Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Navigate between different diagrams
Navigate between different diagrams [message #65400] Wed, 18 October 2006 15:48 Go to next message
Jacques LESCOT is currently offline Jacques LESCOTFriend
Messages: 247
Registered: July 2009
Senior Member
Hi,

My problem consist of navigating between different diagrams of different
types. I have a metamodel that I can edit through two diagram types
(System Diagram and Automaton Diagram).
Here is an overview of a way to associate those diagrams with objects of
my model.

Model View --> AssociatedDiagrams
-------------------------------------------
System --> SystemDiagram (the root diagram)
-- SubSystem --> SystemDiagram
-- Automaton --> AutomatonDiagram

To implement that, I have generated two graphical editors. One that is
used to edit a System (through a System Diagram), and another to edit an
Automaton (through an Automaton Diagram). To link these two editors, in
the gmfmap model of my System Diagram editor, I have set the "Related
Diagrams" property of an "Automaton" to the Canvas Mapping associated
with the gmfmap model of my Automaton Diagram editor (I expect this is
clear until this point !).
Then I need to change by hand the OpenDiagramEditPolicy class that was
generated to return the DiagramKind and EditorID depending on the
selected element (System or Automaton). Things are OK when I try to
create a System Diagram for my Subsystem (in the above overview), but I
can not associate an Automaton Diagram to my Automaton. The following
Error appears :

org.eclipse.core.runtime.CoreException: ERROR
at
org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.createPartControl(DiagramDocumentEditor. java:1458)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:596)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
at
org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2571)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2504)
at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2496)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2481)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2476)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2453)
at
org.topcased.gmf.sam.system.diagram.edit.policies.OpenDiagra mEditPolicy$OpenDiagramCommand.doExecuteWithResult(OpenDiagr amEditPolicy.java:104)
at
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doExecute(AbstractTransactionalCommand.ja va:245)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:127)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:509)
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.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.performRequest(GraphicalEditPart.java:1061)
at
org.eclipse.gef.tools.SelectEditPartTracker.performOpen(Sele ctEditPartTracker.java:187)

Is it possible to associate a different diagram type ? If yes, what have
I missed ?

Regards,

--
Jacques
Re: Navigate between different diagrams [message #65810 is a reply to message #65400] Thu, 19 October 2006 17:20 Go to previous messageGo to next message
Artem Tikhomirov is currently offline Artem TikhomirovFriend
Messages: 222
Registered: July 2009
Senior Member
Could you please file a bug? Looks like Editor of AutomationDiagram is
missing doSetInput method implementation similar to one at SystemDiagram
Editor.

Artem.

"Jacques LESCOT" <jacques.lescot@anyware-tech.com> wrote in message
news:eh5ic4$2de$1@utils.eclipse.org...
> Hi,
>
> My problem consist of navigating between different diagrams of different
> types. I have a metamodel that I can edit through two diagram types
> (System Diagram and Automaton Diagram).
> Here is an overview of a way to associate those diagrams with objects of
> my model.
>
> Model View --> AssociatedDiagrams
> -------------------------------------------
> System --> SystemDiagram (the root diagram)
> -- SubSystem --> SystemDiagram
> -- Automaton --> AutomatonDiagram
>
> To implement that, I have generated two graphical editors. One that is
> used to edit a System (through a System Diagram), and another to edit an
> Automaton (through an Automaton Diagram). To link these two editors, in
> the gmfmap model of my System Diagram editor, I have set the "Related
> Diagrams" property of an "Automaton" to the Canvas Mapping associated with
> the gmfmap model of my Automaton Diagram editor (I expect this is clear
> until this point !).
> Then I need to change by hand the OpenDiagramEditPolicy class that was
> generated to return the DiagramKind and EditorID depending on the selected
> element (System or Automaton). Things are OK when I try to create a System
> Diagram for my Subsystem (in the above overview), but I can not associate
> an Automaton Diagram to my Automaton. The following Error appears :
>
> org.eclipse.core.runtime.CoreException: ERROR
> at
> org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.Di agramDocumentEditor.createPartControl(DiagramDocumentEditor. java:1458)
> at
> org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:596)
> at
> org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:372)
> at
> org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:566)
> at
> org.eclipse.ui.internal.EditorReference.getEditor(EditorRefe rence.java:214)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2571)
> at
> org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2504)
> at
> org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPag e.java:2496)
> at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.ja va:2481)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2476)
> at
> org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2453)
> at
> org.topcased.gmf.sam.system.diagram.edit.policies.OpenDiagra mEditPolicy$OpenDiagramCommand.doExecuteWithResult(OpenDiagr amEditPolicy.java:104)
> at
> org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doExecute(AbstractTransactionalCommand.ja va:245)
> at
> org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:127)
> at
> org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:509)
> 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.gmf.runtime.diagram.ui.editparts.GraphicalEditPa rt.performRequest(GraphicalEditPart.java:1061)
> at
> org.eclipse.gef.tools.SelectEditPartTracker.performOpen(Sele ctEditPartTracker.java:187)
>
> Is it possible to associate a different diagram type ? If yes, what have I
> missed ?
>
> Regards,
>
> --
> Jacques
Re: Navigate between different diagrams [message #66057 is a reply to message #65810] Fri, 20 October 2006 06:41 Go to previous messageGo to next message
Jacques LESCOT is currently offline Jacques LESCOTFriend
Messages: 247
Registered: July 2009
Senior Member
Hi Artem,

that exactly the source of my problem ! When I add this method by hand,
everything works fine and this is a really good point for me ! :-)

I open the following bug :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=161687

Thanks again

--
Jacques

Artem Tikhomirov a écrit :
> Could you please file a bug? Looks like Editor of AutomationDiagram is
> missing doSetInput method implementation similar to one at SystemDiagram
> Editor.
>
> Artem.
Re: Navigate between different diagrams [message #66757 is a reply to message #65400] Sat, 21 October 2006 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hello,

I did, what is mentioned in
http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy
(Basic support for diagram partitioning)

The OpenDiagramEditPolicy is generated and i'm able to call the
getOpenCommand() method:

protected Command getOpenCommand(Request request) {
EditPart targetEditPart = getTargetEditPart(request);
if (false == targetEditPart.getModel() instanceof View) {
return null;
}
EAnnotation ann = ((View) targetEditPart.getModel())
.getEAnnotation("uri://eclipse.org/gmf/openDiagramPolicy");
if (ann == null) {
return null;
}
return new ICommandProxy(new OpenDiagramCommand(ann));
}

There is no Annotation in my model, so nothing happens here. I tried to
add an Annotation to my model, but my EMF Book doesn't seem to provide
me with the infomation I need. So i got stuck right here.

Could you provide me with some hints or even some source files?

Best regards
Jan

Jacques LESCOT schrieb:
> Hi,
>
> My problem consist of navigating between different diagrams of different
> types. I have a metamodel that I can edit through two diagram types
> (System Diagram and Automaton Diagram).
> Here is an overview of a way to associate those diagrams with objects of
> my model.
> ...
>
> Regards,
>
Re: Navigate between different diagrams [message #67567 is a reply to message #66757] Mon, 23 October 2006 09:57 Go to previous messageGo to next message
Jacques LESCOT is currently offline Jacques LESCOTFriend
Messages: 247
Registered: July 2009
Senior Member
Hi Jan,

The Annotation is created in the xxx.xx_diagram file. In the
XXXViewFactory class of the model object that you have associated with a
diagram, the Annotation should be created.

protected void decorateView(...)
{
....
EAnnotation diagramFacet = EcoreFactory.eINSTANCE.createEAnnotation();
diagramFacet.setSource("uri://eclipse.org/gmf/openDiagramPolicy");
view.getEAnnotations().add(diagramFacet);
....
}

Is it the case ?

--
Jacques


Jan Herriger a écrit :
> Hello,
>
> I did, what is mentioned in
> http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy
> (Basic support for diagram partitioning)
>
> The OpenDiagramEditPolicy is generated and i'm able to call the
> getOpenCommand() method:
>
> protected Command getOpenCommand(Request request) {
> EditPart targetEditPart = getTargetEditPart(request);
> if (false == targetEditPart.getModel() instanceof View) {
> return null;
> }
> EAnnotation ann = ((View) targetEditPart.getModel())
> .getEAnnotation("uri://eclipse.org/gmf/openDiagramPolicy");
> if (ann == null) {
> return null;
> }
> return new ICommandProxy(new OpenDiagramCommand(ann));
> }
>
> There is no Annotation in my model, so nothing happens here. I tried to
> add an Annotation to my model, but my EMF Book doesn't seem to provide
> me with the infomation I need. So i got stuck right here.
>
> Could you provide me with some hints or even some source files?
>
> Best regards
> Jan
>
> Jacques LESCOT schrieb:
>> Hi,
>>
>> My problem consist of navigating between different diagrams of
>> different types. I have a metamodel that I can edit through two
>> diagram types (System Diagram and Automaton Diagram).
>> Here is an overview of a way to associate those diagrams with objects
>> of my model.
>> ...
>>
>> Regards,
Re: Navigate between different diagrams [message #69080 is a reply to message #67567] Wed, 25 October 2006 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hi Jacques,

it works now. Actually I don't know what the problem was ;-)

The next tasks are to synchronize all opened editors instantly and to
avoid multiple opened windows of the same diagram instance.

Best regards
Jan

Jacques LESCOT schrieb:
> Hi Jan,
>
> The Annotation is created in the xxx.xx_diagram file. In the
> XXXViewFactory class of the model object that you have associated with a
> diagram, the Annotation should be created.
>
> protected void decorateView(...)
> {
> ...
> EAnnotation diagramFacet = EcoreFactory.eINSTANCE.createEAnnotation();
> diagramFacet.setSource("uri://eclipse.org/gmf/openDiagramPolicy");
> view.getEAnnotations().add(diagramFacet);
> ...
> }
>
> Is it the case ?
>
> --
> Jacques
>
>
> Jan Herriger a écrit :
>> Hello,
>>
>> I did, what is mentioned in
>> http://wiki.eclipse.org/index.php/GMF_New_and_Noteworthy
>> (Basic support for diagram partitioning)
>>
>> The OpenDiagramEditPolicy is generated and i'm able to call the
>> getOpenCommand() method:
>>
>> protected Command getOpenCommand(Request request) {
>> EditPart targetEditPart = getTargetEditPart(request);
>> if (false == targetEditPart.getModel() instanceof View) {
>> return null;
>> }
>> EAnnotation ann = ((View) targetEditPart.getModel())
>> .getEAnnotation("uri://eclipse.org/gmf/openDiagramPolicy");
>> if (ann == null) {
>> return null;
>> }
>> return new ICommandProxy(new OpenDiagramCommand(ann));
>> }
>>
>> There is no Annotation in my model, so nothing happens here. I tried
>> to add an Annotation to my model, but my EMF Book doesn't seem to
>> provide me with the infomation I need. So i got stuck right here.
>>
>> Could you provide me with some hints or even some source files?
>>
>> Best regards
>> Jan
>>
>> Jacques LESCOT schrieb:
>>> Hi,
>>>
>>> My problem consist of navigating between different diagrams of
>>> different types. I have a metamodel that I can edit through two
>>> diagram types (System Diagram and Automaton Diagram).
>>> Here is an overview of a way to associate those diagrams with objects
>>> of my model.
>>> ...
>>>
>>> Regards,
Re: Navigate between different diagrams [message #69554 is a reply to message #69080] Wed, 25 October 2006 20:01 Go to previous message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hello again,

is there a way to announce model changes to other opened diagrams
(without reopening)? I know, this topic has been discussed a lot, but
the only solution I found was to modify the generated code... but what
code? I had some Ideas im mind, but actually they didn't help on.

Best regards
Jan
Previous Topic:How to "Group" and "Un-Group" nodes
Next Topic:Navigation view in gmf rcp lite
Goto Forum:
  


Current Time: Wed Jul 17 15:16:46 GMT 2024

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

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

Back to the top