Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Selective editor features in an RCP application
Selective editor features in an RCP application [message #420124] Wed, 18 June 2008 15:51 Go to next message
Ali is currently offline AliFriend
Messages: 18
Registered: July 2009
Junior Member
Ed,

I have recently asked a question about using selected UI actions in RCP
application in GMF. Since the GMF newsgroup is not as responsive as EMF,
and because the question can be also applied to EMF editor, let me
re-introduce the question here.

An EMF (GMF) editor plugin, creates its own Application and Perspective
classes where it defined some actions. Let's say we have an RCP
application which wants to import only some selected actions from the
editor plugin (here we have yet another Application, Perspective etc in
our RCP application). For example, we may be only interested in SAVE
action.

(1) Is it possible to change the properties of the actions in genmodel
(gmfgen) so that the editor plugin automatically adds the selected actions
to the perspective of the RCP application?

(2) I have tried create an action in my RCP plugin which calls the
corresponding class in the editor plugin. The action was openning a
diagram file, and I got the message "There is no editor registered for the
file [filename]" which was fixed in this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=233635 . Now in 3.4 RC4, I
still have the same problem. It is not clear to me whether this is a bug
or I am not supposed to create an action in one plugin and correspond it
to a class in another plugin.
Re: Selective editor features in an RCP application [message #420126 is a reply to message #420124] Wed, 18 June 2008 16:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080501000409080400030309
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Ali,

Comments below.


Ali wrote:
> Ed,
>
> I have recently asked a question about using selected UI actions in
> RCP application in GMF. Since the GMF newsgroup is not as responsive
> as EMF, and because the question can be also applied to EMF editor,
> let me re-introduce the question here.
I'll have to learn to be less helpful. Perhaps charge a small fee. :-P
Or maybe extort friendship: http://www.eclipse.org/donate/donorlist.php
>
> An EMF (GMF) editor plugin, creates its own Application and
> Perspective classes where it defined some actions. Let's say we have
> an RCP application which wants to import only some selected actions
> from the editor plugin (here we have yet another Application,
> Perspective etc in our RCP application). For example, we may be only
> interested in SAVE action.
I don't know all that much about perspectives and all that...
>
> (1) Is it possible to change the properties of the actions in genmodel
> (gmfgen) so that the editor plugin automatically adds the selected
> actions to the perspective of the RCP application?
Generally we hook up all the context menu so registered popup actions
should show up

protected void createContextMenuForGen(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));

int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] {
LocalTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new
ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new
EditingDomainViewerDropAdapter(editingDomain, viewer));
}


>
> (2) I have tried create an action in my RCP plugin which calls the
> corresponding class in the editor plugin. The action was openning a
> diagram file, and I got the message "There is no editor registered for
> the file [filename]" which was fixed in this bug:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=233635 . Now in 3.4 RC4,
> I still have the same problem. It is not clear to me whether this is a
> bug or I am not supposed to create an action in one plugin and
> correspond it to a class in another plugin.
It depends a bit how your editor is registered. Often they are
registered against file extensions. If you know which editor you want
to open you should be able to specifically open that editor and avoid
this type of problem...


--------------080501000409080400030309
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">
Ali,<br>
<br>
Comments below.<br>
<br>
<br>
Ali wrote:
<blockquote
cite="mid:748cb1d941e84baee18910412d9116b9$1@www.eclipse.org"
type="cite">Ed,
<br>
<br>
I have recently asked a question about using selected UI actions in RCP
application in GMF. Since the GMF newsgroup is not as responsive as
EMF, and because the question can be also applied to EMF editor, let me
re-introduce the question here.
<br>
</blockquote>
I'll have to learn to be less helpful.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Selective editor features in an RCP application [message #420129 is a reply to message #420126] Wed, 18 June 2008 17:08 Go to previous messageGo to next message
Ali is currently offline AliFriend
Messages: 18
Registered: July 2009
Junior Member
Ed Merks wrote:

> Ali,

> Comments below.


> Ali wrote:
>> Ed,
>>
>> I have recently asked a question about using selected UI actions in
>> RCP application in GMF. Since the GMF newsgroup is not as responsive
>> as EMF, and because the question can be also applied to EMF editor,
>> let me re-introduce the question here.
> I'll have to learn to be less helpful. Perhaps charge a small fee. :-P
> Or maybe extort friendship: http://www.eclipse.org/donate/donorlist.php
>>
>> An EMF (GMF) editor plugin, creates its own Application and
>> Perspective classes where it defined some actions. Let's say we have
>> an RCP application which wants to import only some selected actions
>> from the editor plugin (here we have yet another Application,
>> Perspective etc in our RCP application). For example, we may be only
>> interested in SAVE action.
> I don't know all that much about perspectives and all that...
>>
>> (1) Is it possible to change the properties of the actions in genmodel
>> (gmfgen) so that the editor plugin automatically adds the selected
>> actions to the perspective of the RCP application?
> Generally we hook up all the context menu so registered popup actions
> should show up

> protected void createContextMenuForGen(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));

> int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
> Transfer[] transfers = new Transfer[] {
> LocalTransfer.getInstance() };
> viewer.addDragSupport(dndOperations, transfers, new
> ViewerDragAdapter(viewer));
> viewer.addDropSupport(dndOperations, transfers, new
> EditingDomainViewerDropAdapter(editingDomain, viewer));
> }

Maybe my question was not clear: When we have finished creating an EMF RCP
application, Run Configuration must be set to run
org.example.model.editor.XXXApplication
(org.example.diagram.XXXApplication). The problem is that I have another
Application class in my RCP project which includes other editors and the
EMF (GMF) editor I am trying to add is only one of them, so, I cannot use
the automatically generated editor Application class to run the RCP
application. Then, the question is, how can the editor plugin add its menu
and toolbar items to the *RCP* Application, the above adds these stuff to
the *editor* Application.

As an eclipse plugin which contributes to UI, an EMF (GMF) editor should
be able to add viewparts, menus, etc to an *existing* Application, once
loaded. It seems to me that currently the generated code is only able to
add the UI stuff to its own Application. I hope this is clear now.


>>
>> (2) I have tried create an action in my RCP plugin which calls the
>> corresponding class in the editor plugin. The action was openning a
>> diagram file, and I got the message "There is no editor registered for
>> the file [filename]" which was fixed in this bug:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=233635 . Now in 3.4 RC4,
>> I still have the same problem. It is not clear to me whether this is a
>> bug or I am not supposed to create an action in one plugin and
>> correspond it to a class in another plugin.
> It depends a bit how your editor is registered. Often they are
> registered against file extensions. If you know which editor you want
> to open you should be able to specifically open that editor and avoid
> this type of problem...
Re: Selective editor features in an RCP application [message #420131 is a reply to message #420129] Wed, 18 June 2008 17:26 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Ali,

Comments below.

Ali wrote:
> Ed Merks wrote:
>
>> Ali,
>
>> Comments below.
>
>
>> Ali wrote:
>>> Ed,
>>>
>>> I have recently asked a question about using selected UI actions in
>>> RCP application in GMF. Since the GMF newsgroup is not as responsive
>>> as EMF, and because the question can be also applied to EMF editor,
>>> let me re-introduce the question here.
>> I'll have to learn to be less helpful. Perhaps charge a small fee.
>> :-P Or maybe extort friendship:
>> http://www.eclipse.org/donate/donorlist.php
>>>
>>> An EMF (GMF) editor plugin, creates its own Application and
>>> Perspective classes where it defined some actions. Let's say we have
>>> an RCP application which wants to import only some selected actions
>>> from the editor plugin (here we have yet another Application,
>>> Perspective etc in our RCP application). For example, we may be only
>>> interested in SAVE action.
>> I don't know all that much about perspectives and all that...
>>>
>>> (1) Is it possible to change the properties of the actions in
>>> genmodel (gmfgen) so that the editor plugin automatically adds the
>>> selected actions to the perspective of the RCP application?
>> Generally we hook up all the context menu so registered popup actions
>> should show up
>
>> protected void createContextMenuForGen(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));
>
>> int dndOperations = DND.DROP_COPY | DND.DROP_MOVE |
>> DND.DROP_LINK;
>> Transfer[] transfers = new Transfer[] {
>> LocalTransfer.getInstance() };
>> viewer.addDragSupport(dndOperations, transfers, new
>> ViewerDragAdapter(viewer));
>> viewer.addDropSupport(dndOperations, transfers, new
>> EditingDomainViewerDropAdapter(editingDomain, viewer));
>> }
>
> Maybe my question was not clear: When we have finished creating an EMF
> RCP application, Run Configuration must be set to run
> org.example.model.editor.XXXApplication
> (org.example.diagram.XXXApplication). The problem is that I have
> another Application class in my RCP project which includes other
> editors and the EMF (GMF) editor I am trying to add is only one of
> them, so, I cannot use the automatically generated editor Application
> class to run the RCP application. Then, the question is, how can the
> editor plugin add its menu and toolbar items to the *RCP* Application,
> the above adds these stuff to the *editor* Application.
I see. As I said, I really don't understand the details of perspectives
and how to work at that level. Maybe this is just an RCP question to be
asked on the RCP newsgroup.
>
> As an eclipse plugin which contributes to UI, an EMF (GMF) editor
> should be able to add viewparts, menus, etc to an *existing*
> Application, once loaded. It seems to me that currently the generated
> code is only able to add the UI stuff to its own Application. I hope
> this is clear now.
Yes, but I'm not sure how to help. I expect it's a more general RCP
question...
>
>
>>>
>>> (2) I have tried create an action in my RCP plugin which calls the
>>> corresponding class in the editor plugin. The action was openning a
>>> diagram file, and I got the message "There is no editor registered
>>> for the file [filename]" which was fixed in this bug:
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=233635 . Now in 3.4
>>> RC4, I still have the same problem. It is not clear to me whether
>>> this is a bug or I am not supposed to create an action in one plugin
>>> and correspond it to a class in another plugin.
>> It depends a bit how your editor is registered. Often they are
>> registered against file extensions. If you know which editor you
>> want to open you should be able to specifically open that editor and
>> avoid this type of problem...
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Find the referent class in th ecurrent instance
Next Topic:what is a resource?
Goto Forum:
  


Current Time: Sat Apr 27 03:56:48 GMT 2024

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

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

Back to the top