Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Required @Type annotation missing
Required @Type annotation missing [message #1403683] Fri, 25 July 2014 09:54 Go to next message
Peter Lunk is currently offline Peter LunkFriend
Messages: 2
Registered: July 2014
Junior Member

My name is Peter Lunk and I am working on an XML editor similar to the PDE plugin.xml editor, using Sapphire 0.8.

The editor should support an xml format similar to the following:
<?xml version="1.0"?>
<pxproject id="0" name="Sprint_3test">
	<pxseries id="0" name="testseries">
		<cosmostask id="0" name="task1" date="20120922">
				<bmxfile id="2" area="FOO" path="PATH1"></bmxfile>
				<bmxfile id="0" area="BAR" path="PATH2"></bmxfile>
				<bmxfile id="1" area="BAZ" path="PATH3"></bmxfile>
				<cmxfile id="1" sourcearea="FOO" targetarea="BAR" path="PATH4"></cmxfile>
				<cmxfile id="0" sourcearea="BAR" targetarea="BAZ" path="PATH5"></cmxfile>

I am not quite experienced with this technology, and was hoping that I could find a solution here to the following problem:

I have started off the project by modifying the org.eclipse.sapphire.samples project. As I only needed an editor part, I have removed the unnecessary views and wizards from the plugin.xml.

After this I have defined the sapphire model and UI definition based on the documentation and the EzBug project.

Most of the model seems to work fine, only two ListProperty typed properties (BmxFile, CmxFile)are a thorn in my side (If I comment these out, the editor works like a charm)

However If I leave them in the code the following exception is thrown:

Caused by: java.lang.IllegalStateException: Property "BmxFile" of class java.lang.Class is missing the required Type annotation.
	at org.eclipse.sapphire.PropertyDef.<init>(
	at org.eclipse.sapphire.ListProperty.<init>(
	at sapphiretest.fleo.BidData.<clinit>(
	... 153 more

Based on this I'm guessing that somehow the @Type annotation is not added the the BmxFiles property, even though I add it in the respective interface.

As far a I know the Annotation processing is enabled, therefore I have no clue, why this particular Property is affected while the others are working fine. Even after I moved the property into different parent classes, (PxSeries, PxProject) the problem still persisted.

The Development environment is the following:
Eclipse Kepler 4.3 Modeling
Xtext 2.6.1
Xtend 2.6.1
EMF IncQuery 0.8
RTC Rational Team Concert Client Feature 4.5.1
Sapphire 0.8

I have added the model and ui definition code for providing better context for the problem:

PxProject: (Root Element) (left out the trivial name and ID ValueProperties for the sake of better legibility)

@XmlBinding( path = "pxproject" )

public interface PxProject extends Element
    ElementType TYPE = new ElementType( PxProject.class );
    // *** PxSeries ***
    @Type( base = PxSeries.class )
    @Label( standard = "Px Series" )
    @XmlListBinding( mappings = @XmlListBinding.Mapping( element = "pxseries", type = PxSeries.class ) )
    ListProperty PROP_PX_SERIES = new ListProperty( TYPE, "PxSeries" );
    ElementList<PxSeries> getPxSeries();
    // *** CosmosTasks ***
    @Type( base = CosmosTask.class )
    @Label( standard = "Cosmos task" )
    @XmlListBinding( mappings = @XmlListBinding.Mapping( element = "cosmostask", type = CosmosTask.class ) )
    ListProperty PROP_COSMOS_TASKS = new ListProperty( TYPE, "CosmosTasks" );
    ElementList<CosmosTask> getCosmosTasks();

PxSeries (left out the trivial name and ID ValueProperties for the sake of better legibility)
@XmlBinding( path = "pxseries" )
public interface PxSeries extends Element {
	ElementType TYPE = new ElementType(PxSeries.class);

	// *** CosmosTasks ***

	@Type(base = CosmosTask.class)
	@Label(standard = "Cosmos task")
	@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "cosmostask", type = CosmosTask.class))
	ListProperty PROP_COSMOS_TASKS = new ListProperty(TYPE, "CosmosTasks");

	ElementList<CosmosTask> getCosmosTasks();


CosmosTask: (left out the trivial name and ID ValueProperties for the sake of better legibility)
public interface CosmosTask extends Element {
	ElementType TYPE = new ElementType(CosmosTask.class);

	// *** BidData ***

	@Type(base = BidData.class)
	@Label(standard = "BID data")
	@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "biddata", type = BidData.class))
	ImpliedElementProperty PROP_BID_DATA = new ImpliedElementProperty(TYPE, "BidData");

	BidData getBidData();

	// *** AtcData ***

	@Type(base = AtcData.class)
	@Label(standard = "ATC data")
	@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "atcdata", type = AtcData.class))
	ImpliedElementProperty PROP_ATC_DATA = new ImpliedElementProperty(TYPE, "AtcData");

	AtcData getAtcData();


BidData and AtcDAta are similar they only contain BMX and CMX files. In this case, the BmxFile property is causing the problem, even though it clearly has the required @Type annotation:

public interface BidData extends Element {
	ElementType TYPE = new ElementType(BidData.class);

	// *** BMX FILE ***

	@Type(base = BmxFile.class)
	@Label(standard = "BMX file")
	@XmlListBinding(mappings = @XmlListBinding.Mapping(element = "bmxfile", type = BmxFile.class))
	ListProperty PROP_BMX_FILES = new ListProperty(TYPE, "BmxFile");
	ElementList<BmxFile> getBmxFile();


BMX file:
public interface BmxFile extends Element
    ElementType TYPE = new ElementType( BmxFile.class );
 // *** Id ***

  	@XmlBinding(path = "@id")
  	@Label(standard = "&ID")
  	ValueProperty PROP_ID = new ValueProperty(TYPE, "Id");

  	Value<String> getId();

  	void setId(String value);

  	// *** Area ***

  	@XmlBinding(path = "@area")
  	@Label(standard = "&Area")
  	ValueProperty PROP_AREA = new ValueProperty(TYPE, "Area");

  	Value<String> getArea();

  	void setArea(String value);
  	// *** Path ***

  	@XmlBinding(path = "@path")
  	@Label(standard = "&Path")
  	ValueProperty PROP_PATH = new ValueProperty(TYPE, "Path");

  	Value<String> getPath();

  	void setPath(String value);


The Definition file:



			<title>PX Project Properties</title>
			<content>GOOGLE IT!

		<page-name>Px Project Properties</page-name>
		<page-header-text>Px Project Properties</page-header-text>
		<initial-selection>Px Project Properties</initial-selection>
				<label>PX Project</label>
							<label>Add a </label>
					<description> DESC </description>
						<label>${ Name == null ? "&lt;pxseries&gt;" : Name }</label>
								<label>${ Name == null ? "&lt;cosmostask&gt;" : Name }</label>
									<label>Cosmos Task:</label>


Thank you in advance for your time,

Peter Lunk

Re: Required @Type annotation missing [message #1403726 is a reply to message #1403683] Fri, 25 July 2014 15:25 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1047
Registered: July 2009
Senior Member
ListProperty PROP_BMX_FILES = new ListProperty(TYPE, "BmxFile");

The property name doesn't match between the declaration and the holder field (files vs file).
Re: Required @Type annotation missing [message #1403840 is a reply to message #1403726] Mon, 28 July 2014 08:49 Go to previous message
Peter Lunk is currently offline Peter LunkFriend
Messages: 2
Registered: July 2014
Junior Member
Thank you very much, I must have overlooked it. It solved the issue.
Previous Topic:Sorted Node Factory
Next Topic:Sapphire 0.7 memory problem!
Goto Forum:

Current Time: Sun Feb 14 21:12:53 GMT 2016

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

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