diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts')
22 files changed, 0 insertions, 2541 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDEditPartFactory.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDEditPartFactory.java deleted file mode 100644 index 1ca413510..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDEditPartFactory.java +++ /dev/null @@ -1,97 +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.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.jface.util.Assert; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingColumn; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingContentPlaceHolder; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingOperation; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; - -public class ASDEditPartFactory implements EditPartFactory -{ - public EditPart createEditPart(EditPart context, Object model) - { - EditPart child = null; - if (model instanceof IDescription) - { - child = new DefinitionsEditPart(); - } - else if (model instanceof AbstractModelCollection) - { - AbstractModelCollection collection = (AbstractModelCollection)model; - if (collection instanceof BindingColumn) - { - child = new BindingColumnEditPart(); - } - else - { - child = new ColumnEditPart(); - } - } - else if (model instanceof IEndPoint) - { - child = new EndPointEditPart(); - } - else if (model instanceof IService) - { - child = new ServiceEditPart(); - } - else if (model instanceof IBinding) - { - child = new BindingEditPart(); - } - else if (model instanceof IBindingOperation || - model instanceof IBindingMessageReference || - model instanceof BindingContentPlaceHolder) - { - child = new BindingContentEditPart(); - } - else if (model instanceof IInterface) - { - child = new InterfaceEditPart(); - } - else if (model instanceof IMessageReference) - { - child = new MessageReferenceEditPart(); - } - else if (model instanceof IOperation) - { - child = new OperationEditPart(); - } - else if (model instanceof IParameter && context instanceof ParameterEditPart) { - child = new ParameterTypeEditPart(); - } - else if (model instanceof IParameter && context instanceof MessageReferenceEditPart) - { - child = new ParameterEditPart(); - } - if (child == null) - { - System.out.println("\nCould not create editpart for model: " + model); //$NON-NLS-1$ - Thread.dumpStack(); - } - Assert.isNotNull(child); - child.setModel(model); - return child; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDRootEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDRootEditPart.java deleted file mode 100644 index 7b943a13c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDRootEditPart.java +++ /dev/null @@ -1,32 +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.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.BendpointConnectionRouter; -import org.eclipse.draw2d.ConnectionLayer; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.editparts.ScalableRootEditPart; - -public class ASDRootEditPart 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 ManhattanConnectionRouter()); - connectionLayer.setConnectionRouter(new BendpointConnectionRouter()); - } - refresh(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/AbstractBoxtEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/AbstractBoxtEditPart.java deleted file mode 100644 index 964f38a04..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/AbstractBoxtEditPart.java +++ /dev/null @@ -1,125 +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.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.ToolbarLayout; -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.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.ColumnData; - -public abstract class AbstractBoxtEditPart extends BaseEditPart implements INamedEditPart -{ - protected ColumnData columnData = new ColumnData(); - protected BoxComponentFigure figure; - - protected IFigure createFigure() - { - figure = new BoxComponentFigure(); - figure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(); - toolbarLayout.setStretchMinorAxis(true); - // toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT); - figure.setLayoutManager(toolbarLayout); - // if(isScrollable()) - // figure.setScrollingActionListener(this); - return figure; - } - - public IFigure getContentPane() - { - return figure.getContentPane(); - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (cursorLocation == null || hitTestFigure(figure.getHeadingFigure(), cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - else if ((hitTest(figure.getLabel(), cursorLocation) || - hitTestFigure(figure.getHeadingFigure(), cursorLocation)) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - Point location = null; - if (req instanceof DirectEditRequest) { - location = ((DirectEditRequest) req).getLocation(); - } - performDirectEdit(location); - } - } - - public Label getLabelFigure() { - return figure.getLabel(); - } - - protected void refreshChildren() - { - super.refreshChildren(); - // getFigure().invalidateTree(); - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - WSDLBaseAdapter box = (WSDLBaseAdapter) getModel(); - figure.headingFigure.setIsReadOnly(box.isReadOnly()); - figure.getLabel().setText(box.getName()); - } - - public void addFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); -// boxFigureLineBorder.setColor(ColorConstants.darkBlue); - figure.setSelected(true); - figure.repaint(); - } - - public void removeFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - figure.setSelected(false); - figure.repaint(); - } - - public ColumnData getColumnData() - { - return columnData; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java deleted file mode 100644 index 2eaf4bbf1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java +++ /dev/null @@ -1,166 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.ui.internal.actions.OpenInNewEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.IActionProvider; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener; -import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy; - -public abstract class BaseEditPart extends AbstractGraphicalEditPart implements IActionProvider, IASDObjectListener, IFeedbackHandler -{ - protected static final String[] EMPTY_ACTION_ARRAY = {}; - - 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, String[] actions) - { - for (int i = 0; i < actions.length; i++) - { - list.add(actions[i]); - } - } - - public void activate() - { - super.activate(); - Object model = getModel(); - if (model instanceof IASDObject) - { - IASDObject object = (IASDObject)model; - object.registerListener(this); - } - } - - public void deactivate() - { - Object model = getModel(); - if (model instanceof IASDObject) - { - IASDObject object = (IASDObject)model; - object.unregisterListener(this); - } - super.deactivate(); - } - - public void propertyChanged(Object object, String property) - { - //System.out.println("propertyChanged " + this.getClass().getName()); - refresh(); - } - - public void refreshConnections() { - Iterator kids = getChildren().iterator(); - while (kids.hasNext()) { - Object item = kids.next(); - if (item instanceof BaseEditPart) { - ((BaseEditPart) item).refreshConnections(); - } - } - } - - public void addFeedback() { - - } - public void removeFeedback() { - - } - - protected boolean hitTest(Rectangle rectangle, Point location) { - return rectangle.contains(location); - } - - protected boolean hitTest(Label target, Point location) { - Rectangle origB = target.getTextBounds().getCopy(); - Rectangle transB = target.getTextBounds().getCopy(); - - target.translateToAbsolute(transB); - - int newX = origB.x + Math.abs(transB.x - origB.x); - int newY = origB.y + Math.abs(transB.y - origB.y); - Rectangle finalB = new Rectangle(newX, newY, origB.width, origB.height); - - return finalB.contains(location); - } - - protected boolean hitTestFigure(Figure target, Point location) { - Rectangle origB = target.getBounds().getCopy(); - Rectangle transB = target.getBounds().getCopy(); - - target.translateToAbsolute(transB); - - int newX = origB.x + Math.abs(transB.x - origB.x); - int newY = origB.y + Math.abs(transB.y - origB.y); - Rectangle finalB = new Rectangle(newX, newY, origB.width, origB.height); - - return finalB.contains(location); - } - - public boolean isReadOnly() { - Object model = getModel(); - if (model instanceof IASDObject) { - return ((IASDObject) model).isReadOnly(); - } - - return false; - } - - protected void doOpenNewEditor() - { - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor(); - ActionRegistry registry = (ActionRegistry) editorPart.getAdapter(ActionRegistry.class); - if (registry != null) - { - IAction action = registry.getAction(OpenInNewEditor.ID); - action.run(); - } - } - - protected void createEditPolicies() - { - KeyBoardAccessibilityEditPolicy navigationEditPolicy = new KeyBoardAccessibilityEditPolicy() - { - public EditPart getRelativeEditPart(EditPart editPart, int direction) - { - return BaseEditPart.this.getRelativeEditPart(direction); - } - }; - installEditPolicy(KeyBoardAccessibilityEditPolicy.KEY, navigationEditPolicy); - } - - public EditPart getRelativeEditPart(int direction) - { - return EditPartNavigationHandlerUtil.getRelativeEditPart(this, direction); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingColumnEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingColumnEditPart.java deleted file mode 100644 index 76dd73d72..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingColumnEditPart.java +++ /dev/null @@ -1,64 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutAnimator; -import org.eclipse.gef.EditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingColumnLayout; - -public class BindingColumnEditPart extends ColumnEditPart -{ - protected IFigure createFigure() - { - Figure figure = new Figure(); - //figure.setOpaque(true); - //figure.setBackgroundColor(ColorConstants.yellow); - // custom layout that can do animation - // - BindingColumnLayout layout = new BindingColumnLayout(this); - figure.setLayoutManager(layout); - return figure; - } - - - - protected void register() - { - super.register(); - getFigure().addLayoutListener(LayoutAnimator.getDefault()); - } - - protected void unregister() - { - getFigure().removeLayoutListener(LayoutAnimator.getDefault()); - super.unregister(); - } - - // this method will expand the binding edit part - // and collapse any other bindings as appropriate - //public void expand(BidingEditPart bindingEditPart) - //{ - //} - - public void refreshBindingEditParts() - { - for (Iterator i = getChildren().iterator(); i.hasNext(); ) - { - EditPart editPart = (EditPart)i.next(); - editPart.refresh(); - } - getFigure().invalidateTree(); - getFigure().revalidate(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.java deleted file mode 100644 index 5f3c2242a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.java +++ /dev/null @@ -1,91 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.gef.EditPolicy; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingContentPlaceHolder; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingOperation; - -// This class is used to represent a BindingOperation, BindingInput, BindingOutput and BindingFault -// -public class BindingContentEditPart extends BaseEditPart -{ - Label label; - protected ASDSelectionEditPolicy selectionHandlesEditPolicy = new ASDSelectionEditPolicy(); - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setOpaque(true); - figure.setBackgroundColor(ColorConstants.tooltipBackground); - ToolbarLayout toolbarLayout = new ToolbarLayout(true); - toolbarLayout.setStretchMinorAxis(true); - figure.setLayoutManager(toolbarLayout); - label = new Label(); - label.setBorder(new MarginBorder(5, 5, 2, 2)); - figure.add(label); - - return figure; - } - - - protected List getModelChildren() - { - return Collections.EMPTY_LIST; - } - - protected void refreshVisuals() - { - if (getModel() instanceof IBindingOperation) - { - IBindingOperation bindingOperation = (IBindingOperation) getModel(); - label.setIcon(bindingOperation.getImage()); -// label.setText(bindingOperation.getName()); - } - else if (getModel() instanceof IBindingMessageReference) - { - IBindingMessageReference messageRef = (IBindingMessageReference) getModel(); - label.setIcon(WSDLEditorPlugin.getInstance().getImage("icons/bind_asct_val_obj.gif")); -// label.setIcon(messageRef.getImage()); -// label.setText(messageRef.getName()); - } - else if (getModel() instanceof BindingContentPlaceHolder) { - label.setIcon(WSDLEditorPlugin.getInstance().getImage("icons/bind_asct_val_not_obj.gif")); - } - - super.refreshVisuals(); - } - - protected void createEditPolicies() { - super.createEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy); - } - - public void addFeedback() { - label.getParent().setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - label.getParent().setBackgroundColor(ColorConstants.tooltipBackground); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java deleted file mode 100644 index 6b375b98f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java +++ /dev/null @@ -1,303 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Collections; -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.LayoutManager; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.design.connections.CenteredConnectionAnchor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingColumnLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingContentLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; - -public class BindingEditPart extends BaseEditPart -{ - protected ComponentReferenceConnection connectionFigure; - protected BoxComponentFigure figure; - protected boolean isExpanded = false; - private Label hoverHelpLabel = new Label(""); - - protected IFigure createFigure() - { - figure = new BoxComponentFigure(); - figure.getLabel().setBorder(new MarginBorder(2, 2, 1, 2)); - figure.setBorder(new LineBorder(0)); - figure.getContentPane().setLayoutManager(new BindingContentLayout(this)); - figure.getContentPane().setOpaque(true); - figure.getContentPane().setBackgroundColor(ColorConstants.yellow); - figure.setLayoutManager(new BindingLayout(this)); - // if(isScrollable()) - // figure.setScrollingActionListener(this); - return figure; - } - - public IFigure getContentPane() - { - return figure.getContentPane(); - } - - protected List getModelChildren() - { - IBinding binding = (IBinding) getModel(); - return isExpanded ? binding.getBindingContentList() : Collections.EMPTY_LIST; - } - - public void activate() - { - super.activate(); - activateConnection(); - } - - public void deactivate() - { - super.deactivate(); - deactivateConnection(); - } - - public void addFeedback() - { - super.addFeedback(); - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); -// boxFigureLineBorder.setColor(ColorConstants.darkBlue); - figure.setSelected(true); - figure.repaint(); - if (connectionFigure != null) - { - connectionFigure.setHighlight(true); - getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFigure); - } - } - - public void removeFeedback() - { - super.removeFeedback(); - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - figure.setSelected(false); - figure.repaint(); - if (connectionFigure != null) - { - connectionFigure.setHighlight(false); - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - - protected void activateConnection() - { - // If appropriate, create our connectionFigure and add it to the appropriate - // layer - if (createConnectionFigure() != 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 (connectionFigure != null) - { - boolean removed = false; - removed = removeConnectionFigure(getLayer(LayerConstants.CONNECTION_LAYER)); - if (!removed) - { - removeConnectionFigure(getLayer(LayerConstants.FEEDBACK_LAYER)); - } - } - } - - - private boolean removeConnectionFigure(IFigure parent) - { - boolean contains = false; - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) - { - IFigure fig = (IFigure) it.next(); - if (fig.equals(connectionFigure)) - { - contains = true; - break; - } - } - if (contains) - { - parent.remove(connectionFigure); - } - return contains; - } - - public ComponentReferenceConnection createConnectionFigure() - { - if (connectionFigure == null && shouldDrawConnection()) - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - connectionFigure = new ComponentReferenceConnection(); - refreshConnections(); - } - } - } - return connectionFigure; - } - - protected boolean shouldDrawConnection() - { - if (isExpanded) - { - return false; - } - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - return true; - } - } - return false; - } - - protected void refreshVisuals() - { - refreshConnections(); - if (getModel() instanceof IBinding) - { - IBinding binding = (IBinding) getModel(); - ((BoxComponentFigure) getFigure()).headingFigure.setIsReadOnly(((IBinding) getModel()).isReadOnly()); - figure.getLabel().setIcon(binding.getImage()); - - // Show the name of the IBinding with hover help - String prependString = Messages._UI_LABEL_BINDING; - hoverHelpLabel.setText(" " + prependString + " : " + binding.getName() + " "); - figure.setToolTip(hoverHelpLabel); - } - - //getViewer().getEditPartRegistry().put(Lay.class, controller); - super.refreshVisuals(); - } - - protected AbstractGraphicalEditPart getConnectionTargetEditPart() - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (connectionFigure != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - return referenceTypePart; - } - return null; - } - - public void refreshConnections() - { - if (shouldDrawConnection()) - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (connectionFigure != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - IFigure refFigure= referenceTypePart.getFigure(); - connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0)); - connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(refFigure, CenteredConnectionAnchor.HEADER_LEFT, 0, 11)); - connectionFigure.setHighlight(false); - connectionFigure.setVisible(true); - } - else - { - activateConnection(); - } - } - else if (connectionFigure != null) - { - connectionFigure.setVisible(false); - } - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - public boolean isExpanded() - { - return isExpanded; - } - - public void setExpanded(boolean isExpanded) - { - this.isExpanded = isExpanded; - } - - public void performRequest(Request request) - { - if (request.getType() == RequestConstants.REQ_OPEN) - { - LayoutManager layoutManager = getFigure().getParent().getLayoutManager(); - if (layoutManager instanceof BindingColumnLayout) - { - BindingColumnLayout bindingColumnLayout = (BindingColumnLayout)layoutManager; - bindingColumnLayout.setExpanded(this, !isExpanded); - ((BindingColumnEditPart)getParent()).refreshBindingEditParts(); - } - } - } - - public EditPart getRelativeEditPart(int direction) - { - if (direction == PositionConstants.EAST) - { - // navigate forward along the connection (to the right) - return getConnectionTargetEditPart(); - } - else if (direction == PositionConstants.WEST) - { - // navigate backward along the connection (to the left) - return EditPartNavigationHandlerUtil.getSourceConnectionEditPart(this); - } - return super.getRelativeEditPart(direction); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java deleted file mode 100644 index 4423a9a3b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java +++ /dev/null @@ -1,66 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - -public class ColumnEditPart extends BaseEditPart -{ - protected IFigure createFigure() - { - Figure figure = new Figure(); - ToolbarLayout layout = new ToolbarLayout(false); - layout.setStretchMinorAxis(false); - layout.setSpacing(20); - figure.setLayoutManager(layout); - return figure; - } - - public IDescription getDescription() - { - return (IDescription)getModel(); - } - - protected void createEditPolicies() - { - // TODO Auto-generated method stub - } - - protected List getModelChildren() - { - AbstractModelCollection collection = (AbstractModelCollection)getModel(); - Object children[] = collection.getChildren(); - List list = new ArrayList(); - for (int index = 0; index < children.length; index++) { - list.add(children[index]); - } - - return list; - } - - public void addFeedback() { - - } - - public void removeFeedback() { - - } -} - - - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java deleted file mode 100644 index 78649615f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java +++ /dev/null @@ -1,159 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LayoutListener; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingColumn; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.InterfaceColumn; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.ServiceColumn; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - -public class DefinitionsEditPart extends BaseEditPart { - List collections = null; - Figure contentPane; - Label messageLabel; - InternalLayoutListener internalLayoutListener = new InternalLayoutListener(); - - protected IFigure createFigure() - { - Panel panel = new Panel(); - ToolbarLayout toolbarLayout = new ToolbarLayout(true); - panel.setLayoutManager(toolbarLayout); - panel.setBorder(new MarginBorder(60, 30, 30, 30)); - contentPane = new Figure(); - panel.add(contentPane); - - messageLabel = new Label(""); - contentPane.add(messageLabel); - - ToolbarLayout layout = new ToolbarLayout(true); - layout.setStretchMinorAxis(true); - layout.setSpacing(0); - contentPane.setLayoutManager(layout); - return panel; - } - - public void activate() - { - super.activate(); - - // here we want to ensure the binding column is listening - // to the interface column so that it can re-layout when - // the interface changes - for (Iterator i = getChildren().iterator(); i.hasNext(); ) - { - AbstractGraphicalEditPart child = (AbstractGraphicalEditPart)i.next(); - if (child.getModel() instanceof InterfaceColumn) - { - child.getFigure().addLayoutListener(internalLayoutListener); - break; - } - } - } - - public void refresh() { - super.refresh(); - - // Refresh the connecting lines - refreshConnections(); - } - - public IFigure getContentPane() - { - return contentPane; - } - - - protected void createEditPolicies() - { - // TODO Auto-generated method stub - } - - public void setModelChildren(List list) - { - collections = list; - } - - protected List getModelChildren() - { - if (collections == null) - { - collections = new ArrayList(); - - IDescription description = (IDescription) getModel(); - if (description != null) - { - collections.add(new ServiceColumn(description)); - collections.add(new BindingColumn(description)); - collections.add(new InterfaceColumn(description)); - } - } - - boolean hasChildren = false; - for (Iterator i = collections.iterator(); i.hasNext(); ) - { - AbstractModelCollection column = (AbstractModelCollection)i.next(); - if (column.hasChildren()) - { - hasChildren = true; - } - } - - if (hasChildren) - { - messageLabel.setText(""); - if (contentPane.getChildren().contains(messageLabel)) - contentPane.remove(messageLabel); - } - else - { - messageLabel.setText(Messages._UI_LABEL_RIGHT_CLICK_TO_INSERT_CONTENT); //$NON-NLS-1$ - if (!contentPane.getChildren().contains(messageLabel)) - contentPane.add(messageLabel); - } - - - return collections; - } - - public void setInput(Object object) - { - } - - private class InternalLayoutListener extends LayoutListener.Stub - { - public void postLayout(IFigure container) - { - for (Iterator i = getChildren().iterator(); i.hasNext(); ) - { - EditPart child = (EditPart)i.next(); - if (child instanceof BindingColumnEditPart) - { - ((BindingColumnEditPart)child).refreshBindingEditParts(); - break; - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EditPartNavigationHandlerUtil.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EditPartNavigationHandlerUtil.java deleted file mode 100644 index cbd2f88b0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EditPartNavigationHandlerUtil.java +++ /dev/null @@ -1,180 +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.wsdl.ui.internal.asd.design.editparts; -import java.util.Iterator; -import java.util.List; -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.EditPartViewer; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.editparts.LayerManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; - - -class EditPartNavigationHandlerUtil -{ - static GraphicalEditPart getRelativeEditPart(GraphicalEditPart focusEditPart, int direction) - { - // these 'delta' values need to be set to some value that's large enough to cross the gap - // between adjacent edit parts (since some layouts may space the edit parts out a bit) - int dx = 5; - int dy = 5; - - IFigure contentPane = focusEditPart.getContentPane(); - - // we attempt to compute a rectangle that represents our current location - Rectangle r = focusEditPart.getFigure().getBounds().getCopy(); - focusEditPart.getFigure().translateToAbsolute(r); - if (contentPane != focusEditPart.getFigure()) - { - // if the EditPart has a contentPane (that's no the figure) then we assume - // effective rectangle is only the header portion of the figure - // - Rectangle contentPaneBounds = contentPane.getBounds().getCopy(); - contentPane.translateToAbsolute(contentPaneBounds); - - // we assume that when the editpart's figure and contentPane are different - // that portion of the 'hittable' portion of editpart should not include the contentPane - if (contentPaneBounds.y > r.y) - { - // if the contentPane is lower than the figure we only want the rectangle - // above the contentPane - r.height = contentPaneBounds.y - r.y; - // we adjust the rectangle the right slightly since the content is nested a bit - r.x = contentPaneBounds.x; - } - if (contentPaneBounds.x > r.x) - { - // if the contentPane is to the right of the figure we only want the rectangle - // to the left of the content pane - r.width = contentPaneBounds.x - r.x; - } - } - Point p = null; - if (direction == PositionConstants.NORTH) - { - p = r.getTopLeft(); - p.y -= dy; - } - else if (direction == PositionConstants.SOUTH) - { - p = r.getBottomLeft(); - p.x += dx; - p.y += dy; - } - else if (direction == PositionConstants.EAST) - { - p = r.getTopRight(); - p.x += dx; - } - else if (direction == PositionConstants.WEST) - { - p = r.getLeft(); - p.x -= dx; - } - EditPart t = focusEditPart.getViewer().findObjectAt(p); - - if (t instanceof ColumnEditPart || t instanceof DefinitionsEditPart) - { - t = null; - } - return (GraphicalEditPart)t; - } - - 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; - } - - 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; - } - - static EditPart getNextInterface(EditPart editPart) - { - EditPart result = null; - for (EditPart e = editPart; e != null; e = e.getParent()) - { - if (e instanceof InterfaceEditPart) - { - InterfaceEditPart ie = (InterfaceEditPart)e; - result = EditPartNavigationHandlerUtil.getNextSibling(ie); - break; - } - } - return result; - } - - static EditPart getSourceConnectionEditPart(AbstractGraphicalEditPart editPart) - { - // find the first connection that targets this editPart - // navigate backward along the connection (to the left) to find the sourc edit part - EditPart result = null; - EditPartViewer viewer = editPart.getViewer(); - LayerManager manager = (LayerManager)editPart.getViewer().getEditPartRegistry().get(LayerManager.ID); - IFigure layer = manager.getLayer(LayerConstants.CONNECTION_LAYER); - for (Iterator i = layer.getChildren().iterator(); i.hasNext(); ) - { - Figure figure = (Figure)i.next(); - if (figure instanceof ComponentReferenceConnection) - { - ComponentReferenceConnection componentReferenceConnection = (ComponentReferenceConnection)figure; - ConnectionAnchor targetAnchor = componentReferenceConnection.getTargetAnchor(); - if (targetAnchor.getOwner() == editPart.getFigure()) - { - ConnectionAnchor sourceAnchor = componentReferenceConnection.getSourceAnchor(); - IFigure sourceFigure = sourceAnchor.getOwner(); - EditPart part = null; - while (part == null && sourceFigure != null) - { - part = (EditPart)viewer.getVisualPartMap().get(sourceFigure); - sourceFigure = sourceFigure.getParent(); - } - result = part; - break; - } - } - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java deleted file mode 100644 index f86addbfe..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java +++ /dev/null @@ -1,374 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureCanvas; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.ToolbarLayout; -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.EditPartViewer; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalViewer; -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.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.connections.CenteredConnectionAnchor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; - -public class EndPointEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Label nameLabel; - protected Label addressLabel; - private Label hoverHelpLabel = new Label(""); - protected Figure addressBoxFigure; - protected ComponentReferenceConnection connectionFigure; - protected final static int MAX_ADDRESS_WIDTH = 150; - - protected IFigure createFigure() - { - figure = new Panel(); - figure.setBorder(new MarginBorder(4)); - ToolbarLayout layout = new ToolbarLayout(false); - // layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); - layout.setStretchMinorAxis(true); - figure.setLayoutManager(layout); - nameLabel = new Label(); - nameLabel.setIcon(((IEndPoint) getModel()).getImage()); - nameLabel.setLabelAlignment(Label.LEFT); - // nameLabel.setTextPlacement(PositionConstants.WEST); - figure.add(nameLabel); - Figure f1 = new Figure(); - f1.setBorder(new MarginBorder(0, 20, 0, 0)); - f1.setLayoutManager(new ToolbarLayout()); - figure.add(f1); - addressBoxFigure = new RectangleFigure(); - addressBoxFigure.setForegroundColor(ColorConstants.lightGray); - addressBoxFigure.setLayoutManager(new ToolbarLayout() - { - // here' we tweak the layout so that address labels aren't sized too wide - // the Label class automatically handles the addition of the '...' - // - protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) - { - Dimension d = super.calculatePreferredSize(container, wHint, hHint); - d.width = Math.min(d.width, MAX_ADDRESS_WIDTH); - return d; - } - }); - f1.add(addressBoxFigure); - addressLabel = new Label(); - - addressLabel.setForegroundColor(ColorConstants.black); - addressLabel.setBorder(new MarginBorder(2, 6, 2, 6)); - addressLabel.setLabelAlignment(Label.LEFT); - addressBoxFigure.add(addressLabel); - - // rmah: The block of code below has been moved from refreshVisuals(). We're - // assuming the read-only state of the EditPart will never change once the - // EditPart has been created. - if (isReadOnly()) - { - nameLabel.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - addressLabel.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else - { - nameLabel.setForegroundColor(DesignViewGraphicsConstants.labelColor); - addressLabel.setForegroundColor(DesignViewGraphicsConstants.labelColor); - } - - return figure; - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - private DirectEditManager manager; - private Point cursorLocation; - - public void performDirectEdit(Point cursorLocation) - { - this.cursorLocation = cursorLocation; - if (!isReadOnly() && (cursorLocation == null || hitTest(getLabelFigure(), cursorLocation))) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - else if (hitTest(getFigure().getBounds(), cursorLocation) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - performDirectEdit(null); - } - } - - public Label getLabelFigure() - { - if (cursorLocation == null || translateBounds(nameLabel.getBounds()).contains(cursorLocation)) - { - return nameLabel; - } - else if (translateBounds(addressLabel.getBounds()).contains(cursorLocation)) - { - return addressLabel; - } - return null; - } - - protected Rectangle translateBounds(Rectangle bounds) { - - ASDMultiPageEditor editor = (ASDMultiPageEditor) ASDEditorPlugin.getActiveEditor(); - FigureCanvas canvas = (FigureCanvas) ((EditPartViewer) editor.getAdapter(GraphicalViewer.class)).getControl(); - Point viewLocation = canvas.getViewport().getViewLocation(); - - return new Rectangle(bounds.x + viewLocation.x, bounds.y + viewLocation.y, bounds.width, bounds.height); - } - - protected Object getReferencedModel() - { - IEndPoint endPoint = (IEndPoint) getModel(); - return endPoint.getBinding(); - } - - protected void refreshVisuals() - { - IEndPoint endPoint = (IEndPoint) getModel(); - nameLabel.setText(endPoint.getName()); - addressLabel.setText(endPoint.getAddress()); - - Rectangle textBounds = addressLabel.getTextBounds(); - Rectangle bounds = addressLabel.getBounds(); - int textPlacement = addressLabel.getTextPlacement(); - int xDelta = textBounds.x - bounds.x; - int xTextIncrease = textPlacement - xDelta; - int textSize = textBounds.width + xTextIncrease; - int boundSize = bounds.width; - - if (textSize > boundSize) { - hoverHelpLabel.setText(" " + endPoint.getAddress() + " "); - addressLabel.setToolTip(hoverHelpLabel); - } - else { - addressLabel.setToolTip(null); - } - - refreshConnections(); - super.refreshVisuals(); - } - - public void activate() - { - super.activate(); - activateConnection(); - } - - public void deactivate() - { - super.deactivate(); - deactivateConnection(); - } - - protected void activateConnection() - { - if (createConnectionFigure() != null) - { - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - protected void deactivateConnection() - { - if (connectionFigure != null) - { - boolean removed = false; - removed = removeConnectionFigure(getLayer(LayerConstants.CONNECTION_LAYER)); - - if (!removed) { - removeConnectionFigure(getLayer(LayerConstants.FEEDBACK_LAYER)); - } - } - } - - private boolean removeConnectionFigure(IFigure parent) { - boolean contains = false; - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) { - IFigure fig = (IFigure) it.next(); - if (fig.equals(connectionFigure)) { - contains = true; - break; - } - } - - if (contains) { - parent.remove(connectionFigure); - } - - return contains; - } - - protected boolean shouldDrawConnection() - { - Object typeBeingRef = getReferencedModel(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - return true; - } - } - - return false; - } - - - public ComponentReferenceConnection createConnectionFigure() - { - if (connectionFigure == null && shouldDrawConnection()) - { - Object typeBeingRef = getReferencedModel(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - // We do reference another Type. Build a connection. We can make - // assumptions about anchor positioning since an attribute can only - // have a "reference" relationship, no "inheritance", no - // "is-referenced-by" - connectionFigure = new ComponentReferenceConnection(); - refreshConnections(); - } - } - } - return connectionFigure; - } - - EditPart getConnectionTargetEditPart() - { - Object typeBeingRef = getReferencedModel(); - if (connectionFigure != null) { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - return referenceTypePart; - } - return null; - } - - public void refreshConnections() { - if (shouldDrawConnection()) { - Object typeBeingRef = getReferencedModel(); - if (connectionFigure != null) { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(addressBoxFigure, CenteredConnectionAnchor.RIGHT, 0, 0)); - IFigure targetFigure = referenceTypePart.getFigure(); - connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(targetFigure, CenteredConnectionAnchor.HEADER_LEFT, 0, 10)); - connectionFigure.setHighlight(false); - connectionFigure.setVisible(true); - } - else { - activateConnection(); - } - } - else if (connectionFigure != null){ - connectionFigure.setVisible(false); - } - } - - private IFigure getFigureForFeedback() - { - return figure; - } - - public void addFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - - if (connectionFigure != null) { - connectionFigure.setHighlight(true); - getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFigure); - } - } - - public void removeFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(figure.getParent().getBackgroundColor()); - - if (connectionFigure != null) { - connectionFigure.setHighlight(false); - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - // TODO: rmah: VERY UGLY HACK.... I don't see any other way to solve this - // issue at this time. - // EndPointEditPart contains two labels which can be direct edited. The facade - // driving EndPointEditPart - // contains a getSetNameCommand() and a getSetAddressCommand()... however, - // this class (LabelDirectEditPolicy) - // only knows about getSetNameCommand()..... This is the problem we face when - // combining two labels into - // one EditPart..... - // See LabelDirectEditPolicy.getDirectEditCommand(DirectEditRequest) - public Command getSetProperLabelCommand(String newValue) - { - // TODO: rmah: We need to translate the point... - if (cursorLocation == null || translateBounds(nameLabel.getBounds()).contains(cursorLocation)) - { - return ((IEndPoint) getModel()).getSetNameCommand(newValue); - } - else if (translateBounds(addressLabel.getBounds()).contains(cursorLocation)) - { - return ((IEndPoint) getModel()).getSetAddressCommand(newValue); - } - return null; - } - - public EditPart getRelativeEditPart(int direction) - { - if (direction == PositionConstants.EAST) - { - // navigate forward along the connection (to the right) - return getConnectionTargetEditPart(); - } - return super.getRelativeEditPart(direction); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/IFeedbackHandler.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/IFeedbackHandler.java deleted file mode 100644 index e305362de..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/IFeedbackHandler.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.wsdl.ui.internal.asd.design.editparts; - -public interface IFeedbackHandler { - public void addFeedback(); - public void removeFeedback(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/INamedEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/INamedEditPart.java deleted file mode 100644 index 4f6de3e84..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/INamedEditPart.java +++ /dev/null @@ -1,19 +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.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; - -public interface INamedEditPart { - public Label getLabelFigure(); - public void performDirectEdit(Point cursorLocation); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java deleted file mode 100644 index 053744b3f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java +++ /dev/null @@ -1,168 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.swt.graphics.Color; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ListFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation; - - -public class OperationEditPart extends BaseEditPart implements INamedEditPart -{ - protected Figure contentPane; - protected Label label; - private Color unselectedColor; - private Figure labelHolder; - - public OperationEditPart() - { - } - - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); - figure.setLayoutManager(toolbarLayout); - - labelHolder = new Panel(); - labelHolder.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - labelHolder.setLayoutManager(new ToolbarLayout(true)); - figure.add(labelHolder); - - label = new Label("Operation"); //$NON-NLS-1$ -// label.setFont(DesignViewGraphicsConstants.smallBoldFont); - label.setBorder(new MarginBorder(2, 2,2,2)); - label.setTextAlignment(Label.LEFT); - labelHolder.add(label); - - - contentPane = new ListFigure(); - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - figure.add(contentPane); - - // rmah: The block of code below has been moved from refreshVisuals(). We're - // assuming the read-only state of the EditPart will never change once the - // EditPart has been created. - if (isReadOnly()) { - label.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - figure.setBackgroundColor(DesignViewGraphicsConstants.readOnlyTableOperationHeadingColor); - labelHolder.setBackgroundColor(DesignViewGraphicsConstants.readOnlyTableOperationHeadingColor); - } - else { - label.setForegroundColor(ColorConstants.black); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - labelHolder.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - } - - return figure; - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - public void performDirectEdit(Point cursorLocation){ - Rectangle textArea = getLabelFigure().getBounds(); - textArea.width = getFigure().getBounds().width; - if (cursorLocation == null || hitTest(textArea, cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - else if (getFigure() instanceof Figure && hitTestFigure((Figure) getFigure(), cursorLocation) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - performDirectEdit(null); - } - } - - public Label getLabelFigure() { - return label; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IOperation operation = (IOperation)getModel(); - label.setText(operation.getName());// + "---" + getModel()); - label.setIcon(operation.getImage()); - - - } - - public IFigure getContentPane() - { - return contentPane; - } - - protected List getModelChildren() - { - IOperation theOperation = (IOperation)getModel(); - return theOperation.getMessages(); - } - - public void addFeedback() { - unselectedColor = labelHolder.getBackgroundColor(); -// getFigure().setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - labelHolder.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - if (unselectedColor != null) { - labelHolder.setBackgroundColor(unselectedColor); - } - } - - /** - * @deprecated to be removed post WTP 1.5 - */ - protected Label previewLabel; - - /** - * @deprecated to be removed post WTP 1.5 - */ - protected String getOperationPreview() - { - return "deprecated"; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java deleted file mode 100644 index ab6bff4e4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java +++ /dev/null @@ -1,229 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDDragAndDropEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDGraphNodeDragTracker; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class ParameterEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Figure contentPane; - protected Label parameterName; - protected RowLayout rowLayout = new RowLayout(); - protected Image labelImage; - - protected ASDSelectionEditPolicy selectionHandlesEditPolicy = new ASDSelectionEditPolicy(); - - protected IFigure createFigure() - { - IFigure figure = new Figure() - { - public void paint(Graphics graphics) - { - super.paint(graphics); - graphics.pushState(); - // this bit of code is used to draw the dividing line between - // the parameter name and the parameter type - // we might want to consider moving this line drawing into the - // message reference's figure where the horizontal lines are down's - Rectangle r = parameterName.getBounds(); - int x= r.x + r.width -1; - graphics.setForegroundColor(ColorConstants.lightGray); - graphics.drawLine(x, r.y, x, r.y + r.height); - graphics.popState(); - } - }; - //toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER); - figure.setForegroundColor(ColorConstants.black); - figure.setLayoutManager(rowLayout); - /* - String x = ""; - int size = (int)(Math.random()*50); - for (int i = 0; i < size; i++) - { - x += "x"; - } - String y = ""; - int sizey = (int)(Math.random()*50); - for (int i = 0; i < sizey; i++) - { - y += "y"; - } */ - - contentPane = new Figure(); - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - - IFigure parameterNamePane = new Panel(); - toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - parameterNamePane.setLayoutManager(toolbarLayout2); - - parameterName = new Label(); - parameterName.setLabelAlignment(Label.LEFT); - parameterName.setBorder(new MarginBorder(4,10,4,10)); - - parameterNamePane.add(parameterName); - figure.add(parameterNamePane); - figure.add(contentPane); - rowLayout.setConstraint(parameterNamePane, "parameterName"); //$NON-NLS-1$ - rowLayout.setConstraint(contentPane, "parameterType"); //$NON-NLS-1$ - - labelImage = ((IParameter) getModel()).getImage(); - - // rmah: The block of code below has been moved from refreshVisuals(). We're - // assuming the read-only state of the EditPart will never change once the - // EditPart has been created. - if (isReadOnly()) - { - parameterName.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else - { - parameterName.setForegroundColor(ColorConstants.black); - } - - return figure; - } - - public void addNotify() - { - InterfaceEditPart.attachToInterfaceEditPart(this, rowLayout); - super.addNotify(); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (!isReadOnly() && (cursorLocation == null || hitTest(getLabelFigure().getBounds(), cursorLocation))) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - else if (getFigure() instanceof Figure && hitTestFigure((Figure) getFigure(), cursorLocation) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - performDirectEdit(null); - } - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - if (!isReadOnly()) { - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ASDDragAndDropEditPolicy(getViewer(), selectionHandlesEditPolicy)); - } - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, selectionHandlesEditPolicy); - } - - public DragTracker getDragTracker(Request request) - { - return new ASDGraphNodeDragTracker((EditPart)this); - } - - public Label getLabelFigure() { - return parameterName; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IParameter parameter = (IParameter)getModel(); - parameterName.setText(parameter.getName()); - if (labelImage != null) { - parameterName.setIcon(labelImage); - } - - // Resize column widths. Sizes may have shrunk. - rowLayout.getColumnData().clearColumnWidths(); - for (EditPart parent = getParent(); parent != null; parent = parent.getParent()) - { - if (parent instanceof InterfaceEditPart) - { - ((GraphicalEditPart)parent).getFigure().invalidateTree(); - break; - } - } - } - - protected List getModelChildren() - { - // On the facade level, one IParameter will have two editable values. - // A name and a type reference. To make direct editing and selection - // feedback easier, we show this one facade object as two edit parts. - // The approach is to the same facade model, to drive the second (child - // EditPart. - - // TODO (cs) Rich consider creating 2 hard code edit parts - // the first for the parameter name - // the second for the paramter type - List kids = new ArrayList(); - kids.add(getModel()); - return kids; - } - - public IFigure getContentPane() - { - return contentPane; - } - - public void addFeedback() { - parameterName.getParent().setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - parameterName.getParent().setBackgroundColor(figure.getBackgroundColor()); - } - - public EditPart getRelativeEditPart(int direction) - { - EditPart editPart = super.getRelativeEditPart(direction); - if (direction == PositionConstants.SOUTH && editPart == null) - { - editPart = EditPartNavigationHandlerUtil.getNextInterface(this); - } - return editPart; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java deleted file mode 100644 index 2ea2f4c13..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java +++ /dev/null @@ -1,160 +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.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.HeadingFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; - -public class ServiceEditPart extends BaseEditPart implements INamedEditPart -{ - IFigure contentPane; - HeadingFigure headingFigure; - - public void addFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); -// boxFigureLineBorder.setColor(ColorConstants.darkBlue); - headingFigure.setSelected(true); - figure.repaint(); - } - - public void removeFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - headingFigure.setSelected(false); - figure.repaint(); - } - - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - figure.setLayoutManager(toolbarLayout); - headingFigure = new HeadingFigure(); - headingFigure.getLabel().setIcon(((IService) getModel()).getImage()); - figure.add(headingFigure); - - contentPane = new Figure() - { - public void paint(Graphics graphics) - { - super.paint(graphics); - boolean isFirst = false; - for (Iterator i = getChildren().iterator(); i.hasNext(); ) - { - Figure figure = (Figure)i.next(); - if (isFirst) - { - isFirst = false; - } - else - { - Rectangle r = figure.getBounds(); - graphics.drawLine(r.x, r.y +1, r.x + r.width, r.y + 1); - } - } - } - }; - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - figure.add(contentPane); - - // rmah: The block of code below has been moved from refreshVisuals(). We're - // assuming the read-only state of the EditPart will never change once the - // EditPart has been created. - if (isReadOnly()) - { - headingFigure.getLabel().setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else - { - headingFigure.getLabel().setForegroundColor(ColorConstants.black); - } - - return figure; - } - - public IFigure getContentPane() - { - return contentPane; - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (cursorLocation == null || hitTest(headingFigure.getLabel(), cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - else if ((hitTest(headingFigure.getLabel(), cursorLocation) || - hitTestFigure(headingFigure, cursorLocation)) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - performDirectEdit(null); - } - } - - public Label getLabelFigure() { - return headingFigure.getLabel(); - } - - protected List getModelChildren() - { - IService service = (IService)getModel(); - return service.getEndPoints(); - } - - protected void refreshVisuals() - { - IService service = (IService)getModel(); - headingFigure.setIsReadOnly(service.isReadOnly()); - headingFigure.getLabel().setText(service.getName()); - super.refreshVisuals(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java deleted file mode 100644 index 54eeadbf0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java +++ /dev/null @@ -1,70 +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.wsdl.ui.internal.asd.design.editparts.model; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public abstract class AbstractModelCollection implements IASDObject, ITreeElement -{ - IASDObject model; - String kind; - - public AbstractModelCollection(IASDObject model, String kind) - { - this.model = model; - this.kind = kind; - } - - public Object getModel() - { - return model; - } - - public void setModel(IASDObject model) - { - this.model = model; - } - - public String getKind() - { - return kind; - } - - public void setKind(String kind) - { - this.kind = kind; - } - - public Image getImage() { - return null; - } - - public ITreeElement getParent() { - return null; - } - - public boolean isReadOnly() { - return false; - } - - public void registerListener(IASDObjectListener listener) - { - model.registerListener(listener); - } - - public void unregisterListener(IASDObjectListener listener) - { - model.unregisterListener(listener); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java deleted file mode 100644 index 4ba9ffcf4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java +++ /dev/null @@ -1,76 +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.wsdl.ui.internal.asd.design.editparts.model; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class BindingColumn extends AbstractModelCollection { - public BindingColumn(IDescription description) { - super(description, "BindingColumn"); //$NON-NLS-1$ - } - - public ITreeElement[] getChildren() { - List bindings = ((IDescription)model).getBindings(); - Collections.sort(bindings, new BindingComparator()); - Object array[] = bindings.toArray(); - - ITreeElement treeElement[] = new ITreeElement[array.length]; - for (int index = 0; index < array.length; index++) { - treeElement[index] = (ITreeElement) array[index]; - } - - return treeElement; - } - - public boolean hasChildren() { - ITreeElement treeElement[] = getChildren(); - if (treeElement.length > 0) { - return true; - } - - return false; - } - - public String getText() { - return "definition"; //$NON-NLS-1$ - } - - private class BindingComparator implements Comparator { - public int compare(Object o1, Object o2) { - if (o1 instanceof IBinding && o2 instanceof IBinding) { - IInterface interface1 = ((IBinding) o1).getInterface(); - IInterface interface2 = ((IBinding) o2).getInterface(); - - if (interface1 != null && interface2 != null) { - String name1 = ((INamedObject) interface1).getName(); - String name2 = ((INamedObject) interface2).getName(); - return name1.compareTo(name2); - } - else if (interface1 != null && interface2 == null) { - return -1; - } - else if (interface1 == null && interface2 != null) { - return 1; - } - } - - return 0; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingContentPlaceHolder.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingContentPlaceHolder.java deleted file mode 100644 index c963d26d7..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingContentPlaceHolder.java +++ /dev/null @@ -1,23 +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.wsdl.ui.internal.asd.design.editparts.model; - -public class BindingContentPlaceHolder { - private Object model; - - public BindingContentPlaceHolder(Object model) { - this.model = model; - } - - public Object getModel() { - return model; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/IActionProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/IActionProvider.java deleted file mode 100644 index e13715d14..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/IActionProvider.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.wsdl.ui.internal.asd.design.editparts.model; - -public interface IActionProvider -{ - public String[] getActions(Object object); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/InterfaceColumn.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/InterfaceColumn.java deleted file mode 100644 index ecd0f172b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/InterfaceColumn.java +++ /dev/null @@ -1,64 +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.wsdl.ui.internal.asd.design.editparts.model; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class InterfaceColumn extends AbstractModelCollection { - public InterfaceColumn(IDescription description) { - super(description, "InterfaceColumn"); //$NON-NLS-1$ - } - - public ITreeElement[] getChildren() { - List interfaces = ((IDescription)model).getInterfaces(); - Comparator compare = new NamedObjectComparator(); - Collections.sort(interfaces, compare); - Object array[] = interfaces.toArray(); - - ITreeElement treeElement[] = new ITreeElement[array.length]; - for (int index = 0; index < array.length; index++) { - treeElement[index] = (ITreeElement) array[index]; - } - - return treeElement; - } - - public boolean hasChildren() { - ITreeElement treeElement[] = getChildren(); - if (treeElement.length > 0) { - return true; - } - - return false; - } - - public String getText() { - return "definition"; //$NON-NLS-1$ - } - - private class NamedObjectComparator implements Comparator{ - public int compare(Object o1, Object o2) { - if (o1 instanceof INamedObject && o2 instanceof INamedObject) { - String name1 = ((INamedObject) o1).getName(); - String name2 = ((INamedObject) o2).getName(); - return name1.compareTo(name2); - } - - return -1; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/ServiceColumn.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/ServiceColumn.java deleted file mode 100644 index 19a7c8109..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/ServiceColumn.java +++ /dev/null @@ -1,43 +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.wsdl.ui.internal.asd.design.editparts.model; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class ServiceColumn extends AbstractModelCollection { - public ServiceColumn(IDescription description) { - super(description, "ServiceColumn"); //$NON-NLS-1$ - } - - public ITreeElement[] getChildren() { - Object array[] = ((IDescription)model).getServices().toArray(); - ITreeElement treeElement[] = new ITreeElement[array.length]; - for (int index = 0; index < array.length; index++) { - treeElement[index] = (ITreeElement) array[index]; - } - - return treeElement; - } - - public boolean hasChildren() { - ITreeElement treeElement[] = getChildren(); - if (treeElement.length > 0) { - return true; - } - - return false; - } - - public String getText() { - return "definition"; //$NON-NLS-1$ - } -}
\ No newline at end of file |