Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » remove default menu entry (like 'open file')
remove default menu entry (like 'open file') [message #652322] Thu, 03 February 2011 15:18 Go to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
Hi!
I would like to know how remove the 'open file' entry, under the menu 'File' of my rcp. Analyzing the code I found where copy,paste, select ecc. are but not open.

Thank you.
Re: remove default menu entry (like 'open file') [message #653069 is a reply to message #652322] Tue, 08 February 2011 10:57 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

to find this kind of thing, you should try to use ALT+SHIFT+F2 plug-in spy menu ( http://scratsh.wordpress.com/2009/06/09/eclipse-3-5-plug-in- spy-and-menus/)

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: remove default menu entry (like 'open file') [message #653075 is a reply to message #653069] Tue, 08 February 2011 11:26 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
great! it should be very useful... but it doesn't work for me Sad
just tried...

It can be because i'm on a mac? i'v eclipse of 2009. it should be galileo

[update] sorry.... i thought that was already included. Now I try to add the right plug-in to use it.

thank you

[Updated on: Tue, 08 February 2011 11:33]

Report message to a moderator

Re: remove default menu entry (like 'open file') [message #653128 is a reply to message #653075] Tue, 08 February 2011 15:28 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
ok...this is what the plug-in spy gave me about the "open file" entry...
- active contribution item id : 
     org.eclipse.ui.openLocalFile

-active action set id : 
     org.eclipse.ui.actionSet.openFiles

-active action definition id:    
    org.eclipse.ui.edit.text.openLocalFile

-active contribution item class:    
    org.eclipse.ui.internal.ide.actions.OpenLocalFileAction

-contribution plug-in
    org.eclipse.ui.workbench


I tried to use them in any way, but I didn't solve anything. I can't override the class because it's in source code. Even if i made i new class instead of it, I don't know where it's used.
Probably it's used by a class that is used by another class and so on, all in source code. I can't rewrite all the classes just to modify a method.
Any idea, suggestion ?

[Updated on: Tue, 08 February 2011 15:30]

Report message to a moderator

Re: remove default menu entry (like 'open file') [message #653130 is a reply to message #652322] Tue, 08 February 2011 15:34 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

I think that you should take a look to this extension points org.eclipse.ui.perspectiveExtensions with "hiddenMenuItem"

Regards,


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: remove default menu entry (like 'open file') [message #653160 is a reply to message #653130] Tue, 08 February 2011 17:37 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
nothing.... tried to add the extension specifying for any perspective (*) hide the menu entry (org.eclipse.ui.openLocalFile).
I saw the id in the plugin.xml of the package imported to add the entry, but it's in source code, so i can't modify it.
I think that 'hide menu' it's used just to hide menu of relative perspective views..

I tried also to override the 'open file' adding an extension with the same Id in 'action set'....but it's ignored.
Re: remove default menu entry (like 'open file') [message #653163 is a reply to message #652322] Tue, 08 February 2011 17:46 Go to previous messageGo to next message
Aurélien Pupier is currently offline Aurélien PupierFriend
Messages: 637
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

I don't understand why you can't modiffy it. You can set this perspective extension on your own plugin.
If you want more help, i suggest you to post in the PDE forum ( http://www.eclipse.org/forums/index.php?t=thread&frm_id= 14&S=4534df6589faa97aac3ced842f94e787)


Aurélien Pupier - Red Hat
Senior Software Engineer in Fuse Tooling team
Re: remove default menu entry (like 'open file') [message #653166 is a reply to message #653163] Tue, 08 February 2011 17:57 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
i can't modify it because the 'open file' extension doesn't appear in my plugin.xml , but it's in the plugin org.eclipse.ui.ide. It's an imported plugin and i can just see it, without modify.

I tried to add into my plugin.xml another extension equal to that of org.eclipse.ui.ide but with different behavior. Pity it doesn't override the standard one but it's ignored
icon14.gif  [SOLUTION] remove default menu entry (like 'open file') [message #653670 is a reply to message #653166] Thu, 10 February 2011 16:12 Go to previous messageGo to next message
daniele Mising name is currently offline daniele Mising nameFriend
Messages: 48
Registered: July 2009
Member
finally solved.

in DiagramEditorWorkbenchWindowAdvisor, override the postWindowCreate.

public void postWindowCreate() {
		super.postWindowCreate();
		
		IContributionItem[] mItems, mSubItems;
		IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer ().getMenuManager ();
		mItems = mm.getItems ();
			if (mItems[i] instanceof MenuManager) {	
				mSubItems = ((MenuManager) mItems[i]).getItems ();
				for (int j = 0; j < mSubItems.length; j++){
					if (mItems[i].getId ().equals ("file"))
						((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
				}
			}
		}
		
		
		


}
Re: [SOLUTION] remove default menu entry (like 'open file') [message #653687 is a reply to message #653670] Thu, 10 February 2011 17:00 Go to previous message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 29
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------010005000602000904010003
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

The Class DiagramEditorWorkbenchWindowAdvisor is a "private" Class? I
only find WorkbenchWindowAdvisor and
CompatibilityWorkbenchWindowAdvisor. If it's in your code, can you
explain how you connect this specific WorkbenchWindowAdvisor?

Thx

Laurent


On 10/02/2011 17:12, daniele wrote:
> finally solved.
>
> in DiagramEditorWorkbenchWindowAdvisor, override the postWindowCreate.
>
>
> public void postWindowCreate() {
> super.postWindowCreate();
>
> IContributionItem[] mItems, mSubItems;
> IMenuManager mm = getWindowConfigurer ().getActionBarConfigurer
> ().getMenuManager ();
> mItems = mm.getItems ();
> if (mItems[i] instanceof MenuManager) {
> mSubItems = ((MenuManager) mItems[i]).getItems ();
> for (int j = 0; j < mSubItems.length; j++){
> if (mItems[i].getId ().equals ("file"))
> ((MenuManager) mItems[i]).remove ("org.eclipse.ui.openLocalFile");
> }
> }
> }
>
>
>
>
> }


--------------010005000602000904010003
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_redor.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_redor.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgUmVkb3INCm46UmVkb3I7TGF1cmVu dA0Kb3JnOk9i
ZW8NCmFkcjtxdW90ZWQtcHJpbnRhYmxlOjs7MiBydWUgUm9iZXJ0IFNjaHVt YW47UmV6PUMz
PUE5Ozs0NDQwMDtGcmFuY2UNCmVtYWlsO2ludGVybmV0OmxhdXJlbnQucmVk b3JAb2Jlby5m
cg0KdXJsOmh0dHA6Ly93d3cub2Jlby5mcg0KdmVyc2lvbjoyLjENCmVuZDp2 Y2FyZA0KDQo=
--------------010005000602000904010003--
Previous Topic:restore perspective view
Next Topic:Inner node with fixed size and position, not draggable
Goto Forum:
  


Current Time: Fri Apr 19 01:35:48 GMT 2024

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

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

Back to the top