Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-10-25 14:05:06 +0000
committerUwe Stieber2012-10-25 14:05:06 +0000
commitb5ae28bc2644844f0facd574ca7cf1202817171f (patch)
treeb21d17d92f03bda401ab7dfdcfd8b58241302d27 /target_explorer
parentaf52f4e9cf4807e17364ad33ea3665c775d24d99 (diff)
downloadorg.eclipse.tcf-b5ae28bc2644844f0facd574ca7cf1202817171f.tar.gz
org.eclipse.tcf-b5ae28bc2644844f0facd574ca7cf1202817171f.tar.xz
org.eclipse.tcf-b5ae28bc2644844f0facd574ca7cf1202817171f.zip
Target Explorer: Added workaround for CDT/Platform bug 392249
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java32
1 files changed, 29 insertions, 3 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java
index 9d34a23d0..3ffb5dc79 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals/src/org/eclipse/tcf/te/ui/terminals/tabs/TabFolderMenuHandler.java
@@ -14,6 +14,7 @@ import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener2;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -68,9 +69,27 @@ public class TabFolderMenuHandler extends PlatformObject {
*/
@Override
public void menuAboutToShow(IMenuManager manager) {
+ removeInvalidContributions(manager);
updateMenuItems(true);
}
-
+
+ /**
+ * Bug 392249: Remove contributions that appear in the context in Eclipse 4.x which are
+ * not visible in Eclipse 3.8.x. Re-evaluate from time to time!
+ *
+ * @param manager The menu manager or <code>null</code>
+ */
+ private void removeInvalidContributions(IMenuManager manager) {
+ if (manager == null) return;
+
+ IContributionItem[] items = manager.getItems();
+ for (IContributionItem item : items) {
+ String id = item.getId();
+ if (id != null && id.startsWith("org.eclipse.cdt")) { //$NON-NLS-1$
+ manager.remove(item);
+ }
+ }
+ }
}
/**
@@ -134,8 +153,12 @@ public class TabFolderMenuHandler extends PlatformObject {
// Create the menu manager if not done before
contextMenuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- // Create and associated the menu listener
- contextMenuManager.addMenuListener(new MenuListener());
+
+ // Bug 392249: Register our menu listener after registering the context menu
+ // for contributions. That way we can use our menu listener to get
+ // rid of unwanted/misguided contributions. At least until this is
+ // fixed in the Eclipse 4.x platform.
+
// Create the context menu
contextMenu = contextMenuManager.createContextMenu(tabFolder);
@@ -147,6 +170,9 @@ public class TabFolderMenuHandler extends PlatformObject {
// Register to the view site to open the menu for contributions
getParentView().getSite().registerContextMenu(contextMenuManager, getParentView().getSite().getSelectionProvider());
+
+ // Create and associated the menu listener
+ contextMenuManager.addMenuListener(new MenuListener());
}
/**

Back to the top