|
Re: Where is Target ID for ecore model contest menu? [message #429309 is a reply to message #429308] |
Fri, 17 April 2009 18:04 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Mike,
It sounds like you want an object action more like our Create Dynamic
Instance... action on EClass, right?
Mike Stapleton wrote:
> I am trying to add a menu plugin to the context menu of the emf ecore
> model object, basically at the same place that the Teneo project added
> their menu plugin. I want to build a plugin that will take the ecore
> model, parse through all the objects, and build Google protobuf files
> and then run protoc on the proto files to generate Java messages I can
> use to pass over an AMQP broker. My problem is that I cannot find the
> Target ID for the ecore context menu so I can plug into it? I have
> searched the Eclipse documentation, especially the Plugin Environment
> Development Guide, done countless web searches and downloaded the
> Teneo project source and searched it. I basically just want to plug
> into the same menu and approximate spot that the Teneo Project did?
> Should be easy right? Does anyone no if it was even registered
> (registerContextMenu called) when created? It is not in the standard
> IWorkbenchActionConstants or the other constants interface (the name
> excapes me) given in the documentation. Could anyone point me in the
> right direction or if you know it and it's easier, just pass it along.
> Thanks if you considered this question,
> Mike
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: Where is Target ID for ecore model contest menu? [message #429319 is a reply to message #429318] |
Sat, 18 April 2009 20:18 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
--------------070201080505070802090500
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Mike,
Comments below.
Mike Stapleton wrote:
> Thanks for responding Ed,
>
> I'm not sure how to respond to this Ed?
That was my thinking to the original question. In the generated editors
you can see how context menus are registered in createContextMenuFor and
you'll not their isn't a global target ID you can just hook into.
> I have built a UML diagram model and generated code from it. I also
> currently update the model by starting at the root and traversing the
> objects in the model updating classes and their attributes as I go
> (only if they changed of course). I use the root of the model to start
> grabbing model instantiated objects as such:
>
> Root
> rootObj=TablesModelManager.access().initServer(address,port) .getModel();
>
> Now I want to go in a different direction. I want to use the ecore API
> (I think) to grab each declared class in the model and find each
> class's attributes and their corresponding data type and use that
> information to build another type of file (I think this is the process
> you are referring to).
When you talk about class here, do you mean EClass with EAttributes of
type EDataType?
> The way I wanted to have the user start this process off was by adding
> a menu selection called "Generate Proto Files" to the context menu of
> the ecore model object.
So is it like the object action registered again EClass which will
appear on any *properly registered* context menu:
protected void createContextMenuFor(StructuredViewer viewer) {
MenuManager contextMenu = new MenuManager("#PopUp");
contextMenu.add(new Separator("additions"));
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
Menu menu= contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().*registerContextMenu*(contextMenu, new
UnwrappingSelectionProvider(viewer));
> So the user would select the xxx.ecore file (xxx being whatever you
> named it) and right click on it which currently brings up it's context
> menu and select the "Generate Proto Files" item.
So it's more an action on an IFile, like the Reload... action on a
*.genmodel file? You see why I'm getting confuse?
> The xxx.ecore file is in the model folder of the EMF project I created
> along with the xxx.ecorediag and xxx.genmodel files which I know your
> already familiar with.
Just a little. :-P
> I have built a popup menu plugin to do the job declaring it as a
> viewerContribution in the plugin.xml file. The viewerContribution
> declaration requires a targetID tag that tells the plugin which menu
> to add itself to.
I've never used a viewer contribution before. You can look in the
plugin.xml for org.eclipse.emf.ecore.editor and
org.eclipse.emf.codegen.ecore.ui to see how we register the things that
already appear...
> I cannot find anywhere, the targetID that defines the .ecore file's
> context menu?
There really isn't one as far as I understand it...
> It is a menu that only shows up when you add the EMF modeling plugin
> (since these project don't even exist until you add the plugin).
I don't really understand what EMF modeling plugin refers to.
> So it makes sense that it is not defined as a standard constant. But
> where can I find this ID? I only mention teneo because if you have the
> teneo plugin installed then you will have a teneo menu item in this
> menu when you select the .ecore file. That's where is want to entend
> my plugin from, in that menu. Can anyone tell me what the value of the
> targetID that identifies this menu?
It would be good to look in the plugin.xmls to see how something similar
is doing it...
>
> The parsing of the ecore model is something I wouldn't mind discussing
> with you as for the best approach but first I have to have a way for
> the user to select the function from the menu in order to execute my
> plugin and test it.
>
> I hope I haven't confused the issue more by my inexperience with
> Eclipse and EMF and my lack of the proper terminology?
Probably slightly, but that's certainly understandable given there are
so many different tricky ways to do the menu stuff...
>
> Thanks for reading,
> Mike
>
>
--------------070201080505070802090500
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mike,<br>
<br>
Comments below.<br>
<br>
<br>
Mike Stapleton wrote:
<blockquote
cite="mid:594d8428341c19306dfaedcd16bcf371$1@www.eclipse.org"
type="cite">Thanks for responding Ed,
<br>
<br>
I'm not sure how to respond to this Ed? </blockquote>
That was my thinking to the original question.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.05801 seconds