Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to know a class is a UI class in eclipse plugin code
How to know a class is a UI class in eclipse plugin code [message #740785] Tue, 18 October 2011 22:16 Go to next message
Sai Missing name is currently offline Sai Missing nameFriend
Messages: 25
Registered: March 2011
Junior Member
Hi all-

I am new to the eclipse plugin development, and have a simple question to ask:
is there a simple way to decide whether a class is UI class in eclipse plugin code?

For example, we can write an example view like:

public class SampleView extends ViewPart {

... this is a UI class since it extends ViewPart

}

and plug it into the eclipse framework by specifying in the plugin.xml file:

<view
name="Sample View"
icon="icons/sample.gif"
category="plugintest"
class="plugintest.views.SampleView"
id="plugintest.views.SampleView">
</view>


So, I am wondering is there any simple way to decide whether a class is a UI class? Are all UI class must extend (or implement) some class (or interface)? If so, I can check it by reflection. However, seems it is not the case. For example, a PreferencePage and ViewPart have quite different class hierarchies ;(

Can anyone kindly let me know a good way to do that? any comments are highly appreciated!

Thank you

-Sai
Re: How to know a class is a UI class in eclipse plugin code [message #740864 is a reply to message #740785] Wed, 19 October 2011 00:41 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 10/19/2011 3:46 AM, Sai wrote:
> So, I am wondering is there any simple way to decide whether a class is
> a UI class? Are all UI class must extend (or implement) some class (or
> interface)? If so, I can check it by reflection. However, seems it is
> not the case. For example, a PreferencePage and ViewPart have quite
> different class hierarchies ;(
Correct. There is no simple rule for a class to be a 'UI class'.
Re: How to know a class is a UI class in eclipse plugin code [message #741613 is a reply to message #740864] Wed, 19 October 2011 18:12 Go to previous messageGo to next message
Sai Missing name is currently offline Sai Missing nameFriend
Messages: 25
Registered: March 2011
Junior Member
Thanks Deepak.

I note that UI classes are often specified in the plugin.xml. So, I am wondering how complete it would be if I chose to parse the plugin.xml file to fetch all UI classes?

Is that possible that a UI class will be instantiated (i.e., called back) by eclipse but not been specified in the plugin.xml file?

In addition, I found the plugin.xml has gone when packing a developed plugin project into a release jar, for example, i downloaded the CDT release: http://www.eclipse.org/downloads/download.php?file=/tools/cdt/releases/galileo/dist/cdt-master-6.0.0.zip, but did not find any plugin.xml inside. So, in that case, how could I know which class has been "plugged" into eclipse?

Thanks a lot

-Sai

Deepak Azad wrote on Tue, 18 October 2011 20:41
On 10/19/2011 3:46 AM, Sai wrote:
> So, I am wondering is there any simple way to decide whether a class is
> a UI class? Are all UI class must extend (or implement) some class (or
> interface)? If so, I can check it by reflection. However, seems it is
> not the case. For example, a PreferencePage and ViewPart have quite
> different class hierarchies ;(
Correct. There is no simple rule for a class to be a 'UI class'.

Re: How to know a class is a UI class in eclipse plugin code [message #741933 is a reply to message #741613] Thu, 20 October 2011 03:00 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
I don't know how you define a 'UI class' - a class that creates some UI
elements or in other words some SWT widgets ?
Re: How to know a class is a UI class in eclipse plugin code [message #741938 is a reply to message #741933] Thu, 20 October 2011 03:07 Go to previous messageGo to next message
Sai Missing name is currently offline Sai Missing nameFriend
Messages: 25
Registered: March 2011
Junior Member
Yes, in my definition, a UI class is a class that creates some UI
elements or in other words some SWT widgets, and may corrsponds to certain visible UI compositions in eclipse (like view, dialogue, etc)
Re: How to know a class is a UI class in eclipse plugin code [message #742062 is a reply to message #741938] Thu, 20 October 2011 06:16 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 10/20/2011 8:37 AM, Sai wrote:
> Yes, in my definition, a UI class is a class that creates some UI
> elements or in other words some SWT widgets

Then you may look for classes which have this code pattern - "new
<SWTWidget>(...)".

(I would say the boundaries of UI classes and other classes are a bit
fuzzy, at least with the definition you have so far. Arguably, all
classes in org.eclipse.jdt.ui are UI classes and all classes in
org.eclipse.jdt.core are non-UI classes.)
Previous Topic:ASTParser create NormalAnntation
Next Topic:Eclipse Workspace Tiling Difficulties
Goto Forum:
  


Current Time: Wed Sep 25 04:22:46 GMT 2024

Powered by FUDForum. Page generated in 0.04518 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top