Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do I remove Open External File action for RCP editor?
How do I remove Open External File action for RCP editor? [message #542094] Wed, 23 June 2010 20:32 Go to next message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
I originally was looking to do an override, but let's simplify. I justI want to remove the external Open file action from my RCP editor.

I saw a number of entries on the web regarding this.

I tried doing IWorkbenchPage.hideActionSet("org.eclipse.ui.edit.text.actionSet.openExternalFile ");

in varous places, including postWindowOpen() in my WorkbenchAdvisor. I actually see the call go through without any exception, but no dice, the menu item remains.

I tried using an activities extension and specifying a number of patterns including the obvious org.eclipse.ui.edit.text.actionSet.openExternalFile. I also tried org.eclipse.ui.edit.*.openExternalFile..

None of these patterns seem to do anything

I saw another post where someone used a startup extension and specified an earlyStartup method, but the extension is marked as deprecated so I would rather find something else.

Any suggestions that someone has gotten to work?

I have included by WorkbenchAdvisor code in case there is something I screwed up.

    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
    	return new WorkbenchWindowAdvisor(configurer) {
			public void preWindowOpen() {
				super.preWindowOpen();
		        getWindowConfigurer().setInitialSize(new Point(600, 450));
		        getWindowConfigurer().setShowCoolBar(true);
		        getWindowConfigurer().setShowStatusLine(true);
		        getWindowConfigurer().setTitle(RPMMessages.EditorTitle);
				IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
				for (int i = 0; i < windows.length; ++i) {
					IWorkbenchPage page = windows[i].getActivePage();
					if (page != null)
						page.hideActionSet("org.eclipse.ui.edit.text.actionSet.openExternalFile");
				}
			}
			public void postWindowOpen() {
				super.postWindowOpen();
				IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
				for (int i = 0; i < windows.length; ++i) {
					IWorkbenchPage page = windows[i].getActivePage();
					if (page != null)
						page.hideActionSet("org.eclipse.ui.edit.text.actionSet.openExternalFile");
				}
			}
			
			public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer abConfigurer) {
				return new RPMEditorActionBarAdvisor(abConfigurer);
			}
		};
    }

[Updated on: Thu, 24 June 2010 21:42]

Report message to a moderator

Re: How do I remove Open External File action for RCP editor? [message #545450 is a reply to message #542094] Wed, 07 July 2010 19:57 Go to previous message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
Ok, it appears I was trying to hide the wrong action set. Thanks to Chris Aniszczyk for suggesting the way to do this is to hide the openFiles action set in the postWindowOpen() method of the WindowWorkbenchAdvisor as follows:

				IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
				for (int i = 0; i < windows.length; ++i) {
					IWorkbenchPage page = windows[i].getActivePage();
					if (page != null)
						page.hideActionSet("org.eclipse.ui.actionSet.openFiles");
				}


This works.
Previous Topic:Cannot execute exported product
Next Topic:Display non-stacked multiple instances of a view
Goto Forum:
  


Current Time: Tue Apr 23 14:52:54 GMT 2024

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

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

Back to the top