Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornitind2011-12-07 18:50:12 +0000
committernitind2011-12-07 18:50:12 +0000
commit92657ae25d54d2d8f3318aadfb4591b5bad0a1b0 (patch)
tree9f079da25506a9fb2170b884079e18910bcb2346 /bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts
parent5dc4a3721c537f53c492964027eb5fdd3618a960 (diff)
downloadwebtools.sourceediting-201112071853.tar.gz
webtools.sourceediting-201112071853.tar.xz
webtools.sourceediting-201112071853.zip
This commit was manufactured by cvs2svn to create tag 'v201112071853'.v201112071853
Diffstat (limited to 'bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts')
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java102
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java227
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java134
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java300
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java535
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java207
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java92
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java127
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java217
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java121
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java72
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java20
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java16
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java165
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java115
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java62
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java38
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java249
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java135
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java105
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java65
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java37
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java73
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java60
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java17
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java24
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java18
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java138
-rw-r--r--bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java28
34 files changed, 0 insertions, 3690 deletions
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
deleted file mode 100644
index 26426048ab..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTEditPartFactory.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.wst.xsd.ui.internal.adt.design.ADTFloatingToolbar.ADTFloatingToolbarModel;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class ADTEditPartFactory implements EditPartFactory
-{
- public EditPart createEditPart(EditPart context, Object model)
- {
- EditPart child = doCreateEditPart(context, model);
- checkChild(child, model);
- return child;
- }
-
- protected EditPart doCreateEditPart(EditPart context, Object model)
- {
- EditPart child = null;
- if (model instanceof Compartment)
- {
- child = new CompartmentEditPart();
- }
- else if (model instanceof RootHolder)
- {
- child = new RootHolderEditPart();
- }
- else if (model instanceof ADTFloatingToolbarModel)
- {
- child = new ADTFloatingToolbarEditPart(((ADTFloatingToolbarModel)model).getModel());
- }
- else if (model instanceof AbstractModelCollection)
- {
- child = new ColumnEditPart();
- if (model instanceof FocusTypeColumn)
- {
- ColumnEditPart columnEditPart = (ColumnEditPart)child;
- columnEditPart.setSpacing(60);
- columnEditPart.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- }
- }
- else if (model instanceof IComplexType)
- {
- child = new ComplexTypeEditPart();
- }
- else if (model instanceof IStructure)
- {
- child = new StructureEditPart();
- }
- else if (model instanceof IField)
- {
- if (context instanceof CompartmentEditPart)
- {
- child = new FieldEditPart();
- }
- else
- {
- child = new TopLevelFieldEditPart();
- }
- }
- else if (model instanceof IModel)
- {
- child = new RootContentEditPart();
- }
- return child;
- }
-
- /**
- * Subclasses can override and not check for null
- *
- * @param child
- * @param model
- */
- protected void checkChild(EditPart child, Object model)
- {
- if (child == null)
- {
- // Thread.dumpStack();
- }
- Assert.isNotNull(child);
- child.setModel(model);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
deleted file mode 100644
index 46b8be98cd..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ADTFloatingToolbarEditPart.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 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.editparts;
-
-import java.awt.event.KeyEvent;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FocusEvent;
-import org.eclipse.draw2d.FocusListener;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.KeyListener;
-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.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-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.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 ADTFloatingToolbarEditPart extends BaseEditPart
-{
- protected IModel model;
- protected boolean isDrilledDown;
- protected ADTToolbarButton backToSchema;
-
- public ADTFloatingToolbarEditPart(IModel model)
- {
- this.model = model;
- }
-
- 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);
- backToSchema.setFocusTraversable(true);
- figure.add(backToSchema);
- figure.setBounds(new Rectangle(0,0,24,24));
- addToToolbar(figure);
- return figure;
- }
-
- protected void addToToolbar(IFigure figure)
- {
-
- }
-
- public void setIsDrilledDown(boolean isDrilledDown)
- {
- this.isDrilledDown = isDrilledDown;
- }
-
- 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)
- {
- IEditorPart editorPart = getActionEditorPart();
-
- if (backToSchema.getBounds().contains(me.getLocation()))
- {
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
- }
-
- protected void doAction(org.eclipse.draw2d.KeyEvent ke)
- {
- IEditorPart editorPart = getActionEditorPart();
- SetInputToGraphView action = new SetInputToGraphView(editorPart, model);
- action.run();
- }
-
- private IEditorPart getActionEditorPart()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
- return editorPart;
- }
-
-
- protected class ADTToolbarButton extends CenteredIconFigure
- {
- protected MouseListener mouseListener;
- protected org.eclipse.draw2d.KeyListener keyListener;
- protected FocusListener focusListener;
- 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();
- }
- });
-
- keyListener = new KeyListener.Stub()
- {
- public void keyPressed(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- addFeedback();
- }
- }
-
- public void keyReleased(org.eclipse.draw2d.KeyEvent ke)
- {
- boolean isValidKey = (ke.keycode == KeyEvent.VK_SPACE);
- isValidKey = isValidKey || (ke.character == SWT.CR || ke.character == SWT.LF);
- if (isEnabled && isValidKey)
- {
- removeFeedback();
- doAction(ke);
- }
- }
- };
- addKeyListener(keyListener);
-
- focusListener = new FocusListener(){
-
- public void focusGained(FocusEvent fe) {
- setMode(CenteredIconFigure.HOVER);
- refresh();
- }
-
- public void focusLost(FocusEvent fe) {
- setMode(CenteredIconFigure.NORMAL);
- refresh();
- }
- };
-
- addFocusListener(focusListener);
- }
-
- 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/editparts/BackToSchemaEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
deleted file mode 100644
index f79ed6ce9a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BackToSchemaEditPart.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ADTMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-import org.eclipse.wst.xsd.ui.internal.editor.XSDEditorPlugin;
-
-public class BackToSchemaEditPart extends BaseEditPart implements IFeedbackHandler
-{
- protected MultiPageEditorPart multipageEditor;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected boolean isEnabled;
- protected CenteredIconFigure backToSchema;
- protected MouseListener mouseListener;
-
- public BackToSchemaEditPart(ADTMultiPageEditor multipageEditor)
- {
- super();
- this.multipageEditor = multipageEditor;
- }
-
- protected IFigure createFigure()
- {
- backToSchema = new CenteredIconFigure();
- backToSchema.setBackgroundColor(ColorConstants.white);
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- // TODO, look at why the editpolicy doesn't work
- mouseListener = new MouseListener()
- {
- public void mouseDoubleClicked(org.eclipse.draw2d.MouseEvent me)
- {
-
- }
-
- public void mousePressed(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- addFeedback();
- }
- }
-
- public void mouseReleased(org.eclipse.draw2d.MouseEvent me)
- {
- if (isEnabled)
- {
- removeFeedback();
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
- };
- backToSchema.addMouseListener(mouseListener);
- return backToSchema;
- }
-
-
- public void setEnabled(boolean isEnabled)
- {
- this.isEnabled = isEnabled;
- refreshVisuals();
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT || request.getType() == RequestConstants.REQ_OPEN)
- {
- SetInputToGraphView action = new SetInputToGraphView(multipageEditor, getModel());
- action.run();
- }
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- if (isEnabled)
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("elcl16/schemaview_co.gif");
- }
- else
- {
- backToSchema.image = XSDEditorPlugin.getPlugin().getIcon("dlcl16/schemaview_co.gif");
- }
- figure.refresh();
- }
-
- public void addFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.SELECTED);
- figure.refresh();
- }
-
- public void removeFeedback()
- {
- CenteredIconFigure figure = (CenteredIconFigure) getFigure();
- figure.setMode(CenteredIconFigure.NORMAL);
- figure.refresh();
- }
-
- public void deactivate()
- {
- backToSchema.removeMouseListener(mouseListener);
- super.deactivate();
- }
-
-}
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
deleted file mode 100644
index 357e63489f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseEditPart.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 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.editparts;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.editparts.ZoomListener;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFigureFactory;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class BaseEditPart extends AbstractGraphicalEditPart implements IActionProvider, IADTObjectListener, IFeedbackHandler
-{
- protected static final String[] EMPTY_ACTION_ARRAY = {};
- protected boolean isSelected = false;
- protected boolean hasFocus = false;
- protected static boolean isHighContrast = Display.getDefault().getHighContrast();
- protected AccessibleEditPart accessiblePart;
-
- public IFigureFactory getFigureFactory()
- {
- EditPartFactory factory = getViewer().getEditPartFactory();
- Assert.isTrue(factory instanceof IFigureFactory, "EditPartFactory must be an instanceof of IFigureFactory"); //$NON-NLS-1$
- return (IFigureFactory)factory;
- }
-
- public String[] getActions(Object object)
- {
- Object model = getModel();
- if (model instanceof IActionProvider)
- {
- return ((IActionProvider)model).getActions(object);
- }
- return EMPTY_ACTION_ARRAY;
- }
-
- protected void addActionsToList(List list, IAction[] actions)
- {
- for (int i = 0; i < actions.length; i++)
- {
- list.add(actions[i]);
- }
- }
-
- public void activate()
- {
- super.activate();
- Object model = getModel();
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.registerListener(this);
- }
-
- if (getZoomManager() != null)
- getZoomManager().addZoomListener(zoomListener);
-
- }
-
- public void deactivate()
- {
- try
- {
- Object model = getModel();
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.unregisterListener(this);
- }
-
- if (getZoomManager() != null)
- getZoomManager().removeZoomListener(zoomListener);
- }
- finally
- {
- super.deactivate();
- }
- }
-
- public void propertyChanged(Object object, String property)
- {
- refresh();
- }
-
- public void refresh() {
-
- boolean doUpdateDesign = doUpdateDesign();
- if (doUpdateDesign)
- {
- super.refresh();
- }
- }
-
- public void addFeedback()
- {
- isSelected = true;
- refreshVisuals();
- }
-
- public void removeFeedback()
- {
- isSelected = false;
- refreshVisuals();
- }
-
- public ZoomManager getZoomManager()
- {
- return ((ScalableRootEditPart)getRoot()).getZoomManager();
- }
-
- public Rectangle getZoomedBounds(Rectangle r)
- {
- double factor = getZoomManager().getZoom();
- int x = (int)Math.round(r.x * factor);
- int y = (int)Math.round(r.y * factor);
- int width = (int)Math.round(r.width * factor);
- int height = (int)Math.round(r.height * factor);
-
- return new Rectangle(x, y, width, height);
- }
-
- private ZoomListener zoomListener = new ZoomListener()
- {
- public void zoomChanged(double zoom)
- {
- handleZoomChanged();
- }
- };
-
- protected void handleZoomChanged()
- {
- refreshVisuals();
- }
-
- public IEditorPart getEditorPart()
- {
- IEditorPart editorPart = null;
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- if (workbenchWindow.getActivePage() != null)
- {
- editorPart = workbenchWindow.getActivePage().getActiveEditor();
- }
- }
- }
-// Assert.isNotNull(editorPart);
- return editorPart;
- }
-
- protected void createEditPolicies()
- {
- installEditPolicy(KeyBoardAccessibilityEditPolicy.KEY, new KeyBoardAccessibilityEditPolicy()
- {
- public EditPart getRelativeEditPart(EditPart editPart, int direction)
- {
- return doGetRelativeEditPart(editPart, direction);
- }
- });
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- return null;
- }
-
- protected boolean isFileReadOnly()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editor = page.getActiveEditor();
- if (editor != null)
- {
- IEditorInput editorInput = editor.getEditorInput();
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput))
- {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- // For https://bugs.eclipse.org/bugs/show_bug.cgi?id=218281
- // Don't want to refresh the design when changes are made in the source view.
- protected boolean doUpdateDesign()
- {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null)
- {
- IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- if (workbenchWindow != null)
- {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null)
- {
- IEditorPart editorPart = page.getActiveEditor();
- if (editorPart instanceof CommonMultiPageEditor)
- {
- CommonMultiPageEditor editor = (CommonMultiPageEditor) editorPart;
- GraphicalViewer viewer = (GraphicalViewer)editor.getAdapter(GraphicalViewer.class);
- // Need to ensure this is the same editor we are working with since the active editor may not be
- // the current, eg. at startup, there can be another XSD Editor open on the source page, so we could end
- // up not populating the design view initally
- if (getViewer() == viewer)
- {
- // If source page is active, don't update the design
- return !editor.isSourcePageActive();
- }
- }
- }
- }
- }
- return true;
- }
-
- /**
- * Try to get the italic font for the current font
- * @param font
- * @return
- */
- protected Font getItalicFont(Font font)
- {
- if (font != null && !font.isDisposed())
- {
- FontData[] fd = font.getFontData();
- if (fd.length > 0)
- {
- fd[0].setStyle(fd[0].getStyle() | SWT.ITALIC);
- return new Font(font.getDevice(), fd);
- }
- }
- return font;
- }
- protected AccessibleEditPart getAccessibleEditPart() {
-
- if (accessiblePart ==null)
- {
- accessiblePart = new AccessibleGraphicalEditPart(){
-
- public void getName(AccessibleEvent e) {
- e.result = getReaderText();
- }
- };
- }
- return accessiblePart;
- }
-public String getReaderText()
-{
- return "";
-}
-}
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
deleted file mode 100644
index e40978037d..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseFieldEditPart.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-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;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.ConnectableEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.TargetConnectionSpacingFigureEditPart;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.model.TargetConnectionSpaceFiller;
-import org.eclipse.wst.xsd.ui.internal.design.editpolicies.GraphNodeDragTracker;
-import org.eclipse.xsd.XSDNamedComponent;
-
-public class BaseFieldEditPart extends BaseTypeConnectingEditPart implements INamedEditPart, IAutoDirectEdit
-{
- protected TypeReferenceConnection connectionFigure;
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- protected TypeReferenceConnection connectionFeedbackFigure;
-
- protected IFigure createFigure()
- {
- IFieldFigure figure = getFigureFactory().createFieldFigure(getModel());
- figure.setForegroundColor(ColorConstants.black);
- return figure;
- }
-
- public IFieldFigure getFieldFigure()
- {
- return (IFieldFigure)figure;
- }
-
-
- protected boolean shouldDrawConnection()
- {
- boolean result = false;
-
- // For now we only want to produce outbound lines from a Field to a Type
- // when the field in contained in the 'focus' edit part
- for (EditPart parent = getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() instanceof FocusTypeColumn)
- {
- result = true;
- break;
- }
- }
- return result;
- }
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- // get the next column
- EditPart parent = columnEditPart.getParent();
- List columns = parent.getChildren();
- int index = columns.indexOf(columnEditPart);
- if (index + 1 < columns.size())
- {
- EditPart nextColumn = (EditPart)columns.get(index + 1);
- for (Iterator i = nextColumn.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- }
- return null;
- }
-
- private EditPart getTargetConnectionEditPart()
- {
- EditPart result = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- result = getTargetEP(type); //getTargetEditPart(type);
- }
- return result;
- }
-
- /**
- * Do not override
- * @param type
- * @return
- */
- protected EditPart getTargetEP(IType type)
- {
- return getTargetEditPart(type);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetConnectionEditPart();
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection();
-
- if (getFigure().getParent() == referenceTypePart.getFigure())
- {
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.LEFT, 1));
- }
- else
- {
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 5));
- }
- int targetAnchorYOffset = 8;
-
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset));
- connectionFigure.setHighlight(false);
- }
-
- return connectionFigure;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.EAST)
- {
- result = getTargetConnectionEditPart();
- }
- else if (direction == PositionConstants.WEST)
- {
- for (Iterator iter = getParent().getChildren().iterator(); iter.hasNext(); )
- {
- Object child = iter.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart groups = (SectionEditPart) child;
- for (Iterator i = groups.getChildren().iterator(); i.hasNext(); )
- {
- Object groupChild = i.next();
- EditPart connectable = getParentConnectableEditPart((EditPart)groupChild);
- if (connectable != null)
- {
- result = connectable;
- }
- }
- }
- }
- if (result == null)
- {
- result = this;
- }
- }
- else
- {
- result = super.doGetRelativeEditPart(editPart, direction);
- if (result == null)
- {
- result = ((BaseEditPart)getParent()).doGetRelativeEditPart(editPart, direction);
- }
- }
- return result;
- }
-
- protected ConnectableEditPart getParentConnectableEditPart(EditPart connectable)
- {
- if (connectable instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)connectable).getModel();
- if (space.getAdapter() == this.getModel())
- {
- return (ConnectableEditPart)connectable;
- }
- }
-
- for (Iterator i = connectable.getChildren().iterator(); i.hasNext(); )
- {
- Object child = i.next();
- if (child instanceof ConnectableEditPart)
- {
- ConnectableEditPart r = getParentConnectableEditPart((EditPart)child);
- if (r != null) return r;
- }
- else if (child instanceof TargetConnectionSpacingFigureEditPart)
- {
- TargetConnectionSpaceFiller space = (TargetConnectionSpaceFiller) ((TargetConnectionSpacingFigureEditPart)child).getModel();
- if (space.getAdapter() == this.getModel() && connectable instanceof ConnectableEditPart)
- {
- return (ConnectableEditPart)connectable;
- }
- }
- }
- return null;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- IFieldFigure figure = getFieldFigure();
- IField field = (IField) getModel();
-
- figure.getNameLabel().setText(field.getName());
- figure.getTypeLabel().setText(field.getTypeName());
- figure.refreshVisuals(getModel());
-
- figure.recomputeLayout();
-
- ((GraphicalEditPart)getRoot()).getFigure().invalidateTree();
- }
-
- public DragTracker getDragTracker(Request request)
- {
- return new GraphNodeDragTracker(this);
- }
-
- /*
- public IAction[] getActions(Object object)
- {
- // when a FieldEditPart is selected it provides it's own actions
- // as well as those of it's parent 'type' edit part
- List list = new ArrayList();
- EditPart compartment = getParent();
- if (compartment != null)
- {
- EditPart type = compartment.getParent();
- if (type != null && type instanceof IActionProvider)
- {
- IActionProvider provider = (IActionProvider)type;
- addActionsToList(list, provider.getActions(object));
- }
- }
- addActionsToList(list, super.getActions(object));
- IAction[] result = new IAction[list.size()];
- list.toArray(result);
- return result;
- }*/
-
- public Label getNameLabelFigure()
- {
- return getFieldFigure().getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
-
- public void performRequest(Request request)
- {
- if (((IADTObject)getModel()).isReadOnly() || isFileReadOnly())
- {
- return;
- }
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
- request.getType() == RequestConstants.REQ_OPEN)
- {
- IFieldFigure fieldFigure = getFieldFigure();
- Object model = getModel();
- if (request instanceof LocationRequest)
- {
- LocationRequest locationRequest = (LocationRequest)request;
- Point p = locationRequest.getLocation();
-
- if (hitTest(fieldFigure.getTypeLabel(), p))
- {
- TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager((IField)model, this, fieldFigure.getTypeLabel());
- TypeUpdateCommand typeUpdateCommand = new TypeUpdateCommand();
- typeUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
- manager.show();
- }
- else if (hitTest(fieldFigure.getNameLabel(), p))
- {
- directEditNameField();
- }
- }
- else {
- directEditNameField();
- }
- }
- }
-
- protected void directEditNameField()
- {
- if (isFileReadOnly()) return;
- Object model = getModel();
- IFieldFigure fieldFigure = getFieldFigure();
- if ( model instanceof IField)
- {
- IField field = (IField) model;
- if (field.isReference())
- {
- ElementReferenceDirectEditManager manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
- ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
- elementUpdateCommand.setDelegate(manager);
- adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
- manager.show();
- }
- else
- {
- LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- }
-
- public void doEditName(boolean addFromDesign)
- {
- if (!addFromDesign) return;
-
-// removeFeedback();
-
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- Object object = ((XSDBaseAdapter)getModel()).getTarget();
- if (object instanceof XSDNamedComponent)
- {
- Point p = getNameLabelFigure().getLocation();
- LabelEditManager manager = new LabelEditManager(BaseFieldEditPart.this, new LabelCellEditorLocator(BaseFieldEditPart.this, p));
- NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
- adtDirectEditPolicy.setUpdateCommand(wrapper);
- manager.show();
- }
- }
- };
- Display.getCurrent().asyncExec(runnable);
-
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_UPDATE_NAME);
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- IField field = (IField)getModel();
- Object newValue = request.getCellEditor().getValue();
- if (newValue instanceof String)
- {
- command = field.getUpdateNameCommand((String)newValue);
- }
- if (command != null)
- command.execute();
- }
- }
-
- class TypeUpdateCommand extends Command implements IADTUpdateCommand
- {
- protected ComboBoxCellEditorManager delegate;
- protected DirectEditRequest request;
-
- public TypeUpdateCommand()
- {
- super(Messages._UI_ACTION_UPDATE_TYPE);
- }
-
- public void setDelegate(ComboBoxCellEditorManager delegate)
- {
- this.delegate = delegate;
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public boolean canExecute()
- {
- IField field = (IField)getModel();
- Object newValue = ((CCombo)request.getCellEditor().getControl()).getText();
- if (newValue instanceof String)
- {
- return !newValue.equals(field.getTypeName());
- }
- return true;
- }
- }
-
- protected class ReferenceUpdateCommand extends Command implements IADTUpdateCommand
- {
- protected ComboBoxCellEditorManager delegate;
- protected DirectEditRequest request;
-
- public ReferenceUpdateCommand()
- {
- super(Messages._UI_ACTION_UPDATE_ELEMENT_REFERENCE);
- }
-
- public void setDelegate(ComboBoxCellEditorManager delegate)
- {
- this.delegate = delegate;
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- if (delegate != null)
- {
- delegate.performEdit(request.getCellEditor());
- }
- }
-
- public boolean canExecute()
- {
- return true;
- }
- }
-
-
- public void addFeedback()
- {
- // Put back connection figure so it won't get overlayed by other non highlighted connections
- if (connectionFigure != null && !isSelected)
- {
- connectionFeedbackFigure = new TypeReferenceConnection();
- connectionFeedbackFigure.setSourceAnchor(connectionFigure.getSourceAnchor());
- connectionFeedbackFigure.setTargetAnchor(connectionFigure.getTargetAnchor());
- connectionFeedbackFigure.setHighlight(true);
- getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFeedbackFigure);
- }
- super.addFeedback();
- getFieldFigure().addSelectionFeedback();
- }
-
- public void removeFeedback()
- {
- if (connectionFeedbackFigure != null)
- {
- connectionFeedbackFigure.setHighlight(false);
- getLayer(LayerConstants.FEEDBACK_LAYER).remove(connectionFeedbackFigure);
- }
- connectionFeedbackFigure = null;
- super.removeFeedback();
- getFieldFigure().removeSelectionFeedback();
- }
- public String getReaderText()
- {
- IFieldFigure fieldFigure = getFieldFigure();
-
- String name="";
- if (fieldFigure.getNameLabel() !=null&& fieldFigure.getNameLabel().getText().trim().length() > 0)
- name +=fieldFigure.getNameLabel().getText();
- if (fieldFigure.getNameAnnotationLabel() !=null && fieldFigure.getNameAnnotationLabel().getText().trim().length() > 0)
- name += " "+fieldFigure.getNameAnnotationLabel().getText();
- if (fieldFigure.getTypeLabel() !=null && fieldFigure.getTypeLabel().getText().trim().length() > 0)
- name += " type "+fieldFigure.getTypeLabel().getText();
- if (fieldFigure.getTypeAnnotationLabel() !=null && fieldFigure.getTypeAnnotationLabel().getText().trim().length() >0)
- name += " "+fieldFigure.getTypeAnnotationLabel().getText();
- return name;
-
- }
-}
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
deleted file mode 100644
index eebb8e6036..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BaseTypeConnectingEditPart.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts;
-
-import java.util.Iterator;
-import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IFeedbackHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.IADTUpdateCommand;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-/**
- * This class provides some base function to enable drawing connections to a referenced type
- *
- */
-public abstract class BaseTypeConnectingEditPart extends BaseEditPart implements IFeedbackHandler, IConnectionContainer
-{
- private TypeReferenceConnection connectionFigure;
-
- public void activate()
- {
- super.activate();
- }
-
- public void deactivate()
- {
- deactivateConnection();
- super.deactivate();
- }
-
- public void refreshConnections()
- {
- deactivateConnection();
- activateConnection();
- }
-
- protected void activateConnection()
- {
- // If appropriate, create our connectionFigure and add it to the appropriate layer
- if (connectionFigure == null && shouldDrawConnection())
- {
- //System.out.println("activateeConnection()-pre:" + getClass().getName());
- connectionFigure = createConnectionFigure();
- if (connectionFigure != null)
- {
- // Add our editpolicy as a listener on the connection, so it can stay in synch
- //connectionFigure.addPropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
- //connectionFigure.addMouseListener(this);
- getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure);
- }
- }
- }
-
- protected void deactivateConnection()
- {
- // if we have a connection, remove it
- if (connectionFigure != null)
- {
- getLayer(LayerConstants.CONNECTION_LAYER).remove(connectionFigure);
- // Remove our editpolicy listener(s)
- //connectionFigure.removePropertyChangeListener((AttributeSelectionFeedbackPolicy) getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE));
- //connectionFigure.removeMouseListener(this);
- connectionFigure = null;
- }
- }
-
- protected boolean shouldDrawConnection()
- {
- return true;
- }
-
- public abstract TypeReferenceConnection createConnectionFigure();
-
- public void addFeedback()
- {
- if (connectionFigure != null)
- {
- connectionFigure.setHighlight(true);
- }
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- if (connectionFigure != null)
- {
- connectionFigure.setHighlight(false);
- }
- super.removeFeedback();
- }
-
- protected class NameUpdateCommandWrapper extends Command implements IADTUpdateCommand
- {
- Command command;
- protected DirectEditRequest request;
-
- public NameUpdateCommandWrapper()
- {
- super(Messages._UI_ACTION_UPDATE_NAME);
- }
-
- public void setRequest(DirectEditRequest request)
- {
- this.request = request;
- }
-
- public void execute()
- {
- IType iType = (IType)getModel();
- Object newValue = request.getCellEditor().getValue();
- if (newValue instanceof String)
- {
- command = iType.getUpdateNameCommand((String)newValue);
- }
- if (command != null)
- command.execute();
- }
- }
-
- public boolean hitTest(IFigure target, Point location)
- {
- Rectangle b = target.getBounds().getCopy();
- target.translateToAbsolute(b);
- return b.contains(location);
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == PositionConstants.WEST)
- {
- result = getConnectionEditPart(PositionConstants.WEST);
- }
- else if (direction == PositionConstants.EAST)
- {
- result = getConnectionEditPart(PositionConstants.EAST);
- }
- return result;
- }
-
- private EditPart getConnectionEditPart(int direction)
- {
- // find the first connection that targets this editPart
- // navigate backward along the connection (to the left) to find the source edit part
- EditPart result = null;
- for (Iterator i = getLayer(LayerConstants.CONNECTION_LAYER).getChildren().iterator(); i.hasNext(); )
- {
- Figure figure = (Figure)i.next();
- if (figure instanceof TypeReferenceConnection)
- {
- TypeReferenceConnection typeReferenceConnection = (TypeReferenceConnection)figure;
- ConnectionAnchor thisAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- thisAnchor = typeReferenceConnection.getSourceAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- thisAnchor = typeReferenceConnection.getTargetAnchor();
- }
- if (thisAnchor != null && thisAnchor.getOwner() == getFigure())
- {
- ConnectionAnchor outAnchor = null;
- if (direction == PositionConstants.EAST)
- {
- outAnchor = typeReferenceConnection.getTargetAnchor();
- }
- else if (direction == PositionConstants.WEST)
- {
- outAnchor = typeReferenceConnection.getSourceAnchor();
- }
-
- if (outAnchor != null)
- {
- IFigure sourceFigure = outAnchor.getOwner();
- EditPart part = null;
- while (part == null && sourceFigure != null)
- {
- part = (EditPart)getViewer().getVisualPartMap().get(sourceFigure);
- sourceFigure = sourceFigure.getParent();
- }
- result = part;
- break;
- }
- }
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
deleted file mode 100644
index 89a85deaae..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/BoxEditPart.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-import java.util.List;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.SimpleDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.outline.ITreeElement;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-public abstract class BoxEditPart extends BaseTypeConnectingEditPart //IFeedbackHandler
-{
- protected List compartmentList = null;
- protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy();
-
- protected Compartment[] getCompartments()
- {
- return null;
- }
-
- protected IFigure createFigure()
- {
- BoxFigure figure = new BoxFigure();
- LineBorder boxLineBorder = new LineBorder(1);
- figure.setBorder(boxLineBorder);
- ToolbarLayout toolbarLayout = new ToolbarLayout();
- toolbarLayout.setStretchMinorAxis(true);
- figure.setLayoutManager(toolbarLayout);
- // we should organize ITreeElement and integrate it with the facade
- if (getModel() instanceof ITreeElement)
- {
- figure.getNameLabel().setIcon(((ITreeElement)getModel()).getImage());
- }
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return ((BoxFigure)getFigure()).getContentPane();
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy);
- }
-
-
- public void addFeedback()
- {
- BoxFigure boxFigure = (BoxFigure)figure;
- LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
- boxFigureLineBorder.setWidth(2);
- boxFigureLineBorder.setColor(ColorConstants.darkBlue);
- boxFigure.getHeadingFigure().setSelected(true);
- figure.repaint();
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- BoxFigure boxFigure = (BoxFigure)figure;
- LineBorder boxFigureLineBorder = (LineBorder)boxFigure.getBorder();
- boxFigureLineBorder.setWidth(1);
- boxFigureLineBorder.setColor(ColorConstants.black);
- boxFigure.getHeadingFigure().setSelected(false);
- figure.repaint();
- super.removeFeedback();
- }
-
- protected ActionRegistry getEditorActionRegistry(IEditorPart editor)
- {
- return (ActionRegistry) editor.getAdapter(ActionRegistry.class);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
deleted file mode 100644
index 0c93b9d691..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CenteredConnectionAnchor.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-import org.eclipse.draw2d.AbstractConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.xsd.ui.internal.design.figures.CenteredIconFigure;
-
-public class CenteredConnectionAnchor extends AbstractConnectionAnchor
-{
- public static final int TOP = 0;
- public static final int BOTTOM = 1;
- public static final int LEFT = 2;
- public static final int RIGHT = 3;
-
- public static final int HEADER_LEFT = 4;
- public static final int HEADER_RIGHT = 5;
-
- private int location;
- private int inset;
- private int offset = 0;
- private CenteredConnectionAnchor other;
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset)
- {
- super(owner);
- this.location = location;
- this.inset = inset;
- }
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset, int offset)
- {
- this(owner, location, inset);
- this.offset = offset;
- }
-
- public Point getLocation(Point reference)
- {
- Rectangle r = getOwner().getBounds();
- int x, y;
- switch (location)
- {
- case TOP:
- x = r.right() - r.width / 2 + offset;
- y = r.y + inset;
- break;
- case BOTTOM:
- x = r.right() - r.width / 2 + offset;
- y = r.bottom() - inset;
- break;
- case LEFT:
- x = r.x + inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case RIGHT:
- x = r.right() - inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case HEADER_LEFT:
- x = r.x + inset;
- y = r.y + offset;
- break;
- case HEADER_RIGHT:
- x = r.right() - inset;
- y = r.y + offset;
- break;
-
- default:
- x = r.right() - r.width / 2;
- y = r.bottom() - r.height / 2;
- }
- Point p = new Point(x, y);
-
- if (!(getOwner() instanceof CenteredIconFigure))
- {
- getOwner().translateToAbsolute(p);
- }
- else
- {
- getOwner().translateToAbsolute(p);
- }
-
- if (other != null)
- {
- // if within only one pixel of being vertical, we straighten up the line
- Point p2 = other.getLocation(null);
- if (Math.abs(p2.x - p.x) <= 1)
- {
- p.x = p2.x;
- }
- }
- return p;
- }
-
- public Point getReferencePoint()
- {
- return getLocation(null);
- }
-
- public void setOther(CenteredConnectionAnchor other)
- {
- this.other = other;
- }
-
-}
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
deleted file mode 100644
index 8eb4090fbc..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ColumnEditPart.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.gef.EditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class ColumnEditPart extends BaseEditPart
-{
- 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(isHorizontal);
-
- if (minorAlignment != -1)
- {
- layout.setMinorAlignment(minorAlignment);
- }
- layout.setStretchMinorAxis(false);
- layout.setSpacing(spacing);
- figure.setLayoutManager(layout);
- return figure;
- }
-
- public void setSpacing(int spacing)
- {
- this.spacing = spacing;
- if (figure != null)
- {
- ((ToolbarLayout)figure.getLayoutManager()).setSpacing(spacing);
- }
- }
-
- public IComplexType getComplexType()
- {
- return (IComplexType)getModel();
- }
-
- protected void createEditPolicies()
- {
- // TODO Auto-generated method stub
- }
-
- protected List getModelChildren()
- {
- AbstractModelCollection collection = (AbstractModelCollection)getModel();
- return collection.getChildren();
- }
-
- public int getMinorAlignment()
- {
- return minorAlignment;
- }
-
- public void setMinorAlignment(int minorAlignment)
- {
- this.minorAlignment = minorAlignment;
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- if (getModel() instanceof ReferencedTypeColumn)
- {
- if (getParent().getChildren().size() > 0)
- {
- EditPart editPart = (EditPart)getParent().getChildren().get(0);
- refreshConnections(editPart);
- }
- }
- else
- {
- refreshConnections(this);
- }
- }
-
-
- public void refreshConnections(EditPart parent)
- {
- for (Iterator i = parent.getChildren().iterator(); i.hasNext(); )
- {
- EditPart editPart = (EditPart)i.next();
- if (editPart instanceof BaseTypeConnectingEditPart)
- {
- BaseTypeConnectingEditPart connectingEditPart = (BaseTypeConnectingEditPart)editPart;
- connectingEditPart.refreshConnections();
- }
- refreshConnections(editPart);
- }
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
-
-
-
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
deleted file mode 100644
index 15f56e892e..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/CompartmentEditPart.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Annotation;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.ICompartmentFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-
-// TODO (cs) common-up with BoxEditPart (?)
-public class CompartmentEditPart extends BaseEditPart // implements
- // IFeedbackHandler
-{
- protected Annotation annotation = new Annotation();
-
- protected IFigure createFigure()
- {
- ICompartmentFigure figure = getFigureFactory().createCompartmentFigure(getModel());
- return figure;
- }
-
- public IFigure getContentPane()
- {
- return getCompartmentFigure().getContentPane();
- }
-
- public boolean hasContent()
- {
- // since the annotation always takes up 1 child, here's a convenience method to figure out if
- return getChildren().size() > 1;
- }
-
- List getChildrenSansAnnotation()
- {
- List children = new ArrayList();
- children.addAll(getChildren());
- for (Iterator i = children.iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == annotation)
- {
- i.remove();
- break;
- }
- }
- return children;
- }
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
-
- // we compute the children sans the annotation EditPart
- // since the annotation EditPart confuses our up/down key handling
- List children = getChildrenSansAnnotation();
- if (children.contains(editPart))
- {
- if (direction == KeyBoardAccessibilityEditPolicy.OUT_TO_PARENT)
- {
- Compartment compartment = (Compartment)getModel();
- for (EditPart parent = editPart.getParent(); parent != null; parent = parent.getParent())
- {
- if (parent.getModel() == compartment.getOwner())
- {
- result = parent;
- break;
- }
- }
- }
- else if (direction == PositionConstants.SOUTH)
- {
- int size = children.size();
- if (size > 0)
- {
- if (children.get(size - 1) == editPart)
- {
- CompartmentEditPart nextCompartment = (CompartmentEditPart)EditPartNavigationHandlerUtil.getNextSibling(CompartmentEditPart.this);
- if (nextCompartment != null && nextCompartment.getChildrenSansAnnotation().size() > 0)
- {
- result = EditPartNavigationHandlerUtil.getFirstChild(nextCompartment);
- }
- else
- {
- result = editPart;
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getNextSibling(editPart);
- }
- else if (direction == PositionConstants.NORTH)
- {
- if (EditPartNavigationHandlerUtil.getFirstChild(CompartmentEditPart.this) == editPart)
- {
- EditPart prevCompartment = EditPartNavigationHandlerUtil.getPrevSibling(CompartmentEditPart.this);
- if (prevCompartment instanceof CompartmentEditPart)
- {
- List prevCompListChildren = ((CompartmentEditPart)prevCompartment).getChildrenSansAnnotation();
- int size = prevCompListChildren.size();
- if (size > 0)
- {
- result = (EditPart)prevCompartment.getChildren().get(size - 1);
- }
- }
- }
- if (result == null) result = EditPartNavigationHandlerUtil.getPrevSibling(editPart);
- }
- }
- return result;
- }
-
- protected void addChildVisual(EditPart childEditPart, int index)
- {
- Object model = childEditPart.getModel();
-
- IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
-
- if (model instanceof IField)
- {
- getCompartmentFigure().getContentPane().add(child, index);
- return;
- }
- else if (model instanceof Annotation)
- {
- getCompartmentFigure().getAnnotationPane().add(child);
- return;
- }
- super.addChildVisual(childEditPart, index);
- }
-
- protected void removeChildVisual(EditPart childEditPart)
- {
- Object model = childEditPart.getModel();
- IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
-
- if (model instanceof IField)
- {
- getCompartmentFigure().getContentPane().remove(child);
- return;
- }
- else if (model instanceof Annotation)
- {
- getCompartmentFigure().getAnnotationPane().remove(child);
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-
- protected Compartment getCompartment()
- {
- return (Compartment) getModel();
- }
-
- protected List getModelChildren()
- {
- List children = getCompartment().getChildren();
- children.add(annotation);
- return children;
- }
-
- public void setModel(Object model)
- {
- super.setModel(model);
- annotation.setCompartment(getCompartment());
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- // ((AbstractGraphicalEditPart)getParent()).getContentPane().invalidate();
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- }
-
- public void addFeedback()
- {
- // getFigure().setBackgroundColor(ColorConstants.blue);
- // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.black);
- getFigure().repaint();
- }
-
- public void removeFeedback()
- {
- // getFigure().setBackgroundColor(ColorConstants.lightBlue);
- // ((CompartmentFigure)getFigure()).setBorderColor(ColorConstants.lightGray);
- getFigure().repaint();
- }
-
- public ICompartmentFigure getCompartmentFigure()
- {
- return (ICompartmentFigure)figure;
- }
-
- public void addNotify()
- {
- super.addNotify();
- getCompartmentFigure().editPartAttached(this);
- }
-}
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
deleted file mode 100644
index 0eceb08ac1..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/ComplexTypeEditPart.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class ComplexTypeEditPart extends StructureEditPart
-{
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- if (getParent().getModel() instanceof FocusTypeColumn)
- {
- IComplexType complexType = (IComplexType)getModel();
- return complexType.getSuperType() != null;
- }
- return false;
- }
-
-
- private EditPart getTargetEditPart(IType type)
- {
- ColumnEditPart columnEditPart = null;
- for (EditPart editPart = this; editPart != null; editPart = editPart.getParent())
- {
- if (editPart instanceof ColumnEditPart)
- {
- columnEditPart = (ColumnEditPart)editPart;
- break;
- }
- }
- if (columnEditPart != null)
- {
- for (Iterator i = columnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- EditPart child = (EditPart)i.next();
- if (child.getModel() == type)
- {
- return child;
- }
- }
- }
- return null;
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- connectionFigure = null;
- IComplexType complexType = (IComplexType)getModel();
- IType type = complexType.getSuperType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getTargetEditPart(type);
- if (referenceTypePart != null)
- {
- 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);
- }
- }
- return connectionFigure;
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- Label label = getNameLabelFigure();
- IComplexType complexType = (IComplexType)getModel();
- if (complexType.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
deleted file mode 100644
index c234b65f5c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/EditPartNavigationHandlerUtil.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-import java.util.List;
-import org.eclipse.gef.EditPart;
-
-
-public class EditPartNavigationHandlerUtil
-{
- public static EditPart getFirstChild(EditPart editPart)
- {
- EditPart result = null;
- if (editPart.getChildren().size() > 0)
- {
- result = (EditPart)editPart.getChildren().get(0);
- }
- return result;
- }
-
- public static EditPart getLastChild(EditPart editPart)
- {
- EditPart result = null;
- int size = editPart.getChildren().size();
- if (size > 0)
- {
- result = (EditPart)editPart.getChildren().get(size - 1);
- }
- return result;
- }
-
- public static EditPart getNextSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index + 1 < children.size())
- {
- result = (EditPart)children.get(index + 1);
- }
- }
- return result;
- }
-
- public static EditPart getPrevSibling(EditPart editPart)
- {
- EditPart result = null;
- EditPart parent = editPart.getParent();
- if (parent != null)
- {
- List children = parent.getChildren();
- int index = children.indexOf(editPart);
- if (index - 1 >= 0)
- {
- // if this is the first child
- //
- result = (EditPart)children.get(index - 1);
- }
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
deleted file mode 100644
index f17dd39853..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/FieldEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-
-public class FieldEditPart extends BaseFieldEditPart
-{
- public void addNotify()
- {
- super.addNotify();
- getFieldFigure().editPartAttached(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
deleted file mode 100644
index bcd3186980..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IAutoDirectEdit.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.editparts;
-
-/**
- * Edit parts that can be direct editable
- *
- */
-public interface IAutoDirectEdit
-{
- public void doEditName(boolean addFromDesign);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
deleted file mode 100644
index 176125351a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IConnectionContainer.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-public interface IConnectionContainer
-{
- public void refreshConnections();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
deleted file mode 100644
index 7f7a5ae74c..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/IHolderEditPart.java
+++ /dev/null
@@ -1,16 +0,0 @@
-/*******************************************************************************
- * 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.editparts;
-
-public interface IHolderEditPart
-{
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
deleted file mode 100644
index b186c28124..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/INamedEditPart.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-
-public interface INamedEditPart
-{
- public Label getNameLabelFigure();
-
- public void performDirectEdit(Point cursorLocation);
-}
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
deleted file mode 100644
index d2677d4a12..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootContentEditPart.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 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.editparts;
-
-import java.util.ArrayList;
-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.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-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;
-
-public class RootContentEditPart extends BaseEditPart
-{
- List collections = null;
- Figure contentPane;
-
- protected IFigure createFigure()
- {
- Panel panel = new Panel();
- panel.setBorder(new MarginBorder(60));
-
- ToolbarLayout panelLayout = new ToolbarLayout(false);
- panelLayout.setStretchMinorAxis(true);
- panel.setLayoutManager(panelLayout);
-
- contentPane = new Figure();
- panel.add(contentPane);
-
- ToolbarLayout tb = new ToolbarLayout(false);
- tb.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- tb.setStretchMinorAxis(true);
- tb.setSpacing(40);
- contentPane.setLayoutManager(tb);
-
- return panel;
- }
-
- public IFigure getContentPane()
- {
- return contentPane;
- }
-
-
- public IComplexType getSelectedComplexType()
- {
- IComplexType result = null;
- IModel model = (IModel)getModel();
- List types = model.getTypes();
- if (types.size() > 0)
- {
- if (types.get(0) instanceof IComplexType)
- result = (IComplexType)types.get(0);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- // TODO Auto-generated method stub
- }
-
- protected List getModelChildren()
- {
- collections = new ArrayList();
- if (getModel() != null)
- {
- Object obj = getModel();
- IADTObject focusObject = null;
- if (obj instanceof IStructure)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- focusObject = (IStructure)obj;
- }
- }
- else if (obj instanceof IField)
- {
- focusObject = (IField)obj;
- }
- else if (obj instanceof IModel)
- {
- focusObject = (IModel)obj;
- collections.add(focusObject);
- return collections;
- }
- else if (obj instanceof IType)
- {
- if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IType)obj;
- }
- }
- }
- else if (obj instanceof IGraphElement)
- {
- if (((IGraphElement)obj).isFocusAllowed())
- {
- focusObject = (IADTObject)obj;
- collections.add(focusObject);
- return collections;
- }
- }
- if (focusObject != null)
- {
- RootHolder holder = new RootHolder(focusObject);
- collections.add(holder);
- return collections;
- }
- }
- return collections;
- }
-
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.setInput() instead.
- */
- public void setInput(Object component)
- {
- setModel(component);
- refresh();
- }
-
- /**
- * @deprecated Don't call this method. Use DesignViewGraphicalViewer.getInput() instead.
- */
- public Object getInput()
- {
- return getModel();
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=252589
- public void activate()
- {
- super.activate();
- Object model = getModel();
- // The schema adapter doesn't have to notify the RootContentEditPart of it changes
- if (model instanceof IADTObject)
- {
- IADTObject object = (IADTObject)model;
- object.unregisterListener(this);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
deleted file mode 100644
index fd8758129f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootEditPart.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import org.eclipse.draw2d.BendpointConnectionRouter;
-import org.eclipse.draw2d.ConnectionLayer;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Layer;
-import org.eclipse.draw2d.LayeredPane;
-import org.eclipse.draw2d.RectangleFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewerGraphicConstants;
-
-public class RootEditPart extends ScalableRootEditPart implements org.eclipse.gef.RootEditPart
-{
- public void activate()
- {
- super.activate();
- // Set up Connection layer with a router, if it doesn't already have one
- ConnectionLayer connectionLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
- if (connectionLayer != null)
- {
- connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
- }
-
- Figure figure = (Figure)getLayer(LayerConstants.FEEDBACK_LAYER);
- if (figure != null)
- {
- if (getViewer() instanceof ScrollingGraphicalViewer)
- {
- //ScrollingGraphicalViewer sgv = (ScrollingGraphicalViewer)getViewer();
- //IndexFigure indexFigure = new IndexFigure(sgv);
- //figure.add(indexFigure);
- //getViewer().addPropertyChangeListener(indexFigure);
- }
- }
- refresh();
- }
-
- protected LayeredPane createPrintableLayers()
- {
- LayeredPane pane = super.createPrintableLayers();
- Layer layer = new ScaledHandleLayer();
- layer.setPreferredSize(new Dimension(5, 5));
- pane.add(layer, DesignViewerGraphicConstants.SCALED_HANDLE_LAYER);
- return pane;
- }
-
-
- class ScaledHandleLayer extends Layer
- {
- ScaledHandleLayer()
- {
- setEnabled(true);
- }
- /**
- * @see org.eclipse.draw2d.Figure#getPreferredSize(int, int)
- */
- public Dimension getPreferredSize(int wHint, int hHint)
- {
- Rectangle rect = new Rectangle();
- for (int i = 0; i < getChildren().size(); i++)
- rect.union(((IFigure)getChildren().get(i)).getBounds());
- return rect.getSize();
- }
- }
-
- class IndexFigure extends RectangleFigure implements PropertyChangeListener
- {
- EditPart editPart;
- ScrollingGraphicalViewer sgv;
- public IndexFigure(ScrollingGraphicalViewer sgv)
- {
- this.sgv = sgv;
- ((FigureCanvas)sgv.getControl()).getViewport().getHorizontalRangeModel().addPropertyChangeListener(this);
- ((FigureCanvas)sgv.getControl()).getViewport().getVerticalRangeModel().addPropertyChangeListener(this);
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- translateToAbsolute(bounds);
- setBounds(bounds);
- }
- public void propertyChange(PropertyChangeEvent evt)
- {
- System.out.println("scroll-change");
- Rectangle bounds = new Rectangle(0, 0, 40, 40);
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- setBounds(bounds);
- }
-
- public Rectangle getBounds()
- {
- Point p = ((FigureCanvas)sgv.getControl()).getViewport().getViewLocation();
- bounds.translate(p);
- return super.getBounds().getCopy().translate(p);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
deleted file mode 100644
index a4ad059af0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/RootHolderEditPart.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.editparts;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Panel;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.FocusTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.ReferencedTypeColumn;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolderEditPart extends BaseEditPart implements IHolderEditPart
-{
- protected Panel panel;
-
- public RootHolderEditPart()
- {
- }
-
- protected IFigure createFigure()
- {
- panel = new Panel();
- ToolbarLayout layout = new ToolbarLayout(true);
- layout.setStretchMinorAxis(false);
- layout.setSpacing(100);
- panel.setLayoutManager(layout);
-
- return panel;
- }
-
- protected List getModelChildren()
- {
- List collections = new ArrayList();
- RootHolder holder = (RootHolder)getModel();
- IADTObject focusObject = holder.getModel();
- collections.add(new FocusTypeColumn(focusObject));
- collections.add(new ReferencedTypeColumn(focusObject));
- return collections;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
deleted file mode 100644
index a25af476be..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/SectionEditPart.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.editparts;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IComplexType;
-
-public class SectionEditPart extends BaseEditPart
-{
- protected IComplexType complexType;
-
- protected IFigure createFigure()
- {
- Figure fig = new Figure();
- fig.setLayoutManager(new ToolbarLayout());
- return fig;
- }
-
- protected void createEditPolicies()
- {
-
- }
-
- public boolean isSelectable()
- {
- return false;
- }
-}
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
deleted file mode 100644
index 167bfcfc8a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/StructureEditPart.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-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.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.XSDComplexTypeDefinitionAdapter;
-import org.eclipse.wst.xsd.ui.internal.adt.actions.SetInputToGraphView;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.Compartment;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.figures.IStructureFigure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.common.actions.OpenInNewEditor;
-import org.eclipse.wst.xsd.ui.internal.design.editparts.SpaceFillerForFieldEditPart;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDSchema;
-
-public class StructureEditPart extends BaseTypeConnectingEditPart implements INamedEditPart
-{
- 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
- * I suppose we could have subclasses override this method instead of getModelChildren()
- *
- * @deprecated
- */
- protected Compartment[] getCompartments()
- {
- return null;
- }
-
- protected IFigure createFigure()
- {
- IStructureFigure figure = getFigureFactory().createStructureFigure(getModel());
- return figure;
- }
-
- public IStructureFigure getStructureFigure()
- {
- return (IStructureFigure)getFigure();
- }
-
- public IFigure getContentPane()
- {
- return getStructureFigure().getContentPane();
- }
-
-
- public EditPart doGetRelativeEditPart(EditPart editPart, int direction)
- {
- EditPart result = null;
- if (direction == KeyBoardAccessibilityEditPolicy.IN_TO_FIRST_CHILD)
- {
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- CompartmentEditPart compartment = (CompartmentEditPart)i.next();
- if (compartment.hasContent())
- {
- for (Iterator contentChildren = compartment.getChildren().iterator(); contentChildren.hasNext(); )
- {
- Object child = contentChildren.next();
- if (child instanceof SectionEditPart)
- {
- SectionEditPart part = (SectionEditPart) child;
- result = (EditPart)part.getChildren().get(0);
- return result;
- }
- else if (child instanceof BaseFieldEditPart && (!(child instanceof SpaceFillerForFieldEditPart)))
- {
- result = (EditPart)child;
- return result;
- }
- }
- }
- }
- }
- else
- {
- return super.doGetRelativeEditPart(editPart, direction);
- }
- return result;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- }
-
- protected IStructure getStructure()
- {
- return (IStructure)getModel();
- }
-
- protected List getModelChildren()
- {
- if (compartmentList == null)
- {
- compartmentList = new ArrayList();
-
- // TODO.. this needs to be moved to the xsd specific version of this class
- compartmentList.add(new Compartment(getStructure(), "attribute")); //$NON-NLS-1$
- compartmentList.add(new Compartment(getStructure(), "element")); //$NON-NLS-1$
- }
- return compartmentList;
- }
-
- protected void refreshChildren()
- {
- super.refreshChildren();
- //getFigure().invalidateTree();
- }
-
- protected void refreshVisuals()
- {
- super.refreshVisuals();
- getStructureFigure().refreshVisuals(getModel());
- }
-
- public void addFeedback()
- {
- getStructureFigure().addSelectionFeedback();
- super.addFeedback();
- }
-
- public void removeFeedback()
- {
- getStructureFigure().removeSelectionFeedback();
- super.removeFeedback();
- }
-
- public Label getNameLabelFigure()
- {
- return getStructureFigure().getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT)
- {
- if (request instanceof LocationRequest)
- {
- // 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));
-// NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
-// 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))
- {
- // TODO: !!! This should be moved to the adt-xsd package
- //
- if (model instanceof XSDComplexTypeDefinitionAdapter)
- {
- XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter)model;
- XSDComplexTypeDefinition ct = (XSDComplexTypeDefinition)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 == ct.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()
- {
- return false;
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- return null;
- }
- public String getReaderText()
- {
- // return getStructureFigure().getNameLabel().getText();
- return getNameLabelFigure().getText();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
deleted file mode 100644
index 1ad0195f3f..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TopLevelFieldEditPart.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTDirectEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.ADTSelectionFeedbackEditPolicy;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-import org.eclipse.wst.xsd.ui.internal.adt.typeviz.design.figures.BoxFigure;
-
-public class TopLevelFieldEditPart extends BoxEditPart implements INamedEditPart
-{
- protected ADTDirectEditPolicy adtDirectEditPolicy = new ADTDirectEditPolicy();
- private Font italicFont;
-
- protected boolean shouldDrawConnection()
- {
- IField field = (IField)getModel();
- IType type = field.getType();
- return (type != null);
- }
-
- public TypeReferenceConnection createConnectionFigure()
- {
- TypeReferenceConnection connectionFigure = null;
- IField field = (IField)getModel();
- IType type = field.getType();
- if (type != null)
- {
- AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart)getViewer().getEditPartRegistry().get(type);
- if (referenceTypePart != null)
- {
- connectionFigure = new TypeReferenceConnection();
- connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0));
- int targetAnchorYOffset = 12;
- connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(referenceTypePart.getFigure(), CenteredConnectionAnchor.HEADER_LEFT, 0, targetAnchorYOffset));
- connectionFigure.setHighlight(false);
- }
- }
- return connectionFigure;
- }
-
- protected void createEditPolicies()
- {
- super.createEditPolicies();
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, adtDirectEditPolicy);
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ADTSelectionFeedbackEditPolicy());
- }
-
- protected void refreshVisuals()
- {
- IField field = (IField)getModel();
- BoxFigure boxFigure = (BoxFigure)getFigure();
- Label label = boxFigure.getNameLabel();
- label.setText(field.getName());
- if (field.isAbstract())
- {
- if (italicFont == null)
- {
- Font font = label.getFont();
- italicFont = getItalicFont(font);
- }
- if (italicFont != null)
- {
- label.setFont(italicFont);
- }
- }
- else
- {
- label.setFont(label.getParent().getFont());
- }
- super.refreshVisuals();
- }
-
- public void deactivate()
- {
- if (italicFont != null)
- {
- italicFont.dispose();
- italicFont = null;
- }
- super.deactivate();
- }
-
- public Label getNameLabelFigure()
- {
- BoxFigure boxFigure = (BoxFigure)getFigure();
- return boxFigure.getNameLabel();
- }
-
- public void performDirectEdit(Point cursorLocation)
- {
-
- }
- public String getReaderText()
- {
- return getNameLabelFigure().getText();
- }
-
- public void performRequest(Request request)
- {
- if (request.getType() == RequestConstants.REQ_DIRECT_EDIT||
- request.getType() == RequestConstants.REQ_OPEN)
- {
-// if (request instanceof LocationRequest)
-// {
-// LocationRequest locationRequest = (LocationRequest)request;
-// Point p = locationRequest.getLocation();
-//
-// if (hitTest(getNameLabelFigure(), p))
-// {
-// LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, p));
-// NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
-// adtDirectEditPolicy.setUpdateCommand(wrapper);
-// manager.show();
-// }
-// }
- }
- }
-}
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
deleted file mode 100644
index 0d7da4aba0..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/TypeReferenceConnection.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2008 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.editparts;
-
-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;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-public class TypeReferenceConnection extends PolylineConnection
-{
- protected boolean highlight = false;
- protected static final Color activeConnection = ColorConstants.black;
- protected static final Color inactiveConnection = new Color(null, 198, 195, 198);
-
- /**
- * Default constructor
- */
- public TypeReferenceConnection()
- {
- super();
- 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)
- {
- if (cr != null && getConnectionRouter() != null && !(getConnectionRouter() instanceof ManhattanConnectionRouter))
- super.setConnectionRouter(cr);
- }
-
- /**
- * @return Returns the current highlight status.
- */
- public boolean isHighlighted()
- {
- return highlight;
- }
-
- /**
- * @param highlight
- * The highlight to set.
- */
- public void setHighlight(boolean highlight)
- {
- this.highlight = highlight;
- // Update our connection to use the correct colouring
- boolean highContrast = false;
- try
- {
- highContrast = Display.getDefault().getHighContrast();
- }
- catch (Exception e)
- {
- }
- if (highContrast)
- {
- setForegroundColor(highlight ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND) : ColorConstants.lightGray);
- }
- else
- {
- setForegroundColor(highlight ? activeConnection : inactiveConnection);
- }
- setOpaque(highlight);
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
deleted file mode 100644
index dbeb88e177..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/AbstractModelCollection.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-
-public abstract class AbstractModelCollection implements IADTObject
-{
- protected IADTObject model;
- protected String kind;
-
- public AbstractModelCollection(IADTObject model, String kind)
- {
- this.model = model;
- this.kind = kind;
- }
-
- public Object getModel()
- {
- return model;
- }
-
- public void setModel(IADTObject model)
- {
- this.model = model;
- }
-
- public String getKind()
- {
- return kind;
- }
-
- public void setKind(String kind)
- {
- this.kind = kind;
- }
-
- public abstract List getChildren();
-
- public void registerListener(IADTObjectListener listener)
- {
- model.registerListener(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- model.unregisterListener(listener);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
deleted file mode 100644
index 1f67a7fdd8..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Annotation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class Annotation
-{
- Compartment compartment;
- public Annotation()
- {
- super();
- }
-
- public void setCompartment(Compartment compartment)
- {
- this.compartment = compartment;
- }
-
- public Compartment getCompartment()
- {
- return compartment;
- }
-
- public IStructure getOwner()
- {
- return compartment.getOwner();
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
deleted file mode 100644
index 628cd4f8ef..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/Compartment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-
-public class Compartment implements IADTObject
-{
- String kind;
- IStructure owner;
-
- public Compartment(IStructure owner, String kind)
- {
- this.kind = kind;
- this.owner = owner;
- }
-
- public List getChildren()
- {
- List list = new ArrayList();
- for (Iterator i = owner.getFields().iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- if (kind == null || kind.equals(field.getKind()))
- {
- list.add(field);
- }
- }
- return list;
- }
-
- public String getKind()
- {
- return kind;
- }
-
- public IStructure getOwner()
- {
- return owner;
- }
-
- public void registerListener(IADTObjectListener listener)
- {
- // really we want to listen to the owner
- owner.registerListener(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- // really we want to listen to the owner
- owner.unregisterListener(listener);
- }
-
- public boolean isReadOnly()
- {
- return false;
- }
-}
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
deleted file mode 100644
index 60a6fc19c2..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/FocusTypeColumn.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-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()
- {
- List result = new ArrayList();
- if (model instanceof IType)
- {
- IType type = (IType)model;
- if (type.getSuperType() != null)
- {
- result.add(type.getSuperType());
- }
- result.add(type);
- }
- else if (model instanceof IField ||
- model instanceof IStructure)
- {
- result.add(model);
- }
- 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/design/editparts/model/IActionProvider.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
deleted file mode 100644
index d8443fa552..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IActionProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-
-
-public interface IActionProvider
-{
- public String[] getActions(Object object);
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
deleted file mode 100644
index 18e860b330..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IFeedbackHandler.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-public interface IFeedbackHandler
-{
- public void addFeedback();
- public void removeFeedback();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
deleted file mode 100644
index 9b2f5cba55..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IGraphElement.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-import org.eclipse.gef.commands.Command;
-
-public interface IGraphElement
-{
- boolean isFocusAllowed();
- IADTObject getTopContainer();
- Command getDeleteCommand();
- IModel getModel();
- boolean isReadOnly();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
deleted file mode 100644
index f263c38dd6..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/IModelProxy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IModel;
-
-public interface IModelProxy
-{
- IModel getModel();
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
deleted file mode 100644
index 95f8970e0a..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/ReferencedTypeColumn.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 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.editparts.model;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObjectListener;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IField;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure;
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IType;
-
-public class ReferencedTypeColumn extends AbstractModelCollection
-{
- List listenerList = new ArrayList();
- InternalListener internalListener = new InternalListener();
-
- // todo... really this this model object should listen
- // to the parent of the IType
- //
- public ReferencedTypeColumn(IADTObject model)
- {
- super(model, "ReferencedTypeColumn"); //$NON-NLS-1$
- model.registerListener(internalListener);
- internalListener.recomputeSubListeners();
- }
-
- public List getChildren()
- {
- List result = new ArrayList();
- if (model instanceof IStructure)
- {
- IStructure structure = (IStructure)model;
- for (Iterator i = structure.getFields().iterator(); i.hasNext(); )
- {
- IField field = (IField)i.next();
- IType type = field.getType();
- if (type != null) // && type.isComplexType())
- {
- if (!result.contains(type))
- {
- if (type instanceof IGraphElement)
- {
- if (((IGraphElement)type).isFocusAllowed())
- result.add(type);
- }
- }
- }
- }
- }
- else if (model instanceof IField)
- {
- IField field = (IField)model;
- IType type = field.getType();
- if (type != null) // && type.isComplexType())
- {
- if (type instanceof IGraphElement)
- {
- if (((IGraphElement)type).isFocusAllowed())
- result.add(type);
- }
- }
- }
- return result;
- }
-
- public void registerListener(IADTObjectListener listener)
- {
- listenerList.add(listener);
- }
-
- public void unregisterListener(IADTObjectListener listener)
- {
- listenerList.remove(listener);
- }
-
- protected void notifyListeners(Object changedObject, String property)
- {
- List clonedListenerList = new ArrayList();
- clonedListenerList.addAll(listenerList);
- for (Iterator i = clonedListenerList.iterator(); i.hasNext(); )
- {
- IADTObjectListener listener = (IADTObjectListener)i.next();
- listener.propertyChanged(this, null);
- }
- }
-
- protected class InternalListener implements IADTObjectListener
- {
- List fields = new ArrayList();
-
- void recomputeSubListeners()
- {
- if (model instanceof IStructure)
- {
- // remove old ones
- for (Iterator i = fields.iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- field.unregisterListener(this);
- }
- // add new ones
- fields.clear();
- IStructure complexType = (IStructure) model;
- for (Iterator i = complexType.getFields().iterator(); i.hasNext();)
- {
- IField field = (IField) i.next();
- fields.add(field);
- field.registerListener(this);
- }
- }
- }
-
- public void propertyChanged(Object object, String property)
- {
- if (object == model)
- {
- // we need to update the fields we're listening too
- // since these may have changed
- recomputeSubListeners();
- }
- else if (object instanceof IField)
- {
- }
- notifyListeners(object, property);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java b/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
deleted file mode 100644
index ca7b3a6225..0000000000
--- a/bundles/org.eclipse.wst.xsd.ui/src-adt/org/eclipse/wst/xsd/ui/internal/adt/design/editparts/model/RootHolder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 22007 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.editparts.model;
-
-import org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject;
-
-public class RootHolder
-{
- IADTObject model;
-
- public RootHolder(IADTObject model)
- {
- this.model = model;
- }
-
- public IADTObject getModel()
- {
- return model;
- }
-}

Back to the top