AuthorJean-Michel GARCIA

List of some useful Eclipse plugins

When using IntelliJ IDEA is not an option…

This is a list of some useful Eclipse plugins that I tend to use when I’m working in a JavaEE environment.

  •  Eclipse Fullscreen :

Allows Eclipse to run on a fullscreen mode toggled by the Ctrl+Z shortcut.
https://code.google.com/p/eclipse-fullscreen/

  • Eclipse GrepConsole  :

Applies styles to the Console output (regex based). Come with a defined set of style based on (WARN, INFO, FATAL).
http://marketplace.eclipse.org/content/grep-console

  • Atlassian Connector for Eclipse  :

Gives the possibility to view, edit, manage Jira tickets inside Eclipse.
Requires Mylyn to be installed.
https://confluence.atlassian.com/display/IDEPLUGIN/Installing+the+Eclipse+Connector

  • Subclipse  :

I tend to prefer Subclipse over Subversive.
http://subclipse.tigris.org/

  •  Maven Integration :

http://eclipse.org/m2e/download/

and more…

Creating thumbnail images in PHP

Wasn’t easy to find a working solution, so I’m posting here as a reminder.

This is a PHP function to generate images thumbnails that handles: png, jpg, gif and also transparency

I’m not the author of this function, I’ve just mixed two solutions together, and fixed some small issues.

Sources :

http://davidwalsh.name/create-image-thumbnail-php

http://stackoverflow.com/questions/2611852/imagecreatefrompng-makes-a-black-background-instead-of-transparent

Talend Open Studio in fullscreen

I’ve being used Talend Open Studio for a while now.

Whereas this program is just a fantastic ETL program, it lacks of fullscreen support (just as Eclipse does).

I’ve just found this simple yet powerful plugin callend Eclipse fullscreen that also work for RCP based applications.

How to install

  1. Download the plugin here
  2. Simple extract the .jar file to the Talend directory plugin folder (mine is : C:\Program Files\Talend 5.2.1\TOS_DI-Win32-r95165-V5.2.1\plugins)

How to use it

Just press CTRL + ALT + Z to toggle fullscreen mode !

Result

Talend Open Studio with fullscreen mode offTalend Open Studio with fullscreen mode on

Fullscreen support is a nice feature for people who work with two monitors and therefore can take advantage of the second monitor without loosing sight of the task bar and other open applications.

Using java keyword when declaring an enumeration

Once, I had this particular case where I needed to have an enumeration with the double java keyword. I also wanted that a call on this enumeration would return me the “double” String.

If you try to type this :

You will get an error from the compiler saying that you cannot use the double keyword.

Here an elegant solution to achieve this :

This is possible due to the fact the enum is a class. We can then manipulate the name attribute

A very nice CSS3 Selector

This is a tiny small article (more like a reminder) to show you a great CSS3 selector

Match every p element inside any container that have a particular attribute :

Here is a small example. I want my rule to match the p element inside the div with customAttribute=”1″

Content in a “p” block inside the div

Content in a “p” block outside the div

Content in a “p” block inside the div

That magical ruly would be :

a p element inside any element with customAttribute set to 1

And voilà!

I strongly suggest you to read the CSS3 specification CSS 3 Selectors specification

Embedding a GWT / SmartGWT application in a Java Portlet (Liferay) using Maven

For a research project, I was once able to embed a GWT application using the SmartGWT framework in a Java Portlet. So, as I had faced some issues and problems, I’ve decided to post a small tutorial with guidelines to help people trying to achieve the same thing.

Little precisions:

  • The portlet was following the JSR 268
  • GWT version 2.3
  • SmartGWT version 2.5
  • Firefox was the only browser I was targeting
  • I was using Maven to manage my projects (but same thing could be done using Ant)

Thanks to “Antoniodb” from the SmartGWT community for providing some precious informations.

I do not intend to be an expert in those products. I’m only sharing my experience. There is another way of doing this (throught an html iframe) but I’m not detailing it.

    To integrate a SmartGWT application in a portlet, here are the steps I recommend to follow :
  • Create an empty JSR-268 portlet and configure it
  • Configure the SmartGWT app to work with the portlet
  • Mix the projects
  • Solve the Liferay CSS issues

The first part, is to create an empty JSR-268 portlet and configure it

No big deal in this part, we are going to create an empty portlet following the JSR 268 specification. In the main JSP page, we need to define an entry point for our SmartGWT module.

This is our jsp page

 

The GWT compile process will generate a lot of html and javascript files. But the “applicationame.nocache.js” is our entry point one. The gwtSource will be used to set the url of this file.
The urlSmartGWT will be used to set the isomorphicDir (the directory where SmartGWT search for its resources).

We also added a div that will contain the whole SmartGWT application once launched.

 

Now we are going to use the doView method, to set properly “gwtSource” and “urlSmartGWT” :

Configure the SmartGWT app to work with the portlet

To allow our SmartGWT module to be inserted into our JSP page, we have to add our outmermost layout manager into the div we defined before. We do that using this line of code instead of calling show() or draw():

When I used this approach, SmartGWT had some problems finding the image dir. So I’ve added this in the beginning of my onModuleLoad() method :

Another annoying problem is that SmartGWT uses high zIndex values (sometimes above 190 000), and this is not compliant with the Liferay zIndex. This results in your application getting rendered above the Liferay menus. To solve that, there is a possible solution :

To your outermost SmartGWT layout manager (any Canvas, Layout, etc), add this handler :

 

Mix the projects

This is the way I managed my java projects (maybe a better solution exists).

  1. One eclipse project containing my GWT / SmartGWT module.
  2. Another eclipse project containing my JSP portlet

When running in test mode, I only use the first project (using the embedded jetty servlet container).

When I was led to test the application under Liferay I used the second one.

Every time I wanted to deploy the portlet project, I copy the source files from SmartGWT project using the Maven Ant run plugin :

To make this approach work, we have to add this generated-sources/imported dir to the list of the known sources directories. Again this is easily done using the build helper Maven plugin :

After that, the Portlet project can compile the GWT code imported from the first project :

Solve the Liferay CSS issues

Finally, if you are using the Liferay portal you will probably experience some issues regarding the scrollbars. I named this issue : “Scrollbars gone crazy” (more info here).

In a short way, the problem is that the Liferay CSS (defined in the theme) is interfering with the SmartGWT CSS. I filled an issue report at Liferay’s site( more info here) but no one seems to be interested on it.
There is many ways to solve this, but I choose the approach modifying the Liferay theme. So a small solution is to add this rule in the Liferay CSS (best place to do that is in the custom.css file) :

I don’t know if all these settings are mandatory, but they solved my issues whens using Firefox.

© 2017 jmichelgarcia

Theme by Anders NorénUp ↑