Results 1 to 3 of 3
- 01-03-2009, 12:34 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
Missing annotations in Eclipse plugin
Hello everyone,
We are creating the plugin for the BIRT for creating the reports from the objects we pass to it. During the report creation phase, we will be using the graph representation of the objects network.
To provide the user-friendly graph, we decided to use annotations to indicate, which fields should be displayable and what should be their names on graph.
The annotation:
Then, when user points the place where the properly annotated classes are placed, we are loading them (using our own class loader) and look for the annotated fields:Java Code:@Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface BIRTVertex { String displayableName() default "[unset]"; boolean expandable() default false; }
It works great as long as we are testing it as a simple Java program. The result of the AnnotationGetter for:Java Code:for(Field f : cl.getFields()) { System.out.println("Checking field " + f.getName()); if(f.isAnnotationPresent(BIRTVertex.class)) { System.out.println("Is annotation " + f.getName()); BIRTVertex vertex = f.getAnnotation(BIRTVertex.class); DisplayableField field = new DisplayableField(); field.setDisplayableName(vertex.displayableName()); field.setExpandable(vertex.expandable()); field.setRealName(f.getName()); field.setField(f); field.setType(f.getType()); if(f.isAnnotationPresent(BIRTIterable.class)) { field.setIterable(true); } fields.add(field); } System.out.println("Checked field " + f.getName()); }
is:Java Code:public class Contractor { @BIRTVertex(displayableName = "Simple Contractor", expandable = true) public NameBox nm = new NameBox("SomeNAME"); }
and everything is ok. Then comes the toughest part: we are trying to run the code inside the new eclipse application (inside the BIRT plugin). The same code (copy/paste pattern), different behavior:Java Code:Checking field nm Is annotation nm Checked field nm
The BIRTVertex class is available in the plugin environment, I have even loaded it manually (Class.forName).Java Code:Checking field nm Checked field nm
We have tried a hundreds of configurations, classpath settings and so on: the annotations are invisible...
Can anyone tell me what I am doing wrong or propose the solution of the problem?
- 06-30-2009, 03:34 AM #2
Member
- Join Date
- Jun 2009
- Posts
- 1
- Rep Power
- 0
Missing annotations in Eclipse plugin
I meet the same prolem.If someone knows the problem and solved it ,please mail to ahfang09@163.com.I appreciate your help very much.
- 07-12-2009, 09:01 AM #3
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
The problem was with the fields permissions: in the annotation definition, there should be:
instead of:Java Code:public String displayableName() default "[unset]"; public boolean expandable() default false;
After that small change everything works smoothly...Java Code:String displayableName() default "[unset]"; boolean expandable() default false;
Similar Threads
-
Help with Eclipse SWT - OLE plugin
By nmarathe in forum EclipseReplies: 4Last Post: 03-11-2009, 01:37 PM -
missing required java project: org.eclipse.swt
By phubaba in forum EclipseReplies: 1Last Post: 12-15-2008, 08:11 PM -
Eclipse Plugin Dev
By eva in forum EclipseReplies: 1Last Post: 01-21-2008, 10:56 PM -
AnyEdit Plugin For Eclipse Plugin
By JavaForums in forum EclipseReplies: 0Last Post: 05-18-2007, 12:28 PM -
plugin for eclipse
By sin in forum EclipseReplies: 1Last Post: 05-10-2007, 07:43 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks