Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Eclipse RCP Meets Spring: A Perfect Thick-Client Match : Page 2

Eclipse Rich Client Platform (RCP) is fast becoming the framework of choice for building thick client applications. Get a step-by-step guide to leveraging Eclipse RCP with Spring.


advertisement
Refactoring the Default View Class
As you can see, the Eclipse wizard created a class for you called View. Not very helpful, is it? Take the following steps to refactor the default view class:
  1. Let's rename it by right clicking on View.java in the Package Explorer. Go to Refactor -> Rename. For new name, enter ExplorerView and click Preview. In the panel that pops up, you will see that the Perspective class will be refactored to use ExplorerView.ID instead of View.ID (see Figure 6). Click OK.

    Click to enlarge

    Figure 6. Refactoring View Class to ExplorerView
  2. Unfortunately, Eclipse's refactoring is a bit weak--especially compared with IntelliJ's. For a refactoring like this, IntelliJ would not only change the class as expected, it would apply the refactor against your .xml files as well! This is invaluable, especially in a Spring/Hibernate/XML config-heavy world. But I digress…

    You must update the refactoring in plugin.xml manually. Open plugin.xml, and click on the plugin.xml tab. Find the extension for View, and update as follows:



    name="ExplorerView" class="eclipseTradeClient.ExplorerView" id="EclipseTradeClient.explorerView">

    After doing so, save (see Figure 7).

    Click to enlarge

    Figure 7. More Refactoring – Update Plugin.XML Manually
  3. That should be it for this very simple refactor, right? I'd like to say yes, but sadly you are not done. Open class ExplorerView. Change the static variable ID to be initialized to EclipseTradeClient.explorerView. This corresponds to the ID you just set in plugin.xml.
  4. Finally, you are finished with the refactor. Now, let's test that everything was changed correctly. Go back to plugin.xml in the editor, and click the Overview tab. Click Launch an Eclipse application, which should result in Figure 8.

    Click to enlarge

    Figure 8. Eclipse Trade Client Launched
  5. Now let's change the names of the nodes. Open class ExplorerView. Find the inner class ViewContentProvider, and change method Object getElements(Object parent) to return a string array of "Watch List", "Order History":



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap