aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Fullbright2011-08-09 20:37:16 (EDT)
committerFrancis Upton IV2011-08-09 20:37:16 (EDT)
commiteeee11dffc7156b07f30d5d8783c67f67dbd4ac2 (patch)
tree0b53ba7d7915f165f90fbd11eec20ad60c2a4990
parent3b41c02f4edd3b0fd72694e4a2196daf15416fc3 (diff)
downloadeclipse.platform.ui-eeee11dffc7156b07f30d5d8783c67f67dbd4ac2.zip
eclipse.platform.ui-eeee11dffc7156b07f30d5d8783c67f67dbd4ac2.tar.gz
eclipse.platform.ui-eeee11dffc7156b07f30d5d8783c67f67dbd4ac2.tar.bz2
bug 349224 [CommonNavigator] Navigator content provider "appearsBefore"
creates hard reference to named id
-rw-r--r--bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java13
-rw-r--r--tests/org.eclipse.ui.tests.navigator/plugin.xml11
-rw-r--r--tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java1
-rw-r--r--tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/ProgrammaticOpenTest.java10
4 files changed, 31 insertions, 4 deletions
diff --git a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java
index c226021..abec983 100644
--- a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java
+++ b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/extensions/NavigatorContentDescriptorManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2010 IBM Corporation and others.
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Bug 349224 Navigator content provider "appearsBefore" creates hard reference to named id - paul.fullbright@oracle.com
*******************************************************************************/
package org.eclipse.ui.internal.navigator.extensions;
@@ -23,6 +24,7 @@ import java.util.TreeSet;
import java.util.WeakHashMap;
import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
@@ -456,9 +458,12 @@ public class NavigatorContentDescriptorManager {
if (desc.getId().equals(id))
return i;
}
- throw new RuntimeException("Can't find id: " + id); //$NON-NLS-1$
+ // Do not require content descriptor to exist in workspace
+ NavigatorPlugin.log(IStatus.WARNING, 0,
+ "Can't find Navigator Content Descriptor with id: " + id, null); //$NON-NLS-1$
+ return -1;
}
-
+
private void computeSequenceNumbers() {
NavigatorContentDescriptor[] descs = getAllContentDescriptors();
@@ -474,7 +479,7 @@ public class NavigatorContentDescriptorManager {
NavigatorContentDescriptor desc = (NavigatorContentDescriptor) list.get(i);
if (desc.getAppearsBeforeId() != null) {
int beforeInd = findId(list, desc.getAppearsBeforeId());
- if (beforeInd < i) {
+ if (beforeInd >= 0 && beforeInd < i) {
list.add(beforeInd, desc);
list.remove(i + 1);
changed = true;
diff --git a/tests/org.eclipse.ui.tests.navigator/plugin.xml b/tests/org.eclipse.ui.tests.navigator/plugin.xml
index ae94131..a81970e 100644
--- a/tests/org.eclipse.ui.tests.navigator/plugin.xml
+++ b/tests/org.eclipse.ui.tests.navigator/plugin.xml
@@ -357,6 +357,17 @@
</navigatorContent>
<navigatorContent
+ appearsBefore="org.eclipse.ui.tests.navigator.testTHISISNOTFOUND"
+ contentProvider="org.eclipse.ui.tests.navigator.extension.TestSimpleChildrenContentProvider2"
+ id="org.eclipse.ui.tests.navigator.testSimpleChildrenAppearsBeforeNotFound"
+ labelProvider="org.eclipse.ui.tests.navigator.extension.TestLabelProviderCyan"
+ name="Test Simple Children Appears Before Not Found">
+ <enablement>
+ <instanceof value="org.eclipse.core.resources.IProject"/>
+ </enablement>
+ </navigatorContent>
+
+ <navigatorContent
id="org.eclipse.ui.tests.navigator.testContent2"
contentProvider="org.eclipse.ui.tests.navigator.extension.TestContentProvider"
labelProvider="org.eclipse.ui.tests.navigator.extension.TestLabelProviderBlue"
diff --git a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java
index 8df313b..a40c555 100644
--- a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java
+++ b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/NavigatorTestBase.java
@@ -87,6 +87,7 @@ public class NavigatorTestBase extends TestCase {
public static final String TEST_SIMPLE_CHILDREN1 = "org.eclipse.ui.tests.navigator.testSimpleChildrenContent1";
public static final String TEST_SIMPLE_CHILDREN2 = "org.eclipse.ui.tests.navigator.testSimpleChildrenContent2";
public static final String TEST_SIMPLE_CHILDREN3 = "org.eclipse.ui.tests.navigator.testSimpleChildrenContent3";
+ public static final String TEST_SIMPLE_CHILDREN_NOT_FOUND = "org.eclipse.ui.tests.navigator.testSimpleChildrenAppearsBeforeNotFound";
public static final String TEST_CONTENT_M12_VIEW = "org.eclipse.ui.tests.navigator.M12View";
public static final String TEST_CONTENT_M12_M1_CONTENT = "org.eclipse.ui.tests.navigator.m12.M1";
diff --git a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/ProgrammaticOpenTest.java b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/ProgrammaticOpenTest.java
index 014297f..6663acb 100644
--- a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/ProgrammaticOpenTest.java
+++ b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/ProgrammaticOpenTest.java
@@ -189,4 +189,14 @@ public class ProgrammaticOpenTest extends NavigatorTestBase {
}
+ // bug 349224 Navigator content provider "appearsBefore" creates hard reference to named id
+ public void testNceNotFound() throws Exception {
+ _contentService.bindExtensions(new String[] {
+ COMMON_NAVIGATOR_RESOURCE_EXT, TEST_SIMPLE_CHILDREN_NOT_FOUND }, false);
+ _contentService.getActivationService().activateExtensions(
+ new String[] { COMMON_NAVIGATOR_RESOURCE_EXT, TEST_SIMPLE_CHILDREN_NOT_FOUND }, true);
+ }
+
+
+
}