[211826] Support a configurable outline view - more changes
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java
index 3ae013a..4f2ff61 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDBaseAdapter.java
@@ -29,9 +29,12 @@
 import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
 import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
 import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
 import org.eclipse.xsd.XSDComplexTypeDefinition;
 import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDModelGroupDefinition;
 import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
 import org.w3c.dom.Element;
 
 public class XSDBaseAdapter extends AdapterImpl implements IADTObject, ITreeElement
@@ -208,7 +211,13 @@
   protected IADTObject getGlobalXSDContainer(XSDConcreteComponent component)
   {
     XSDConcreteComponent c = component.getContainer();
-    while (c != null && !(c.getContainer() instanceof XSDSchema))
+    // We want the top most structural component
+    while (c != null && 
+           !(c.getContainer() instanceof XSDSchema) && 
+           !(c instanceof XSDComplexTypeDefinition) &&
+           !(c instanceof XSDSimpleTypeDefinition) &&
+           !(c instanceof XSDModelGroupDefinition) &&
+           !(c instanceof XSDAttributeGroupDefinition))
     {
       c = c.getContainer();
     }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java
index 199c153..9462a9a 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/navigation/DesignViewNavigationLocation.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
@@ -124,11 +124,11 @@
       this.name = name;
     }
   }
-  static class Path
+  protected static class Path
   {
     List segments = new ArrayList();
 
-    static XSDConcreteComponent computeComponent(XSDSchema schema, Path path)
+    public static XSDConcreteComponent computeComponent(XSDSchema schema, Path path)
     {
       PathResolvingXSDVisitor visitor = new PathResolvingXSDVisitor(path);
       visitor.visitSchema(schema);
@@ -176,7 +176,7 @@
       return path;
     }
 
-    static Path computePath(XSDConcreteComponent component)
+    public static Path computePath(XSDConcreteComponent component)
     {
       Path path = new Path();
       for (EObject c = component; c != null; c = c.eContainer())
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
index 60b4e69..3388c57 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/actions/SetInputToGraphView.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
@@ -24,8 +24,8 @@
 public class SetInputToGraphView extends BaseSelectionAction
 {
   public static String ID = "SetAsFocus"; //$NON-NLS-1$
-  IEditorPart editorPart;
-  Object input;
+  protected IEditorPart editorPart;
+  protected Object input;
 
   public SetInputToGraphView(IWorkbenchPart part)
   {
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 3284be5..f102eff 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
@@ -85,7 +85,8 @@
       }
       else if (selectedObject instanceof IGraphElement)
       {
-        if (((IGraphElement)selectedObject).isFocusAllowed() && (event.getSource() instanceof ADTContentOutlinePage))
+        if (((IGraphElement)selectedObject).isFocusAllowed() && ((event.getSource() instanceof ADTContentOutlinePage) ||
+            (event.getSource() instanceof org.eclipse.jface.viewers.IPostSelectionProvider && !(getInput() instanceof IModel))))
         {
           setInput((IADTObject)selectedObject);              
         }
@@ -230,8 +231,8 @@
           // First check to see if there is a selection
           ISelection currentSelection = getSelection();
           
-          // If there is a selection then we will try to find the 
-          // target edit part that is a child of the enclosing container.
+          // If there is a selection then we will try to select 
+          // the target edit part that is one of its children
           // This is handy when you add an element to a structured edit part
           // then you want to select the element immediately and put it in
           // direct edit mode
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
index e43e85e..8fa0340 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
@@ -28,7 +28,7 @@
 import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
 import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
 
-public class RootContentEditPart extends AbstractGraphicalEditPart
+public class RootContentEditPart extends BaseEditPart
 {
   List collections = null;
   Figure contentPane;