Home » Modeling » GMF (Graphical Modeling Framework) » GMF Diagram without Resource?
| | | | | | | |
| Re: GMF Diagram without Resource? [message #516025 is a reply to message #515959] |
Mon, 22 February 2010 09:04   |
Ali Koudri Messages: 118 Registered: July 2009 |
Senior Member |
|
|
You welcome,
It seems like we are trying to make the same thing with GMF. I am
combining GMF with CNF to make multi-views modeler (see
http://vimeo.com/8928764). If this the case, maybe we can share our
experience. I have solved many of my issues but it remains lot of issues
I did not solved. I have posted several questions and had no answers, so
I spent hours at debugging to solve my problems. Indeed, I had to modify
the regular GMF flow, and a big part of the resulting flow is automated
through modified xpand templates.
Regards,
Ali.
Le 22/02/2010 11:59, Giovanni a écrit :
> HI Ali,
>
> thank you very much, I really appreciate your help.
>
>
> Regards,
>
> Giovanni.
|
|
|
| Re: GMF Diagram without Resource? [message #516060 is a reply to message #516025] |
Mon, 22 February 2010 11:02   |
Giovanni De Sossi Messages: 161 Registered: October 2009 Location: Rome, Italy |
Senior Member |

|
|
Ali,
I've seen your video: very good job, very interesting, especially your use of xPand templates, which I don't know.
My needs are simpler than yours; I'm just trying to show in a Model Navigator (CNF based, of course) ONLY my model objects, not annoying Diagram, Shape, Node and so on, which are provided in the GMF-generated Project Explorer. Especially I don't want to display files.
My Model Navigator shows a statical and hierarchical folder structure, initially empty; then, I generate my model on-the-fly, using only standard EMF methods (XYZFactory.eINSTANCE.createXyz(), etc.) invoked by context menu on my Tree. The last action I want to provide is "Open Diagram", which has to take my model as root element and finally open the GMF-generated graphical editor: that's why I pose the initial question of this thread, 'cause I want to avoid to create a project file, until it's strictly necessary.
That said, if you think I can help you in any manner, I'll be happy to collaborate: this forum is a little...er, greedy of answers, so I hope we can change this.
Best regards,
Giovanni.
|
|
|
| Re: GMF Diagram without Resource? [message #516077 is a reply to message #516060] |
Mon, 22 February 2010 12:16   |
Ali Koudri Messages: 118 Registered: July 2009 |
Senior Member |
|
|
Thx Giovanni,
In case you still looking forward to open your diagram, here is the
trick (to complete the previous example I gave you):
1. In your plugin.xml:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions ">
<command
commandId="qualified.name.openDiagram"
label="Open Diagram"
style="push">
<visibleWhen
checkEnabled="false">
<with
variable="selection">
<count
value="1">
</count>
<iterate>
<adapt
type="qualified.name.to.MyObject">
</adapt>
</iterate>
</with>
</visibleWhen>
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="qualified.name.openDiagram"
name="Open Diagram Command">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="qualified.name.commands.OpenDiagramHandler"
commandId="qualified.name.openDiagram">
</handler>
</extension>
2. Implement the Open Diagram Handler
package qualified.name.commands;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
....
public class OpenDiagramHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (!(selection instanceof IStructuredSelection)) return null;
if (!(((IStructuredSelection)selection).getFirstElement() instanceof
MyObject)) return null;
MyObject myObject = (MyObject)
((IStructuredSelection)selection).getFirstElement();
IWorkbenchPage page =
HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
try {
page.openEditor(new MyEditorInput(myObject), MyDiagramEditor.ID);
} catch (PartInitException e) {
e.printStackTrace();
return null;
}
return null;
}
}
Hope it will help.
Regards,
Ali.
Le 22/02/2010 17:02, Giovanni a écrit :
> Ali,
>
> I've seen your video: very good job, very interesting, especially your
> use of xPand templates, which I don't know.
>
> My needs are simpler than yours; I'm just trying to show in a Model
> Navigator (CNF based, of course) ONLY my model objects, not annoying
> Diagram, Shape, Node and so on, which are provided in the GMF-generated
> Project Explorer. Especially I don't want to display files.
> My Model Navigator shows a statical and hierarchical folder structure,
> initially empty; then, I generate my model on-the-fly, using only
> standard EMF methods (XYZFactory.eINSTANCE.createXyz(), etc.) invoked by
> context menu on my Tree. The last action I want to provide is "Open
> Diagram", which has to take my model as root element and finally open
> the GMF-generated graphical editor: that's why I pose the initial
> question of this thread, 'cause I want to avoid to create a project
> file, until it's strictly necessary.
>
> That said, if you think I can help you in any manner, I'll be happy to
> collaborate: this forum is a little...er, greedy of answers, so I hope
> we can change this.
>
> Best regards,
>
> Giovanni.
|
|
| | |
Goto Forum:
Current Time: Wed May 22 19:53:04 EDT 2013
Powered by FUDForum. Page generated in 0.02765 seconds
|