Category Archive for: ‘Eclipse’

My Blog has a mobile Theme now

6

Since I am very interested in mobile platforms like Android, iOS, etc. I decided to add a mobile theme to my WordPress based blog. After playing around with different options I decided to give the WordPress Mobile Pack a try. As a result, you should see a different theme if you access my blog from mobile devices. It should look like this:

But after some experiments I liked the 1.9.x version of WPTouch (which is still free) even better. Now my mobile Blog looks like:

Please give me feedback how my blog looks on your mobile device. On my Android based N1 it looks and behaves quite good, but I have no idea how it does on other devices.

Thanx

Kai

Follow me on Twitter

PS: I am working on a technical blog about “Modular Web Applications with OSGi and Vaadin” — stay tuned

Eclipse RCP 3.6.x: Got Headless PDE Build working

In one of my previous posts I had some issues to get the headless 3.6.x PDE build running for a few of my RCP projects. But I quickly got many very helpful comments and now I have the build up and running on Windows Vista/7. I have to admit that the tricks I describe below considered to be hacks rather than a clean solution, but on the other hand it works at least for my RCP applications.

Trick 1: Modify the target 3.6.x platform
Usually I create my target platforms just by unzipping an Eclipse SDK and the corresponding delta pack. But this did not work with 3.6.x, as described in my previous post about PDE build. I got lots of unresolved dependencies. The trick to get rid of many of them is to delete everything from the target platform except the plugins and features directory. If your RCP application is not using p2 related stuff, then there is a good chance that the build will succeed. In my RCP applications I include the feature org.eclipse.equinox.p2.user.ui in my product configurations, that leads to an unresolved dependency to org.eclipse.compare. If you see the same in your build, then trick 2 might help.

Trick 2: Manually remove dependency to org.eclipse.compare (if not needed)
If your RCP application just uses p2 for self-updating, then you probably don’t need a dependency to org.eclipse.compare. How to remove it manually I described in my blog post “Eclipse RCP p2 self-update with Eclipse 3.6.x“.

With above modifications I got the build running again. Please let me know, if these tricks work on other platforms, too. I explicitly want to thank Alexander, Albert MacSweeny and Frode for their helpful comments in my previous post about PDE build.

Have Fun!

Kai
Follow me on Twitter

Eclipse RCP p2 self-update with Eclipse 3.6.x

4

If you are using the feature org.eclipse.equinox.p2.user.ui in your RCP product to include the p2 update mechanism in your application, or if you just use p2 internally, you might run into some issues with Eclipse 3.6.x. If your update is not working and or you get a log entry “the update checker service is not initialized”, then probably the OSGi bundle org.eclipse.equinox.ds is not started properly. The easiest way to solve this issue is to include org.eclipse.equinox.ds with start level 2 in your product configuration (in the configuration tab, see screenshot below)

Another thing is the newly introduced dependency of the bundle org.eclipse.equinox.p2.ui.sdk to org.eclipse.compare, which depends on org.eclipse.ui.ide… If you just want to use RCP self-updating, here is a recipe how to get rid of this dependency:

  • Import org.eclipse.equinox.p2.ui.sdk as source into your Eclipse IDE
  • Delete dependency to org.eclipse.compare
  • Delete class RevertProfilePageWithCompare
  • Export the bundle
  • Replace the original org.eclipse.equinox.p2.ui.sdk with the newly exported version in your target platform

I would like to thank Alexander (comment in my last post) for the pointer to a p2-dev mailing list entry.

With these 2 tips I got p2 self update for my MP3 Manager running again with Eclipse 3.6.x. I also got the headless PDE build running again and will blog about that later.

Have Fun!

Kai
Follow me on Twitter

Oh No! My headless PDE build failed with Eclipse 3.6.1 :(

12

Yesterday I decided to update the headless builds for several of my Eclipse RCP based projects to Eclipse 3.6.1. No big deal, I thought. I did this several times in the last years and it took me only minutes. But this time, I can’t get the build running. My platform is Windows 7 32bit and I get the following errors:


[p2.director] An error occurred while collecting items to be installed
[p2.director]  session context was:(profile=profile,
phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
[p2.director]  No repository found containing: osgi.bundle,org.apache.ant,1.7.1.v20100518-1145
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ant.core,3.2.200.v20100427
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.compare,3.5.100.I20100526-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.compare.core,3.5.100.I20100526-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.core.filebuffers,3.5.100.v20100520-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.core.variables,3.2.400.v20100505
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.equinox.concurrent,1.0.100.v20100503
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.jface.text,3.6.1.r361_v20100825-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.text,3.5.0.v20100601-1300
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ui.editors,3.6.1.r361_v20100825-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ui.ide,3.6.1.M20100825-0800
[p2.director] An error occurred while collecting items to be installed
...
BUILD FAILED

My RCP application does NOT have any dependencies to the above bundles. I found some hints here and a bug here, but did not find a working solution yet.

Is anybody out there who got a working headless PDE build under Windows using Eclipse 3.6.1?

If so, please let me know, I will update this post if I get it working.

Thanks

Kai
Follow me on Twitter

My upcoming Eclipse 4.0 RCP related Sessions/Tutorials/Trainings

Summer is almost over, I had a great vacation with my family. Now I am looking forward to the upcoming events to talk about e4 (Eclipse 4.0 RCP respectively).

The next event is the JAOO conference at the beginning of October in beautiful Aarhus (Denmark). At JAOO I give a full day tutorial “Developing Rich Clients with Eclipse 4.0”. I like JAOO a lot, this is a conference where I always meet very interesting people and learn new things. If you plan to attend, here is a tip to get 20% discount. Follow me or any other JAOO speaker on Twitter and then use “JAOOspeakerfollower” as promotion code upon registration. Besides the great conference technical content, I really love the tasty food by Chilly John. Have you ever tasted a steak with a chilly/chocolate sauce?

One week later, at October 20th, I give a full day tutorial “Rich Client Entwicklung mit Eclipse 4.0” in Düsseldorf, Germany. This will be full day of e4 related RCP stuff with lot of hands-on experience.

The next event is Eclipse Summit Europe in Ludwigsburg (November 2-4). I will give an e4 tutorial “Anatomy of an e4 Application” together with Lars Vogel, participate in the “Eclipse 4.0 Hackfest” (together with Boris Bokowski, Tom Schindl and Lars Vogel). And I give a little short talk about “Eclipse 4.0: Theming the UI with CSS“. This conference is like a little EclipseCon in Germany. I am pretty exited that Jeff Norris is going to give a key note. The keynote Jeff gave at this year’s EclipseCon was one of the best I have ever seen in my life (and I have seen quite a lot keynotes :)).  Also Gunter Dueck is always fun, very nice to have him as keynote speaker.

Then, from November 15-19, I have a home match at the W-JAX conference in Munich, Germany. Here I talk about “Eclipse 4.0: CSS Styling and Workbench Modeling“. W-JAX in Munich is always great!

So, if you are interested in e4, there’s lots of upcoming events you could attend.

Have Fun!

Kai
Follow me on Twitter

CSS Theming for Eclipse RCP 3.x

11

Eclipse 4.0 brought a great new feature: Theming RCP applications with CSS. Another good news is, this cool feature can also be used with RCP 3.x based applications. The following screen shot shows the RCP Mail Demo, styled with CSS:

How to run the Demo with CSS styling?

  1. Checkout :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse/e4/releng
  2. Import Project Set /releng/org.eclipse.e4.ui.releng/e4.ui.css.psf
  3. Checkout e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.widgets (see bug 322641)
  4. Cleanup org.eclipse.e4.ui.css.swt (see bug 322644)
    => Organize Imports
    => Delete dependencies to org.eclipse.e4.core.*
  5. Start the CSS RCP Mail demo (project org.eclipse.e4.ui.examples.css.rcp)

The demo also provides dynamic theme switching. Here is is little excerpt from the defaul.css styling:


CTabItem, Label, Tree, Text {
 font-family: "Arial";
}

Shell {
 font-size: 12;
}

CTabItem, ToolBar, Button, CBanner, CoolBar {
 font-size: 9;
 background-color: white;
}

CTabFolder, CTabItem {
 background-color: #F0F1F7;
}

If you would like to play around with the css, just edit the files css/default.css and css/colorful.css in the project org.eclipse.e4.ui.examples.css.rcp. I have submitted a short talk at Eclipse Summit Europe to explain a few more details.

Have Fun!

Kai
Follow me on Twitter

Flattr and the Eclipse Community

Yesterday I discovered Flattr, a new micro payment cloud service that went to open beta recently. I have to admit, I really like the idea of Flattr: Spend a fixed amount of real money every month to honor the efforts of others who provide articles, blogs, software, music, video, etc. Let’s say you would like to spend $5 per month (minimum for Europeans is 2€). If you flattr just one thing, the owner will get a great portion of your 5$ (Flattr itself takes a little fee). If you flattr 50 things, every owner will get 1/50 = 10 cent. This does not seem to be much but all flattrs will add up.

In the past, I was just too lazy to donate something to open source projects or authors of great blogs and tutorials (like Tom Schindl, Lars Vogel and others). But now, I can easily recognize their work with just one click!

If you want to get more information about Flattr, just visit www.flattr.com and take a tour. If you like it, an account is created very quickly and easily.

If you provide something to the community, especially the Eclipse community, that others find helpful, you could get some recognition for your work by other Flattr users easily.

For example, if you are the owner of an open source project where you put effort in your spare time, just put it as “Software Thing” into Flattr, tag it,  and put a Flattr button on the project web page (Shameless plug: I did this today with my Eclipse/OSGi related OSS projects MP3 Manager and Person Manager).

Or, if you blog, you could easily put Flattr buttons in or at the end of your blog. There are many plug-ins available for WordPress and probably other blogging systems.

In summery: I think Flattr is a great way to recognize people who provide helpful/interesting content and I am looking forward to flattring you if I like the content you provide.

BTW, if you like this blog post, you could flattr it: Just click on the Flattr button below in the original post (If you read this post from Planet Eclipse, just click on the post’s title to open the original post from my web site, then you should see a Flattr button at the end of this post).

Have Fun

Kai

Eclipse 4.0 RCP: Selection

5

One of the objectives of Eclipse 4.0 was to make rich client development easier. One good example is the following use case: One view provides a selection (e.g. using a JFace TableViewer) and another view wants to get notified about a new selection of a domain object to get the chance to react on it.

First the selection provider part. The selection services can be easily injected using dependency injection.


@Inject
private ESelectionService selectionService;

When using a JFace viewer, the viewer selection has to be forwarded to the selection service:


tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
  @Override
  public void selectionChanged(SelectionChangedEvent event) {
    IStructuredSelection selection =
       (IStructuredSelection) event.getSelection();
    selectionService.setSelection(selection.getFirstElement());
  }
});

On the consumer side, the domain object is injected using an @Optional and @Named active selection. The following code snipped is part of a details view POJO that uses a WritableValue (Eclipse data binding) as holder for the actual domain object (of type IContact).

@Inject
public void setSelection(
  @Optional @Named(IServiceConstants.ACTIVE_SELECTION) IContact contact) {
    if (contact != null) {
      contactValue.setValue(contact);
    }
}

That’s pretty convenient and concise compared with the code needed in Eclipse 3.x.

Have Fun!

Kai
Follow me on Twitter

OSGi 4.2: Extender Pattern and BundleTracker

Today a updated my dynamic OSGi demo (see screenshot below),  in particular: the extender bundle. The extender pattern is a frequently used pattern in the OSGi world. The idea is to extend the semantics of bundles by adding custom manifest headers and react, if bundles with these headers come and go dynamically. Prominent examples for using the extender pattern are service component models like OSGi Declarative Services (DS) or Spring Dynamic Modules (Spring DM). In my demo I wanted to create a simple extender that tracks bundles with the custom manifest header “Action-Contribution” and provide a class that should be registered as a service. Here an example for such a custom manifest header (you find it in the manifest of bundle com.siemens.ct.pm.ui.actions.vcard in the demo):

Action-Contribution: com.siemens.ct.pm.ui.actions.vcard.Actions

Before OSGi 4.2 I used Heiko Seeberger’s custom bundle tracker to deal with all workflow and threading issues. But since OSGi 4.2 comes with a convenient BundleTracker now, it is no longer necessary to implement all the plumbing. Here is the complete source code of my little extender:

public class ExtenderBundleTracker extends BundleTracker {

  private final Logger logger = LoggerFactory
      .getLogger(ExtenderBundleTracker.class);

  public ExtenderBundleTracker(BundleContext context) {
    super(context, Bundle.ACTIVE, null);
  }

  @Override
  public Object addingBundle(Bundle bundle, BundleEvent event) {
    String className = (String) bundle.getHeaders().get(
        "Action-Contribution");
    if (className != null) {
      Class<?> clazz;
      try {
        clazz = bundle.loadClass(className);
        try {
          bundle.getBundleContext()
              .registerService(
                  "com.siemens.ct.pm.application.service.IActionContribution",
                  clazz.newInstance(), null);
          logger.info("Extender Action Contribution Service registered for: "
              + clazz.getName());

        } catch (InstantiationException e) {
          logger.error("Could not instantiate " + className, e);
        } catch (IllegalAccessException e) {
          logger.error("Illegal access during instatiation of class "
              + className, e);
        }
      } catch (ClassNotFoundException e) {
        logger.error("Could not find class " + className, e);
      }
    }
    return bundle;
  }
}

You might wonder, why I did not overload

public void removedBundle(Bundle bundle, BundleEvent event, Object object) {}

to unregister the services. Since I used the context of the active bundle that comes in to register the service, this service is automatically unregisterd when the bundle goes away.

Have Fun

Kai
Follow me on Twitter

Eclipse 4.0: Dependency Injection and OSGi Declarative Services

2

In my last post I explained how easy it is to inject your own objects. For the common use case that you want to specify an interface attribute but want an object being injected I showed a simple solution using a little factory. Another way of doing this is the use of OSGi declarative services (DS). But instead of creating a declarative service that implements the service interface you create a declarative service for a helper object that just registers your implementation class for the needed interface with the ContextInjectionFactory. So, the ContactPresentation code looks like this now:

...
	private IContactView contactView;

	@Inject
	public ContactPresenter(IContactView contactView) {
		this.contactView = contactView;
...

The xml for the declarative service is in OSGI-INF/views.xml:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"
               name="org.eclipse.e4.demo.contacts.mvp.views">
   <implementation class="...mvp.views.ContactViewCreationFunction"/>
   <service>
      <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
   </service>
   <property name="service.context.key" type="String"
      value="...contacts.mvp.presenters.ContactPresenter$IContactView"/>
</scr:component>

The implementation class provides the interface org.eclipse.e4.core.contexts.IContextFunction and an additional property with the name service.context.key specifies the actual interface that the contact function is going to register. Here is the simple code for the ContactViewCreationFunction:

public class ContactViewCreationFunction extends ContextFunction {
	@Override
	public Object compute(IEclipseContext context) {
		return ContextInjectionFactory.make(ContactView.class, context);
	}
}

The only thing the ContactViewCreationFunction does is to bind the ConatcsView class to the context, using the above service.context.key to know the interface. I will check in the code soon, stay tuned…

It’s very important that you don’t forget to add the 2 manifest headers in the manifest.mf:

Service-Component: OSGI-INF/views.xml
Bundle-ActivationPolicy: lazy

I would like to thank Tom Schindl for giving me the tip not to forget the lazy Bundle-ActivationPolicy!

Have Fun

Kai
Follow me on Twitter

Page 5 of 10« First...«34567»...Last »