Tuesday, March 8, 2011

JDT at EclipseCon 2011


Raksha Vasisht and I will be speaking at EclipseCon 2011 in Santa Clara. We have the following 2 talks

What's new in JDT
Monday, March 21 14:00 - 14:20, Stevens Creek

JDT - Tips and Tricks
Tuesday, March 22 14:00 - 14:20, Stevens Creek

We are also organizing a Bof
Eclipse - Tips and Tricks
Wednesday, March 23 19:30, Sonoma

See you soon at EclipseCon !

Sunday, February 6, 2011

JDT 3.7 M5 - New and Noteworthy

This time there are a bunch of interesting items in the debug area

There is now a history for recently used breakpoint conditions:

The global history shows the saved conditions across all conditional breakpoints, while the local history shows the history of one particular breakpoint.

In the Java editor, if you delete a breakpoint that has a condition set on it, you will now be prompted before the breakpoint gets deleted:

You can specify that you would not like to be notified again when trying to remove a conditional breakpoint. This can later be changed again via Prompt for confirmation when deleting a conditional breakpoint from editor on the Java > Debug preference page.


If you accidentally removed a breakpoint from the editor's vertical ruler or the Breakpoints view, you can now get it back using the standard undo functionality - Edit > Undo Delete Breakpoint (Ctrl+Z) - in the Breakpoints view or any other view that works against the global undo history.


The Add missing case statements quick assist is now available in the body of the switch statement:


The Quick Outline shows inherited members of top-level types when Ctrl+O is pressed twice. Now, it also shows inherited members of the type that contains the current editor selection:


The focus types that can show inherited members are marked with a triangle.


Two new compiler options have been added that mark methods which can be made static because they only refer to static members.


The first option marks private and final methods than can always be made static. The second option also marks other methods. Note that methods can be overridden in a subclass, so if you make a "potentially static" method static, this may break existing clients. These options are disabled by default.

Another interesting feature in the SDK is detached editors. This can be really useful in a dual monitor setup.

 Though while trying this out I 'lost' a couple of editors before filing Bug 336391

Monday, December 13, 2010

JDT 3.7 M4 - New and Noteworthy

This time there are a bunch of interesting items in the quick assist (Ctrl+1) area

The Introduce new local with cast type quick assist is now not only available on the instanceof keyword, but also in the body of the conditional statement (before the first body statement).


The Join variable declaration quick assist is now also available for variables initialized to null.


The Exchange left and right operands for infix expression quick assist is now also available for the !=, <, <=, >, and >= operators.


The properties file editor now offers two new quick assists to escape or unescape backslashes.


The Escape backslashes quick assist is also offered automatically on paste if the pasted text contains backslashes that should be escaped.  The next step is to provide a similar feature in the Java Editor, see Bug 332205.

Couple of irritating bugs that got fixed
  • Bug 327079 [JUnit] Can't run single test with JUnit 4 launcher if there's a suite() method
  • Bug 329677 [type hierarchy] view must honor package name abbreviation setting

Sunday, October 31, 2010

e4 - Eclipse 4.x - Second Impression

I have been using the latest builds of Eclipse 4.x SDK for my daily work for the last 6 weeks. The overall stability has improved gradually, and the NPEs are quite rare now. Some of the bugs I filed were also fixed  quite quickly during M3 - Bug 325834 , Bug 327154. But there are still a few things which must work but don't.
  • Ability to customize a perspective (Bug 320478)
  • Ability to set or change key bindings (Bug 317299)
  • Plus I am a bit confused about the 'Editor Area' introduced in 4.1 M3. Does this mean I should not create multiple editor stacks? Should I create multiple editor stacks only in the editor area? Will this editor area continue to take extra space as it does in M3? In 3.x we had a editor only area, are we going back towards that? M4 is supposed to have a more polished implementation of the 'Editor area', I will wait for that.
I am also hoping that Editor tab rendering could be improved significantly in Eclipse 4.x (Bug 325422).

    Saturday, September 18, 2010

    e4 - Eclipse 4.0 : First Impression

    Looks a bit funny

    Off is On and On is Off - I saw that Build Automatically was Off so I switched it On, and then my code changes had no effect... few minutes later I realized that if something is turned Off in the UI, it may mean that it is actually turned On! e.g.Mark Occurrences, Build Automatically.  Or in the case of 'Edit > Smart Insert Mode' I cannot even toggle it.

    Layout and minimized Views - I like the overall layout and the fact that I can put views in the editor area. I also like the way when minimized views are selected they open in a pop-up sort of a way. Overall the UI/layout feels nice.

    Custom Key Bindings - mmh...


    Order of menu and toolbar items - The ordering of items in menus and toolbars can be a bit different from 3.x versions. e.g. navigate menu, run/debug toolbar
    I can use it for my daily work, except for some minor glitches and some funny behavior I have been able to use it for last few days. And I do like the layout, mixing of editors and views, and the overall feel of the UI to not go back to 3.x (at least for now).

    Monday, September 6, 2010

    New Command in JDT : Open from Clipboard

    This is what I used to end up doing very frequently
    - copy something like String#getBytes from a bug comment
    - press Ctrl+Shift+T in Eclipse
    - paste the copied text Open Type dialog
    - argh... no matches
    - delete the method name
    - open the type in an editor
    - press Ctrl+O
    - argh.. what was that method again?
    - go back to bugzilla and read/copy the method name
    - come back to Quick Outline and filter the method
    - and finally reach the method

    The new command opens a Java element or a Java stack trace from clipboard. If the clipboard content spans multiple lines then the it is pasted to the Java Stack Trace Console. If the clipboard content is a single line the command tries to open the matching Java element in an editor. Some examples
    • java.lang.String
    • String#getBytes
    • java.lang.String.getBytes(String, int[], int)
    • String.java:123
    • at java.lang.String.matches(String.java:1550)
    • java.lang.String.valueOf(char) line: 1456  
    I use this command with a key binding of Ctrl+Shift+V. After doing a Ctrl+C the most natural thing to do is Ctrl+V so the key binding for this command should be similar. Plus Ctrl+Shift+V is also similar to Ctrl+Shift+T and Ctrl+Shift+R, making it a bit easier for me to remember it.

    This command (Bug 48880) is already in nightly builds and will be in the today's I-build.

    As a final note I should also mention 2 'nasty' Platform bugs that I faced while implementing this command
    • Bug 324160: [Commands] Platform should support to use the action IDs from the action set contribution in menuContribution
    • Bug 324161: menu contributions added using 'endof' should appear before contributions added using 'after'
    I say nasty because in its current form the whole menu contribution, command, actionSet, action story can be very confusing...

    Saturday, August 7, 2010

    JDT 3.7 M1 - New and Noteworthy

    Filter preferences on Java > Compiler > Errors/Warnings page

    We have just too many options on this preference page (as does PDE and API tooling on some of their preference pages) and finding the option you are looking for can be quite difficult (and frustrating) with all the twisties and so much of scrolling involved.

    You can now filter preferences on the Java > Compiler > Errors/Warnings page by preference label text or by preference value. A word in the filter string preceded by '~' is used to filter on preference values. Examples:
    • param
    • ~off
    • ~ignore
    • param ~enabled
    • ~ignore param

    Bug 321818 is the next item to do - allow to filter a section for a value e.g. 'code style ~error.

    New 'Open Hyperlink' command

    The new Open Hyperlink command opens one or more hyperlinks at the current caret location. The command has been added to the Navigate menu for the Java and properties file editors and can also be used in other text editors by assigning a key binding on the General > Keys preference page.


    The command opens the hyperlink directly if there's only one link available. Otherwise, it shows a chooser with all the available hyperlinks at that location. The links are the same as when you move the mouse with Ctrl pressed.
    So now you can assign a key to this command (say F6) and then use this command in Properties files to navigate to NLS key references, in Java editor to navigate to declaration or implementation for a method,and declaration for other Java elements, or for any other hyperlinks.

    In short you can possibly stop using Open Declaration (F3) and start using this new command - depending on whether or not you would like to always make a choice between navigating to declaration or navigating to implementation for method invocations :)

    Other New and Noteworthy items.