Friday Dec 21, 2007

NetBeans 6.0 FCS compatible Code Templates Tools on NetBeans Plugin Portal

Only yesterday I discovered that the Code Template Tools module was not working with NetBeans 6.0 FCS. I have fixed the issue and uploaded the module on NetBean Plugin Portal. The older, NetBeans 5.x compatible module can be downloaded from here.

UPDATE: I have improved the Surround With... Action (Ctrl+J T) for interactive use. Now it shows a pop up dialog with a list of templates. You can select a template and type ENTER or double click to insert the template in the editor. If the editor has some selected text then the templates using the ${selection} parameter are shown at the top of the template list. You can just type the template prefix to select a matching template quickly.
 

Friday May 04, 2007

Java Editor Hint: Change variable type fix

In NetBeans 6.0 Java editor supports writing custom, so called, fixes, hints and suggestions. These appear as a light bulb icon in the left margin of the Java editor. For example, in the code below:

100        List list = ...;
101        :
:
110        String s = list.get(0);

the type of the variable s does not match the type of the expression list.get(0). In such cases a light bulb icon appears in the left margin of the Java editor on the line 110 of the code. Clicking or invoking the fix action reveals a menu item saying Cast ...get(...) to String. Selecting the menu item changes the code on line 110 to:

110        String s = (String) list.get(0);

This is all well and good. However what if you wanted to adjust the type of the variable s to Object. It is very easy to write such a fix and that is what I have implemented.

With this fix, I always write my variable like this:

110        int i = .....; // some expression that return a type I don't know - assume it is RefactoringPluginFactory

Select the hint to change the type of i to the correct type.

110        RefactoringPluginFactory i = ....; 

(I know, I know some may say why I am doing this...because I am an extremely poor typist :( )
Then I quickly delete i and use the smart variable name proposal code completion to get:

110        RefactoringPluginFactory refactoringPluginFactory = ....;

I have added the fix to the Experimental Java Hints (contrib/editorhints/java) module. You can get the module from Development Update center.

Sources

DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.

Wednesday Apr 11, 2007

NetBeans 6.0 specific Update Center

NetBeans 6.0 Specific Update center

I have upgraded some of my modules to NetBeans 6.0 specific APIs. To handle those modules I have configured a NetBeans 6.0 specific Update Center so that you can install these modules.

So far I have uploaded the following modules:

I will be putting other 6.0 specific modules there soon.

You say - I don't know how to configure and use a NetBeans Update Center!. Don't worry, here is the tip:

The NetBeans 6.0 Update Center URL is:

http://blogs.sun.com/scblog/resource/updatecenter_6_0/update-center.xml

To add the Update Center do the following in NetBeans IDE:

  1. Select Tools:Options menu item
  2. Click on Advanced Options button
  3. Select Options:IDE Configuration:System:Autoupdate Types
  4. Right Click and select New:General Update Center
  5. Enter Sandip Chitale's 6.0 Modules  for Name and click Finish
  6. In options dialog expand Autoupdate Types node, select Sandip Chitale's 6.0 Modules
  7. On the right hand side enter:
http://blogs.sun.com/scblog/resource/updatecenter_6_0/update-center.xml

as the value for Server Url poropetry. Also make sure the Enabled property is selected. Then close all the dialogs.

Now select the Tools:Update Center menu item. You should see the Sandip Chitale's 6.0 Modules entry in the update centers list. Install the modules by finishing the wizard.

DISCLAIMER: These modules are experimental. So no guarantees. Use the modules at your own risk.
About

sandipchitale

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today