Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SWT/Devel/Workflow

< SWT‎ | Devel
Revision as of 13:50, 21 August 2018 by Ericwill.redhat.com (Talk | contribs)

Launching Eclipse with SWT source code

To test SWT snippets, it's useful to launch a child Eclipse with your patch to see how it looks and feels. To do so, under run-configurations, right click on "Eclipse Application" and select "new".

Eclipse Application

Common troubleshooting

Often Eclipse won't launch with various errors. Below are common steps to troubleshoot.

  • API Baseline: Make sure API Base line is set. If you updated Eclipse (e.g Luna to Mars), you may need to re-create the baseline.
  • Enable Execution Environments: Make sure that relevant Execution Environments are enabled. (1.5, 1.6 etc..)
Eclipse Execution Environments
  • Target Platform: Make sure to have an Target Platform set. Try re-creating it with Default for running platform.
  • Validate Plugins: In the run-time configuration for a Child Eclipse, under the 'Plug-ins' tab, instead of launching all plugins, try to select only SWT and it's binaries. Try to Validate the setup to see if there are missing dependencies.
  • re-create new run-time configuration: Often after updating Eclipse version, I have to create new "Eclipse Application" run time configurations for the child Eclipse to launch propertly

Tips

  • Choice of child Eclipse Workspace: Instead of using a blank workspace, copy your exiting workspace, append '-runtime' and use that for your child Eclipse.

Preserving run configurations across workspaces

If you are using the same major version of Eclipse across workspaces, you can copy your run configurations across to prevent losing them. It's highly recommended that you backup your workspace before copying, in case something goes awry.

To find your current launch configurations, navigate to:

 <workspace directory>/.metadata/.plugins/org.eclipse.debug.core/.launches

In this folder, there should be a .launch file for every run configuration created within Eclipse. Copy all these files to:

  <new workspace directory>/.metadata/.plugins/org.eclipse.debug.core/.launches

Launch Eclipse using the new workspace. Open the run configurations dialog, all the old run configurations should be there.

Gerrit

Configure Repository for Gerrit review

Eclipse/SWT uses a code review tool called Gerrit.

Using EGit

It's quite easy to configure Gerrit if you have the EGit plugin installed.

  1. Open the "Git Repositories" view
  2. Expand the "org.eclipse.swt" item (assuming you have the org.eclipse.platform.swt project in your EGit repositories view)
  3. Expand the "Remotes" item
  4. Right click the "origin" item, and select "Gerrit configuration"
  5. Fill in your information from gerrit (username).

Manual configuration

Edit your git config file from the SWT repository. The file is located in top level directory of the org.eclipse.platform.swt git repository:

 .git/config

Then add the review branch:

 [remote "review"]
   url = ssh://YOUR_GERRIT_USER_NAME@git.eclipse.org:29418/platform/eclipse.platform.swt.git
   push = HEAD:refs/for/master

Substitute YOUR_GERRIT_USER_NAME with your username like 'lufimtsev' (not your full email address).

Now you can push patches to review

 git push review

Reviewing Changes

Fetching changes from Gerrit into Eclipse

For simplicity and ease of use, you can fetch changes from Gerrit into Eclipse using Egit (this assumes you have it installed).

To do so, you must know the Gerrit change number, and have your git config set up for review. Note: change number is not the same as change-ID.

To find the change number, go to the gerrit review you intend to fetch and look at the URL to see the change number:

 git.eclipse.org/r/#/c/change_number_will_be_here/ 

You can also look at the header above the commit message, "Change <change_number>".

To fetch it, right click the repository in Eclipse that contains the change, and select "Fetch from Gerrit..." The following window will appear:

Fetch from Gerrit window


Enter the change number from Gerrit and press Ctrl + Space. Eclipse will pull information for the change and provide a drop down menu of patch sets to choose from. Choose the patch set you wish to fetch.

If you wish to create a separate branch with these changes, keep the default selected option and enter a branch name.

If you want the changes applied against the branch you are currently on, select the "Checkout FETCH_HEAD" option. Click finish and Eclipse will fetch the changes into your workspace.

Identifying dependencies between patches

Sometimes you want to know which patches have to be pushed to master before your patch can be merged (dependencies).

"Related changes" will pop up if there are related changes (e.g your patch depends on another patch, or it's a pre-requisite for another patch).

In older versions of gerrit, there were explicit titles for 'parent' patches and 'child' patches. However now one thing to note is that the related changes are listed the same way a 'git-log' is listed. Meaning all dependencies will appear below the current patch etc... Please see documentation for details: [[1]]

Adding API to SWT

SWT API has to be backwards compatible, meaning changing existing API is basically not an option (except in a few cases). However it's very common to add new API -- to do so, follow the steps below.

  1. Add the API. If you are doing this in a common class, you only have to add it once. Otherwise, be sure to add the constant/method to all platforms' classes.
  2. If this is the first time you are adding API in this release cycle, bump the minor "version" fields in the pom.xml and MANIFEST.mf files. For example, 3.107.100 -> 3.108.0
  3. Write the Javadocs, and be sure to include @since tags, indicating the API is available since the API version you just bumped in step 2.


Mylyn

Nice Video tutorials:

 Note, you need to install the 'Gerrit' connector inside mylyn.

Writing new and noteworthy (N&N) posts

If you've added a new feature or fixed a significant bug, it's often useful to write an N&N post. N&N posts are short HTML entries in a milestone's/release's N&N page. The N&N page showcases improvements and features for all aspects of the Eclipse IDE during that milestone/release. To write an N&N post:

  1. Clone the eclipse/news repo
  2. Look for the folder and file corresponding to the milestone/release and component you want to write about (for example: 4.9/platform.html)
  3. Follow the instructions in the HTML page and/or look at other posts as example
  4. Add a new section with a meaningful title and a short description about the feature/bug that was fixed. Images can be added to further demonstrate the fix (follow the instructions in the HTML file re: images)
  5. Upload the change to the gerrit repo for eclipse/news and add a committer from your component to review it

Back to the top