diff options
author | kchong | 2015-11-24 02:57:25 +0000 |
---|---|---|
committer | kchong | 2015-11-24 02:57:25 +0000 |
commit | db898edc6f2ffb9d795d5085dbe286671d923106 (patch) | |
tree | fd4bf3566c49f17a3d9ea60acb31f3b4cb9acc2a | |
parent | 358c305f6370d468116920c72e14671164162489 (diff) | |
download | webtools.sourceediting-R3_7_maintenance.tar.gz webtools.sourceediting-R3_7_maintenance.tar.xz webtools.sourceediting-R3_7_maintenance.zip |
[482859] Failure to check namespace in OpenOnSelectionHelper - 3.7.2R3_7_2R3_7_maintenance
3 files changed, 35 insertions, 17 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF index e3b9f494c9..aaeee093f1 100644 --- a/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.wst.xsd.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %_UI_PLUGIN_NAME Bundle-SymbolicName: org.eclipse.wst.xsd.ui; singleton:=true -Bundle-Version: 1.2.500.qualifier +Bundle-Version: 1.2.510.qualifier Bundle-Activator: org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin Bundle-Vendor: %Bundle-Vendor.0 Bundle-Localization: plugin diff --git a/bundles/org.eclipse.wst.xsd.ui/pom.xml b/bundles/org.eclipse.wst.xsd.ui/pom.xml index f8fef9ff05..f62492129e 100644 --- a/bundles/org.eclipse.wst.xsd.ui/pom.xml +++ b/bundles/org.eclipse.wst.xsd.ui/pom.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright (c) 2012, 2013 Eclipse Foundation and others. + Copyright (c) 2012, 2015 Eclipse Foundation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Distribution License v1.0 which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ <groupId>org.eclipse.webtools.sourceediting</groupId> <artifactId>org.eclipse.wst.xsd.ui</artifactId> - <version>1.2.500-SNAPSHOT</version> + <version>1.2.510-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> <!-- added this "constraint" for bug 458962 --> diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java index be1aa78b54..d6d70c61f2 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/utils/OpenOnSelectionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. + * Copyright (c) 2001, 2015 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 @@ -161,9 +161,11 @@ public class OpenOnSelectionHelper { XSDSchema schema = xsdSchema; String name = null; + String namespace = null; if (comp instanceof XSDNamedComponent) { name = ((XSDNamedComponent) comp).getName(); + namespace = ((XSDNamedComponent) comp).getTargetNamespace(); } if (name == null) { @@ -175,6 +177,7 @@ public class OpenOnSelectionHelper if (comp instanceof XSDNamedComponent) { name = ((XSDNamedComponent) comp).getName(); + namespace = ((XSDNamedComponent) comp).getTargetNamespace(); } } } @@ -210,19 +213,34 @@ public class OpenOnSelectionHelper objects = schema.getAttributeDeclarations(); } - if (objects != null) - { - for (Iterator iter = objects.iterator(); iter.hasNext();) - { - XSDNamedComponent namedComp = (XSDNamedComponent) iter.next(); - - if (namedComp.getName().equals(name)) - { - revealObject(namedComp); - return namedComp; - } - } - } + if (objects != null) + { + if (namespace != null) + { + // First, look for a namespace and name match + for (Iterator iter = objects.iterator(); iter.hasNext();) + { + XSDNamedComponent namedComp = (XSDNamedComponent) iter.next(); + String targetNamespace = namedComp.getTargetNamespace(); + if (namedComp.getName().equals(name) && targetNamespace != null && targetNamespace.equals(namespace)) + { + revealObject(namedComp); + return namedComp; + } + } + } + + // Next, look for just a name match + for (Iterator iter = objects.iterator(); iter.hasNext();) + { + XSDNamedComponent namedComp = (XSDNamedComponent) iter.next(); + if (namedComp.getName().equals(name)) + { + revealObject(namedComp); + return namedComp; + } + } + } return null; } |