diff options
author | kchong | 2007-02-28 23:07:37 +0000 |
---|---|---|
committer | kchong | 2007-02-28 23:07:37 +0000 |
commit | 72d75361f394323f9ac20ac3a8c8efa2fe3bdcc0 (patch) | |
tree | 78ba707ea25747fd01e9db58b1205d7e67222599 /bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse | |
parent | 9eb5defc7dfad948257344ad054c79720cf5f85d (diff) | |
download | webtools.sourceediting-72d75361f394323f9ac20ac3a8c8efa2fe3bdcc0.tar.gz webtools.sourceediting-72d75361f394323f9ac20ac3a8c8efa2fe3bdcc0.tar.xz webtools.sourceediting-72d75361f394323f9ac20ac3a8c8efa2fe3bdcc0.zip |
[175943] Attribute and element's type namespace should be from the resolved declaration
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse')
4 files changed, 41 insertions, 8 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java index c4200ef61a..9399572eae 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeDeclarationAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. + * Copyright (c) 2001, 2007 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 @@ -11,6 +11,7 @@ package org.eclipse.wst.xsd.ui.internal.adapters; import org.eclipse.xsd.XSDAttributeDeclaration; +import org.eclipse.xsd.XSDTypeDefinition; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider; import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel; @@ -42,5 +43,16 @@ public class XSDAttributeDeclarationAdapter extends XSDBaseAttributeAdapter impl public boolean isFocusAllowed() { return isGlobal(); - } + } + + public String getTypeNameQualifier() + { + XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition(); + if (type != null) + { + return type.getTargetNamespace(); + } + return ""; + } + } diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java index 8759688d43..df2d0f4b4c 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDAttributeUseAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. + * Copyright (c) 2001, 2007 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 @@ -15,6 +15,7 @@ import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvide import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel; import org.eclipse.xsd.XSDAttributeDeclaration; import org.eclipse.xsd.XSDAttributeUse; +import org.eclipse.xsd.XSDTypeDefinition; public class XSDAttributeUseAdapter extends XSDBaseAttributeAdapter implements IActionProvider { @@ -76,4 +77,15 @@ public class XSDAttributeUseAdapter extends XSDBaseAttributeAdapter implements I Adapter adapter = XSDAdapterFactory.getInstance().adapt(getXSDAttributeDeclaration().getSchema()); return (IModel)adapter; } + + public String getTypeNameQualifier() + { + XSDTypeDefinition type = getResolvedXSDAttributeDeclaration().getTypeDefinition(); + if (type != null) + { + return type.getTargetNamespace(); + } + return ""; + } + }
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java index 8243945761..e7c7cf9ac7 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAttributeAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. + * Copyright (c) 2001, 2007 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 @@ -93,8 +93,12 @@ public abstract class XSDBaseAttributeAdapter extends XSDBaseAdapter implements public String getTypeName() { - XSDTypeDefinition td = getResolvedXSDAttributeDeclaration().getTypeDefinition(); - return (td != null) ? td.getName() : Messages._UI_NO_TYPE_DEFINED; + IType type = getType(); + if (type != null) + { + return type.getName(); + } + return ""; } public String getTypeNameQualifier() diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java index b89e77bc6c..f81399f5e7 100644 --- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java +++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDElementDeclarationAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. + * Copyright (c) 2001, 2007 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 @@ -66,7 +66,12 @@ public class XSDElementDeclarationAdapter extends XSDParticleAdapter implements public String getTypeNameQualifier() { - return getXSDElementDeclaration().getTypeDefinition().getTargetNamespace(); + XSDTypeDefinition type = getXSDElementDeclaration().getResolvedElementDeclaration().getTypeDefinition(); + if (type != null) + { + return type.getTargetNamespace(); + } + return ""; } public IType getType() |