Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design')
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewContextMenuProvider.java170
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java151
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicsConstants.java49
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/KeyboardDragImpl.java78
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/CenteredConnectionAnchor.java88
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/TopLeftConnectionAnchor.java35
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDCCombo.java1514
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java311
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ComboBoxCellEditorManager.java204
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/DirectEditSelectionTool.java60
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelCellEditorLocator.java70
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelEditManager.java140
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/TypeReferenceDirectEditManager.java178
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDEditPartFactory.java97
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDRootEditPart.java32
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/AbstractBoxtEditPart.java125
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java166
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingColumnEditPart.java64
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.java91
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java303
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java66
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java159
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EditPartNavigationHandlerUtil.java180
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java374
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/IFeedbackHandler.java16
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/INamedEditPart.java19
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java168
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java229
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java160
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java70
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java76
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingContentPlaceHolder.java23
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/IActionProvider.java16
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/InterfaceColumn.java64
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/ServiceColumn.java43
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java135
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java38
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java30
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java44
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java89
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java58
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java58
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java81
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/LinkIconFigure.java90
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java79
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java145
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingContentLayout.java105
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingLayout.java60
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/ColumnData.java83
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/RowLayout.java182
50 files changed, 0 insertions, 6866 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewContextMenuProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewContextMenuProvider.java
deleted file mode 100644
index 6e0d22e27..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewContextMenuProvider.java
+++ /dev/null
@@ -1,170 +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;
-
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ShowPropertiesViewAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ColumnEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.IActionProvider;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.ContextMenuParticipant;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorModeManager;
-
-
-public class DesignViewContextMenuProvider extends ContextMenuProvider
-{
- ISelectionProvider selectionProvider;
-
- /**
- * Constructor for GraphContextMenuProvider.
- *
- * @param selectionProvider
- * @param editor
- */
- public DesignViewContextMenuProvider(EditPartViewer viewer, ISelectionProvider selectionProvider)
- {
- super(viewer);
- this.selectionProvider = selectionProvider;
- }
-
- protected Object getAppropriateSelection(Object selection) {
- if (selection instanceof ColumnEditPart) {
- return ((EditPart) selection).getParent();
- }
-
- return selection;
- }
-
- /**
- * @see org.eclipse.gef.ui.parts.ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager,
- * org.eclipse.gef.EditPartViewer)
- */
- public void buildContextMenu(IMenuManager menu)
- {
- IMenuManager currentMenu = menu;
-
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- EditorModeManager manager = (EditorModeManager)editor.getAdapter(EditorModeManager.class);
- ContextMenuParticipant contextMenuParticipant = manager != null ? manager.getCurrentMode().getContextMenuParticipant() : null;
-
-
- currentMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- ActionRegistry registry = getEditorActionRegistry();
- ISelection selection = selectionProvider.getSelection();
-
- Object activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
-
- if (selection != null)
- {
- Object selectedObject = ((StructuredSelection) selection).getFirstElement();
- selectedObject = getAppropriateSelection(selectedObject);
-
- if (contextMenuParticipant != null)
- {
- // Convert editparts to model objects as selections
- Object o = selectedObject;
- if (o instanceof EditPart)
- {
- o = ((EditPart)selectedObject).getModel();
- }
- contextMenuParticipant.contributeActions(o, menu);
- }
-
- if (selectedObject instanceof IActionProvider)
- {
- IActionProvider actionProvider = (IActionProvider) selectedObject;
- String[] actions = actionProvider.getActions(activePart);
- for (int i = 0; i < actions.length; i++)
- {
- String id = actions[i];
- if (contextMenuParticipant == null || contextMenuParticipant.isApplicable(selectedObject, id))
- {
- if (id.startsWith(BaseSelectionAction.SUBMENU_START_ID)) {
- String text = id.substring(BaseSelectionAction.SUBMENU_START_ID.length());
- IMenuManager subMenu = new MenuManager(text);
- currentMenu.add(subMenu);
- currentMenu = subMenu;
- }
- else if (id.startsWith(BaseSelectionAction.SUBMENU_END_ID)) {
- currentMenu = getParentMenu(menu, currentMenu);
- }
- else
- {
- IAction action = registry.getAction(id);
- if (action != null) {
- action.isEnabled();
- currentMenu.add(action);
- }
- }
- }
- }
-
- menu.add(registry.getAction(ShowPropertiesViewAction.ID));
- menu.add(new Separator());
- menu.add(new Separator("refactoring-slot-temp")); //$NON-NLS-1$
- menu.add(new Separator());
- menu.add(new Separator("search_slot_temp")); //$NON-NLS-1$
- menu.add(new Separator());
- }
- }
- menu.add(new Separator());
- }
-
- protected IMenuManager getParentMenu(IMenuManager root, IMenuManager child) {
- IMenuManager parent = null;
-
- IContributionItem[] kids = root.getItems();
- int index = 0;
- while (index < kids.length && parent == null) {
- IContributionItem item = kids[index];
- if (item.equals(child)) {
- parent = root;
- }
- else {
- if (item instanceof IMenuManager) {
- parent = getParentMenu((IMenuManager) item, child);
- }
- }
- index++;
- }
-
- return parent;
- }
-
- protected ActionRegistry getEditorActionRegistry()
- {
- return (ActionRegistry) ASDEditorPlugin.getActiveEditor().getAdapter(ActionRegistry.class);
- }
- protected CommandStack commandStack;
-
- protected CommandStack getCommandStack()
- {
- if (commandStack == null)
- commandStack = getViewer().getEditDomain().getCommandStack();
- return commandStack;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java
deleted file mode 100644
index d602a7020..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java
+++ /dev/null
@@ -1,151 +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;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.xsd.ui.internal.adt.design.BaseGraphicalViewerKeyHandler;
-import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonSelectionManager;
-
-public class DesignViewGraphicalViewer extends ScrollingGraphicalViewer implements ISelectionChangedListener
-{
- protected ASDSelectionChangedListener internalSelectionProvider = new ASDSelectionChangedListener();
-//TODO Make this generic
- public DesignViewGraphicalViewer(IEditorPart editor, CommonSelectionManager manager)
- {
- super();
- setContextMenu(new DesignViewContextMenuProvider(this, this));
- editor.getEditorSite().registerContextMenu("org.eclipse.wst.wsdl.editor.popup.graph", getContextMenu(), internalSelectionProvider, false); //$NON-NLS-1$
-
- // make the internalSelectionProvider listen to graph view selection changes
- addSelectionChangedListener(internalSelectionProvider);
- internalSelectionProvider.addSelectionChangedListener(manager);
- manager.addSelectionChangedListener(this);
-
- setKeyHandler(new BaseGraphicalViewerKeyHandler(this));
- }
-
- // this method is called when something changes in the selection manager
- // (e.g. a selection occured from another view)
- public void selectionChanged(SelectionChangedEvent event)
- {
- Object selectedObject = ((StructuredSelection) event.getSelection()).getFirstElement();
- if (event.getSource() != internalSelectionProvider)
- {
- EditPart editPart = getEditPart(getRootEditPart(), selectedObject);
- if (editPart != null)
- {
- setSelection(new StructuredSelection(editPart));
- }
- }
- }
-
- protected EditPart getEditPart(EditPart editPart, Object model)
- {
- EditPart result = null;
- if (editPart.getModel() == model)
- {
- result = editPart;
- }
- else
- {
- for (Iterator i = editPart.getChildren().iterator(); i.hasNext(); )
- {
- result = getEditPart((EditPart)i.next(), model);
- if (result != null)
- {
- break;
- }
- }
- }
- return result;
- }
-
-
- /*
- * We need to convert from edit part selections to model object selections
- */
- class ASDSelectionChangedListener implements ISelectionProvider, ISelectionChangedListener
- {
- protected List listenerList = new ArrayList();
- protected ISelection selection = new StructuredSelection();
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.add(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- listenerList.remove(listener);
- }
-
- public ISelection getSelection()
- {
- return selection;
- }
-
- protected void notifyListeners(SelectionChangedEvent event)
- {
- for (Iterator i = listenerList.iterator(); i.hasNext();)
- {
- ISelectionChangedListener listener = (ISelectionChangedListener) i.next();
- listener.selectionChanged(event);
- }
- }
-
- public StructuredSelection convertSelectionFromEditPartToModel(ISelection editPartSelection)
- {
- List selectedModelObjectList = new ArrayList();
- if (editPartSelection instanceof IStructuredSelection)
- {
- for (Iterator i = ((IStructuredSelection) editPartSelection).iterator(); i.hasNext();)
- {
- Object obj = i.next();
- Object model = null;
- if (obj instanceof EditPart)
- {
- EditPart editPart = (EditPart) obj;
- model = editPart.getModel();
- }
- if (model != null)
- {
- selectedModelObjectList.add(model);
- }
- }
- }
- return new StructuredSelection(selectedModelObjectList);
- }
-
- public void setSelection(ISelection selection)
- {
- this.selection = selection;
- }
-
- public void selectionChanged(SelectionChangedEvent event)
- {
- ISelection newSelection = convertSelectionFromEditPartToModel(event.getSelection());
- this.selection = newSelection;
- SelectionChangedEvent newEvent = new SelectionChangedEvent(this, newSelection);
- notifyListeners(newEvent);
- }
- }
-} \ 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/DesignViewGraphicsConstants.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicsConstants.java
deleted file mode 100644
index c4e8b437f..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicsConstants.java
+++ /dev/null
@@ -1,49 +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;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * A collection of color and font related constants.
- */
-public interface DesignViewGraphicsConstants
-{
- public final static Display display = Display.getDefault();
-
- public final static Color groupBorderColor = new Color(null, 118, 134, 164);
- public final static Color groupHeaderColor = new Color(null, 232, 240, 248);
-
- public final static Color elementBorderColor = new Color(null, 120, 152, 184);
- public final static Color elementBackgroundColor = new Color(null, 232, 240, 248);
- public final static Color elementLabelColor = new Color(null, 80, 102, 144);
- public final static Color readOnlyBorderColor = new Color(null, 164, 164, 164);
- public final static Color red = new Color(null, 255, 0, 0);
-
- public final static Color tableOperationHeadingColor = new Color(null, 224, 233, 246);
- public final static Color tableMessageHeadingColor = new Color(null, 230, 240, 245);
- public final static Color tableCellSelectionColor = new Color(null, 238, 232, 170); //new Color(null, 240, 230, 140); //1, 15, 42);
-
- public final static Color readOnlyTableOperationHeadingColor = new Color(null, 239, 243, 255);
- public final static Color readOnlyMessageRefHeadingColor = new Color(null, 245, 245, 245);
-
- public final static Color readOnlyBackgroundColor = ColorConstants.white;
- public final static Color readOnlyLabelColor = ColorConstants.gray;
- public final static Color labelColor = ColorConstants.black;
-
- public final static Font smallBoldFont = new Font(Display.getCurrent(), "Tahoma", 8, SWT.BOLD); //$NON-NLS-1$
- public final static Font mediumFont = new Font(Display.getCurrent(), "Tahoma", 10, SWT.NONE); //$NON-NLS-1$
- public final static Font mediumBoldFont = new Font(Display.getCurrent(), "Tahoma", 10, SWT.BOLD); //$NON-NLS-1$
-} \ 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/KeyboardDragImpl.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/KeyboardDragImpl.java
deleted file mode 100644
index a84adf13f..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/KeyboardDragImpl.java
+++ /dev/null
@@ -1,78 +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;
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction;
-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.xsd.ui.internal.adt.design.IKeyboardDrag;
-import org.eclipse.wst.xsd.ui.internal.adt.design.editpolicies.KeyBoardAccessibilityEditPolicy;
-
-public class KeyboardDragImpl extends BaseSelectionAction implements IKeyboardDrag {
-
- public KeyboardDragImpl() {
- super(null);
- }
-
- public void performKeyboardDrag(GraphicalEditPart movingElement, int direction) {
-
- KeyBoardAccessibilityEditPolicy policy = (KeyBoardAccessibilityEditPolicy)movingElement.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
-
- EditPart rightElement = policy.getRelativeEditPart(movingElement, direction);
- policy = (KeyBoardAccessibilityEditPolicy)rightElement.getEditPolicy(KeyBoardAccessibilityEditPolicy.KEY);
- EditPart leftElement = (policy != null)? policy.getRelativeEditPart(rightElement, direction): null;
-
- Object leftSibElement = (leftElement != null)? leftElement.getModel() : null;
- Object rightSibElement = (rightElement != null)? rightElement.getModel() : null;
- if (direction == PositionConstants.SOUTH) {
- leftSibElement = rightSibElement;
- rightSibElement = leftSibElement;
- } else if (direction != PositionConstants.NORTH) return;
-
- Object source = movingElement.getModel();
-
- if (source instanceof IMessageReference) {
-
- if(!(leftSibElement instanceof IMessageReference)) leftSibElement = null;
- if(!(rightSibElement instanceof IMessageReference)) rightSibElement = null;
-
- Object messageRefOwner = ((IMessageReference) source).getOwnerOperation();
- if (messageRefOwner instanceof IOperation) {
- IMessageReference leftSib = (IMessageReference) leftSibElement;
- IMessageReference rightSib = (IMessageReference) rightSibElement;
- IMessageReference movingSib = (IMessageReference) source;
- Command command = ((IOperation) messageRefOwner).getReorderMessageReferencesCommand(leftSib, rightSib, movingSib);
- command.execute();
- performSelection(source);
- }
- }
- else if (source instanceof IParameter) {
-
- if(!(leftSibElement instanceof IParameter)) leftSibElement = null;
- if(!(rightSibElement instanceof IParameter)) rightSibElement = null;
-
- Object paramOwner = ((IParameter) source).getOwner();
- if (paramOwner instanceof IMessageReference) {
- IParameter leftSib = (IParameter) leftSibElement;
- IParameter rightSib = (IParameter) rightSibElement;
- IParameter movingSib = (IParameter) source;
- Command command = ((IMessageReference) paramOwner).getReorderParametersCommand(leftSib, rightSib, movingSib);
- command.execute();
- performSelection(source);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/CenteredConnectionAnchor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/CenteredConnectionAnchor.java
deleted file mode 100644
index e5c9c29ee..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/CenteredConnectionAnchor.java
+++ /dev/null
@@ -1,88 +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.connections;
-
-import org.eclipse.draw2d.AbstractConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class CenteredConnectionAnchor extends AbstractConnectionAnchor
-{
- public static final int TOP = 0;
- public static final int BOTTOM = 1;
- public static final int LEFT = 2;
- public static final int RIGHT = 3;
-
- // These two are custom for rectangles with header blocks
- public static final int HEADER_LEFT = 4;
- public static final int HEADER_RIGHT = 5;
-
- private int location;
- private int inset;
- private int offset = 0;
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset) {
- super(owner);
- this.location = location;
- this.inset = inset;
- }
-
- public CenteredConnectionAnchor(IFigure owner, int location, int inset, int offset) {
- this(owner, location, inset);
- this.offset = offset;
- }
-
- public Point getLocation(Point reference) {
- Rectangle r = getOwner().getBounds();
- int x, y;
- switch (location) {
- case TOP:
- x = r.right() - r.width / 2 + offset;
- y = r.y + inset;
- break;
- case BOTTOM:
- x = r.right() - r.width / 2 + offset;
- y = r.bottom() - inset;
- break;
- case LEFT:
- x = r.x + inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case RIGHT:
- x = r.right() - inset;
- y = r.bottom() - r.height / 2 + offset;
- break;
- case HEADER_LEFT:
- x = r.x + inset;
- y = r.y + offset;
- break;
- case HEADER_RIGHT:
- x = r.right() - inset;
- y = r.y + offset;
- break;
-
- default:
- // Something went wrong. Attach the anchor to the middle
- x = r.right() - r.width / 2;
- y = r.bottom() - r.height / 2;
- }
- Point p = new Point(x,y);
-
- getOwner().translateToAbsolute(p);
- return p;
- }
-
- public Point getReferencePoint() {
- return getLocation(null);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/TopLeftConnectionAnchor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/TopLeftConnectionAnchor.java
deleted file mode 100644
index 840bda89c..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/connections/TopLeftConnectionAnchor.java
+++ /dev/null
@@ -1,35 +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.connections;
-
-import org.eclipse.draw2d.AbstractConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-
-public class TopLeftConnectionAnchor extends AbstractConnectionAnchor
-{
- IFigure label;
- public TopLeftConnectionAnchor(IFigure owner, IFigure label) {
- super(owner);
- this.label = label;
- }
- public Point getLocation(Point reference) {
- int x = getOwner().getBounds().x;
- int y = label.getBounds().y + label.getBounds().height / 2;
- Point p = new Point(x,y);
- getOwner().translateToAbsolute(p);
- return p;
- }
-
- public Point getReferencePoint() {
- return getLocation(null);
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDCCombo.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDCCombo.java
deleted file mode 100644
index 4a9b1daa1..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDCCombo.java
+++ /dev/null
@@ -1,1514 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 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.directedit;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.accessibility.AccessibleTextAdapter;
-import org.eclipse.swt.accessibility.AccessibleTextEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TypedListener;
-import org.eclipse.swt.widgets.Widget;
-
-/*
- * rmah:
- * This class is a copy of CCombo. We copy it because we wish to align
- * the Text of the Combo in our own special way. However there is no
- * way to access the Text object within CCombo.....
- * Bug for this issue to be opened
- */
-
-/**
- * The CCombo class represents a selectable user interface object
- * that combines a text field and a list and issues notification
- * when an item is selected from the list.
- * <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to add children to it, or set a layout on it.
- * </p>
- * <dl>
- * <dt><b>Styles:</b>
- * <dd>BORDER, READ_ONLY, FLAT</dd>
- * <dt><b>Events:</b>
- * <dd>Selection</dd>
- * </dl>
- */
-public final class ASDCCombo extends Composite {
-
- Text text;
- List list;
- int visibleItemCount = 5;
- Shell popup;
- Button arrow;
- boolean hasFocus;
- Listener listener, filter;
- Color foreground, background;
- Font font;
- private int textIndent = 5;
-
-/**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#BORDER
- * @see SWT#READ_ONLY
- * @see SWT#FLAT
- * @see Widget#getStyle()
- */
-public ASDCCombo (Composite parent, int style) {
- super (parent, style = checkStyle (style));
-
- int textStyle = SWT.SINGLE;
- if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY;
- if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT;
- text = new Text (this, textStyle);
- int arrowStyle = SWT.ARROW | SWT.DOWN;
- if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT;
- arrow = new Button (this, arrowStyle);
-
- listener = new Listener () {
- public void handleEvent (Event event) {
- if (popup == event.widget) {
- popupEvent (event);
- return;
- }
- if (text == event.widget) {
- textEvent (event);
- return;
- }
- if (list == event.widget) {
- listEvent (event);
- return;
- }
- if (arrow == event.widget) {
- arrowEvent (event);
- return;
- }
- if (ASDCCombo.this == event.widget) {
- comboEvent (event);
- return;
- }
- if (getShell () == event.widget) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
- filter = new Listener() {
- public void handleEvent(Event event) {
- Shell shell = ((Control)event.widget).getShell ();
- if (shell == ASDCCombo.this.getShell ()) {
- handleFocus (SWT.FocusOut);
- }
- }
- };
-
- int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize};
- for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
-
- int [] textEvents = {SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, SWT.MouseUp, SWT.Traverse, SWT.FocusIn};
- for (int i=0; i<textEvents.length; i++) text.addListener (textEvents [i], listener);
-
- int [] arrowEvents = {SWT.Selection, SWT.FocusIn};
- for (int i=0; i<arrowEvents.length; i++) arrow.addListener (arrowEvents [i], listener);
-
- createPopup(null, -1);
- initAccessible();
-}
-static int checkStyle (int style) {
- int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask;
-}
-/**
- * Adds the argument to the end of the receiver's list.
- *
- * @param string the new item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String,int)
- */
-public void add (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string);
-}
-/**
- * Adds the argument to the receiver's list at the given
- * zero-relative index.
- * <p>
- * Note: To add an item at the end of the list, use the
- * result of calling <code>getItemCount()</code> as the
- * index or use <code>add(String)</code>.
- * </p>
- *
- * @param string the new item
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #add(String)
- */
-public void add (String string, int index) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.add (string, index);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's text is modified, by sending
- * it one of the messages defined in the <code>ModifyListener</code>
- * interface.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #removeModifyListener
- */
-public void addModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Modify, typedListener);
-}
-/**
- * Adds the listener to the collection of listeners who will
- * be notified when the receiver's selection changes, by sending
- * it one of the messages defined in the <code>SelectionListener</code>
- * interface.
- * <p>
- * <code>widgetSelected</code> is called when the combo's list selection changes.
- * <code>widgetDefaultSelected</code> is typically called when ENTER is pressed the combo's text area.
- * </p>
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #removeSelectionListener
- * @see SelectionEvent
- */
-public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener (SWT.Selection,typedListener);
- addListener (SWT.DefaultSelection,typedListener);
-}
-void arrowEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.Selection: {
- dropDown (!isDropped ());
- break;
- }
- }
-}
-/**
- * Sets the selection in the receiver's text field to an empty
- * selection starting just before the first character. If the
- * text field is editable, this has the effect of placing the
- * i-beam at the start of the text.
- * <p>
- * Note: To clear the selected items in the receiver's list,
- * use <code>deselectAll()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #deselectAll
- */
-public void clearSelection () {
- checkWidget ();
- text.clearSelection ();
- list.deselectAll ();
-}
-void comboEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (popup != null && !popup.isDisposed ()) {
- list.removeListener (SWT.Dispose, listener);
- popup.dispose ();
- }
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- popup = null;
- text = null;
- list = null;
- arrow = null;
- break;
- case SWT.Move:
- dropDown (false);
- break;
- case SWT.Resize:
- internalLayout (false);
- break;
- }
-}
-
-public Point computeSize (int wHint, int hHint, boolean changed) {
- checkWidget ();
- int width = 0, height = 0;
- String[] items = list.getItems ();
- int textWidth = 0;
- GC gc = new GC (text);
- int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
- for (int i = 0; i < items.length; i++) {
- textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
- }
- gc.dispose();
- Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
- int borderWidth = getBorderWidth ();
-
- height = Math.max (textSize.y, arrowSize.y);
- width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
- if (wHint != SWT.DEFAULT) width = wHint;
- if (hHint != SWT.DEFAULT) height = hHint;
- return new Point (width + 2*borderWidth, height + 2*borderWidth);
-}
-void createPopup(String[] items, int selectionIndex) {
- // create shell and list
- popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP);
- int style = getStyle ();
- int listStyle = SWT.SINGLE | SWT.V_SCROLL;
- if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT;
- if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT;
- if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT;
- list = new List (popup, listStyle);
- if (font != null) list.setFont (font);
- if (foreground != null) list.setForeground (foreground);
- if (background != null) list.setBackground (background);
-
- int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate};
- for (int i=0; i<popupEvents.length; i++) popup.addListener (popupEvents [i], listener);
- int [] listEvents = {SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, SWT.FocusIn, SWT.Dispose};
- for (int i=0; i<listEvents.length; i++) list.addListener (listEvents [i], listener);
-
- if (items != null) list.setItems (items);
- if (selectionIndex != -1) list.setSelection (selectionIndex);
-}
-/**
- * Deselects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already deselected, it remains
- * deselected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to deselect
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void deselect (int index) {
- checkWidget ();
- list.deselect (index);
-}
-/**
- * Deselects all selected items in the receiver's list.
- * <p>
- * Note: To clear the selection in the receiver's text field,
- * use <code>clearSelection()</code>.
- * </p>
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see #clearSelection
- */
-public void deselectAll () {
- checkWidget ();
- list.deselectAll ();
-}
-void dropDown (boolean drop) {
- if (drop == isDropped ()) return;
- if (!drop) {
- popup.setVisible (false);
- text.selectAll();
- if (!isDisposed ()&& arrow.isFocusControl()) {
- text.setFocus();
- }
- return;
- }
-
- if (getShell() != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- list.removeListener (SWT.Dispose, listener);
- popup.dispose();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
-
- Point size = getSize ();
- int itemCount = list.getItemCount ();
- itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
- int itemHeight = list.getItemHeight () * itemCount;
- Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
- list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);
-
- int index = list.getSelectionIndex ();
- if (index != -1) list.setTopIndex (index);
- Display display = getDisplay ();
- Rectangle listRect = list.getBounds ();
- Rectangle parentRect = display.map (getParent (), null, getBounds ());
- Point comboSize = getSize ();
- Rectangle displayRect = getMonitor ().getClientArea ();
- int width = Math.max (comboSize.x, listRect.width + 2);
- int height = listRect.height + 2;
- int x = parentRect.x;
- int y = parentRect.y + comboSize.y;
- if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height;
- if (x + width > displayRect.x + displayRect.width) x = displayRect.x + displayRect.width - listRect.width;
- popup.setBounds (x, y, width, height);
- popup.setVisible (true);
- list.setFocus ();
-}
-/*
- * Return the lowercase of the first non-'&' character following
- * an '&' character in the given string. If there are no '&'
- * characters in the given string, return '\0'.
- */
-char _findMnemonic (String string) {
- if (string == null) return '\0';
- int index = 0;
- int length = string.length ();
- do {
- while (index < length && string.charAt (index) != '&') index++;
- if (++index >= length) return '\0';
- if (string.charAt (index) != '&') return Character.toLowerCase (string.charAt (index));
- index++;
- } while (index < length);
- return '\0';
-}
-/*
- * Return the Label immediately preceding the receiver in the z-order,
- * or null if none.
- */
-Label getAssociatedLabel () {
- Control[] siblings = getParent ().getChildren ();
- for (int i = 0; i < siblings.length; i++) {
- if (siblings [i] == this) {
- if (i > 0 && siblings [i-1] instanceof Label) {
- return (Label) siblings [i-1];
- }
- }
- }
- return null;
-}
-public Control [] getChildren () {
- checkWidget();
- return new Control [0];
-}
-/**
- * Gets the editable state.
- *
- * @return whether or not the receiver is editable
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public boolean getEditable () {
- checkWidget ();
- return text.getEditable();
-}
-/**
- * Returns the item at the given, zero-relative index in the
- * receiver's list. Throws an exception if the index is out
- * of range.
- *
- * @param index the index of the item to return
- * @return the item at the given index
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getItem (int index) {
- checkWidget();
- return list.getItem (index);
-}
-/**
- * Returns the number of items contained in the receiver's list.
- *
- * @return the number of items
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemCount () {
- checkWidget ();
- return list.getItemCount ();
-}
-/**
- * Returns the height of the area which would be used to
- * display <em>one</em> of the items in the receiver's list.
- *
- * @return the height of one item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getItemHeight () {
- checkWidget ();
- return list.getItemHeight ();
-}
-/**
- * Returns an array of <code>String</code>s which are the items
- * in the receiver's list.
- * <p>
- * Note: This is not the actual structure used by the receiver
- * to maintain its list of items, so modifying the array will
- * not affect the receiver.
- * </p>
- *
- * @return the items in the receiver's list
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String [] getItems () {
- checkWidget ();
- return list.getItems ();
-}
-public Menu getMenu() {
- return text.getMenu();
-}
-/**
- * Returns a <code>Point</code> whose x coordinate is the start
- * of the selection in the receiver's text field, and whose y
- * coordinate is the end of the selection. The returned values
- * are zero-relative. An "empty" selection as indicated by
- * the the x and y coordinates having the same value.
- *
- * @return a point representing the selection start and end
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Point getSelection () {
- checkWidget ();
- return text.getSelection ();
-}
-/**
- * Returns the zero-relative index of the item which is currently
- * selected in the receiver's list, or -1 if no item is selected.
- *
- * @return the index of the selected item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getSelectionIndex () {
- checkWidget ();
- return list.getSelectionIndex ();
-}
-public int getStyle () {
- int style = super.getStyle ();
- style &= ~SWT.READ_ONLY;
- if (!text.getEditable()) style |= SWT.READ_ONLY;
- return style;
-}
-/**
- * Returns a string containing a copy of the contents of the
- * receiver's text field.
- *
- * @return the receiver's text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public String getText () {
- checkWidget ();
- return text.getText ();
-}
-/**
- * Returns the height of the receivers's text field.
- *
- * @return the text height
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextHeight () {
- checkWidget ();
- return text.getLineHeight ();
-}
-/**
- * Returns the maximum number of characters that the receiver's
- * text field is capable of holding. If this has not been changed
- * by <code>setTextLimit()</code>, it will be the constant
- * <code>Combo.LIMIT</code>.
- *
- * @return the text limit
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int getTextLimit () {
- checkWidget ();
- return text.getTextLimit ();
-}
-/**
- * Gets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @return the number of items that are visible
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public int getVisibleItemCount () {
- checkWidget ();
- return visibleItemCount;
-}
-void handleFocus (int type) {
- if (isDisposed ()) return;
- switch (type) {
- case SWT.FocusIn: {
- if (hasFocus) return;
-// if (getEditable ()) text.selectAll ();
- hasFocus = true;
- Shell shell = getShell ();
- shell.removeListener (SWT.Deactivate, listener);
- shell.addListener (SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- display.addFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusIn, e);
- break;
- }
- case SWT.FocusOut: {
- if (!hasFocus) return;
- Control focusControl = getDisplay ().getFocusControl ();
- if (focusControl == arrow || focusControl == list || focusControl == text) return;
- hasFocus = false;
- Shell shell = getShell ();
- shell.removeListener(SWT.Deactivate, listener);
- Display display = getDisplay ();
- display.removeFilter (SWT.FocusIn, filter);
- Event e = new Event ();
- notifyListeners (SWT.FocusOut, e);
- break;
- }
- }
-}
-/**
- * Searches the receiver's list starting at the first item
- * (index 0) until an item is found that is equal to the
- * argument, and returns the index of that item. If no item
- * is found, returns -1.
- *
- * @param string the search item
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string);
-}
-/**
- * Searches the receiver's list starting at the given,
- * zero-relative index until an item is found that is equal
- * to the argument, and returns the index of that item. If
- * no item is found or the starting index is out of range,
- * returns -1.
- *
- * @param string the search item
- * @param start the zero-relative index at which to begin the search
- * @return the index of the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public int indexOf (String string, int start) {
- checkWidget ();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return list.indexOf (string, start);
-}
-
-void initAccessible() {
- AccessibleAdapter accessibleAdapter = new AccessibleAdapter () {
- public void getName (AccessibleEvent e) {
- String name = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- name = stripMnemonic (label.getText());
- }
- e.result = name;
- }
- public void getKeyboardShortcut(AccessibleEvent e) {
- String shortcut = null;
- Label label = getAssociatedLabel ();
- if (label != null) {
- String text = label.getText ();
- if (text != null) {
- char mnemonic = _findMnemonic (text);
- if (mnemonic != '\0') {
- shortcut = "Alt+"+mnemonic; //$NON-NLS-1$
- }
- }
- }
- e.result = shortcut;
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- };
- getAccessible ().addAccessibleListener (accessibleAdapter);
- text.getAccessible ().addAccessibleListener (accessibleAdapter);
- list.getAccessible ().addAccessibleListener (accessibleAdapter);
-
- arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() {
- public void getName (AccessibleEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- public void getKeyboardShortcut (AccessibleEvent e) {
- e.result = "Alt+Down Arrow"; //$NON-NLS-1$
- }
- public void getHelp (AccessibleEvent e) {
- e.result = getToolTipText ();
- }
- });
-
- getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() {
- public void getCaretOffset (AccessibleTextEvent e) {
- e.offset = text.getCaretPosition ();
- }
- public void getSelectionRange(AccessibleTextEvent e) {
- Point sel = text.getSelection();
- e.offset = sel.x;
- e.length = sel.y - sel.x;
- }
- });
-
- getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getChildAtPoint (AccessibleControlEvent e) {
- Point testPoint = toControl (e.x, e.y);
- if (getBounds ().contains (testPoint)) {
- e.childID = ACC.CHILDID_SELF;
- }
- }
-
- public void getLocation (AccessibleControlEvent e) {
- Rectangle location = getBounds ();
- Point pt = toDisplay (location.x, location.y);
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
-
- public void getChildCount (AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- public void getRole (AccessibleControlEvent e) {
- e.detail = ACC.ROLE_COMBOBOX;
- }
-
- public void getState (AccessibleControlEvent e) {
- e.detail = ACC.STATE_NORMAL;
- }
-
- public void getValue (AccessibleControlEvent e) {
- e.result = getText ();
- }
- });
-
- text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () {
- public void getRole (AccessibleControlEvent e) {
- e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL;
- }
- });
-
- arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() {
- public void getDefaultAction (AccessibleControlEvent e) {
- e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
-}
-boolean isDropped () {
- return popup.getVisible ();
-}
-public boolean isFocusControl () {
- checkWidget();
- if (text.isFocusControl () || arrow.isFocusControl () || list.isFocusControl () || popup.isFocusControl ()) {
- return true;
- }
- return super.isFocusControl ();
-}
-
-public void setTextIndent(int indent) {
- textIndent = indent;
-}
-
-void internalLayout (boolean changed) {
- if (isDropped ()) dropDown (false);
- Rectangle rect = getClientArea ();
- int width = rect.width;
- int height = rect.height;
- Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
-
- text.pack();
- int textHeight = text.getBounds().height;
- int textX = textIndent;
- int textY = (height - textHeight) / 2;
- text.setLocation(textX, textY);
-
- arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
-}
-void listEvent (Event event) {
- switch (event.type) {
- case SWT.Dispose:
- if (getShell () != popup.getParent ()) {
- String[] items = list.getItems ();
- int selectionIndex = list.getSelectionIndex ();
- popup = null;
- list = null;
- createPopup (items, selectionIndex);
- }
- break;
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- dropDown (false);
- break;
- }
- case SWT.Selection: {
- int index = list.getSelectionIndex ();
- if (index == -1) return;
- text.setText (list.getItem (index));
-// text.selectAll ();
- list.setSelection (index);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- e.doit = event.doit;
- if (!isDropped()) {
- notifyListeners (SWT.Selection, e);
- }
- event.doit = e.doit;
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ESCAPE:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- event.doit = false;
- break;
- }
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
-
- notifyListeners (SWT.KeyUp, e);
-
-
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.ESC) {
- // Escape key cancels popup list
- dropDown (false);
- }
- if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) {
- dropDown (false);
- }
-
- if (event.character == SWT.CR) {
- // Enter causes default selection
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- // At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- Event e = new Event();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners(SWT.KeyDown, e);
- break;
-
- }
- }
-}
-
-void popupEvent(Event event) {
- switch (event.type) {
- case SWT.Paint:
- // draw black rectangle around list
- Rectangle listRect = list.getBounds();
- Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK);
- event.gc.setForeground(black);
- event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1);
- break;
- case SWT.Close:
- event.doit = false;
- dropDown (false);
- break;
- case SWT.Deactivate:
- dropDown (false);
- break;
- }
-}
-public void redraw () {
- super.redraw();
- text.redraw();
- arrow.redraw();
- if (popup.isVisible()) list.redraw();
-}
-public void redraw (int x, int y, int width, int height, boolean all) {
- super.redraw(x, y, width, height, true);
-}
-
-/**
- * Removes the item from the receiver's list at the given
- * zero-relative index.
- *
- * @param index the index for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int index) {
- checkWidget();
- list.remove (index);
-}
-/**
- * Removes the items from the receiver's list which are
- * between the given zero-relative start and end
- * indices (inclusive).
- *
- * @param start the start of the range
- * @param end the end of the range
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (int start, int end) {
- checkWidget();
- list.remove (start, end);
-}
-/**
- * Searches the receiver's list starting at the first item
- * until an item is found that is equal to the argument,
- * and removes that item from the list.
- *
- * @param string the item to remove
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void remove (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- list.remove (string);
-}
-/**
- * Removes all of the items from the receiver's list and clear the
- * contents of receiver's text field.
- * <p>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void removeAll () {
- checkWidget();
- text.setText (""); //$NON-NLS-1$
- list.removeAll ();
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's text is modified.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see ModifyListener
- * @see #addModifyListener
- */
-public void removeModifyListener (ModifyListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Modify, listener);
-}
-/**
- * Removes the listener from the collection of listeners who will
- * be notified when the receiver's selection changes.
- *
- * @param listener the listener which should no longer be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see SelectionListener
- * @see #addSelectionListener
- */
-public void removeSelectionListener (SelectionListener listener) {
- checkWidget();
- if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection,listener);
-}
-/**
- * Selects the item at the given zero-relative index in the receiver's
- * list. If the item at the index was already selected, it remains
- * selected. Indices that are out of range are ignored.
- *
- * @param index the index of the item to select
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void select (int index) {
- checkWidget();
- if (index == -1) {
- list.deselectAll ();
- text.setText (""); //$NON-NLS-1$
- return;
- }
- if (0 <= index && index < list.getItemCount()) {
- if (index != getSelectionIndex()) {
- text.setText (list.getItem (index));
-// text.selectAll ();
- list.select (index);
- list.showSelection ();
- }
- }
-}
-public void setBackground (Color color) {
- super.setBackground(color);
- background = color;
- if (text != null) text.setBackground(color);
- if (list != null) list.setBackground(color);
- if (arrow != null) arrow.setBackground(color);
-}
-/**
- * Sets the editable state.
- *
- * @param editable the new editable state
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setEditable (boolean editable) {
- checkWidget ();
- text.setEditable(editable);
-}
-public void setEnabled (boolean enabled) {
- super.setEnabled(enabled);
- if (popup != null) popup.setVisible (false);
- if (text != null) text.setEnabled(enabled);
- if (arrow != null) arrow.setEnabled(enabled);
-}
-public boolean setFocus () {
- checkWidget();
- return text.setFocus ();
-}
-public void setFont (Font font) {
- super.setFont (font);
- this.font = font;
- text.setFont (font);
- list.setFont (font);
- internalLayout (true);
-}
-public void setForeground (Color color) {
- super.setForeground(color);
- foreground = color;
- if (text != null) text.setForeground(color);
- if (list != null) list.setForeground(color);
- if (arrow != null) arrow.setForeground(color);
-}
-/**
- * Sets the text of the item in the receiver's list at the given
- * zero-relative index to the string argument. This is equivalent
- * to <code>remove</code>'ing the old item at the index, and then
- * <code>add</code>'ing the new item at that index.
- *
- * @param index the index for the item
- * @param string the new text for the item
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItem (int index, String string) {
- checkWidget();
- list.setItem (index, string);
-}
-/**
- * Sets the receiver's list to be the given array of items.
- *
- * @param items the array of items
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the items array is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if an item in the items array is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setItems (String [] items) {
- checkWidget ();
- list.setItems (items);
- if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$
-}
-/**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note: No Layout can be set on this Control because it already
- * manages the size and position of its children.
- * </p>
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setLayout (Layout layout) {
- checkWidget ();
- return;
-}
-public void setMenu(Menu menu) {
- text.setMenu(menu);
-}
-/**
- * Sets the selection in the receiver's text field to the
- * range specified by the argument whose x coordinate is the
- * start of the selection and whose y coordinate is the end
- * of the selection.
- *
- * @param selection a point representing the new selection start and end
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the point is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setSelection (Point selection) {
- checkWidget();
- if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- text.setSelection (selection.x, selection.y);
-}
-
-/**
- * Sets the contents of the receiver's text field to the
- * given string.
- * <p>
- * Note: The text field in a <code>Combo</code> is typically
- * only capable of displaying a single line of text. Thus,
- * setting the text to a string containing line breaks or
- * other special characters will probably cause it to
- * display incorrectly.
- * </p>
- *
- * @param string the new text
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the string is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setText (String string) {
- checkWidget();
- if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- int index = list.indexOf (string);
- if (index == -1) {
- list.deselectAll ();
- text.setText (string);
- return;
- }
- text.setText (string);
-// text.selectAll ();
- list.setSelection (index);
- list.showSelection ();
-}
-/**
- * Sets the maximum number of characters that the receiver's
- * text field is capable of holding to be the argument.
- *
- * @param limit new text limit
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_CANNOT_BE_ZERO - if the limit is zero</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public void setTextLimit (int limit) {
- checkWidget();
- text.setTextLimit (limit);
-}
-
-public void setToolTipText (String string) {
- checkWidget();
- super.setToolTipText(string);
- arrow.setToolTipText (string);
- text.setToolTipText (string);
-}
-
-public void setVisible (boolean visible) {
- super.setVisible(visible);
- if (!visible) popup.setVisible(false);
-}
-/**
- * Sets the number of items that are visible in the drop
- * down portion of the receiver's list.
- *
- * @param count the new number of items to be visible
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.0
- */
-public void setVisibleItemCount (int count) {
- checkWidget ();
- if (count < 0) return;
- visibleItemCount = count;
-}
-String stripMnemonic (String string) {
- int index = 0;
- int length = string.length ();
- do {
- while ((index < length) && (string.charAt (index) != '&')) index++;
- if (++index >= length) return string;
- if (string.charAt (index) != '&') {
- return string.substring(0, index-1) + string.substring(index, length);
- }
- index++;
- } while (index < length);
- return string;
-}
-void textEvent (Event event) {
- switch (event.type) {
- case SWT.FocusIn: {
- handleFocus (SWT.FocusIn);
- break;
- }
- case SWT.KeyDown: {
- if (event.character == SWT.CR) {
- dropDown (false);
- Event e = new Event ();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.DefaultSelection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
-
- if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {
- event.doit = false;
- if ((event.stateMask & SWT.ALT) != 0) {
- boolean dropped = isDropped ();
-// text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
-
- int oldIndex = getSelectionIndex ();
- if (event.keyCode == SWT.ARROW_UP) {
- select (Math.max (oldIndex - 1, 0));
- } else {
- select (Math.min (oldIndex + 1, getItemCount () - 1));
- }
- if (oldIndex != getSelectionIndex ()) {
- Event e = new Event();
- e.time = event.time;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.Selection, e);
- }
- //At this point the widget may have been disposed.
- // If so, do not continue.
- if (isDisposed ()) break;
- }
-
- // Further work : Need to add support for incremental search in
- // pop up list as characters typed in text widget
-
-
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- //notifyListeners (SWT.KeyDown, e);
- break;
- }
- case SWT.KeyUp: {
- Event e = new Event ();
- e.time = event.time;
- e.character = event.character;
- e.keyCode = event.keyCode;
- e.stateMask = event.stateMask;
- notifyListeners (SWT.KeyUp, e);
- break;
- }
- case SWT.MenuDetect: {
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.MenuDetect, e);
- break;
- }
- case SWT.Modify: {
- list.deselectAll ();
- Event e = new Event ();
- e.time = event.time;
- notifyListeners (SWT.Modify, e);
- break;
- }
- case SWT.MouseDown: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
- boolean dropped = isDropped ();
-// text.selectAll ();
- if (!dropped) setFocus ();
- dropDown (!dropped);
- break;
- }
- case SWT.MouseUp: {
- if (event.button != 1) return;
- if (text.getEditable ()) return;
-// text.selectAll ();
- break;
- }
- case SWT.Traverse: {
- switch (event.detail) {
- case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_ARROW_PREVIOUS:
- case SWT.TRAVERSE_ARROW_NEXT:
- // The enter causes default selection and
- // the arrow keys are used to manipulate the list contents so
- // do not use them for traversal.
- event.doit = false;
- break;
- }
-
- Event e = new Event ();
- e.time = event.time;
- e.detail = event.detail;
- e.doit = event.doit;
- e.character = event.character;
- e.keyCode = event.keyCode;
- notifyListeners (SWT.Traverse, e);
- event.doit = e.doit;
- event.detail = e.detail;
- break;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java
deleted file mode 100644
index af33c58f1..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java
+++ /dev/null
@@ -1,311 +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.directedit;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog;
-
-/*
- * This is a copy of ComboBoxCellEditor.
- * We need to apply and deactivate the combo on a single click (not on a double click like
- * the ComboBoxCellEditor).
- */
-public class ASDComboBoxCellEditor extends CellEditor {
-
- /**
- * The list of items to present in the combo box.
- */
- private String[] items;
-
- /**
- * The zero-based index of the selected item.
- */
- int selection;
-
- /**
- * The custom combo box control.
- */
- ASDCCombo comboBox;
-
- /**
- * Used to determine if the value should be applied to the cell.
- */
- private boolean continueApply;
- private Object selectedValue;
- private ComponentReferenceEditManager componentReferenceEditManager;
- private int textIndent = 5;
-
- /**
- * Default ComboBoxCellEditor style
- */
- private static final int defaultStyle = SWT.NONE;
-
- /**
- * Creates a new cell editor with a combo containing the given
- * list of choices and parented under the given control. The cell
- * editor value is the zero-based index of the selected item.
- * Initially, the cell editor has no cell validator and
- * the first item in the list is selected.
- *
- * @param parent the parent control
- * @param items the list of strings for the combo box
- */
- public ASDComboBoxCellEditor(Composite parent, String[] items, ComponentReferenceEditManager editManager) {
- super(parent, defaultStyle);
- setItems(items);
- componentReferenceEditManager = editManager;
- }
-
- /**
- * Returns the list of choices for the combo box
- *
- * @return the list of choices for the combo box
- */
- public String[] getItems() {
- return this.items;
- }
-
- /**
- * Sets the list of choices for the combo box
- *
- * @param items the list of choices for the combo box
- */
- public void setItems(String[] items) {
- Assert.isNotNull(items);
- this.items = items;
- populateComboBoxItems();
- }
-
- public void setTextIndent(int indent) {
- textIndent = indent;
- comboBox.setTextIndent(indent);
- }
-
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected Control createControl(Composite parent) {
- comboBox = new ASDCCombo(parent, getStyle());
- comboBox.setFont(parent.getFont());
- comboBox.setTextIndent(textIndent);
-
- comboBox.addKeyListener(new KeyAdapter() {
- // hook key pressed - see PR 14201
- public void keyPressed(KeyEvent e) {
- keyReleaseOccured(e);
- }
- });
-
- comboBox.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent event) {
- selectionMade();
- }
-
- public void widgetSelected(SelectionEvent event) {
- selectionMade();
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE
- || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- comboBox.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- ASDComboBoxCellEditor.this.focusLost();
- }
- });
- return comboBox;
- }
-
- private Object invokeDialog(IComponentDialog dialog) {
- Object newValue = null;
-
- if (dialog == null) {
- return null;
- }
-
- if (dialog.createAndOpen() == Window.OK) {
- newValue = dialog.getSelectedComponent();
- }
- else {
- continueApply = false;
- }
-
- return newValue;
- }
-
- /**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method returns
- * the zero-based index of the current selection.
- *
- * @return the zero-based index of the current selection wrapped
- * as an <code>Integer</code>
- */
- protected Object doGetValue() {
- return new Integer(selection);
- }
-
- /* (non-Javadoc)
- * Method declared on CellEditor.
- */
- protected void doSetFocus() {
- comboBox.setFocus();
- comboBox.dropDown(true);
-// String comboText = comboBox.getText();
-// comboBox.setText(" " + comboText);
- }
-
- /**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method sets the
- * minimum width of the cell. The minimum width is 10 characters
- * if <code>comboBox</code> is not <code>null</code> or <code>disposed</code>
- * eles it is 60 pixels to make sure the arrow button and some text is visible.
- * The list of CCombo will be wide enough to show its longest item.
- */
- public LayoutData getLayoutData() {
- LayoutData layoutData = super.getLayoutData();
- if ((comboBox == null) || comboBox.isDisposed())
- layoutData.minimumWidth = 60;
- else {
- // make the comboBox 10 characters wide
- GC gc = new GC(comboBox);
- layoutData.minimumWidth = (gc.getFontMetrics()
- .getAverageCharWidth() * 10) + 10;
- gc.dispose();
- }
- return layoutData;
- }
-
- /**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method
- * accepts a zero-based index of a selection.
- *
- * @param value the zero-based index of the selection wrapped
- * as an <code>Integer</code>
- */
- protected void doSetValue(Object value) {
- Assert.isTrue(comboBox != null && (value instanceof Integer));
- selection = ((Integer) value).intValue();
- comboBox.select(selection);
- }
-
- /**
- * Updates the list of choices for the combo box for the current control.
- */
- private void populateComboBoxItems() {
- if (comboBox != null && items != null) {
- comboBox.removeAll();
- for (int i = 0; i < items.length; i++)
- comboBox.add(items[i], i);
-
- setValueValid(true);
- selection = 0;
- }
- }
-
- /**
- * Applies the currently selected value and deactiavates the cell editor
- */
- void applyEditorValueAndDeactivate() {
- // must set the selection before getting value
- selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
- markDirty();
- boolean isValid = isCorrect(newValue);
- setValueValid(isValid);
- if (!isValid) {
- // try to insert the current value into the error message.
- setErrorMessage(MessageFormat.format(getErrorMessage(),
- new Object[] { items[selection] }));
- }
- fireApplyEditorValue();
- deactivate();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#focusLost()
- */
- protected void focusLost() {
- if (isActivated()) {
- applyEditorValueAndDeactivate();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent)
- */
- protected void keyReleaseOccured(KeyEvent keyEvent) {
- if (keyEvent.character == '\u001b') { // Escape character
- fireCancelEditor();
- } else if (keyEvent.character == '\t') { // tab key
- applyEditorValueAndDeactivate();
- }
- }
-
- public Object getSelectedValue() {
- return selectedValue;
- }
-
-
- public void selectionMade() {
- Object newValue = null;
- continueApply = true;
- selection = comboBox.getSelectionIndex();
- String stringSelection = items[selection];
-
- if (stringSelection.equals(Messages._UI_BUTTON_BROWSE)) { //$NON-NLS-1$
- newValue = invokeDialog(componentReferenceEditManager.getBrowseDialog());
- }
- else if (stringSelection.equals(Messages._UI_BUTTON_NEW)) { //$NON-NLS-1$
- newValue = invokeDialog(componentReferenceEditManager.getNewDialog());
- }
-
- if (newValue == null) {
- int index = comboBox.getSelectionIndex();
- if (index != -1) {
- selectedValue = comboBox.getItem(index);
- }
- }
- else {
- selectedValue = newValue;
- }
- applyEditorValueAndDeactivate();
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ComboBoxCellEditorManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ComboBoxCellEditorManager.java
deleted file mode 100644
index 849ac6bc9..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ComboBoxCellEditorManager.java
+++ /dev/null
@@ -1,204 +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.directedit;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellEditorListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-public abstract class ComboBoxCellEditorManager extends DirectEditManager
-{
- protected Label label;
-
- public ComboBoxCellEditorManager(GraphicalEditPart source, Label label)
- {
- super(source, ComboBoxCellEditor.class, new InternalCellEditorLocator(label));
- this.label = label;
- }
-
- protected void initCellEditor()
- {
- String initialLabelText = label.getText();
-
- ASDCCombo combo = (ASDCCombo)getCellEditor().getControl();
- combo.setFont(label.getFont());
- combo.setForeground(label.getForegroundColor());
- combo.setBackground(label.getBackgroundColor());
- combo.setVisibleItemCount(20);
- combo.setEditable(false);
-
- ICellEditorListener cellEditorListener = new ICellEditorListener()
- {
- public void cancelEditor()
- {
- }
- public void applyEditorValue()
- {
- }
- public void editorValueChanged(boolean old, boolean newState)
- {
- }
- };
- getCellEditor().addListener(cellEditorListener);
-
- String[] item = combo.getItems();
- for (int i = 0; i < item.length; i++)
- {
- if (item[i].equals(initialLabelText))
- {
- getCellEditor().setValue(new Integer(i));
- break;
- }
- }
- }
-
- // hack... for some reason the ComboBoxCellEditor does't fire an editorValueChanged to set the dirty flag
- // unless we overide this method to return true, the manager is not notified of changes made in the cell editor
- protected boolean isDirty()
- {
- return true;
- }
-
- protected CellEditor createCellEditorOn(Composite composite)
- {
- boolean isLabelTextInList = false;
- List list = computeComboContent();
- for (Iterator i = list.iterator(); i.hasNext(); )
- {
- String string = (String)i.next();
- if (string.equals(label.getText()))
- {
- isLabelTextInList = true;
- break;
- }
- }
-
- if (!isLabelTextInList)
- {
- list.add(label.getText());
- }
-
- List sortedList = computeSortedList(list);
- String[] stringArray = new String[sortedList.size()];
- for (int i = 0; i < stringArray.length; i++)
- {
- stringArray[i] = (String)sortedList.get(i);
- }
- return createCellEditor(composite, stringArray);
- }
-
- protected CellEditor createCellEditor(Composite composite, String[] stringArray)
- {
- return new ComboBoxCellEditor(composite, stringArray);
- }
-
- protected List computeSortedList(List list)
- {
- return list;
- }
-
- protected abstract List computeComboContent();
-
- protected abstract void performModify(Object value);
-
- public static class InternalCellEditorLocator implements CellEditorLocator
- {
- protected Label label;
-
- public InternalCellEditorLocator(Label label)
- {
- this.label = label;
- }
-
- public void relocate(CellEditor celleditor)
- {
- ASDCCombo combo = (ASDCCombo)celleditor.getControl();
- Rectangle labelParentBounds = label.getParent().getBounds().getCopy();
- label.translateToAbsolute(labelParentBounds);
-
- int x = labelParentBounds.x;
- int y = labelParentBounds.y;
- int widthK = labelParentBounds.width;
- int height = labelParentBounds.height;
- combo.setBounds(x, y + 1, widthK, height - 2);
- }
- }
-
- public void performEdit(CellEditor cellEditor)
- {
- ASDComboBoxCellEditor comboCellEditor = (ASDComboBoxCellEditor) cellEditor;
- ASDCCombo combo = (ASDCCombo)getCellEditor().getControl();
- int index = combo.getSelectionIndex();
- if (index != -1)
- {
- Object value = combo.getItem(index);
- if (comboCellEditor.getSelectedValue() != null) {
- value = comboCellEditor.getSelectedValue();
- }
-
- performModify(value);
- }
- else
- {
- String typedValue = combo.getText();
- if (combo.indexOf(typedValue) != -1)
- {
- performModify(typedValue);
- }
- else
- {
- String closeMatch = getCloseMatch(typedValue, combo.getItems());
- if (closeMatch != null)
- {
- performModify(closeMatch);
- }
- else
- {
- Display.getCurrent().beep();
- }
- }
- }
- }
-
- protected String getCloseMatch(String value, String[] items)
- {
- int matchIndex = -1;
-
- for (int i = 0; i < items.length; i++)
- {
- String item = items[i];
- String a = getLocalName(value);
- String b = getLocalName(item);
- if (a.equalsIgnoreCase(b))
- {
- matchIndex = i;
- break;
- }
- }
- return matchIndex != -1 ? items[matchIndex] : null;
- }
-
- protected String getLocalName(String string)
- {
- int index = string.indexOf(":"); //$NON-NLS-1$
- return (index != -1) ? string.substring(index + 1) : string;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/DirectEditSelectionTool.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/DirectEditSelectionTool.java
deleted file mode 100644
index 7eb49a6d1..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/DirectEditSelectionTool.java
+++ /dev/null
@@ -1,60 +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.directedit;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-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.tools.SelectionTool;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.INamedEditPart;
-
-/**
- * Extends the default GEF selection tools to send the
- * mouse events
- */
-public class DirectEditSelectionTool extends SelectionTool {
-
- protected INamedEditPart getSelectedPart() {
- if(getCurrentViewer() == null)
- return null;
- EditPart ep = getCurrentViewer().getFocusEditPart();
- if(ep instanceof INamedEditPart && ep.isActive())
- return (INamedEditPart)ep;
- return null;
- }
-
- protected boolean handleButtonDown(int button) {
- super.handleButtonDown(button);
- INamedEditPart selectedPart = getSelectedPart();
-
- if(selectedPart != null && button == 1) {
- Input i = getCurrentInput();
- Point l = translateLocation(i.getMouseLocation());
-
- IFigure f = ((AbstractGraphicalEditPart) selectedPart).getFigure();
- Rectangle bounds = f.getBounds();
- if(bounds.contains(l.x,l.y)) {
- selectedPart.performDirectEdit(translateLocation(new Point(l.x, l.y)));
- return true;
- }
- }
- return true;
- }
-
- protected Point translateLocation(Point mouseLocation) {
- FigureCanvas canvas = (FigureCanvas)getCurrentViewer().getControl();
- Point viewLocation = canvas.getViewport().getViewLocation();
- return new Point(mouseLocation.x + viewLocation.x,mouseLocation.y + viewLocation.y);
- }
-} \ 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/directedit/LabelCellEditorLocator.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelCellEditorLocator.java
deleted file mode 100644
index cc9164d38..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelCellEditorLocator.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.directedit;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.INamedEditPart;
-
-public class LabelCellEditorLocator implements CellEditorLocator {
- private INamedEditPart namedEditPart;
- private Point cursorLocation;
-
- public LabelCellEditorLocator(INamedEditPart namedEditPart, Point cursorLocation) {
- this.namedEditPart = namedEditPart;
- this.cursorLocation = cursorLocation;
- }
-
- public void relocate(CellEditor celleditor) {
- Text text = (Text)celleditor.getControl();
- if (text.getBounds().x <= 0 && namedEditPart.getLabelFigure() != null) {
- Label label = namedEditPart.getLabelFigure();
- Rectangle boundingRect = label.getTextBounds();
-
- // Reduce the width by the amount we shifted along the x-axis
- int delta = Math.abs(boundingRect.x - label.getParent().getBounds().x);
-// boundingRect.width = tableCellFigure.getPreferredSize().width - delta;
-
- label.getParent().translateToAbsolute(boundingRect);
- org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
- boundingRect.translate(trim.x, trim.y);
-// boundingRect.width = boundingRect.width - trim.x;
- boundingRect.height = boundingRect.height - trim.y;
-
- boundingRect.width = label.getParent().getBounds().width - delta;
- text.setBounds(boundingRect.x, boundingRect.y, boundingRect.width, boundingRect.height);
-
- if (cursorLocation != null) {
- // Translate point
- Point translatedPoint = new Point(cursorLocation.x - boundingRect.x,cursorLocation.y - boundingRect.y);
-
- // Calculate text offset corresponding to the translated point
- text.setSelection(0, 0);
- int xCaret = text.getCaretLocation().x;
- int offset = text.getCaretPosition();
- while (xCaret < translatedPoint.x) {
- text.setSelection(offset + 1, offset + 1);
- xCaret = text.getCaretLocation().x;
- int newOffset = text.getCaretPosition();
- if (newOffset == offset) {
- break;
- }
- offset++;
- }
- text.setSelection(offset, offset);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelEditManager.java
deleted file mode 100644
index 8c03ade2a..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelEditManager.java
+++ /dev/null
@@ -1,140 +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.directedit;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.INamedEditPart;
-
-public class LabelEditManager extends DirectEditManager {
-
- private IActionBars actionBars;
- private CellEditorActionHandler actionHandler;
- private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
- private Font scaledFont;
-
- public LabelEditManager(GraphicalEditPart source, CellEditorLocator locator) {
- super(source, null, locator);
- }
-
- /**
- * @see org.eclipse.gef.tools.DirectEditManager#bringDown()
- */
- protected void bringDown() {
- if (actionHandler != null) {
- actionHandler.dispose();
- actionHandler = null;
- }
- if (actionBars != null) {
- restoreSavedActions(actionBars);
- actionBars.updateActionBars();
- actionBars = null;
- }
-
- Font disposeFont = scaledFont;
- scaledFont = null;
- super.bringDown();
- if (disposeFont != null)
- disposeFont.dispose();
- }
-
- public void showFeedback() {
- getEditPart().showSourceFeedback(getDirectEditRequest());
- }
-
- protected CellEditor createCellEditorOn(Composite composite) {
- return new TextCellEditor(composite, SWT.SINGLE | SWT.WRAP);
- }
-
- protected void initCellEditor() {
- Text text = (Text)getCellEditor().getControl();
- Label label = ((INamedEditPart) getEditPart()).getLabelFigure();
-
- if (label != null) {
- scaledFont = label.getFont();
-
- // TODO: rmah: hack here to set the background color of the
- // direct edit Text. Solution is to make the Text transparent...
- Color color = label.getBackgroundColor();
- if (color.equals(DesignViewGraphicsConstants.tableCellSelectionColor)) {
- text.setBackground(color);
- }
- else {
-// text.setBackground(ColorConstants.lightBlue);
- text.setBackground(ColorConstants.white);
- }
-
- String initialLabelText = label.getText();
- getCellEditor().setValue(initialLabelText);
- }
- else {
- scaledFont = label.getParent().getFont();
- text.setBackground(label.getParent().getBackgroundColor());
- }
-
- FontData data = scaledFont.getFontData()[0];
- Dimension fontSize = new Dimension(0, data.getHeight());
- label.getParent().translateToAbsolute(fontSize);
- data.setHeight(fontSize.height);
- scaledFont = new Font(null, data);
-
- text.setFont(scaledFont);
-// text.selectAll();
-
- // Hook the cell editor's copy/paste actions to the actionBars so that they can
- // be invoked via keyboard shortcuts.
- actionBars = ASDEditorPlugin.getActiveEditor().getEditorSite().getActionBars();
- saveCurrentActions(actionBars);
- actionHandler = new CellEditorActionHandler(actionBars);
- actionHandler.addCellEditor(getCellEditor());
- actionBars.updateActionBars();
- }
-
- private void restoreSavedActions(IActionBars actionBars){
- actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
- actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
- actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
- actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
- actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
- actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
- }
-
- private void saveCurrentActions(IActionBars actionBars) {
- copy = actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
- paste = actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
- delete = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
- selectAll = actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
- cut = actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
- find = actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
- undo = actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
- redo = actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/TypeReferenceDirectEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/TypeReferenceDirectEditManager.java
deleted file mode 100644
index fdfa992d4..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/TypeReferenceDirectEditManager.java
+++ /dev/null
@@ -1,178 +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.directedit;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ParameterTypeEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter;
-import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-
-public class TypeReferenceDirectEditManager extends ComboBoxCellEditorManager
-{
- protected AbstractGraphicalEditPart editPart;
- protected IParameter setObject;
-
- public TypeReferenceDirectEditManager(IParameter parameter, AbstractGraphicalEditPart source, Label label)
- {
- super(source, label);
- editPart = source;
- setObject = parameter;
- }
-
- protected CellEditor createCellEditorOn(Composite composite)
- {
- return super.createCellEditorOn(composite);
- }
-
- protected List computeComboContent()
- {
- List list = new ArrayList();
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null)
- {
- list.add(Messages._UI_BUTTON_BROWSE); //$NON-NLS-1$
- list.add(Messages._UI_BUTTON_NEW); //$NON-NLS-1$
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- list.add(componentSpecification.getName());
- }
- }
- ComponentSpecification[] history = editManager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- list.add(componentSpecification.getName());
- }
- }
- }
- return list;
- }
-
- public void performModify(Object value)
- {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager == null)
- {
- return;
- }
-
- // our crude combo box can only work with 'String' objects
- // if we get a String back we need to do some clever mapping to get the ComponentSpecification
- //
- if (value instanceof String)
- {
- value = getComponentSpecificationForValue((String)value);
- }
- // we assume the selected value is always of the form of a ComponentSpecification
- //
- if (value instanceof ComponentSpecification)
- {
- editManager.modifyComponentReference(getEditPart().getModel(), (ComponentSpecification) value);
- }
- }
-
- protected List computeSortedList(List list)
- {
-// return TypesHelper.sortList(list);
- return list;
- }
-
- private int getTextIndent() {
- if (editPart instanceof ParameterTypeEditPart) {
- Rectangle bounds = ((ParameterTypeEditPart) editPart).getFigure().getBounds();
- int textX = ((ParameterTypeEditPart) editPart).getLabelFigure().getTextBounds().x;
- return textX - bounds.x;
- }
-
- return 5;
- }
-
- protected CellEditor createCellEditor(Composite composite, String[] stringArray)
- {
- ASDComboBoxCellEditor cellEditor = new ASDComboBoxCellEditor(composite, stringArray, getComponentReferenceEditManager());
- cellEditor.setTextIndent(getTextIndent());
- //((ADTComboBoxCellEditor) cellEditor).setObjectToModify(setObject);
-
- return cellEditor;
- }
-
- public ComponentReferenceEditManager getComponentReferenceEditManager() {
- ComponentReferenceEditManager editManager = null;
- boolean isType = true;
-
- // TODO: We're specifically looking for and using WSDL11 Impl classes.... We should
- // investigate further to see if we can avoid knowing about WSDL11 Impl classes.
- if (setObject instanceof W11ParameterForPart) {
- isType = ((W11ParameterForPart) setObject).isType();
- }
-
- if (isType) {
- editManager = (ComponentReferenceEditManager) ReferenceEditManagerHelper.getXSDTypeReferenceEditManager(setObject);
- }
- else {
- editManager = (ComponentReferenceEditManager) ReferenceEditManagerHelper.getXSDElementReferenceEditManager(setObject);
- }
-
- return editManager;
- }
-
- // TODO: rmah: This code should live in a common place..... This code is also used in other UI scenarios when
- // a similar combo box is used. For example in the properties...(ParameterSection) Also used in the XSDEditor...
- protected ComponentSpecification getComponentSpecificationForValue(String value)
- {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- ComponentSpecification[] history = editManager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-}
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
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java
deleted file mode 100644
index 68301db17..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java
+++ /dev/null
@@ -1,135 +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.editpolicies;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDragAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDragReorderAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.MessageReferenceEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ParameterEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter;
-
-public class ASDDragAndDropCommand extends Command {
- protected EditPartViewer viewer;
- protected ChangeBoundsRequest request;
- protected Point location;
- protected ASDDragAction dragAction;
- protected boolean canExecute = false;
-
- public ASDDragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request)
- {
- this.viewer = viewer;
- this.request = request;
-
- location = request.getLocation();
- EditPart targetEditPart = viewer.findObjectAt(location);
-
- if (targetEditPart instanceof ParameterEditPart || targetEditPart instanceof MessageReferenceEditPart) {
- ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().translateToRelative(location);
- GraphicalEditPart movingChildEditPart;
- Vector dragActions = new Vector();
- if (request.getType().equals(RequestConstants.REQ_ADD)) { // This really shouldn't be REQ_ADD....
- List list = request.getEditParts();
- if (list.size() <= 0) {
- canExecute = false;
- return;
- }
-
- // Grabbing the fist selection
- movingChildEditPart = (GraphicalEditPart) list.get(0);
- Object model = movingChildEditPart.getModel();
- EditPart pointerEditPart = viewer.findObjectAt(location);
-
- if (model instanceof IParameter) {
- dragActions.add(new ASDDragReorderAction(movingChildEditPart, pointerEditPart, getPointerLocation(location)));
- }
- else if (model instanceof IMessageReference) {
- IMessageReference messageRef = (IMessageReference) model;
- if (messageRef.getKind() == IMessageReference.KIND_INPUT || messageRef.getKind() == IMessageReference.KIND_OUTPUT) {
- dragActions.add(new ASDDragReorderAction(movingChildEditPart, pointerEditPart, getPointerLocation(location)));
-// dragActions.add(new WSDLDragSetMessageAction(movingChildEditPart, pointerEditPart, location));
- }
- }
-
-// else if (model instanceof Fault) {
-// dragActions.add(new WSDLDragSetMessageAction(movingChildEditPart, pointerEditPart, location));
-// }
- }
-// else if (request.getType().equals(RequestConstants.REQ_CLONE)) {
-// List list = request.getEditParts();
-// if (list.size() > 0)
-// {
-// // Grabbing the fist selection
-// movingChildEditPart = (WSDLTreeNodeEditPart) list.get(0);
-//
-// dragActions.add(new CopyWSDLElementAction(viewer,
-// (WSDLElement) movingChildEditPart.getModel(),
-// (WSDLElement) targetEditPart.getModel(),
-// null));
-// }
-// }
-
- Iterator it = dragActions.iterator();
- while (it.hasNext()) {
- dragAction = (ASDDragAction) it.next();
- canExecute = dragAction.canExecute();
- if (canExecute)
- break;
- }
- }
- }
-
- public boolean canExecute()
- {
- return canExecute;
- }
-
- public void execute() {
- if (canExecute)
- {
- dragAction.run();
- }
- }
-
- public IFigure getFeedbackFigure() {
- if (dragAction != null) {
- return dragAction.getFeedbackFigure();
- }
- else {
- return null;
- }
- }
-
- /*
- * This method compensates for the current scroll position
- */
- private Point getPointerLocation(Point origPointerLocation) {
- Point compensatedLocation = origPointerLocation;
- FigureCanvas figureCanvas = (FigureCanvas) viewer.getControl();
- int yOffset = figureCanvas.getViewport().getVerticalRangeModel().getValue();
- compensatedLocation.y = compensatedLocation.y + yOffset;
-
- return compensatedLocation;
- }
-} \ 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/editpolicies/ASDDragAndDropEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java
deleted file mode 100644
index 5c23ef3a6..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java
+++ /dev/null
@@ -1,38 +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.editpolicies;
-
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-
-public class ASDDragAndDropEditPolicy extends org.eclipse.gef.editpolicies.GraphicalEditPolicy {
- protected EditPartViewer viewer;
- protected ASDSelectionEditPolicy selectionHandlesEditPolicy;
-
- public ASDDragAndDropEditPolicy(EditPartViewer viewer, ASDSelectionEditPolicy selectionHandlesEditPolicy) {
- this.viewer = viewer;
- this.selectionHandlesEditPolicy = selectionHandlesEditPolicy;
- }
-
- public boolean understandsRequest(Request req) {
- return true;
- }
-
- public org.eclipse.gef.commands.Command getCommand(Request request) {
- ASDDragAndDropCommand command = null;
- if (request instanceof ChangeBoundsRequest) {
- command = new ASDDragAndDropCommand(viewer, (ChangeBoundsRequest)request);
- selectionHandlesEditPolicy.setDragAndDropCommand(command);
- }
- return command;
- }
-} \ 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/editpolicies/ASDGraphNodeDragTracker.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java
deleted file mode 100644
index 9e9f6c5fd..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java
+++ /dev/null
@@ -1,30 +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.editpolicies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.tools.DragEditPartsTracker;
-
-public class ASDGraphNodeDragTracker extends DragEditPartsTracker {
- protected EditPart editPart;
-
- public ASDGraphNodeDragTracker(EditPart editPart) {
- super(editPart);
- this.editPart = editPart;
- }
-
- protected Command getCommand() {
- Request request = getTargetRequest();
- return editPart.getCommand(request);
- }
-} \ 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/editpolicies/ASDLabelDirectEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java
deleted file mode 100644
index b54b6fe75..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java
+++ /dev/null
@@ -1,44 +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.editpolicies;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.DirectEditPolicy;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.EndPointEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject;
-
-public class ASDLabelDirectEditPolicy extends DirectEditPolicy {
- protected Command getDirectEditCommand(DirectEditRequest request) {
- Command command = null;
- String labelText = (String) request.getCellEditor().getValue();
- EditPart editPart= getHost();
-
- // TODO: rmah: Start 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.....
- if (editPart instanceof EndPointEditPart) {
- command = ((EndPointEditPart) editPart).getSetProperLabelCommand(labelText);
- }
- // End VERY UGLY HACK
- else if (editPart.getModel() instanceof INamedObject) {
- command = ((INamedObject) editPart.getModel()).getSetNameCommand(labelText);
- }
-
- return command;
- }
-
- protected void showCurrentEditValue(DirectEditRequest request) {
- }
-} \ 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/editpolicies/ASDSelectionEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java
deleted file mode 100644
index fcafff427..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java
+++ /dev/null
@@ -1,89 +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.editpolicies;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.editpolicies.SelectionEditPolicy;
-import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.IFeedbackHandler;
-
-public class ASDSelectionEditPolicy extends SelectionEditPolicy {
- protected ASDDragAndDropCommand dragAndDropCommand;
- protected IFigure feedback;
-
- public void setDragAndDropCommand(ASDDragAndDropCommand dragAndDropCommand) {
- this.dragAndDropCommand = dragAndDropCommand;
- }
-
- public void showSourceFeedback(Request request)
- {
- eraseChangeBoundsFeedback(null);
-
- if (dragAndDropCommand != null && dragAndDropCommand.canExecute()) {
- if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType())) {
- showMoveChangeBoundsFeedback((ChangeBoundsRequest) request);
- }
-// else if (REQ_CLONE.equals(request.getType())) {
-// showCopyChangeBoundsFeedback((ChangeBoundsRequest) request);
-// }
- }
- }
-
- /**
- * Erase feedback indicating that the receiver object is
- * being dragged. This method is called when a drag is
- * completed or cancelled on the receiver object.
- * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag.
- */
- public void eraseSourceFeedback(Request request)
- {
- if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType()))
- {
- eraseChangeBoundsFeedback((ChangeBoundsRequest)request);
- }
- }
-
- /**
- * Erase feedback indicating that the receiver object is
- * being dragged. This method is called when a drag is
- * completed or cancelled on the receiver object.
- * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag.
- */
- protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request)
- {
- if (feedback != null)
- {
- removeFeedback(feedback);
- }
- feedback = null;
- }
-
- protected void showMoveChangeBoundsFeedback(ChangeBoundsRequest request)
- {
- if (dragAndDropCommand != null && dragAndDropCommand.getFeedbackFigure() != null) {
- feedback = dragAndDropCommand.getFeedbackFigure();
- addFeedback(feedback);
- }
- }
-
- protected void hideSelection() {
- if (getHost() instanceof IFeedbackHandler) {
- ((IFeedbackHandler) getHost()).removeFeedback();
- }
- }
-
- protected void showSelection() {
- if (getHost() instanceof IFeedbackHandler) {
- ((IFeedbackHandler) getHost()).addFeedback();
- }
- }
-} \ 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/figures/BoxComponentFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java
deleted file mode 100644
index 43dbc265c..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java
+++ /dev/null
@@ -1,58 +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.figures;
-
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.ToolbarLayout;
-
-public class BoxComponentFigure extends Figure
-{
- public HeadingFigure headingFigure;
- Figure contentPane;
- protected boolean isSelected = false;
- protected boolean isReadOnly = false;
-
- public void setSelected(boolean isSelected)
- {
- headingFigure.setSelected(isSelected);
- }
-
- public void setIsReadOnly(boolean isReadOnly)
- {
- this.isReadOnly = isReadOnly;
- }
-
- public BoxComponentFigure()
- {
- super();
- headingFigure = new HeadingFigure();
- add(headingFigure);
- contentPane = new ListFigure();
- contentPane.setLayoutManager(new ToolbarLayout());
- add(contentPane);
- }
-
- public Figure getContentPane()
- {
- return contentPane;
- }
-
- public Label getLabel()
- {
- return headingFigure.getLabel();
- }
-
- public Figure getHeadingFigure()
- {
- return headingFigure;
- }
-} \ 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/figures/ComponentReferenceConnection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java
deleted file mode 100644
index 22602a73e..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java
+++ /dev/null
@@ -1,58 +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.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.ConnectionRouter;
-import org.eclipse.draw2d.PolygonDecoration;
-import org.eclipse.draw2d.PolylineConnection;
-import org.eclipse.swt.graphics.Color;
-
-public class ComponentReferenceConnection extends PolylineConnection
-{
- protected boolean highlight = false;
- protected static final Color activeConnection = ColorConstants.black;
- protected static final Color inactiveConnection = new Color(null, 198, 195, 198);
-
- /**
- * Default constructor
- */
- public ComponentReferenceConnection()
- {
- super();
- setTargetDecoration(new PolygonDecoration());
- }
-
- public void setConnectionRouter(ConnectionRouter cr)
- {
- if (cr != null && getConnectionRouter() != null)// TODO:.... && !(getConnectionRouter() instanceof BOManhattanConnectionRouter))
- super.setConnectionRouter(cr);
- }
-
- /**
- * @return Returns the current highlight status.
- */
- public boolean isHighlighted()
- {
- return highlight;
- }
-
- /**
- * @param highlight
- * The highlight to set.
- */
- public void setHighlight(boolean highlight)
- {
- this.highlight = highlight;
- setForegroundColor(highlight ? activeConnection : inactiveConnection);
- setOpaque(highlight);
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java
deleted file mode 100644
index 7dd5ba690..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java
+++ /dev/null
@@ -1,81 +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.figures;
-
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.swt.graphics.Color;
-
-public class HeadingFigure extends Figure
-{
- public static final Color headerColor = new Color(null, 224, 233, 246);
- Label label;
- protected Color[] gradientColor = {ColorConstants.white,
- ColorConstants.lightGray,
- ColorConstants.lightBlue,
- ColorConstants.gray};
- protected boolean isSelected = false;
- protected boolean isReadOnly = false;
-
- public HeadingFigure()
- {
- label = new Label();
- label.setBorder(new MarginBorder(2));
- ToolbarLayout toolbarLayout = new ToolbarLayout(false);
- toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
- setLayoutManager(toolbarLayout);
- add(label);
- }
-
- public void setSelected(boolean isSelected)
- {
- this.isSelected = isSelected;
- }
-
- public void setIsReadOnly(boolean isReadOnly)
- {
- this.isReadOnly = isReadOnly;
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
-// Color oldForeground = graphics.getForegroundColor();
- // Fill for the header section
- //
- Rectangle r = getBounds().getCopy();
- graphics.setBackgroundColor(ColorConstants.lightGray);
- //graphics.fillRectangle(r.x+1, r.y+1, r.width-1, barYcoordinate - r.y - 1);
- Color gradient1 = isReadOnly ? gradientColor[1] : headerColor;
- if (isSelected && isReadOnly) gradient1 = gradientColor[3];
- else if (isSelected && !isReadOnly) gradient1 = gradientColor[2];
- Color gradient2 = gradientColor[0];
- graphics.setForegroundColor(gradient1);
- graphics.setBackgroundColor(gradient2);
- Rectangle labelBounds = label.getBounds();
- graphics.fillGradient(r.x+1, r.y+1, r.width-2, labelBounds.height , true);
- graphics.setForegroundColor(ColorConstants.darkGray);
- label.paint(graphics);
- graphics.setForegroundColor(isSelected ? gradientColor[1] : gradientColor[3]);
- //graphics.drawLine(r.x+1, r.y + 15, r.x + r.width, r.y + 15);
- //graphics.drawLine(r.x+1, r.y + labelBounds.height, r.x + r.width, r.y + labelBounds.height);
- }
-
- public Label getLabel()
- {
- return label;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/LinkIconFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/LinkIconFigure.java
deleted file mode 100644
index 8107a381f..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/LinkIconFigure.java
+++ /dev/null
@@ -1,90 +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.figures;
-
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.Polygon;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-
-public class LinkIconFigure extends Polygon {
- private AbstractGraphicalEditPart editPart;
- private Point figLocation;
- private PointList points = new PointList();
- public int horizontalBuffer = 5;
- public int verticalBuffer = 7;
-
- public LinkIconFigure(AbstractGraphicalEditPart ep) {
- editPart = ep;
-
- // Draw the arrow
- points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 9, 4 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 9, 0 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 14, 5 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 9, 10 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 9, 6 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 0, 6 + verticalBuffer));
- points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer));
-
- setFill(true);
- setPoints(points);
- }
-
- public void paintFigure(Graphics graphics) {
- super.paintFigure(graphics);
- }
-
- public void setFigureLocation(Point newStartingLocation) {
- int dy = newStartingLocation.y;
-
- if (figLocation != null) {
- dy = newStartingLocation.y - figLocation.y;
- }
-
- // Update the points
- PointList newPoints = new PointList();
- PointList pList = getPoints();
- for (int index = 0; index < pList.size(); index++) {
- Point point = pList.getPoint(index);
- // Add 5 for the padding
- Point newPoint = new Point(point.x + horizontalBuffer, point.y + dy);
- newPoints.addPoint(newPoint);
- }
- setPoints(newPoints);
-
- figLocation = newStartingLocation;
- }
-
- public void primTranslate(int dx, int dy) {
- bounds.x += dx;
- bounds.y += dy;
-
- PointList pList = getPoints();
- PointList newList = new PointList();
- for (int index = 0; index < pList.size(); index++) {
- Point point = pList.getPoint(index);
- Point newPoint = new Point(point.x + dx, point.y);
- newList.addPoint(newPoint);
- }
- setPoints(newList);
-
- if (useLocalCoordinates()) {
- fireCoordinateSystemChanged();
- return;
- }
- }
-
- public AbstractGraphicalEditPart getAssociatedEditPart() {
- return editPart;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java
deleted file mode 100644
index 028563aca..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java
+++ /dev/null
@@ -1,79 +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.figures;
-
-import java.util.Iterator;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class ListFigure extends Figure
-{
- boolean isOpaque = false;
- boolean isHorizontal = false;
- boolean paintFirstLine = true;
-
- public ListFigure(boolean isHorizontal)
- {
- this.isHorizontal = isHorizontal;
- }
-
- public ListFigure()
- {
- this(false);
- }
-
- public void paint(Graphics graphics)
- {
- super.paint(graphics);
- boolean isFirst = true;
- for (Iterator i = getChildren().iterator(); i.hasNext();)
- {
- Figure figure = (Figure) i.next();
- if (isFirst && !paintFirstLine)
- {
- isFirst = false;
- }
- else
- {
- Rectangle r = figure.getBounds();
- if (isHorizontal)
- {
- graphics.drawLine(r.x, r.y, r.x, r.y + r.height);
- }
- else
- {
- graphics.drawLine(r.x, r.y, r.x + r.width, r.y);
- }
- }
- }
- }
-
- public boolean isOpaque()
- {
- return isOpaque;
- }
-
- public void setOpaque(boolean isOpaque)
- {
- this.isOpaque = isOpaque;
- }
-
- public boolean isPaintFirstLine()
- {
- return paintFirstLine;
- }
-
- public void setPaintFirstLine(boolean paintFirstLine)
- {
- this.paintFirstLine = paintFirstLine;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java
deleted file mode 100644
index b60ac7972..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java
+++ /dev/null
@@ -1,145 +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.layouts;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.BindingEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface;
-
-public class BindingColumnLayout extends AbstractLayout
-{
- EditPart bindingColumnEditPart;
-
- public BindingColumnLayout(EditPart bindingColumnEditPart)
- {
- super();
- this.bindingColumnEditPart = bindingColumnEditPart;
- }
-
- protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
- {
- Rectangle clientArea = container.getClientArea();
- Dimension d = calculateChildrenSize(container.getChildren(), wHint, hHint);
- d.height = Math.max(d.height, clientArea.height);
- return d;
- }
-
- private Dimension calculateChildrenSize(List children, int wHint, int hHint)
- {
- Dimension childSize;
- IFigure child;
- int height = 0, width = 0;
- for (int i = 0; i < children.size(); i++)
- {
- child = (IFigure) children.get(i);
- childSize = child.getPreferredSize(wHint, hHint);
- height += childSize.height;
- height += 80;
- width = Math.max(width, childSize.width);
- }
- return new Dimension(Math.max(width, 150), height);
- }
-
- public void layout(IFigure container)
- {
- //System.out.println("BindingColumnLayout.layout()" + container.getChildren().size());
- Rectangle clientArea = container.getClientArea();
- Rectangle r = new Rectangle();
- r.x = clientArea.x + 50;
- r.y = clientArea.y;
- int used = 0;
-
- for (Iterator i = container.getChildren().iterator(); i.hasNext();)
- {
- Figure child = (Figure) i.next();
- Dimension d = child.getPreferredSize(-1, -1);
- r.width = d.width;
- r.height = d.height;
-
- child.setBounds(r);
- used += 30;
- used += r.height;
-
- IFigure intefaceFigure = getInterfaceFigureForExpandedEditPartFigure(child);
- if (intefaceFigure != null)
- {
- Rectangle b = intefaceFigure.getBounds();
- int width = 30;
- child.setBounds(new Rectangle(b.x - width, b.y, width, b.height));
- }
-
- r.y += d.height;
- r.y += 80;
- }
- }
-
- public void setExpanded(BindingEditPart bindingEditPart, boolean isExpanded)
- {
- // First run through all of the bindings are are expanded
- // to ensure at most one binding is expanded for each interface since
- // we may need to collapse a binding in order to expand this one.
- //
- IInterface interfaze = getInterface(bindingEditPart);
- if (interfaze != null)
- {
- bindingEditPart.setExpanded(isExpanded);
- if (isExpanded)
- {
- for (Iterator i = bindingColumnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- BindingEditPart otherBindingEditPart = (BindingEditPart)i.next();
- if (otherBindingEditPart != bindingEditPart &&
- interfaze == getInterface(otherBindingEditPart))
- {
- otherBindingEditPart.setExpanded(false);
- }
- }
- }
- }
- }
-
- private IFigure getInterfaceFigureForExpandedEditPartFigure(Figure editPartFigure)
- {
- for (Iterator i = bindingColumnEditPart.getChildren().iterator(); i.hasNext(); )
- {
- BindingEditPart bindingEditPart = (BindingEditPart)i.next();
- if (bindingEditPart.isExpanded() && bindingEditPart.getFigure() == editPartFigure)
- {
- AbstractGraphicalEditPart interfaceEditPart = getMatchingEditPart(getInterface(bindingEditPart));
- if (interfaceEditPart != null)
- {
- return interfaceEditPart.getFigure();
- }
- }
- }
- return null;
- }
-
- private IInterface getInterface(BindingEditPart editPart)
- {
- IBinding binding = (IBinding)editPart.getModel();
- return binding.getInterface();
- }
-
- private AbstractGraphicalEditPart getMatchingEditPart(IInterface interfaze)
- {
- return(AbstractGraphicalEditPart)bindingColumnEditPart.getViewer().getEditPartRegistry().get(interfaze);
- }
-} \ 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/layouts/BindingContentLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingContentLayout.java
deleted file mode 100644
index 201b38af8..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingContentLayout.java
+++ /dev/null
@@ -1,105 +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.layouts;
-
-import java.util.Iterator;
-
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.BindingEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.INamedEditPart;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingContentPlaceHolder;
-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.IMessageReference;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation;
-
-/**
- * This class is used to layout the contents of the binding 'ruler' displayed
- * to the left side of an interface. The contents are aligned with the interface
- * figures so that correspoding binding and interface constructs are side by side.
- */
-public class BindingContentLayout extends AbstractLayout
-{
- BindingEditPart bindingEditPart;
-
- public BindingContentLayout(BindingEditPart bindingEditPart)
- {
- this.bindingEditPart = bindingEditPart;
- }
-
- protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
- {
- if (bindingEditPart.isExpanded())
- {
- Rectangle clientArea = container.getClientArea();
- return new Dimension(clientArea.width, clientArea.height);
- }
- else
- {
- return new Dimension(0,0);
- }
- }
-
- public void layout(IFigure container)
- {
- Rectangle clientArea = container.getClientArea();
- for (Iterator i = bindingEditPart.getChildren().iterator(); i.hasNext();)
- {
- AbstractGraphicalEditPart childEditPart = (AbstractGraphicalEditPart) i.next();
- AbstractGraphicalEditPart correspondingEditPart = null;
- Object model = childEditPart.getModel();
- if (model instanceof IBindingOperation)
- {
- IOperation operation = ((IBindingOperation)model).getOperation();
- correspondingEditPart = getEditPart(operation);
- }
- else if (model instanceof IBindingMessageReference)
- {
- IMessageReference messageReference = ((IBindingMessageReference)model).getMessageReference();
- correspondingEditPart = getEditPart(messageReference);
- }
- else if (model instanceof BindingContentPlaceHolder) {
- Object correspondingModel = ((BindingContentPlaceHolder) model).getModel();
- correspondingEditPart = getEditPart(correspondingModel);
- }
-
- if (correspondingEditPart != null)
- {
- IFigure figure = correspondingEditPart.getFigure();
- if (correspondingEditPart instanceof INamedEditPart)
- {
- figure = ((INamedEditPart)correspondingEditPart).getLabelFigure();
- }
- Rectangle bounds = figure.getBounds();
- Rectangle newBounds = new Rectangle(clientArea.x, bounds.y, clientArea.width, bounds.height);
- childEditPart.getFigure().setBounds(newBounds);
- }
- }
- }
-
- protected AbstractGraphicalEditPart getEditPart(Object model)
- {
- if (model != null)
- {
- EditPart editPart = (EditPart)bindingEditPart.getViewer().getEditPartRegistry().get(model);
- if (editPart instanceof AbstractGraphicalEditPart)
- {
- return (AbstractGraphicalEditPart)editPart;
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingLayout.java
deleted file mode 100644
index 2748e448c..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingLayout.java
+++ /dev/null
@@ -1,60 +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.layouts;
-
-import java.util.List;
-import org.eclipse.draw2d.Figure;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.ToolbarLayout;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.BindingEditPart;
-
-// just a toolbar layout with a minor tweak to ensure the last figure fills
-// the entire available space
-public class BindingLayout extends ToolbarLayout
-{
- BindingEditPart editPart;
-
- public BindingLayout(BindingEditPart editPart)
- {
- this.editPart = editPart;
- }
-
- protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
- {
- Dimension d = super.calculatePreferredSize(container, wHint, hHint);
- //Rectangle clientArea = container.getClientArea();
- //d.width = Math.max(d.width, clientArea.width);
- //d.height = Math.max(d.height, clientArea.height);
- return d;
- }
-
- public void layout(IFigure container)
- {
- super.layout(container);
- if (editPart.isExpanded())
- {
- Rectangle clientArea = container.getClientArea();
- List children = container.getChildren();
- if (children.size() > 1)
- {
- Figure header = (Figure)children.get(0);
- Figure contentPane = (Figure)children.get(children.size() - 1);
- if (contentPane.getChildren().size() > 0)
- {
- Rectangle bounds = contentPane.getBounds();
- bounds.height = clientArea.height - header.getBounds().height;
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/ColumnData.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/ColumnData.java
deleted file mode 100644
index d2a5887aa..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/ColumnData.java
+++ /dev/null
@@ -1,83 +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.layouts;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class ColumnData
-{
- HashMap map = new HashMap();
-
- class Entry
- {
- int width = 0;
- int weight = 1;
- }
-
- public void clearColumnWidths()
- {
- for (Iterator i = map.values().iterator(); i.hasNext();)
- {
- Entry entry = (Entry)i.next();
- entry.width = 0;
- }
- }
-
- private Entry lookupOrCreateColumnEntry(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry == null)
- {
- entry = new Entry();
- map.put(identifier, entry);
- }
- return entry;
- }
-
- void stretchColumnWidthIfNeeded(String identifier, int width)
- {
- Entry entry = lookupOrCreateColumnEntry(identifier);
- entry.width = Math.max(entry.width, width);
- }
-
- int getColumnWidth(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry != null)
- {
- return entry.width;
- }
- else
- {
- return 0;//hmm should we return -1 ?
- }
- }
-
- int getColumnWeight(String identifier)
- {
- Entry entry = (Entry)map.get(identifier);
- if (entry != null)
- {
- return entry.weight;
- }
- else
- {
- return 0;
- }
- }
-
- public void setColumnWeight(String identifier, int weight)
- {
- Entry entry = lookupOrCreateColumnEntry(identifier);
- entry.weight = weight;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/RowLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/RowLayout.java
deleted file mode 100644
index 14c7409c2..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/RowLayout.java
+++ /dev/null
@@ -1,182 +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.layouts;
-
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.draw2d.AbstractLayout;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
-
-public class RowLayout extends AbstractLayout
-{
- // layout is associated with a parent context
- // any layout manager under the parent context is connected
- // column rows are maintained accross container boundaries
- protected ColumnData columnData;
- protected HashMap figureToContstraintMap = new HashMap();
-
- public RowLayout()
- {
- super();
- }
-
-
- // this method computes the minimum size required to display the figures
- //
- private Dimension calculateChildrenSize(IFigure container, List children, int wHint, int hHint, boolean preferred)
- {
- Dimension childSize;
- IFigure child;
- int height = 0;
- int width = 0;
-
- //IRowFigure figure = (IRowFigure)container;
-
- // for each cell in the row
- //
- for (int i = 0; i < children.size(); i++)
- {
- child = (IFigure) children.get(i);
- String columnIdenifier = (String)getConstraint(child);
-
- // first we compute the child size without regard for columnData
- //
- childSize = child.getPreferredSize(wHint, hHint);// : child.getMinimumSize(wHint, hHint);
-
- // now that the columnData has been populated we can consider if the row needs to be larger
- //
- int effectiveWidth = childSize.width;
- if (columnIdenifier != null)
- {
- columnData.stretchColumnWidthIfNeeded(columnIdenifier, childSize.width);
- effectiveWidth = columnData.getColumnWidth(columnIdenifier);
- }
- height = Math.max(childSize.height, height);
- width += effectiveWidth;
- }
- return new Dimension(width, height);
- }
-
-
-
- protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
- {
- List children = container.getChildren();
- Dimension prefSize = calculateChildrenSize(container, children, wHint, hHint, true);
- //System.out.println("preferredSize=" + prefSize);
- return prefSize;
- }
-
- public void layout(IFigure parent)
- {
- // layout a table with the columns aligned
- //IRowFigure rowFigure = (IRowFigure)parent;
- Rectangle clientArea = parent.getClientArea();
- List children = parent.getChildren();
- Rectangle r = new Rectangle();
- r.x = clientArea.x;
- r.y = clientArea.y;
- r.height = clientArea.height;
-
- int childrenSize = children.size();
- Rectangle[] bounds = new Rectangle[childrenSize];
-
- // for each cell in the row
- //
- int requiredWidth = 0;
- int totalColumnWeight = 0;
- for (int i = 0; i < childrenSize; i++)
- {
- IFigure child = (IFigure) children.get(i);
- //String columnIdenifier = figure.getColumnIdentifier(child);
- // first we compute the child size without regard for columnData
- //
- Dimension childSize = child.getPreferredSize(-1, -1);
-
- int columnWidth = -1;
- //String columnIdentifier = rowFigure.getColumnIdentifier(child);
- String columnIdentifier = (String)getConstraint(child);
- if (columnIdentifier != null)
- {
- //columnData.stretchColumnWidthIfNeeded(columnIdentifier, childSize.width);
- columnWidth = columnData.getColumnWidth(columnIdentifier);
- totalColumnWeight += columnData.getColumnWeight(columnIdentifier);
- //System.out.println("columnWidth(" + columnIdentifier + ")=" + columnWidth);
- }
- r.width = Math.max(childSize.width, columnWidth);
- requiredWidth += r.width;
- bounds[i] = new Rectangle(r);
- r.x += r.width;
- }
- if (totalColumnWeight < 1)
- {
- totalColumnWeight = 1;
- }
- //System.out.println("clientArea.width=" + clientArea.width + ", " + r.x);
- int extraWidth = Math.max(clientArea.width - requiredWidth, 0);
- //System.out.println("extraWidth=" + extraWidth + " totalColumnWeight=" + totalColumnWeight);
- int extraWidthAllocated = 0;
- for (int i = 0; i < childrenSize; i++)
- {
- IFigure child = (IFigure) children.get(i);
- Rectangle b = bounds[i];
- if (extraWidth > 0)
- {
- String columnIdentifier = (String)getConstraint(child);
- if (columnIdentifier != null)
- {
- int weight = columnData.getColumnWeight(columnIdentifier);
- float fraction = (float)weight / (float)totalColumnWeight;
- int extraWidthForChild = (int)(extraWidth * fraction);
- //System.out.println("extraWidthForChild(" + fraction + ")=" + extraWidthForChild);
- b.width += extraWidthForChild;
- b.x += extraWidthAllocated;
- extraWidthAllocated += extraWidthForChild;
- }
- else
- {
- b.x += extraWidthAllocated;
- }
- }
- child.setBounds(new Rectangle(b));
- }
- }
-
- public ColumnData getColumnData()
- {
- return columnData;
- }
-
- public void setColumnData(ColumnData columnData)
- {
- this.columnData = columnData;
- }
-
- public Object getConstraint(IFigure child)
- {
- return figureToContstraintMap.get(child);
- }
-
- public void setConstraint(IFigure child, Object constraint)
- {
- figureToContstraintMap.put(child, constraint);
- }
-
- public void invalidate()
- {
- //figureToContstraintMap.clear();
- //this.columnData.clearColumnWidths();
- super.invalidate();
- //System.out.println("invalidate");
- }
-}

Back to the top