Multiple editors editor for contained model elements [message #221245] |
Wed, 11 March 2009 15:06 |
Andreas Schoeneck 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--
|
|
|
|
Powered by
FUDForum. Page generated in 0.03499 seconds