Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Empty properties view in editor when using a ecore model with subpackages
Empty properties view in editor when using a ecore model with subpackages [message #211975] Mon, 24 November 2008 22:35 Go to next message
Eclipse UserFriend
Originally posted by: sderrienREMOVE.irisa.fr

This is a multi-part message in MIME format.
--------------060905020400050107010308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

As mentionned in the title, I am having problems with a GMF diagram
editor which is based on a ecore model with subpackages (see attached file).

Whenever I select in the editor an EditPart corresponding to a EClass of
a subpackage, Its property view is always empty, this does not happen
for EClass that are defined in the main (root) package.

Any idea on how to solve this issue ?

Thanks in advance,

Steven





--------------060905020400050107010308
Content-Type: text/xml;
name="datapath.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="datapath.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="datapath"
nsURI="datapath" nsPrefix="fr.irisa.cairn.model.datapath">
<eClassifiers xsi:type="ecore:EClass" name="Datapath" eSuperTypes="#//NamedElement ../../fr.irisa.cairn.graph/model/graph.ecore#//IGraph #//ActivableBlock #//DataFlowBlock #//FlagBearerBlock">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="nonNegativeNumberOfComponents noCombinationalCycles&#xD;&#xA;"/>
</eAnnotations>
<eAnnotations source="OCL">
<details key="nonEmptyComponentList" value="self.components.size()&lt;>0"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="components" lowerBound="1"
upperBound="-1" eType="#//AbstractBlock" containment="true" eOpposite="#//AbstractBlock/parent"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="dataWires" upperBound="-1"
eType="#//wires/DataFlowWire" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="controlWires" upperBound="-1"
eType="#//wires/ControlFlowWire" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="AbstractBlock" abstract="true" eSuperTypes="#//NamedElement ../../fr.irisa.cairn.graph/model/graph.ecore#//INode">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="consistentInputPortWidth consistentOutputPortWidth hasValidSources"/>
</eAnnotations>
<eAnnotations source="OCL"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" lowerBound="1"
eType="#//Datapath" eOpposite="#//Datapath/components"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="combinational" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" changeable="false"
defaultValueLiteral="false"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ActivableBlock" abstract="true" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="activate" lowerBound="1"
upperBound="-1" eType="#//port/InControlPort" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataFlowBlock" abstract="true" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="in" upperBound="-1" eType="#//port/InDataPort"
unsettable="true" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="out" upperBound="-1" eType="#//port/OutDataPort"
containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="FlagBearerBlock" abstract="true" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="flags" lowerBound="1" upperBound="-1"
eType="#//port/OutControlPort" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="NamedElement" abstract="true">
<eAnnotations/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Wire" abstract="true" eSuperTypes="#//NamedElement ../../fr.irisa.cairn.graph/model/graph.ecore#//IEdge">
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" lowerBound="1"
eType="#//Datapath"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" changeable="false"
defaultValueLiteral="1" unsettable="true" derived="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Port" abstract="true" eSuperTypes="#//NamedElement ../../fr.irisa.cairn.graph/model/graph.ecore#//IPort">
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" lowerBound="1"
eType="#//AbstractBlock" changeable="false" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Operator" abstract="true" eSuperTypes="#//DataFlowBlock">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="consistentBitwidth&#xD;&#xA;"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentBitwidth" value="self.width>0"/>
<details key="consistentPortNumber" value="self.in.size()=2 and self.out.size()=1 "/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="SubDatapath" eSuperTypes="#//Datapath"/>
<eClassifiers xsi:type="ecore:EClass" name="TestOp" eSuperTypes="#//Operator"/>
<eSubpackages name="port" nsURI="port" nsPrefix="port">
<eClassifiers xsi:type="ecore:EClass" name="InDataPort" eSuperTypes="#//port/InputPort">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="consistentBitwidth&#xD;&#xA;"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentBitwidth" value="self.sources.forall (w|w.width&lt;=self.width)"/>
</eAnnotations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="InputPort" abstract="true" eSuperTypes="#//Port">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
eType="#//Wire"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OutputPort" abstract="true" eSuperTypes="#//Port">
<eStructuralFeatures xsi:type="ecore:EReference" name="sinks" upperBound="-1"
eType="#//Wire"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OutDataPort" eSuperTypes="#//port/OutputPort"/>
<eClassifiers xsi:type="ecore:EClass" name="InControlPort" eSuperTypes="#//port/InputPort"/>
<eClassifiers xsi:type="ecore:EClass" name="OutControlPort" eSuperTypes="#//port/OutputPort"/>
</eSubpackages>
<eSubpackages name="wires" nsURI="wires" nsPrefix="wires">
<eClassifiers xsi:type="ecore:EClass" name="DataFlowWire" eSuperTypes="#//Wire">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="consistentInputPortType consistentOutputPortType"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="source" unique="false"
lowerBound="1" eType="#//port/OutDataPort"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sink" lowerBound="1"
eType="#//port/InDataPort"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ControlFlowWire" eSuperTypes="#//Wire">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value="consistentInputPortType consistentOutputPortType"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EReference" name="source" unique="false"
lowerBound="1" eType="#//port/OutControlPort"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="sink" lowerBound="1"
eType="#//port/InControlPort"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="storage" nsURI="storage" nsPrefix="storage">
<eClassifiers xsi:type="ecore:EClass" name="Register" eSuperTypes="#//ActivableBlock #//DataFlowBlock"/>
<eClassifiers xsi:type="ecore:EClass" name="CERegister" eSuperTypes="#//ActivableBlock #//DataFlowBlock"/>
<eClassifiers xsi:type="ecore:EClass" name="ShiftRegister" eSuperTypes="#//ActivableBlock #//DataFlowBlock"/>
</eSubpackages>
<eSubpackages name="operators" nsURI="operators" nsPrefix="operators">
<eClassifiers xsi:type="ecore:EEnum" name="UnaryOpcode">
<eLiterals name="sqrt"/>
<eLiterals name="inv" value="1"/>
<eLiterals name="neg" value="3"/>
<eLiterals name="not" value="4"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="UnaryOperator" eSuperTypes="#//Operator">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value=" consistentPortNumber"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentPortNumber" value="self.in.size()=2 and self.out.size()=1 "/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="opcode" lowerBound="1"
eType="#//operators/UnaryOpcode" defaultValueLiteral="&quot;add&quot;"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="BinaryOpcode">
<eLiterals name="add"/>
<eLiterals name="mul" value="1"/>
<eLiterals name="sub" value="3"/>
<eLiterals name="div" value="4"/>
<eLiterals name="mux" value="5"/>
<eLiterals name="shl" value="6"/>
<eLiterals name="shr" value="7"/>
<eLiterals name="xor" value="8"/>
<eLiterals name="and" value="9"/>
<eLiterals name="nand" value="10"/>
<eLiterals name="max" value="11"/>
<eLiterals name="min" value="12"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BinaryOperator" eSuperTypes="#//Operator">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value=" consistentPortNumber"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentPortNumber" value="self.in.size()=2 and self.out.size()=1 "/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="opcode" lowerBound="1"
eType="#//operators/BinaryOpcode" defaultValueLiteral="&quot;add&quot;"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="TernaryOpcode">
<eLiterals name="addc"/>
<eLiterals name="muladd" value="1"/>
<eLiterals name="subc" value="2"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="TernaryOperator" eSuperTypes="#//Operator">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value=" consistentPortNumber bitwidthConstraint"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentPortNumber" value="self.in.size()=3 and self.out.size()=1 "/>
<details key="bitwidthConstraint" value="self.in.forall(p | p.name='S' implies p.width=1)"/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="opcode" lowerBound="1"
eType="#//operators/TernaryOpcode" defaultValueLiteral="&quot;add&quot;"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ReductionOpcode">
<eLiterals name="prod"/>
<eLiterals name="sigma" value="1"/>
<eLiterals name="max" value="2"/>
<eLiterals name="min" value="3"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ConstantValue" eSuperTypes="#//DataFlowBlock">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataFlowMux" eSuperTypes="#//DataFlowBlock"/>
<eClassifiers xsi:type="ecore:EClass" name="ControlFlowMux" eSuperTypes="#//DataFlowBlock #//ActivableBlock"/>
<eClassifiers xsi:type="ecore:EClass" name="ReductionOperator" eSuperTypes="#//Operator">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore">
<details key="constraints" value=" consistentPortNumber"/>
</eAnnotations>
<eAnnotations source="http://www.eclipse.org/ocl/examples/OCL">
<details key="consistentPortNumber" value="self.in.size()=2 and self.out.size()=1 "/>
</eAnnotations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="opcode" lowerBound="1"
eType="#//operators/UnaryOpcode" defaultValueLiteral="&quot;add&quot;"/>
</eClassifiers>
</eSubpackages>
<eSubpackages name="pads" nsURI="pads" nsPrefix="pads">
<eClassifiers xsi:type="ecore:EClass" name="DataInputPad" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="parentPort" lowerBound="1"
eType="#//port/InDataPort" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="out" lowerBound="1" eType="#//port/OutDataPort"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DataOutputPad" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="parentPort" lowerBound="1"
eType="#//port/OutDataPort"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="in" lowerBound="1" eType="#//port/InDataPort"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ControlPad" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="parentPort" lowerBound="1"
eType="#//port/InControlPort"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="out" lowerBound="1" eType="#//port/OutControlPort"
containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StatusPad" eSuperTypes="#//AbstractBlock">
<eStructuralFeatures xsi:type="ecore:EReference" name="parentPort" lowerBound="1"
eType="#//port/OutControlPort"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="in" lowerBound="1" eType="#//port/InControlPort"
containment="true"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>

--------------060905020400050107010308--
Re: Empty properties view in editor when using a ecore model with subpackages [message #212137 is a reply to message #211975] Tue, 25 November 2008 18:05 Go to previous message
Eclipse UserFriend
Originally posted by: sderrienREMOVE.irisa.fr

I finally found a way to solve the problem.

For the records, here is a solution (there is certainly a better way to
handle this).

Assuming that we want to design a diagram editor for an ecore model
(called example) which contains one toplevel package (top) and two
subpackages (sub1, sub2).

The problem stems from the fact that the TopItemProvider class generated
in the example.edit plugin cannot find ItemProvider classes for classes
that do not belong to the top package.

The solution consist in hacking the TopItemProvider generated java code
so as to make the subpackages classes visible to the
ItemProviderAdapter. This can be done by modifying the code as follows :

1) Add a field to store the subpackages ItemProviderAdapter factories
and Modify the constructor as follows :

protected static AdapterFactoryImpl[] subPackageFactories;

/**
* This constructs an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public DatapathItemProviderAdapterFactory() {
supportedTypes.add(IEditingDomainItemProvider.class);
supportedTypes.add(IStructuredItemContentProvider.class);
supportedTypes.add(ITreeItemContentProvider.class);
supportedTypes.add(IItemLabelProvider.class);
supportedTypes.add(IItemPropertySource.class);

subPackageFactories = new AdapterFactoryImpl[] {
new Sub1ItemProviderAdapterFactory(),
new Sub2ItemProviderAdapterFactory()
};
}

2) modify the two following methods :

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isFactoryForType(Object type) {
boolean res = supportedTypes.contains(type)
|| super.isFactoryForType(type);

if (res) return true;

// search for AdapterFactory in subpackages
for (AdapterFactory factory : subPackageFactories) {
if (factory.isFactoryForType(type))
return true;
}
}
return false;
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public Adapter adapt(Notifier notifier, Object type) {
Adapter res= super.adapt(notifier, this);
if (res==null) {
for (AdapterFactoryImpl factory : subPackageFactories) {
res = factory.adapt(notifier, type);
if (res!=null) return res;
}
}
return res;
}

3) run your diagram editor, you should see the property view for all
your model objects.

Steven


Steven Derrien a écrit :

> Hello,
>
> As mentionned in the title, I am having problems with a GMF diagram
> editor which is based on a ecore model with subpackages (see attached
> file).
>
> Whenever I select in the editor an EditPart corresponding to a EClass of
> a subpackage, Its property view is always empty, this does not happen
> for EClass that are defined in the main (root) package.
>
> Any idea on how to solve this issue ?
>
> Thanks in advance,
>
> Steven
>
>
>
>
Previous Topic:Label with Feature Seq Initializer via OCL
Next Topic:adding properties to a connection(edge)
Goto Forum:
  


Current Time: Sat Apr 27 00:54:40 GMT 2024

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

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

Back to the top