Combining EMF- and GMF-generated Editor.How do I pass selections between them? [message #45578] |
Tue, 12 September 2006 02:58  |
Eclipse User |
|
|
|
Hi
as I posted in :
http://www.eclipse.org/newsportal/article.php?id=622&gro up=eclipse.modeling.gmf#622
I want to use both editors (emf generated + gmf generated) together with
the same underlying model. I generated both of them and they work perfect
on their own. each editor writes his own files and can open an dedit
themŽ. The only difference between these two generated editors is that the
gmf-editor uses only a part (subtree) of the model, the emf-generated uses
the whole model.
I managed to hook a double-click-action to the emf-editor, so that i get
the rootobject of the subtree when I double-click it in the treeview of
the emf-editor. code follows:
private void hookDoubleClickAction() {
final Action doubleClickAction;
doubleClickAction = new Action() {
public void run() {
ISelection selection = selectionViewer.getSelection();
if(((IStructuredSelection)selection).getFirstElement() instanceof
DelegatingWrapperItemProvider){
DelegatingWrapperItemProvider obj =
(DelegatingWrapperItemProvider)((IStructuredSelection)select ion).getFirstElement();
Object value = obj.getValue();
if(value instanceof SequenceType){
//TODO add functionality here to open clicked Sequence in graphical
editor.
}//if
}//if
}//run()
};
My Question is, how to get this selection into the graphical-gmf-editor? I
tried to use methods in the generated ??InitDiagramFileAction.java of the
gmf-editor, but I didn't manage to open the gmf-editor with the selection
of the emf-editor. The other thing is, the emf-editor wraps the treeItems
with a DelegatingWrapperItemProvider. The EObjects of the model are only
the values of the wrapperobjects. I think the gmf-editor cannot understand
a selection of wrapperobjects, so I need to unwrap the EObjects first?
In ??InitDiagramFileAction the gmf-editor allways wants to use fileInput
and not a stream or selection. Are there any other input-possibilities for
editors?
My second Question is: do I need the editingDomain from the emf-editor to
put to the gmf-editor or do I need a special editingDomain for the
gmf-editor? I think they should be the same, as the editingDomain tracks
changes in the underlying model, right??
Does anyone have any idea how to manage the connection of the two
generated editors?? I am allready too blind to see any new possibilities,
cause i worked to long on this.
Any help appreciated!!
Many thanks in advance
Alex
|
|
|
|
Error after update gmf-build [message #46072 is a reply to message #45921] |
Tue, 12 September 2006 08:11   |
Eclipse User |
|
|
|
Thanks alex for your post,
I tried to update the gmf-build, and regenerate ma diagrammodelcode, but
all I got was two errors (stack follows).
error 1
--------------------------
eclipse.buildId=M20060629-1905
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86
Error
Tue Sep 12 14:06:48 CEST 2006
org/eclipse/gmf/internal/common/migrate/ModelLoadHelper
java.lang.NoClassDefFoundError:
org/eclipse/gmf/internal/common/migrate/ModelLoadHelper
at
org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTempla tesAction.loadGenModel(ExecuteTemplatesAction.java:176)
at
org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTempla tesAction.run(ExecuteTemplatesAction.java:67)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:254)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:539)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:400)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
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.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
---------------------------
error2
---------------------------
eclipse.buildId=M20060629-1905
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86
Error
Tue Sep 12 14:06:48 CEST 2006
Unhandled event loop exception
I don't know what to do, have I done something wrong with the update or
what is this error?
Please help
Thanks Alex
|
|
|
|
|
|
|
|
|
|
|
Re: GMF-Editor will open, but there are no initial contents in it! [message #48889 is a reply to message #48742] |
Fri, 15 September 2006 07:05  |
Eclipse User |
|
|
|
Hello Dmitry,
> - What if my diagram is not "synchronized"; I mean canonical edit
> policy is disabled and I handle notation model updates by myself. It
> could be a requirement to edit graphical presentation independently
> (to some extent of course ))) ).
In this case generated ??NewDiagramFileWizard will contain additional method
performing diagram content initialization. This method will be called just
after new diagram creation.
> - We support design only diagrams (editor without domain model); see
> org.eclipse.gmf.examples.design2d; what if I'd like to provide some
> initial content there?
The same method (initDiagramContents) could be generated for pure design
diagrams with empty body. Then users will be able to perform diagram initialization
by adding “@generated NOT” and specifying the body for this method. If this
sounds useful you can submit corresponding request.
-----------------
Alex Shatalin
|
|
|
Powered by
FUDForum. Page generated in 0.06329 seconds