Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » 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
Hello,

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">
			<biddata>
				<bmxfile id="2" area="FOO" path="PATH1"></bmxfile>
				<bmxfile id="0" area="BAR" path="PATH2"></bmxfile>
				<bmxfile id="1" area="BAZ" path="PATH3"></bmxfile>
			</biddata>
			<atcdata>
				<cmxfile id="1" sourcearea="FOO" targetarea="BAR" path="PATH4"></cmxfile>
				<cmxfile id="0" sourcearea="BAR" targetarea="BAZ" path="PATH5"></cmxfile>
			</atcdata>
			<timeunits>24</timeunits>
		</cosmostask>
	</pxseries>
</pxproject>


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>(PropertyDef.java:74)
	at org.eclipse.sapphire.ListProperty.<init>(ListProperty.java:23)
	at sapphiretest.fleo.BidData.<clinit>(BidData.java:23)
	... 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")
  	@Required
  	ValueProperty PROP_ID = new ValueProperty(TYPE, "Id");

  	Value<String> getId();

  	void setId(String value);

  	// *** Area ***

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

  	Value<String> getArea();

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

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

  	Value<String> getPath();

  	void setPath(String value);

}



The Definition file:

<definition>

	<import>
		<package>sapphiretest.fleo</package>
	</import>

	<composite>
		<id>ProjectEditorForm</id>
		<documentation>
			<title>PX Project Properties</title>
			<content>GOOGLE IT!
			</content>
		</documentation>
		<content>
			<property-editor>Id</property-editor>
			<property-editor>Name</property-editor>
		</content>
		<scale-vertically>true</scale-vertically>
		<width>600</width>
		<height>500</height>
	</composite>


	<editor-page>
		<id>PxProjectEditorPage</id>
		<element-type>sapphiretest.fleo.PxProject</element-type>
		<page-name>Px Project Properties</page-name>
		<page-header-text>Px Project Properties</page-header-text>
		<initial-selection>Px Project Properties</initial-selection>
		<root-node>
			<node>
				<label>PX Project</label>
				<section>
					<content>
						<actuator>
							<action-id>Sapphire.Add</action-id>
							<label>Add a </label>
						</actuator>
					</content>
					<description> DESC </description>
				</section>
				<node-factory>
					<property>PxSeries</property>
					<case>
						<label>${ Name == null ? "&lt;pxseries&gt;" : Name }</label>
						<section>
							<content>
								<include>ProjectEditorForm</include>
							</content>
						</section>
						<node-factory>
							<property>CosmosTasks</property>
							<case>
								<label>${ Name == null ? "&lt;cosmostask&gt;" : Name }</label>
								<section>
									<label>Cosmos Task:</label>
									<content>
										<include>ProjectEditorForm</include>
									</content>
								</section>
                                                        <node>
                                                           <property>BidData</property>
                                                           <label>BidData</label>
                                                           <node-factory>
                                                                <property>BmxFile</property>
                                                            </node-factory>
                                                        </node>
                                                        <node>
                                                        <property>AtcData</property>
                                                        <label>AtcData</label>
                                                           <node-factory>
                                                           <property>CmxFile</property>
                                                           </node-factory>
                                                        </node>
							</case>
						</node-factory>
					</case>
				</node-factory>
			</node>
		</root-node>
        <persistent-state-element-type>org.eclipse.sapphire.ui.forms.MasterDetailsEditorPageState</persistent-state-element-type>
	</editor-page>

</definition>


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: 1077
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: Sat Oct 05 08:50:23 GMT 2024

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

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

Back to the top