www.bsiag.com
 

Snipmatch: a solution for configuring scout properties from the java editor?

Scout comes with powerful tools in the Scout perspective. You have a logical representation of your application in the “Scout Explorer” view and a “Scout Object Properties” view where you can set or change a property for the selected object. A modification in the property view updates the java code and a code modification is reflected in the property view. This allows the developers to work as they want.

Scout Property View

The problem is that power users are not using this property view very often. The explanation is simple: using the view breaks the flow when you are typing code in the java code editor. You need to switch to the mouse, find your current object in the scout explorer and set the properties in the other view.

When you know the name of the getConfigured method you want to set, then you are quicker if you stay in the java editor. The problem is that what the JDT is offering by default is not really what you need in this case. Lets see how Snipmach can help.

With the JDT

If you are in a column’s inner-class you might want to define it as editable. You need to override the getConfiguredEditable() method and return true instead of the default false.

The JDT can help: enter “getCondiguredEdit” and press control space:

Jdt CTRL Space

This works well, but the result is not as efficient as it could be:

Jdt result

My problems are:
* I really do not need the “(non-Javadoc) comment” block.
* The cursor is not at the correct position; It would be preferable to have the cursor in the line of the return statement.
* In this specific case I do not need to call the super implementation at all.
* And the TODO statement makes sense in a lot of cases, but not here.

With Snipmach

Snipmatch can help too. I have defined snippets to handle those cases. They are shared in this git repository. In my column, press CTRL + Alt + Space + the search filter set to “edit”, I can find the snippet I am looking for:

Snipmatch CTRL+Alt+Space

Now when I press enter, there is a big difference with what the JDT override assist function provides:

Snipmatch result

The cursor is where it should be. In the Snippet’s definition, I have defined as first choice the value that will be most likely used at this point (in this case true because the default in AbstractColumn is false). The result is really straight forward.

Just to be clear, I am not complaining about the JDT doing a bad job. We are comparing a generic feature coming out of the box in the JDT and another approach where someone needs to configure the possible snippets. It is normal to have a better user experience with a specific tool because it is a specific use case.

What is missing in snipmatch?

The snippets do not have any metadata to define a context. The consequence is that the search engine is only based on the keyword entered by the user in the search box. It would be nice to be also able to influence the search result depending on the cursor position. I have commented Bug 435632. Let’s hope that the code recommenders team will propose something going in this direction to improve the user experience.

Scout Links

Project Home, Forum, Wiki, Twitter

New Eclipse Scout Homepage

Hi Eclipse Scout Users,

we think it is time for a new Eclipse Scout homepage. The old one is quite outdated not up to date anymore.

Therefore we created a design contest for a new state of the art homepage. It’s been a few days and now we have 3 designs we think are pretty awesome. Since Scout is open-source and a community project, we want to know your opinion. What do you think is the design which represents Scout the best?

Design #1

Design #2

Design #3

 

Vote here!

Please give your vote until Friday, 18th July 2014.

Thank you very much!

Git + Gerrit workflow

I often have to explain the git and gerrit workflow, used by the eclipse scout team, to developers that are used to centralized source control system like svn. One of the big differences is that writing something into the main repository (what svn users know as svn-commit) is composed of multiple steps in the Git+Gerrit workflow.

I created this picture, to represent the workflow:
Read the rest of this entry »

Snipmatch: a better template engine for the Eclipse IDE

I have always liked code templates that can be inserted in the code. In my opinion an IDE providing this functionality helps me to really be efficient when I code.

Few month after having started at BSI (the company behind the scout project), one of my first blog posts on the internal company blog was about the template engine. I wrote about adding a template to instantiate a ScoutLogger. I described how it works and the necessary steps in the preferences dialog to add the scout logger..

BSI Internal Blog

At the Eclipse DemoCamp in Zurich, Marcel Bruch presented “Snipmatch – a better template engine”. Snipmatch will be released along with the Luna release. I was really impressed and I wanted to give the tool a try.

Installation:

Since Snipmatch is released with the Luna release train, it is really simple to install it:

  • Open the “Install new software” dialog (Help menu)
  • Work with the Luna update site: http://download.eclipse.org/releases/luna
  • Set the filter to “Snip” and you will find the desired item.

install snipmatch

Maybe we should add Snipmatch to our Eclipse distribution “Eclipse for Scout developers”. Do not hesitate to leave acomment if you have an idea on this topic.

Usage:

You need to learn a new shortcut: CTRL + ALT + Space (or to bind the feature to another key combination).
This opens a small text field where you can search for a specific template.

snipmatch

Adding new snippets:

Adding new snippets is as simple as with the old template engine. Open the “Snippets” view and click the “Add” button. A Snippet editor is opened. You should enter some metadata and some source for the snippet. The syntax is the same as with the old template engine (see JFace template language). To start writing templates, I also like the approach “look for inspiration in the existing examples”.

snipmatch editor

From what I understood the Code Recommenders team is working on an improved editor. It will provide syntax highlighting, validation and content assist.
There will also be an easy way to create templates directly from your java code editor . Simply select the relevant code and choose“create a new snippet” from the context menu. I think this will help the community to create useful snippets.

Sharing snippets:

In my opinion, one of the killer features of Snipmatch is the ability to share templates in an easy way.Snippets are stored in a git repository. Sharing them is as simple as pushing a text file into a git repository. In order to consume the shared snippets, your team needs to set the URL of the git repo in the preferences dialog. (Preferences Dialog > Code Recommenders > Snipmatch).

snipmatch for scout - git repo

The code recommenders project has prepared a git repo hosted by the eclipse foundation to collect and share snippets. I am sure they will greatly welcome gerrit changes for new snippet contributions.

For the Scout project I have forked this repository at GitHub. I am not sure how we should handle the “Scout specific” snippets. Let us experiment on this fork and we can decide later if it makes sense or not.

Scout Links:

Project Home, Forum, Wiki, Twitter

Eclipse Democamp in Zurich on June 23rd

democamp_zrh_2014_header

We are happy to invite you to attend the 3rd Eclipse Democamp in Zürich on June 23rd. In addition to a large number of excellent speakers and interesting topics, the democamp also features an optional hands-on Scout tutorial before the actual democamp.

Here is our current Agenda:

democamp_zrh_2014_agenda

I’m especialy looking forward to see Sharky flying through an ETH lecture hall

democamp_zrh_2014_sharky

And, thanks to our sponsors, we can again host the democamp at the centrally located main building of the ETH Zurich, enjoy food, beer and have a good time :-)

democamp_zrh_2014_sponsors

 

“Ignore Issues on Multiple Criteria” in SonarQube

I am currently helping a customer to setup a configuration of his SonarQube instance in order to monitor the code of a Scout Application. SonarQube is a great tool to monitor code quality continuously and to fight against technical debt.

SonarQube Logo

We started with the default set of rules (called “quality profile” in SonarQube). This was done because we trust the SonarQube team that knows what is important when it comes to the quality of a Java project. Additionally, the source code that we consider to be acceptable should not be marked with any violations when analyzed with SonarQube. On new projects, if you cannot maintain a zero warning state, over the time nobody will look at the error dashboard anymore. The team treats each new violation as false positive, and at the end the quality of the code will decrease.

We had a problem with rule squid:S00112. This rule ensures that generic exceptions are not thrown. This is a good principle, but we got violations of this rule in each Activator classes in our code.

Read the rest of this entry »

Dynamic Working Sets: another way to define working sets

While working with the workspace containing the Scout demo applications, I have a lot of projects inside. The Scout Explorer presents a logical representation of each application. However, to access some files (like the MANIFEST.MF file) you have to use the Package Explorer View.

Explorer Views

A possibility is to group the projects corresponding to one demo application into a separate working set.

Of course you can work with PSF files (we have started to propose PSF files for each application), but there are still a lot of manipulations needed to import them correctly into the workspace. (See our current how to Download and Run Locally the Scout Demo Application).

During the last EclipseCon Europe I was told that a couple of good tools were provided by the CDO project. Dynamic working sets is one of them. It allows to define rules, to assign projects into a working set. Rules are based on predicates describing the project (name, pattern, nature, builder, file …) and logical operator predicates (and, or, not…).

Read the rest of this entry »

Local p2 mirrors to work offline

Working with Tycho without an internet connection?
=> Make a local mirror of the p2 repositories.

I was asked to create a maven tycho build for an existing scout application in a company where it was difficult to reach the eclipse repositories. Do not ask me why, I guess this has something to do with proxy, firewalls and so on…

This was really frustrating because I could see the plugins in my target editor, but during the maven build there was a lot of warnings that maven will contact another mirror and finally I got some timeout errors.

default_target
Read the rest of this entry »

Working with version=”0.0.0″ in your target platform?

At BSI (the company behind the Eclipse Scout project) we are working with the version attribute set to “0.0.0″ in some of our target platform definitions.

xml file

<location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.scout.feature.group" version="0.0.0"/>

<repository location="http://download.eclipse.org/releases/kepler"/>
</location>

Setting the version to “0.0.0″ means that we want to get the last available version of the installable unit (features or plugins). For example: the feature org.eclipse.scout.feature.group was 3.9.0.20130612-0904 last summer and is now 3.9.1.20130918-0824 and will become something like 3.9.2.xxxx when Kepler SR2 gets released.

This works well, but we are experiencing some difficulties:
Read the rest of this entry »

Scout Mobile Applications

One of the most notable features of the Scout Kepler release is the support for mobile applications. Scout’s mobile support is based on Eclipse RAP adding an (optional) device transformation component. This component adapts widgets to the target device at runtime.

Let us use the small bug viewer as an example application to show the out-of-the box mobile support provided by the Scout package.

ibug_samsung_mibug_samsung2_m

 

The client application consists of a single form that lists the most recent bugzillas for a given project and assignee. In the Scout SDK, the complete UI model of the form looks as follows.

ibug_sdk_m

Comparing the model with the mobile screenshot  (shown on the left) we can observe, that the table field is actually rendered as a list. Instead of showing the content of the 10+ columns defined in the model, the content of the first three columns is presented in each list item. Once the user touches a list item a form containing the content of all defined rows is presented (shown on the right mobile screenshot).

The main benefit of the example shown above is the possibility with Scout to write business applications that run on mobile browsers and as desktop applications with the same code base. Below, the same application is shown running with Scout’s SWT UI rendering component.

ibug_swt

To play around with the iBug application you can get the sources from Github. Please don’t complain about the parsing of Bugzilla HTML content on the server, I have been fully convinced that this is bad. But – so far – nobody did step forward and provide an alternative implementation doing it properly.

In case you are new to Scout you may want to read the related article in the Eclipse Newsletter (you should be able to have a running hello world in less than 30′).

Scout Links: Project Home, Forum, Wiki, Twitter