Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Alternative types of top node elements
Alternative types of top node elements [message #189965] Thu, 29 May 2008 05:33 Go to next message
Eclipse UserFriend
Hi there,

I want to do something very simple:

I have two objects in my domain model: A State and a CompartmentState,
where the CompartmentState extends the State. Now the CompartmentState
aggregates States in a "myStates" relation, hence it can contain States
and CompartmentStates recursively, modeling hierarchy.

The diagram extends CompartmentState, hence it can contain both types.

How do I set this up correctly in the mapping?

1. I cannot create two TopNodeReference for both State and
CompositeState, because I have only one aggregation "myStates". Hence I
get an error message if I choose the same Containment Feature:
"Phantom nodes that are not targeted by a link mapping exist".

2. I cannot create a single TopNodeReference to State (which gets
extended by CompartmentState), because only the latter has a Child
Reference to "myStates".

3. Next try would be to create a second aggregation from
CompartmentState to CompartmentState recursively to get two distinct
aggregations, but this is not exactly what I want...

How to do it?

Cheers,
Hauke
Re: Alternative types of top node elements [message #190050 is a reply to message #189965] Thu, 29 May 2008 07:57 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hauke,

> 1. I cannot create two TopNodeReference for both State and
This is a correct way to solve this problem - you can create two TopNodeReferences
with the same containment feature specified and different NodeMappings inside.

> "Phantom nodes that are not targeted by a link mapping exist".
This error should be visible only if you have TopNodeReference without containment
feature specified.

-----------------
Alex Shatalin
Re: Alternative types of top node elements [message #190375 is a reply to message #190050] Sat, 31 May 2008 08:39 Go to previous messageGo to next message
Eclipse UserFriend
Alex Shatalin wrote:
>> 1. I cannot create two TopNodeReference for both State and
> This is a correct way to solve this problem - you can create two
> TopNodeReferences with the same containment feature specified and
> different NodeMappings inside.

Hey Alex, thanks, works now on the diagram level. Unfortunately within
the Compartment I can only add States but not CompositeStates although I
think I got the mapping right:

Mapping
- Top Node Reference <node:ComppositeState/CompositeState>
- - Node Mapping <CompositeState/CompositeState>
- - - Feature Label Mapping false
- - - Child Reference <nodes:State/Node>
- - - - Node Mapping <State/Node>
- - - - - Feature Label Mapping false
- - - Child Reference <nodes:CompositeState/CompositeState>
- - - - Node Mapping <CompositeState/CompositeState>
- - - - - Feature Label Mapping false
- - - Compartment Mapping <CompositeStateCompartment>
-> Children: both prev defined Child References
- Top Node Reference <nodes:State/Node>
- - Node Mapping <State/Node>
- - - Feature Label Mapping false
....

Adding a CompartmentState to a CompartmentState gives the following
exception which I cannot decipher...

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:399)
at
org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(Abs tractTool.java:411)
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 :1064)
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 :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1145)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3335)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2982)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2392)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2356)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 22)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:474)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:469)
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:193)
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:362)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 564)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1251)
at org.eclipse.equinox.launcher.Main.main(Main.java:1227)


Caused by: org.eclipse.jface.util.Assert$AssertionFailedException: null
argument;failed to create a view
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:153)
at
org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.do ExecuteWithResult(CreateCommand.java:99)
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:157)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:403)
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:403)
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:403)
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
Re: Alternative types of top node elements [message #190510 is a reply to message #190375] Mon, 02 June 2008 07:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hauke,

> Hey Alex, thanks, works now on the diagram level. Unfortunately within
> the Compartment I can only add States but not CompositeStates although
Do you have corresponding constraints specified in mapping file? Something
like "not self.oclIsTypeOf(CompartmentState)" for AState mappings.

-----------------
Alex Shatalin
Re: Alternative types of top node elements [message #190868 is a reply to message #190510] Wed, 04 June 2008 03:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

>> Hey Alex, thanks, works now on the diagram level. Unfortunately within
>> the Compartment I can only add States but not CompositeStates although
> Do you have corresponding constraints specified in mapping file?
> Something like "not self.oclIsTypeOf(CompartmentState)" for AState
> mappings.

No, there are no constraints at all. That's why I'm a bit confused about
it here...

Hauke
Re: Alternative types of top node elements [message #190963 is a reply to message #190868] Wed, 04 June 2008 08:46 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hauke,

> No, there are no constraints at all. That's why I'm a bit confused
> about it here...
So, I suggest you to add these constraints - GMF can mistakenly recognize
CompartmentState as a State (it actually is instance of State...) So, I suggest
you to prevent framework from doing it by addition proper constraint (see
my prev. message).

-----------------
Alex Shatalin
Re: Alternative types of top node elements [message #191106 is a reply to message #190963] Wed, 04 June 2008 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex, thanks a lot for your hints so far!

Alex Shatalin wrote:
>>> Do you have corresponding constraints specified in mapping file?
>>> Something like "not self.oclIsTypeOf(CompartmentState)" for
>>> AState mappings.
>> No, there are no constraints at all. That's why I'm a bit confused
>> about it here...
> So, I suggest you to add these constraints - GMF can mistakenly
> recognize CompartmentState as a State (it actually is instance of
> State...) So, I suggest you to prevent framework from doing it by
> addition proper constraint (see my prev. message).

ah, okay, got what you meant. I added that ocl constraint and: Yes, I
now can add as many hierarchichal CompositeStates as I want recursively
into each other. Yipiie!
BUT: Now I cannot add a simple "State" anymore, neither to the root
element nor to a CompositeState. I get same exception for the States now
as I got for CompositeStates before. Anything else I need to constrain?

Cheers,
Hauke
Re: Alternative types of top node elements [message #191255 is a reply to message #191106] Thu, 05 June 2008 13:07 Go to previous messageGo to next message
Eclipse UserFriend
Hello Hauke,

It's ratehr strange - looks like incorrect OCL constraint.. Can you debug
generated ???VisualIDRegistry to see why corresponding condition was not
satisfied for simple "State"?

-----------------
Alex Shatalin
Re: Alternative types of top node elements [message #191590 is a reply to message #191255] Mon, 09 June 2008 03:58 Go to previous message
Eclipse UserFriend
Alex Shatalin wrote:
> It's ratehr strange - looks like incorrect OCL constraint.. Can you
> debug generated ???VisualIDRegistry to see why corresponding condition
> was not satisfied for simple "State"?

Hi Alex,

works now: debugged it and found some syntax error in the OCL
expression. With the correct expression it works now perfectly. Thanks a
lot for your time and help!

Cheers,
Hauke
Previous Topic:Tutorial using EMF and GMF
Next Topic:Multiple palettes in a single editor
Goto Forum:
  


Current Time: Mon May 12 05:31:51 EDT 2025

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

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

Back to the top