It's been a little while since I gave an update on where the PsychoPath XPath 2.0 processor stands from a W3C Test Suite compliance point. Mukul Gandhi (note: nudge him to get his blog on Planet Eclipse since he is an Eclipse committer now) and I have been working our way steadily through the entire test suite. Here are the current results:
Tests: 8137
Failures: 988
Errors: 42
Code Coverage according to ECLEmma:
The test suite now covers about 76% of the PsychoPath. I suspect that we will be close to 80% to 85% code coverage by the time we complete the test suite. When we started we had about 30 or 40 tests that covered about 20% of the code. Unless you run the coverage analysis with a tool like ECLEmma you really do not know how much of your code is actually being executed by your tests. Trying to get to 100% coverage is not worth doing, getting to above 75% is worth doing and should be worked toward.
XPath 2.0 Castable, Durations, and Date/Times:
This has been the bane of my existance for the last several weeks. Reading the W3C specifications on when something can be cast and when something shouldn't be cast can give one a headache pretty quickly. Luckily the XPath 2.0 and XQuery 1.0 Functions Specification has this nice handy table:
The SeqCastableTest test suite covers about 648 test cases for the core specification. PschyoPath now passes all of these tests. With out the above table, trying to figure out the wording of the specification can be difficult at best, and just plain maddening at worst.
The Natives Will Byte You!
One thing that constantly was biting me was the imprecision that the Java primitive types have. PsychoPath in it's original implementation used the Integer, Double, and Float classes exclusively. The problem was that in many cases, especially during IntegerLiteral and DecimalLiteral parsing or creation, these were either too small to hold the numbers the tests wanted, or their precision was not accurate enough. A good explanation of the reason can be found in "Double Precision Numbers". Switching where need to BigInteger and BigDecimal solved many of these issues.
Dates are still another pain to deal with especially calculations. Again you start to run into a precision issue, where some numbers are stored too low. I did some experimentation and both the com.ibm.icu.util.GregorianCalendar and the built in Java GregorianCalendar have precision issues, some in the same place others not. I had thought about trying to leverage Joda Time but that was previously turned down by Eclipse IP team due to pedigree concerns.
I dread debugging these issues. Dates and Time calculations give me a headache.
What's left:
Lots. There are several core functions that are not working or are missing. Some logic expression errors to correct, and a few more lexer/parser issues to address. Overall though, PsychoPath passes about 88% of the W3C Test Suite, so is much more compliant than it started out. Credit still has to be given to Andrea Bittau, the original author, for a well designed implementation, and some very clean and easy to maintain code. Compared to some of the code I've worked on at Eclipse, this is just a pleasure to work with.
All current changes are in the WTP Source Editing CVS Repository.
July 03, 2009
![]() Dave Carver |
Eclipse: PsychoPath XPath 2.0 Processor Update |
![]() Doug Schaefer |
MinGW on Linux on Windows 7???
My Windows/Linux world has gotten a whole lot more complicated in the last few days, but I'm really liking how it's set up now. |
![]() Robert Konigsberg |
Generic types are not required for covariance
Java 5.0 introduced Generics. It also introduced covariant return types. Wikipedia does a fine job describing covariant return types. public interface Model{T extends Model{T}} { public class MyModel implements Model{MyModel} {Thanks to the covariance, I can write a method chain like this: new MyModel() With Java 1.4, the code would have to look like this Version 2: Java 1.4 public interface Model {And the method chain would result in a syntax error: public static void foo() {Which you could hack around with an ugly cast: public static void foo() {Back to the Java 5 example: My point is just this: covariant return types don't require generics. All that messy code in version 1 could look much simpler because covariant return types exist on their own without generics: Version 3: Java 5, Covariant return types public interface Model public class MyModel implements ModelLesson learned: I know generics fairly well, but there's a difference between knowing when it's useful and when it isn't. Said another way: when you have a Generic hammer everything looks like a generic nail. Thanks to David Plass for pointing this out. |
![]() David Green |
Android versus iPhone Development: A Comparison
A few months ago I ventured into the world of Mobile development and created an application (Hudson Helper) for both iPhone and Android. This article is about my experiences, comparing Android and iPhone development with a focus on tools, platform and the developer experience. Before going much further I should note that my comparison is with considerable bias. I’ve spent the past 12+ years in Java development, having spent much of my career building developer tools. Since January of 2004 I’ve been building plug-ins for Eclipse, and before that plug-ins for NetBeans. This bias is somewhat tempered with several years of C and C++ development. With this background I find that I’m very critical of developer tools. Developer productivity is key — anything that takes away from the flow of a developer in the zone is a real problem. Language, Programming Model and PlatformLanguageThe language of choice for iPhone development is Objective-C. Objective-C is a language based on C with extensions for object-oriented concepts, such as classes, inheritance, interfaces, messages, dynamic typing, etc. The Java language is used when developing for Android (though it doesn’t actually get compiled to bytecode). Java is a no-brainer. I have to say that it’s nice not to have to learn a new language to target mobile. Existing skillsets don’t come easy — so reuse of expertise is worth a lot. It took a little while to wrap my head around some of the language features available with Objective-C. I soon discovered that I really loved certain language features, such as message passing (instead of calling methods), categories and named arguments. I did find however that the syntax of Objective-C is cumbersome. I’m still not used to ‘+’ and ‘-’ for static and member methods, too many parentheses are required, and in general I just felt like I had to type way to much to express a simple concept. The IDE didn’t help much with this either (more on that later). One thing that really became clear to me is that Objective-C, though it may have been visionary for its time, is really a language of the '80s. Certain issues such as split header and implementation files and violation of DRY are really time-wasters, and not small ones at that. I found myself constantly switching back and forth between files, which not only has a cost in navigation (which file to open?) but with every file opened your sense of context must be recreated (where’s the caret, what’s selected, where am I in the file, how is this file organized). As far as DRY, must I really do 5 things to declare a property?? (declare in the class definition, again to declare getter/settter, initialize in the init method, @synthesize in the implementation, release in dealloc). Here’s what I mean: Server.h Server.m If you ask me, everything in Server.m should go away. Another gotcha here is the positional relevance of @synthesize. Java has a similar problem with properties, though not quite so bad — and the IDE helps you write your getter/setter. Pointers in Objective-C, though powerful, are also another time-waster. This is where Java really shines with its garbage collection. I found that I was constantly considering whether allocated objects were freed appropriately. Code flow is poor since application logic is littered with memory management. I only have so many brain cycles available — why do I have to think about this other cruft that’s not really a core concern of the application domain? Of course this gets even worse when trying to figure out where things went wrong if you make a mistake. Zombies help, but still don’t make it obvious if you’ve accessed something that was deallocated. Other issues include deallocating something twice, autoreleasing something twice. I also found it non-intuitive when to retain return values from methods. Another annoyance of Objective-C is the patterns that must be followed: implementing correct init and dealloc methods is non-trivial. @synthesized getters and setters for properties with retain should not be called in these methods. So many conventions and rules to remember! Though I understand why there’s a separation of alloc and init, it’s still overly wordy to specify Objective-C’s imports and forward-declarations (@class) are a pain. Though these issues exist with Java development, Eclipse’s JDT is so good that I’ve almost forgotten what it’s like to write an import. All you have to do is Ctrl+Space to auto-complete a class name or Ctrl+Shift+O to organize imports and voila! Of course Java is not perfect either, however this fact is hidden from me due to the fact that I’ve been living in Java for a very long time. Sometimes I wish that Java were more Groovy-like, however I’m used to it and the tooling is so good. PlatformOn Android I found that I could readily use the Java runtime classes. Some, but not all, of the standard Java RT classes are available on Android. I didn’t find this a problem, since most of the standard Java IO, network and regex libraries are available. Android RT classes appear to be based on Harmony, which has been around long enough to be stable. With iPhone on the other hand, finding the functionality that I needed was painful. Classes and methods are poorly organized. When to look for a static method versus a class with members was not clear to me. Also depending on the framework used, naming conventions and code organization would differ. I suppose this is the legacy of an older platform. Areas where functionality was lacking that I found painful were regular expressions, string handling and XML parsing. I ended up using the excellent Regex Kit Lite for regular expressions. For XML parsing I implemented a parser abstraction over libxml, only to discover later that I may have had an easier time with On the iPhone when things didn’t work as expected I had to resort to Google and hope that others had encountered the same problem. This technique was hampered by Apple’s earlier NDA policy, which meant that iPhone content is pretty thin on the net. In some cases I would resort to guesswork and experimentation to find a solution. Android has the benefit of being open source. Within minutes I had the full Android platform source code on my system, and had re-built the SDK from sources to ensure that the source I had matched the runtime classes in the emulator. So not only could I see how things were implemented in the Android platform and learn by example, I could step through the platform code in the emulator and discover why my code wasn’t producing the desired results. In general I found the layout, organization, and naming conventions of Android platform classes was consistent and predictable. This made it much easier to learn. Programming ModelThe iPhone platform does a great job of encouraging an MVC design pattern. With this design pattern built in to the platform, building the UI was simple and I didn’t have to figure out how to organize the UI component design myself. It also means that when looking at sample code, it’s all organized in the same way. Android also does a good job with design patterns, though their concepts varied significantly from the iPhone. With Android’s support for multiple processes and component reuse, the platform itself provides support for Intents and Activities (an Intent is just a variant of a command). The design results in a better user experience, however it does introduce some complexity for the developer: when starting one Activity from another, an Intent is used to communicate any parameters. These parameters cannot be passed by reference — only by value. Where on the iPhone it’s simple to have screens sharing the same data structures, on Android this requires some forethought. Apparently Android applications can manage the back button and have everything occur inside a single Activity, however this is not the norm. Both Android and iPhone provide a way of declaring user preferences in XML. Both platforms provide a default UI for editing those preferences, which is great. Android’s XML format is extensible allowing custom UI components to be integrated, which makes user preferences a breeze. iPhone developers that wish to customize preferences will have to implement a UI from scratch, which is a lot more work. Testing and Continuous IntegrationI’m of the opinion that every development effort should include unit tests. Teams of size greater than one should also include Continuous Integration. Android developers will be happy to know that they can write JUnit tests. I could even launch these from the Eclipse UI after some classpath fiddling. Though I didn’t try it, I assume that it’s trivial to run these from Ant and your favorite CI server such as Hudson. I did see some iPhone unit test documentation with the iPhone SDK but didn’t take the time to explore it — so I can’t comment there. ResourcesApple does an excellent job of providing lots of resources for developers. Important concepts are explained in videos, which makes grasping concepts easy — however I did find that videos progressed slowly and I was watching for what seemed like hours to find information that should have taken minutes. Luckily Apple also provides lots of sample applications and code to demonstrate API usage. Android developers also have access to loads of resources. The guide and API reference are installed with the SDK, so everything is available when offline (which for me is important since I do a lot of my work in transit). I found the Android development resources better organized and spent less time looking and more time finding. In particular the ApiDemos sample app provides a great starting point. I also downloaded many open source Android projects for ideas on architecture and API usage. This is an area where Android has the advantage, with Apple’s previous NDA policy there isn’t much out there in terms of open source for iPhone. ToolingFor me tooling was a real shocker. These are the categories of tooling that I’ll cover: IDE, UI builder, debugger, profiler. Almost everything else is related to provisioning, and in that area I didn’t notice much in the way of differences between Android and iPhone. IDEAndroid development leverages the excellent JDT tools, which are pretty much stock and standard with every Eclipse installation. I’ve used these tools now for many years and they’re excellent. Everything Java is indexed, the IDE has a rich model of the source code, and refactoring is so seamless that it has changed the way that I work. Perhaps the best feature of JDT is its incremental compiler, which provides immediate feedback with errors and warnings as you type. This eliminates the code-compile-wait-for-feedback cycle that was so common in the '80s and '90s. Errors and warnings are updated in the Java editor as I type, giving me instant feedback. I didn’t realize just how valuable this feature is until I was coding Objective-C in XCode — when I became acutely aware at how waiting for compiler feedback can break the flow of programming. Other key features that make Eclipse so amazing to work with are:
Integrated javadoc and content assist is quite possibly the best way to learn an unfamiliar API. In Ecipse not only are all classes and methods immediately available in the context in which you’re writing code, their documentation is presented alongside. ![]() Content Assist with Integrated Javadoc XCode is so shockingly bad that I almost don’t know where to start. Here’s a minimum list of things that I think need fixing in order for XCode to become a viable IDE:
One area of Eclipse that simply can’t be matched is Mylyn. Integrated task management and a focused interface introduce huge efficiencies into any project, small or large. If you haven’t yet tried out Mylyn, it’s definitely worth your time to take a look. A good place to start is Mylyn’s Getting Started page. UI BuilderiPhone app developers are given a pretty good UI builder. It does a great job of showing the UI as it will actually appear. It’s flexible and can model some pretty sophisticated UIs, so I was impressed. I found that using it was a little tricky — I had to read the documentation two or three times before I could really figure out how to use it properly. The Android UI builder I found pretty useless: it can’t display UIs how they’ll actually appear, and it’s UI is way too inefficient. I found that I coded all of the UIs directly in the XML source view of the UI builder. There the content assist and validation were pretty good, making it the easiest way for me to build a UI. DebuggerHaving used to the Java debugger in Eclipse I was shocked at the state of the debugger in XCode. With Eclipse I can see and modify variable values. Not so in XCode. Maybe this is simply the state of affairs when debugging native code, but it sure affects the usefulness of the debugger. XCode often seemed confused as to the type of an object and presented me with a pointer value and no detail. This is a sharp contrast to Eclipse, where I can drill down through an object graph with ease. I found the XCode debugger UI extremely difficult to use. Clicking on the stack to show code in an editor caused new windows to open, eventually resulting in dozens of windows open. In addition I found that watch expressions rarely worked for me. Profiler and Heap AnalysisAn area where Apple development tools excel is in profiling and heap analysis. These tools seemed mature and easy to use. With no prior experience with these specific tools I was able to gain a better understanding of my app within minutes, find and fix several memory leaks and improve performance. ![]() XCode Memory Leak Detection Android developers must use Android’s traceview application, which I found worked well but required significantly more effort to configure and operate. I was surprised to find that the source code must be changed in order to get the trace files required for analysis. I’m not sure if Android can provide heap dumps in hprof format. If it can then the awesome MAT tool could be used to analyze heap usage. According to this article Android can produce hprof heap data, though I haven’t tried it. App StoreIt goes without saying that the iPhone app store is excellent in that you can sell into many countries worldwide with a single setup. I was able to provide my Canadian bank account number, sign a few legal agreements and I was up and running. Getting an app into the store however is frustrating to say the least. Apple must approve every app before it is accepted into the store. Mine got rejected multiple times. Each time it was rejected I was given almost no information about why. When I emailed them to clarify the problem, I received what looked like a canned response indicating that I should refer to previous correspondence. If it weren’t so frustrating I would have found it funny. I highly recommend reading Brian Stormont’s Avoiding iPhone App Rejection from Apple and Dan Grigsby’s Part 2 follow-up. Of course once I started selling Hudson Helper I realized that Apple won’t send me any money unless the payout is greater than $250. This is true not only of the first payout, but every payout. Google market on the other hand requires a minimum of $1 for each payout. Both the iPhone app store and Google market take about %30 of your app selling price. $0.99 applications have to have high volume, or they’re simply not worth your time. The Google market by comparison to the Apple app store is terrible in that you can only sell into a handful of countries. You also can’t see or install apps that cost money on a developer phone. Actually you can, but not if the app has copy protection — which is almost every non-free app. On the other hand when you upload your app to the app store it’s available within minutes, so you don’t have to worry about an approval process. To set up a merchant account with Google market, I had to provide a US address and bank account number, since Google doesn’t support Canada. For me this was a pain, but not too bad since I live within a few kilometers of the US border. I rode my bike down to the US and opened an account with Horizon bank. The bank required a passport and driver’s license, so no problem there. Why Google doesn’t support more countries I don’t know. At the very least Google market should accept alternate payment methods for countries that are not supported by Google checkout. SummaryAndroid’s platform and developer tools are excellent. Leveraging Java and the Eclipse IDE are major winning factors for Android. Apple’s developer tools are shockingly bad by comparison. The Objective-C language and platform APIs are cumbersome and poorly organized. Overall when developing for the iPhone I felt like I was back in 1993. These factors combined in my estimation make application development about three times more expensive when developing for iPhone. The only area where Apple’s developer tools excelled was in profiling and heap analysis. Apple’s app store from a user’s standpoint and from a worldwide coverage standpoint are excellent. In this area Google market for Android is weak. Development for iPhone may improve as tools such as iphonical (MDD for iPhone) and objectiveclipse (Eclipse plug-in for Objective-C) emerge. We may see a shake-up in the mobile market, with at least 18 new Android handsets being released this year. Until that happens, iPhone will remain a market leader and developers will have to put up with XCode and Objective-C. For me, my love is with Android. Sure, the iPhone is great — but can you install a new Linux kernel? |
![]() BioClipse |
Bioclipse 2.0 Release Candidate 5Today, Bioclipse 2.0 Release Candidate 5 (versioned 2.0.0.RC5) was released with primarily a fix in the atom typing done when editing chemical structures, and a less stricter handling of SDFiles. The Bioclipse help is also available as standalone. The release requires a fresh download from Sourceforge, and we kindly ask beta-testers for bug reports on the bugs.bioclipse.net. |
![]() Benjamin Muskalla |
Eclipse Galileo and the Rich Ajax Platform (RAP)
As Galileo is out in the wild and we are all already working on Helios… I thought it would be handy to give a quick overview of the New and Noteworthy features the RAP team worked on for Galileo. Besides many, many bug fixes… we still found time to provide several new features. On top of the new features, we focused on making single sourcing even easier to do. New Look and FeelThis is one of the biggest features of RAP released as part of the train. As Ian already pointed out correctly:
While this was true in the past, we worked really hard to provide the community a clean and easy way how to customize the whole workbench styling. Cell EditorsIt’s finally done – RAP supports cell editors in the Table. As this was a really long-standing issue we’re more than happy to have it in 1.2. Ed, now it’s time to give the whole “generated EMF editor on RAP” idea a new spin! For anybody interested in this story, please CC yourself on this bug. Performance & MemoryThe RAP team really had a great time for this release – we just sat there and waited for the browsers to become even faster…as this was a really silly task we decided to do something: Improvement of Session Startup Performance First the creating of the startup page is less CPU intensive. Second the javascript library content is not embedded in the startup page anymore and will be delivered separately. As the library content doesn’t change after server start it can be zipped once and buffered. This reduces CPU usage significantly. The library is stored in the browser’s cache and need not to be reloaded on subsequent application visits. Client-side memory improvements Included is also a new version of the Javascript library qooxdoo. Thanks to the great support by the RAP community, most notably from Stefan Hansel who tracked down a number of significant memory leaks in qooxdoo and provided patches to the qooxdoo developers, this version now brings a major improvement in client memory consumption. With this qooxdoo version, the long-standing memory leakage problems of RAP especially in Internet Explorer are resolved. Thanks to everyone who helped making this possible! New API & WidgetsWith the idea of single sourcing in mind we concentrated on adding new API to allow even more reuse of existing SWT/RCP code. Besides many small things like Display#timerExec() we also tried to complete the set of widgets. With 8 (yes, eight) new widgets in this release, these two are my personal favorites and often requested by the community. DateTimeFormText (Forms)Cursor SupportSummaryIn case you’re not yet sure how “single sourcing” works – Ralf and Rüdiger would be happy to explain it to you step-by-step in their upcoming webinar. In summary, we’re quite happy with the current 1.2 release but are already looking forward to the Helios release train. If you have anything you want to see in 1.3, don’t hesitate and drop us a note. |
![]() Greg Wilkins |
Roadmap for Jetty-6, Jetty-7 and Jetty-8
This blog updates the roadmap for jetty-6, jetty-7 and jetty-8 with the latest plans resulting from the move to the Eclipse Foundation and the delay in the servlet-3.0 specification. Previously it was intended that jetty-7 was going to be servlet-3.0, but with the move to eclipse and with the delay of JSR-315, it was decided to delay servlet 3.0 to Jetty-8 later in this year. Thus the current active branches of jetty are: Jetty-6 @ codehaus & mortbayThe current stable branch is jetty-6 for servlet-2.5 and java-1.4 (some modules are 1.5). It is in the org.mortbay.* package space and is licensed under the apache 2.0 license. However, it is now mostly in maintenance mode and new features will not be added to jetty-6 unless there is compelling reasons to do so. It includes support for both HTTP server and client and comes bundled with a cometd server. Jetty-6 is the release for established, production-ready projects. Jetty-7 @ eclipseThe current development branch is jetty-7 for servlet-2.5 and java-1.5. It is in the org.eclipse.jetty.* package space and is licensed under both the apache 2.0 and eclipse 1.0 licenses and may be distributed under the terms of either license. Jetty-7 represents a moderate refactor of the jetty code base:
The intent of jetty-7 is to allow users to transition to the updated architecture and to access some servlet-3.0 features, within a servlet 2.5 container and without the need to update java 1.6 or to wait for the final specification later this year. There are milestone builds of jetty-7 available already and we hope to have an official eclipse release in the next month or two. The cometd client and server are now in the cometd.org project and are built against jetty-7. Some jetty integrations (eg jetty-maven-plugin, terracotta,
wadi, etc) and distributions (eg. deb, rpm, hightide) will remain at
codehaus and are now built from codehaus trunk. Jetty-7 is the release for projects starting development now. Jetty-8 @ eclipseThe current experimental branch is jetty-8 for servlet-3.0 and java-1.6. It is in the org.eclipse.jetty.* package space and is licensed under both the apache 2.0 and eclipse 1.0 licenses and may be distributed under the terms of either license. Jetty-8 is being kept in lock-step with jetty-7 as much as possible, so that it represents essentially the same server, but rebuilt with java-1.6 and using the standard servlet-3.0 to access the features already available in jetty-7. Jetty-8 is the branch for people who wish to experiment with the emerging APIs now. Webtide @ JavaOneIf you want more information about what exactly are these jetty and servlet-3.0 features, why not come to JavaOne 2009?! Webtide will be have a small booth in the expo (where you will mostly find me) and Sun have invited me to participate in their technical
session on Servlet 3.0 at JavaOne, together with Rajiv Mordani and Jan
Leuhe. I'll be presenting a section on the Asynchronous Servlets API
and giving a demonstration that uses some ease-of-deployment features
to deploy a webapp on glassfish using the Jetty asynchronous HTTP
client in a 3.0 asynchronous servlet. The session is |
![]() Greg Wilkins |
Google Wave - A new paradigm?
The announcement of Google Wave is a bold declaration of where Google sees the future of the web. Google, unsurprisingly enough, sees the future of the web as a server side paradigm, with dynamic updates being used to drive the thin client model to capture even more of tasks that where once done client side. Google are extending the server side model of webmail to apply to applications that have been fundamentally client side, such as document authoring, IM and chat. Some have said that Wave's use of XMPP represents the death of HTTP, but I think they've got the wrong end of the banana! Wave is using XMPP to federate servers together, not clients. When it comes to client/server communications, Wave is using GWT over good old HTTP, with some push extensions so that a client can get a dynamic view onto a Wave document, which is a fundamentally server side entity. If anything, Wave has declared that HTTP is king and a near immortal one at that. Google's use of XMPP is roughly equivalent to the existing use of SMTP between mail servers. Instead of passing mail documents between servers using a store and forward model, Wave has the servers dynamically collaborating to maintain a live Wave document that contains content, style, history, permissions and private content. The protocols that Wave might put on the endangered species list are SMTP, POP and IMAP (but have any protocols gone extinct? Has a gopher been sighted in the wild recently or only in captivity?). If Wave is successful (and it certainly looks pretty compelling), then more traditionally client side state is going to be captured on the server side. This is a great model for google, as it lets them use their massive serverside databases to power their serverside robots like spelly and rosey, which access the vast databases of Google to do contextual spell checking and translation. You will never get such robots running client side and it is services like these that makes Google confident that they can offer better wave servers than anybody else - hence they do not fear opening up their Wave servers to competition. So Googles' webmail competitors had better start thinking of compelling reasons that people will want to host their waves on non-Google servers. Of course for Jetty, Google Wave is just a brilliant story. To implement a Wave server, you will need a flexible, performant web server that can well support dynamic push content and will affordably scale into your wave clouds (should they be called oceans rather than clouds now?) Jetty is the ideal Wave server! In fact because Wave uses GWT, Google AppEngine and links to shindig, it is already based on and/or using the Google services that are based on or use Jetty. For our other key project, cometd.org, the picture is a little less clear. Google Wave does it's own comet implementation based on long polling using GWT RPC. But Wave reinforces that comet is now a core web paradigm. Any alternative implementations of Wave that do not use the google GWT code base, would do well to look to cometd.org as a core technology.
|
![]() Greg Wilkins |
Bidirectional Web Transfer Protocol - BWTP
I really like the idea behind the HTML5 Websocket API - namely that a datagram model should be used for web application communication rather than a request/response paradigm (this is also the idea behind cometd). But unfortunately, the proposed protocol to carry websocket traffic is neither a good protocol nor is it well specified. After failing in an attempt to get the WebSocket protocol improved, I decided to try to define a better solution. I had intended to work privately on this for a while, but the twittersphere has pointed out an early draft, so I've put the work-in-progress on http://bwtp.wikidot.com and I invite review, feedback and collaborators. So what's so bad about the Websocket protocol proposal? The main things I dislike are that the document is impenetrable, the protocol inflexible and it is entirely different from other IETF application protocols for no good reason. But rather than throw (more)mud, I'd rather sing the praises of the approach that I have taken:
If you are interested, I encourage you to join the IETF Hybi mailing list and to join the discussion ragarding the bidirectional web.
|
![]() Ekkehard Gentz |
[galileo] Cool Views to control Plug-ins (IDE)
Part 7 of my Galileo Reviews around Target Platforms. An Overview of this blog series can be found here. If you look at the Views available under “Plug-in Development” you should see this:
If there’s no “Graph Plug-in Dependencies” View, then you should install it from http://download.eclipse.org/eclipse/pde/incubator/visualization/site There’s another Bundle available: Neil’s Bundle Monitor. You can install the Bundle Monitor from http://neilbartlett.name/downloads/bundlemonitor/site.xml If Neil’s Bundle Monitor is installed, then you have some more Views available:
in this Blog we’ll use the Bundles View and the Services View from Bundle Monitor. (HowTo use the Configuration View is another story and will be covered in a blog of my osgi – applications – blogseries) Additional to these Views you can get informations of Plug-ins from your running IDE from the “About > Installation Details” Page. Two different kind of ViewsPlease remember, that there are Plug-ins installed into the IDE and also Plug-ins installed into your Target Platform, so you need two different kind of Views !
If your IDE is also the active running Target Platform – then in this case all Views are pointing to the same set of Plug-ins. Lets structure the Views now depending on the source where the Plug-ins are from:
In this blog entry we’ll look in detail @ Plug-ins defining your IDE (1.1 … 1.5). The next blog entry will cover the Target Platform (2.1 … 2.4) 1. View @ Plug-ins defining your IDEAll these Views are using your Plug-ins (Bundles) installed at the running IDE. 1.1. Plug-in Registry View The Plug-in Registry View got many enhancements compared with Eclipse 3.4. Lets look at some different kind of bundles and see what kind of informations now are available. Run-time Libraries: if a Bundle defines Run-time Libraries, they are listet. (example from plug-in com.brosinski.eclipse.regex)
Extension Points: If Plug-ins are defining Extension Points, you can inspect them.
Required Bundles: The required Bundles are listed under “Prerequisites“. @ Location: You also see that there’s always an information about @ Location where you can easy control where the bundle comes from: per ex. eclipse/plugins installation or dropins directory
Registered Services: Informations about Services in Plug-in Registry View are new in Eclipse 3.5 and are shown with informations about Service ID, Interface, Properties and (very useful) which bundles are using the Service at the moment.
Used Services: gives you informations which OSGI Services are used by this Plug-in. BTW: It doesn’t matter if a Service is a classic OSGI Service or a Declarative Service (DS) – all are displayed in the Plug-in registry View.
Fragment Bundles: Fragments are easy recognized – they have an own icon. The Host is displayed right beside the Version.
Imported and Exported Packages: also new in Eclipse 3.5 you get detailed informations which Packages are imported and which ones exported. Great for me as I’m a fan of using Imported and Exported Packages where possible.
Options: Right-clicking on a Plug-in there are some options:
Options with Advanced Operations: if advanced operations are ON, there will be some more commands available bringing functionality of OSGI Console into Plug-in registry View):
Group By: By default the Plug-in Registry View is groupd by Plug-in, but you can also group by Extension Point and Service.
Group By Extension Point: you can easy find the Extension Points avalable and control who’s contributing an extension and what variables are set.
Group By Services: The Interface, who registered the Service, what Properties are set
Group By Services (DS): In this case its a Declarative Service and you also get Informations about the Component. Also you see that this Service is used by a Bundle, the other Service above was registered, but not used yet.
From my POV the Plug-in Registry is very helpful to analyse your running IDE and I dont want miss it. Thx to the PDE Team that DS are very well integrated. 1.2. About > Installation Details > Plug-ins As seen in previous blog there’s also a list of all Plug-ins from running IDE. 1.3. About > Installation Details -> Configuration The Installation Details offer informations about your Configuration. You should open this and explore the content. Here are only some parts: The installed Features:
The installed Plug-ins: with exact informations from bundle-lifecycle – you see if a bundle is [ACTIVE] [STARTING] [RESOLVED] etc.
… and much more. 1.4. Bundle Monitor > Bundles View If you have installed Neil Bartletts Bundle Monitor, the View OSGI Runtime > Bundles looks like the OSGI Console and gives you an information about the state of your bundles from running IDE. (You can include this view also into your RCP application to display the infos from your Runtime then)
From this View you can also
Attention if Installing Bundles ! (see below) Right-clicking on a Bundle gives you:
The Properties are displaying informations from the MANIFEST. From your IDE you can easy open the MANIFEST directly, but if inside an RCP app its a good option to explore things.
ATTENTION: If you Install a bundle from Bundle Monitor then
Why are some nice features from Eclipse 3.5 not available ? If you look into Installation Details > Configuration you see the Bundle is recognized as “Bundle in System”, from “Plug-in registry”, but not as “P2 IU – Installable Unit”. The missing P2 is the key: “Bundle Monitor” doesn’t support P2 at the moment. The nice thing: you can easy test some bundles in your running IDE without persisting the installation – only do a restart and they are gone ! if all works as expected then you can install them after restart the usual P2-aware way. I like Neil’s Bundles View: its great to see the State of all Bundles – and sometimes its good to have a way to install a bundle without letting P2 knowing about 1.5. Bundle Monitor > Services View The Services View from Bundle Monitor gives you a List of all Services:
In this case I would prefer to use the Plug-ins registry View grouped by Services. But installed into a RCP app this View can be used to display all Services. (or use it in Eclipse 3.4 Installations without Services listed under Plug-ins Registry View) The next blog entry of my Galileo reviews will look in detail @ Plug-ins defining a Target Platform. Posted in Eclipse, Equinox, Galileo, OSGI, P2, PDE![]() |
![]() Dave Carver |
XText for RelaxNG Update
Peter Friese spent some time with me this afternoon to help work around some of the issues I had with the EBNF grammar and Xtext. The results are very encouraging. |
July 02, 2009
![]() Tom Schindl |
E4 – A new area for RCP/RIA-Applications
I’m on the road to prepare my example for the E4 talk I’m delivering on the Eclipse-Developers-Day in Karlsruhe and I have to say that in my eyes E4 is going to open up a new world for Eclipse-RCP-Developers. Though RCP-Applications written in 3.x might not look too bad no one can deny that the UI-Design is coming from an IDE background and compared to modern Web-UIs it looks boring (which is not a bad thing per se for business applications). The problem in 3.x is that it is very hard to impossible to change the L&F of your application. E4 provides different multiple solutions to fix the L&F:
To demostrate what you can achieve when you combine the 1st and 2nd possibility I create a small screencast where you see the famous E4-Photo-Application revamped
A second example application is our E4-Contacts-Demo created and maintained by Kai Tödter which shows advanced css-styles like radial gradients.
I use this application to show you another nice thing you can do with E4’s declarative styling support. You can adjust the styling of your application while it is running so that you can experiment with various font and color settings WITHOUT shutting down your application. If all this would not be enough you can run the unmodified code (please take this literally) from the example application above in your browser using the RAP-Framework.
If you are interested in E4 and what’s going on behind the scenes of the next major Eclipse-Release I hope to see you in Karlsruhe on Tuesday July 7th. ![]() |
![]() Martin Lippert |
Slides from Talk at Java-Forum-Stuttgart 2009
Today I gave a talk on building dynamic applications with OSGi at the Java-Forum-Stuttgart 2009. This was mostly the talk I gave (and prepared) together with Kai Tödter and Gerd Wütherich for previous conferences. Here are the slides: |
![]() Bryan Hunt |
Running Rational Team Concert (Jazz) on Eclipse 3.5 / Mac OS X
Rational Team Concert 2.0 has been released. With a little work, you can get the client running on Eclipse 3.5 and the server running on Mac OS X. ServerThe Jazz team does not officially support running the server on OS X, and a download that runs on OS X out-of-the-box is not available. With a couple of minor modifications, the Linux server download will run on OS X just fine.
<Connector port="9443"
connectionTimeout="20000"
maxHttpHeaderSize="8192"
maxThreads="150"
minSpareThreads="25"
maxSpareThreads="75"
enableLookups="false"
disableUploadTimeout="true"
acceptCount="100"
scheme="https"
secure="true"
clientAuth="false"
keystoreFile="ibm-team-ssl.keystore"
keystorePass="ibm-team"
sslProtocol="TLS"
algorithm="SunX509"
URIEncoding="UTF-8" />
If you want to make sure the server started correctly, you can tail -f tomcat/logs/catalina.out and watch the server startup. If you see any exceptions thrown, something went wrong. If all goes well, the last message you see in the log should be: INFO: Server startup in xxxxx ms To get started right away, launch Safari and point it to https://localhost:9443/jazz login with User: ADMIN and Password: ADMIN. You can use this admin account to create a personalized account. Don’t forget to give yourself a Developer license. ClientThese instructions are not specific to Mac OS X – they should work for any OS. The Jazz team does support a Mac OS X Client as an incubator project, but the client is based on Eclipse 3.4. You can download the client and get the jazz bundles to work in an Eclipse 3.5 environment. The Jazz client has dependencies on the following features: With the exception of SDO, all of the features can be installed from the Galileo update site. To get SDO, add the EMF releases update site and install the SDO runtime from the EMF 2.4.2 release. From the downloaded client, move all of the sub-folders in jazz/client/eclipse/jazz to your Eclipse 3.5 dropins folder. You could use P2 to install the contents of those sub-folders; however, you must manually check every bundle to be installed. I’d rather spend 10 seconds doing a drag-and-drop rather than 15 minutes checking checkboxes. After you launch the client, you should be able to open the Team Artifacts view and create a connection to the repository at https://localhost:9443/jazz Next StepsSee the Jazz web site for tutorials on getting started. Update: Added -XX:MaxPermSize=256m to the server instructions ![]() |
![]() Dave Carver |
XText for RelaxNG
So, I decided to try and create an XText Grammar for the RelaxNG Compact Syntax. Mixed results so far, mainly having to do with my lack of knowledge on the XText grammar and it's mapping to EBNF.
Some of the errors I can figure out...others are just baffling. Particular the ones where it can't find the Rule even though it's been editted. Help from the XText gurus out their would be appreciated. |
![]() Sven Efftinge |
Xtext scopes and EMF index in action
This is a post about scoping and how to use the EMF index for that. It is in some sense a practical follow up on another blog post about the general idea behind indexing and scoping in Xtext. The topic is somewhat advanced and bleeding edge. This post describes the needed steps to get the current index based default scoping up and running. I've prepared a small screencast demonstrating the result in action. The example language can be downloaded from here. import "platform:/resource/my.project/src/othermodel.dsl"The corresponding default scoping is very simplistic. Every object in the current resource and in the referenced resources can be referenced by its simple name (as long as it has a 'name'). Although this is very easy to understand, it has it's limitation when it comes to more sophisticated design. If you for instance want to hide some elements or have duplicate simple names in different packages (this can be the case if you use elements, which are developed by others). In many programming languages we have the notion of namespaces, which are much more flexible and powerful. Java, for instance, is file system agnostic. Although it forces you to put the files into folders which correspond the packages, it ultimately is just based on namespaces (packages, types). That said Java's namespace mechanism is also a bit limited. For instance I cannot have imports in nested namespaces but only per file. And I cannot nest packages but only classes and interfaces. Scala and C# both allow to have multiple nested packages within one file and you can put imports per namespace, so that imported names are only visible within that namespace. In order to demonstrate how to use the index together with Xtext, I've implemented a DefaultIndexBasedScopeProvider which implements a similar semantic. There's a small example I've prepared, where you can see how it can be used. It is mainly a matter of configuring the different implementations with Guice. Programming is not needed as long as you're happy with the defaults. Here's how it works The index registeres a builder, which is invoked on resource changes. In order to make your model elements visible, you'll have to contribute a so called Indexer using an extension point. <extension point="org.eclipse.emf.index.indexer">Please ignore the ExecutableExtensionFactory, which is declared in order to make any executable extension Guice aware, that is you can use dependency injection. This is a different topic and might be covered by another blog post. The actual class to be instantiated is the one after the colon (':'): The DefaultDeclarativeResourceIndexer, which delegates to an instance of IQualifiedNameProvider, which itself is injected. This means that its implementation can be arbitrarily changed. The contract of a name provider is very simple: it computes a qualified name for an element, if it returns null, the element is not indexed and hence not referable. By default we use a DefaultDeclarativeQualifiedNameProvider, which if not otherwise specified looks up a simple name (if there's an attribute 'name') and concatenates it to the qualified name of its parent. It's named 'declarative' because you're able to change the described default behavior per type by just adding a method like this: String qualifiedName(MyType foo) {It will automatically dispatch to this method as soon as it has to compute a qualified name for an instance of MyType.With this in place we'll have our elements automatically indexed as long as they are in a project, which have the index nature enabled. Being indexed means that they are globally visible by their qualified name, which is comparable to how public Java elements are globally visible as soon as they are on the classpath. What's next? In order to use the index and have it injected into your components (e.g. your scope provider) you'll have to configure the singleton instance from the index bundle into your Guice module. In the example the corresponding binding goes into the UI module and looks like this: public IndexStore bindIndexStore() {With that in place you can inject the index store by just adding a dependency in your code:@InjectGuice will automatically put the instance into such declared dependencies. Now that we have a binding for IndexStore we can add the index based scoping to the runtime module: public IndexStore bindIndexStore() {Note the additional IndexStore binding, which is overridden by the binding we previously added to the UI module, but is needed in order to use this stuff at runtime (i.e. without running within exquinox). So it gets active as soon as you run without UI.How the DefaultIndexBasedScopeProvider works The DefaultIndexBasedScopeProvider - looks up EAttributes with name 'importNamespace' - and translates the globally unique qualified name into shorter ones using those import statements. By default qualified names with or without a wildcard at the end are supported. For an import of a qualified name the simple name is made available as we know from e.g. Java, where import java.util.Set;makes it possible to refer to 'java.util.Set' by its simple name 'Set'. Contrary to Java the import is not active for the whole file but only for the namespace it is declared in and its child namespaces. That is why you can write the following in the example DSL: package foo {Of course the declared elements within a package are as well referable by their simple name:package bar {Of course the following would as well be ok:package bar {DisclaimerAll this is in a very early stage. The index is not finished and its architecture is not settled down yet. Also the scope provider implementation might be changed in future (I'm sure it will). Additionally, there are other things around this which we have to work on before considering this mature. But as I know that there are a lot of bleeding edge users out there, I wanted to share the current state, so you might find a starting point to play with it. The index is an enabler for more advanced functionality in Xtext and in EMF based development in general. So expect it to become an important part in Eclipse Modeling. Feedback is highly appreciated and should either go to the newsgroup for Xtext (the scoping part) or to the EMFT newsgroup (the index part), because the index project is a component under EMFT. |
![]() Vasanth Dharmaraj |
Portable Eclipse and Portable Java
I like portable software. I carry around a bunch of them in my flash drive. I just found out that both Java and Eclipse are available as portable versions at PortableApps.com. The Java version they have is Java 6 update 14 but Eclipse is stuck at 3.4.2. Eclipse uses portable Java, so Java need not be installed in the PC to run it. Nice. The portable version has some trouble finding the workspace but once you correct the path it works fine. I updated the Eclipse binaries in to the just released 3.5 and it work great too. Nice way to take Eclipse and your work with you. Related posts:
|
![]() Ed Merks |
Talking About Connected Data Objects
My personal Berlin tour guide, Eike Stepper, and I did a Galileo Series Podcast about CDO with James Sugrue the other day. |
July 01, 2009
![]() Eric Rizzo |
Screencast: Creating an Eclipse download package "from scratch"
If the cave you've been living in does not have Internet service, then perhaps it will come as news to you that Galileo was successfully released last week. It's a truly impressive feat to release so reliably so many projects year after year - you'd think that corporate internal and consumer software projects would take note and figure out what it is that enables the yearly release train to succeed when so many projects deliver late, over budget, or not at all. But, I digress... http://download.eclipse.org/technology/epp/packages/galileo/ |
![]() Kenn Hussey |
On Falling...
It's been just under two years now since I left the mother ship for an opportunity with Embarcadero, and I've seldom looked back... until today. On this day, when most other Canadians are celebrating the birth of our great nation and the freedom it affords its citizens, I'm faced with commemorating a new found freedom of my own. I've been exiled from Cubicle Nation. This isn't exactly the kind of change I had in mind when I wrote my last blog entry, but I'm committed to facing it with an open mind (seeing as I have no choice). I don't know what I'll be doing for income yet (if you have any suggestions, I'd love to hear them), but in the meantime I thought it would be an apt occasion to take another wordle snapshot of my blog (exactly six months after the last one). ![]() So far, 2009 has been a challenging year. But, a friend of mine told me recently that a kick in the pants is still a step forward, and I'm inclined to agree. I really should be seeing this as more of a beginning than an end, and I'm sure that once I've landed with two feet firmly planted on my next venture, this will be obvious in hindsight. One thing is for certain, though. I'll not be looking back again.
|
![]() Chris Aniszczyk |
Training for Eclipse Galileo and p2
As part of the Eclipse Galileo release, we updated all of our training courses to reflect the latest release:
We have also added two new courses to cover two popular topics, Equinox p2 and migrating to Galileo RCP: We are also offering our courses online now. If you’re interested in any of these courses, please email us. |
![]() Jens von Pilgrim |
User Report: Migrate from oAW Xtext to TMF Xtext
With Eclipse 3.5 comes the new version of Xtext, called TMF Xtext. Since I had to switch to Eclipse 3.5 in order to keep GEF3D running on the latest Eclipse version, I decided to migrate from the old openArchitecture Xtext (oAW Xtext) to the new TMF version. The SettingI have written a model transformation language, and it consists of an Xtext grammar (with about 90 rules), an interpreter for executing the language, and other things which I didn't expected to be involved in the migration, as a debugger component or other user-interface stuff. An Xtend-based M2M transformation exists which modifies the generated ecore model in order to set some default values, add some workarounds for existing oAW bugs, and do other things. In order to migrate my application, I had to
In the following old versions are highlighted with a light red back and the new ones with a light green background. Migrating the GrammarAs described in the Xtext documentation, I had to replace "Enum" with "enum", and add two new lines at the beginning of the grammar. Since "with" has become a keyword. Thus I had to rename "with" in my grammar : into This also caused some small changes in the model and the client code. Is there a way to use Xtext keywords as a reference names? BacktrackingApparently the parser generation (or some settings) has changed, too. E.g., the following rule worked with the oAW Xtext version: The idea of these rules is to force the definition of a name in case of qualified parameter references and to make it optional in simple ones. Unfortunately these rules are not working with the new version. Since ANTLR is a LL-parser, there are some constraints on how to define the grammar. There is a document explaining how to remove backtracking from a grammar, unfortunately some of the described techniques cannot be used with Xtext. In some cases I was able to fix the problem by rewriting my grammar, as in this example: I simply had to reorder the first rule: In some cases I couldn't find a solution (maybe it is possible, but I'm not an LL/LR-expert). Actually I'm not the first one with this problem, and there is a posting in the TMF newsgroup about this. If you cannot rewrite your grammar, you need backtracking (and lookahead). Thanks to this posting, I was able to fix the problem. I had to edit the MWE-file from to Note that you have to install the itemis generator fragment from http://download.itemis.com/updates as described in the Xtext documentation (page 62). Maybe I'm going to "left factor" my grammar in a future version, but for now I only wanted to get my application running. Lexer RulesIn the oAW version, lexer rules were defined with the keyword "native", which has been changed to "terminal". Not mentioned in the migration guide yet: INT was redefined in the new version. I had rewritten the definition in the old version in order to remove the optional sign (as my language is handling this itself). This is the old INT definition: And here's the new one: In my case I could remove my own definition since the new one matches my requirements. In other cases, this might be a trap. According to the documentation, it should be possible to define the type of a terminal rule now. I tried this as follows: As a matter of fact, the code is generated as expected, but the parser still returns a String, which leads to a ClassCastException. So I removed the type definition and added a convenient method to my model, as described below. I assume this is a bug or something, I will file a report later on ;-). Since the old version always returned Strings, my code was prepared for that, anyway. OrmPackage missingI don't know exactly why or when, but at some point in time my grammar file contains got an error marker: This bug seems to be fixed already, fortunately it is possible to generate the model and code from the grammar, even with this error. Unassigned ActionsIn the oAW Xtext version, a model element was assigned whenever a non-abstract rule was hit. My grammar contained the following rule: This rule is not working with the new TMF Xtext version. As found in the documentation "by default the object to be returned by a parser rule is created lazily on the first assignment". Although I've read that passage, I was not aware of the consequences. In the new version, an element is not automatically created when the rule is hit, but only when an assignment is to be executed. That is, a rule which contains only terminals does not create a model element, as in the example above. While this first example is obvious, the problem is sometimes hidden. Here is another more tricky example: If no "BlockStatements" are specified, that is in case of an empty block ("{}"), no block element is created at all. I posted that problem to the newsgroup, and Sebastian Zarnekow immediately solved my problem (Thank you very much, Sebastian!). The solution is to use unassigned actions, which forces the creation of an element of the specified type. So I had to change the rules above as follows: I figure this is a bitchy trap, especially if there is an optional assignment. Model ChangesI'm already using an Xtend M2M-transformation to adjust the generated ecore model. TMF Xtext supports this mechanism, I simply had to rename my Xtend extension into MitraPostProcessor.ext (Mitra is the name of my language, by the way). Enumeration NULL valuesThere are some adjustments necessary due to changed behaviour of Xtext. Most notable: There is no "NULL" value generated for enumerations. Also, it is not possible to define a hidden enumeration in the grammar, which might could have solved that problem. IMHO, this is a major drawback, as this makes a postprocessing of the created ecore file necessary. But they can be added to the M2M transformation. Unfortunately, I didn't got this problem solved with Xtend, I posted that to the TMF newsgroup. This is at least one solution using Java, although I would prefer a pure Xtend solution: And this is the Java extension: public class MitraPostProcessorHelper {In order to make a literal the default value, it must be the first defined literal. This is why e.getELiterals().add(0, nullLiteral); is required, simply adding the literal with e.getELiterals().add(nullLiteral); doesn't work.Java Body Annotation in the Ecore ModelIn the old version, Xtext didn't create the genmodel and no code. I added this feature and I also edited the generated code after is was created using oAW extension. Since Xtext is doing the code generation now automatically, I didn't feel that comfortable with manually editing the generated model code anymore. So I decided to add Java annotations to the ecore model in order to add some tiny helper methods. This is how body annotations are added to an ecore model in Xtend: API ChangesSo far I found three API changes which required changes in my code. These changes are rather simple and briefly explained in the following. NodeUtil.getNode(..)First of all, NodeUtil.getNode(EObject); has changed. There is no type Node anymore. I had to change my code fromNode node = NodeUtil.getNode(eobj); to NodeAdapter adapter = NodeUtil.getNodeAdapter(eobj); Resources and SetupFor (JUnit) tests, I have to call a setup method in order to register Xtext's resource implementations and my model. This is now simply achieved via a generated setup method. This is the setup method I'm using now in JUnit tests: public static void setup() {No DSL-specific Editor ClassA little bit surprising at first is the absence of a DSL specific editor class, in my case MitraEditor. Instead, the general Xtext editor class is used, DSL specifics are injected using Google Guice as described in the Xtext manual. Most surprising is the new syntax found in the plugin.xml which is used to inject things. Here is the declaration of my editor using the new notation (the plugin.xml is generated):The attribute "class" defines the Guice module to be created and the editor class. Unfortunately I need the editor class in order to add breakpoint markers (for my debugger plugin). The old version looks like this: public class MitraBreakpointAdapterFactory implements IAdapterFactory {How do I identify the mitra editor in the new version? First of all, instead of a generated DSL specific editor, an XtextEditor is used (this class is found in plugin org.eclipse.xtext.ui.core). Then the current language can be retrieved via getLanguageName(). This is the new version:public Object getAdapter(Object adaptableObject, Class adapterType) {Note that the name of the editor class has to be changed in the plugin.xml of the debug plugin accordingly. SummaryAfter applying the changes described above, my language worked as expected (at least all the tests are green and my application is running). Since I haven't written any extensions for content assist or other UI things, I only had to adjust the grammar, my M2M-transformation and the code a little bit. If you do not have an M2M-transformation, you may have to add it in order to add the missing NULL values for enumerations -- I assume this is the case quite often. TMF Xtext adds some very nice features (grammar mixings, improved linking/cross references feature with ILinkingService, serialization with formatter, return types, and tree rewrite actions). These features will simplify my hand written code immensely, and I'm looking forward using them. Last but not least, since Xtext is now part of the Eclipse modeling package, it is much easier to install an Xtext based DSL and editor. Last but not least: Kudos to the Xtext team! The new version looks really nice! And many thanks for the great and fast (newsgroup) support! |
![]() Heiko Behrens |
Xtext at DemoCamp London in June 2009
This Monday the Eclipse DemoCamp took place in London at Skills Matter. You will find a comprehensive review at InfoQ by Alex Blewitt where you can read about NatTable (Dan Pollitt) and JQantLib/OSGi (Richard Gomes) as well as Xtext. And thanks to Eren Aykin you will find a video podcast of the latter, too! This time I tried to spread the idea of DSLs with chess and different ways of expressing moves within the game. In the first part of my presentation I processed cryptic notations like “Rd2-c2″ or more natural equivalents such as “rook at d2 moves to c2″ to work with them as true Java objects and eventually visualized chess fields. Second, I tried to emphasize the value of DSLs in today’s software projects where we implemented another DSL live at the DemoCamp in the end. You will find my slides at SlideShare again. It was quite informative to chat with the Eclipse folks in London afterwards. Most of them have a pragmatic view at modeling and tools in general. I really appreciate this! Thank you, Neil, for organizing this event and inviting via twitter. LinksSource CodeLoading chess DSL text files as Java objects: package org.xtext.example.chess;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.xtext.example.ChessStandaloneSetup;
public class JavaTest {
public static void main(String[] args) {
String filename = "some/path/MyModel.chess";
Game g = getGame(filename);
System.out.println(g.getWhitePlayer() + " vs. " + g.getBlackPlayer());
for (Move m : g.getMoves())
System.out.println(m.getSource() + " to " + m.getDest());
}
private static Game getGame(String filename) {
ChessStandaloneSetup.doSetup();
ResourceSet rs = new XtextResourceSet();
Resource res = rs.getResource(URI.createFileURI(filename), true);
return (Game) res.getContents().get(0);
}
}
|
![]() Ekkehard Gentz |
[galileo] Manage Plug-ins (bundles) of Eclipse Target Platform
Part 6 of my Galileo Reviews around Target Platforms. An Overview of this blog series can be found here. We finished part 5 with a Target Definition containing Plug-ins (bundles) from different kinds of locations:
Fine-tuning the Selection of Plug-insAt the moment all Plug-ins from all added Locations are selected. You can display the Content together with your Locations on the first page checking “Show Plug-in content” …
… or you switch to the “Content” Tab where you have some more control.
You can check if Source Bundles should be shown or not and also group the content:
And as usual there’s a Search field to make it easy to find Plug-ins:
But the most important is the little ckeckbox which allows you to
Now its easy for you to fine-tune your Plug-ins and save the selection in the Target Definition file. There’s also the option to “Add Required” – you can test if after Selecting / Deselecting all Required Bundles are selected in your Target Definition. Attention: this option perhaps Selects Plug-ins you Deselected before without giving you an information which Plug-ins are re- selected to fullfill the requirements ! Defining the EnvironmentBeside the “Content” tab there’s also an “Environment” tab:
If your Target Environment is the same as your IDE (running Host platform) is running from, then you can leave this empty. But its usual that you have some different Environments where your product should run – even if you only develop for one OS. per ex. under OSX you should test and run under JVM 5 cocoa 32-bit, JVM 5 cocoa 64-bit, JVM 6 cocoa 64-bit, JVM 5 carbon. Its a good idea at first to start with the same Environment then your IDE is running and later duplicate the Target Definition file for different Environments. Or another strategy could be to put all (OS – specific fragments etc) into one Target Platform Definition and have different Launch configurations using different Environments / Plug-ins / Fragments. But thats a story for another blog and outside of the “Galileo Review Scope”. The only thing you should have in mind now:
Lets go back to the Preferences Page “Preferences -> Plug-in Development -> Target Platform“ Updating Plug-ins (bundles) of your Target PlatformThe Preference Page shows the active and all available Target Platforms:
As you already learned you can add (and move) or remove Target Definitions from here. Edit… is nearly the same then from the Target Definition Editor described above. Hint: I had sometimes the problem, that my selections of Plug-ins were destroyed, esp. if using the search-field on the Contents page, but it wasn’t easy reproduceable. So its a good idea to have a backup or put the Target definitions under CVS – then its easy to compare and restore. To see if there are newer versions of your Plug-ins you can start a “Reload…” – your Sources will be contacted and newer Plug-ins fetched. Double-clicking to Edit the Target Definition does the same job. But this works only, if its the same version and only the Qualifier changed. This means its great and easy to use if you always need the newest I-Build of the same Version. If you need a new Version (Update), then you should duplicate the Target Definition (do this in your Workspace project), change the title and name to reflect the new version and select the Plug-ins with the new Version or choose another Software Site or Directory. Then its also easy to test per ex. 1.0.0.M1 and 1.0.0.M2 by switching the active Target Platform from Preferences. The next part of my blog series will explain you all the new cool views of Eclipse 3.5 helping you to get more informations about the Plug-ins from IDE and Target Platform. Posted in Eclipse, Equinox, Galileo, P2, PDE![]() |
![]() Laurent Goubet |
Acceleo 0.8 is out
You might already know Acceleo 2.6, the open source model-to-text generator, and wonder how version 2.6 could come down to 0.8. The reason is quite simple : after four years of development outside of Eclipse, Acceleo is now taking a turn (for the better we hope :)) since we began rewriting it within Eclipse as the implementation of the OMG MOF Model to text Transformation Language (MOFM2T) specification. This change and our becoming an Eclipse-hosted project calls for a mandatory incubation period, thus version numbers "0.x". |
![]() Thomas ten Cate |
New build instructions
Because of many problems I experienced with Darcs, I converted the EclipseFP repository to Git. I really like the clean and simple model and UI of Darcs, and I’m sorry to see it go, but it was simply too slow and too unreliable. Also, I removed all dependencies on Cohatoe. Without further ado, here are the new and improved instructions in case anyone wants to test-drive my current work. As usual, this assumes that you have GHC, cabal-install, and git. I tested only on Ubuntu 9.4, but there is no reason why it shouldn’t work on other Unix platforms. There may still be some issues on Windows.
A known issue is that you have to save a file before it gets loaded into Scion, so you don’t get type tooltips and go-to-definition until then. This will be resolved in the near future, maybe tomorrow. After nine consecutive days of work, I’m taking a day off now. Again, please let me know if you tried this. Also let me know if something didn’t work, so I can improve it! ![]() |
![]() Jerome Benois |
Quelques news Spring et Acceleo
Je suis très heureux d'annonçer la sortie imminente de la nouvelle édition de "Spring par la pratique". La parution en librairie est prévu pour le 9 Juillet 2009 et la version ebook est d'ores et déjà disponible. Un grand bravo à Thierry Templier, Arnaud Cogoluègnes et Julien Dubois qui ont fait un travail de titan sur cette nouvelle version. Vous y trouverez toutes les nouveautés de Spring 2.5 et Spring 3.0 ainsi que des nouveaux chapitres sur Spring Batch ou encore Spring DM. J'ai eu l'occasion de participer modestement à cette aventure et de
contribuer une annexe traitant de l'industrialisation des développements Spring
dans Eclipse. Vous devez vous doutez que cette industrialisation est basée sur
une approche dirigée par les modèles et utilise le générateur Acceleo Cette nouvelle version atteignant pas moins de 680 pages, les annexes ne seront pas inclus dans l'édition. Mais elles seront bientôt disponibles pour tous en téléchargement sur le site dédié créé pour l'occasion : http://www.springparlapratique.org. La listes des annexes :
Aussi, je profite de ce billet pour relayer l'annonçe de Freddy sur un événement à ne pas manquer "Eclipse Acceleo Day". La communauté Acceleo se retrouvera le 10 Juillet 2009 à Nantes. Cette événement se déroulera pendant les 10ème RMLL. Vous trouverez toutes les informations ainsi que le programme complet ici. Inscrivez-vous vite, il ne reste que peu de temps avant la clôture des inscriptions ! |
![]() Alex Radeski |
64bit Cocoa Galileo Keyboard Problem Fixed (kinda)
I refused to give in to my keyboard problems I posted about yesterday and it looks like a bit of perseverance has paid off. |
![]() Gorkem Ercan |
New Java for S60
Nokia Java Runtime 2.0 for S60 (JRT 2.0) has been released for beta testing and now available from Nokia beta labs site. This is a package that upgrades the Java runtime on the phone (tested with Nokia 5800 XpressMusic, and N97) with this new one. This is the first time we are testing the independent release/upgrades of Java Runtime from S60 releases. In the future this will allow us to deliver the latest and greatest JRT to older phones. Some of the new features and improvements that will be noticeable (also listed on release notes) are one-click application installation, application launch user experience, and execution performance. I must tell about a feature that I am proud of and can be interesting to the readers of this blog. The Java installer in JRT 2.0 (the application that installs midlets) is itself a Java application. In fact, the UI(prompts etc. ) for the installer is developed using eSWT. I am very excited about the new installer because it proves that eSWT can be used to create native looking UIs, even ones that are integrated to the system. |
June 30, 2009
![]() Thomas ten Cate |
Compiling and error reporting
During the last few days, I have been reinstating error reporting. Previously, EclipseFP would call GHC, collect its output in a Java string, and send that string off to Cohatoe (the now defunct bridge from Java to Haskell). A Haskell module would parse the GHC output using Parsec, return the result back to Java, where EclipseFP would do fancy things with the parsed output. If this all sounds very roundabout, you’re right. We are already interfacing with Haskell in the form of the Scion server, so why not let it do the compiling and send us (EclipseFP) the result in a formatted way? Thoughts in this direction are under way, but currently hampered by a few factors:
In the light of all these obstacles (especially the first one, which cannot be solved by installing a HEAD build of GHC) I decided to keep the current way of calling GHC as an external process. However, this meant that the output parsing had to be rewritten in Java. Moreover, because compiling a large project might take a while, gathering up all output and processing it all at once is not the best approach. My new parser works directly on the output stream from the GHC process, so all errors will appear live in the IDE as soon as GHC spits them out. With that in place, I sprinkled on some UI code (oh, this makes it sound so easy…) and got things working again. Like error squigglies:
You can hover over the error to get the message. Note that an error marker is also shown in the left margin, and next to the scrollbar. This last one is very convenient if you want to jump to an error in a large source file. These are the kinds of features that Eclipse gives you for free, which is the reason why I chose to do Haskell in Eclipse in the first place. Unfortunately, an error marker on the icon of the editor’s tab is more difficult, so I left that out for now. The Project Explorer now also shows error markers on files that do not compile:
Parents of files with errors also receive this marker. This makes it easy to locate problems in a large project. Errors are, as usual, also reported in a special Problems view:
It would be better if only the first line were shown, and could be expanded to show the additional information, but for a first attempt this will do. If parsing of GHC’s output might fail for some reason, an error will be reported in the Error Log (which contains Eclipse errors, not Haskell errors), and you can always see the raw output in the Console:
Very nice. There is, however, one small problem currently. This is caused by a mismatch between GHC’s notion of building, and Eclipse’s. When building, EclipseFP will visit all files in the project, then invoke “ghc –make” on them. It suffices to call “ghc –make” only on the file containing the main function, and GHC will take care of the rest. But not only is this approach wasteful: it will also lead to error markers appearing and disappearing as the same file gets compiled (as a dependency) multiple times. My plan for solving this is to add a project option to specify the main module and the name of the main function, so that we can call GHC only on that module. Much more efficient. ![]() |
![]() Thomas ten Cate |
Little rant on modularity
But unfortunately, there is a lot of code in the JDT that does quite generic things, like showing the error markers in the Project Explorer, or on the editor tabs. I often find myself digging through the JDT sources to figure out how the big guys do things, only to find out that they implemented quite common functionality in the JDT that would also benefit many other language-specific plug-ins. Other plug-in writers who want to use this functionality have a choice: either have their plug-in depend on the Java Development Tools, or reproduce all the code in their own plug-in. Depending on the JDT plug-ins would be a shame, because we’re trying to build a Haskell IDE here. Even though most Eclipse users will have the JDT already installed, we do not want to have to package it with an eventual “Hasklipse” (I hope that name doesn’t stick…) distribution containing an Eclipse platform for Haskell development. Moreover, it is not even always possible to use the classes from the JDT directly: often, they subtly depend on some Java-specific treat. The alternative, copying and pasting to your own plug-in, is therefore often the best option. It is not pretty, but it works, and it allows you to customize the code to fit your own plug-in better. But I sure wish it wasn’t necessary. For a poor Haskell plug-in developer, even more modularity would be very welcome. ![]() |
![]() Andrew Overholt |
Going to GUADEC
Thanks to the generous sponsorship of the GNOME Foundation and GNOME Travel Committee, on Thursday I’m heading to the Gran Canaria Desktop Summit. This conference is a combination of GUADEC and Akademy and promises to be an excellent week of discussions, presentations, etc. I’ll be giving a talk on Eclipse, focusing on our work at the Linux Tools project and of course showing the CDT and Mylyn and all the other awesome stuff I can fit into 30 minutes. I’ve been to GUADEC twice before and was really impressed with everyone’s enthusiasm. I’m sure this year will be just as good and I look forward to the inspiration that comes from conferences like this. |
![]() Freddy Allilaire |
Eclipse Acceleo Day program is available!
The first Eclipse Acceleo workshop will take place on July 10, 2009 in Nantes. More information available here: http://www.acceleo.org/wiki/index.php/EclipseAcceleoDay
This workshop is free but with mandatory registration (for organisation purposes). Registration details are available here: http://www.acceleo.org/wiki/index.php/EclipseAcceleoDay Hope to see you there :-) |
![]() Ben Vitale |
p2 UI policy and Declarative Services
This is another post in what is becoming a short (so far only two) series about moving a product from 3.4 to 3.5.
Unfortunately, when I launched 1.0.0.abc, the Install New Software dialog didn't have a way for me to add a new repository. Ditto for the preference page. Turns out there is a more robust set of p2 UI building blocks in 3.5, which is handy for RCP developers. That is described in great detail here: http://wiki.eclipse.org/Equinox/p2/Adding_Self-Update_to_an_RCP_Application I should mention that the RCP-p2 example in 3.5 is leaps and bounds ahead of the one from 3.4 (there wasn't one) - so props to the p2 UI team on that. At any rate, the wiki page tipped me off that there is a UI policy which controls what components are showing and enabled. This policy is implemented as an OSGi declarative service. What really threw me for a loop is that I wasn't trying to do anything special with this policy. I just wanted the stock SDK one since our product is based on the SDK. Debugging the Policy Behavior I stepped through the preference page code and discovered that the SDKPolicy wasn't getting discovered as a service (it was just getting an empty Policy every time). So this sent me down the route of launching with -console to see the OSGi console and look for the policy service. After fighting with the filter syntax for the services <filter> console command, I googled a bit more and found these useful runtime options for spitting out verbose DS logging information. I turned those on but I didn't get anything logged. I was pretty stumped at this point. Then a light bulb came on: maybe declarative services wasn't running at all? A quick ss ds at the console showed that it was RESOLVED but not active! I did a start to spin it up and all of a sudden a deluge of DS logging information printed out. And then SDKPolicy started working, and voila my p2 UI was working.It turns out the root cause is that we had a custom config.ini in 3.4 to specify a custom osgi.instance.area location. This was screwing up the start level for the ds bundle. I switched the product to generate a config.ini for me, did a new build, and everything worked. I plan to migrate the osgi.instance.area configuration step to a p2.inf file, which is what the platform releng guys do.Useful Links [1] Equinox Runtime Options [2] Explore Eclipse's OSGi Console [3] Around the world in Java: Getting Started with OSGi Declarative Services [4] p2 UI policy bug #1 [5] p2 UI policy bug #2 |
![]() Ekkehard Gentz |
[galileo] EPP for Cocoa 64-bit
You know from my Galileo – review – Blogs that I’m now working under OSX Cocoa-64bit. If you try to download one of the easy-to-start EPP Packages for Galileo, there’s no Cocoa 64-bit – download available. See a detailed discussion under Bugzilla 281501. Thanks to comment#39 from Markus Knauer there’s a Software Site wich helps you to get it: http://download.eclipse.org/technology/epp/packages/galileo/ I also updated my collection of Software Sites here.
Now its easy:
and you’re done
Eclipse EPP RCP Cocoa 64-bitUse the EPP (P2) Software Site, choose your Package:
here are the Details:
Finish -> Restart:
Now its easy to test all EPP Packages under Cocoa 64-bit |
![]() Alex Radeski |
Eclipse Galileo, Mac 64bit Cocao Yay!, No keyboard, Boo!
So I've fully switched from Eclipse Ganymede to Galileo, at work and at home. At home I thought I'd try the the Mac Cocoa 64-bit version (available here) to give the new Apple JDK 1.6.0_13 for a spin. |
![]() Emil Crumhorn |
Creating a Notification Popup Widget
In this article I will explain how to create a custom widget that displays a popup notification dialog in the bottom right corner of your screen (usually above the toolbar on Windows). Here’s what it will look like when we’re done:
We could custom draw everything which would allow us more control over the widget, but for the sake of this article lets stick to using basic SWT components inside a normal Shell that we will make a bit prettier than your typical SWT Shell. (Do note this has only been tested on Windows, it’s quite possible tweaks are necessary for other platforms).
The ShellWhat we want is a Shell that stays on top of our application (but not on top of all applications) and doesn’t steal the active focus or else it would show up in your task manager or move focus away from where the user is now. We also don’t any normal Shell “trim” borders, we’ll draw our own. Creating it is easy as all of our requirements are available via SWT flags. Thus we can create the Shell as follows: _shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_FOCUS | SWT.NO_TRIM); As we have SWT widgets inside our shell and we intend to use a gradient background on the shell itself, all the widgets need to be transparent. This is done by setting the Background Mode on the shell to _shell.setBackgroundMode(SWT.INHERIT_DEFAULT); So how do we get a gradient background on a shell? It certainly don’t support it by default. You can set a foreground and a background but that’s about it. The trick is to paint an image with the colors we want and use that as the shell’s background. To set it at the right time, we listen to the
The ContentsOur shell consists of 3 sections, an image at the top left (which is a normal CLabel). Then a label that contains the header text (also a CLabel), and finally a label which represents our message (a normal Label). We use a Label at the end instead of a CLabel as Labels support wrapping and multi-lines better than the CLabel does. You could of course use pretty much any widgets you want. Here’s an outline of what section each label covers:
We use a GridLayout with some 5px margins (except at the top) and the widgets are created normally without any special magic, so I won’t show that code here (it’s all at the bottom for you to download). Some Eye Candy – FadingShells support alpha values as of SWT 3.4, so we’ll use this to make our “appearing” and “disappearing” a bit prettier. All we need to do to make a shell fade in and out is to have a thread that loops and increases/decreases the alpha channel value for the shell. As we need to be on the Display thread to do this it’s easiest to do it all via a runnable that we let the Display object run for us at a given interval. We need to remember to continuously check to see if the shell is disposed as it can happen when we’re on a thread. When we’re finished fading in, we want the shell to stay visible for a certain amount of time, and then we want to fade out. So basically the chain is this:
All these timers are more or less similar in terms of how the code looks, so I’ll show one example here and for the rest you can look at the complete source downloadable below. We have some global variables here that should be explained.
Stacked NotificationsThere’s one last thing we want to support, which is stacked notifications. Assume our notification shell’s entire life-span is about 5 seconds, what if we have another notify call before the first one has finished showing? We could dispose the first shell and replace it with the new one of course, but a much prettier approach is to simply move the previous shell up, and show the new notification below it. The effect of this is something like this (this screenshot was taken just as the old shells started to fade out, hence the higher alpha on them):
What we do to achieve this effect is rather simple. Every time a notification shell is opened, we keep a reference of it in a static array of shells. When it’s faded out (and disposed), it’s removed from the list. Thus, when a new shell is created we simply check to see what’s already in the array and then set the location for each old shell in the array to Further ImprovementsEverything could be made prettier than it already is of course, perhaps you want an “X” close button, or different colored text, or rounded shell corners. None of that is in the current code, but the code should give you enough to go on to implement most of that without any major problems. Also note that I currently use The code is not perfect, it’s an example to build on (if you so wish). Download CodeI’ve created an Eclipse project with the code and also the ImageCache/FontCache/ColorCache classes I use in the code (all they do is keep already used images etc in memory so that they don’t need to be re-created). There’s also a jar with the images I’ve used in this example. If you like them and want more like it, there’s a massive image pack with exactly these icons and more here: Gnome Colors Icons. Do note you may need to adjust your CLASSPATH settings for the project to reflect the location of your SWT jars. To run the code, simply run the ConclusionHopefully this gives you an insight into how to create a “custom widget” (without much custom painting). Have fun! |
![]() Laurent Goubet |
EMF Compare graduated!
Galileo is out ... and with it came the graduation of EMF Compare to 1.0 at last! |
![]() Kent Beck |
Immovable Object versus Unstoppable Force: Capex and the Marginal Cost of Production
One of the courses I study in the Farmyard Podcast University is economics. I like making sense of the world, and sometimes economics help make sense of the world. Sometimes. Sometimes it seems flatly contradictory. Here is one of those cases. The theory of production states that in a competitive market, prices will stabilize at the marginal cost of production. That is, if I am a farmer with a bunch of wheat, I will be willing to sell my next kilo at the cost to raise that additional kilo. If seed, fertilizer, and diesel cost me $10 for that kilo, I will rationally take anything more than $10 for it. Since lots of other farmers are also competing to sell wheat, the price will fall to $10. I would be a chump to insist on a higher price and risk not selling at all. I would be a chump to sell for less than my cost of production. Price = marginal cost of production. The theory or production is used to “logically” justify a price of $0 for information. Since the marginal cost of production (the amount to distribute the next download) is essentially zero, so the story goes, the price for information will tend to zero. Enter CAPEXThis theory takes a very narrow view of economics. Somebody has to pay for the tractor and the land. In this model, such costs get paid for out of an irrelevantly small slice of the price. Businesses divide the money they spend in to capital expenditure, CAPEX, and operational expenditure, OPEX. CAPEX is money spent in anticipation of future gain, like buying a new tractor or writing a programming tool. OPEX is money spent in anticipation of immediate gain, like buying seed or paying this month’s bandwidth bill. The distinction between CAPEX and OPEX is important for tax reasons and because balancing the two in various ways can offer different business models. OPEX is really our friend the marginal cost of production by a different name. Bringing CAPEX into the picture highlights the absurdity of the “price = marginal cost of production” theory as OPEX trends to zero. That little “capital tax” added to every price becomes increasingly significant. What happens when price = marginal cost = $0? Like quantum effects, once you reach a certain scale the rules change. The Newtonian economics of “price = marginal cost of production” are overwhelmed by the need to finance the upfront capital. The form of solution to this has yet to emerge. Is This Really a Problem?One of the factors that has kept this dilemma from being a problem to date is increasing capital efficiency. A programmer today can produce software for much, much less than he would have required for the same functionality even ten years ago. In fields like journalism or music, the cost of doing an okay job has likewise fallen dramatically. The word “okay” is important in that last sentence. There is a difference between an article written by Malcolm Gladwell (on this very topic) and one written by, well, me. But if his costs money and mine is free and you don’t care enough about the difference, he can’t charge for his. I don’t care about charging for mine, because I make my money on, on, on… I’ll get back to you on that. Cracks are appearing in the system. One of my pressing needs is an efficient environment for collaborating in real-time on code. Many projects have started to provide such functionality, but most (all in the Eclipse world) have stalled short of solving the problem. Increasing capital efficiency in this case can’t overcome the size of the task of solving a difficult programming problem. The capital just isn’t there to solve the whole problem. A group of smart, poor graduate students can’t muster the capital necessary to solve it and a VC would have to be crazy to invest in it, given that no one will pay for a solution. And so a socially, economically significant problem goes unsolved. I don’t have a resolution of this dilemma. CAPEX is immovable but the pressure for “price = marginal cost of production” is unstoppable. One argument was that in a world of abundance, things that couldn’t be replicated easily, like one’s own physical presence, would increase in value. I am not finding that to be true, but I’m experimenting with selling a remote pair programming session. I’ll get back to you on how it works. In the meantime I have some good ideas waiting for capital, I just can’t promise any payoff. I know I’m not alone. |
June 29, 2009
![]() Peter Friese |
Getting Started with Xtext
Xtext has been released as a part of the Eclipse Galileo release train on June 24th, 2009. Xtext is a framework for building DLSs (domain specific languages). In fact, it can be seen as a DSL for defining DSLs. In this article, we will develop a small DSL for defining entities. Download and InstallHop over to http://xtext.itemis.com and download an Xtext distribution matching your platform. We've got all major platforms: Windows, Mac OSX Carbon, Mac OSX Cocoa 64, Mac OSX Cocoa 32, Linux Gtk 64, Linux Gtk 32. To install, unzip the distribution file to a directory of your liking. Windows users, please make sure you unzip to a directory near to your filesystem root! Eclipse contains files and folders with long names that might be hard to handle for Windows. Create a new projectAfter launching Eclipse and creating a new workspace (or using an existing one), create a new Xtext project by selecting File -> New... Project... -> Xtext Project. In this article, we're creating a DSL for describing entities, so let's go with the following settings:
Click Finish to let Xtext create the three projects that make up your DSL:
Upon finishing creating these three projects, Xtext opens a file Entity.xtext, which contains a sample grammar, which we will change in a second. Define the grammar for your DSLNext up, we need to define the grammar for our DSL. To make things easier for us, let's first write down a sample model. Please open org.xtext.example.entity.generator/src/model/MyModel.entity and key in the following text: typedef String
typedef Integer
typedef Date mapsto java.util.Date
entity Person {
String name
String surName
Date birthDay
Address home
Address work
}
entity Boss extends Person {
Person* employees
}
entity Address {
String street
String number
String city
String ZIP
}
Most of this model should be pretty obvious, but there are two things worth noting:
Let's derive the grammar for this model. Open org.xtext.example.entity/src/org/xtext/example/Entity.xtext, erase its entire contents and enter the following: grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals generate entity "http://www.xtext.org/example/Entity" The first line indicates we want the new grammar to be derived from the (built-in) grammar Terminals, which defines some basic terminal rules (like STRING, ID and so forth). If you're interested, CTRL+Click on the language name to navigate to its definition. The second line defines the name and namespace URI for our own grammar. Let's now define that our DSL supports types. Add the following lines: Model: (types+=Type)*; Type: TypeDef | Entity; This tells Xtext that our Model contains any number (i.e. 0..N, as declared by the *) of Types. What exactly a Type is needs to be specified. Apparently, a Type can be either a TypeDef or an Entity: TypeDef:
"typedef" name=ID ("mapsto" mappedType=JAVAID)?;
A TypeDef starts with the keyword typedef, followed by an ID making up its name. Following the name, we can optionally (hence the question mark at the end) add a mapsto clause. The fragment mappedType=JAVAID specifies that the TypeDef will later have an attribute named mappedType of type JAVAID. As JAVAID is not yet defined, we need to do so: JAVAID:
name=ID("." ID)*;
So, a JAVAID is a sequence of IDs and dots, making up a qualified Java type name, such as java.util.Date. Next, let's define how to model entities: Entity:
"entity" name=ID ("extends" superEntity=[Entity])?
"{"
(attributes+=Attribute)*
"}";
As you might have guessed, Entitys start with the keyword entity, followed by an ID as their name. They may optionally extends another entity. Surrounding a rule call with square brackets means "this is a cross reference", i.e. a reference to an already existing element. Entitys do have Attributes (any number, to be precise), thus we have to define how Attributes look like: Attribute: type=[Type] (many?="*")? name=ID; By now, you should be able to read this rule: an Attribute has a type which is a cross reference to a Type (which is either a TypeDef or an Entity), it has an optional multiplicity indicator (the star) and - of course - if has a name. Your grammar should look like this by now: grammar org.xtext.example.Entity with org.eclipse.xtext.common.Terminals
generate entity "http://www.xtext.org/example/Entity"
Model:
(types+=Type)*;
Type:
TypeDef | Entity;
TypeDef:
"typedef" name=ID ("mapsto" mappedType=JAVAID)?;
JAVAID:
name=ID("." ID)*;
Entity:
"entity" name=ID ("extends" superEntity=[Entity])?
"{"
(attributes+=Attribute)*
"}";
Attribute:
type=[Type] (many?="*")? name=ID;
Compiling the DSLNow it is time to see the fruits of our labor. But first, we need to compile our grammar. Xtext will create:
from this grammar. To make this happen, please select org.xtext.example.entity/src/org/xtext/example/GenerateEntity.mwe and select Run As -> MWE Workflow from the context menu. Xtext will now generate the entire infrastructure for your DSL and after a few seconds you should have a shiny new DSL including a great editor. Taking it for a spinSeeing is believing, so let's take the DSL editor for a test drive. Select the DSL project org.xtext.example.entity and, from the context menu, select Run As -> Eclipse Application. A second instance of Eclipse will be started. In this new instance, create a new, empty project (File -> New -> Project... -> General -> Project. Create a new file Sample.entity in the new project. You can now insert the model we designed above or enter a new model: Leveraging the modelNow that we've got a fancy editor for our DSL, we want to transform the models we can create with this editor into something meaningful. This, however, will be the topic of the next installment. More infoFeel free to discuss this article in the comments section of my blog. Should you have any technical questions regarding Xtext, we've got an excellent newsgroup where the committers answer your questions. We also offer professional (commercial) support, i.e. customized trainings to get your team up to speed. Just drop us a note, we're happy to discuss the details with you. |
![]() Scott Lewis |
Early bird defines the worm!
In his posting All contributions are Equal, some are more equal than others, Robert Konigsberg points out that contributing multiple ways of doing things can easily lead to more user complexity (e.g., by having multiple toString generators). This is true and in my view, a risk for any system that has many strongly-opinioned contributors (pretty much any large open source project). Toward the end of his post, he poses a process-level question about how to avoid the situation of some contributions being more equal than others…. I think the solution is the current de facto for Eclipse.org projects and that’s the (frequently unstated) reality that the early bird defines the worm. When it comes down to it, those that initiate and then follow through on enhancements, fixes, documentation or other contributions get to choose when it comes to actual design decisions. Inevitably, there are design choices that some disagree with, even when all discussion is had completely in the open. I think the truth of the early bird defines the worm statement is that we should provide incentive to organizations and individuals in the community to be more aggressive about contributing to existing Eclipse projects. This is because waiting for someone else to initiate, design, implement, test and document something often doesn’t work very well. To some, it may seem like Eclipse Project development is effectively subsidized by others, but this is not true. Even for one’s own usage of Eclipse, contribution and community involvement with Eclipse.org projects pays dividends. There are many ways to contribute, from contributing discussion/ideas, to planning, to new example/app code, to helping to maintain existing code, to documentation, to build support, to testing and bug reporting, to providing bug fixes, to mentoring, and plenty of other kinds of support. In my view, these are the ways to get your contributions into Eclipse, and influence the community around the software. Here’s my understanding of where the toString() contribution originated. |
![]() Kevin McGuire |
Why choice reduces usability
We usually consider choice as being a good thing, whether it be around choice of restaurant, chocolate bar, clothing, or technology. Choice makes us feel empowered, and variety adds richness to life. Not surprisingly, embedded in the design philosophy of Eclipse is the notion that “choice is good”. Clearly then, if some choice is good, more choice is better. And darn if Eclipse doesn’t give you a LOT of choice! The preferences alone should make any humble programmer feel empowered to tweak the IDE into exactly the shape and behaviour you want. However, it turns out that in practice, while we believe we want choice, there is good research suggesting that more choice makes us less happy. For an excellent book on the subject, I highly recommend The Paradox of Choice by Barry Schwartz. I’ve been pondering this a lot lately with respect to user interface design in general, and Eclipse specifically. What we often forget (and Schwartz does a great job of explaining) is that there is a cost to choice. One must understand the choices themselves, one must be informed, otherwise we risk choosing wrong. Not only does that comparison itself imply a cost (learning, weighing), but bad choices cost us more than good ones benefit us. That is, we feel the negative impact of say losing $50 to a greater extent than we feel the positive emotional impact of winning the same amount. Therefore, paradoxially, although we seek choice, we actually prefer not to choose. There’s much more in the Scwartz book and I encourage you to read it. Thus a common misbelief in UI design is that giving the user more choice will increase the usability of the product. It’s almost always not true. What choice does is increase the utility of the product, because you can use it for more things, or in more ways. But it reduces the usability, because the choice brings with it a cost that the user must bear. (Note that I’m ignoring accessibility related preferences since these obviously increase usability for those who need them). A favorite example is the following dialog that you get post P2 update. Now to be clear, I’m not picking on P2, this happens to be a good example, and there are many more throughout Eclipse. Plus, I must confess that I had a hand in this dialog. The dialog is there to support the set of users who know under which conditions the workspace does not need to be restarted. Personally, I refer to it as the “Feeling lucky, punk?” dialog. Susan and I have had many discussions about this dialog and in keeping with the theme of “just enough rope to hang yourself with” decided to leave it in Eclipse for the power users. For many though, it leaves you scratching your head, or even a little afraid. These “some add-ons”, how do I know which they are? Is there a list? If yes, why doesn’t Eclipse have this list so it doesn’t have to ask me? If such a list can’t exist, then what chance do I have? What happens if I say “No” and don’t restart, will bad things occur? If so, why do you let me do it? If not, then why aren’t two choices sufficient? What are the warning signs that I should’ve said yes, and then what should I do to fix it? It’s asking me if I want to restart, but it’s giving a binary choice (yes/no), plus another choice, so will “Apply Changes” restart or not? And if not, does it mean that “No” didn’t apply the changes? I’m afraid! Mommy!! Thus we’ve increased utility (advanced users can work more efficiently), but we’ve decreased usability (all users are forced to make a decision with no guidance, where the consequence of picking the non-default is unknowable at that moment). Next time you go to add a preference or provide a choice dialog, it’s worth considering the cost of the choice and it’s impact on usability. Ask yourself, “Have I really benefitted the majority of my users in providing this? Or have I benefitted a few at what cost to the many?”. |
![]() Ben Vitale |
Debugging PDE Build and the publisher
I posted a problem to the PDE newsgroup last week about unexpected requirements in my product feature. This was in the context of moving a 3.4-based product to 3.5.
Then the trick was to pass along those options to the AntRunner app which drives PDE build. I added -debug path/to/.options into my arguments to AntRunner. Running the build again I got two things, neither of which were helpful:
Based on these results, I reasoned that nobody else must be using this technique to solve their p2 problems. Moving on. Stepping through the publisher Next up: run AntRunner with Java debug enabled so that I could connect remotely and set breakpoints in the publisher actions. I added the appropriate JVM args to enable the Java wire debug protocol. Started the build again, connected up and started setting breakpoints in various publisher actions. Since the rogue requirement was getting added to my product feature IU, I added a conditional breakpoint in FeaturesAction to look for that feature being processed.Then, since the problematic requirement was org.eclipse.core.resources [3.4.0,3.5.0) I added another conditional breakpoint in getVersionRange to watch for incoming feature entries with 3.4.0 as their minimum version. I did finally discover the problem: I had a bunch of old, outdated entries in my product feature's feature.xml, which included references to several different versions of o.e.core.resources. After I ripped those out, I had a successful build and director install. Conclusions
How are you debugging your p2 builds?? |
![]() Robert Konigsberg |
All contributions are Equal, some are more equal than others
This evening I read Cay Hortmann's article on upgrading to Galileo. (For those of you who do not know Cay, he writes the fantastic Core Java books. I learned Java from the 1.1 version, as well as both the 1.4 and 1.5 versions. He writes great stuff.) There is now an option to generateI've not yet seen the toString generator, but having written more than enough toString implementations, I've worried that such a code generator may be less than ideal. Similarly, I've seen the equals and hashCode generators at work, and I also tend to not want to use them. Given that I work for a company that has so much Java code that "If code was ice cream, it would be a lot of ice cream," [Ref Java Posse 240, 9:15] in addition to having very helpful helper methods for hashCode and equals, I'd love more finely-tuned generators for such critical methods. But I feel a bit constrained by one of the basic rules guiding Eclipse contributions, as defined by the book Eclipse: Principles, Patterns and Plug-ins: As the Contribution Rule reminds us, “Everything is a contribution.” And with many contributions, the possibilities are endless.OK, so let's say I write my own generators for toString, hashCode and equals. Then there are two toString generators in the IDE, one possibly better than the other. Why should the end user be forced to deal with two confusing UI contributions? Sure, there's also the recent object of my affections, patch fragments, but the patch fragment is a back-door lover. I want to remove the default contributions altogether, and replace them with something better suited to my environment. But that violates the Contribution Rule. Am I stuck with something less than ideal until Eclipse 3.6, or worse, forever? What's the solution here? PS: Has someone picked up on Cay's concerns and logged a bug? |
![]() David Green |
Hudson Helper for Android
Recently I launched Hudson Helper for iPhone and iPod Touch, enabling Continuous Integration fans to stay in touch with their projects. Android users can get in on the game now too, with Hudson Helper for Android.
Hudson Helper for Android provides all of the same features as the iPhone version including support for multiple servers and authentication. New for this version are build controls: start and stop builds right from your phone. CI can be even more fun with shake-to-build and sound effects. To get Hudson Helper for Android, search for 'Hudson Helper' in the Google Market on your Android device. |
![]() Stéphane Drapeau |
SCA Tools Galileo Release
The SCA Tools project has seen an enormous amount of new development since the 2008 Ganymede release. We’ve added an XML editor to make editing and updating SCA-standard assembly files really easy.
For Java developers, it’s now possibly to create an SCA assembly definition and then generate Java code from it. And, if you want to start with some Java you already have, we’ve added a special introspector that will investigate your code and automatically produce an SCA assembly.
Once you’ve created your Java SCA project, you can then run and debug it using the great facilities that Eclipse provides.
We also have made sure that the SCA artifacts you might create are properly validated, helping you spot mistakes early in the process.
We even took the time to update the graphics, giving us a prettier SCA Composite Designer.
For me, the most exciting feature is how we’ve developed the core SCA model to be extensible by people who want to write in extra capabilities into the tools. The heart of the model contains the SCA standard specifications, and different extensions have been created to support the key Open Source SCA runtimes - Apache Tuscany 1.4 and Frascati 0.5. Using the extension mechanisms, it is much more straightforward to add new concepts to SCA and extend the tools to include them. SCA Tools has been improved a lot. Download SCA Tools 2.0.0 now! |
![]() Shaun Smith |
OSGi Persistence Slides from OSGi DevCon Europe 2009
Here are the slides to a short presentation I gave on persistence at OSGi DevCon Europe in Zurich. I had 30 minutes and wanted to do a demo to show that EclipseLink is running nicely in OSGi--it was tough cramming all this in but I did it without a moment to spare. Enjoy the slides and if they spark some questions you can post them here on the blog or on the EclipseLink newsgroup at http://www.eclipse.org/newsportal/thread.php?group=eclipse.rt.eclipselink or the eclipselink-users mailing list. OSGi Persistence With EclipseLink
View more documents from shaunmsmith. |
![]() Polishin' Eclipse |
Eclipse DemoCamp in Cracow - Round 3
This is the third time when Eclipse DemoCamp was organized in Krakow. On Jun 27 (Saturday) Eclipse fans from Krakow met in Baraka club at Kazimierz in Krakow.
Kazimierz is an old Jewish department of Krakow. You can read more about it here. For us important is the atmosphere there which is in favor for such events. Since we wanted to celebrate the Galileo release, we didn't fill the whole time with talks and demos. More than a half of the time was just chatting with beer and pizza in hands. This way we managed to answer more questions and meet more people personally than we could do otherwise. People came despite the rain. I understand that this could be hard to wake up early on Saturday when it rains. However Eclipse people are tough guys and girls, so rooms at the club were full. Moreover we found a new application for laptops. Yet another proof that ThinkPads rules :) The agenda and the list of attendees can be found here. Don't forget that the next DemoCamp is in November and you are all welcome. Cheers! |
![]() BioClipse |
Bioclipse 2.0 Release Candidate 4
Today, Bioclipse 2.0 Release Candidate 4 (versioned 2.0.0.RC4) was released. The release requires a fresh download from Sourceforge, and we kindly ask beta-testers for bug reports on the bugs.bioclipse.net.
|
![]() Tom Schindl |
Now that’s cool
If you are following my blog you may have noticed that I invested some hours this weekend in Eclipse-Databinding and GWT. It was Saturday in the evening when I got the Eclipse-Databinding working inside GWT and I started searching for a decent Table and TableTree-Widget (I looked at the code in the gwt-incubator but that didn’t made me happy). So I thought the RAP people are using Qooxdoo as the underlying JavaScript-UI library what would be if there was a GWT-Binding to this JavaScript-Lib using the GWT-native calling interface and so I started search for such a thing but apparently noone ever tried to write such a thing. So I started reading docs and studying libraries who use this native-calling interface – I’ve never written such a thing before – and voilá it was yesterday around lunch time when I had the first success because one of the GWT-Demos showed up. The Java code for this small application looks like this:
public class Button extends QooxdooApp {
@Override
protected void run(QxAbstractGui application) {
QxHBox box = new QxHBox();
box.setSpacing(10);
QxComposite container = new QxComposite(box);
container.setPadding(20);
application.getRoot().add(container, QxOption.left(0), QxOption.top(0));
QxButton btn1 = new QxButton("Button A", "/icon/22/apps/media-video-player.png");
container.add(btn1);
QxButton btn2 = new QxButton("Button B", "/icon/22/apps/internet-mail.png");
btn2.setEnabled(false);
container.add(btn2);
QxToggleButton btn3 = new QxToggleButton("Toggle Button", "/icon/22/apps/internet-web-browser.png");
btn3.focus();
container.add(btn3);
QxRepeatButton btnRepeat = new QxRepeatButton(null,"/icon/22/actions/list-add.png");
container.add(btnRepeat);
final QxLabel l1 = new QxLabel("0");
l1.setDecorator("main");
l1.setPadding(2, 4);
l1.setBackgroundColor("white");
container.add(l1);
btnRepeat.addExecuteHandler(new ExecuteHandler() {
public void execute(ExecuteEvent executeEvent) {
int tmp = Integer.parseInt(l1.getContent()) + 1;
l1.setContent(tmp+"");
}
});
}
}
and now compare it too the original source:
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
LGPL: http://www.gnu.org/licenses/lgpl.html
EPL: http://www.eclipse.org/org/documents/epl-v10.php
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Fabian Jakobs (fjakobs)
************************************************************************ */
/* ************************************************************************
#asset(qx/icon/${qx.icontheme}/22/apps/media-video-player.png)
#asset(qx/icon/${qx.icontheme}/22/apps/internet-mail.png)
#asset(qx/icon/${qx.icontheme}/22/apps/internet-web-browser.png)
#asset(qx/icon/${qx.icontheme}/22/actions/list-add.png)
************************************************************************ */
qx.Class.define("demobrowser.demo.widget.Button",
{
extend : qx.application.Standalone,
members :
{
main: function()
{
this.base(arguments);
var box = new qx.ui.layout.HBox();
box.setSpacing(10);
var container = new qx.ui.container.Composite(box);
container.setPadding(20);
this.getRoot().add(container, {left:0,top:0});
// Two normal buttons
var btn1 = new qx.ui.form.Button("Button A", "icon/22/apps/media-video-player.png");
container.add(btn1);
var btn2 = new qx.ui.form.Button("Button B", "icon/22/apps/internet-mail.png");
btn2.setEnabled(false);
container.add(btn2);
// Toggle Button
var btn3 = new qx.ui.form.ToggleButton("Toggle Button", "icon/22/apps/internet-web-browser.png");
btn3.focus();
container.add(btn3);
btn3.addListener("changeChecked", function(e) {
this.debug("Checked: " + e.getData());
}, this);
// Repeat Button
var img1 = "icon/22/actions/list-add.png";
var btnRepeat = new qx.ui.form.RepeatButton(null, img1);
container.add(btnRepeat);
// Label
var l1 = new qx.ui.basic.Label("0");
l1.setDecorator("main");
l1.setPadding(2, 4);
l1.setBackgroundColor("white");
container.add(l1);
// Listener
btnRepeat.addListener("execute", function()
{
var tempValue = parseInt(l1.getContent()) + 1;
l1.setContent(tempValue.toString());
});
}
}
});
Afterwards I went outdoors because the weather was just too nice to stay inside but because of my great success in the morning I sat down and implemented a few more widgets to show you the GWT-Databinding example from Saturdays post running on Qooxdoo-GWT.
public class TextLabelBinding extends QooxdooApp {
@Override
protected void run(QxAbstractGui application) {
final QxLabel titleLabel = new QxLabel("");
final QxTextField firstNameField = new QxTextField("");
final QxTextField lastNameField = new QxTextField("");
QxVBox box = new QxVBox();
box.setSpacing(10);
QxComposite container = new QxComposite(box);
container.setPadding(20);
container.add(titleLabel);
container.add(firstNameField);
container.add(lastNameField);
application.getRoot().add(container, QxOption.left(0), QxOption.top(0));
final Person p = new Person();
p.setFirstname("Tom");
p.setLastname("Schindl");
DataBindingContext dbc = new DataBindingContext(QxObservables.getRealm());
QxIWidgetValueProperty uiProp = QxWidgetProperties.text();
dbc.bindValue(uiProp.observe(firstNameField), UBeansObservables.observeValue(QxObservables.getRealm(), p, Person.FIRST_NAME));
dbc.bindValue(uiProp.observe(lastNameField), UBeansObservables.observeValue(QxObservables.getRealm(), p, Person.LAST_NAME));
ComputedValue titleValue = new ComputedValue(QxObservables.getRealm()) {
private IObservableValue last = UBeansObservables.observeValue(QxObservables.getRealm(), p, Person.LAST_NAME);
private IObservableValue first = UBeansObservables.observeValue(QxObservables.getRealm(), p, Person.FIRST_NAME);
@Override
protected Object calculate() {
return last.getValue().toString().toUpperCase() + ", " + first.getValue();
}
};
dbc.bindValue(uiProp.observe(titleLabel), titleValue);
}
}
I’m going to look at the more complex controls when having the next free time slot but for now this is just plain cool, isn’t it? ![]() |
June 28, 2009
![]() Andrei Loskutov |
On Galileo train
Galileo? Me too :-) I've just released updates for two of my plugins: Bytecode Outline and Data Hierarchy. Highlights:
Here is a screenshot which may explain Data Hierarchy better then words (check the "UnreadFields" class node). You see here the data hierarchy of the AnalysisContext class: |
![]() Doug Schaefer |
Understanding the Mobile Killer App
Clearly, with the success of iPhone and Blackberry and the buzz around Android and Pre, mobile already has its killer apps. But for someone new like me to this arena, I find it important that I try to understand what that app is and simplify the category so I can know where to focus what little time I have to play here. So this is what I've come up with, and I hope you have an opinion you can share in the comments to help guide me. |
![]() Robert Konigsberg |
Lies, Damned Lies, and Eclipse Upload Statistics
Update: Added 4th assumption, Saturday, June 27
These are my three primary, and therefore, potentially disputable, assumptions:
Let's start with downloads by product: Here, the clear winner is the JEE distribution. Modeling, which is heavily discussed on the modeling blog and had a crazy number of talks at EclipseCon, has just under 25% the popularity of JEE. I haven't used WTP in a while but I hope, if it's this popular, that the developer docs reflect the popularity. (Please?) Next we move to downloads by operating system: Wow, Windows, huh? That's a surprise, and also, not really a surprise. I'd love to see how these numbers compare next year. Will we see an complete inversion of Linux 32 and Linux 64 in a year? Two years? I predict four years. Let's look at all the download ratio data without grouping by products or operating system. This chart really highlights both the JEE and Win32 popularity. I'm pleased to see the CDT platform is well used by the Linux32 community. I wonder why, on the Classic platform, OSX Carbon is uploaded slightly more than OSX Cocoa? Are variances on that scale negligible? I hear the Linux community say "Rob, come on. We just shut down the spin machine from that ludicrous browser comparison. How about something that reflects reality?" Reality, whatever. You punks are lucky drawing charts is fun, so I'll do one more for ya. Here's the same data, with OSX and Linux products as single pieces of data. Seriously, this does have something more interesting to say:
and heck, here's another: Do these last two charts tell you anything different from the download ratio charts? I'll leave that up to someone else to discover. Add it in the comments. Here's the last three pieces of data I want to share tonight: Total Uploads: 145You could say, then, that 145 people got their instance of Eclipse from my bittorrent client. Thank you, Verizon FIOS. Thank you, Eclipse Foundation! |
June 27, 2009
![]() Tom Schindl |
Eclipse-Databinding 3.5 for GWT
I’m a big fan of GWT but one of the real pain points when developing GWT applications is that there’s no databinding framework [*] available to synchronize your domain objects and UI-Widgets. As many of you know I’m an even bigger fan of Eclipse-Databinding because it is written so that it can be used with ANY Model-Technology you want and even more important ANY UI-Technology you want and in fairly every environment you want (or at least porting to it is possible without too much trouble). I’m happy to announce that the days without a databinding solution are gone forever now because yesterday in the night I made Eclipse-Databinding 3.5 compile under GWT and already wrote the first WidgetProperty implementations for Text and Label-Widgets. Take a look at this video to see it in action The code used to create this small presentation looks like this:
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.observable.value.ComputedValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.ufacekit.core.ubean.databinding.observables.UBeansObservables;
import org.eclipse.ufacekit.ui.gwt.databinding.GWTObservables;
import org.eclipse.ufacekit.ui.gwt.databinding.IWidgetValueProperty;
import org.eclipse.ufacekit.ui.gwt.databinding.WidgetProperties;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class GWTDatabindingExample implements
EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
final Label titleLabel = new Label();
final TextBox firstNameField = new TextBox();
final TextBox lastNameField = new TextBox();
final Person p = new Person();
p.setFirstname("Tom");
p.setLastname("Schindl");
DataBindingContext dbc = new DataBindingContext(
GWTObservables.getRealm()
);
IWidgetValueProperty uiProp = WidgetProperties.text();
dbc.bindValue(
uiProp.observe(firstNameField),
UBeansObservables.observeValue(
GWTObservables.getRealm(), p, Person.FIRST_NAME
)
);
dbc.bindValue(
uiProp.observe(lastNameField),
UBeansObservables.observeValue(
GWTObservables.getRealm(), p, Person.LAST_NAME
)
);
ComputedValue titleValue =
new ComputedValue(GWTObservables.getRealm()) {
private IObservableValue last =
UBeansObservables.observeValue(
GWTObservables.getRealm(), p, Person.LAST_NAME
);
private IObservableValue first =
UBeansObservables.observeValue(
GWTObservables.getRealm(), p, Person.FIRST_NAME
);
@Override
protected Object calculate() {
return last.getValue().toString().toUpperCase()
+ ", " + first.getValue()
;
}
};
dbc.bindValue(uiProp.observe(titleLabel), titleValue);
RootPanel.get("titleContainer").add(titleLabel);
RootPanel.get("firstNameFieldContainer").add(
firstNameField
);
RootPanel.get("lastNameFieldContainer").add(
lastNameField
);
}
}
If you take a close look to the sources above the first thing you’ll spot is the usage of org.eclipse.ufacekit.core.ubean which is very light weight domain model implementation part of UFaceKit. The domain model has it’s own notification concept and a reflective API similar to EMF but is as light weight as possible. A domain object implementation looks like this:
import org.eclipse.ufacekit.core.ubean.UBaseBean;
import org.eclipse.ufacekit.core.ubean.notify.Notification;
public class Person extends UBaseBean {
public static final int FIRST_NAME = 1;
public static final int LAST_NAME = 2;
private String lastname;
private String firstname;
public void add(int featureId, Object value) {
throw new IllegalArgumentException(
"No multi feature with id '"+featureId+"'"
);
}
@SuppressWarnings("unchecked")
public <V> V get(int featureId) {
if (featureId == FIRST_NAME) {
return (V) getFirstname();
} else if (featureId == LAST_NAME) {
return (V) getLastname();
}
throw new IllegalArgumentException(
"No feature with id '"+featureId+"'"
);
}
public void remove(int featureId, Object value) {
throw new IllegalArgumentException(
"No multi feature with id '"+featureId+"'"
);
}
public void set(int featureId, Object value) {
if( featureId == FIRST_NAME ) {
setFirstname((String) value);
} else if( featureId == LAST_NAME ) {
setLastname((String) value);
} else {
throw new IllegalArgumentException(
"No feature with id '"+featureId+"'"
);
}
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
notifyListeners(
new Notification(
this,
Notification.SET,
LAST_NAME,
this.lastname,
this.lastname = lastname
)
);
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
notifyListeners(
new Notification(
this,
Notification.SET, FIRST_NAME,
this.firstname,
this.firstname = firstname
)
);
}
}
The reflective API has the advantage that it doesn’t need reflection to call methods and thus is directly usable within GWT applications where no reflection is available. This is only the start of the many things UFaceKit is going to provide to you starting from full GWT-Databinding support over JFace-Viewer like implemenations to it’s highlevel UI-Abstraction. For UFaceKit the support of GWT marks a new milestone because now we have a solution for another Java-Developer Community. We now support:
The sources are available from the UFaceKit-repository (you need to have the Google-Eclipse-Plugin installed) and an Eclipse 3.5 as the target (if you don’t want to see compile errors in your IDE) * Update there are databinding-frameworks (GXT, gwittir) but they force me to buy into their whole framework and even reach out into my Domain-Model if I understood them appropiately. ![]() |
![]() Madhu Samuel |
Kudos to the Eclipse Galileo Developers!
When 40% of all the commercial projects are failing due to one or the other reasons, the technique and style of the eclipse developers have successfully delivered one more annual release of Eclipse Galileo. This is one of the modern wonders. Nothing more than a set of 'strong minds' are required for this kind of achievement. |
June 26, 2009
![]() Erkki Lindpere |
P2 Still Not Awesome
P2 has surely seen a lot of improvement in Eclipse 3.5, but some functionality that was actually somewhat acceptable in the old Update Manager is still lacking awesomeness. I’m trying to install VE into Galileo (Eclipse for Java + M2Eclipse + Subclipse + Scala IDE). There are two usability issues with this. The first is that after selecting the “Visual Editor” feature from the site, I don’t have a “select dependencies” option. But from past usage of VE I remember that it requires Java EMF Model. So I select that too. A new user would not know to select this. I’ll have to navigate to the next page to find out if there are unresolved dependencies. And then we come to the second problem, which is this screen:
Am I really supposed to decipher this text and take action based on that? No thanks, I’ll just skip installing VE this time, I don’t have actual need for it right now. ![]() |
![]() Gabe O'Brien |
Everywhere a Tweet Tweet..
|
![]() Birt World |
Passing JDBC ResultSet to a report
Nice article on how to pass a JDBC resultset to a report at |
![]() Yves Yang |
Eclipse VE gets revived!
I’m pleased to announce the come-back of VE in Eclipse stream after more than two years’ sleeping. Now the builds for eclipse 3.4 and 3.5 are available here: The VE home page gets updated as well. I’d like to thank Nick Boldt who had done an excellent job to re-integrate VE into eclipse build system and update the Web page. Now, it is time to consider new features and the development plan for the next release 1.5. Please use ve-dev@eclipse.org to send us your feedback and requests. |
![]() Denis & Karl |
Galileo should go down …
… as being the smoothest release I have ever participated in, despite the major constraint I had this year: no extra bandwidth shall be purchased. Here is how we pulled this off: 1. More bandwidth. Since we got sooo many new Friends of Eclipse, I bent the rules and added 12 megabits of bandwidth [1]. But — get this — for the pre-release only. Marker (1) shows the increase, and marker (2) shows a significant drop three hours into the release. Unheard of! 2. Early access. Friends of Eclipse, mirror sites and Member companies all had early access to the bits, relieving some of the stress on release day. 3. BitTorrent. In April, I didn’t have options (4) and (5) below, so with the no-extra-bandwidth rule, I had to set up something. Actually, I suspect many Friends took advantage of their benefits by downloading and pre-seeding many of the files before release day. More seeds == faster downloads. 4. Eclipse Member companies. They provided lots of bandwidth (and still are!) via the Get It Faster section of the download page. Many thanks! 5. Amazon Web Services. This was a last-minute deal that was/is a true blessing, since I was able to redirect lots of the download.eclipse.org requests to AWS instead of our stressed mirror sites. 6. Server virtualization. Our own version of ‘the Cloud on demand’ — I enabled an extra virtual server node for www.eclipse.org on June 23 to handle the extra CPU power that would be required to handle the many requests. I may just shut it off later next week, or I may just keep it around… I think we’re getting good at these annual release trains.. [1] In reality, we get billed by the 95th percentile, so if I played my cards right, the extra bandwidth may end up costing us next to nothing. |



























































































