aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Elder2013-01-11 10:43:46 (EST)
committerPaul Webster2013-01-11 10:43:46 (EST)
commitf45b9f594318ba7e4e0b577d90b1b510b1d9b7df (patch)
treeb3a237bc17ea31c9feeb027e459fa1a663a16441
parent256fe7630c949f09c3d4f0f10242b7d05ca9b58d (diff)
downloadeclipse.platform.ui-f45b9f594318ba7e4e0b577d90b1b510b1d9b7df.zip
eclipse.platform.ui-f45b9f594318ba7e4e0b577d90b1b510b1d9b7df.tar.gz
eclipse.platform.ui-f45b9f594318ba7e4e0b577d90b1b510b1d9b7df.tar.bz2
Bug 387606 - A contribution to the toolbar without a given id lets
Eclipse hang Change the order of the checks, and do them in one place.
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java21
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java11
-rwxr-xr-xbundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java10
3 files changed, 21 insertions, 21 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
index b61be95..3379b9a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuAdditionCacheEntry.java
@@ -54,6 +54,20 @@ public class MenuAdditionCacheEntry {
final static String TRIM_STATUS = "org.eclipse.ui.trim.status"; //$NON-NLS-1$
+ /**
+ * Test whether the location URI is in one of the pre-defined workbench trim
+ * areas.
+ *
+ * @param location
+ * @return true if the URI is in workbench trim area.
+ */
+ static boolean isInWorkbenchTrim(MenuLocationURI location) {
+ final String path = location.getPath();
+ return MAIN_TOOLBAR.equals(path) || TRIM_COMMAND1.equals(path)
+ || TRIM_COMMAND2.equals(path) || TRIM_VERTICAL1.equals(path)
+ || TRIM_VERTICAL2.equals(path) || TRIM_STATUS.equals(path);
+ }
+
private MApplication application;
// private IEclipseContext appContext;
private IConfigurationElement configElement;
@@ -90,17 +104,14 @@ public class MenuAdditionCacheEntry {
}
}
if (inToolbar()) {
- String path = location.getPath();
- if (path.equals(MAIN_TOOLBAR) || path.equals(TRIM_COMMAND1)
- || path.equals(TRIM_COMMAND2) || path.equals(TRIM_VERTICAL1)
- || path.equals(TRIM_VERTICAL2) || path.equals(TRIM_STATUS)) {
+ if (isInWorkbenchTrim(location)) {
processTrimChildren(trimContributions, toolBarContributions, configElement);
} else {
String query = location.getQuery();
if (query == null || query.length() == 0) {
query = "after=additions"; //$NON-NLS-1$
}
- processToolbarChildren(toolBarContributions, configElement, path,
+ processToolbarChildren(toolBarContributions, configElement, location.getPath(),
query);
}
return;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
index 78121f8..b3c30b9 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/MenuFactoryGenerator.java
@@ -50,13 +50,7 @@ public class MenuFactoryGenerator {
ArrayList<MToolBarContribution> toolBarContributions,
ArrayList<MTrimContribution> trimContributions) {
if (inToolbar()) {
- String path = location.getPath();
- if (path.equals(MenuAdditionCacheEntry.MAIN_TOOLBAR)
- || path.equals(MenuAdditionCacheEntry.TRIM_COMMAND1)
- || path.equals(MenuAdditionCacheEntry.TRIM_COMMAND2)
- || path.equals(MenuAdditionCacheEntry.TRIM_VERTICAL1)
- || path.equals(MenuAdditionCacheEntry.TRIM_VERTICAL2)
- || path.equals(MenuAdditionCacheEntry.TRIM_STATUS)) {
+ if (MenuAdditionCacheEntry.isInWorkbenchTrim(location)) {
// processTrimChildren(trimContributions, toolBarContributions,
// configElement);
} else {
@@ -64,7 +58,8 @@ public class MenuFactoryGenerator {
if (query == null || query.length() == 0) {
query = "after=additions"; //$NON-NLS-1$
}
- processToolbarChildren(toolBarContributions, configElement, path, query);
+ processToolbarChildren(toolBarContributions, configElement, location.getPath(),
+ query);
}
return;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
index 690af33..dc8dbfe 100755
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/menus/WorkbenchMenuService.java
@@ -91,13 +91,7 @@ public class WorkbenchMenuService implements IMenuService {
MenuLocationURI location = new MenuLocationURI(factory.getLocation());
if (inToolbar(location)) {
- String path = location.getPath();
- if (path.equals(MenuAdditionCacheEntry.MAIN_TOOLBAR)
- || path.equals(MenuAdditionCacheEntry.TRIM_COMMAND1)
- || path.equals(MenuAdditionCacheEntry.TRIM_COMMAND2)
- || path.equals(MenuAdditionCacheEntry.TRIM_VERTICAL1)
- || path.equals(MenuAdditionCacheEntry.TRIM_VERTICAL2)
- || path.equals(MenuAdditionCacheEntry.TRIM_STATUS)) {
+ if (MenuAdditionCacheEntry.isInWorkbenchTrim(location)) {
// processTrimChildren(trimContributions, toolBarContributions,
// configElement);
} else {
@@ -105,7 +99,7 @@ public class WorkbenchMenuService implements IMenuService {
if (query == null || query.length() == 0) {
query = "after=additions"; //$NON-NLS-1$
}
- processToolbarChildren(factory, location, path, query);
+ processToolbarChildren(factory, location, location.getPath(), query);
}
return;
}