Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Multiple editors editor for contained model elements
Multiple editors editor for contained model elements [message #221245] Wed, 11 March 2009 15:06 Go to next message
Andreas Schoeneck is currently offline Andreas SchoeneckFriend
Messages: 22
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------050306030202020605030106
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Hi there!

I am currently working on an editor, evaluating whether or not I can use
GMF to build it (or at least huge parts of it).

The model is like:

+ Container
-> Structure ( -- refers to Structure's editor)
-> Graph ( -- refers to child editor)
-> Node
-> Edge

where a Container can contain multiple Structures and a Structure
contains at least two distinct Graphs.

What I want to accomplish now is to have subeditors for each Structure
instance. I read the newsgroup as well as the regarding site on GMF
wiki, so I think perhaps I would get this managed.

Before I can do this I have to find out whether it is possible to build
up an editor for the Structures as follows:

The Structure editor should contain (at least two) panes representing
the editors for the contained graphs. I tried to achieve this by
creating another plugin that uses the created plugin and instantiates
(for now) two editors on a SashForm, code's like this (in an editor
derived from EditorPart):

public void createPartControl(Composite parent) {

rootSash = new SashForm(parent, SWT.HORIZONTAL);

editor1.createPartControl(rootSash);
editor2.createPartControl(rootSash);
}

public void init(IEditorSite site, IEditorInput editorInput)
throws PartInitException {

setSite(site);
setInput(editorInput);

editor1.init(site, editorInput);
editor2.init(site, editorInput);
}

public boolean isDirty() {
return editor1.isDirty() || editor2.isDirty();
}

public void setFocus() {
editor1.setFocus();
// what to do here?
}

Since the editors are synchronized all the time doSave/doSaveAs simply
invoke the doSave/doSaveAs methods of editor1.

As you can see both child editors take the same input what leads me to
the first problem: How to give them different inputs? Is this possible
withing a GMF structure (since I want a subeditor)?

Another problem is that upon context menu invocation an exception is
thrown. The context menu does not show all the elements (it is missing
3D-figures etc.). Also, there is no element (Node in this case) creation
tooltip on the canvas of either editors and there are exceptions over
exceptions thrown when clicking on other views (e.g. ErrorLog). What
must be done to take back the whole GMF functionality to the embedded
editors?

I tried the same thing using MultiEditor and some context menu
acrobatics. In this solution the second editor had full functionality
for some reasons...the first one hadn't.

Supposed I got rid of all the problems, there will be some requirements
remaining:

1. Since all the child editors contain the same elements there shall be
only one palette. Can I reuse the generated code for the Structure's
editor and remove the palettes from the child editors? Which superclass
do I have to use for the Structure's editor (that is compatible with
SashForm)?

2. There shall be one palette tool that is able to map elements between
the different Graphs: You select this tool, click on a node in the first
child editor and on a node in the second child editor and they get the
same color for example. Can I achieve this when having embedded GMF
editors (focus problems, whatever)?

3. Each Structure has to have at least two Graphs. Do I instantiate the
required ones by using a Feature Seq Initializer?

4. After all this said and done, can I use this Structure's editor as a
subeditor to a Container's editor?

Any answer to any question is very much appreciated. Also, different
solutions (like having *special* compartments for Graphs that behave
like Sash) are welcome.

Thanks for reading and thanks in advance for answering. I will keep you
up if I find out more on some point of interest.

I'm afraid that I can't use GMF at all finally (perhaps at least
generate figures ;-) ).

Regards
Andy

--------------050306030202020605030106
Content-Type: text/x-vcard; charset=utf-8;
name="as_maps.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="as_maps.vcf"

begin:vcard
fn:Andreas Schoeneck
n:Schoeneck;Andreas
email;internet:as.maps@gmail.com
x-mozilla-html:FALSE
version:2.1
end:vcard


--------------050306030202020605030106--
Re: Multiple editors editor for contained model elements [message #221298 is a reply to message #221245] Thu, 12 March 2009 14:36 Go to previous message
Andreas Schoeneck is currently offline Andreas SchoeneckFriend
Messages: 22
Registered: July 2009
Junior Member
Hi!

So, what I achieved to now is the following:

1. Got the second editor to load a different file (by just creating the
appropriate input in init)
2. Have both editors use one common palette with which you can drag model
elements to both the editors (by manipulating gen'd code to call the super
constructor with false to not create any palettes and write my own little
provider that calls the gen'd PaletteFactory.fillPalette method - this is
still no flyout palette and just placed on the SashForm...)

So the main difficulty lies in preserving all the GMF features in each
embedded editor. As said before there is an exception thrown upon context
menu invocation.
Error log shows 'error building context menu', here are some lines from
the exception stack trace
java.lang.NullPointerException
at
org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy.get ConstraintFor(ConstrainedLayoutEditPolicy.java:204)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEdit Policy.getConstraintFor(XYLayoutEditPolicy.java:336)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEdit Policy.getCreateCommand(XYLayoutEditPolicy.java:256)
at
org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEdit Policy.getCommand(XYLayoutEditPolicy.java:321)
at
org.eclipse.gef.editparts.AbstractEditPart.getCommand(Abstra ctEditPart.java:470)
[..]

after having tried to let the context menu pop up every single click on
the editor triggers an exception involving (\w*)LayoutEditPolicies as
well. The edit submenu of the context menu doesn't show undo/redo and
cut/copy/paste are disabled. Similar are the other submenus. Upon
selecting "Arrange All" I simply get a message box popping up saying
'null' (must be extensive information prevention ;-) ). I can't delete any
elements either.

Since I have no idea how to fix up the things any single hint or idea or
whatever (telling me: man, start it from scratch with GEF, you need too
many customizations) is appreciated. If you want me to provide more
information please ask for it.

Atm my evaluation is that GMF cannot be used for creating an editor with
posted requirements.

Regards,
Andy
Previous Topic:Changes via PropertySheet and undo/redo
Next Topic:How to install latest stable build of GMF?
Goto Forum:
  


Current Time: Fri Feb 26 19:28:39 GMT 2021

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

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

Back to the top