Posts Tagged ‘Planet’

Knights of the round table – Eclipse committer election

Friday, February 19th, 2010

Eclipse Committer Election is starting as of 22. Febr. This is the first year I’m allowed to vote therefore I’m thinking what should guide my vote.

I recently read the book The Art of Community from Jono Bacon.

Jone speaks about the concept of Meritocracy.

A meritocracy is a system of governance in which its members are given responsibilities and recognition based upon achievements, merit, and talent. Those who are part of a meritocracy (such as in the Ubuntu and other open source communities) can make tremendous advances in respect and responsibility by simply doing good work. In these communities, money, class, and family connections have little or no impact on the ability to progress and build a reputation.

I believe that is an excellent concept and my vote will be guided by this principle. For an excellent summary of the committer project activities please see the How active is your-Committer blog entry from Ed Merks.

In addition to the involvement of the candidates in Eclipse projects I will also consider their community activity and attitude in the other Eclipse channels, e.g. their twitter activity, blog posts, email, etc.

I’m looking forward to the election; I think we have lots of great candidates.

 

Eclipse 3.6M4 – Tiny nice things

Saturday, December 12th, 2009

I personally believe that little things make a difference. Eclipse 3.6 is going to be great for new (and perhaps also for experienced) plugin and RCP developers.

Especially I like in the Eclipse 3.6M4 release:

-consoleLog included per default in a new launch configuration
RCP with a View

I believe the solution of Bug for -consoleLog will solve the most common problem with getting started for new Plugin / RCP developers. Also the update of the PDE RCP templates will hopefully guide new developers in using commands instead of actions.

The change in Bug for -consoleLog was also a community decision, which is a good example that Eclipse does consider user feedback.

Thanks to all involved parties and the Eclipse community for these changes. :-)

Update Unfortunately Mail Template was not part of M4.

 

Re-using the Eclipse proxy preference settings in your Eclipse RCP application

Tuesday, December 8th, 2009

The following demonstrates how to re-use the Eclipse proxy preferences in an Eclipse RCP application.

Create a project “de.vogella.rcp.net.proxy” and select the “RCP application with a view” as template.

Add the preferences command to your application. See Eclipse Preferences Tutorial for details.

Add the plugin “org.eclipse.ui.net” and “org.eclipse.core.net” as dependency to your plugin.

Run your plugin and open preferences.

proxy_settings

Fantastic! You already have the preference dialog.

Now change your view to the following.


package de.vogella.rcp.net.proxy;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import org.osgi.framework.FrameworkUtil;
import org.osgi.util.tracker.ServiceTracker;

public class View extends ViewPart {
	public static final String ID = "de.vogella.rcp.net.proxy.view";
	private final ServiceTracker proxyTracker;

	public View() {
		proxyTracker = new ServiceTracker(FrameworkUtil.getBundle(
				this.getClass()).getBundleContext(), IProxyService.class
				.getName(), null);
		proxyTracker.open();
	}

	/**
	 * This is a callback that will allow us to create the viewer and initialize
	 * it.
	 */
	public void createPartControl(Composite parent) {
		StyledText text = new StyledText(parent, SWT.NONE);
		text.setText(readWebpage());
	}

	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}

	private String readWebpage() {
		BufferedReader in = null;
		StringBuffer sb = new StringBuffer();

		try {
			URI uri = new URI("http://www.vogella.de");
			IProxyService proxyService = getProxyService();
			IProxyData[] proxyDataForHost = proxyService.select(uri);

			for (IProxyData data : proxyDataForHost) {
				if (data.getHost() != null) {
					System.setProperty("http.proxySet", "true");
					System.setProperty("http.proxyHost", data.getHost());
				}
				if (data.getHost() != null) {
					System.setProperty("http.proxyPort", String.valueOf(data
							.getPort()));
				}
			}
			// Close the service and close the service tracker
			proxyService = null;

			URL url;

			url = uri.toURL();

			in = new BufferedReader(new InputStreamReader(url.openStream()));
			String inputLine;

			while ((inputLine = in.readLine()) != null) {
				// Process each line.
				sb.append(inputLine + "\n");
			}

		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (URISyntaxException e) {
			e.printStackTrace();
		} finally {
			if (in != null) {
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

		}
		return sb.toString();

	}

	public IProxyService getProxyService() {
		return (IProxyService) proxyTracker.getService();
	}

	@Override
	public void dispose() {
		proxyTracker.close();
		super.dispose();
	}

}

If you run your application behind a firewall and if you have maintained the proxy correctly then the View should display the HTML code.

Hope this helps!

 

Eclipse e4 – Using the modeled user interface editor

Wednesday, August 26th, 2009

Update This description has been updated in the following tutorial: Eclipse e4 tutorial.

In the Eclipse e4 webseminar I learned about the e4 UI editor which allow you to change the user interface on the fly.

As you most likely know the Eclipse UI is modelled as an Eclipse EMF model. This model can be changed during directly in Eclipse via the editor or via the EMF API (I have not yet tested this) and the UI will change immeadiately according to the change.

To following my example you need the E4 0.9 download from Eclipse E4 0.9 download.

Start Eclipse e4 tutorial. Select Window -> UI Editor

e4modelledui10

Open the WorkbenchWindow

e4modelledui20

You can now modify the model, e.g. you can drag the package explorer on the same level as the Java perspective.

e4modelledui30

I believe the modeled UI concept is really powerful as it exposes the internal state of the Eclipse based apllication via a well-defined model with a clear API.

Kudos to the Eclipse e4 team!

 

Eclipse Papercut #4 – Modifying Eclipse PDE default launch configuration

Monday, July 27th, 2009

In this episode of the Eclipse Papercut series I will change the default PDE launch configuration. During this process I show how to get and modify Eclipse PDE code.

Lets define the papercut:

One thing I always have to do during plugin and Eclipse RCP development is to make the following settings in the launch configuration:

  1. add -consoleLog in the arguments tab
  2. Select the flag “Validate plug-in automatically prio to launching” on the plug-ins tab

This papercut has two dimensions.

The first one is that for everybody who knows about these settings it is not a problem to set them up. It is just time-consuming and error prone. Sometimes I’m searching why something does not work and then I’m banging my head because I forgot to set -consoleLog.

The second dimension is that this default launch configuration makes it harder for new plugin and Eclipse RCP developers to get started. I frequently see questions in the Eclipse newsgroup and other places which can be answered by: “please set -consoleLog” or “press the Validate button”.

So I seek to change the current behavior.

Adding “-consoleLog” is easy. Go to preference, select the target platform, select “Edit” and add -consoleLog as a argument.

target10

target20

Of course this does not help the new developers but I come back to this later in this post.

To set the “Validate plug-in automatically prio to launching” flag we have to look into Eclipse PDE code.

A launch configuration is contributed by the extension point “org.eclipse.debug.core.launchConfigurationTypes”. To search through your existing plugins import your plugins into a new workspace. A plugin search reveals that “org.eclipse.pde.ui” contributes such an extension.

Eclipse PDE can be found in the Eclipse cvs via the repository path “/cvsroot/eclipse”. Search here for the folder “pde” which contains the pde plugins. Checkout the plugin “org.eclipse.pde.ui”.

Here we find quickly the right extension point.

pde10

After some pocking around the code and some debugging I found the class “AbstractPluginBlock” and the method “setDefaults”. The change is trivial:

public void setDefaults(ILaunchConfigurationWorkingCopy config) {
	config.setAttribute(IPDELauncherConstants.INCLUDE_OPTIONAL, true);
	config.setAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true);
	config.setAttribute(IPDELauncherConstants.AUTOMATIC_VALIDATE, true); // This has changed from false to true
	config.setAttribute(IPDELauncherConstants.SHOW_SELECTED_ONLY, false);
}

If you now run Eclipse with this adjusted plugin the flag “Validate…” will be flagged for a new runtime configuration.

Now lets return to the addtion of “-consoleLog” to the target platform. I argued earlier that the absence of “-consoleLog” makes it harder for beginner to get started with plugin and RCP development. Changing the target platform is not trivial for starters, so the better solution was if was part of the standard code.

We find the relevant code easily with a text seach for an existing launch parameter, e.g. “-arch”. The responsible class is “LaunchArgumentsHelper” and the method getInitialProgramArguments(). We add “-consoleLog” to the following line:


StringBuffer buffer = new StringBuffer("-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"); //$NON-NLS-1$

Thats it. By deploying the plugin into our Eclipse IDE we have the changed behavior.

I have submitted bugs and attached the patches. Bug Report for “Validate plug-in automatically prio to launching” and Bug Report for -consoleLog.

I hope that these patches will get accepted. If they would be accepted I believe it would be a little easier for new developers to get started.

If someone finds a reason why these settings should not always be the default I would suggest a new PDE preference page which contains the settings for these launch parameters.

 

Hello Planet Eclipse,

Friday, July 24th, 2009

My blog posts are now aggregated on Planet Eclipse and I want to follow the ancient tradition of introducing myself.

I try to help others to learn the Eclipse platform by providing Eclipse Tutorials, for example about Eclipse RCP. More about me can be found here.

While the intent of my articles is to cover larger and hopefully timeless topics, my blog posts cover less large and less timeless ;-) topics related to Eclipse. The remaining things I tweet at Twitter.

Currently I’m writing the 7 Papercuts in Eclipse series in which I discuss usability issues in the Eclipse platform and how to overcome them.

I hope that you will find my posts enjoyable and useful.