[152476] Constraints tab not refreshing when changing element's type from the graph view
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java
index 2330c27..60d7f8d 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaDirectiveAdapter.java
@@ -15,6 +15,8 @@
 import java.util.List;
 
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
+import org.eclipse.wst.xsd.ui.internal.adt.actions.ShowPropertiesViewAction;
 import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
 import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
 import org.eclipse.wst.xsd.ui.internal.common.actions.DeleteXSDConcreteComponentAction;
@@ -118,6 +120,8 @@
     List list = new ArrayList();
     list.add(OpenInNewEditor.ID);
     list.add(DeleteXSDConcreteComponentAction.DELETE_XSD_COMPONENT_ID);
+    list.add(BaseSelectionAction.SEPARATOR_ID);
+    list.add(ShowPropertiesViewAction.ID);
     
     return (String [])list.toArray(new String[0]);
   }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java
index 7817e31..5d32c55 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/properties/sections/XSDFacetSection.java
@@ -77,6 +77,7 @@
   boolean isNumericBaseType;
   private XSDTypeDefinition typeDefinition;
   private XSDSimpleTypeDefinition xsdSimpleTypeDefinition;
+  private XSDSimpleTypeDefinition currentPrimitiveType, previousPrimitiveType;
   private XSDElementDeclaration xsdElementDeclaration;
   private XSDAttributeDeclaration xsdAttributeDeclaration;
   private XSDFeature xsdFeature;
@@ -302,6 +303,7 @@
   
   private void updateInput()
   {
+    previousPrimitiveType = currentPrimitiveType;
     if (input instanceof XSDFeature)
     {
       xsdFeature = (XSDFeature) input;
@@ -334,10 +336,12 @@
         {
           XSDSimpleTypeDefinition basePrimitiveType = xsdSimpleTypeDefinition.getBaseTypeDefinition();
           String basePrimitiveTypeString = basePrimitiveType != null ? basePrimitiveType.getName() : "";
+          currentPrimitiveType = basePrimitiveType;
           titleString = Messages._UI_LABEL_TYPE + (anonymousTypeDefinition != null ? "(" + xsdFeature.getResolvedFeature().getName() + "Type)" : xsdSimpleTypeDefinition.getName())  + " , " + Messages._UI_LABEL_BASE + ": " + basePrimitiveTypeString; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
         }
         else
         {
+          currentPrimitiveType = xsdSimpleTypeDefinition;
           titleString = Messages._UI_LABEL_TYPE + (anonymousTypeDefinition != null ? "(" + xsdFeature.getResolvedFeature().getName() + "Type)" : xsdSimpleTypeDefinition.getName());
         }
       }
@@ -345,6 +349,7 @@
     else if (input instanceof XSDSimpleTypeDefinition)
     {
       xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) input;
+      currentPrimitiveType = xsdSimpleTypeDefinition;
       titleString = Messages._UI_LABEL_TYPE + (xsdSimpleTypeDefinition.getName() == null ? "(localType)" : xsdSimpleTypeDefinition.getName()) + " , " + Messages._UI_LABEL_BASE + ": " + xsdSimpleTypeDefinition.getBaseTypeDefinition().getName(); //$NON-NLS-1$ //$NON-NLS-2$
     }
   }
@@ -353,6 +358,12 @@
   {
     super.refresh();
     init();
+    
+    if (currentPrimitiveType != previousPrimitiveType)
+    {
+      relayout();      
+    }
+    
     setListenerEnabled(false);
     
     XSDWhiteSpaceFacet whitespaceFacet = xsdSimpleTypeDefinition.getWhiteSpaceFacet();
@@ -511,9 +522,6 @@
     maximumInclusiveCheckbox.removeSelectionListener(this);
     try
     {
-      minLengthText.setText(""); //$NON-NLS-1$
-      maxLengthText.setText(""); //$NON-NLS-1$
-
       minimumInclusiveCheckbox.setSelection(false);
       minimumInclusiveCheckbox.setEnabled(false);
       if (minFacet != null && minFacet.getRootContainer() == xsdSchema)
@@ -525,6 +533,10 @@
           minimumInclusiveCheckbox.setSelection(minFacet.isInclusive());
           minimumInclusiveCheckbox.setEnabled(true);
         }
+        else
+        {
+          minLengthText.setText(""); //$NON-NLS-1$
+        }
       }
 
       maximumInclusiveCheckbox.setSelection(false);
@@ -538,6 +550,10 @@
           maximumInclusiveCheckbox.setSelection(maxFacet.isInclusive());
           maximumInclusiveCheckbox.setEnabled(true);
         }
+        else
+        {
+          maxLengthText.setText(""); //$NON-NLS-1$
+        }
       }
     }
     finally
@@ -552,6 +568,7 @@
     super.doHandleEvent(event);
     Command command = null;
     boolean doUpdateMax = false, doUpdateMin = false;
+    boolean doSetInput = false;
     
     String minValue = minLengthText.getText().trim();
     String maxValue = maxLengthText.getText().trim();
@@ -759,6 +776,7 @@
           changeToAnonymousCommand = new ChangeToLocalSimpleTypeCommand(Messages._UI_ACTION_CONSTRAIN_LENGTH, (XSDFeature)input);
           changeToAnonymousCommand.setAnonymousSimpleType(anonymousSimpleType);
           compoundCommand.add(changeToAnonymousCommand);
+          doSetInput = true;
         }
 
         if (!isNumericBaseType)
@@ -851,7 +869,8 @@
       }
       
     }
-    setInput(getPart(), getSelection());
+    if (doSetInput)
+      setInput(getPart(), getSelection());
   }
   
   public void widgetSelected(SelectionEvent e)