[176565] Enhancements to XML Schema Editor
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java
index 5d316de..6a52600 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/adapters/XSDSchemaAdapter.java
@@ -308,7 +308,7 @@
return adapterList;
}
- protected List getGlobalElements(XSDSchema schema, boolean showFromIncludes)
+ public List getGlobalElements(XSDSchema schema, boolean showFromIncludes)
{
List elements = schema.getElementDeclarations();
List list = new ArrayList();
@@ -325,7 +325,7 @@
return adapterList;
}
- protected List getGlobalElements(XSDSchema schema)
+ public List getGlobalElements(XSDSchema schema)
{
return getGlobalElements(schema, false);
}
@@ -334,7 +334,7 @@
* @param schema
* @return
*/
- protected List getComplexTypes(XSDSchema schema, boolean showFromIncludes)
+ public List getComplexTypes(XSDSchema schema, boolean showFromIncludes)
{
List allTypes = schema.getTypeDefinitions();
List list = new ArrayList();
@@ -355,19 +355,19 @@
return adapterList;
}
- protected List getComplexTypes(XSDSchema schema)
+ public List getComplexTypes(XSDSchema schema)
{
return getComplexTypes(schema, false);
}
- protected List getTypes(XSDSchema schema, boolean showFromIncludes)
+ public List getTypes(XSDSchema schema, boolean showFromIncludes)
{
List list = getComplexTypes(schema, showFromIncludes);
list.addAll(getSimpleTypes(schema, showFromIncludes));
return list;
}
- protected List getAttributeGroupList(XSDSchema xsdSchema, boolean showFromIncludes)
+ public List getAttributeGroupList(XSDSchema xsdSchema, boolean showFromIncludes)
{
List attributeGroupList = new ArrayList();
for (Iterator i = xsdSchema.getAttributeGroupDefinitions().iterator(); i.hasNext();)
@@ -383,12 +383,12 @@
return adapterList;
}
- protected List getAttributeGroupList(XSDSchema xsdSchema)
+ public List getAttributeGroupList(XSDSchema xsdSchema)
{
return getAttributeGroupList(xsdSchema, false);
}
- protected List getAttributeList(XSDSchema xsdSchema, boolean showFromIncludes)
+ public List getAttributeList(XSDSchema xsdSchema, boolean showFromIncludes)
{
List attributesList = new ArrayList();
for (Iterator iter = xsdSchema.getAttributeDeclarations().iterator(); iter.hasNext();)
@@ -427,12 +427,12 @@
return adapterList;
}
- protected List getAttributeList(XSDSchema xsdSchema)
+ public List getAttributeList(XSDSchema xsdSchema)
{
return getAttributeList(xsdSchema, false);
}
- protected List getSimpleTypes(XSDSchema schema, boolean showFromIncludes)
+ public List getSimpleTypes(XSDSchema schema, boolean showFromIncludes)
{
List allTypes = schema.getTypeDefinitions();
List list = new ArrayList();
@@ -453,12 +453,12 @@
return adapterList;
}
- protected List getSimpleTypes(XSDSchema schema)
+ public List getSimpleTypes(XSDSchema schema)
{
return getSimpleTypes(schema, false);
}
- protected List getGroups(XSDSchema schema, boolean showFromIncludes)
+ public List getGroups(XSDSchema schema, boolean showFromIncludes)
{
List groups = schema.getModelGroupDefinitions();
List list = new ArrayList();
@@ -475,7 +475,7 @@
return adapterList;
}
- protected List getGroups(XSDSchema schema)
+ public List getGroups(XSDSchema schema)
{
return getGroups(schema, false);
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java
index e90a976..5f36878 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/editparts/CategoryEditPart.java
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
@@ -28,6 +29,7 @@
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.swt.SWT;
import org.eclipse.wst.xsd.ui.internal.adapters.CategoryAdapter;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.EditPartNavigationHandlerUtil;
@@ -35,12 +37,10 @@
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
import org.eclipse.wst.xsd.ui.internal.design.editpolicies.SelectionHandlesEditPolicyImpl;
import org.eclipse.wst.xsd.ui.internal.design.layouts.ContainerLayout;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.FillLayout;
public class CategoryEditPart extends BaseEditPart
{
protected SelectionHandlesEditPolicyImpl selectionHandlesEditPolicy;
- // CategoryFigure figure;
Figure outerPane;
HeadingFigure headingFigure;
protected ScrollPane scrollpane;
@@ -52,7 +52,6 @@
protected IFigure createFigure()
{
- // figure = new CategoryFigure(getType());
outerPane = new Figure();
outerPane.setBorder(new RoundedLineBorder(1, 6));
@@ -61,7 +60,7 @@
headingFigure.getLabel().setText(((CategoryAdapter) getModel()).getText());
headingFigure.getLabel().setIcon(((CategoryAdapter) getModel()).getImage());
- int minHeight = 250;
+ int minHeight = SWT.DEFAULT;
switch (getType())
{
case CategoryAdapter.DIRECTIVES:
@@ -78,7 +77,8 @@
}
final int theMinHeight = minHeight;
- FillLayout outerLayout = new FillLayout()
+
+ ToolbarLayout outerLayout = new ToolbarLayout(false)
{
protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
{
@@ -87,6 +87,7 @@
return d;
}
};
+ outerLayout.setStretchMinorAxis(true);
outerPane.setLayoutManager(outerLayout);
RectangleFigure line = new RectangleFigure()
@@ -123,7 +124,14 @@
protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
{
Dimension d = super.calculatePreferredSize(parent, width, height);
- d.height = Math.min(d.height, theMinHeight - 25); // getViewer().getControl().getBounds().height);
+ if (theMinHeight > 0)
+ d.height = Math.min(d.height, theMinHeight);
+ else
+ {
+ double factor = getZoomManager().getZoom();
+ int scaledHeight = (int)Math.round((getViewer().getControl().getBounds().height - 400) / factor); // adjust for other categories and spaces
+ d.height = Math.max(250, scaledHeight);
+ }
d.width = Math.min(d.width, 300);
return d;
}
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 3dcfc12..792bcef 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
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
@@ -52,7 +53,6 @@
protected IFigure createFigure()
{
outer = new Figure();
- // outer.setBorder(new RoundedLineBorder(1, 6));
outer.setBorder(new LineBorder(1));
FillLayout fillLayout = new FillLayout(4);
@@ -61,25 +61,11 @@
headingFigure = new HeadingFigure();
outer.add(headingFigure);
- final int theMinHeight = 200;
- FillLayout outerLayout = new FillLayout()
- {
- protected Dimension calculatePreferredSize(IFigure parent, int width, int height)
- {
- Dimension d = super.calculatePreferredSize(parent, width, height);
- d.union(new Dimension(250, theMinHeight));
- return d;
- }
- };
- outerLayout.setHorizontal(false);
- outer.setLayoutManager(outerLayout);
-
RectangleFigure line = new RectangleFigure()
{
public Dimension getPreferredSize(int wHint, int hHint)
{
Dimension d = super.getPreferredSize(wHint, hHint);
- d.width += 20;
d.height = 1;
return d;
}
@@ -91,12 +77,11 @@
outer.add(line);
contentFigure = new Figure();
- contentFigure.setBorder(new MarginBorder(4, 4, 4, 4));
+ contentFigure.setBorder(new MarginBorder(4));
fillLayout = new FillLayout(4);
contentFigure.setLayoutManager(fillLayout);
outer.add(contentFigure);
-
return outer;
}
@@ -157,7 +142,7 @@
{
targetNamespaceValue = Messages._UI_GRAPH_XSDSCHEMA_NO_NAMESPACE;
}
- headingFigure.getLabel().setText(Messages._UI_GRAPH_XSDSCHEMA + " : " + targetNamespaceValue); //$NON-NLS-1$
+ headingFigure.getLabel().setText(Messages._UI_GRAPH_XSDSCHEMA + " : " + targetNamespaceValue); //$NON-NLS-1$
}
public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
@@ -286,7 +271,7 @@
FillLayout fillLayout = new FillLayout(4);
fillLayout.setHorizontal(true);
containerFigure.setLayoutManager(fillLayout);
-
+
return containerFigure;
}
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 1e84920..95e2ac4 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
@@ -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
@@ -14,11 +14,23 @@
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.requests.LocationRequest;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.xsd.ui.internal.adapters.XSDSimpleTypeDefinitionAdapter;
+import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseTypeConnectingEditPart;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.CenteredConnectionAnchor;
@@ -31,7 +43,9 @@
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.HeadingFigure;
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.RoundedLineBorder;
import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.StructureFigure;
+import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
import org.eclipse.wst.xsd.ui.internal.common.util.XSDCommonUIUtils;
+import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDSimpleTypeDefinition;
public class XSDSimpleTypeEditPart extends BaseTypeConnectingEditPart
@@ -118,14 +132,17 @@
if (referenceTypePart != null)
{
- connectionFigure = new TypeReferenceConnection();
+ connectionFigure = new TypeReferenceConnection(true);
// draw a line out from the top
connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
// TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
// adding a label to the connection would help to
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
+ connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
+ connectionFigure.setConnectionRouter(new ManhattanConnectionRouter());
+ ((CenteredConnectionAnchor)connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor)connectionFigure.getTargetAnchor());
connectionFigure.setHighlight(false);
+
}
}
return connectionFigure;
@@ -155,4 +172,61 @@
}
return null;
}
+
+ public void performRequest(Request request)
+ {
+ if (request.getType() == RequestConstants.REQ_OPEN)
+ {
+ Object model = getModel();
+ if (request instanceof LocationRequest)
+ {
+ LocationRequest locationRequest = (LocationRequest)request;
+ Point p = locationRequest.getLocation();
+
+ if (getStructureFigure().hitTestHeader(p))
+ {
+ // TODO: !!! This should be moved to the adt-xsd package
+ //
+ if (model instanceof XSDSimpleTypeDefinitionAdapter)
+ {
+ XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter)model;
+ XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition)adapter.getTarget();
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+ Object schema = editorPart.getAdapter(XSDSchema.class);
+ ActionRegistry registry = getEditorActionRegistry(editorPart);
+ if (registry != null)
+ {
+ if (schema == st.getSchema())
+ {
+ IAction action = registry.getAction(SetInputToGraphView.ID);
+ action.run();
+ }
+ else
+ {
+ IAction action = registry.getAction(OpenInNewEditor.ID);
+ action.run();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
+ {
+ return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
+ }
+
+ protected boolean shouldDrawConnection()
+ {
+ if (getModel() instanceof IType)
+ {
+ if (((IType)getModel()).getSuperType() != null)
+ return true;
+ }
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java
index 81ec1d5..6eacf2f 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt-xsd/org/eclipse/wst/xsd/ui/internal/design/figures/CenteredIconFigure.java
@@ -36,6 +36,12 @@
setCornerDimensions(new Dimension(5,5));
}
+ public CenteredIconFigure(Image img)
+ {
+ this();
+ this.image = img;
+ }
+
public void refresh()
{
repaint();
@@ -64,7 +70,7 @@
protected void fillShape(Graphics g)
{
- super.fillShape(g);
+ super.fillShape(g);
if (image != null)
{
Rectangle r = getBounds();
@@ -94,5 +100,5 @@
{
setToolTip(null);
}
- }
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
new file mode 100644
index 0000000..9a75fc1
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/ADTFloatingToolbar.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.xsd.ui.internal.adt.design;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MouseEvent;
+import org.eclipse.draw2d.MouseListener;
+import org.eclipse.draw2d.MouseMotionListener;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BaseEditPart;
+import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
+import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
+import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
+
+public class ADTFloatingToolbar extends GraphicalViewerImpl
+{
+ protected IModel model;
+ protected boolean isDrilledDown;
+ protected ADTToolbarButton backToSchema;
+ protected ADTFloatingToolbarEditPart editPart;
+
+ public ADTFloatingToolbar(IModel model)
+ {
+ this.model = model;
+ editPart = new ADTFloatingToolbarEditPart();
+ editPart.setModel(model);
+ setContents(editPart);
+ }
+
+ public void setModel(IModel model)
+ {
+ this.model = model;
+ editPart.setModel(model);
+ }
+
+ public Control createControl(Composite composite)
+ {
+ Canvas canvas = new Canvas(composite, SWT.NONE);
+ canvas.setBackground(ColorConstants.white);
+ setControl(canvas);
+ return getControl();
+ }
+
+ public void refresh(boolean isDrilledDown)
+ {
+ this.isDrilledDown = isDrilledDown;
+ getContents().refresh();
+ }
+
+ protected void addToToolbar(IFigure figure)
+ {
+
+ }
+
+ protected class ADTFloatingToolbarEditPart extends BaseEditPart
+ {
+ protected IFigure createFigure()
+ {
+ Figure figure = new Figure();
+ ToolbarLayout tb = new ToolbarLayout(true);
+ tb.setStretchMinorAxis(false);
+ tb.setSpacing(3);
+ figure.setLayoutManager(tb);
+
+ backToSchema = new ADTToolbarButton(XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif"));
+ backToSchema.setToolTipText(Messages._UI_HOVER_BACK_TO_SCHEMA);
+ backToSchema.setBackgroundColor(ColorConstants.white);
+ figure.add(backToSchema);
+
+ addToToolbar(figure);
+
+ return figure;
+ }
+
+ protected void refreshVisuals()
+ {
+ super.refreshVisuals();
+ backToSchema.isEnabled = isDrilledDown;
+ if (isDrilledDown)
+ {
+ backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
+ }
+ else
+ {
+ backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
+ }
+ backToSchema.refresh();
+ }
+ }
+
+ protected void doAction(MouseEvent me)
+ {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
+
+ if (backToSchema.getBounds().contains(me.getLocation()))
+ {
+ SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
+ action.run();
+ }
+ }
+
+ protected class ADTToolbarButton extends CenteredIconFigure
+ {
+ protected MouseListener mouseListener;
+ public boolean isEnabled;
+
+ public ADTToolbarButton(Image img)
+ {
+ super();
+ this.image = img;
+
+ mouseListener = new MouseListener.Stub()
+ {
+ public void mousePressed(org.eclipse.draw2d.MouseEvent me)
+ {
+ if (isEnabled)
+ {
+ addFeedback();
+ }
+ }
+
+ public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
+ {
+ if (isEnabled)
+ {
+ removeFeedback();
+ doAction(me);
+ }
+ }
+ };
+ addMouseListener(mouseListener);
+ addMouseMotionListener(new MouseMotionListener.Stub()
+ {
+ public void mouseExited(MouseEvent me)
+ {
+ removeFeedback();
+ }
+ });
+ }
+
+ public void addFeedback()
+ {
+ setMode(CenteredIconFigure.SELECTED);
+ refresh();
+ }
+
+ public void removeFeedback()
+ {
+ setMode(CenteredIconFigure.NORMAL);
+ refresh();
+ }
+
+ public Rectangle getBounds()
+ {
+ Rectangle r = super.getBounds();
+ org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
+ return new Rectangle(r.x, r.y, rect.width + 8, rect.height + 8);
+ }
+
+ public Dimension getPreferredSize(int hint, int hint2)
+ {
+ org.eclipse.swt.graphics.Rectangle rect = image.getBounds();
+ return new Dimension(rect.width + 8, rect.height + 8);
+ }
+ }
+}
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 a428112..40b8be5 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
@@ -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
@@ -224,9 +224,11 @@
public void setInput(IADTObject object)
{
- RootContentEditPart rootContentEditPart = (RootContentEditPart)getRootEditPart().getContents();
+ // Force refresh of all edit parts
+ RootContentEditPart rootContentEditPart = new RootContentEditPart();
rootContentEditPart.setModel(object);
- rootContentEditPart.refresh();
+ setContents(rootContentEditPart);
+
if (object != null)
{
inputChangeManager.setSelection(new StructuredSelection(object));
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
index 85949f3..095a584 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
@@ -105,8 +105,6 @@
public void refresh() {
super.refresh();
- // Tell our children to refresh (note, this is NOT the function of
- // refreshChildren(), strangely enough)
for(Iterator i = getChildren().iterator(); i.hasNext(); )
{
Object obj = i.next();
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
index 00333ed..4044165 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.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,11 +24,22 @@
{
protected int spacing = 20;
protected int minorAlignment = -1;
+ protected boolean isHorizontal = false;
+
+ public ColumnEditPart()
+ {
+ }
+
+ public ColumnEditPart(boolean isHorizontal)
+ {
+ this.isHorizontal = isHorizontal;
+ }
protected IFigure createFigure()
{
Figure figure = new Figure();
- ToolbarLayout layout = new ToolbarLayout(false);
+ ToolbarLayout layout = new ToolbarLayout(isHorizontal);
+
if (minorAlignment != -1)
{
layout.setMinorAlignment(minorAlignment);
@@ -97,7 +108,6 @@
for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
{
EditPart editPart = (EditPart)i.next();
- //System.out.println("class " + editPart.getClass().getName());
if (editPart instanceof BaseTypeConnectingEditPart)
{
BaseTypeConnectingEditPart connectingEditPart = (BaseTypeConnectingEditPart)editPart;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
index 966acd8..0ff12cf 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.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,8 @@
package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
import java.util.Iterator;
+
+import org.eclipse.draw2d.ManhattanConnectionRouter;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
@@ -57,7 +59,7 @@
public TypeReferenceConnection createConnectionFigure()
{
- TypeReferenceConnection connectionFigure = null;
+ connectionFigure = null;
IComplexType complexType = (IComplexType)getModel();
IType type = complexType.getSuperType();
if (type != null)
@@ -65,13 +67,14 @@
AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetEditPart(type);
if (referenceTypePart != null)
{
- connectionFigure = new TypeReferenceConnection();
+ connectionFigure = new TypeReferenceConnection(true);
// draw a line out from the top
connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.TOP, 1));
// TODO (cs) need to draw the target anchor to look like a UML inheritance relationship
// adding a label to the connection would help to
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.BOTTOM, 0, 0));
+ connectionFigure.setConnectionRouter(new ManhattanConnectionRouter());
((CenteredConnectionAnchor)connectionFigure.getSourceAnchor()).setOther((CenteredConnectionAnchor)connectionFigure.getTargetAnchor());
connectionFigure.setHighlight(false);
}
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 f509c7d..ebd30fd 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
@@ -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 java.util.List;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.Panel;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
@@ -27,7 +28,6 @@
import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.design.layouts.ContainerLayout;
public class RootContentEditPart extends AbstractGraphicalEditPart
{
@@ -37,19 +37,21 @@
protected IFigure createFigure()
{
Panel panel = new Panel();
- // why do we need to use a container layout? can we just set a
- // margin border and get the same effect?
- ContainerLayout clayout = new ContainerLayout();
- clayout.setBorder(60);
- panel.setLayoutManager(clayout);
+ panel.setBorder(new MarginBorder(60));
+
+ ToolbarLayout panelLayout = new ToolbarLayout(false);
+ panelLayout.setStretchMinorAxis(true);
+ panel.setLayoutManager(panelLayout);
contentPane = new Figure();
panel.add(contentPane);
-
- ToolbarLayout layout = new ToolbarLayout(true);
- layout.setStretchMinorAxis(false);
- layout.setSpacing(100);
- contentPane.setLayoutManager(layout);
+
+ ToolbarLayout tb = new ToolbarLayout(false);
+ tb.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ tb.setStretchMinorAxis(true);
+ tb.setSpacing(40);
+ contentPane.setLayoutManager(tb);
+
return panel;
}
@@ -116,6 +118,11 @@
{
collections.add(new FocusTypeColumn(focusObject));
collections.add(new ReferencedTypeColumn(focusObject));
+
+ ToolbarLayout layout = new ToolbarLayout(true);
+ layout.setStretchMinorAxis(false);
+ layout.setSpacing(100);
+ contentPane.setLayoutManager(layout);
}
}
return collections;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
index db1f68c..054c9b2 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.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
@@ -43,6 +43,8 @@
{
protected List compartmentList = null;
protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
+ protected TypeReferenceConnection connectionFigure;
+ protected TypeReferenceConnection connectionFeedbackFigure;
/**
* TODO cs... I'm sure this has something to do with the way we wanted to rework compartment creation
@@ -155,16 +157,13 @@
public void performRequest(Request request)
{
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT ||
- request.getType() == RequestConstants.REQ_OPEN)
+ if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
{
-
- Object model = getModel();
if (request instanceof LocationRequest)
{
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-// uncomment for direct edit of name (add else)
+ // uncomment for direct edit of name (add else)
+// LocationRequest locationRequest = (LocationRequest)request;
+// Point p = locationRequest.getLocation();
// if (hitTest(getNameLabelFigure(), p))
// {
// LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
@@ -172,7 +171,15 @@
// adtDirectEditPolicy.setUpdateCommand(wrapper);
// manager.show();
// }
-
+ }
+ }
+ else if (request.getType() == RequestConstants.REQ_OPEN)
+ {
+ Object model = getModel();
+ if (request instanceof LocationRequest)
+ {
+ LocationRequest locationRequest = (LocationRequest)request;
+ Point p = locationRequest.getLocation();
if (getStructureFigure().hitTestHeader(p))
{
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
index b0d4c31..4a72280 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.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
@@ -12,6 +12,7 @@
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.ManhattanConnectionRouter;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.PolylineConnection;
@@ -32,6 +33,31 @@
setTargetDecoration(new PolygonDecoration());
}
+ public TypeReferenceConnection(boolean fill)
+ {
+ super();
+ PolygonDecoration dec = new PolygonDecoration()
+ {
+ protected void fillShape(Graphics g)
+ {
+ try
+ {
+ g.pushState();
+ g.setBackgroundColor(ColorConstants.white);
+ super.fillShape(g);
+ }
+ finally
+ {
+ g.popState();
+ }
+ }
+
+ };
+ dec.setFill(fill);
+ dec.setTemplate(PolygonDecoration.TRIANGLE_TIP);
+ dec.setScale(14,6);
+ setTargetDecoration(dec);
+ }
public void setConnectionRouter(ConnectionRouter cr)
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
index 4618c27..60a6fc1 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.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
@@ -19,10 +19,18 @@
import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
public class FocusTypeColumn extends AbstractModelCollection
-{
+{
+ protected boolean isFocusObject = false;
+
public FocusTypeColumn(IADTObject model)
{
+ super(model, "FocusTypeColumn"); //$NON-NLS-1$
+ }
+
+ public FocusTypeColumn(IADTObject model, boolean isFocusObject)
+ {
super(model, "FocusTypeColumn"); //$NON-NLS-1$
+ this.isFocusObject = isFocusObject;
}
public List getChildren()
@@ -44,4 +52,9 @@
}
return result;
}
+
+ public boolean isFocusObject()
+ {
+ return isFocusObject;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
index f1dee13..9aba411 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/ADTMultiPageEditor.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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.wst.xsd.ui.internal.adt.editor;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
@@ -17,7 +18,6 @@
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.editparts.ZoomManager;
import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -32,9 +32,9 @@
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.wst.xsd.ui.internal.adt.actions.BaseSelectionAction;
import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
+import org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar;
import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.ADTEditPartFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.BackToSchemaEditPart;
import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage;
import org.eclipse.wst.xsd.ui.internal.adt.outline.ADTLabelProvider;
@@ -45,6 +45,7 @@
protected IModel model;
private int currentPage = -1;
protected Button tableOfContentsButton;
+ protected ADTFloatingToolbar floatingToolbar;
/**
* Creates a multi-page editor example.
@@ -74,8 +75,9 @@
for (int i = 0; i < children.length; i++)
{
if (i == 0) // For the back to schema button
- {
- children[i].setBounds(rect.x + 10, rect.y + 10, 26, 26);
+ {
+ org.eclipse.draw2d.geometry.Rectangle r = ((GraphicalEditPart)floatingToolbar.getContents()).getFigure().getBounds();
+ children[i].setBounds(rect.x + 10, rect.y + 10, r.width, Math.max(24, r.height));
}
else if (i == 1 && modeCombo != null) // For the drop down toolbar
{
@@ -89,20 +91,16 @@
}
}
- GraphicalViewerImpl toolbarViewer;
- BackToSchemaEditPart backToSchemaEditPart;
protected Composite createGraphPageComposite()
{
Composite parent = new Composite(getContainer(), SWT.FLAT);
- parent.setLayout(new InternalLayout());
+ parent.setBackground(ColorConstants.white);
- // the palletViewer extends from this...maybe use it instead?
- toolbarViewer = new GraphicalViewerImpl();
- toolbarViewer.createControl(parent);
- toolbarViewer.getControl().setVisible(true);
- backToSchemaEditPart = new BackToSchemaEditPart(this);
- backToSchemaEditPart.setModel(getModel());
- toolbarViewer.setContents(backToSchemaEditPart);
+ parent.setLayout(new InternalLayout());
+
+ floatingToolbar = new ADTFloatingToolbar(getModel());
+ floatingToolbar.createControl(parent);
+ floatingToolbar.getControl().setVisible(true);
createViewModeToolbar(parent);
@@ -153,6 +151,7 @@
model = buildModel(); // (IFileEditorInput)getEditorInput());
initializeGraphicalViewer();
+ floatingToolbar.setModel(model);
int pageIndexToShow = getDefaultPageTypeIndex();
setActivePage(pageIndexToShow);
@@ -186,8 +185,7 @@
public void selectionChanged(SelectionChangedEvent event)
{
IStructuredSelection input = (IStructuredSelection)event.getSelection();
- backToSchemaEditPart.setEnabled(isTableOfContentsApplicable(input.getFirstElement()));
- backToSchemaEditPart.setModel(getModel());
+ floatingToolbar.refresh(isTableOfContentsApplicable(input.getFirstElement()));
}
});
return viewer;
@@ -249,8 +247,7 @@
{
XSDEditorPlugin.getPlugin().setDesignPageAsDefault();
}
- toolbarViewer = null;
- backToSchemaEditPart = null;
+ floatingToolbar = null;
super.dispose();
}
}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
index 2d0c7f3..8d86970 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/Messages.java
@@ -48,4 +48,5 @@
public static String _UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT;
public static String _UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME;
public static String _UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE;
-}
+ public static String _UI_HOVER_BACK_TO_SCHEMA;
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
index 0dfb286..88367bb 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/editor/messages.properties
@@ -31,4 +31,5 @@
_UI_CAPTURE_SCREEN_ACTION_TEXT = &Capture Screen
_UI_CAPTURE_SCREEN_ACTION_TOOLTIPTEXT = Capture screen
_UI_ACTION_CAPTURE_SCREEN_DEFAULT_FILE_NAME = ScreenCapture
-_UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE=Save Screen Capture Image
\ No newline at end of file
+_UI_ACTION_CAPTURE_SCREEN_FILE_SAVE_DIALOG_TITLE=Save Screen Capture Image
+_UI_HOVER_BACK_TO_SCHEMA=Show schema index view
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
index f0b86ef..ce3e39b 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/outline/ADTContentOutlinePage.java
@@ -10,10 +10,12 @@
*******************************************************************************/
package org.eclipse.wst.xsd.ui.internal.adt.outline;
+import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -21,10 +23,12 @@
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.part.MultiPageSelectionProvider;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewContextMenuProvider;
import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IModelProxy;
import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
@@ -172,6 +176,7 @@
{
public void selectionChanged(SelectionChangedEvent event)
{
+ updateStatusLine(getSite().getActionBars().getStatusLineManager(), event.getSelection());
if (event.getSelectionProvider() != ADTContentOutlinePage.this) //getTreeViewer())
{
StructuredSelection selection = (StructuredSelection)event.getSelection();
@@ -184,7 +189,7 @@
{
if (!(currentSelection.getFirstElement() instanceof IModelProxy))
{
- getTreeViewer().setSelection(event.getSelection(), true);
+ getTreeViewer().setSelection(event.getSelection(), true);
}
}
else
@@ -214,4 +219,53 @@
// }
// }
// }
+
+
+ void updateStatusLine(IStatusLineManager mgr, ISelection selection)
+ {
+ String text = null;
+ Image image = null;
+ ILabelProvider statusLineLabelProvider = new StatusLineLabelProvider(getTreeViewer());
+ if (statusLineLabelProvider != null && selection instanceof IStructuredSelection && !selection.isEmpty())
+ {
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ text = statusLineLabelProvider.getText(firstElement);
+ image = statusLineLabelProvider.getImage(firstElement);
+ }
+ if (image == null)
+ {
+ mgr.setMessage(text);
+ }
+ else
+ {
+ mgr.setMessage(image, text);
+ }
+ }
+
+ private class StatusLineLabelProvider extends JFaceNodeLabelProvider
+ {
+ TreeViewer treeViewer = null;
+
+ public StatusLineLabelProvider(TreeViewer viewer)
+ {
+ treeViewer = viewer;
+ }
+
+ public String getText(Object element)
+ {
+ if (element == null)
+ return null;
+
+ StringBuffer s = new StringBuffer();
+ s.append(labelProvider.getText(element));
+ return s.toString();
+ }
+
+ public Image getImage(Object element)
+ {
+ return labelProvider.getImage(element);
+ }
+ }
+
+
}
\ No newline at end of file
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 508c6df..34b4715 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
@@ -22,6 +22,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML;
import org.eclipse.wst.xsd.ui.internal.adt.design.ImageOverlayDescriptor;
+import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
import org.eclipse.xsd.XSDAnnotation;
import org.eclipse.xsd.XSDAttributeDeclaration;
import org.eclipse.xsd.XSDAttributeGroupDefinition;
@@ -66,8 +67,13 @@
{
if (xsdAnnotation.getApplicationInformation().size() > 0)
{
- ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage, isReadOnly);
- Image newImage = ovr.getImage();
+ Image newImage = XSDEditorPlugin.getDefault().getImageRegistry().get(input.getClass().getName() + isReadOnly);
+ if (newImage == null)
+ {
+ ImageOverlayDescriptor ovr = new ImageOverlayDescriptor(baseImage, isReadOnly);
+ newImage = ovr.getImage();
+ XSDEditorPlugin.getDefault().getImageRegistry().put(input.getClass().getName() + isReadOnly, newImage);
+ }
return newImage;
}
}