Eclipse Yoxos Services Downloads Blogs About
Home > Blogs >

Posts Tagged ‘indigo’

on Jun 7th, 2011jQuery timeago in Java with RAP

A few weeks ago I showed you how easy it is to integrate jQuery into RAP using the browser widget. I’d like to show you another example of what can be integrated. Last time I created a carousel widget; this time the demo is something smaller but still really cool.

Yesterday I came across a github repository by Ryan McGeary. He has created a very clever jQuery plug-in called “timeago“. What this plug-in does is simple. It takes a timestamp and displays a text string instead of the stamp that describes the difference between the actual time and the one in the timestamp.  We’ve all seen the messages, “about a minute ago.”  The cool thing about this plug-in is that it refreshes automatically. I mean, it isn’t new to transform timestamps in this way, but it is usually done just once. So, when you visit a website in the morning and leave the tab open until evening, it still says something like, “The page was opened about minute ago” icon wink jQuery timeago in Java with RAP . This can’t happen with McGeary’s plug-in.

While having a jQuery plug-in is nice for javascript developers, it’s not as nice if you’re a Java Developer. But, fortunately we can integrate jQuery painlessly into RAP. As a result I wrote a RWT/SWT widget that simply maps the functionality of the timeago plug-in. You can set a date from the server and read the displayed text from the client.
timeago jQuery timeago in Java with RAP
If you like this idea you can grab the sources at github. Of course this is just a demo. Let me know if you would like to work with me on an implementation for productive use. Have fun with timeago icon wink jQuery timeago in Java with RAP

on Apr 27th, 2011Key Bindings in RAP

Support for key bindings (bug 282449) has been one of the most requested features for RAP. So I’m happy to say that since 1.4 M5, RAP implements the JFace key bindings API, provides the org.eclipse.ui.bindings extension point, and enables most of the default workbench key bindings. As a result, you can now use most* of the key shortcuts of your application also in the browser–if your application uses the workbench. But many use RAP without using the workbench. So how can you enable key bindings in a plain RWT application?

In M7, we now introduce a simple way of doing this. Let’s first have a look on how you would implement a key binding in SWT. You would have to register a global listener for key events on the display like this:

display.addFilter( SWT.KeyDown, new Listener() {
  public void handleEvent( Event event ) {
    if( event.stateMask == 0 && event.keyCode == SWT.ESCAPE ) {
      // handle escape key
    }
  }
} );

Well, you can now use the same code in RWT.

But there’s one more thing to it: RWT is a client-server architecture and we don’t want the browser client to send a request for each and every key stroke. The server should only be notified when the user presses one of the key sequences that we are really interested in. Therefore, we have to inform the client, which key sequences should be active. This information can now be attached to the display using Display.setData() with the new constant RWT.ACTIVE_KEYS as property key. The value of this property must be an array of strings, each one representing a single active key sequence. The syntax is the same that you know from key binding extensions for the workbench. So if you want to enable some simple key bindings like, for example, “c” for compose and “x” for delete, and maybe some more advanced key sequences like “Ctrl+F11″ for power-users, you could write something like this:

display.setData( RWT.ACTIVE_KEYS, new String[] { "C", "X", "CTRL+F11" } );
display.addFilter( SWT.KeyDown, new Listener() {
  public void handleEvent( Event event ) {
    if( event.stateMask == 0 && event.character == 'C' ) {
      handleCompose();
    } else if( event.stateMask == 0 && event.character == 'X' ) {
      handleDelete();
    } else if( event.stateMask == SWT.CTRL && event.keyCode == SWT.F11 ) {
      doSomeAdvancedStuff();
    }
  }
} );

Only the first line is RAP-specific. So for a single-sourcing RWT/SWT application, you only have to care about the constant. I’m sure you have an idea how to do that. M7 will be available on May 7–easy to remember.

*) Some shortcuts may be reserved by some browsers and cannot be used. Other shortcuts will override browser actions, like Ctrl-N (new window) Ctrl-T (new tab) etc. You also may not like to disable C&P in form fields by adding key bindings for Ctrl-C etc. So you have to choose your web key bindings wisely… Ah, and sequences of key strokes like Ctrl+X T are not yet supported.

on Feb 2nd, 2011Equinox/RAP WAR Products has moved. Hello Eclipse Libra…

A while ago I introduced you to my Google Summer of Code 2010 project, the WAR Products. I really appreciate your participation with feedback and bugs. It showed me that there is a real need for this tooling, so I’m proud to announce that the WAR Products development will not continue in the RAP Project.

You may think, “WTF? Odd thing to be proud of.” But, it really does make sense icon wink Equinox/RAP WAR Products has moved. Hello Eclipse Libra... . The WAR Products were never targeted to be part of RAP, primarily because the tooling is not RAP specific. It eases the deployment of Server-Side Equinox applications. And this kind of application does not necessarily have to be a RAP application.

Three months ago a new Eclipse project was announced. It’s called Libra or formerly “OSGi Enterprise Tools” (it had to be renamed ‘Libra’ because of legal issues). I don’t want to repeat the project goal here because Kaloyan (the Libra project lead) does a much better job with this than I could. You can read about the project in this proposal. Libra passed the project creation review a while ago and provisioning by the eclipse.org webmasters is ongoing. So, why am I talking about Libra here?

wtp logo 2010 Equinox/RAP WAR Products has moved. Hello Eclipse Libra...There is a simple reason.  Because of one sentence from Kaloyan about Libra, I thought it would be the perfect project to contribute the WAR Products to.  “Libra tries to close the gap between PDE and WTP”.  This maps exactly to the WAR Products as the tooling tries to ease the deployment of Equinox-based applications on Servlet-Containers or JavaEE Application Servers.

Additionally there are plans to extend the tooling with a WTP integration to enhance the creation of a WAR Archive with automated deployment functionality, without adding explicit dependencies to WTP. And where can this development be done better than in between PDE and WTP?

Yesterday I committed the WAR Products to the Libra git repository after it passed the IP process successfully. I also set up a temporary p2 repository from which you can install the tooling (Eclipse 3.7 M4+ required). Of course we’re trying to push Libra in the direction of Indigo. If this works you will soon be able to install the WAR Products from the Indigo Repository. Please keep in mind that the bundle ID’s have changed during the move. So, if you had installed the sneak-preview from this blog post, please uninstall the tooling before installing the Libra version. It’s really worth getting the new version because of many bug fixes and enhancements which are included. Please feel free to file bugs, but this time against Libra icon wink Equinox/RAP WAR Products has moved. Hello Eclipse Libra...

Please note: To use the WAR Product’s full functionality you need to add the Equinox Server-Side SDK to your target or set RAP 1.4 M5 as your target environment. There is no longer a “requiredBundles.zip” that you need. Use this temporary p2 repository to install the WAR Products: http://download.eclipsesource.com/~hstaudacher/warproducts/3.7/

on Jan 29th, 2011Eclipse 3.7 (Indigo) M5, available for download

Well here we are just over half way through the NHL season and the norther hemisphere is in the middle of winter.  For those of you who don’t plan on spending the weekend watching the NHL All-Star game, you’ll be happy to know that Eclipse 3.7M5 is now available for download.

Milestone 5 comes backed with a number of new goodies including conditional breakpoint improvements:

condition history Eclipse 3.7 (Indigo) M5, available for download

Static analysis improvements, such as the ability to detect methods that can be declared static:

method can be static Eclipse 3.7 (Indigo) M5, available for download

And Touch & Gesture support in SWT (for supported hardware)

gesture Eclipse 3.7 (Indigo) M5, available for download

There are also a number of features specific to Eclipse 4.1 such as detachable editors:

detached editor Eclipse 3.7 (Indigo) M5, available for download

Checkout the complete New and Noteworthy, or better yet download Milestone 5 and try it yourself.

Eclipse 3.7 M5

Eclipse 4.1 M5

on Jan 17th, 2011How to build a RAP application with Tycho

Recently I played around a little with Tycho because we evaluated it for the use in the RTP project. As a test case, I decided to try to build a RAP application with Tycho. With building I mean compiling and packaging the artifacts into a WAR file in order to deploy them on a Tomcat or another Servlet Container.

I have to say that I’m really impressed with Tycho. Before this experience, Maven was the “bad thing that downloads the internet” to me. Okay, it still downloads the internet but in this case it’s very useful. You can add p2 repositories to resolve dependencies and it automatically downloads the right bundles. You can define the dependencies in your MANIFEST.MF and use the pom.xml to describe what kind of package it is, e.g. a feature or bundle. For building the RAP application, I just had to add the Helios p2 repository to solve all my feature’s dependencies.

RAP Logo How to build a RAP application with Tycho tycho logo How to build a RAP application with Tycho

Now, you might want to know how to build the application with Tycho yourself. I published the code on github [1]. It’s just the example Mail application and a sample feature that can be built with Tycho. Follow the README instructions to run the build. Here are a few notes you might need if you want to use this configuration as a template for your own build:

  1. Edit the feature.xml from com.eclipsesource.maildemo.tycho.feature, adding your dependencies.
  2. The build uses a static configuration.ini. As a result, you have to edit the configuration manually and add your own bundles. You will find the configuration.ini in the com.eclipsesource.maildemo.tycho.feature feature in the templates/WEB-INF/eclipse/configuration folder.
  3. Create a pom.xml for every bundle you created with the following content:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <modelVersion>4.0.0</modelVersion>
      <parent>
        <artifactId>maildemo</artifactId>
        <groupId>com.eclipsesource</groupId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>
      <groupId>com.eclipsesource</groupId>
      <artifactId>com.eclipsesource.maildemo.tycho</artifactId>
      <version>1.0.0-SNAPSHOT</version>
      <packaging>eclipse-plugin</packaging>
    </project>
  4. Change the artifactId from com.eclipsesource.maildemo.tycho to your own Id.  You’ll also need to change the parentId when you use your own Id.
  5. Edit the pom.xml in the parent folder and add your modules. To add modules you just need to add the folder names from the different bundles to the file.
  6. In the pom.xml of the feature, change the naming of the “maildemo” to create a .war file with the name of your choice.
  7. Of course you can use your own groupIds and artifactIds. But, you have to reference the parent pom.xml artifactId in every bundle’s pom.xml

I hope these steps and the example build will help you to create your own Tycho based builds for RAP applications. Maybe you have some experiences or ideas you’d like to share?  Please feel free to post comments.

[1] https://github.com/hstaudacher/org.eclipse.rap.build.examples

on Jan 14th, 2011SAP likes Eclipse Runtime Technologies

A few weeks ago I told you about the Eclipse RTP project. Since then some things happened that I want to share with you.

First of all, we made it to the creation review. The review is scheduled for January 12-19. The community gathering period was very successful. We reached 10 interested parties and 7 initial committers from three different companies. In this article, I’d like to focus on one very cool thing. It’s the effort made by SAP.

As you might have seen in the last months, SAP is involved in more than the half of the new Eclipse projects. Probably the main reason behind this is that SAP submitted the most project proposals icon wink SAP likes Eclipse Runtime Technologies . But reading about it and getting in touch with the guys behind this company are two different things as we learned in the RTP project. So, let’s review the SAP + RTP story:

sap SAP likes Eclipse Runtime TechnologiesIn December a colleague of mine, Florian Waibel, made his way through closed airports and meters of snow to South Hampton, UK to have a face-to-face meeting with the Virgo guys. During this meeting he also talked about RTP and gained some interest from some of the people there. Back home he told me about SAP getting heavily involved in Virgo and also about their interest in RTP. Because we are an open Eclipse project we got in touch with a friendly SAP project manager (thanks Krassi) and had discussions about the RTP project and how an internal development project from SAP could fit into RTP. Well, the result was that SAP was so interested that we extended the scope of the project together and will now receive an initial contribution from SAP called the “p2 installer”. Of course, Eclipse is not a software dumping area. That’s why they will provide a maintainer for this contribution who will also be an initial committer.  Welcome Georgi Stanev icon wink SAP likes Eclipse Runtime Technologies .

The “p2 installer” is basically a command line interface for the official p2 installer to manage remote Eclipse runtime installations. The purpose of this tool was to enable automated scripts to install Eclipse runtime to remote systems. The cool thing about it is the ability to define the units that should be installed in a property file declaratively. Yesterday we had a short demo of the installer and I have to say that it looks very exciting.

To put it all in a nutshell it’s really good to see SAP working actively in and with the open source community. They are not shy about donating things and providing guidance. It’s very nice to see a really big player supporting open source in positive ways.

on Dec 21st, 2010Indigo Sneak Preview: Merry Christmas from the RAP Team

Christmas is only a few days away and we at the RAP team wanted to show our appreciation to you, our community, for your active participation in setting directions for RAP and for RAP development.  As a small Christmas present, we’d like to give a preview of the next release so you don’t have to wait until June 2011 to see the Indigo features in action. Please lean back and enjoy our Indigo Sneak Preview screencast:

As you know we are an Eclipse project.  And, as an Eclipse Project, we believe in the mantra, “ship early, ship often.”   As a result of this, you don’t have to wait for Indigo to use the features shown in the screencast. You can simply download our latest milestone build or checkout the code from our CVS. You will find additional information here:

on Dec 18th, 2010A new Google Maps Widget for SWT and RAP

Your early Christmas present from EclipseSource: a custom-widget that displays, controls and reacts to a Google-Map. While there have been similar widgets before, this one is the first (as far as I know) that runs in RAP and RCP without any changes.

gmapb 300x210 A new Google Maps Widget for SWT and RAP gmapd 300x167 A new Google Maps Widget for SWT and RAP

[ Download ] (You also need RAP 1.4M4.)

Creating custom-widgets for RAP is no easy task. You need to be familiar not only with Java and JavaScript, but with a lot of RAP’s complex internals as well. It’s a lot of work, even if you simply want to integrate an existing javascript-application or library.

That’s now a lot easier, using the much improved browser-widget. We recently added some missing features, tested different scenarios and fixed known bugs. This makes it an ideal platform to insert javascript-based applications with almost no overhead for the programmer. You simply call JavaScript from Java and vice versa! And the bonus: these custom-widgets can (under certain conditions) also run in RCP, as demonstrated here.

The widget is currently hosted at github, so feel free to check it out, use it in your application or fork it to add your improvements. Also check out Holger Staudachers carousel widget for RAP to see another example.

“Traditional” custom widgets for RAP are by no means obsolete with this, as they still have certain advantages (slightly better performance, themeability, can use rap client components). But for the cases mentioned above, the browser widget can make your life much easier!

Happy Holidays!

on Dec 8th, 2010JQuery, Eclipse RAP and a carousel

A few weeks ago, my colleague Ralf Sternberg, announced that RAP supports a JQuery integration. What we still needed to do was to create an example that shows how to integrate some JQuery stuff into RAP. Yesterday I took a little time to work on it. I used the JQueryUI Carousel widget as a base. Two hours later the integration and a book store example were completed. You can see the result in the screencast below.

The special thing about this integration is that it uses the SWT Browser widget with BrowserFunctions. This makes this type of integration very lightweight and simple to develop. As I mentioned before, two hours were enough to create the example. Of course, besides JQuery you can integrate all kinds of Frameworks, Mashups and other things that are running in a browser. Ian Bull highlighted this by developing a GMap example. The cool thing about this technique is that it works with RAP (RWT) and RCP (SWT).

I made the source code publicly available via github. You can find the repository here. It would be great to see some other examples. So, please feel free to post your examples in a comment.

on Nov 13th, 2010RAP 1.4 M3 supports JQuery, reduced client size

Another milestone build on the way to RAP 1.4 is available: RAP 1.4 M3.

In this milestone, we conentrated on optimizations to the Javascript code that we deliver to the client browser. We managed to reduce the size of this code by ~8%, making RAP apps load a litte bit faster again. More optimizations will follow.

As a nice side effect of using a new Javascript compressor, RAP does not interfere with JQuery anymore. That means that you can now use JQuery in your RAP applications, if you like.

In the next milestone, scheduled for Dec 17, you can expect updated JFace and Workbench bundles as well as key bindings support.

© EclipseSource 2008 - 2011