[170557] Extensions and Extension Properties View Fixes - Support read only components
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif
new file mode 100644
index 0000000..c24a95f
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsn_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif
new file mode 100644
index 0000000..843cd0e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/obj16/extnsndis_obj.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif
new file mode 100644
index 0000000..f34420b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsn_ovr.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif
new file mode 100644
index 0000000..94eb768
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/icons/ovr16/extnsndis_ovr.gif
Binary files differ
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java
index 05ec150..654558f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/ModelGroupEditPart.java
@@ -80,21 +80,21 @@
       case XSDCompositor.ALL:
       {
         image = isReadOnly ? ModelGroupFigure.ALL_ICON_DISABLED_IMAGE :ModelGroupFigure.ALL_ICON_IMAGE;
-        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image);
+        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly);
         nodeName = XSDConstants.ALL_ELEMENT_TAG;
         break;
       }
       case XSDCompositor.CHOICE:
       {
         image = isReadOnly ? ModelGroupFigure.CHOICE_ICON_DISABLED_IMAGE : ModelGroupFigure.CHOICE_ICON_IMAGE;
-        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image); 
+        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly); 
         nodeName = XSDConstants.CHOICE_ELEMENT_TAG;
         break;
       }
       case XSDCompositor.SEQUENCE:
       {
         image = isReadOnly ? ModelGroupFigure.SEQUENCE_ICON_DISABLED_IMAGE : ModelGroupFigure.SEQUENCE_ICON_IMAGE;
-        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image); 
+        modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent)adapter.getTarget(), image, isReadOnly); 
         nodeName = XSDConstants.SEQUENCE_ELEMENT_TAG;
         break;
       }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java
index 48146fb..cac822a 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/TopLevelComponentEditPart.java
@@ -109,7 +109,7 @@
       Image image = adapter.getImage();
       if (image != null)
       {
-        label.setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image));
+        label.setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly));
       }
       // arrowLabel.setVisible(Boolean.TRUE.equals(adapter.getProperty(getModel(),
       // "drillDown")));
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java
index 710f0c9..b118683 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDBaseFieldEditPart.java
@@ -72,12 +72,13 @@
     if (getModel() instanceof XSDBaseAdapter)
     {
       Image image = ((XSDBaseAdapter)getModel()).getImage();
+      boolean isReadOnly = ((XSDBaseAdapter)getModel()).isReadOnly();
       figure.getNameLabel().setIcon(image);
       
       if (image != null)
       {
         XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter)getModel()).getTarget();
-        figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage(comp, image));
+        figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage(comp, image, isReadOnly));
       }
     }    
   }
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java
index 3c52815..033637b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDEditPartFactory.java
@@ -142,7 +142,8 @@
     if (model instanceof XSDBaseAdapter)
     {
       XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter)model).getTarget();
-      figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage( comp, ((XSDBaseAdapter)model).getImage()));
+      boolean isReadOnly = ((XSDBaseAdapter)model).isReadOnly();
+      figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage( comp, ((XSDBaseAdapter)model).getImage(), isReadOnly));
     }
     return figure;
   }  
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java
index bbf2e46..3dcfc12 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSchemaEditPart.java
@@ -148,7 +148,7 @@
     headingFigure.getLabel().setIcon(image);
     if (image != null)
     {
-      headingFigure.getLabel().setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) schemaAdapter.getTarget(), image));
+      headingFigure.getLabel().setIcon(XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) schemaAdapter.getTarget(), image, false));
     }
     outer.repaint();
     
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java
index dc0446d..1e84920 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/XSDSimpleTypeEditPart.java
@@ -67,7 +67,7 @@
     headingFigure.setIsReadOnly(adapter.isReadOnly());
     Label label = headingFigure.getLabel();
     label.setText(name);
-    label.setIcon(XSDCommonUIUtils.getUpdatedImage(adapter.getXSDTypeDefinition(), adapter.getImage()));    
+    label.setIcon(XSDCommonUIUtils.getUpdatedImage(adapter.getXSDTypeDefinition(), adapter.getImage(), adapter.isReadOnly()));    
   }
   
   public IStructureFigure getStructureFigure()
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
index c537f7b..0f2a674 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ImageOverlayDescriptor.java
@@ -19,15 +19,18 @@
 public class ImageOverlayDescriptor extends CompositeImageDescriptor
 {
   protected Image baseImage;
-  protected Image extensionOverlay;
+  protected Image extensionOverlay, disabledExtensionOverlay;
   protected Point imageSize;
+  protected boolean isReadOnly;
   
-  public ImageOverlayDescriptor(Image baseImage)
+  public ImageOverlayDescriptor(Image baseImage, boolean isReadOnly)
   {
     super();
     this.baseImage = baseImage;
+    this.isReadOnly = isReadOnly;
     imageSize = new Point(baseImage.getBounds().width, baseImage.getBounds().height);
-    extensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/textoverlay.gif");  //$NON-NLS-1$ 
+    extensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsn_ovr.gif");  //$NON-NLS-1$ 
+    disabledExtensionOverlay = XSDEditorPlugin.getPlugin().getIcon("ovr16/extnsndis_ovr.gif");  //$NON-NLS-1$
   }
 
   public Image getImage()
@@ -37,8 +40,16 @@
   
   protected void drawCompositeImage(int width, int height)
   {
-    drawImage(baseImage.getImageData(), 0, 0);  
-    ImageData extensionImageData = extensionOverlay.getImageData();
+    drawImage(baseImage.getImageData(), 0, 0);
+    ImageData extensionImageData;
+    if (isReadOnly)
+    {
+      extensionImageData = disabledExtensionOverlay.getImageData();
+    }
+    else
+    {
+      extensionImageData = extensionOverlay.getImageData();
+    }
     drawImage (extensionImageData, imageSize.x - extensionImageData.width, 0);  // Top Right corner
   }
 
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
index b6619e7..508c6df 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-common/org/eclipse/wst/xsd/ui/internal/common/util/XSDCommonUIUtils.java
@@ -58,14 +58,15 @@
     super();
   }
   
-  public static Image getUpdatedImage(XSDConcreteComponent input, Image baseImage)
+  public static Image getUpdatedImage(XSDConcreteComponent input, Image baseImage, boolean isReadOnly)
   {
     XSDAnnotation xsdAnnotation = getInputXSDAnnotation(input, false);
+    
     if (xsdAnnotation != null)
     {
       if (xsdAnnotation.getApplicationInformation().size() > 0)
       {
-        ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage);
+        ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage, isReadOnly);
         Image newImage = ovr.getImage();
         return newImage;
       }