Tuesday, July 27, 2010

Add Actions-sets in existing Perspectives

Assumption/PRE-required knowledge : Actionsets has already been created in your plugin. I will only be using the ID declared fr this action set in order to customize its visibility on existing Perspectives.

Example Objective: To display my Actionset with id =”myActionSet” only in Debug perspective(id : org.eclipse.debug.ui.DebugPerspective")

Steps:

There are two ways of doing this.. One is through the class implementation as in (1) below), while is other is by using only plugin.xml file(2) below)

  1. Class implementation: As a first step, we need to register our plug-in as a perspective change listener.
--> include the below xml snippet in plugin.xml

--> Now, implement the class EarlyStartup mentioned in your xml code. This class should implement the IStartup interface and implement the method perspectiveActivated from within the method earlyStartup(). This method is responsible for the action performed every time a perspective is activated.
--------

--------
With the above code, your action sets will be visible only in perspectives related to JAVA, such as : Java, Java Browsing and Java Type Hierarchy.

***************************************************************

2. Extend your plug-in with the extension -Perspective Extensions(refer the blog - 'Customizing existing Perspective')

References:







Sunday, July 25, 2010

source code websites

DOCJAR

GREPCODE

KICKJAVA

http://www.devdaily.com/java/jwarehouse/eclipse/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyEditingSupport.java.shtml

JAD - JAVA Decompiler / JADCLIPSE

  • In order to use JAD in eclipse, you need to update the eclipse version with the Update site forJADClipse - http://jadclipse.sf.net/update 1) Eclipse >> help >> install new software >> type - http://jadclipse.sf.net/update >> add >> choose ' JDT Decompiler feature' from list
    >> next >>and just follow eclipse instructions once this is done.... and you restart eclipseNow, you will be able to view source codes of all library classes when you search for a certain "java' element using the "alt+shift+t"

Wednesday, July 14, 2010

Externalize/Internationalize Plug-in strings

Externalize / Internationalize Strings in plugin.xml

When we extend our plug-in projects with some extension.. there will be soo many attribute values such as Names, labels etc. It becomes tedious to change every such attributue if in case required in the later stage of the project.

The easier way to do it is to be able to see it all at one file(the .properties file).

This becomes of utmost importance when the developer is ignorant of the local language and would want to just type-in English texts for these attribute values..

The language interpreter could just refer to this one file(.properties file) and convert all the required strings into the local language without having to know the Extension implementation details.

How is this implemented??

note: This article is applicable only for externalization of PLugin.xml files.. If you are to externalize source files.. its a whole new procedure...
  • Create your plug-in project.
  • once you have completed with including all the required extensions, make sure you have completed with all the textual values of attributes such as name, label, etc
  • Now, select your plugin.xml file form the explorer view
  • right click >>
  • PDE Tools >>
  • Externalize Strings/Internationalize >>
  • choose and expand the plug-in of interest
  • choose the manifest.mf and the plugin.xml file one by one to check if you are alright with the appended changes.
  • You could even modify the 'substitution key ' values if preferred
  • Next>> check with the appended changes in each file under your plug-in
  • Finish
Now, you will have a new bundle.properties file in your project which will map all the strings to a certain value.

Check the below screenshot after externalization:

Monday, July 12, 2010

Debug Eclipse Runtime Plug-ins

showView >> Plug-ins>>

choose the plug-in you want to debug..

>>right-click

>>Import as

>> source project

Now look at your project explorer to fins this plug-in...

Now.. go ahead and debug :)

Eclipse Pop-up Menu

org.eclipse.ui.popupMenus
****************************

Eclipse Pop-up menus are menuitems that appear when you right-click on an object in the Eclipse workbench.

Steps:

1) Create a Plug-in project with the.. While you are in the process of creating your plug-in project, when prompted for a template.. choose

' Plug-in project with pop-up menu'>>
next>>
finish

2)Open the Plugin.xml file

3)choose the 'extensions' tab. You will see th eextension structure as seen in the figure below:


4) Now, click on the ....(Object Contribution) item. This will populate the right tab with the details of 'id' and 'Object class'.(figure below)




5) Now, when you right-click on a object from the eclipse workbench, this Object class attribute is the value which determines, when right-clicked on which object, the pop-up needs to be visible as the context menu. Now, if you want to enable this pop-up meny when you click on a folder from any of the eclipse views, you have to browse to 'org.eclipse.core.resources.IFolder' in the field for Object class.


6) As a result of the above step, you will be able to view the pop-up when right-clicking on a folder object in your Eclipse wrkbench as seen in the figure below.

7) In your step 3), click on the ....(Action) item. This will populate the right tab with many details. Now when you click at the 'class' parameter from this view, It opens the class in an editor. This is the class where you can define the action that needs to be performed when you click on the popUpMenu Action(refer figure above)

And there you gooooo :)
***************************************

Eclipse SPY - (ALT+SHIFT+F1)

The Class responsible and the various class instances within the responsible class for a certain part of the Eclipse workbench can be easily recognised using the Eclipse SPY feature.


What exactly do I mean?

Let's consider an example...


Let's say that we want to know about the class and the list of classes instances called or responsible fo rth elaunch tab of "Eclipse Application".


How to see this list?


1)Create any eclipse application( a plug-in project)

2)Now right-click and open 'run configurations../debug configuration.." over this application.This will open the Debug/Run configuration dialog.

3)Now press, "alt+shift+f1". This will open the Eclipse spy dialog as shown in the figure below showing all the responsible classes fo rthe configuration dialog.