Writing Eclipse Plug-ins is one of my major tasks. And everytime I start a new one or enhance existing ones it often comes to two situtations. First, there’s something going on in the code and you want to create a log for the error log view. Activators can do it easily by accessing their log. Second, when writing UI Plug-ins you often need to load images from some place in your Plug-in hierarchy. It’s another thing your Activator can do for you.
Eclipse comes with many features, that one can use to ease coding. One of them is the ability to define your own editor templates. You can export and import them to share them with your colleagues. Some are already build in. You may even have used one of them. Do “syso”, “main”, “foreach”, etc. sound familiar? No? Try them by start typing them in a Java editor and trigger code completion (Ctrl+Space).
To get back to the Activator methods. I wrote a template triggered by “activatorfill” that adds various log() methods and a getImageDescriptor() method to the active class: activatorfill.xml.tar.gz
Importing that template is just a matter of opening your Eclipse preferences, navigating to Java->Editor->Templates, and choose “Import”. Then select the extracted activatorfill.xml file.
No user commented in " Useful Plug-in Activator Methods "
Follow-up comment rss or Leave a TrackbackLeave A Reply