Lubos Eclipse Bblog

Blog about Eclipse and related technology

Eclipse plugin and RCP development notes

This page contains my Eclipse plugin and RCP development notes. I am not developing Eclipse plugin often enough to stay current so this should help me to get re-started with Eclipse plugin development.

I use Diigo to store my links about Eclipse here.

Eclipse Plugins

Following steps can help you with Eclipse Plugin development:

Check following tutorials:

You will need some Eclipse compliant icons for plugin development, here are some:

To leverage Eclipse SDK and use plugins/tools already available in Eclipse, you need to know extension point, here is the documentation.
To learn how to use JFace Views you can use Eclipse JFace TableViewer – Tutorial . To learn how to use wizards, check Creating JFace Wizards.
To learn how to use Eclipse Preferences and Preference Pages you can use Eclipse Preference or Simplifying Preference Pages with Field Editors or check Eclipse preferences customization video.

Pay attention to plugin activation. Eclipse plugins are by default lazily initialized (only when needed), see check "Activate this plugin when one of its classes is loaded" on plugin editor Overview page. You plugin activator, usually subclass of AbstractUIPlugin start() method is only called when the plugin is activated, so if you store static reference to plugin like:

   public void start(BundleContext context) throws Exception {
     super.start(context); plugin = this;
   }
   public static PluginActivator getDefault() { return plugin; }

getDefault() method can return null if referenced before the plugin is activated (for example from your perspective that is restored form workspace instead of created from the perspective factory).

SWT, JFace

SWT is the core UI/presentation framework for Eclipse, JFace is higher level UI/presentation framework for Eclipse:

Menus, Actions, Commands

Eclipse plugins menus are implemented using Actions (older) or Commands, check following links:

Four good articles by Prakash G.R.:

Other menu references:

The standard set of references:

Credit for links to How to Eclipse Commands blog.

The Platform Command Framework uses core expressions for enabledWhen and activeWhen for handlers, programmatic activation of contexts, and for visibleWhen for menu contributions. The command framework provides the IEvaluationContext that command core expressions are evaluate against.

Eclipse Menu Contributions are documented here. If you use Commands you will probably have to use custom property testers to set command visibility visibleWhen and/or handler active state activeWhen and enabled state enabledWhen.

If no activeWhen is specified or if it evaluates to true the handler will be active and associated with the command. Note that command can be associated with more than one active handler, in this case specific rule apply, see Commands Part 2: Selection and Enablement of IHandlers. If command has no active handler, the command is disabled. Still the command will be enabled only if handler is enabled. Handler can be enabled with enabledWhen expression, or by implementing handler.isEnabled(). activeWhen and enabledWhen are similar – with respective to the expression language and lazy loading of the plugin until the command is executed. But there is small difference – your handler might be loaded if the enabledWhen expression returns true and your plugin is already loaded. The enablement also works this way:

  • No enabledWhen specified, plugin is not loaded – command is enabled
  • No enabledWhen specified, but plugin is loaded – consult handler.isEnabled() and set command accordingly
  • enabledWhen specified, returns false, command is disabled (no matter plugin is loaded or not)
  • enabledWhen specified, returns true, plugin is not loaded – command is enabled
  • enabledWhen specified, returns true, plugin is loaded – consult handler.isEnabled() and set command accordingly

To learn more check great screencast from Robert Konigsberg. You will need to declare command handlers, the class org.eclipse.ui.handlers.HandlerUtil provides several convenience methods useful from within the handler execute() method. To get an active shell in handle, use HandlerUtil.getActiveShell(event). To get a window use IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

See Showing menu contributions depending on active perspective for how to make menus visible only for a given perspective.

Note. Property tester receiver can be Collection that contains selected objects. Check for Collection instance and loop through all element to test receiver.

Note. Handler class generated by eclipse from plugin manifest implement IHandler and sets isEnabled to false by default. Unless you have overriding reason to use IHandler, it is better to subclass AbstractHandler instead, which takes care of listeners and sets isEnabled to true by default. Just override AbstractHandler.executed() method.

Note. Eclipse Search menu (org.eclipse.search.menu) doesn’t support Command contributions, so you cannot use org.eclipse.ui.menus extension point to make Search menu contribution. You have to use action sets and org.eclipse.ui.actionSets extension point and use menubarPath org.eclipse.search.menu/dialogGroup (for example) for your action.

If you wish to contribute to already existing Eclipse menus, you will have to make menu contributions. Check Eclipse Plugins Exposed page 1, page 2.

If you need to take a look at Eclipse source, here is Eclipse CVS Howto. I highly recommend to put the repository :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse into Eclipse CVS perspective, and use the repository (directly without downloading the source code projects) to explore Eclipse source code.

Implementing toolbar menu and dynamic menu

Toolbar (like view toolbar) cannot contain menu or another toolbar. To implement menu in toolbar:

  • Create command with pulldown style
  • create org.eclipse.ui.menus menuContribution and define locationURI as menu:<id of the command above>

If you want to define dynamic menu (in toolbar menu or otherwise):

  • define dynamic in the menuContribution and define class that extends CompoundContributionItem, implement method getContributionItems(), set the command parameter for each dynamic item created
  • associate dynamic with command with parameter and with handler, in execute() method retrieve the parameter value and act on it
  • handler should implement IElementUpdater and updateElement() method to set selection for RADIO or CHECK items

Following is a set of links for toolbar and dynamic menus:

Extension points and Extensions

Adding an extension point (publish extension) and load (consume) the extensions defined by the extension is a fairly involved and not very well documented procedure. But you can always rely on excellent Lars Vogel tutorial Eclipse Extension Points and Extensions – Tutorial.

Old way to load extensions was static and usually happened only while your plugin was being loaded. New approach uses IExtensionChangeHandler to load or remove the extension during the lifetime of your plugin. See the article OSGi, Dynamics and Eclipse « EclipseSource Blog for excellent explanation how to dynamically add/load or remove extensions based on your extension point.

Tutorials

Writing an Eclipse plugin (by cvalcarcel):

Dialogs

Search Pages and Dialogs

Using Eclipse Search

Following section describes how to leverage Eclipse build-in text search to search in Eclipse resources.

  • Main search engine class: org.eclipse.search.core.text.TextSearchEngine
  • Examples of use:
    • org.eclipse.search.internal.core.text.TextSearchVisitor
    • org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertyKeyHyperlink
    • org.eclipse.search.internal.ui.text.FileSearchQuery
    • org.eclipse.jdt.internal.corext.refactoring.util.QualifiedNameFinder
    • org.eclipse.search.core.text.TextSearchRequestor
    • org.eclipse.search.internal.ui.text.FileSearchResult
    • org.eclipse.search.ui.text.AbstractTextSearchResult
    • org.eclipse.search.ui.NewSearchUI
  • Example source code:
     
    	// get allEntries and sourceFiles somehow
    	final List&lt;myentry&gt; foundEntries = new ArrayList&lt;myentry&gt;();
    	TextSearchEngine engine = TextSearchEngine.create();
    	for (MyEntry entry : allEntries) {
    		Pattern searchPattern = Pattern.compile(getPatternFromEntry(entry));
    		ResultCollector collector = new ResultCollector(foundEntries, entry);
    		IStatus status = engine.search(sourceFiles, collector, searchPattern, monitor);
    	}
    
    	private static class ResultCollector extends TextSearchRequestor {
    
    		private List&lt;myentry&gt; results;
    		private MyEntry entry;
    		
    		public ResultCollector(List&lt;giresourceentry&gt; results, GIResourceEntry entry) {
    			this.results = results;
    			this.entry = entry;
    		}
    
    		@Override
    		public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) throws CoreException {
    			// You might do sdome logic and extend matching data from TextSearchMatchAccess
    			results.add(entry);
    			return true;
    		}
    	}
    

Progress Monitors, Jobs, Concurrency

For progress monitors start with this excellent overview.

Workbench Views

Properties

Files, Editors

Closing editor programatically:

  • From inside the editor do: this.getEditorSite().getPage().closeEditor(this, false);
  • From the "outside" do: editor.getEditorSite().getPage().closeEditor(editor, false); Check apidocs of IWorkbenchPage to find out about the second parameter

    and other convenience methods for closing all editors and the like.

Articles an tutorials for creating new Eclipse editors:

Drag and drop classes to explore:

  • org.eclipse.ui.internal.ide.EditorAreaDropAdapter
  • org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor
  • org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor

Developing multi-page form editor:

Resource handling, Common Navigator Framework

Natures, Builders, Markers

Markers are not quite as lightweight as Eclipse documentation states, it takes quite some time to add thousands or ten thousands of markers. If you have so many markers, install Part listener using PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(new YourPluginPartListener2());.

Decorators

Help System

Help should be implemented in separate plugin like your.plugin.help, the help plugin should have following dependencies:

  • org.eclipse.help,
  • org.eclipse.ui.ide,
  • org.eclipse.ui.cheatsheet

Your plugin should contain following Help System related dependencies:

  • org.eclipse.help
  • org.eclipse.help.ui
  • org.eclipse.help.webapp

Useful links:

To register help with dialogs use PlatformUI.getWorkbench().getHelpSystem().setHelp(container, helpContextId), for wizard pages override DialogPage.performHelp() and call help directly using PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpContextId).

Implementing Intro, Welcome page

The new intro system is quite badly documented and it is not clear to me how to set it up so the Welcome page uses Intro instead of old 2.0 welcome.xml. I can make Intro contribute for initial (first time start) Intro, but then in RCP application the action ActionFactory.INTRO.create(window) calls the old welcome.xml from Help/Welcome instead of new Intro like Eclipse IDE does. I got advise on newsgroup about “bind the command "org.eclipse.ui.help.quickStartAction" to the Welcome menu item”, but I am not sure how to do that.

Internationalization

Good background information on internationalizing plug-ins can be found in the Eclipse Foundation’s articles:

P2 provisioning and software installs/updates

Tips, Tricks and How to

Following notes contain small code howto snippets useful for Eclipse plugin development :

  • To get all projects in workbench:
 
  IProject[] projects = ResourcePlugin.getWorkspace().getRoot().getProjects(); 
  • To get Eclipse installation configuration location:
 
  Location loc = Platform.getConfigurationLocation(); 
  • FAQ How do I find out the install location of a plug-in?
     
    	public static String getFilenameInPlugin(String pluginId, String fileLocation) {
    		Bundle bundle = Platform.getBundle(pluginId);
    		Path path = new Path(fileLocation);
    		URL fileURL = FileLocator.find(bundle, path, null);
    		if (fileURL == null) return null;
    		try {
    			fileURL = FileLocator.toFileURL(fileURL);
    			return new File(fileURL.getFile()).getAbsolutePath();
    		} catch (Exception e) {
    			logError(&amp;quot;Unable to get file: &amp;quot; + fileLocation + &amp;quot; from plugin: &amp;quot; + pluginId, e);
    		}
    		return null;
    	}
    

 

 
  public static MessageConsole findConsole(String name) { 
    ConsolePlugin plugin = ConsolePlugin.getDefault(); 
    IConsoleManager conMan = plugin.getConsoleManager(); 
    IConsole[] existing = conMan.getConsoles(); 
    for (int i = 0; i &amp;amp;lt; existing.length; i++) 
      if (name.equals(existing[i].getName())) 
        return (MessageConsole) existing[i]; 
    //no console found, so create a new one 
    MessageConsole myConsole = new MessageConsole(name, null); 
    conMan.addConsoles(new IConsole[]{myConsole}); 
    return myConsole;
  } 

  public static void writeToConsole(String message) { 
    MessageConsole myConsole = findConsole(CONSOLE_NAME); 
    MessageConsoleStream out = myConsole.newMessageStream(); 
    out.println(message); 
    // Make console visible 
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); 
    try { 
      IConsoleView view = (IConsoleView) page.showView(IConsoleConstants.ID_CONSOLE_VIEW); 
      view.display(myConsole); 
    } catch (Exception e) { 
      Log.logError(&amp;quot;Unable to display Console View&amp;quot;, e); 
    } 
  }
  • To create links in your console you have to, define extension point org.eclipse.ui.console.consolePatternMatchListeners and define regex attribute like regex="\(.*:(\d+|(\d+-\d+))\, and class attribute like class=”my.plugin.PatternMatchListenerDelegate". Then you have to create delegate class PatternMatchListenerDelegate that implements IPatternMatchListenerDelegate, and in matchFound() method get console, offset and length (of the console content), and text console.getDocument().get(offset, length). Then parse the text and create your own link that implements IHyperlink, and add that link to console.addHyperlink(link, offset, length).
  • Application specific Console
  • How to write a hyperlink to an eclipse console from a plugin
  • How link Eclipse Console text to source code? – note this will not work with your own console
  • Console Pattern Match Listeners
  • Create internal web browser editor
     
      try {
        IWebBrowser browser = YourPluginActivator.getDefault().getWorkbench().getBrowserSupport().createBrowser(YOUR_BROWSER_ID);
        URL url = new URL(urlStr);
        browser.openURL(url);
      } catch (Exception e) {
        YourPluginLog.logError(&amp;quot;Failed to open browser at: &amp;quot; + urlStr, e);
      }
    
  • Set/reset wait cursor:
     
      Cursor cursor = Display.getDefault().getActiveShell().getCursor();
      Cursor waitCursor = Display.getDefault().getSystemCursor(SWT.CURSOR_WAIT);
      Display.getDefault().getActiveShell().setCursor(waitCursor);
      ....
      Display.getDefault().getActiveShell().setCursor(cursor);
    
  • Open type dialog for classes in current project with nature JavaCore.NATURE_ID (requires org.eclipse.jdt.core):
     
      IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[]{JavaCore.create(project)}, IJavaSearchScope.SOURCES);
      SelectionDialog dlg = JavaUI.createTypeDialog(e.display.getActiveShell(), new ProgressMonitorDialog(e.display.getActiveShell()),
        scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false);
      int status = dlg.open();
    
  • Intercepting hyperlinks in SWT browser is not straightforward, following code is an example how I managed to intercept hyperlink click and display the link in internal browser:
     
      private Browser dummyBrowser;
      ....
      dummyBrowser = new Browser(parent, SWT.EMBEDDED);
      setupBrowser(dummyBrowser);
      ....
      Browser browser = new Browser(folder, SWT.EMBEDDED);
      setupBrowser(browser);
      ....
      private void setupBrowser(Browser browser) {
    	browser.addOpenWindowListener(new OpenWindowListener() {
    		public void open(WindowEvent event) {
    			event.browser = dummyBrowser;
    			event.required = true;
    		}
    	});
    	browser.addLocationListener(new LocationListener() {
    		@Override
    		public void changing(LocationEvent event) {
    		}
    		@Override
    		public void changed(LocationEvent event) {
    			String urlStr = event.location;
    			if (urlStr == null || !urlStr.startsWith(&amp;quot;http:&amp;quot;)) return;
    			try {
    				IWebBrowser browser = MyPluginActivator.getDefault().getWorkbench().getBrowserSupport().createBrowser(MyPluginActivator.BROWSER_ID);
    				URL url = new URL(urlStr);
    				browser.openURL(url);
    			} catch (Exception e) {
    				MyPluginLog.logError(&amp;quot;Failed to open browser at: &amp;quot; + urlStr, e);
    			}
    		}
    	});
      }
    
  • Calculate widget/control width based on text size (can be used in int computeWidth(Control control)):
     
    	GC gc = new GC(control);
    	gc.setFont(Display.getCurrent().getSystemFont());
    	int width = gc.textExtent(&amp;quot;123456&amp;quot;).x;
    	gc.dispose();
    
    	((Text) control).computeTrim(0, 0, width, 0).width;
    
  • Execute UI code in any thread (UI or non UI)
    	// If this is the UI thread, then make the change.
    	if (Display.getCurrent() != null) {
    		// Do the work
    		return;
    	}
    	// otherwise, redirect to execute on the UI thread.
    	Display.getDefault().asyncExec(new Runnable() {
    		public void run() {
    		// Do the work
    		}
    	});
        
  • Execute command programmatically:
     
      IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class);
      handlerService.executeCommand(&amp;quot;id.of.the.command&amp;quot;, null);
        
  • Display Java String Externalization wizard:
     
    	IEditorPart editor = null;
    	try {
    		editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    	} catch (Exception e) {
    	}
    	if (editor == null || !(editor instanceof CompilationUnitEditor)) return;
    
    	ExternalizeStringsAction action = new ExternalizeStringsAction((CompilationUnitEditor)editor);
    	ISelection selection = YourPluginActivator.getDefault().getSelection();
    	if (selection instanceof ITextSelection) {
    		action.run((ITextSelection)selection);
    	} else if (selection instanceof IStructuredSelection) {
    		action.run((IStructuredSelection)selection);
    	}
        
  • How to open two editors in splitscreen?
     
      // get the current workbench page
      IWorkbenchPage activeWorkbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      WorkbenchPage page = (WorkbenchPage) activeWorkbenchPage;
    
      // get the editor area and set the default workbook active
      EditorSashContainer editorArea = (EditorSashContainer) page.getEditorPresentation().getLayoutPart();
      editorArea.setActiveWorkbookFromID(&amp;quot;DefaultEditorWorkbook&amp;quot;);
    
      // open the editor for the first part
      IDE.openEditor(page, getIEditorInput1(), getEditorId1());
    
      // get the second workbook or create a new one
      EditorStack newWorkbook;
      if (editorArea.getEditorWorkbooks().size() &amp;gt; 1) {
        newWorkbook = (EditorStack) editorArea.getEditorWorkbooks().get(1);
      } else {
        newWorkbook = EditorStack.newEditorWorkbook(editorArea, page);
        editorArea.add(newWorkbook);
      }
      // activate the second workbook
      editorArea.setActiveWorkbook(newWorkbook, true);
    
      // open the second editor
      IDE.openEditor(page, getIEditorInput2(), getEditorId2());
        
  • Running application launch programmatically (JUnit):
     
      ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType launchConfig = launchManager.getLaunchConfigurationType(&amp;quot;org.eclipse.jdt.junit.launchconfig&amp;quot;);
      ILaunchConfigurationWorkingCopy workingCopy = launchConfig.newInstance(null, &amp;quot;name&amp;quot;);
      workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, &amp;quot;javaprojectname&amp;quot;);
      workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, &amp;quot;testclassname&amp;quot;);
      workingCopy.setAttribute(&amp;quot;org.eclipse.jdt.junit.TEST_KIND&amp;quot;, &amp;quot;org.eclipse.jdt.junit.loader.junit4&amp;quot;);
      ILaunchConfiguration config = workingCopy.doSave();
      config.launch(ILaunchManager.RUN_MODE, null);
        
  • Fairly common requirement is to programmatically refresh resources especially the ones open in editor. But there in no easy way to do it programmatically. Following are the two ways I found how to trigger refresh:
     
      // trigger a refresh
      IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
      if (handlerService != null) {
    	try {
    		handlerService.executeCommand(&amp;quot;org.eclipse.ui.file.refresh&amp;quot;, null);
    	} catch (Exception e) {
    	}
      }
    
      If you have a resource available you can call refreshLocal() on it:
    
      IFile resource = &lt;get resource somehow&gt;
      if (resource != null) resource.refreshLocal(IResource.DEPTH_INFINITE, monitor);
        
  • Programmatically changing perspective
  • FAQ How do I find out what view or editor is selected?
  • FAQ: Eclipse Plug-in Development
  • FAQ: Plugin Development Environment
  • FAQ: When does a plug-in get started
  • Lazy Start Bundles Bundle-ActivationPolicy
  • If you need to handle selection, check Use the Selection Service
  • SourceFolderClassFileContainer
  • How to get the project name in Eclipse
  • Eclipse runtime options
  • To retrieve application command line options: String [] args = Platform.getApplicationArgs();
  • To run background (long running jobs) see Lars Vogel’s excellent tutorial (one of many) Eclipse Jobs
  • Can I make a job run in the UI thread
  • To write to workbench status line see FAQ: How do I write a message to the workbench status line
  • FAQ: Diagnose Bundle Start
  • FAQ: PDE/Build
  • FAQ: PDE/API Tools
  • FAQ: How do I find the active workbench page
  • FAQ How do I load and save plug-in preferences?
  • Plugin Spy
  • SWT Spy
  • Using IAdaptable and Adaptors
  • How do I find the active workbench page
  • When developing an Eclipse plugin, how to get access to the project’s Java Model and AST root node?
  • EclipseUtils.java
  • EclipseSearchUtils.java
  • Creating Java Projects Programmatically in Eclipse
  • How to subscribe to an OpenProject event in Eclipse?
  • Patch a plugin with a single class?
  • Eclipse plug-in on project loaded.
  • Eclipse-plugin how to get current text editor cursor position
  • How to get cursor position in an eclipse TextEditor
  • How to get the cursor position in the CEditor?
  • How do you disable/hide menu items contributed by other plugins: Is it possible to hide/remove arbitrary context menu items in Eclipse, FAQ How do I add activities to my plug-in?, and Activities definition
  • Filtering large user interfaces – Activities
  • JFace ErrorDialog: how do I show something in the details portion?
  • JDT UI source code

If you have problem with some packages not being exported from your plugin check the following:

  1. Make sure they are in the Build Configuration -> Order and Export area, and they are check for export.
  2. Make sure you have the packages exported in the manifest (PDE Tools -> Open Manifest -> Runtime tab)
  3. In the same place as above, make sure the JAR files are in the manifest classpath.
  4. (as Al says below), make sure the build properties has your jars marked for exclusion (though this is not likely your issue as you are getting errors compiling).

If all of this is done (and it’s still not working), do a clean build an restart eclipse. Sometimes the Eclipse gets a little confused about this and a restart helps.

If you get ClassNotFoundException when referencing different plugin (e.g. you have core and ui plugins), make sure that classes and libraries are on classpath, usually classes are in bin directory, include explicitly all your external libraries from lib/… . You might also include . as top directory if you are loading resources like config files from root.

If you need to access configuration files included in plugin, make sure you configure them in feature.xml Plug-ins tab as “Unpack the plugin archive after installation”.

If your plugin exports libraries, they have to be individually listed in PDE Tools -> Open Manifest -> Runtime tab in Classpath and packages to be exported from the libraries has to be listed in Runtime tab Exported packages. See also this FAQ item.

Eclipse RCP

To get started with Eclipse RCP development you should install Eclipse RCP delta pack to support multiple platforms, here are some useful links:

Note, do not unzip deltapack directly into Eclipse install, use Eclipse/Preferences/PDE Development as described in Using deltapack in Eclipse 3.5.

Review the older but still very useful Eclipse RCP tutorial from Ed Brunette:

Another useful RCP tutorials:

And check the official Eclipse RCP web site RCP FAQ.

If you need to create a intro/welcome, cheatsheet or help page for your RCP application or plugin read "Get to know Eclipse User Assistance."

Custom branding and splash screen

Debugging and testing Plugin or RCP

You can run or debug the plugin or RCP application from the Overview tab of the plugin or RCP.  It will create a launch configuration if it doesn’t exist. If you need to start from scratch, you can reset the workspace before the launch. To do that, check Clear workspace (on Main tab). Optionally, you can check "Clear the configuration area before launching" in Configuration tab.

Make sure you have -consoleLog as a Program Argument in your launch configuration. You may also want to take a look at these runtime tools.

Testing tools:

I did not have much luck with Window Tester, and I did not try to use SWTBot because I had feeling from documentation and blogs that it requires. Too many changes to tested object. I installed and started using Jubula and I am quite impressed. It is still not trivial to get going and I recommend following steps:

  • Install standalone version of Jubula from http://eclipse.org/jubula/
  • Read or at least skim the documentation in the installation and read the blogs above
  • Export your RCP product and install <jubula installation>/rcp-support.zip plugin org.eclipse.jubula.rc.rcp_… in your product plugins directory
  • Edit you product’s configuration/config.ini and add “,org.eclipse.jubula.rc.rcp” to the end of the property osgi.bundles=
  • Start the AUT agent (on Windows from Start/All Programs/Jubula)
  • Follow the documentation to create AUT, create and execute tests

Remote debugging of RCP application

  • Add following to –vmargs of yourapplication.ini:

-Xdebug

-Xnoagent

-Djava.compiler=NONE

-Xrunjdwp:transport=dt_socket,suspend=y,server=y,address=8000

  • Create Debug launch configuration, select appropriate project with your RCP application and Connection Standard (Socket Attach), with Host (localhost) and Port (8000)
  • Start your RCP application
  • Start your remote launch configuration in debug mode

Building plugins, features

Automated build of plugins and features without Eclipse IDE is challenge task. Check bottom of this blog and P2 Publisher (new in Eclipse 3.5). See also Eclipse PDE Build – Tutorial.

Versioning is described in MANIFEST.MF and feature.xml versioning rules.

To prevent custom build.xml being overwritten, see FAQ How do I prevent my build.xml file from being overwritten (puts custom = true into build.properties).

There are two tools that makes building Eclipse plugins and RCP, they are Buckminster and Tycho. If you use Maven, you should hav strong look at Tycho, if you prefer And as your build tool, consider:

Adding Update Support

There is a great tutorial Adding Self-Update to an RCP Application at Eclipse Wiki. You can also check EclipseSource Equinox p2 website and Eclipse p2 website, and this note.

Here is some code how to handle updates programatically Using Equinox P2 – Getting information about installed features and plugins.

Eclipse3 to Eclipse4

10 Responses to “Eclipse plugin and RCP development notes”

  1. the free poker room said

    Howdy I am so happy I found your website, I really found you by accident, while I was researching on Google for something else, Regardless I am
    here now and would just like to say kudos for a incredible post and a all round interesting
    blog (I also love the theme/design), I don’t have time to look
    over it all at the moment but I have saved it and also added in your RSS feeds, so when
    I have time I will be back to read a great deal more, Please do keep up the great b.

  2. I am genuinely delighted to glance at this weblog posts which contains tons of valuable
    data, thanks for providing these information.

  3. Hello There. I found your blog using msn. This is
    a very well written article. I’ll make sure to bookmark it and return to read more of your useful information. Thanks for the post. I’ll certainly comeback.

  4. Alpesh Rathod said

    Very nice articles….liked a lot :) Keep it updated.

  5. chepa653 said

    I like this post! A lot of structured information in one bundle! Thanks very much, Appreciate this!

  6. [...] Eclipse plugin and RCP development notes [...]

  7. Your post offers verified helpful to me. It’s really informative and you are naturally quite educated of this type.
    You get opened my own face in order to various opinion of this specific subject together with intriquing, notable and reliable written content.

  8. Many thanks for such a great blog. Where else could anybody
    get that kind of info written in such a great way?
    I have a presentation that i’m presently writing on, and I have been on the look out for such fantastic information. Pleased to find your site.

  9. Ativan said

    I just couldn’t go away your site before suggesting that I actually enjoyed the usual info a person provide for your guests? Is gonna be again ceaselessly to investigate cross-check new posts

  10. […] Eclipse plugin and RCP development notes « Lubos Eclipse … – This page contains my Eclipse plugin and RCP development notes. I am not developing Eclipse plugin often enough to stay current so this should help me to get re …… […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: