|
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 |
tom 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 |
tom 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) {
>
> }
>
> }
|
|
|
Powered by
FUDForum. Page generated in 0.03609 seconds