[150963] problems adding elements and attributes with XML Schema Editor. See points 3 and 4.
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
index d290c0b..a428112 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/DesignViewGraphicalViewer.java
@@ -87,6 +87,15 @@
{
setInput((IADTObject)selectedObject);
}
+ if (selectedObject instanceof IField)
+ {
+ IField field = (IField)selectedObject;
+ if (!field.isGlobal() && getInput() instanceof IModel)
+ {
+ if (field.getContainerType() != null)
+ setInput(field.getContainerType());
+ }
+ }
}
else if (selectedObject instanceof IField)
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
index 13e5cf9..f9fe653 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
@@ -29,6 +29,7 @@
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.gef.requests.LocationRequest;
import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter;
import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ComboBoxCellEditorManager;
import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager;
@@ -296,10 +297,10 @@
// removeFeedback();
-// Runnable runnable = new Runnable()
-// {
-// public void run()
-// {
+ Runnable runnable = new Runnable()
+ {
+ public void run()
+ {
Object object = ((XSDBaseAdapter)getModel()).getTarget();
if (object instanceof XSDNamedComponent)
{
@@ -309,9 +310,9 @@
adtDirectEditPolicy.setUpdateCommand(wrapper);
manager.show();
}
-// }
-// };
-// Display.getCurrent().asyncExec(runnable);
+ }
+ };
+ Display.getCurrent().asyncExec(runnable);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java
index 5fe16a2..07785fc 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAnyAttributeAction.java
@@ -54,7 +54,8 @@
if (command != null)
{
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java
index fe797b3..2ac9607 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeDeclarationAction.java
@@ -96,7 +96,8 @@
if (command != null)
{
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java
index 3aff554..f30a3e7 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDAttributeGroupDefinitionAction.java
@@ -69,7 +69,8 @@
if (command != null)
{
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java
index 93b7e0d..c55f4ef 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDComplexTypeDefinitionAction.java
@@ -44,7 +44,8 @@
AddXSDComplexTypeDefinitionCommand command = new AddXSDComplexTypeDefinitionCommand(Messages._UI_ACTION_ADD_COMPLEX_TYPE, (XSDSchema) selection);
getCommandStack().execute(command);
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java
index cb0b0e4..5930728 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDElementAction.java
@@ -117,7 +117,8 @@
if (command != null)
{
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java
index bbc9797..d49a367 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDModelGroupDefinitionAction.java
@@ -53,7 +53,9 @@
{
AddXSDModelGroupDefinitionCommand command = new AddXSDModelGroupDefinitionCommand(getText(), xsdConcreteComponent, isReference);
getCommandStack().execute(command);
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java
index 4a1f200..bc7cd73 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/AddXSDSimpleTypeDefinitionAction.java
@@ -44,7 +44,8 @@
AddXSDSimpleTypeDefinitionCommand command = new AddXSDSimpleTypeDefinitionCommand(Messages._UI_ACTION_ADD_SIMPLE_TYPE, (XSDSchema) selection);
getCommandStack().execute(command);
- Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
+ addedComponent = command.getAddedComponent();
+ Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java
index be611b5..3edf43f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/actions/XSDBaseAction.java
@@ -23,6 +23,7 @@
public class XSDBaseAction extends BaseSelectionAction
{
+ XSDConcreteComponent addedComponent;
public XSDBaseAction(IWorkbenchPart part)
{
@@ -59,9 +60,12 @@
if (obj instanceof TopLevelComponentEditPart)
{
TopLevelComponentEditPart editPart = (TopLevelComponentEditPart)obj;
- editPart.setScroll(true);
- editPart.addFeedback();
- editPart.doEditName(!(part instanceof ContentOutline));
+ if (addedComponent == ((XSDBaseAdapter)editPart.getModel()).getTarget())
+ {
+ editPart.setScroll(true);
+ editPart.addFeedback();
+ editPart.doEditName(!(part instanceof ContentOutline));
+ }
}
else if (obj instanceof BaseFieldEditPart)
{