GWT UiBinder support

Posted on by Nikolay Chashnikov

The first IntelliJ IDEA 9.0.2 EAP build will add support for UiBinder, new functionality introduced in GWT 2.0. IntelliJ IDEA will understand tags and attributes in ui.xml files:

Inconsistencies between ui.xml file and associated Java class will be highlighted:

You can jump from field to the corresponding tag by using icon on the gutter:

Also IDE provides actions to quickly create new ui.xml file with associated Java class (in Edit | New | Google Web Toolkit menu) and to generate @UiHandler method (in Code | Generate menu).

Expect new version EAP to be published shortly.

Comments below can no longer be edited.

6 Responses to GWT UiBinder support

  1. David says:

    May 31, 2010

    I have 9.0.2 but this integration doesn’t seem to be working for me. How do I activate it?

    thanks

  2. Nikolay Chashnikov says:

    June 1, 2010

    Do you have GWT facet in your module?

  3. Jesper Rønn-Jensen says:

    June 18, 2010

    While the UiBinder support you describe here works perfectly, there is still one important issue that IntelliJ has yet to support:

    It seems that methods invoked via UiBinders are marked as unused.
    For instance, you have a field declared (in java file):

    @UiBinder
    JespersHyperLink aboutlink;

    And imagine that the JespersHyperLink class has a `setTextAndTitle(String s)` metod. UiBinder syntax allows you to call setters directly from the .ui.xml file on instantiation, which is a good way for me to keep java class size down.

    Unfortunately, the code inspection grays out the metod and postulates it’s unused.

    This is very wrong. Do you have focus on correcting this behaviour?

  4. Alexander Vasiljev says:

    June 28, 2010

    Hello Jesper.

    If aboutlink is not invoked from Java code, it may still exists in ui.xml (with or without ui:field binding) with setters called there. So aboutlink field is really unused and could be deleted.

  5. Jesper Rønn-Jensen says:

    November 3, 2010

    @Alexander:
    > So aboutlink field is really unused and could be deleted.

    You are right, i could delete @UiField aboutLink in my Java class

    But i think you are missing the point: IntelliJ incrorrectly marks `JespersHyperLink.setTextAndTitle()` as being unused.

    I think that is incorrect: JespersHyperLink.setTextAndTitle() is used in the UiBinder files. So IntelliJ should mark it as used. AND “find usages” should show the usage in uibinder file.

  6. Danilo Reinert says:

    March 18, 2015

    I noticed that IDEA only supports UiHandler method generation when the field is injected in the class. GWT doesn’t require this injection to the UiHandler method work properly. Could you provide this (great) feature without requiring it?

    Also, it would be very nice if we could navigate to the UiHandler method from the UiBinder XML by only clicking on the element. (The IDE could recognize the UiHandler methods declared for the referring UiBinder element, show them as a select menu, and the user would click on the desired method to navigate to).

Subscribe

Subscribe for updates