User interface improvements in the upcoming Eclipse 4.4 Luna release

I recently crossed paths with my good friend Oliver Gierke from Pivotal, the company behind the the Spring framework.

Oliver complains since a while about the Eclipse 4 IDE user interface experience. His complains could be summerized by the following picture.

Now fortunately we met at the german JAX conference and I could tell him about the numerous improvements in the UI which the platform team did. They are displayed in the next picture.

I was happy to hear from Oliver that he really likes these changes and is looking forward to Eclipse 4.

Posted in Eclipse, Lars Vogel | 10 Comments

Generics, Eclipse, JFace, and Google Summer of Code

Greeting readers,

My name is Jeanderson Candido, I am undergrad in Computer Science at Federal University of Campina Grande, Brazil, and I will be writing about the cool things we are doing to the Eclipse project in the 10th edition of Google Summer of Code.

Continue reading

Posted in Jeanderson Candido, Other | Tagged , | 6 Comments

LanguageTool

The mission of vogella is to provide everyone with developer knowledge in plain simple English whether by online tutorials, books or training materials. Improving the text quality is a constant endeavour. It has to be done, because flawed texts become hard and annoying to read. Everyone who wrote a longer work knows, it can be a pain to proof-read spelling, grammar and style. It screams for automatism. However, the simple spell-check, that comes with most tools, is often not smart enough to detect your errors. There has to be a solution and there is!

Continue reading

Posted in Eclipse, Java, vogella | Comments Off

Eclipse Bugzilla new favicon

Yeah! Eclipse Bugzilla got an Eclipse flavored favicon. See Bug report.

This helps to get your tabs organized if you happen to have Bugs and Eclipse pages open.

bugzillanewicon

Posted in Eclipse, Lars Vogel | 3 Comments

Welcome Sopot Cela as a new eclipse.platform.ui Committer

I would like to welcome Sopot and new platform.ui committer. See the message on the platform.ui mailing list.

Posted in Eclipse, Lars Vogel | Comments Off

Eclipse and the Ubuntu team working together – Solving the Eclipse menu issue under Ubuntu

I’m very happy to report that the Eclipse platform team worked together with the Canonical Ubuntu team to solve the broken menu issue of Eclipse under Ubuntu. This fix is available for Ubuntu 14.04.

It just to be the case that the menu of the Eclipse IDE did not work out of the box under Ubuntu and you had to use several tricks to make Eclipse work. This was relatively hard to discover for new users of Eclipse under Ubuntu and increased the barrier in using Eclipse.

We (Eclipse platform team) reached out to the Ubuntu team and William Hua from Canonical did solve this issue. I would like to thank William and the whole team from Ubuntu for that effort, they could also have pushed the issue back to the Eclipse side. But they went through the extra effort to solve it on their Ubuntu side. Kudos to them!

Thanks to William for doing most of the work, and also a big thanks to all involved parties, including Jono Bacon, Jason Warner from Canonical and Aleksandar Kurtakov, Paul Webster, Ian Skerrett and Mike Milinkovich from the Eclipse side. Especially thanks to Aleksandar Kurtakov from Red Hat for answering GTK3 SWT questions.

See Ubuntu Launchpad bug report for details.

Posted in Eclipse, Lars Vogel | Tagged , | 9 Comments

Eclipse platform contributors – please convert any patch you have to a Gerrit review

Yesterday Michael Keppler commented on my latest blog post the following:

Although the general process for contributions has improved, there is still quite a difference between what a single _committer_ can do, and what a single _contributor_ can do. It is frustrating if you create bug reports or patches, and no one looks at them. As a (non committer) contributor, you still very much depend on project committers, and their time is a scarce resource. Therefore, from the outside it does not look that easy to me as described by you.

I assume Michael is referring to patches in Bugzilla. The platform.ui team (and I believe the JDT team also) is IMHO good in reviewing Gerrit contributions. I agree that patches in Bugzilla tend to get ignored, I was no one has the time to find and review them.

So please convert any patch you have to a Gerrit review. See Eclipse platform contributions for a description of the required setup.

Posted in Eclipse, Lars Vogel | 3 Comments

Eclipse contributions – What difference can a single developer make?

I frequently hear that a single developer cannot make a difference for the Eclipse project. I think that is not true. The Eclipse project page show that in a lot of projects a handful of developers make most of the work.

See for example JDT project page and you see that Stephan Herrmann makes 24 % of the changes in JDT.

jdt_contributions

Kudos to Stephan for this. I hope others see this as opportunity to get involved into Eclipse development and to make a difference. See Eclipse platform development guide for starting points.

If you live close to Hamburg, please join our Eclipse Hackathon Friday this week.

Posted in Eclipse, Lars Vogel | Tagged | 5 Comments

Using Eclipse application model persisted state to specify the SWT stylebits

With Eclipse Luna M6 and M7 we introduced the possibility to set the stylebits for user interface controls via persisted state data. Use “styleOverride” as key and the integer value for the SWT stylebits you want to use.

For example to create a SWT shell which cannot be resized you need to supply the integer value for SWT.SHELL_TRIM & (~SWT.RESIZE), which is 1024 on the MWindow application element.

styleOverride

If your MPartStack should render its tab below the parts, use 1024.

This results in the following application (in which the window cannot be resized).

styleOverrideresult

Posted in Eclipse, Java, Lars Vogel | Tagged , | 2 Comments

Eclipse Luna M6 – Localization Update

With Eclipse Luna M6 there are some interesting news about localization.

Locale changes at runtime

The application model is now able to react on Locale changes at runtime. In combination with the Eclipse Translation Pattern that comes with the New Message Extension, an Eclipse based application can be re-localized at runtime. For this the MLocalizable mixin interface was introduced, which is now implemented by every model class that contains localizable information, e.g. MUILabel. In this blog post I would like to show how to change the locale at runtime with the new extension, rather than explaining the internals that enables this.

In a previous blog post I described how to change the Locale directly via setting the value to the context. With Luna M6 you should use the newly introduced ILocaleChangeService. This is because the default implementation of that service is updating the Locale in the application context and notifies the model elements. Additionally the ILocaleChangeService posts an event for the topic org/eclipse/e4/core/NLS/LOCALE_CHANGE to the event broker.

A command handler for changing the Locale would now look like this:

/**
 * Item that can be added as a ToolControl to the TrimBar of a
 * Window. Shows an input field which allows to enter a
 * locale String and a Button to send the action to update
 * the Locale.
 */
public class LocaleChangeItem {

	Button button;

	@Inject
	ILocaleChangeService lcs;

	@Inject
	public LocaleChangeItem(Composite parent) {
		final Text input = new Text(parent, SWT.BORDER);
		input.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				if (e.keyCode == SWT.CR
					|| e.keyCode == SWT.KEYPAD_CR) {
					lcs.changeApplicationLocale(
						input.getText());
				}
			}
		});

		button = new Button(parent, SWT.PUSH);
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				lcs.changeApplicationLocale(
					input.getText());
			};
		});
	}

	@Inject
	public void translate(@Translation OsgiMessages messages) {
		//button localization via Eclipse Translation Pattern
		LocalizationHelper.updateButtonText(
			button, messages.button_change_locale);
	}
}

You can react on a Locale change in different ways:

  • by getting TranslationService.LOCALE injected (which is what the new message extension is doing)
    @Inject
    @Optional
    private void getNotified(
    	@Named(TranslationService.LOCALE) String s) {
    	System.out.println("Injected via context: " + s);
    }
  • by listening to the @UIEventTopic ILocaleChangeService.LOCALE_CHANGE via dependency injection
    @Inject
    @Optional
    private void getNotified(
    	@UIEventTopic(ILocaleChangeService.LOCALE_CHANGE) Locale s) {
    	System.out.println("Injected via event broker: " + s);
    }
  • by getting the newly created Message object instance injected
    @Inject
    public void translate(@Translation OsgiMessages messages) {
    	System.out.println("Messages injection");
    	//button localization via Eclipse Translation Pattern
    	LocalizationHelper.updateButtonText(
    		button, messages.button_change_locale);
    }
  • by listening to model updates directly (which is what the renderers need to do for example)

The example for the new message extension was updated to show the application model updates with Luna M6 aswell. You can find it at GitHub.

TranslationService Update

Another enhancement regarding localization is an update to the TranslationService. The TranslationService is responsible for localizing the application model. The default implementation BundleTranslationProvider is doing that job by using OSGi ResourceBundles. That means, it loads the file-based ResourceBundle typically located in OSGI-INF/l10n/bundle.properties. To change that, you could create a custom TranslationService implementation and put it to the context. But most of the time that meant to copy&paste some code. And it was not easily possible to configure a ResourceBundle that is located outside the OSGi context, which was asked at Stack Overflow. Two things were done to make it possible to exchange the ResourceBundle loading more easily:

  1. Modified the API of TranslationService.
  2. Introduced the new ResourceBundleProvider service, that is responsible for loading ResourceBundles.

The API modification of TranslationService is a quite simple one, as only the method getResourceString(String, ResourceBundle) was moved from BundleTranslationProvider to TranslationService with protected visibility. Therefore it is not necessary anymore to copy&paste that code for custom TranslationProvider implementations.

The BundleTranslationProvider was modified to use the newly introduced ResourceBundleProvider instead of having a direct dependency to BundleLocalization, which is loading the OSGi ResourceBundle. Of course the default implementation of ResourceBundleProvider is still using BundleLocalization. But with introducing ResourceBundleProvider, it is now possible to easily exchange the way the ResourceBundle is loaded, e.g. a ResourceBundle located on a different server can be loaded or a class-based ResourceBundle can be used. The following example is using a CustomResourceBundleControl, which simply returns a new class-based ResourceBundle instance.

public class CustomResourceBundleProvider
		implements ResourceBundleProvider {
	@Override
	public ResourceBundle getResourceBundle(
		Bundle bundle, String locale) {
		//we set the base name to be an empty String for
		//this simple example
		return ResourceBundle.getBundle("",
			ResourceBundleHelper.toLocale(locale),
			new CustomResourceBundleControl());
	}
}

class CustomResourceBundleControl extends Control
	@Override
	public ResourceBundle newBundle(String baseName, Locale locale,
		String format, ClassLoader loader, boolean reload)
		throws IllegalAccessException, InstantiationException,
			IOException {
		return new CustomListMockBundle();
	}
}

The CustomResourceBundleProvider needs to be set to the IEclipseContext before the model is passed to the renderer. This can be done either via a lifecycle manager in the @PostContextCreate method, or via model addon. In both cases the code gets executed before the model gets passed to the renderer, which is important as the renderer will request the values for the localized content.

public class LifecycleManager {
	@PostContextCreate
	public void postContextCreate(final IEclipseContext context) {
		//Use this to enable custom resource bundle loading,
		//e.g. using a custom ResourceBundle.Control
		context.set(ResourceBundleProvider.class,
			new CustomResourceBundleProvider());
	}
}

Note that the lifecycle manager needs to be registered via plugin.xml (see this vogella tutorial for more information), while the addon is registered via application model (see the Addons section in the Application Model Editor).

public class ResourceBundleAddon {
	@PostConstruct
	void postConstruct(final IEclipseContext context) {
		context.set(ResourceBundleProvider.class,
			new CustomResourceBundleProvider());
	}
}

Another advantage of the ResourceBundleProvider usage is that both, the application model and the new message extension, are using it in the last instance for searching the ResourceBundle to use for localizing the application. So it is only one step to exchange the ResourceBundle for application model and content.

The complete example can also be found at GitHub.

Posted in Dirk Fauth, Eclipse, OSGi | 4 Comments