Locating Code Executed By "Built-In" Menu Items

 

Let's say there is a built-in menu item that executes some functionality that you want to access or duplicate in your own code. How do you find out where the code executed by the menu item resides?

 

If it is a built-in menu item you need to look at the configureMainMenus method of the JUMPConfiguration class. (This is a private method so you will actually need to look at the source code, the Javadoc won't help you much, if at all.)

 

As an example, I was interested in seeing how the code that copied selected features and then pasted them to another Layer worked. Once I opened the JUMPConfiguration class in my Eclipse IDE I did a search for "edit". This brought me to the section of the method that creates the menu items in the "Edit" top-level menue. I found the code I wanted to examine was in the CopySelectedItemsPlugIn and the PasteItemsPlugIn.

 

In summary, here are the simple steps to locate the code executed by a built-in menu function:

 

  1. Open the JUMPConfiguration source code file in your favorite text editor or IDE.
  2. Search for the name of the top-level menu that contains the menu item that executes the code you are interested in. (This should take you to a section of the configureMainMenus metjhod.)
  3. Look in that section of code within the configureMainMenus method that "hooks up" the functionality for the menu item you are interested in. Usually this functionality will be captured in a plug-in.

 

Note: This method will not work for menu items that are contributed by third party plug-ins.


Page Information

  • 11 months ago [history]
  • View page source
  • You're not logged in
  • No tags yet learn more

Wiki Information

Recent PBwiki Blog Posts