Wednesday, October 1, 2003

Changing default editors in WebSphere Studio

THIS WEEK'S POWERTIP

By Dan Velasco

WebSphere Studio offers almost every kind of editor you could need to edit your code and develop your applications. But what if you really want to use an editor that you've come to know and love? For instance, many developers like the raw, clean feel of editors like TextPad (at http://www.textpad.com). Once you start using WebSphere Studio, however, you find yourself stuck with the default Java editor that it comes with. But are you really stuck?

Short answer: no.

The good news is that you can choose what program you want WebSphere to launch when you click on different types of files. For instance, you can easily make WebSphere launch TextPad when you double-click to edit a Java file or launch Dreamweaver when you double-click an HTML file. In this article I'll use the example of making TextPad the default editor for Java files in WebSphere Studio, but the same steps can be taken to change the editor for any file type you desire. I'll also point out some of the potential drawbacks of changing the default editor.

Changing the default editor for any type of file is easy in WebSphere Studio. First, select Window --> Preferences. In the Preferences dialog box, expand the "Workbench" category at the top of the left-hand list. Select File Associations and scroll to the file type for which you would like to change the editor. In Figure A you can see the "*.java" file type is selected.

FIGURE A

The "*.java" file type is selected. (click for larger image)

In the lower-right of that window, click the Add button and then select the radio button for External Programs (note that this might take a while the first time you do it). Choose the program that you would like to use and then click OK as shown in Figure B.

FIGURE B

WebSphere Studio will provide you with a list of external programs, but it might take a while to load. (click for larger image)

Next, in the Associated editors box select the program you just added and then click the Default button to the right to make it the default editor. WebSphere Studio does not have to be restarted in order for the changes to take effect. Navigate to any file that is the type you changed the association for and double-click to open it. As you would probably expect, the editor opens in its own window outside of the WebSphere Studio environment. You can see an example of this in Figure C.

FIGURE C

Voila! The external editor opens just as you might wish. (click for larger image)

One thing that I found interesting when testing out different editors for modifying Java files is that I ended up missing the features of the built-in editors in WebSphere Studio. For instance, when you edit a Java file using the built-in editor and then save the file, the file is validated by default. When you use an external editor like TextPad, though, you're dependent on that program's validation capabilities.