Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » rcp application, how to I get rid of the search menu
rcp application, how to I get rid of the search menu [message #444536] Fri, 17 February 2006 08:15 Go to next message
tom is currently offline tomFriend
Messages: 7
Registered: July 2009
Junior Member
I use the search plugin for my Eclipse RCP Application but It will
be an application specific search. I use the search results page but
not the official search dialog - we have a own search view..

I want to get rid of the search menu (in the menubar) and the search
entries in the toolbar..

Is there some way to do this ???
Re: rcp application, how to I get rid of the search menu [message #444542 is a reply to message #444536] Fri, 17 February 2006 10:05 Go to previous messageGo to next message
tom is currently offline tomFriend
Messages: 7
Registered: July 2009
Junior Member
tom@knube.org schrieb:
> I use the search plugin for my Eclipse RCP Application but It will
> be an application specific search. I use the search results page but
> not the official search dialog - we have a own search view..
>
> I want to get rid of the search menu (in the menubar) and the search
> entries in the toolbar..
>
> Is there some way to do this ???


I got it !

The method hideActionSet from IWorkbenchPage is doing the job ...
For a short hack to disable the actions for my hole RCP Appliction I
hooked in an org.eclipse.ui.startup class and there I define a
Perspective Listener ... Well I know it is doing the hide call for
every perspective change (even if it is already hidden).. but until now
it is all I wanted.

The action ids I got from browsing through my dependent eclipse
plugins.. searching for ActionSets




package ch.post.pf.gui.prototyp.sesam.pstonline;

import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class ActionWiper implements IStartup, IPerspectiveListener {

private static final String[] ACTIONS_2_WIPE = new String[] {
"org.eclipse.search.searchActionSet",
"org.eclipse.ui.edit.text.actionSet.presentation",
"org.eclipse.ui.edit.text.actionSet.openExternalFile",
"org.eclipse.ui.edit.text.actionSet.annotationNavigation",
"org.eclipse.ui.edit.text.actionSet.navigation",
"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
"org.eclipse.update.ui.softwareUpdates" };

public void earlyStartup() {
IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
.getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
IWorkbenchPage page = windows[i].getActivePage();
if (page != null) {
wipeActions(page);
}
windows[i].addPerspectiveListener(this);
}
}

private void wipeActions(IWorkbenchPage page) {
for (int i = 0; i < ACTIONS_2_WIPE.length; i++) {
wipeAction(page, ACTIONS_2_WIPE[i]);
}

}

private void wipeAction(final IWorkbenchPage page, final String
actionsetId) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
page.hideActionSet(actionsetId);
}
});

}

public void perspectiveActivated(IWorkbenchPage page,
IPerspectiveDescriptor perspective) {
wipeActions(page);

}

public void perspectiveChanged(IWorkbenchPage page,
IPerspectiveDescriptor perspective, String changeId) {

}

}
Re: rcp application, how to I get rid of the search menu [message #444544 is a reply to message #444542] Fri, 17 February 2006 10:32 Go to previous message
tom is currently offline tomFriend
Messages: 7
Registered: July 2009
Junior Member
With the PreferenceManager I got even rid of the unwanted Preferences..:)
Where the PREFERENCES_2_WIPE Strings have to be the IDs of the main
categories you want to get rid off. Like the
"org.eclipse.ui.preferencePages.Workbench" -> shows up as General


PreferenceManager pm = PlatformUI.getWorkbench().getPreferenceManager();
for (int i = 0; i < PREFERENCES_2_WIPE.length; i++) {
pm.remove(PREFERENCES_2_WIPE[i]);
}



tom@knube.org schrieb:
> tom@knube.org schrieb:
>
>> I use the search plugin for my Eclipse RCP Application but It will
>> be an application specific search. I use the search results page but
>> not the official search dialog - we have a own search view..
>>
>> I want to get rid of the search menu (in the menubar) and the search
>> entries in the toolbar..
>>
>> Is there some way to do this ???
>
>
>
> I got it !
>
> The method hideActionSet from IWorkbenchPage is doing the job ...
> For a short hack to disable the actions for my hole RCP Appliction I
> hooked in an org.eclipse.ui.startup class and there I define a
> Perspective Listener ... Well I know it is doing the hide call for
> every perspective change (even if it is already hidden).. but until now
> it is all I wanted.
>
> The action ids I got from browsing through my dependent eclipse
> plugins.. searching for ActionSets
>
>
>
>
> package ch.post.pf.gui.prototyp.sesam.pstonline;
>
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.ui.IPerspectiveDescriptor;
> import org.eclipse.ui.IPerspectiveListener;
> import org.eclipse.ui.IStartup;
> import org.eclipse.ui.IWorkbenchPage;
> import org.eclipse.ui.IWorkbenchWindow;
> import org.eclipse.ui.PlatformUI;
>
> public class ActionWiper implements IStartup, IPerspectiveListener {
>
> private static final String[] ACTIONS_2_WIPE = new String[] {
> "org.eclipse.search.searchActionSet",
> "org.eclipse.ui.edit.text.actionSet.presentation",
> "org.eclipse.ui.edit.text.actionSet.openExternalFile",
> "org.eclipse.ui.edit.text.actionSet.annotationNavigation",
> "org.eclipse.ui.edit.text.actionSet.navigation",
> "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
> "org.eclipse.update.ui.softwareUpdates" };
>
> public void earlyStartup() {
> IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
> .getWorkbenchWindows();
> for (int i = 0; i < windows.length; i++) {
> IWorkbenchPage page = windows[i].getActivePage();
> if (page != null) {
> wipeActions(page);
> }
> windows[i].addPerspectiveListener(this);
> }
> }
>
> private void wipeActions(IWorkbenchPage page) {
> for (int i = 0; i < ACTIONS_2_WIPE.length; i++) {
> wipeAction(page, ACTIONS_2_WIPE[i]);
> }
>
> }
>
> private void wipeAction(final IWorkbenchPage page, final String
> actionsetId) {
> Display.getDefault().syncExec(new Runnable() {
> public void run() {
> page.hideActionSet(actionsetId);
> }
> });
>
> }
>
> public void perspectiveActivated(IWorkbenchPage page,
> IPerspectiveDescriptor perspective) {
> wipeActions(page);
>
> }
>
> public void perspectiveChanged(IWorkbenchPage page,
> IPerspectiveDescriptor perspective, String changeId) {
>
> }
>
> }
Previous Topic:Creating standalone help RCP
Next Topic:Plugin In Editor and Squiggles
Goto Forum:
  


Current Time: Wed Nov 13 22:05:51 GMT 2024

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

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

Back to the top