|
|
Re: Creating custom connection bindings [message #1709287 is a reply to message #1709283] |
Fri, 25 September 2015 15:58 |
Justin Albright Messages: 10 Registered: September 2015 |
Junior Member |
|
|
I have been using the Map sample as a guide for developing my diagram editor and I did notice that the highway routes were very similar to what I was attempting to do. Where I get caught up is when I got to specify the endpoints because my Connection interface is
public interface Connection extends Element {
ElementType TYPE = new ElementType( Connection.class );
// *** Name ***
@XmlBinding(path = "@name")
@Label(standard = "Name")
ValueProperty PROP_NAME = new ValueProperty(TYPE, "Name");
Value<String> getName();
void setName(String value);
// *** Transport ***
@XmlBinding( path = "@transport" )
@Label( standard = "Transport" )
ValueProperty PROP_TRANSPORT = new ValueProperty( TYPE, "Transport" );
Value<String> getProperty();
void setProperty( String value );
// *** Ports ***
@Type( base = ConnectionPort.class )
@XmlListBinding( mappings = { @XmlListBinding.Mapping( element = "port", type = ConnectionPort.class ) } )
@Label( standard = "Ports" )
ListProperty PROP_PORTS = new ListProperty( TYPE, "Ports" );
ElementList<ConnectionPort> getPorts();
}
With the ConnectionPort interface as follows...
public interface ConnectionPort extends Element {
ElementType TYPE = new ElementType( ConnectionPort.class );
// *** Name ***
@XmlBinding(path = "@name")
@Label(standard = "Name")
@Required
ValueProperty PROP_NAME = new ValueProperty(TYPE, "Name");
Value<String> getName();
void setName(String value);
// *** Instance ***
@Reference( target = Instance.class )
@ElementReference(list = "/Instances", key = "Component")
@XmlBinding(path = "@instance")
@Label(standard = "Instance")
@Required
@MustExist
ValueProperty PROP_INSTANCE = new ValueProperty(TYPE, "Instance");
ReferenceValue<String, Instance> getInstance();
void setInstance(String value);
}
My connection binding looks like...
<connection-binding>
<connection-id>ConnectionElementConnection</connection-id>
<property>Connections</property>
<endpoint1>
<property>Ports</property>
<value>endpoint 1</value>
</endpoint1>
<endpoint2>
<property>Ports</property>
<value>endpoint2</value>
</endpoint2>
</connection-binding>
When I launch I get this exception...
java.lang.ClassCastException: org.eclipse.sapphire.ListProperty cannot be cast to org.eclipse.sapphire.ValueProperty. I am assuming this related to using the Port list property as the endpoint property. Is there a way I can restructure my interfaces or modify the property value inside the connection binding endpoints to allow this to work.
*** Update: No longer get the above exception because I was able to modify the connection binding endpoint property to be Ports/Instance, however now I get another exception - java.lang.IllegalArgumentException
at org.eclipse.sapphire.ElementImpl.property(ElementImpl.java:372).
[Updated on: Fri, 25 September 2015 16:14] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07822 seconds