Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » removing items from the popup menu
removing items from the popup menu [message #177973] Tue, 18 March 2008 19:33 Go to next message
Eclipse UserFriend
Originally posted by: chrisn86.yahoo.de

Hi,

I know that this question was asked several times before, but after all
I still didn't got it working.
I want to remove some actions and sub menus from the pop-up menu and the
main menu bar. I know about the 'popupPredefinedItem' in
'org.eclipse.gmf.runtime.common.ui.services.action.contribut ionItemProviders'

and I have tried to use this snippet from the example:

<popupPredefinedItem
id="autoSizeAction"
path="/formatMenu/"
remove="true"/>

Apart from that the autosizeAction in my diagram menu is always
disabled, it is still visible. What am I doing wrong?
It would be nice if somebody could give me a working example for
removing the copy action or the whole filter menu!

Thanks

Christian Neudert
Re: removing items from the popup menu [message #178226 is a reply to message #177973] Wed, 19 March 2008 20:23 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Christian,

Your snippet looks fine, but what else are you setting in the
contributionItemProviders extension point?

By the way, you will only be able to remove the autosize action from the
context menu this way and not from the main menu or toolbar (see
Bugzilla 111221 for more info).

Regards,
Cherie

christian Neudert wrote:
> Hi,
>
> I know that this question was asked several times before, but after all
> I still didn't got it working.
> I want to remove some actions and sub menus from the pop-up menu and the
> main menu bar. I know about the 'popupPredefinedItem' in
> 'org.eclipse.gmf.runtime.common.ui.services.action.contribut ionItemProviders'
>
> and I have tried to use this snippet from the example:
>
> <popupPredefinedItem
> id="autoSizeAction"
> path="/formatMenu/"
> remove="true"/>
>
> Apart from that the autosizeAction in my diagram menu is always
> disabled, it is still visible. What am I doing wrong?
> It would be nice if somebody could give me a working example for
> removing the copy action or the whole filter menu!
>
> Thanks
>
> Christian Neudert
Re: removing items from the popup menu [message #178471 is a reply to message #178226] Thu, 20 March 2008 19:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chrisn86.yahoo.de

This is a multi-part message in MIME format.
--------------060405000406080703050004
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi Cherie,

I've attached the interesting part of my plugin.xml. I also completely
recreated my diagram plug-in, but I still can't filter any pop-up action
through popupPredefinedItem..

Thanks for the bug hint. After I read the comment #2 I implemented my
own DiagramContextMenuProvider and needed to overwrite
configureGraphicalViewer() in my DiagramDocumentEditor to register this
Provider. With this "hack" I can filter the pop-up menu through
allowItem(IContributionItem itemToAdd). By the way, its possible to
remove the toolbar actions, after they have been created, if you filter
them in your DiagramActionBarContributor.

For now these workarounds are sufficent, but i would like to use the
smart way with popupPredefinedItem.

Regards,

Christian

Cherie Revells schrieb:
> Christian,
>
> Your snippet looks fine, but what else are you setting in the
> contributionItemProviders extension point?
>
> By the way, you will only be able to remove the autosize action from the
> context menu this way and not from the main menu or toolbar (see
> Bugzilla 111221 for more info).
>
> Regards,
> Cherie
>

--------------060405000406080703050004
Content-Type: text/plain;
name="snippet.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="snippet.txt"

<extension point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<?gmfgen generated="true"?>
<contributionItemProvider class="petri.diagram.providers.PetriContributionItemProvider ">
<Priority name="Low">
</Priority>
<partContribution id="petri.diagram.part.PetriDiagramEditorID">
<partAction menubarPath="/file/print" id="printPreviewAction">
</partAction>
</partContribution>
</contributionItemProvider>
<contributionItemProvider
class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider "
checkPluginLoaded="false">
<Priority name="Low"/>
<popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.StelleNameEditPart"/ >
<popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
<popupPredefinedItem id="deleteFromModelAction" remove="true"/>
<popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
</popupContribution>
<popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.TransitionNameEditPart "/>
<popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
<popupPredefinedItem id="deleteFromModelAction" remove="true"/>
<popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
</popupContribution>
<popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.Connection1GewichtEditPart "/>
<popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
<popupPredefinedItem id="deleteFromModelAction" remove="true"/>
<popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
</popupContribution>
<popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.Connection2GewichtEditPart "/>
<popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
<popupPredefinedItem id="deleteFromModelAction" remove="true"/>
<popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
</popupContribution>
</contributionItemProvider>
</extension>

--------------060405000406080703050004--
Re: removing items from the popup menu [message #178500 is a reply to message #178471] Thu, 20 March 2008 20:11 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Christian,

Are you saying that with the code in your plugin.xml you were able to
remove the delete menu items, but not the autosize menu item? I do not
understand why. I did the following to remove the autosize menu item
from the geoshapes example and it worked fine. It looks teh same as to
what you have.

<extension
point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<contributionItemProvider
checkPluginLoaded="false"

class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider ">
<Priority
name="Low">
</Priority>
<popupContribution

class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria
objectClass=" org.eclipse.gmf.runtime.diagram.ui.geoshapes.internal.editpa rts.GeoShapeEditPart ">
</popupStructuredContributionCriteria>
<popupPredefinedItem
id="autoSizeAction"
path="/formatMenu/"
remove="true">
</popupPredefinedItem>
</popupContribution>
</contributionItemProvider>
</extension>

Regards,
Cherie

christian Neudert wrote:
> Hi Cherie,
>
> I've attached the interesting part of my plugin.xml. I also completely
> recreated my diagram plug-in, but I still can't filter any pop-up action
> through popupPredefinedItem..
>
> Thanks for the bug hint. After I read the comment #2 I implemented my
> own DiagramContextMenuProvider and needed to overwrite
> configureGraphicalViewer() in my DiagramDocumentEditor to register this
> Provider. With this "hack" I can filter the pop-up menu through
> allowItem(IContributionItem itemToAdd). By the way, its possible to
> remove the toolbar actions, after they have been created, if you filter
> them in your DiagramActionBarContributor.
>
> For now these workarounds are sufficent, but i would like to use the
> smart way with popupPredefinedItem.
>
> Regards,
>
> Christian
>
> Cherie Revells schrieb:
>> Christian,
>>
>> Your snippet looks fine, but what else are you setting in the
>> contributionItemProviders extension point?
>>
>> By the way, you will only be able to remove the autosize action from
>> the context menu this way and not from the main menu or toolbar (see
>> Bugzilla 111221 for more info).
>>
>> Regards,
>> Cherie
>>
>
> ------------------------------------------------------------ ------------
>
> <extension point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
> <?gmfgen generated="true"?>
> <contributionItemProvider class="petri.diagram.providers.PetriContributionItemProvider ">
> <Priority name="Low">
> </Priority>
> <partContribution id="petri.diagram.part.PetriDiagramEditorID">
> <partAction menubarPath="/file/print" id="printPreviewAction">
> </partAction>
> </partContribution>
> </contributionItemProvider>
> <contributionItemProvider
> class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContribu tionItemProvider "
> checkPluginLoaded="false">
> <Priority name="Low"/>
> <popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
> <popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.StelleNameEditPart"/ >
> <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
> <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
> <popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
> </popupContribution>
> <popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
> <popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.TransitionNameEditPart "/>
> <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
> <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
> <popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
> </popupContribution>
> <popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
> <popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.Connection1GewichtEditPart "/>
> <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
> <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
> <popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
> </popupContribution>
> <popupContribution class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
> <popupStructuredContributionCriteria objectClass="petri.diagram.edit.parts.Connection2GewichtEditPart "/>
> <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
> <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
> <popupPredefinedItem id="autoSizeAction" path="/formatMenu/" remove="true"/>
> </popupContribution>
> </contributionItemProvider>
> </extension>
Re: removing items from the popup menu [message #178522 is a reply to message #178500] Thu, 20 March 2008 20:55 Go to previous message
Eclipse UserFriend
Originally posted by: chrisn86.yahoo.de

Cherie,

No, I wasn't able to remove any menu item per plugin.xml. I will try the
example and maybe reinstall gmf. I will write if I get it working.

Regards

Christian
Previous Topic:Explanation of Editing Domain Id in GMF editor
Next Topic:Sorting popup menu actions
Goto Forum:
  


Current Time: Thu Apr 25 04:05:43 GMT 2024

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

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

Back to the top