Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram root element
Diagram root element [message #138381] Thu, 21 June 2007 10:50 Go to next message
Eclipse UserFriend
Hi all,

is have the following case - after the diagram generation i got among all
classes one that do not compile - xx.diagram.part.xxDiagramEditorPart.java
The cause is the following method:

private static DocumentRoot createDocumentRoot(DocumentRoot model) {
DocumentRoot docRoot = ScaFactory.eINSTANCE.createDocumentRoot();

docRoot.setDocumentRoot(model); // FIXME name of the set method is pure
guess
return docRoot;
}

FIXME is also generated, and DocumentRoot has for sure no setter method
for DocumentRoot itself...

I wrote in the dev group, assuming this is a bug, but got the reply, that
I should not use DocumentRoot as diagram root element, but some model
element.

The question is - what should I do now - the DocumentRoot seems as a model
element (appears in the .ecore model as element) and is the only object
that contains the elements I wish to display in the diagram? The model can
not be modified - it is generated form public XSDs...

Best regards,
Krasi
Re: Diagram root element [message #139660 is a reply to message #138381] Tue, 26 June 2007 15:39 Go to previous messageGo to next message
Eclipse UserFriend
Hello Krassimir,

File a request to support diagram visualizing document root itself + try
to modify generated code by hands to support this situation.

-----------------
Alex Shatalin
Re: Diagram root element [message #140830 is a reply to message #139660] Mon, 02 July 2007 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex, thanks for the reply - I have modified a little bit the generated
code, as you suggested, it seems to work just fine :)
Re: Diagram root element [message #141131 is a reply to message #140830] Tue, 03 July 2007 15:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: yburd.andrew.cmu.edu

Krassmir, can you share the solution in the group since I have the same
problem.

Thanks!

"Krassimir Kondarev" <krassimir.kondarev@sap.com> wrote in message
news:0283aa4db15c7ee21cc7a125163575ec$1@www.eclipse.org...
> Hi Alex, thanks for the reply - I have modified a little bit the generated
> code, as you suggested, it seems to work just fine :)
>
Re: Diagram root element [message #141533 is a reply to message #141131] Thu, 05 July 2007 09:27 Go to previous messageGo to next message
Eclipse UserFriend
Sure!
In my specific case the ecore model is generated from multiple XSDs and
there are some strange restrictions - I had to update the
createDocumentRoot method in xxx.parts.xxxDiagramEditorUtil - from the
generated state:

private static DocumentRoot createDocumentRoot(DocumentRoot model) {
DocumentRoot docRoot = ScaFactory.eINSTANCE.createDocumentRoot();
docRoot.setDocumentRoot(model); // THIS LINE DID NOT EVEN COMPILE
return docRoot;
}

to something more meaningful:

private static DocumentRoot createDocumentRoot(DocumentRoot model) {
Composite composite = ScaFactory.eINSTANCE.createComposite();
model.setComposite(composite);
return model;
}

In general you have to satisfy the model constraints, nothing more...

Cheers,
Krasi
Re: Diagram root element [message #144901 is a reply to message #141533] Tue, 31 July 2007 03:45 Go to previous message
Eclipse UserFriend
Hi Krassimir,

I work also on SCA. I'm developing a designer to define assemblies and
like you I also modified the createDocumentRoot method.

However, I have another problem. This problem appears with elements
which include a substitution group attribute.
The generation of the ecore model is correct. Any element declaration
that is the head of a substitution group produces a feature map in the
Eclass corresponding to any referencing elements. In addition to the
normal EReference in the corresponding EClass, a feature map EAttribute
is created. The name of the FeatureMap EAttribute is the same as the
name of the element's corresponding EReference with the string "group"
appended. The element's corresponding Ereference is derived from the
FeatureMap... Everything is all right.

When I use the EMF editor everything is ok. But when I use my GMF editor
I can't add elements of this type. For example, I can add a
JavaImplementation (the head of the substitution group is
Implementation) to a Component in the EMF editor but I can't do it in
the GMF editor. The following exception is launched:

org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:205)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:168)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:155)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTo ol.java:388)
at
org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(Abs tractTool.java:400)
at
org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.perfor mCreation(CreationTool.java:133)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTo ol.java:178)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1053)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:259)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainEventDispatcher.java:374)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.java:538)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:206)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Caused by: java.lang.IllegalArgumentException: The feature
'implementation' is not a valid changeable feature
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1081)
at org.osoa.xmlns.sca._1.impl.ComponentImpl.eSet(ComponentImpl. java:533)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
at
org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.create(EMF CoreUtil.java:84)
at
org.eclipse.gmf.runtime.emf.type.core.commands.CreateElement Command.doDefaultElementCreation(CreateElementCommand.java:1 27)
at
org.eclipse.gmf.runtime.emf.type.core.commands.CreateElement Command.doExecuteWithResult(CreateElementCommand.java:73)
at
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doExecute(AbstractTransactionalCommand.ja va:246)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:137)
at
org.eclipse.gmf.runtime.diagram.ui.commands.SemanticCreateCo mmand.doExecuteWithResult(SemanticCreateCommand.java:70)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:134)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:406)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:134)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:406)
at
org.eclipse.gmf.runtime.common.core.command.AbstractCommand. execute(AbstractCommand.java:134)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
.... 37 more

I changed the property of the "implementation" attribute to modifiable
but XML documents are serialized using xsi:type attributes... I know
that this is not the good solution ;)

Do you know this problem? Do you have any idea of how to solve it?

Thank you and best regards.

Stéphane Drapeau
Obeo


Krassimir Kondarev a écrit :
> Sure!
> In my specific case the ecore model is generated from multiple XSDs and
> there are some strange restrictions - I had to update the
> createDocumentRoot method in xxx.parts.xxxDiagramEditorUtil - from the
> generated state:
>
> private static DocumentRoot createDocumentRoot(DocumentRoot model) {
> DocumentRoot docRoot = ScaFactory.eINSTANCE.createDocumentRoot();
> docRoot.setDocumentRoot(model); // THIS LINE DID NOT EVEN COMPILE
> return docRoot;
> }
>
> to something more meaningful:
>
> private static DocumentRoot createDocumentRoot(DocumentRoot model) {
> Composite composite = ScaFactory.eINSTANCE.createComposite();
> model.setComposite(composite);
> return model;
> }
>
> In general you have to satisfy the model constraints, nothing more...
>
> Cheers,
> Krasi
>
Previous Topic:Load and open a diagram editor from the xml file
Next Topic:Puprose of EditHelper and EditHelperAdvice ?
Goto Forum:
  


Current Time: Sun Jul 27 15:52:22 EDT 2025

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

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

Back to the top