gpt4 book ai didi

eclipse - 运行和搜索出现在 RCP 菜单栏中

转载 作者:行者123 更新时间:2023-12-03 07:41:54 24 4
gpt4 key购买 nike

我的 RCP 应用程序的菜单栏中突然出现了“运行”和“搜索”。有办法删除它们吗?

最佳答案

首先,检查 this thread (以及 Contributing Actions to the Eclipse Workbench 中使用的文章“this thread ”):

The trick was "check the launcher config" -- even after a completely fresh install of Eclipse 3.1.1, with precisely nothing else in my WS except my own plugins, the annoying extra menus and annoying error "edit last position" were still present.

Then I went to the launcher config as you suggested, which had loads of cruft (created automagically by Eclipse) -- so I deselected all, selected my plugins, and clicked "Add Required"; running from the WS with that -- great!

另请参阅bug 115998

removing the "platform" feature fixes it all up -- a very simple fix that was very hard to find!

<小时/>

也就是说,一般来说,要隐藏一些您可以尝试的操作贡献,例如 this thread至:

1/隐藏由 ActionSet 扩展点定义的菜单/酷栏。

IWorkbenchPage.hideActionSet(actionSetId)
IWorkbenchPage.hideActionSet("org.eclipse.search.menu");

2/隐藏其菜单:

MenuManager mbManager = ((ApplicationWindow)page.getWorkbenchWindow()).getMenuBarManager();
for (int i=0; i<mbManager.getItems().length; i++){
IContributionItem item=mbManager.getItems()[i];
if (item.getId().equals("org.eclipse.search.menu")){
item.setVisible(false);
}
}

或者您可以尝试this thread ,通过 PerspectiveListener 对任何视角隐藏它:

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) {
}
}

并删除首选项:

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]);
}

关于eclipse - 运行和搜索出现在 RCP 菜单栏中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2451628/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com