diff options
author | kchong | 2008-12-17 19:14:32 +0000 |
---|---|---|
committer | kchong | 2008-12-17 19:14:32 +0000 |
commit | b2eddd145b4b41e114edddb571a85dfe01c1605e (patch) | |
tree | 30851e8ec3f8e05a232a45e2792de0ca7ae6bf65 /bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst | |
parent | 458808767e6b5f3fcf3ea63faeb4b61c04783143 (diff) | |
download | webtools.webservices-200812171916.tar.gz webtools.webservices-200812171916.tar.xz webtools.webservices-200812171916.zip |
This commit was manufactured by cvs2svn to create tag 'v200812171916'.v200812171916
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst')
127 files changed, 0 insertions, 14420 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorCSHelpIds.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorCSHelpIds.java deleted file mode 100644 index 6220663cf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorCSHelpIds.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd; - -public class ASDEditorCSHelpIds { - private static String pluginId = "org.eclipse.wst.wsdl.ui."; //$NON-NLS-1$ - - /*------------------------------------------------------------------------------- - New WSDL Wizard - Options page: - -------------------------------------------------------------------------------*/ - public static String WSDL_WIZARD_OPTIONS_PAGE_TNS_TEXT = pluginId + "wsdlu0000"; //$NON-NLS-1$ - public static String WSDL_WIZARD_OPTIONS_PAGE_PREFIX_TEXT = pluginId + "wsdlu0001"; //$NON-NLS-1$ - public static String WSDL_WIZARD_OPTIONS_PAGE_CREATE_SKELETON_CHECKBOX = pluginId + "wsdlu0002"; //$NON-NLS-1$ - public static String WSDL_WIZARD_OPTIONS_PAGE_PROTOCOL_COMBO = pluginId + "wsdlu0003"; //$NON-NLS-1$ - -// Soap Binding Options - public static String DOC_LIT_RADIO = pluginId + "wsdlu0010"; //$NON-NLS-1$ - public static String RPC_LIT_RADIO = pluginId + "wsdlu0011"; //$NON-NLS-1$ - public static String RPC_ENCODED_RADIO = pluginId + "wsdlu0012"; //$NON-NLS-1$ - -// HTTP Binding Options - public static String HTTP_GET_RADIO = pluginId + "wsdlu0013"; //$NON-NLS-1$ - public static String HTTP_POST_RADIO = pluginId + "wsdlu0014"; //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Design View - -------------------------------------------------------------------------------*/ - public static String WSDL_DESIGN_VIEW_SERVICE_OBJECT = pluginId + "wsdlu0020"; // Service Object --> wsdlu0020 //$NON-NLS-1$ - public static String WSDL_DESIGN_VIEW_BINDING_OBJECT = pluginId + "wsdlu0021"; // Binding Object --> wsdlu0021 //$NON-NLS-1$ - public static String WSDL_DESIGN_VIEW_PORTTYPE_OBJECT = pluginId + "wsdlu0022"; // PortType Object --> wsdlu0022 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Outline View - -------------------------------------------------------------------------------*/ - public static String WSDL_OUTLINE_VIEW_GROUP = pluginId + "wsdlu0023"; // Imports, Types, Services, Bindings, Port Types, Messages (grouped together) --> wsdlu0023 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Port Wizard - -------------------------------------------------------------------------------*/ - public static String PORT_WIZARD = pluginId + "wsdlu0030"; //$NON-NLS-1$ - public static String PORT_WIZARD_NAME_TEXT = pluginId + "wsdlu0031"; // not used - dup below //$NON-NLS-1$ - public static String PORT_WIZARD_BINDING_COMBO = pluginId + "wsdlu0032"; // not used - dup below //$NON-NLS-1$ - public static String PORT_WIZARD_PROTOCOL_COMBO = pluginId + "wsdlu0033"; // not used - dup below //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Generate Binding Wizard - -------------------------------------------------------------------------------*/ - public static String BINDING_WIZARD = pluginId + "wsdlu0040"; //$NON-NLS-1$ - public static String PROTOCOL_COMPONENT_NAME_TEXT = pluginId + "wsdlu0041"; //$NON-NLS-1$ - public static String PROTOCOL_COMPONENT_REF_COMBO = pluginId + "wsdlu0042"; //$NON-NLS-1$ - public static String PROTOCOL_COMPONENT_PROTOCOL_COMBO = pluginId + "wsdlu0043"; //$NON-NLS-1$ - public static String pROTOCOL_COMPONENT_OVERWRITE_CHECKBOX = pluginId + "wsdlu0044"; //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Edit Namespaces Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String EDIT_NS_DIALOG = pluginId + "wsdlu0050"; // Edit Namespaces Dialog "dialog" --> wsdlu0050 //$NON-NLS-1$ - public static String EDIT_NS_DIALOG_TNS_TEXT = pluginId + "wsdlu0051"; // Target Namespace "text" --> wsdlu0051 //$NON-NLS-1$ - public static String EDIT_NS_DIALOG_DECLARATIONS_TABLE = pluginId + "wsdlu0052"; // Namespace Declarations "table" --> wsdlu0052 //$NON-NLS-1$ - - public static String EDIT_NS_DIALOG_ADD_BUTTON = pluginId + "wsdlu0053"; // Add... "push button" --> wsdlu0053 //$NON-NLS-1$ - public static String EDIT_NS_DIALOG_EDIT_BUTTON = pluginId + "wsdlu0054"; // Edit... "push button" --> wsdlu0054 //$NON-NLS-1$ - public static String EDIT_NS_DIALOG_DELETE_BUTTON = pluginId + "wsdlu0055"; // Delete "push button" --> wsdlu0055 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Add Namespace Declarations Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String ADD_NS_DECL = pluginId + "wsdlu0060"; // Add Namespace Declarations Dialog "dialog" --> wsdlu0060 //$NON-NLS-1$ - public static String ADD_NS_DECL_SELECT_REG_NS_RADIO = pluginId + "wsdlu0061"; // Select From Registered Namespaces "radio" --> wsdlu0061 //$NON-NLS-1$ - public static String ADD_NS_DECL_SPECIFY_NEW_NS_RADIO = pluginId + "wsdlu0062"; // Specify New Namespace "radio" --> wsdlu0062 //$NON-NLS-1$ - - // Registered Namespaces: - public static String ADD_NS_DECL_SELECT_NS_TO_ADD_TABLE = pluginId + "wsdlu0063"; // Select the namespace declarations to add "table" --> wsdlu0063 //$NON-NLS-1$ - - // New Namespace: - public static String ADD_NS_DECL_PREFIX_TEXT = pluginId + ""; // Prefix: "text" -->(COMMON) wsdlu0064 //$NON-NLS-1$ - public static String ADD_NS_DECL_NAMESPACE_NAME_TEXT = pluginId + ""; // Namespace Name: "text" -->(COMMON) wsdlu0065 //$NON-NLS-1$ - public static String ADD_NS_DECL_LOCATION_HINT_TEXT = pluginId + ""; // Location Hint: "text" -->(COMMON) wsdlu0066 //$NON-NLS-1$ - public static String ADD_NS_DECL_BROWSE_BUTTON = pluginId + ""; // Browse... "push button" -->(COMMON) wsdlu0067 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - New Namespace Information Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String NEW_NAMESPACE_INFO_DIALOG = pluginId + "wsdlu0068"; //$NON-NLS-1$ - - public static String NAMESPACE_NAME = pluginId + "wsdlu0065"; //$NON-NLS-1$ - public static String PREFIX = pluginId + "wsdlu0064"; //$NON-NLS-1$ - public static String LOCATION_HINT = pluginId + "wsdlu0066"; //$NON-NLS-1$ - public static String BROWSE = pluginId + "wsdlu0067"; //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - New Message Dialog - -------------------------------------------------------------------------------*/ - public static String NEW_MESSAGE_DIALOG = pluginId + "wsdlu0080"; //$NON-NLS-1$ - public static String NEW_MESSAGE_DIALOG_NAME_TEXT = pluginId + "wsdlu0081"; // not used -- text will use "dialog" context Id //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Specify Message Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String SPECIFY_MESSAGE_DIALOG = pluginId + "wsdlu0082"; // "dialog" --> wsdlu0082 //$NON-NLS-1$ - - public static String SPECIFY_DIALOG_NAME_TEXT = pluginId + "wsdlu0070"; // Name (? = character, * = any string): "text" -->(COMMON) wsdlu0070 //$NON-NLS-1$ - public static String SPECIFY_DIALOG_COMPONENTS_LIST = pluginId + "wsdlu0071"; // Components "list" -->(COMMON) wsdlu0071 //$NON-NLS-1$ - - public static String SPECIFY_DIALOG_SEARCH_SCOPE = pluginId + "wsdlu0072"; // Search Scope: //$NON-NLS-1$ - //Workspace, Enclosing Project, Current Resource, Working Sets (Grouped) "radio" -->(COMMON) wsdlu0072 - - - /*------------------------------------------------------------------------------- - WSDL Editor - New Binding Dialog - -------------------------------------------------------------------------------*/ - public static String NEW_BINDING_DIALOG = pluginId + "wsdlu0083"; //$NON-NLS-1$ - public static String NEW_BINDING_DIALOG_NAME_TEXT = pluginId + "wsdlu0084"; // not used -- text will use "dialog" context Id //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Specify Binding Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String SPECIFY_BINDING_DIALOG = pluginId + "wsdlu0085"; // Specify Binding Dialog "dialog" --> wsdlu0085 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - New PortType Dialog - -------------------------------------------------------------------------------*/ - public static String NEW_PORTTYPE_DIALOG = pluginId + "wsdlu0086"; //$NON-NLS-1$ - public static String NEW_PORTTYPE_DIALOG_NAME_TEXT = pluginId + "wsdlu0087"; // not used -- text will use "dialog" context Id //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Specify Port Type Dialog --- common.ui - -------------------------------------------------------------------------------*/ - public static String SPECIFY_PORTTYPE_DIALOG = pluginId + "wsdlu0088"; // Specify Port Type Dialog "dialog" --> wsdlu0088 //$NON-NLS-1$ - - - /*------------------------------------------------------------------------------- - WSDL Editor - Properties - -------------------------------------------------------------------------------*/ - //Definition: - public static String PROPERTIES_NAME_TEXT = pluginId + "wsdlu0100"; //$NON-NLS-1$ - public static String PROPERTIES_DEF_PREFIX_TEXT = pluginId + "wsdlu0101"; //$NON-NLS-1$ - public static String PROPERTIES_DEF_TNS_TEXT = pluginId + "wsdlu0102"; //$NON-NLS-1$ - - //Port: - public static String PROPERTIES_PORT_BINDING_COMBO = pluginId + "wsdlu0103"; //$NON-NLS-1$ - public static String PROPERTIES_PORT_ADDRESS_TEXT = pluginId + "wsdlu0104"; //$NON-NLS-1$ - public static String PROPERTIES_PORT_PROTOCOL_TEXT = pluginId + "wsdlu0105"; //$NON-NLS-1$ - - //Binding: - public static String PROPERTIES_BINDING_PORTTYPE_COMBO = pluginId + "wsdlu0106"; //$NON-NLS-1$ - public static String PROPERTIES_BINDING_PROTOCOL_TEXT = pluginId + "wsdlu0107"; //$NON-NLS-1$ - public static String PROPERTIES_BINDING_GEN_BINDING_BUTTON = pluginId + "wsdlu0108"; //$NON-NLS-1$ - - //Input/Output/Fault: - public static String PROPERTIES_MESSAGE_REF_MESSAGE_COMBO = pluginId + "wsdlu0109"; //$NON-NLS-1$ - - //Part: - public static String PROPERTIES_PART_ELEMENT_COMBO = pluginId + "wsdlu0110"; //$NON-NLS-1$ - public static String PROPERTIES_PART_TYPE_COMBO = pluginId + "wsdlu0111"; //$NON-NLS-1$ - public static String PROPERTIES_PART_TYPE_RADIO = pluginId + "wsdlu0112"; //$NON-NLS-1$ - public static String PROPERTIES_PART_ELEMENT_RADIO = pluginId + "wsdlu0113"; //$NON-NLS-1$ - - - public static String PROPERTIES_DOCUMENTATION_TAB = pluginId + "wsdlu0114"; //$NON-NLS-1$ - - public static String WSDL_WIZARD_OPTIONS_PAGE = pluginId + "wsdlu0120"; // New WSDL Wizard - options page --> wsdlu0120 //$NON-NLS-1$ - public static String WSDL_DESIGN_VIEW = pluginId + "wsdlu0121"; // Design View --> wsdlu0121 //$NON-NLS-1$ - public static String WSDL_OUTLINE_VIEW = pluginId + "wsdlu0122"; // Outline View --> wsdlu0122 //$NON-NLS-1$ - public static String WSDL_PROPERTIES_VIEW = pluginId + "wsdlu0123"; // Properties View --> wsdlu0123 //$NON-NLS-1$ - -// WSDL Preference Page: - public static String WSDL_PREF_DEFAULT_TNS = pluginId + "wsdlu0200"; //$NON-NLS-1$ - public static String WSDL_PREF_REGEN_ON_SAVE = pluginId + "wsdlu0201"; //$NON-NLS-1$ - public static String WSDL_PREF_PROMPT_REGEN_ON_SAVE = pluginId + "wsdlu0202"; //$NON-NLS-1$ - public static String WSDL_PREF_ENABLE_AUTO_IMPORT_CLEANUP = pluginId + "wsdlu0205"; //$NON-NLS-1$ -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorPlugin.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorPlugin.java deleted file mode 100644 index c7ac0befd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorPlugin.java +++ /dev/null @@ -1,68 +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; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; - -public class ASDEditorPlugin extends AbstractUIPlugin { - public static int DEPENDECIES_CHANGED_POLICY_RELOAD = 2; - - protected static ASDEditorPlugin instance; - - public ASDEditorPlugin() { - } - -// /** -// * Get the singleton instance. -// */ -// public static ASDEditorPlugin getInstance() -// { -// if (instance == null) { -// instance = new ASDEditorPlugin(); -// } -// return instance; -// } -// -// public Image getImage(String iconName) -// { -// ImageRegistry imageRegistry = getImageRegistry(); -// -// if (imageRegistry.get(iconName) != null) -// { -// return imageRegistry.get(iconName); -// } -// else -// { -// imageRegistry.put(iconName, ImageDescriptor.createFromFile(getClass(), iconName)); -// return imageRegistry.get(iconName); -// } -// } - - public static ImageDescriptor getImageDescriptor(String path) { - // We should not know about WSDLEditorPlugin.java. Eventually, we should move these - // 'generic', 'top-level' icons to the ASD level..... - return WSDLEditorPlugin.getImageDescriptor(path); - } - - public static ImageDescriptor getImageDescriptorFromPlugin(String path) { - // We should not know about WSDLEditorPlugin.java. Eventually, we should move these - // 'generic', 'top-level' icons to the ASD level..... - return WSDLEditorPlugin.getImageDescriptorFromPlugin(path); - } - - public static IEditorPart getActiveEditor() { - return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDLabelProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDLabelProvider.java deleted file mode 100644 index 228ca216d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDLabelProvider.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.FileStoreEditorInput; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.xsd.ui.internal.adt.editor.EditorModeManager; - -public class ASDLabelProvider extends LabelProvider { - /** - * - */ - public ASDLabelProvider() { - super(); - } - - private ILabelProvider getDelegate() - { - ILabelProvider labelProvider = null; - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - EditorModeManager manager = (EditorModeManager) editor.getAdapter(EditorModeManager.class); - if (manager != null) - { - labelProvider = (ILabelProvider) manager.getCurrentMode().getAdapter(ILabelProvider.class); - } - return labelProvider; - } - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ - public Image getImage(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return null; - } - Image result = null; - if (object instanceof StructuredSelection) { - Object selected = ((StructuredSelection)object).getFirstElement(); - ILabelProvider delegate = getDelegate(); - if (delegate != null) { - result = delegate.getImage(selected); - } - else if (selected instanceof ITreeElement) { - result = ((ITreeElement) selected).getImage(); - } - } - - return result; - } - - /** - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - public String getText(Object object) { - if (object == null || object.equals(StructuredSelection.EMPTY)) { - return "No items selected";//$NON-NLS-1$ - } - String result = null; - Object selected = null; - if (object instanceof StructuredSelection) { - selected = ((StructuredSelection) object).getFirstElement(); - - ILabelProvider delegate = getDelegate(); - if (delegate != null) { - result = delegate.getText(selected); - } - else if (selected instanceof ITreeElement) { - result = ((ITreeElement) selected).getText(); - } - - boolean isFileReadOnly = false; - IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window != null) { - IWorkbenchPage page = window.getActivePage(); - if (page != null) { - IEditorPart editor = page.getActiveEditor(); - if (editor != null) { - IEditorInput editorInput = editor.getEditorInput(); - if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput)) { - isFileReadOnly = true; - } - } - } - } - } - - if (selected instanceof IASDObject && ((IASDObject) selected).isReadOnly() || isFileReadOnly) { - result = result + " (" + Messages._UI_LABEL_READ_ONLY + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDMultiPageEditor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDMultiPageEditor.java deleted file mode 100644 index 73103ad0d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDMultiPageEditor.java +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.editparts.ZoomManager; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.FileStoreEditorInput; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddEndPointAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddFaultAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddImportAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddInputAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddOperationAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddOutputAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddParameterAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddSchemaAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddServiceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDGenerateBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDOpenSchemaAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewInterfaceAction; -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.DesignViewContextMenuProvider; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicalViewer; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.DirectEditSelectionTool; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ASDEditPartFactory; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ASDContentOutlinePage; -import org.eclipse.wst.wsdl.ui.internal.asd.properties.sections.ASDTabbedPropertySheetPage; -import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonMultiPageEditor; - -public abstract class ASDMultiPageEditor extends CommonMultiPageEditor -{ - // TODO: move to design viewer - protected DesignViewContextMenuProvider menuProvider; - protected IDescription model; - private int currentPage = -1; - - /** - * Creates a multi-page editor example. - */ - public ASDMultiPageEditor() - { - super(); - - getEditDomain().setActiveTool(new DirectEditSelectionTool()); - getEditDomain().setDefaultTool(new DirectEditSelectionTool()); - } - - public String getContributorId() - { - return "org.eclipse.wst.wsdl.ui.internal.WSDLEditor"; //$NON-NLS-1$ - } - - private class InternalLayout extends StackLayout - { - public InternalLayout() { - super(); - } - - protected void layout(Composite composite, boolean flushCache) { - Control children[] = composite.getChildren(); - Rectangle rect = composite.getClientArea(); - rect.x += marginWidth; - rect.y += marginHeight; - rect.width -= 2 * marginWidth; - rect.height -= 2 * marginHeight; - - for (int i = 0; i < children.length; i++) { - if (i == 0 && modeCombo != null) { // For the drop down toolbar - children[i].setBounds(rect.x + rect.width - 90 - maxLength, rect.y + 10, maxLength + 60, 26); - } - else {// For the main graph viewer - children[i].setBounds(rect); - } - } - } - } - - protected Composite createGraphPageComposite() { - Composite parent = new Composite(getContainer(), SWT.FLAT); - parent.setLayout(new InternalLayout()); - createViewModeToolbar(parent); - return parent; - } - - - public IContentOutlinePage getContentOutlinePage() { - if ((fOutlinePage == null) || fOutlinePage.getControl() == null || (fOutlinePage.getControl().isDisposed())) { - IContentProvider provider = getEditorModeManager().getCurrentMode().getOutlineProvider(); - - ASDContentOutlinePage outlinePage = new ASDContentOutlinePage(this, menuProvider); - outlinePage.setContentProvider((ITreeContentProvider)provider); - outlinePage.setLabelProvider((ILabelProvider)provider); - outlinePage.setModel(getModel()); - outlinePage.addSelectionChangedListener(getSelectionManager()); - getSelectionManager().addSelectionChangedListener(outlinePage); - - fOutlinePage = outlinePage; - } - return fOutlinePage; - } - - /** - * Creates the pages of the multi-page editor. - */ - protected void createPages() - { - selectionProvider = getSelectionManager(); - getEditorSite().setSelectionProvider(selectionProvider); - - createGraphPage(); - createSourcePage(); - - buildAndSetModel(); - initializeGraphicalViewer(); - setActivePage(getDefaultPageTypeIndex()); - - getSelectionManager().setSelection(new StructuredSelection(getModel())); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(graphicalViewer.getControl(), ASDEditorCSHelpIds.WSDL_DESIGN_VIEW); - } - - protected int getDefaultPageTypeIndex() { - int pageIndex = SOURCE_PAGE_INDEX; - if (WSDLEditorPlugin.getInstance().getDefaultPage().equals(WSDLEditorPlugin.DESIGN_PAGE)) { - pageIndex = DESIGN_PAGE_INDEX; - } - - return pageIndex; - } - - protected ScrollingGraphicalViewer getGraphicalViewer() - { - return new DesignViewGraphicalViewer(this, getSelectionManager()); - } - - public void buildAndSetModel() { - model = buildModel(getEditorInput()); - } - - abstract public IDescription buildModel(IEditorInput editorInput); - - public boolean isFileReadOnly() { - IEditorInput editorInput = getEditorInput(); - return !(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput); - } - - protected void createActions() - { - ActionRegistry registry = getActionRegistry(); - BaseSelectionAction action; - if (!isFileReadOnly()) - { - action = new ASDAddServiceAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddBindingAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddInterfaceAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddEndPointAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddOperationAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddInputAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddOutputAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddFaultAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDDeleteAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDSetNewBindingAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDSetExistingBindingAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDSetNewInterfaceAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDSetExistingInterfaceAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDGenerateBindingAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddImportAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddParameterAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ASDAddSchemaAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - } - - action = new ASDOpenSchemaAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new ShowPropertiesViewAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - } - - public IDescription getModel() - { - return model; - } - - public Object getAdapter(Class type) - { - if (type == ZoomManager.class) - return graphicalViewer.getProperty(ZoomManager.class.toString()); - - if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) - { - ASDTabbedPropertySheetPage page = new ASDTabbedPropertySheetPage(this); - return page; - } - if (type == GraphicalViewer.class) - return graphicalViewer; - if (type == EditPart.class && graphicalViewer != null) - return graphicalViewer.getRootEditPart(); - if (type == IFigure.class && graphicalViewer != null) - return ((GraphicalEditPart) graphicalViewer.getRootEditPart()).getFigure(); - - if (IContentOutlinePage.class.equals(type)) - { - return getContentOutlinePage(); - } - - if (type == ISelectionProvider.class) - { - return getSelectionManager(); - } - - return super.getAdapter(type); - } - - protected EditPartFactory getEditPartFactory() { - return new ASDEditPartFactory(); - } - - protected void setEditPartFactory(EditPartFactory factory) { - graphicalViewer.setEditPartFactory(factory); - } - - protected void initializeGraphicalViewer() - { - graphicalViewer.setContents(model); - menuProvider = new DesignViewContextMenuProvider(graphicalViewer, getSelectionManager()); - } - - protected void pageChange(int newPageIndex) { - currentPage = newPageIndex; - super.pageChange(newPageIndex); - } - - public void dispose() { - if (currentPage == SOURCE_PAGE_INDEX) { - WSDLEditorPlugin.getInstance().setDefaultPage(WSDLEditorPlugin.SOURCE_PAGE); - } - else { - WSDLEditorPlugin.getInstance().setDefaultPage(WSDLEditorPlugin.DESIGN_PAGE); - } - - super.dispose(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDSelectionManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDSelectionManager.java deleted file mode 100644 index 3c7ac861d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDSelectionManager.java +++ /dev/null @@ -1,100 +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; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.part.MultiPageSelectionProvider; - -public class ASDSelectionManager extends MultiPageSelectionProvider implements ISelectionProvider, ISelectionChangedListener -{ - protected List listenerList = new ArrayList(); - protected ISelection currentSelection; - protected boolean enableNotify = true; - - public ASDSelectionManager(MultiPageEditorPart multiPageEditor) - { - super(multiPageEditor); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) - { - listenerList.add(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() - */ - public ISelection getSelection() - { - return currentSelection; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) - { - listenerList.remove(listener); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) - */ - public void setSelection(ISelection selection) - { - setSelection(selection, this); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) - { - if (enableNotify) - { - setSelection(event.getSelection(), event.getSelectionProvider()); - } - } - - public void setSelection(ISelection selection, ISelectionProvider source) - { - if (enableNotify) - { - currentSelection = selection; - enableNotify = false; - try - { - SelectionChangedEvent event = new SelectionChangedEvent(source, selection); - List copyOfListenerList = new ArrayList(listenerList); - for (Iterator i = copyOfListenerList.iterator(); i.hasNext(); ) - { - ISelectionChangedListener listener = (ISelectionChangedListener)i.next(); - listener.selectionChanged(event); - } - } - finally - { - enableNotify = true; - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/Messages.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/Messages.java deleted file mode 100644 index 8203720df..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/Messages.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -import org.eclipse.osgi.util.NLS; - - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.wst.wsdl.ui.internal.asd.messages"; //$NON-NLS-1$ - - static { - NLS.initializeMessages(BUNDLE_NAME, Messages.class); //$NON-NLS-1$ - } - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - // TODO Auto-generated method stub - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String _UI_TAB_GRAPH; - public static String _UI_TAB_SOURCE; - public static String _UI_BUTTON_NEW; - public static String _UI_LABEL_READ_ONLY; - public static String _UI_LABEL_NAMESPACE; - public static String _UI_LABEL_PORTTYPE; - public static String _UI_LABEL_LOCATION; - public static String _UI_LABEL_ADDRESS; - public static String _UI_LABEL_BINDING; - public static String _UI_LABEL_PREFIX; - public static String _UI_LABEL_NAME; - public static String _UI_LABEL_TYPE; - public static String _UI_ACTION_ADD_SERVICE; - public static String _UI_ACTION_ADD_MESSAGE; - public static String _UI_ACTION_ADD_OPERATION; - public static String _UI_ACTION_ADD_IMPORT; - public static String _UI_ACTION_ADD_OUTPUT; - public static String _UI_ACTION_ADD_FAULT; - public static String _UI_ACTION_ADD_PORT; - public static String _UI_ACTION_ADD_PORTTYPE; - public static String _UI_ACTION_DELETE; - public static String _UI_BUTTON_BROWSE; - public static String _UI_ACTION_NEW_PORTTYPE; - public static String _UI_ACTION_NEW_BINDING; - public static String _UI_ACTION_EXISTING_PORTTYPE; - public static String _UI_GENERATE_BINDING_CONTENT; - public static String _UI_ACTION_EXISTING_BINDING; - public static String _UI_LABEL_BINDING_PROTOCOL; - public static String _UI_LABEL_TARGET_NAMESPACE; - public static String _UI_ACTION_ADD_BINDING; - public static String _UI_ACTION_ADD_SCHEMA; - public static String _UI_ACTION_ADD_INPUT; - public static String _UI_SECTION_ADVANCED_ATTRIBUTES; - - public static String _UI_ACTION_EDIT_NAMESPACES; - public static String _UI_ACTION_OPEN_SCHEMA; - public static String _UI_TOOLTIP_RENAME_REFACTOR; - - public static String _UI_LABEL_RIGHT_CLICK_TO_INSERT_CONTENT; - public static String _UI_ACTION_SHOW_PROPERTIES; -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddBindingAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddBindingAction.java deleted file mode 100644 index 1ea54453c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddBindingAction.java +++ /dev/null @@ -1,51 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddBindingAction extends BaseSelectionAction { - public static String ID = "ASDAddBindingAction"; //$NON-NLS-1$ - - public ASDAddBindingAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_BINDING); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/binding_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddBindingCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddEndPointAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddEndPointAction.java deleted file mode 100644 index d6a7e31de..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddEndPointAction.java +++ /dev/null @@ -1,55 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; - -public class ASDAddEndPointAction extends BaseSelectionAction { - public static String ID = "ASDAddEndPointAction"; //$NON-NLS-1$ - - public ASDAddEndPointAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_PORT); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/port_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IService service = null; - - if (o instanceof IService) { - service = (IService) o; - } - else if (o instanceof IEndPoint) { - service = ((IEndPoint) o).getOwnerService(); - } - - if (service != null) { - Command command = service.getAddEndPointCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object element = ((IASDAddCommand) command).getNewlyAddedComponent(); - selectAndDirectEdit(element); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddFaultAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddFaultAction.java deleted file mode 100644 index 1c188367e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddFaultAction.java +++ /dev/null @@ -1,63 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -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; - -public class ASDAddFaultAction extends BaseSelectionAction { - public static String ID = "ASDAddFaultActionn"; //$NON-NLS-1$ - - public ASDAddFaultAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_FAULT); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/fault_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IOperation iOperation = null; - Object possibleFault = null; - - if (o instanceof IOperation) { - iOperation = (IOperation) o; - } - else if (o instanceof IMessageReference) { - iOperation = ((IMessageReference) o).getOwnerOperation(); - possibleFault = ((W11MessageReference) o).getTarget(); - } - else if (o instanceof IParameter) { - iOperation = ((IMessageReference) ((IParameter) o).getOwner()).getOwnerOperation(); - possibleFault = ((W11MessageReference) ((IParameter) o).getOwner()).getTarget(); - } - - if (iOperation != null) { - Command command = iOperation.getAddFaultCommand(possibleFault); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddImportAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddImportAction.java deleted file mode 100644 index a8ce0bed7..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddImportAction.java +++ /dev/null @@ -1,51 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddImportAction extends BaseSelectionAction { - public static String ID = "ASDAddImportAction"; //$NON-NLS-1$ - - public ASDAddImportAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_IMPORT); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/import_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddImportCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInputAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInputAction.java deleted file mode 100644 index ff5f9aa5f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInputAction.java +++ /dev/null @@ -1,59 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -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; - -public class ASDAddInputAction extends BaseSelectionAction { - public static String ID = "ASDAddInputActionn"; //$NON-NLS-1$ - - public ASDAddInputAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_INPUT); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/input_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IOperation iOperation = null; - - if (o instanceof IOperation) { - iOperation = (IOperation) o; - } - else if (o instanceof IMessageReference) { - iOperation = ((IMessageReference) o).getOwnerOperation(); - } - else if (o instanceof IParameter) { - iOperation = ((IMessageReference) ((IParameter) o).getOwner()).getOwnerOperation(); - } - - if (iOperation != null) { - Command command = iOperation.getAddInputCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInterfaceAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInterfaceAction.java deleted file mode 100644 index ddf12f83f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInterfaceAction.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddInterfaceAction extends BaseSelectionAction { - public static String ID = "ASDAddInterfaceAction"; //$NON-NLS-1$ - - public ASDAddInterfaceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_PORTTYPE); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/porttype_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddInterfaceCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object element = ((IASDAddCommand) command).getNewlyAddedComponent(); - selectAndDirectEdit(element); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddMessageAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddMessageAction.java deleted file mode 100644 index acd07a84c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddMessageAction.java +++ /dev/null @@ -1,51 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddMessageAction extends BaseSelectionAction { - public static String ID = "ASDAddMessageAction"; //$NON-NLS-1$ - - public ASDAddMessageAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_MESSAGE); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/message_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddMessageCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOperationAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOperationAction.java deleted file mode 100644 index 3e1939aa5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOperationAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -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; - -public class ASDAddOperationAction extends BaseSelectionAction { - public static String ID = "ASDAddOperationAction"; //$NON-NLS-1$ - - public ASDAddOperationAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_OPERATION); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/operation_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IInterface theInterface = null; - - if (o instanceof IInterface) { - theInterface = (IInterface) o; - } - else if (o instanceof IOperation) { - theInterface = ((IOperation) o).getOwnerInterface(); - } - else if (o instanceof IMessageReference) { - theInterface = ((IMessageReference) o).getOwnerOperation().getOwnerInterface(); - } - else if (o instanceof IParameter) { - theInterface = ((IMessageReference) ((IParameter) o).getOwner()).getOwnerOperation().getOwnerInterface(); - } - - if (theInterface != null) { - Command command = theInterface.getAddOperationCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object element = ((IASDAddCommand) command).getNewlyAddedComponent(); - selectAndDirectEdit(element); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOutputAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOutputAction.java deleted file mode 100644 index ca36abfb4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOutputAction.java +++ /dev/null @@ -1,59 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -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; - -public class ASDAddOutputAction extends BaseSelectionAction { - public static String ID = "ASDAddOutputActionn"; //$NON-NLS-1$ - - public ASDAddOutputAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_OUTPUT); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/output_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IOperation iOperation = null; - - if (o instanceof IOperation) { - iOperation = (IOperation) o; - } - else if (o instanceof IMessageReference) { - iOperation = ((IMessageReference) o).getOwnerOperation(); - } - else if (o instanceof IParameter) { - iOperation = ((IMessageReference) ((IParameter) o).getOwner()).getOwnerOperation(); - } - - if (iOperation != null) { - Command command = iOperation.getAddOutputCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddParameterAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddParameterAction.java deleted file mode 100644 index 61970a854..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddParameterAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class ASDAddParameterAction extends BaseSelectionAction { - public static String ID = "ASDAddParameterAction"; //$NON-NLS-1$ - - public ASDAddParameterAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText("Add Parameter"); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/input_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - IMessageReference messageReference = null; - - if (o instanceof IMessageReference) - { - messageReference = (IMessageReference)o; - } - else if (o instanceof IParameter) { - messageReference = ((IMessageReference) ((IParameter) o).getOwner()); - } - - if (messageReference instanceof W11MessageReference) { - W11MessageReference w11MessageReference = (W11MessageReference)messageReference; - Command command = w11MessageReference.getAddParamterCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - selectAndDirectEdit(object); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddSchemaAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddSchemaAction.java deleted file mode 100644 index 1904b2d05..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddSchemaAction.java +++ /dev/null @@ -1,51 +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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddSchemaAction extends BaseSelectionAction { - public static String ID = "ASDAddSchemaAction"; //$NON-NLS-1$ - - public ASDAddSchemaAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_SCHEMA); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/xsd_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddSchemaCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object object = ((IASDAddCommand) command).getNewlyAddedComponent(); - performSelection(object); - } - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddServiceAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddServiceAction.java deleted file mode 100644 index ec6368f61..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddServiceAction.java +++ /dev/null @@ -1,59 +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.actions; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ServiceEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; - -public class ASDAddServiceAction extends BaseSelectionAction { - public static String ID = "ASDAddServiceAction"; //$NON-NLS-1$ - - public ASDAddServiceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_ADD_SERVICE); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/service_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - - if (o instanceof IDescription) { - Command command = ((IDescription) o).getAddServiceCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (command instanceof IASDAddCommand) { - Object element = ((IASDAddCommand) command).getNewlyAddedComponent(); - selectAndDirectEdit(element); - } - } - } - } - - protected void doDirectEdit(EditPart ep) { - if (ep instanceof ServiceEditPart) { - ((ServiceEditPart) ep).performDirectEdit(null); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDCaptureScreenAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDCaptureScreenAction.java deleted file mode 100644 index 0589425fd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDCaptureScreenAction.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.IEditorActionDelegate; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.ActionDelegate; -import org.eclipse.wst.xsd.ui.internal.adt.actions.CaptureScreenAction; - - -/** - * Our sample action implements workbench action delegate. - * The action proxy will be created by the workbench and - * shown in the UI. When the user tries to use the action, - * this delegate will be created and execution will be - * delegated to it. - * @see org.eclipse.ui.IWorkbenchWindowActionDelegate - */ -public class ASDCaptureScreenAction extends ActionDelegate implements IEditorActionDelegate { - - /** - * The constructor. - */ - public ASDCaptureScreenAction() { - } - - /** - * The action has been activated. The argument of the - * method represents the 'real' action sitting - * in the workbench UI. - * @see IWorkbenchWindowActionDelegate#run - */ - public void run(IAction action) { - CaptureScreenAction captureScreenAction = new CaptureScreenAction(); - captureScreenAction.run(); - } - - public void setActiveEditor(IAction action, IEditorPart targetEditor) { - - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDeleteAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDeleteAction.java deleted file mode 100644 index 59df16335..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDeleteAction.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import java.util.Iterator; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; - -public class ASDDeleteAction extends BaseSelectionAction { - public static String ID = "ASDDeleteAction"; //$NON-NLS-1$ - - public ASDDeleteAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_DELETE); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/delete_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - Iterator it = getSelectedObjects().iterator(); - while (it.hasNext()) { - Object object = it.next(); - Command command = null; - - if (object instanceof IASDObject) { - command = ((IASDObject) object).getDeleteCommand(); - } - - if (command != null) { - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - - if (object instanceof WSDLBaseAdapter) { - Object target = ((WSDLBaseAdapter) object).getTarget(); - if (target instanceof WSDLElement) { - performSelection(((WSDLElement) target).getEnclosingDefinition()); - } - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDirectEditAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDirectEditAction.java deleted file mode 100644 index 26d5bd69c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDirectEditAction.java +++ /dev/null @@ -1,84 +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.actions; - -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.ui.actions.DirectEditAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; - -public class ASDDirectEditAction extends DirectEditAction { - protected ISelectionProvider provider; - - /** - * Same as {@link #DirectEditAction(IWorkbenchPart)}. - * @param editor the editor - */ - public ASDDirectEditAction(IEditorPart editor) { - super((IWorkbenchPart)editor); - } - - /** - * Constructs a DirectEditAction using the specified part. - * @param part the workbench part - */ - public ASDDirectEditAction(IWorkbenchPart part) { - super(part); - } - - /* (non-Javadoc) - * @see org.eclipse.gef.ui.actions.SelectionAction#getSelection() - */ - protected ISelection getSelection() - { - // If we're in this action, we assume the action was initiated via the graphical viewer. - // We use the graphical view to obtain the selected edit part because for us, one model - // may drive more than one edit part. So we need to find the exact edit part we wish to - // direct edit. The preferred method of determining the edit part would have been to go - // through the selection manager, then through the edit part registry. However, the selection - // manager only returns the model object (not the edit part).... and since the model object - // may drive more than one edit part, the edit part registry may return the "wrong" edit - // part for direct editing. Thus we look call GraphicalViewer.getFocusEditPart(). - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Object object = editor.getAdapter(GraphicalViewer.class); - if (object instanceof GraphicalViewer) { - Object selection = ((GraphicalViewer) object).getFocusEditPart(); - return new StructuredSelection(selection); - } - - return super.getSelection(); - } - - /* (non-Javadoc) - * @see org.eclipse.gef.ui.actions.SelectionAction#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) - */ - public void setSelectionProvider(ISelectionProvider provider) - { - super.setSelectionProvider(provider); - this.provider = provider; - } - - protected boolean calculateEnabled() { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof IASDObject) { - return !((IASDObject) selection).isReadOnly(); - } - - return true; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragAction.java deleted file mode 100644 index 193c83aae..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragAction.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.ui.IWorkbenchPart; - -public abstract class ASDDragAction extends BaseSelectionAction { - protected GraphicalEditPart movingChildEditPart; - protected Point pointerLocation; - - public ASDDragAction(IWorkbenchPart part) { - super(part); - } - - /* - * Sub-classes should override this method. - */ - public boolean canExecute() { - return false; - } - - public void execute() { - run(); - } - - /* - * Sub-classes should override this method. - */ - public String getUndoDescription() { - return ""; //$NON-NLS-1$ - } - - /* - * Sub-classes should override this method. - */ - public IFigure getFeedbackFigure() { - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragReorderAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragReorderAction.java deleted file mode 100644 index 8c5a3e91c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDragReorderAction.java +++ /dev/null @@ -1,284 +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.actions; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Polyline; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -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; - -public class ASDDragReorderAction extends ASDDragAction { - protected IASDObject movingChild; - protected IASDObject newParent; - protected GraphicalEditPart leftSiblingEditPart; - protected GraphicalEditPart rightSiblingEditPart; - protected IASDObject leftSibElement; - protected IASDObject rightSibElement; - protected boolean canNeverExecute = false; - - public ASDDragReorderAction(GraphicalEditPart movingChildEditPart, EditPart pointerEditPart, Point pointerLocation) { - super(null); - this.movingChildEditPart = movingChildEditPart; - this.pointerLocation = pointerLocation; - - EditPart possibleParent = getParentEditPart(pointerEditPart); - - if (!(possibleParent instanceof GraphicalEditPart)) { - canNeverExecute = true; - return; - } - - GraphicalEditPart targetParentEditPart = (GraphicalEditPart) possibleParent; - - if (pointerEditPart.getParent() != null) { - // Sort the siblings (and itself) - List targetEditPartSiblings = pointerEditPart.getParent().getChildren(); - Collections.sort(targetEditPartSiblings, new VerticalEditPartComparator()); - - // Get 'left' and 'right' siblings - leftSiblingEditPart = getVerticalLeftSibling(targetEditPartSiblings, movingChildEditPart, pointerLocation); - rightSiblingEditPart = getVerticalRightSibling(targetEditPartSiblings, movingChildEditPart, pointerLocation); - - if (movingChildEditPart != null) - movingChild = (IASDObject) movingChildEditPart.getModel(); - if (leftSiblingEditPart != null) - leftSibElement = (IASDObject) leftSiblingEditPart.getModel(); - if (rightSiblingEditPart != null) - rightSibElement = (IASDObject) rightSiblingEditPart.getModel(); - - newParent = (IASDObject) targetParentEditPart.getModel(); - } - else { - newParent = (IASDObject) targetParentEditPart.getModel(); - leftSibElement = null; - rightSibElement= null; - } - } - - public boolean canExecute() - { - boolean result = false; - - if (canNeverExecute || newParent == null || movingChild == null) { - return false; - } - - if (movingChild instanceof IMessageReference) { - IMessageReference messageRef = (IMessageReference) movingChild; - if (messageRef.getKind() == IMessageReference.KIND_INPUT || messageRef.getKind() == IMessageReference.KIND_OUTPUT) { - IMessageReference leftSibMessageRef = (IMessageReference) leftSibElement; - - result = true; - if (leftSibMessageRef != null) { - if (leftSibMessageRef.getKind() == IMessageReference.KIND_FAULT) { - result = false; - } - } - if (!(result && newParent.equals(messageRef.getOwnerOperation()))) { - result = false; - } - } - } - else if (movingChild instanceof IParameter) { - if (newParent instanceof IMessageReference && newParent.equals(((IParameter) movingChild).getOwner())) { - result = true; - } - } - - return result; - } - - /* - * @see IAction#run() - */ - public void run() - { -// beginRecording(); - if (canExecute()) { - if (movingChild instanceof IMessageReference) { - Object messageRefOwner = ((IMessageReference) movingChild).getOwnerOperation(); - if (messageRefOwner instanceof IOperation) { - IMessageReference leftSib = (IMessageReference) leftSibElement; - IMessageReference rightSib = (IMessageReference) rightSibElement; - IMessageReference movingSib = (IMessageReference) movingChild; - Command command = ((IOperation) messageRefOwner).getReorderMessageReferencesCommand(leftSib, rightSib, movingSib); - command.execute(); - } - } - else if (movingChild instanceof IParameter) { - Object paramOwner = ((IParameter) movingChild).getOwner(); - if (paramOwner instanceof IMessageReference) { - IParameter leftSib = (IParameter) leftSibElement; - IParameter rightSib = (IParameter) rightSibElement; - IParameter movingSib = (IParameter) movingChild; - Command command = ((IMessageReference) paramOwner).getReorderParametersCommand(leftSib, rightSib, movingSib); - command.execute(); - } - } -// wsdlEditor.getSelectionManager().setSelection(new StructuredSelection(movingChild)); - } -// endRecording(); - } - - public IFigure getFeedbackFigure() { - IFigure feedbackFigure = null; - if (feedbackFigure == null && movingChildEditPart instanceof GraphicalEditPart) - { - feedbackFigure = new Polyline(); - ((Polyline)feedbackFigure).setLineWidth(2); - drawLines((Polyline) feedbackFigure); - } - - return feedbackFigure; - } - - /* Return a PointList which will be used to add a feedback figure. The feedback figure will be a - * Polyline composed of the Points in the PointList - */ - private PointList drawLines(Polyline polyLine) { - PointList pointList = new PointList(); - - if (leftSiblingEditPart != null) { - Rectangle leftRectangle = leftSiblingEditPart.getFigure().getBounds(); - int xCoord = leftRectangle.x; - int yCoord = leftRectangle.y; - int height = leftRectangle.height; - int width = leftRectangle.width; - - // Draw left end line - addLineToPolyline(polyLine, xCoord, yCoord + height + 3, xCoord, yCoord + height - 3); - addLineToPolyline(polyLine, xCoord, yCoord + height - 3, xCoord, yCoord + height); - - // Draw horizontal line - addLineToPolyline(polyLine, xCoord, yCoord + height, xCoord + width, yCoord + height); - - // Draw right end line - addLineToPolyline(polyLine, xCoord + width, yCoord + height, xCoord + width, yCoord + height - 3); - addLineToPolyline(polyLine, xCoord + width, yCoord + height, xCoord + width, yCoord + height + 3); - } - else if (rightSiblingEditPart != null) { - Rectangle rightRectangle = rightSiblingEditPart.getFigure().getBounds(); - int xCoord = rightRectangle.x; - int yCoord = rightRectangle.y; - int width = rightRectangle.width; - - // Draw left end line - addLineToPolyline(polyLine, xCoord, yCoord + 3, xCoord, yCoord - 3); - addLineToPolyline(polyLine, xCoord, yCoord - 3, xCoord, yCoord); - - // Draw horizontal line - addLineToPolyline(polyLine, xCoord, yCoord, xCoord + width, yCoord); - - // Draw right end line - addLineToPolyline(polyLine, xCoord + width, yCoord, xCoord + width, yCoord - 3); - addLineToPolyline(polyLine, xCoord + width, yCoord, xCoord + width, yCoord + 3); - } - - return pointList; - } - - protected Polyline addLineToPolyline(Polyline polyline, int x1, int y1, int x2, int y2) { - polyline.addPoint(new Point(x1, y1)); - polyline.addPoint(new Point(x2, y2)); - - return polyline; - } - - /* - * Pre-condition: The List siblings should be sorted by it's y-coordinate - */ - private GraphicalEditPart getVerticalRightSibling(List siblings, GraphicalEditPart movingEditPart, Point pointerLocation) { - GraphicalEditPart rightSibling = null; - int pointerYLocation = pointerLocation.y; - - for (int index = 0; index < siblings.size(); index++) { - GraphicalEditPart sibling = (GraphicalEditPart) siblings.get(index); - int siblingYLocation = sibling.getFigure().getBounds().getCenter().y; - - if (siblingYLocation > pointerYLocation) { - rightSibling = sibling; - break; - } - } - - return rightSibling; - } - - /* - * Pre-condition: The List siblings should be sorted by it's y-coordinate - */ - private GraphicalEditPart getVerticalLeftSibling(List siblings, GraphicalEditPart movingEditPart, Point pointerLocation) { - GraphicalEditPart leftSibling = null; - int pointerYLocation = pointerLocation.y; - - int index; - for (index = 0; index < siblings.size(); index++) { - GraphicalEditPart sibling = (GraphicalEditPart) siblings.get(index); - int siblingYLocation = sibling.getFigure().getBounds().getCenter().y; - - if (siblingYLocation > pointerYLocation) { - if (index > 0) { - leftSibling = (GraphicalEditPart) siblings.get(index - 1); - } - - break; - } - } - - if (index == siblings.size()) { - leftSibling = (GraphicalEditPart) siblings.get(index - 1); - } - - return leftSibling; - } - - protected EditPart getParentEditPart(EditPart target) - { - return target.getParent(); - } - - private class VerticalEditPartComparator implements Comparator { - - public VerticalEditPartComparator() { - } - - public int compare(Object part1, Object part2) { - int compareValue = 0; - - if (part1 instanceof GraphicalEditPart && part2 instanceof GraphicalEditPart) { - GraphicalEditPart editPart1 = (GraphicalEditPart) part1; - GraphicalEditPart editPart2 = (GraphicalEditPart) part2; - - int editPart1Y = editPart1.getFigure().getBounds().getCenter().y; - int editPart2Y = editPart2.getFigure().getBounds().getCenter().y; - - Integer integerPart1 = new Integer(editPart1Y); - Integer integerPart2 = new Integer(editPart2Y); - - compareValue = integerPart1.compareTo(integerPart2); - } - - return compareValue; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDEditNamespacesAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDEditNamespacesAction.java deleted file mode 100644 index f5b727e3e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDEditNamespacesAction.java +++ /dev/null @@ -1,74 +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.actions; - -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11EditNamespacesCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; -import org.eclipse.wst.wsdl.ui.internal.dialogs.EditNamespacesDialog; - -public class ASDEditNamespacesAction extends BaseSelectionAction { - public static String ID = "ASDEditNamespacesAction"; //$NON-NLS-1$ - - private IDescription description; - - public ASDEditNamespacesAction(IWorkbenchPart part, IDescription description) { - super(part); - setId(ID); - String text = Messages._UI_EDIT_NAMESPACES; //$NON-NLS-1$ - setText(text); - - this.description = description; - } - - public void run() { - Object o = description; - if (getSelectedObjects().size() > 0) { - if (o instanceof ICategoryAdapter) { - o = ((ICategoryAdapter) o).getOwnerDescription(); - } - } - - if (o instanceof IDescription) { - // TODO: The code below is not generic. We need to revisit this to ensure it is - // generic. IDescription needs a getNamespacesInfo() and getEditNamespacesCommand()... - IDescription description = (IDescription) o; - W11Description w11Description = (W11Description) o; - Definition definition = (Definition) w11Description.getTarget(); - - IPath path = new Path(definition.getDocumentBaseURI()); - List namespaceInfoList = w11Description.getNamespacesInfo(); - String tns = description.getTargetNamespace(); - EditNamespacesDialog dialog = new EditNamespacesDialog(WSDLEditorPlugin.getShell(), path, Messages._UI_EDIT_NAMESPACES_DIALOG_TITLE, tns, namespaceInfoList); //$NON-NLS-1$ - int rc = dialog.createAndOpen(); - if (rc == IDialogConstants.OK_ID) { - List newInfoList = dialog.getNamespaceInfoList(); - W11EditNamespacesCommand command = (W11EditNamespacesCommand) w11Description.getEditNamespacesCommand(); - command.setNamespacesInfo(newInfoList); - command.setTargetNamespace(dialog.getTargetNamespace()); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDGenerateBindingAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDGenerateBindingAction.java deleted file mode 100644 index 21a359070..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDGenerateBindingAction.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.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; - -public class ASDGenerateBindingAction extends BaseSelectionAction { - public static String ID = "ASDGenerateBindingActionn"; //$NON-NLS-1$ - - public ASDGenerateBindingAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_GENERATE_BINDING_CONTENT); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/input_obj.gif")); - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof IBinding) { - Command command = ((IBinding) o).getGenerateBindingCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - - performSelection(o); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDOpenSchemaAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDOpenSchemaAction.java deleted file mode 100644 index 4951e1b1f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDOpenSchemaAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IType; -import org.eclipse.wst.wsdl.ui.internal.asd.util.IOpenExternalEditorHelper; - -public class ASDOpenSchemaAction extends BaseSelectionAction { - public static String ID = "ASDOpenSchemaAction"; //$NON-NLS-1$ - - public ASDOpenSchemaAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_OPEN_SCHEMA); //$NON-NLS-1$ -// setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/binding_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - - if (o instanceof IType) { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Object helper = editor.getAdapter(IOpenExternalEditorHelper.class); - if (helper instanceof IOpenExternalEditorHelper) { - ((IOpenExternalEditorHelper) helper).setModel(o); - ((IOpenExternalEditorHelper) helper).openExternalEditor(); - } - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingBindingAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingBindingAction.java deleted file mode 100644 index 357852275..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingBindingAction.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.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class ASDSetExistingBindingAction extends BaseSelectionAction { - public static String ID = "ASDSetExistingBindingAction"; //$NON-NLS-1$ - protected IEndPoint endPoint; - - public ASDSetExistingBindingAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_EXISTING_BINDING); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void setIEndPoint(IEndPoint endPoint) { - this.endPoint = endPoint; - } - - public void run() { - if (endPoint == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IEndPoint) { - endPoint = (IEndPoint) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getBindingReferenceEditManager(endPoint); - if (endPoint != null && refManager != null) { - IComponentDialog dialog = refManager.getBrowseDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(endPoint, spec); - } - } - - endPoint = null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingInterfaceAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingInterfaceAction.java deleted file mode 100644 index 4605ca855..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingInterfaceAction.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.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class ASDSetExistingInterfaceAction extends BaseSelectionAction { - public static String ID = "ASDSetExistingInterfaceAction"; //$NON-NLS-1$ - protected IBinding binding; - - public ASDSetExistingInterfaceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_EXISTING_PORTTYPE); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void setIBinding(IBinding binding) { - this.binding = binding; - } - - public void run() { - if (binding == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IBinding) { - binding = (IBinding) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getInterfaceReferenceEditManager(binding); - if (binding != null && refManager != null) { - IComponentDialog dialog = refManager.getBrowseDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(binding, spec); - } - } - - binding = null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewBindingAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewBindingAction.java deleted file mode 100644 index a6da98c2b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewBindingAction.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.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class ASDSetNewBindingAction extends BaseSelectionAction { - public static String ID = "ASDSetNewBindingAction"; //$NON-NLS-1$ - protected IEndPoint endPoint; - - public ASDSetNewBindingAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_NEW_BINDING); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void setIEndPoint(IEndPoint endPoint) { - this.endPoint = endPoint; - } - - public void run() { - if (endPoint == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IEndPoint) { - endPoint = (IEndPoint) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getBindingReferenceEditManager(endPoint); - if (endPoint != null && refManager != null) { - IComponentDialog dialog = refManager.getNewDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(endPoint, spec); - } - } - - endPoint = null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewInterfaceAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewInterfaceAction.java deleted file mode 100644 index 02aec427c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewInterfaceAction.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.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class ASDSetNewInterfaceAction extends BaseSelectionAction { - public static String ID = "ASDSetNewInterfaceAction"; //$NON-NLS-1$ - protected IBinding binding; - - public ASDSetNewInterfaceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages._UI_ACTION_NEW_PORTTYPE); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void setIBinding(IBinding binding) { - this.binding = binding; - } - - public void run() { - if (binding == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IBinding) { - binding = (IBinding) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getInterfaceReferenceEditManager(binding); - if (binding != null && refManager != null) { - IComponentDialog dialog = refManager.getNewDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(binding, spec); - } - } - - binding = null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/BaseSelectionAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/BaseSelectionAction.java deleted file mode 100644 index f5bc1a248..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/BaseSelectionAction.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.actions; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.gef.ui.parts.AbstractEditPartViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; - -public abstract class BaseSelectionAction extends SelectionAction -{ - public static final String SUBMENU_START_ID = "SUBMENU_START_ID: "; //$NON-NLS-1$ - public static final String SUBMENU_END_ID = "SUBMENU_END_ID: "; //$NON-NLS-1$ - - protected ISelectionProvider provider; - - public BaseSelectionAction(IWorkbenchPart part) - { - super(part); - } - - /* (non-Javadoc) - * @see org.eclipse.gef.ui.actions.SelectionAction#getSelection() - */ - protected ISelection getSelection() - { - // always get selection from selection provider first - if (provider!=null) - return provider.getSelection(); - - return super.getSelection(); - } - /* (non-Javadoc) - * @see org.eclipse.gef.ui.actions.SelectionAction#setSelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) - */ - public void setSelectionProvider(ISelectionProvider provider) - { - super.setSelectionProvider(provider); - this.provider = provider; - } - - public List getSelectedObjects() - { - List processedObjects = new ArrayList(); - List objects = super.getSelectedObjects(); - Iterator it = objects.iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item instanceof AbstractModelCollection) { - processedObjects.add(((AbstractModelCollection) item).getModel()); - } - else { - processedObjects.add(item); - } - } - - return processedObjects; - } - - protected boolean calculateEnabled() { - Object selection = ((IStructuredSelection) getSelection()).getFirstElement(); - - if (selection instanceof IASDObject) { - return !((IASDObject) selection).isReadOnly(); - } - - return true; - } - - protected void selectAndDirectEdit(final Object o) { - Runnable runnable = new Runnable() { - public void run() { - if (o instanceof Notifier) { - performSelection(o); - activateDirectEdit(); - } - }}; - Display.getCurrent().asyncExec(runnable); - } - - protected void activateDirectEdit() { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - if (!(part instanceof ContentOutline)) { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Object graphicalViewer = editor.getAdapter(GraphicalViewer.class); - if (graphicalViewer instanceof AbstractEditPartViewer) { - AbstractEditPartViewer viewer = (AbstractEditPartViewer) graphicalViewer; - Object obj = viewer.getSelectedEditParts().get(0); - // todo: rmah: we need to completely remove all implementations of doDirectEdit(). - // Use performRequest() instead. -// doDirectEdit((EditPart) obj); - Request request = new Request(); - request.setType(RequestConstants.REQ_DIRECT_EDIT); - ((EditPart) obj).performRequest(request); - } - } - } - - protected void doDirectEdit(EditPart ep) { - Request request = new Request(); - request.setType(RequestConstants.REQ_DIRECT_EDIT); - ep.performRequest(request); - } - - protected void performSelection(Object object) { - Object adapted = null; - - if (object instanceof Notifier) { - Notifier element = (Notifier) object; - // TODO: We shouldn't know about WSDLAdapterFactoryHelper here.... - adapted = WSDLAdapterFactoryHelper.getInstance().adapt(element); - } - else if (object instanceof IASDObject) { - adapted = object; - } - - if (adapted != null) { - try { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor != null && editor.getAdapter(ISelectionProvider.class) != null) { - ISelectionProvider provider = (ISelectionProvider) editor.getAdapter(ISelectionProvider.class); - if (provider != null) { - provider.setSelection(new StructuredSelection(adapted)); - } - } - } - catch (Exception e) {} - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/IASDAddCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/IASDAddCommand.java deleted file mode 100644 index 552ee0bb9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/IASDAddCommand.java +++ /dev/null @@ -1,15 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.actions; - -public interface IASDAddCommand { - public Object getNewlyAddedComponent(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ShowPropertiesViewAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ShowPropertiesViewAction.java deleted file mode 100644 index 8f447ace9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ShowPropertiesViewAction.java +++ /dev/null @@ -1,56 +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.actions; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PartInitException; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; - - -/** - * Show the properties view in the current perspective. - */ -public class ShowPropertiesViewAction extends BaseSelectionAction -{ - public static final String ID = "org.eclipse.wst.wsdl.ui.internal.asd.actions.ShowPropertiesViewAction"; //$NON-NLS-1$ - public static final String PROPERTIES_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$ - - protected static ImageDescriptor enabledImage, disabledImage; - - public ShowPropertiesViewAction(IWorkbenchPart part) - { - super(part); - setId(ID); - setText(Messages._UI_ACTION_SHOW_PROPERTIES); - setToolTipText(getText()); - setImageDescriptor(ASDEditorPlugin.getImageDescriptorFromPlugin("icons/elcl16/showproperties_obj.gif") ); //$NON-NLS-1$ - setDisabledImageDescriptor(ASDEditorPlugin.getImageDescriptorFromPlugin("icons/dlcl16/showproperties_obj.gif") ); //$NON-NLS-1$ - } - - protected boolean calculateEnabled() - { - return true; - } - - public void run() - { - try - { - getWorkbenchPart().getSite().getPage().showView(PROPERTIES_VIEW_ID); - } - catch (PartInitException pie) - { - - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtension.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtension.java deleted file mode 100644 index 147090576..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtension.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.adapterfactory.extension; - -import org.eclipse.emf.common.notify.AdapterFactory; - -public class AdapterFactoryExtension { - private String namespace; - private String adapterFactoryClassName; - private ClassLoader classLoader; - - public AdapterFactoryExtension(String namespace) { - this.namespace = namespace; - } - - public void setAdapterFactoryClassName(String factoryClassName) { - adapterFactoryClassName = factoryClassName; - } - - public void setClassLoader(ClassLoader classLoader){ - this.classLoader = classLoader; - } - - public String getNamespace() { - return namespace; - } - - public AdapterFactory getAdapterFactory() { - AdapterFactory factory = null; - if (adapterFactoryClassName != null) { - try { - Class theClass = classLoader != null ? classLoader.loadClass(adapterFactoryClassName) : Class.forName(adapterFactoryClassName); - factory = (AdapterFactory) theClass.newInstance(); - } - catch (Exception e) { - } - } - - return factory; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtensionRegistry.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtensionRegistry.java deleted file mode 100644 index 34b99bc23..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/adapterfactory/extension/AdapterFactoryExtensionRegistry.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.adapterfactory.extension; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - - -public class AdapterFactoryExtensionRegistry { - protected List registeredAdapterFactories = new ArrayList(); - - public void add(AdapterFactoryExtension factory) { - registeredAdapterFactories.add(factory); - } - - public List getAdapterFactoryNamespaces() { - List list = new ArrayList(); - for (Iterator i = registeredAdapterFactories.iterator(); i.hasNext();) { - AdapterFactoryExtension extension = (AdapterFactoryExtension) i.next(); - list.add(extension.getNamespace()); - } - return list; - } - - public AdapterFactoryExtension getExtensionForNamespace(String namespace) { - AdapterFactoryExtension result = null; - if (namespace != null) { - for (Iterator i = registeredAdapterFactories.iterator(); i.hasNext();) { - AdapterFactoryExtension extension = (AdapterFactoryExtension) i.next(); - if (namespace.equals(extension.getNamespace())) { - result = extension; - break; - } - } - } - - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtension.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtension.java deleted file mode 100644 index 325804987..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtension.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension; - -import org.eclipse.wst.wsdl.ui.internal.wizards.ContentGeneratorOptionsPage; - -public class ContentGeneratorUIExtension { - private String name; - private String namespace; - private String label; - private String bindingOptionsPageClassName; - private String portOptionsPageClassName; - - private ClassLoader classLoader; - - public ContentGeneratorUIExtension(String name, String namespace) { - this.name = name; - this.namespace = namespace; - } - - public void setBindingOptionsPageClassName(String bindingClassName) { - bindingOptionsPageClassName = bindingClassName; - } - - public void setPortOptionsPageClassName(String portClassName) { - portOptionsPageClassName = portClassName; - } - - public void setClassLoader(ClassLoader classLoader){ - this.classLoader = classLoader; - } - - public String getName() { - return name; - } - - public String getNamespace() { - return namespace; - } - - public ContentGeneratorOptionsPage getBindingContentGeneratorOptionsPage() { - ContentGeneratorOptionsPage result = null; - if (bindingOptionsPageClassName != null) { - try { - Class theClass = classLoader != null ? classLoader.loadClass(bindingOptionsPageClassName) : Class.forName(bindingOptionsPageClassName); - result = (ContentGeneratorOptionsPage) theClass.newInstance(); - } - catch (Exception e) { - } - } - - return result; - } - - public ContentGeneratorOptionsPage getPortContentGeneratorOptionsPage() { - ContentGeneratorOptionsPage result = null; - if (portOptionsPageClassName != null) { - try { - Class theClass = classLoader != null ? classLoader.loadClass(portOptionsPageClassName) : Class.forName(portOptionsPageClassName); - result = (ContentGeneratorOptionsPage) theClass.newInstance(); - } - catch (Exception e) { - } - } - - return result; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtensionRegistry.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtensionRegistry.java deleted file mode 100644 index 2b853f834..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/contentgenerator/ui/extension/ContentGeneratorUIExtensionRegistry.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class ContentGeneratorUIExtensionRegistry { - protected List registeredContentGeneratorUIList = new ArrayList(); - - public void add(ContentGeneratorUIExtension extension) { - registeredContentGeneratorUIList.add(extension); - } - - public List getBindingExtensionNames() { - List list = new ArrayList(); - for (Iterator i = registeredContentGeneratorUIList.iterator(); i.hasNext();) { - ContentGeneratorUIExtension extension = (ContentGeneratorUIExtension) i.next(); - list.add(extension.getName()); - } - return list; - } - - public ContentGeneratorUIExtension getExtensionForNamespace(String namespace) { - ContentGeneratorUIExtension result = null; - if (namespace != null) { - for (Iterator i = registeredContentGeneratorUIList.iterator(); i.hasNext();) { - ContentGeneratorUIExtension extension = (ContentGeneratorUIExtension) i.next(); - if (namespace.equals(extension.getNamespace())) { - result = extension; - break; - } - } - } - - return result; - } - - public ContentGeneratorUIExtension getExtensionForName(String name) { - ContentGeneratorUIExtension result = null; - if (name != null) { - for (Iterator i = registeredContentGeneratorUIList.iterator(); i.hasNext();) { - ContentGeneratorUIExtension extension = (ContentGeneratorUIExtension) i.next(); - if (name.equals(extension.getName())) { - result = extension; - break; - } - } - } - - return result; - } - - public ContentGeneratorUIExtension getExtensionForLabel(String label) - { - ContentGeneratorUIExtension result = null; - if (label != null) - { - for (Iterator i = registeredContentGeneratorUIList.iterator(); i.hasNext();) - { - ContentGeneratorUIExtension extension = (ContentGeneratorUIExtension) i.next(); - if (label.equals(extension.getLabel())) - { - result = extension; - break; - } - } - } - - return result; - } -} 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 d6e2da975..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.SelectionManager; -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)); - -// MenuManager manager = new MenuManager("#popup"); -// manager.addMenuListener(menuProvider); -// manager.setRemoveAllWhenShown(true); -// Menu menu = manager.createContextMenu(getControl()); -// getControl().setMenu(menu); - - editor.getEditorSite().registerContextMenu("org.eclipse.wst.wsdl.ui.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); - - // Workaround bug 227687 An edit part's focus state is not updated properly - // Once this is bug is fixed, we can remove custom selection manager - setSelectionManager(new CustomSelectionManager()); - - setKeyHandler(new BaseGraphicalViewerKeyHandler(this)); - } - - // Workaround bug 227687 An edit part's focus state is not updated properly - // Once this is bug is fixed, we can remove this class - private class CustomSelectionManager extends SelectionManager - { - public void appendSelection(EditPart editpart) - { - if (editpart != getFocus()) - getViewer().setFocus(editpart); - super.appendSelection(editpart); - } - } - - // 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 c4eff0c4c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicsConstants.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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 boolean isHighContrast = Display.getDefault().getHighContrast(); - - 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 normalTableCellSelectionColor = new Color(null, 238, 232, 170); //new Color(null, 240, 230, 140); //1, 15, 42); - public final static Color tableCellSelectionColor = isHighContrast ? Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT): normalTableCellSelectionColor; - - 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 Color defaultForegroundColor = isHighContrast ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND) : ColorConstants.black; - public final static Color defaultBackgroundColor = isHighContrast ? Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND) : ColorConstants.white; - - 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 23af5e524..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDCCombo.java +++ /dev/null @@ -1,1509 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.directedit; - -import org.eclipse.swt.SWT; -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.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; - -/* - * 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 org.eclipse.swt.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 org.eclipse.swt.widgets.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.events.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 && !isDisposed()) { - 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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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; - 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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 org.eclipse.swt.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 d674ee0e4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.directedit; - -import java.text.MessageFormat; - -import org.eclipse.core.runtime.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; - private Object selectedValue; - private ComponentReferenceEditManager componentReferenceEditManager; - private int textIndent = 5; - private boolean isTraversing = false; - // This prevents the cell editor from being deactivated while handling the New or Browse selection. - private boolean isHandlingSelection = false; - - /** - * 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; - } - if (e.detail == SWT.TRAVERSE_ARROW_NEXT || e.detail == SWT.TRAVERSE_ARROW_PREVIOUS) - { - isTraversing = true; - } - } - }); - - 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(); - } - - 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() && !isHandlingSelection) { - 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() { - isHandlingSelection = true; - Object newValue = null; - try { - selection = comboBox.getSelectionIndex(); - if (isTraversing) - { - isTraversing = false; - return; - } - 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()); - } - } - finally - { - isHandlingSelection = false; - } - 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 912774435..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelEditManager.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.directedit; - -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(DesignViewGraphicsConstants.defaultBackgroundColor); - } - - 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 ef66b900d..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, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -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 3f45b1755..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, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -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.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.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 (!isFileReadOnly() && (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(DesignViewGraphicsConstants.defaultForegroundColor); - 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/BaseConnectedEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseConnectedEditPart.java deleted file mode 100644 index 2e179cc99..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseConnectedEditPart.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; - -abstract public class BaseConnectedEditPart extends BaseEditPart -{ - protected ComponentReferenceConnection connectionFigure; - protected ComponentReferenceConnection connectionFeedbackFigure; - - abstract protected AbstractGraphicalEditPart getConnectionTargetEditPart(); - - public ComponentReferenceConnection createConnectionFigure() - { - if (connectionFigure == null && shouldDrawConnection()) - { - AbstractGraphicalEditPart referenceTypePart = getConnectionTargetEditPart(); - if (referenceTypePart != null) - { - connectionFigure = new ComponentReferenceConnection(); - refreshConnections(); - } - } - return connectionFigure; - } - - protected boolean shouldDrawConnection() - { - AbstractGraphicalEditPart referenceTypePart = getConnectionTargetEditPart(); - return (referenceTypePart != null); - } - - 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) - { - getLayer(LayerConstants.CONNECTION_LAYER).remove(connectionFigure); - } - removeConnectionFeedbackFigure(); - } - - protected void addConnectionFeedbackFigure() - { - // remove any preexisting connection feedback figures first - removeConnectionFeedbackFigure(); - - connectionFeedbackFigure = new ComponentReferenceConnection(); - connectionFeedbackFigure.setSourceAnchor(connectionFigure.getSourceAnchor()); - connectionFeedbackFigure.setTargetAnchor(connectionFigure.getTargetAnchor()); - connectionFeedbackFigure.setHighlight(true); - getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFeedbackFigure); - } - - protected void removeConnectionFeedbackFigure() - { - if (connectionFeedbackFigure != null) - { - connectionFeedbackFigure.setHighlight(false); - getLayer(LayerConstants.FEEDBACK_LAYER).remove(connectionFeedbackFigure); - connectionFeedbackFigure = null; - } - } - - public void addFeedback() - { - if (connectionFigure != null && connectionFigure.isVisible()) - { - connectionFigure.setHighlight(true); - addConnectionFeedbackFigure(); - } - } - - public void removeFeedback() - { - removeConnectionFeedbackFigure(); - if (connectionFigure != null) - connectionFigure.setHighlight(false); - } -} 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 3f9856ba6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -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.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.FileStoreEditorInput; -import org.eclipse.wst.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); - } - - protected boolean isFileReadOnly() - { - IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) - { - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - if (workbenchWindow != null) - { - IWorkbenchPage page = workbenchWindow.getActivePage(); - if (page != null) - { - IEditorPart editor = page.getActiveEditor(); - if (editor != null) - { - IEditorInput editorInput = editor.getEditorInput(); - if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput)) - { - return true; - } - } - } - } - } - return false; - } - - protected void paintFocusCursor(Rectangle r, Graphics graphics) - { - if (hasFocus()) - { - try - { - graphics.pushState(); - graphics.drawFocus(r.x, r.y + 1, r.width - 1, r.height - 2); - } - finally - { - graphics.popState(); - } - } - } - -} 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 2c05bd8c1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Rectangle; -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; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -// 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() - { - public void paint(Graphics graphics) { - super.paint(graphics); - Rectangle r = getBounds(); - // bug146932 - paintFocusCursor(new Rectangle(r.x, r.y, r.width, r.height), graphics); - } - }; - 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(); - - if (bindingOperation instanceof ITreeElement) { - label.setIcon(((ITreeElement) bindingOperation).getImage()); - } -// label.setText(bindingOperation.getName()); - } - else if (getModel() instanceof IBindingMessageReference) - { - label.setIcon(WSDLEditorPlugin.getInstance().getImage("icons/bind_asct_val_obj.gif")); //$NON-NLS-1$ -// 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")); //$NON-NLS-1$ - } - - 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 5f32abb3e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Collections; -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.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.DesignViewGraphicsConstants; -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.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; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class BindingEditPart extends BaseConnectedEditPart -{ - protected BoxComponentFigure figure; - protected boolean isExpanded = false; - private Label hoverHelpLabel = new Label(""); //$NON-NLS-1$ - - 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 addFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); -// boxFigureLineBorder.setColor(ColorConstants.darkBlue); - figure.setSelected(true); - figure.repaint(); - - super.addFeedback(); - } - - public void removeFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(DesignViewGraphicsConstants.defaultForegroundColor); - figure.setSelected(false); - figure.repaint(); - - super.removeFeedback(); - } - - protected boolean shouldDrawConnection() - { - if (isExpanded) - { - return false; - } - return super.shouldDrawConnection(); - } - - protected void refreshVisuals() - { - refreshConnections(); - if (getModel() instanceof IBinding) - { - IBinding binding = (IBinding) getModel(); - ((BoxComponentFigure) getFigure()).headingFigure.setIsReadOnly(((IBinding) getModel()).isReadOnly()); - - if (binding instanceof ITreeElement) { - figure.getLabel().setIcon(((ITreeElement) binding).getImage()); - } - - // Show the name of the IBinding with hover help - String prependString = Messages._UI_LABEL_BINDING; - hoverHelpLabel.setText(" " + prependString + " : " + binding.getName() + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - figure.setToolTip(hoverHelpLabel); - } - - //getViewer().getEditPartRegistry().put(Lay.class, controller); - super.refreshVisuals(); - } - - protected AbstractGraphicalEditPart getConnectionTargetEditPart() - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - return referenceTypePart; - } - return null; - } - - public void refreshConnections() - { - if (shouldDrawConnection()) - { - if (connectionFigure != null) - { - AbstractGraphicalEditPart referenceTypePart = getConnectionTargetEditPart(); - 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); - - if (connectionFeedbackFigure != null) - addConnectionFeedbackFigure(); - } - else - { - activateConnection(); - } - } - else if (connectionFigure != null) - { - connectionFigure.setVisible(false); - removeConnectionFeedbackFigure(); - } - } - - 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) - if (connectionFigure != null) - { - return getConnectionTargetEditPart(); - } - else - { - return null; - } - } - 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 0b4bf3ab6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java +++ /dev/null @@ -1,67 +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 - super.createEditPolicies(); - } - - 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 e7227c30d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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(""); //$NON-NLS-1$ - 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 - super.createEditPolicies(); - } - - 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(""); //$NON-NLS-1$ - 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 20ebddfe8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EditPartNavigationHandlerUtil.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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 = focusEditPart; - while ((t instanceof ColumnEditPart || t instanceof DefinitionsEditPart) && t.getChildren().size() > 0) - { - t = (EditPart) t.getChildren().get(0); - } - } - 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 getNextService(EditPart editPart) - { - EditPart result = null; - for (EditPart e = editPart; e != null; e = e.getParent()) - { - if (e instanceof ServiceEditPart) - { - ServiceEditPart ie = (ServiceEditPart)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 1100d65a9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureCanvas; -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.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.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.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class EndPointEditPart extends BaseConnectedEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Label nameLabel; - protected Label addressLabel; - private Label hoverHelpLabel = new Label(""); //$NON-NLS-1$ - protected Figure addressBoxFigure; - protected final static int MAX_ADDRESS_WIDTH = 150; - - protected IFigure createFigure() - { - figure = new Panel() { - public void paint(Graphics graphics) { - super.paint(graphics); - Rectangle r = getBounds(); - // bug146932 - paintFocusCursor(new Rectangle(r.x, r.y + 1, r.width, r.height - 1), graphics); - } - }; - figure.setBorder(new MarginBorder(4)); - ToolbarLayout layout = new ToolbarLayout(false); - // layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); - layout.setStretchMinorAxis(true); - figure.setLayoutManager(layout); - nameLabel = new Label(); - - if (getModel() instanceof ITreeElement) { - nameLabel.setIcon(((ITreeElement) 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(DesignViewGraphicsConstants.defaultForegroundColor); - 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.defaultForegroundColor); - addressLabel.setForegroundColor(DesignViewGraphicsConstants.defaultForegroundColor); - } - - 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() && !isFileReadOnly() && (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() + " "); //$NON-NLS-1$ //$NON-NLS-2$ - addressLabel.setToolTip(hoverHelpLabel); - } - else { - addressLabel.setToolTip(null); - } - - refreshConnections(); - super.refreshVisuals(); - } - - protected AbstractGraphicalEditPart getConnectionTargetEditPart() - { - Object typeBeingRef = getReferencedModel(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - return referenceTypePart; - } - return null; - } - - public void refreshConnections() { - if (shouldDrawConnection()) { - if (connectionFigure != null) { - AbstractGraphicalEditPart referenceTypePart = getConnectionTargetEditPart(); - 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); - - if (connectionFeedbackFigure != null) - addConnectionFeedbackFigure(); - } - else { - activateConnection(); - } - } - else if (connectionFigure != null){ - connectionFigure.setVisible(false); - removeConnectionFeedbackFigure(); - } - } - - private IFigure getFigureForFeedback() - { - return figure; - } - - public void addFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - - super.addFeedback(); - } - - public void removeFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(figure.getParent().getBackgroundColor()); - - super.removeFeedback(); - } - - // 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) - if (connectionFigure != null) - { - return getConnectionTargetEditPart(); - } - else - { - return null; - } - } - - if (direction == PositionConstants.SOUTH) - { - return EditPartNavigationHandlerUtil.getNextService(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/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/InterfaceEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/InterfaceEditPart.java deleted file mode 100644 index 4d595eab2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/InterfaceEditPart.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.IFigure; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.EditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -//import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BaseLinkIconFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class InterfaceEditPart extends AbstractBoxtEditPart implements IFeedbackHandler -{ - private RectangleFigure linkIconColumn; - protected BoxComponentFigure boxFigure; - public InterfaceEditPart() - { - columnData.setColumnWeight("MessageLabel", 0); //$NON-NLS-1$ - columnData.setColumnWeight("MessageContentPane", 100); //$NON-NLS-1$ - columnData.setColumnWeight("parameterName", 50); //$NON-NLS-1$ - columnData.setColumnWeight("parameterType", 50); //$NON-NLS-1$ - } - - protected IFigure createFigure() - { - IFigure outer = new Figure() { - public void validate() { - super.validate(); - // If we don't layout our Link Icon Column at this point, the link icons - // will not be properly updated in the scenario where a porttype is added - // or removed. The link icons of the existing porttypes will not be updated. - getLinkIconColumn().getLayoutManager().layout(getLinkIconColumn()); - } - }; - - outer.setLayoutManager(new ToolbarLayout(true)); - boxFigure = (BoxComponentFigure) super.createFigure(); - - if (getModel() instanceof ITreeElement) { - boxFigure.getLabel().setIcon(((ITreeElement) getModel()).getImage()); - } - - boxFigure.setBackgroundColor(ColorConstants.orange); - boxFigure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - boxFigure.setLayoutManager(toolbarLayout); - outer.add(boxFigure); - linkIconColumn = new RectangleFigure(); - linkIconColumn.setOutline(false); - linkIconColumn.setLayoutManager(new ToolbarLayout() { - public void layout(IFigure parent) { - super.layout(parent); - - // We need to layout on the y-axis - Iterator children = parent.getChildren().iterator(); - while (children.hasNext()) { - Object item = children.next(); - if (item instanceof IFigure) { - IFigure figure = (IFigure) item; - figure.getLayoutManager().layout(figure); - } - } - } - - protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) { - Dimension dimension = super.calculatePreferredSize(container, wHint, hHint); - - // Calculate the height - Iterator it = container.getParent().getChildren().iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item instanceof BoxComponentFigure) { - dimension.height = ((IFigure) item).getPreferredSize().height; - break; - } - } - - return dimension; - } - }); - - outer.add(linkIconColumn); - - // 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()) - { - figure.getLabel().setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else - { - figure.getLabel().setForegroundColor(ColorConstants.black); - } - - return outer; - } - - public static void attachToInterfaceEditPart(EditPart editPart, RowLayout rowLayout) - { - for (EditPart parent = editPart.getParent(); parent != null; parent = parent.getParent()) - { - if (parent instanceof InterfaceEditPart) - { - InterfaceEditPart interfaceEditPart = (InterfaceEditPart)parent; - rowLayout.setColumnData(interfaceEditPart.columnData); - break; - } - } - } - - protected void refreshChildren() - { - super.refreshChildren(); - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - } - - protected List getModelChildren() - { - IInterface theInterface = (IInterface)getModel(); - return theInterface.getOperations(); - } - - public void addFeedback() { - super.addFeedback(); - } - - public void removeFeedback() { - super.removeFeedback(); - } - - public EditPart getRelativeEditPart(int direction) - { - if (direction == PositionConstants.WEST) - { - return EditPartNavigationHandlerUtil.getSourceConnectionEditPart(this); - } - return super.getRelativeEditPart(direction); - } - - public IFigure getLinkIconColumn() { - return linkIconColumn; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/MessageReferenceEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/MessageReferenceEditPart.java deleted file mode 100644 index 5105e506b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/MessageReferenceEditPart.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.PositionConstants; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -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.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ListFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ModelDiagnosticInfo; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class MessageReferenceEditPart extends BaseEditPart implements IFeedbackHandler -{ - protected Figure contentPane; - protected Label label; - protected RowLayout rowLayout; - - private Figure messageLabelWrapper; - private Label messageLabel; - - protected ASDSelectionEditPolicy selectionHandlesEditPolicy = new ASDSelectionEditPolicy(); - - protected IFigure createFigure() - { - ListFigure figure = new ListFigure(true); - figure.setOpaque(true); - figure.setPaintFirstLine(false); - figure.setBackgroundColor(ColorConstants.tooltipBackground); - - rowLayout = new RowLayout(); - figure.setLayoutManager(rowLayout); - label = new Label() - { - public void paint(Graphics graphics) - { - super.paint(graphics); - // bug146932 - paintFocusCursor(getBounds(), graphics); - } - }; - label.setLabelAlignment(Label.LEFT); - //label.setFont(DesignViewGraphicsConstants.mediumFont); - label.setBorder(new MarginBorder(2, 16, 2 ,10)); - figure.add(label); - - contentPane = new ListFigure(); - ((ListFigure)contentPane).setOpaque(true); - contentPane.setBackgroundColor(ColorConstants.listBackground); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - - /* - ToolbarLayout toolbarLayout = new ToolbarLayout(false) - { - // TODO (cs) consider minor tweak here to ensure that the row fills up the available space - // vertically... without this a bit of trim is visible at the bottom of the list - // when the param labels are given a margin width top and bottom < '4' - public void layout(IFigure parent) - { - super.layout(parent); - if (children.size() == 1) - { - Figure child = (Figure)children.get(0); - //child.getBounds().height = parent.getClientArea().height; - } - } - }; - */ - toolbarLayout.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout); - figure.add(contentPane); - - rowLayout.setConstraint(label, "MessageLabel"); //$NON-NLS-1$ - rowLayout.setConstraint(contentPane, "MessageContentPane"); //$NON-NLS-1$ - - // 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); - label.getParent().setBackgroundColor(DesignViewGraphicsConstants.readOnlyMessageRefHeadingColor); - } - else - { - label.setForegroundColor(DesignViewGraphicsConstants.defaultForegroundColor); - label.getParent().setBackgroundColor(ColorConstants.tooltipBackground); - } - - return figure; - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - if (!isReadOnly() && !isFileReadOnly()) { - 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 IFigure getContentPane() - { - return contentPane; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IMessageReference message = (IMessageReference)getModel(); - - if (message instanceof ITreeElement) { - label.setText(((ITreeElement) message).getText()); - label.setIcon(((ITreeElement) message).getImage()); - } - - // 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 void refreshChildren() { - super.refreshChildren(); - refreshMessage(); - } - - protected void refreshMessage() { - if (getModelChildren().size() > 0) { - if (messageLabelWrapper != null) { - contentPane.remove(messageLabelWrapper); - messageLabelWrapper = null; - } - } - else { - if (messageLabelWrapper == null) { - messageLabelWrapper = new Figure(); - messageLabel = new Label(); - - ToolbarLayout toolbarLayout = new ToolbarLayout(false) - { - // We want to center the text - public void layout(IFigure parent) - { - super.layout(parent); - - if (parent.getChildren().size() == 1 && parent.getChildren().get(0) instanceof Label) - { - parent.setSize(parent.getSize().width, parent.getSize().height + 3); - Label child = (Label) parent.getChildren().get(0); - int newXAmount = (parent.getSize().width - child.getSize().width) / 2; - Point p = child.getLocation(); - child.setLocation(new Point(p.x + newXAmount, p.y + 3)); - } - } - }; - - messageLabelWrapper.setLayoutManager(toolbarLayout); - messageLabelWrapper.add(messageLabel); - contentPane.add(messageLabelWrapper); - } - - List errorList = getErrors(); - List warnList = getWarnings(); - - if (errorList.size() > 0) { - ModelDiagnosticInfo info = (ModelDiagnosticInfo) errorList.get(0); - messageLabel.setText(" " + info.getDescriptionText() + " "); //$NON-NLS-1$ //$NON-NLS-2$ - messageLabel.setForegroundColor(info.getDescriptionTextColor()); - } - else if (warnList.size() > 0){ - ModelDiagnosticInfo info = (ModelDiagnosticInfo) warnList.get(0); - messageLabel.setText(" " + info.getDescriptionText() + " "); //$NON-NLS-1$ //$NON-NLS-2$ - messageLabel.setForegroundColor(info.getDescriptionTextColor()); - } - else { - messageLabel.setText(""); //$NON-NLS-1$ - messageLabel.setForegroundColor(ColorConstants.black); - } - } - } - - protected List getErrors() { - IMessageReference messageRef = (IMessageReference) getModel(); - return getDiagnosticMessageType(messageRef.getDiagnosticMessages(), ModelDiagnosticInfo.ERROR_TYPE); - } - - protected List getWarnings() { - IMessageReference messageRef = (IMessageReference) getModel(); - return getDiagnosticMessageType(messageRef.getDiagnosticMessages(), ModelDiagnosticInfo.WARNING_TYPE); - } - - protected List getDiagnosticMessageType(List diagnosticInfo, int type) { - List listType = new ArrayList(); - for (int index = 0; index < diagnosticInfo.size(); index++) { - ModelDiagnosticInfo info = (ModelDiagnosticInfo) diagnosticInfo.get(index); - if (info.getType() == type) { - listType.add(info); - } - } - - return listType; - } - - protected List getModelChildren() - { - IMessageReference theMessage = (IMessageReference)getModel(); - return theMessage.getParameters(); - } - - public void addNotify() - { - InterfaceEditPart.attachToInterfaceEditPart(this, rowLayout); - super.addNotify(); - } - - public void addFeedback() { - label.getParent().setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - if (isReadOnly()) { - label.getParent().setBackgroundColor(DesignViewGraphicsConstants.readOnlyMessageRefHeadingColor); - } - else { - label.getParent().setBackgroundColor(ColorConstants.tooltipBackground); - } - } - - public EditPart getRelativeEditPart(int direction) - { - EditPart editPart = super.getRelativeEditPart(direction); - if (direction == PositionConstants.SOUTH && editPart == null) - { - editPart = EditPartNavigationHandlerUtil.getNextInterface(this); - } - return editPart; - } -} 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 20c4a3612..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -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.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; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - - -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() { - public void paint(Graphics graphics) { - super.paint(graphics); - Rectangle r = getBounds(); - // bug146932 - paintFocusCursor(new Rectangle(r.x, r.y, r.width, r.height), graphics); - } - }; - 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 (!isFileReadOnly() && (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()); - - if (operation instanceof ITreeElement) { - label.setIcon(((ITreeElement) 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); - } - } -} 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 1f3bdfeae..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -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(); - - // bug146932 - paintFocusCursor(new Rectangle(r.x + 1, r.y, r.width - 2, r.height), graphics); - } - }; - //toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER); - figure.setForegroundColor(DesignViewGraphicsConstants.defaultForegroundColor); - 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$ - - if (getModel() instanceof ITreeElement) { - labelImage = ((ITreeElement) 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(DesignViewGraphicsConstants.defaultForegroundColor); - } - - return figure; - } - - public void addNotify() - { - InterfaceEditPart.attachToInterfaceEditPart(this, rowLayout); - super.addNotify(); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (!isFileReadOnly() && !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() && !isFileReadOnly()) { - 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; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterTypeEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterTypeEditPart.java deleted file mode 100644 index 1bd232170..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterTypeEditPart.java +++ /dev/null @@ -1,418 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.MarginBorder; -import org.eclipse.draw2d.MouseEvent; -import org.eclipse.draw2d.MouseListener; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.MouseMotionListener.Stub; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -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.commands.Command; -import org.eclipse.gef.editpolicies.DirectEditPolicy; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.ASDCCombo; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.TypeReferenceDirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BaseLinkIconFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ModelDiagnosticInfo; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.asd.util.IOpenExternalEditorHelper; - -public class ParameterTypeEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected SimpleDirectEditPolicy simpleDirectEditPolicy = new SimpleDirectEditPolicy(); - protected Label parameterType; - protected RowLayout rowLayout = new RowLayout(); - - public void performRequest(Request req) { - if (req.getType().equals(RequestConstants.REQ_DIRECT_EDIT)) { - performDirectEdit(null); - } - } - - protected MyMouseEventListener mouseEventListener; - private BaseLinkIconFigure linkIconFigure; - - protected IFigure createFigure() - { - IFigure figure = new Panel() { - public void paint(Graphics graphics) { - super.paint(graphics); - Rectangle r = getBounds(); - // bug146932 - paintFocusCursor(new Rectangle(r.x, r.y, r.width, r.height), graphics); - } - }; - figure.setLayoutManager(rowLayout); - - parameterType = new Label(); - parameterType.setLabelAlignment(Label.LEFT); - parameterType.setBorder(new MarginBorder(4,12,4,20)); - figure.add(parameterType); - - // 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()) - { - parameterType.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else - { - parameterType.setForegroundColor(DesignViewGraphicsConstants.defaultForegroundColor); - } - - return figure; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IParameter param = (IParameter) getModel(); - String name = param.getComponentName(); - parameterType.setText(name); - - Image image = ((ITreeElement)getModel()).getSecondaryImage(); - if (image != null) - { - parameterType.setIcon(image); - } - - parameterType.setForegroundColor(DesignViewGraphicsConstants.defaultForegroundColor); - - List diagnosticMessages = param.getDiagnosticMessages(); - Iterator it = diagnosticMessages.iterator(); - ModelDiagnosticInfo errorInfo = null; - while (it.hasNext() && errorInfo == null) { - ModelDiagnosticInfo temp = (ModelDiagnosticInfo) it.next(); - if (temp.getType() == ModelDiagnosticInfo.ERROR_TYPE) { - errorInfo = temp; - break; - } - } - - if (errorInfo != null) { - parameterType.setText(errorInfo.getDescriptionText()); - parameterType.setForegroundColor(errorInfo.getDescriptionTextColor()); - parameterType.setIcon(null); - } - - // Force the LinkIconColumn to resize and relayout itself. - if (getInterfaceEditPart() != null) { - ((Figure) getInterfaceEditPart().getLinkIconColumn()).invalidate(); - refreshLinkFigure(new Point(-1, -1)); - } - } - - private InterfaceEditPart getInterfaceEditPart() { - EditPart ep = getParent(); - while (ep != null && !(ep instanceof InterfaceEditPart)) { - ep = ep.getParent(); - } - - if (ep instanceof InterfaceEditPart) { - return (InterfaceEditPart) ep; - } - - return null; - } - - public void addFeedback() { - figure.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - figure.setBackgroundColor(figure.getParent().getBackgroundColor()); - } - - public Label getLabelFigure() { - return parameterType; - } - - protected void createEditPolicies() - { - super.createEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, simpleDirectEditPolicy); - } - - public void performDirectEdit(Point cursorLocation) { - if (!isFileReadOnly() && (cursorLocation == null || (hitTest(parameterType, cursorLocation) && !isReadOnly()))) { - IParameter param = (IParameter) getModel(); - - TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager(param, this, parameterType); - simpleDirectEditPolicy.setDelegate(manager); - manager.show(); - - - } - else if (parameterType.getParent() instanceof Figure && - hitTestFigure((Figure) parameterType.getParent(), cursorLocation) && isReadOnly()) { - doOpenNewEditor(); - } - } - - public void activate() { - super.activate(); - - IFigure primaryLayer = getLayer(LayerConstants.PRIMARY_LAYER); - mouseEventListener = new MyMouseEventListener(); - primaryLayer.addMouseMotionListener(mouseEventListener); - primaryLayer.addMouseListener(mouseEventListener); - } - - public void deactivate() { - if (mouseEventListener != null) { - IFigure primaryLayer = getLayer(LayerConstants.PRIMARY_LAYER); - primaryLayer.removeMouseMotionListener(mouseEventListener); - primaryLayer.removeMouseListener(mouseEventListener); - } - - InterfaceEditPart ep = getInterfaceEditPart(); - if (ep != null && linkIconFigure != null) { - IFigure fig = ep.getLinkIconColumn(); - if (fig.getChildren().contains(linkIconFigure)) { - ep.getLinkIconColumn().remove(linkIconFigure); - } - } - } - - - private class SimpleDirectEditPolicy extends DirectEditPolicy - { - protected TypeReferenceDirectEditManager delegate; - - public void setDelegate(TypeReferenceDirectEditManager delegate) - { - this.delegate = delegate; - } - - protected org.eclipse.gef.commands.Command getDirectEditCommand(final DirectEditRequest request) - { - return new Command() //AbstractCommand() - { - public void execute() - { - if (delegate != null) - { - delegate.performEdit(request.getCellEditor()); - } - } - - public void redo() - { - } - - public void undo() - { - } - - public boolean canExecute() - { - // dont execute if name is not changing - IParameter parameter = (IParameter)getModel(); - Object newValue = ((ASDCCombo)request.getCellEditor().getControl()).getText(); - if (newValue instanceof String) - { - return !newValue.equals(parameter.getComponentName()); - } - return true; - } - }; - } - - protected void showCurrentEditValue(DirectEditRequest request) - { - //hack to prevent async layout from placing the cell editor twice. - getHostFigure().getUpdateManager().performUpdate(); - } - } - - public EditPart getRelativeEditPart(int direction) - { - EditPart editPart = super.getRelativeEditPart(direction); - if (direction == PositionConstants.SOUTH && editPart == null) - { - editPart = EditPartNavigationHandlerUtil.getNextInterface(this); - } - return editPart; - } - - private class MyMouseEventListener extends Stub implements MouseListener { - public void mouseReleased(MouseEvent me) { } - public void mouseDoubleClicked(MouseEvent me) { } - - public void mouseMoved(MouseEvent me) { - Point pointer = me.getLocation(); - refreshLinkFigure(pointer); - } - - public void mousePressed(MouseEvent me) { - Point pointer = me.getLocation(); - openExternalEditor(pointer); - } - - public void mouseHover(MouseEvent me) { - Point pointer = me.getLocation(); - showPreviewDialog(pointer); - } - } - - private void showPreviewDialog(Point point) { - Rectangle linkFigBounds = getLinkFigureBounds(); - if (linkFigBounds == null) { - return; - } - - Rectangle testbounds = new Rectangle(linkFigBounds.x, linkFigBounds.y, 0, linkFigBounds.height); - - if (pointerInRange(testbounds, point)) { - IOpenExternalEditorHelper helper = getExternalEditorOpener(); - helper.showPreview(); - } - } - - // Methods below handle the Link Figure..... - private void emphasizeLinkFigure() { - linkIconFigure.setColor(ColorConstants.blue); - } - - private void unemphasizeLinkFigure() { - linkIconFigure.setColor(ColorConstants.lightGray); - } - - private boolean pointerInRange(Rectangle figBounds, Point pointer) { - Rectangle linkBounds = getLinkFigureBounds(); - - int entireX = figBounds.x; - int entireY = figBounds.y; - int entireWidth = figBounds.width + linkBounds.width; - int entireHeight = figBounds.height; - Rectangle entireBounds = new Rectangle(entireX, entireY, entireWidth, entireHeight); - - return entireBounds.contains(pointer); - } - - private boolean containsLinkFigure() { - Iterator it = getInterfaceEditPart().getLinkIconColumn().getChildren().iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item.equals(linkIconFigure)) { - return true; - } - } - - return false; - } - - private Rectangle getLinkFigureBounds() { - if (containsLinkFigure()) { - return linkIconFigure.getBounds(); - } - else { - return null; - } - } - - private IOpenExternalEditorHelper getExternalEditorOpener() { - IOpenExternalEditorHelper openExternalEditorHelper = null; - if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor() != null) { - Object adapted = page.getActiveEditor().getAdapter(IOpenExternalEditorHelper.class); - if (adapted instanceof IOpenExternalEditorHelper) { - openExternalEditorHelper = (IOpenExternalEditorHelper) adapted; - openExternalEditorHelper.setModel(getModel()); - } - } - } - - return openExternalEditorHelper; - } - - private void refreshLinkFigure(Point point) { - Rectangle figBounds = getFigure().getParent().getParent().getBounds(); - - IOpenExternalEditorHelper openHelper = getExternalEditorOpener(); - if (openHelper != null && openHelper.linkApplicable()) { - if (!figureContainsLinkFigure(getInterfaceEditPart().getLinkIconColumn())) { - linkIconFigure = new BaseLinkIconFigure(this); - getInterfaceEditPart().getLinkIconColumn().add(linkIconFigure); - } - - if (openHelper.isValid()) { - linkIconFigure.setLinkIconStyle(BaseLinkIconFigure.VALID_SCHEMA_LINK_STYLE); - - if (pointerInRange(figBounds, point)) { - emphasizeLinkFigure(); - } - else { - unemphasizeLinkFigure(); - } - } - else { - linkIconFigure.setLinkIconStyle(BaseLinkIconFigure.INVALID_SCHEMA_LINK_STYLE); - } - } - else { - if (containsLinkFigure()) { - getInterfaceEditPart().getLinkIconColumn().remove(linkIconFigure); - } - } - } - - private boolean figureContainsLinkFigure(IFigure parent) { - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) { - if (it.next().equals(linkIconFigure)) { - return true; - } - } - - return false; - } - - private void openExternalEditor(Point point) { - Rectangle linkFigBounds = getLinkFigureBounds(); - if (linkFigBounds == null || getExternalEditorOpener() == null) { - return; - } - - Rectangle testbounds = new Rectangle(linkFigBounds.x, linkFigBounds.y, 0, linkFigBounds.height); - - if (getExternalEditorOpener().linkApplicable() && pointerInRange(testbounds, point)) { - // Open in XSD Editor - getExternalEditorOpener().openExternalEditor(); - } - } -} 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 3bcf5ebf4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -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(DesignViewGraphicsConstants.defaultForegroundColor); - 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(); - - if (getModel() instanceof ITreeElement) { - headingFigure.getLabel().setIcon(((ITreeElement) 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 (!isFileReadOnly() && (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(); - } -} 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 baa3e8c5a..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,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.commands.Command; -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 Image getSecondaryImage() { - 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); - } - - public Command getDeleteCommand() { - return null; - } - - public List getDiagnosticMessages() { - return new ArrayList(); - } -} 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 1e6597b75..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,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; - -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.IService; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.asd.util.EndPointComparator; - -public class ServiceColumn extends AbstractModelCollection { - public ServiceColumn(IDescription description) { - super(description, "ServiceColumn"); //$NON-NLS-1$ - } - - public ITreeElement[] getChildren() { - List services = ((IDescription)model).getServices(); - Collections.sort(services, new ServiceComparator()); - Object array[] = services.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 ServiceComparator implements Comparator { - public int compare(Object o1, Object o2) { - if (o1 instanceof IService && o2 instanceof IService) { - IEndPoint endPoint1 = getFirstAssociatedEndPoint((IService) o1); - IEndPoint endPoint2 = getFirstAssociatedEndPoint((IService) o2); - - EndPointComparator comparator = new EndPointComparator(); - return comparator.compare(endPoint1, endPoint2); - } - - return 0; - } - - private IEndPoint getFirstAssociatedEndPoint(IService service) { - Iterator endPoints= service.getEndPoints().iterator(); - - while (endPoints.hasNext()) { - IEndPoint tempEndPoint = (IEndPoint) endPoints.next(); - if (tempEndPoint.getBinding() != null) { - return tempEndPoint; - } - } - - return null; - } - } -} 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/BaseLinkIconFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BaseLinkIconFigure.java deleted file mode 100644 index e953e1539..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BaseLinkIconFigure.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.figures; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -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.Point; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.swt.graphics.Color; - -public class BaseLinkIconFigure extends Figure { - public static int VALID_SCHEMA_LINK_STYLE = 1; - public static int INVALID_SCHEMA_LINK_STYLE = 2; - - private int linkIconStyle = VALID_SCHEMA_LINK_STYLE; - private AbstractGraphicalEditPart editPart; - private List childFigures = new ArrayList(); - public int figureSpacing = 7; - - public BaseLinkIconFigure(AbstractGraphicalEditPart ep) { - editPart = ep; - - ToolbarLayout layout = new ToolbarLayout(true) { - public void layout(IFigure parent) { - super.layout(parent); - - AbstractGraphicalEditPart ep = getAssociatedEditPart(); - IFigure associatedFigure = ep.getFigure(); - if (associatedFigure != null) { - // Update the bounds - Rectangle associatedBounds = associatedFigure.getBounds(); - int x = associatedBounds.x + associatedBounds.width; - int y = associatedBounds.y; - int width = getSize().width; - int height = associatedBounds.height; - - Rectangle newFigBounds = new Rectangle(x, y, width, height); - // Set my bounds based on my associated editpart - setBounds(newFigBounds); - - // Layout the children - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) { - IFigure fig = (IFigure) it.next(); - Point newPoint = new Point(x, y); - - // Indent the figure to the right to show the "broken" schema link figure - if (fig instanceof RightInvalidIconFigure) { - newPoint.x = newPoint.x + figureSpacing; - } - - fig.setLocation(newPoint); - } - } - } - }; - setLayoutManager(layout); - - // Default to a ValidLinkIconFigure - linkIconStyle = VALID_SCHEMA_LINK_STYLE; - addChildFigure(new ValidLinkIconFigure()); - } - - private void removeChildFigures() { - Iterator it = childFigures.iterator(); - while (it.hasNext()) { - remove((IFigure) it.next()); - } - - childFigures.clear(); - } - - private void addChildFigure(IFigure fig) { - childFigures.add(fig); - add(fig); - } - - public void setLinkIconStyle(int style) { - if (style == VALID_SCHEMA_LINK_STYLE && linkIconStyle != VALID_SCHEMA_LINK_STYLE) { - removeChildFigures(); - addChildFigure(new ValidLinkIconFigure()); - } - else if (style == INVALID_SCHEMA_LINK_STYLE && linkIconStyle != INVALID_SCHEMA_LINK_STYLE) { - removeChildFigures(); - addChildFigure(new LeftInvalidIconFigure()); - addChildFigure(new RightInvalidIconFigure()); - } - - linkIconStyle = style; - } - - public int getLinkIconStyle() { - return linkIconStyle; - } - - public void setColor(Color color) { - Iterator it = childFigures.iterator(); - while (it.hasNext()) { - IFigure fig = (IFigure) it.next(); - fig.setBackgroundColor(color); - fig.setForegroundColor(color); - } - } - - public AbstractGraphicalEditPart getAssociatedEditPart() { - return editPart; - } - - private class LeftInvalidIconFigure extends LinkIconFigure { - public LeftInvalidIconFigure() { - super(null); - PointList points = new PointList(); - - // Draw the arrow - points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 5, 4 + verticalBuffer)); - - points.addPoint(new Point(horizontalBuffer + 7, 0 + verticalBuffer)); // top slash - points.addPoint(new Point(horizontalBuffer + 5, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 2, 10 + verticalBuffer)); // bottom slash - - points.addPoint(new Point(horizontalBuffer + 4, 6 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 0, 6 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer)); - - setForegroundColor(ColorConstants.lightGray); - setBackgroundColor(ColorConstants.lightGray); - setFill(true); - setPoints(points); - } - - // We increase the size of the width because we indent the figure towards the right. - // So we indent by that same amount stored in horizontalBuffer - public Dimension getPreferredSize(int wHint, int hHint) { - Dimension dimension = super.getPreferredSize(wHint, hHint); - dimension.width = dimension.width + horizontalBuffer; - - return dimension; - } - - public void setLocation(Point point) { - super.setLocation(point); - // Update the points with the following method call - setFigureLocation(point); - } - } - - private class RightInvalidIconFigure extends LinkIconFigure { - public RightInvalidIconFigure() { - super(null); - PointList points = new PointList(); - - points.addPoint(new Point(horizontalBuffer + 5, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 7, 0 + verticalBuffer)); // top slash - points.addPoint(new Point(horizontalBuffer + 5, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 10, 4 + verticalBuffer)); - - points.addPoint(new Point(horizontalBuffer + 10, 0 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 15, 5 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 10, 10 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 10, 6 + verticalBuffer)); - - points.addPoint(new Point(horizontalBuffer + 4, 6 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 2, 10 + verticalBuffer)); // bottom slash - points.addPoint(new Point(horizontalBuffer + 5, 4 + verticalBuffer)); - - setForegroundColor(ColorConstants.lightGray); - setBackgroundColor(ColorConstants.lightGray); - setFill(true); - setPoints(points); - } - - public void setLocation(Point point) { - super.setLocation(point); - setFigureLocation(point); - } - } - - private class ValidLinkIconFigure extends LeftInvalidIconFigure { - public ValidLinkIconFigure() { - PointList points = new PointList(); - - // Draw the arrow - points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 15, 4 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 15, 0 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 20, 5 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 15, 10 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 15, 6 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 0, 6 + verticalBuffer)); - points.addPoint(new Point(horizontalBuffer + 0, 4 + verticalBuffer)); - - setForegroundColor(ColorConstants.lightGray); - setBackgroundColor(ColorConstants.lightGray); - setFill(true); - setPoints(points); - } - } -} 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 069b87668..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; - -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 ? DesignViewGraphicsConstants.defaultForegroundColor : 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/figures/ModelDiagnosticInfo.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ModelDiagnosticInfo.java deleted file mode 100644 index 7fdd8acf6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ModelDiagnosticInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.figures; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.swt.graphics.Color; - -/* - * A ModelDiagnosticInfo object contains "additional" information about a model object. - * It is passed from a model (facade) object to an EditPart. The EditPart uses the ModelDiagnosticInfo - * object to display any additional information necessary (for example, an error message when the model - * object is in some way invalid. - */ -public class ModelDiagnosticInfo { - public static int INFORMATIONAL_TYPE = 0; - public static int ERROR_TYPE = 1; - public static int WARNING_TYPE = 2; - - private int type = 1; - private String text = ""; //$NON-NLS-1$ - private Color textColor; - - public ModelDiagnosticInfo(String txt, int infoType, Color color) { - text = txt; - type = infoType; - textColor = color; - } - - public void setDescriptionText(String txt) { - text = txt; - } - - public void setDescriptionTextColor(Color color) { - textColor = color; - } - - public void setType(int infoType) { - type = infoType; - } - - public String getDescriptionText() { - return text; - } - - public int getType() { - return type; - } - - public Color getDescriptionTextColor() { - if (textColor != null) { - return textColor; - } - - if (type == ERROR_TYPE) { - return ColorConstants.red; - } - else if (type == WARNING_TYPE) { - return ColorConstants.lightGray; - } - - return ColorConstants.black; - } -} 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"); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObject.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObject.java deleted file mode 100644 index b5a3f8539..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - - -public interface IASDObject -{ - public void registerListener(IASDObjectListener listener); - public void unregisterListener(IASDObjectListener listener); - - public boolean isReadOnly(); - public List getDiagnosticMessages(); - public Command getDeleteCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObjectListener.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObjectListener.java deleted file mode 100644 index 9428c38b9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObjectListener.java +++ /dev/null @@ -1,15 +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.facade; - -public interface IASDObjectListener { - public void propertyChanged(Object object, String property); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBinding.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBinding.java deleted file mode 100644 index bffcbc106..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBinding.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - -public interface IBinding extends INamedObject -{ - public IInterface getInterface(); - public List getBindingOperations(); - public List getBindingContentList(); - public List getExtensiblityObjects(); - public String getProtocol(); - public IDescription getOwnerDescription(); - - public Command getSetInterfaceCommand(IInterface newInterface); - public Command getGenerateBindingCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingMessageReference.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingMessageReference.java deleted file mode 100644 index 60bc967a3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingMessageReference.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.facade; - -import java.util.List; - -public interface IBindingMessageReference extends INamedObject -{ - public IMessageReference getMessageReference(); - public List getExtensiblityObjects(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingOperation.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingOperation.java deleted file mode 100644 index 4d8b99d74..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBindingOperation.java +++ /dev/null @@ -1,20 +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.facade; - -import java.util.List; - -public interface IBindingOperation extends INamedObject -{ - public IOperation getOperation(); - public List getBindingMessages(); - public List getExtensiblityObjects(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IDescription.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IDescription.java deleted file mode 100644 index fdf7c54e1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IDescription.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.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - - -public interface IDescription extends INamedObject -{ - public String getTargetNamespace(); - public String getTargetNamespacePrefix(); -// public List getNamespacesInfo(); // TODO: Add this method in the future - - public List getImports(); - public List getTypes(); - public List getServices(); - public List getBindings(); - public List getInterfaces(); - public List getMessages(); - - public Command getAddImportCommand(); - public Command getAddSchemaCommand(); - public Command getAddServiceCommand(); - public Command getAddBindingCommand(); - public Command getAddInterfaceCommand(); - public Command getAddMessageCommand(); -// public Command getEditNamespacesCommand(); // TODO: Add this method in the future -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IEndPoint.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IEndPoint.java deleted file mode 100644 index 7b8fb0ebf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IEndPoint.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import org.eclipse.gef.commands.Command; - -public interface IEndPoint extends INamedObject -{ - public IService getOwnerService(); - public String getAddress(); - public IBinding getBinding(); - public String getProtocol(); - - public Command getSetBindingCommand(IBinding binding); - public Command getSetAddressCommand(String newAddress); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IImport.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IImport.java deleted file mode 100644 index ebfd35333..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IImport.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -public interface IImport extends INamedObject { - public String getNamespace(); - public String getNamespacePrefix(); - public String getLocation(); - - public IDescription getOwnerDescription(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IInterface.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IInterface.java deleted file mode 100644 index 6ff4defa3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; - -public interface IInterface extends INamedObject { - public List getOperations(); - /* - * @deprecated. The method getImage() will be removed in the near future - */ - public Image getImage(); - public Command getAddOperationCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessage.java deleted file mode 100644 index ad86c5ea6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessage.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - -public interface IMessage extends INamedObject { - public List getParts(); - - public IDescription getOwnerDescription(); - - public Command getAddPartCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessageReference.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessageReference.java deleted file mode 100644 index 3340e9d25..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessageReference.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - -// this is a simplification of an input, output or fault object -// (or any other kind of object future specs might cook up) -public interface IMessageReference extends INamedObject -{ - public final static int KIND_INPUT = 1; - public final static int KIND_OUTPUT = 2; - public final static int KIND_FAULT = 3; - - public int getKind(); - public List getParameters(); - public IOperation getOwnerOperation(); - - public Command getReorderParametersCommand(IParameter leftSibling, IParameter rightSibling, IParameter movingParameter); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/INamedObject.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/INamedObject.java deleted file mode 100644 index f8d373aa0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/INamedObject.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import org.eclipse.gef.commands.Command; - -public interface INamedObject extends IASDObject -{ - public String getName(); - - public Command getSetNameCommand(String newName); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IOperation.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IOperation.java deleted file mode 100644 index bf328ca13..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IOperation.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; - -import org.eclipse.gef.commands.Command; - -public interface IOperation extends INamedObject -{ - public List getMessages(); - public IInterface getOwnerInterface(); - - public Command getAddInputCommand(); - public Command getAddOutputCommand(); - // TODO: rmah: We need to revisit this (Sending in an existing FaultImpl when we want to - // add a Fault Parameter. What do we really want to do when we add a - // 'new Fault'.... This also relates to what we really want to do when we delete a Fault... - public Command getAddFaultCommand(Object fault); - public Command getReorderMessageReferencesCommand(IMessageReference leftSibling, IMessageReference rightSibling, IMessageReference movingMessageRef); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IParameter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IParameter.java deleted file mode 100644 index 80ce8a645..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IParameter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import org.eclipse.gef.commands.Command; - - -// this class is used to describe in simplified descritpion of the input/output/fault structure -// in the familiar style of a typical programming language parameter e.g. "String[] foo" -// -// often this class represents a simplification of a more complex service description or schema -// this class serves common denominator to drive a simple view of an operation's message structure -// implementation specific editors can choose to provide 'advanced' views that delve into addition details -// of a Message structure -public interface IParameter extends INamedObject -{ - public Object getOwner(); -// String getKind(); - public String getComponentName(); - public String getComponentNameQualifier(); - - // TODO: rmah: Do these strings belong here??? - public static final String SET_NEW_ACTION_ID = "SetTypeAction_AddType"; //$NON-NLS-1$ - public static final String SELECT_EXISTING_ACTION_ID = "SetTypeAction_ExistingType"; //$NON-NLS-1$ - - public Command getSetTypeCommand(String actionId); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IService.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IService.java deleted file mode 100644 index fe487db65..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IService.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import java.util.List; -import org.eclipse.gef.commands.Command; - -public interface IService extends INamedObject -{ - public List getEndPoints(); - public IDescription getOwnerDescription(); - public Command getAddEndPointCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IType.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IType.java deleted file mode 100644 index d997301d2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IType.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import org.eclipse.gef.commands.Command; - -public interface IType extends INamedObject { - public IDescription getOwnerDescription(); - public Command getDeleteCommand(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/messages.properties b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/messages.properties deleted file mode 100644 index a2b5e8bcd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/messages.properties +++ /dev/null @@ -1,50 +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 -############################################################################### -_UI_TAB_GRAPH=Design -_UI_TAB_SOURCE=Source -_UI_BUTTON_NEW=New... -_UI_LABEL_READ_ONLY=read-only -_UI_LABEL_NAMESPACE=Namespace -_UI_LABEL_PORTTYPE=PortType -_UI_LABEL_LOCATION=Location -_UI_LABEL_ADDRESS=Address -_UI_LABEL_BINDING=Binding -_UI_LABEL_PREFIX=Prefix -_UI_LABEL_NAME=Name -_UI_LABEL_TYPE=Type -_UI_ACTION_ADD_SERVICE=Add Service -_UI_ACTION_ADD_MESSAGE=Add Message -_UI_ACTION_ADD_OPERATION=Add Operation -_UI_ACTION_ADD_IMPORT=Add Import -_UI_ACTION_ADD_OUTPUT=Add Output -_UI_ACTION_ADD_FAULT=Add Fault -_UI_ACTION_ADD_PORT=Add Port -_UI_ACTION_ADD_PORTTYPE=Add PortType -_UI_ACTION_DELETE=Delete -_UI_BUTTON_BROWSE=Browse... -_UI_ACTION_NEW_PORTTYPE=New PortType... -_UI_ACTION_NEW_BINDING=New Binding... -_UI_ACTION_EXISTING_PORTTYPE=Existing PortType... -_UI_GENERATE_BINDING_CONTENT=Generate Binding Content... -_UI_ACTION_EXISTING_BINDING=Existing Binding... -_UI_LABEL_BINDING_PROTOCOL=Protocol -_UI_LABEL_TARGET_NAMESPACE=Target namespace -_UI_ACTION_ADD_BINDING=Add Binding -_UI_ACTION_ADD_SCHEMA=Add Schema -_UI_ACTION_ADD_INPUT=Add Input -_UI_SECTION_ADVANCED_ATTRIBUTES=Advanced - -_UI_ACTION_EDIT_NAMESPACES = Edit Namespaces... -_UI_ACTION_OPEN_SCHEMA=Open Schema -_UI_TOOLTIP_RENAME_REFACTOR=Click here to invoke the Rename refactoring. - -_UI_LABEL_RIGHT_CLICK_TO_INSERT_CONTENT=Right mouse click here to insert content -_UI_ACTION_SHOW_PROPERTIES=Show properties diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlinePage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlinePage.java deleted file mode 100644 index 955500ac9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlinePage.java +++ /dev/null @@ -1,98 +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.outline; - -import org.eclipse.gef.EditPart; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.contentoutline.ContentOutlinePage; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - -public class ASDContentOutlinePage extends ContentOutlinePage { - protected ASDMultiPageEditor wsdlEditor; - protected IDescription model; - protected ITreeContentProvider contentProvider; - protected ILabelProvider labelProvider; - protected IMenuListener menuListener; - - public ASDContentOutlinePage(ASDMultiPageEditor editor, IMenuListener menuListener) { - wsdlEditor = editor; - this.menuListener = menuListener; - } - - public TreeViewer getTreeViewer() { - return super.getTreeViewer(); - } - - public void setContentProvider(ITreeContentProvider contentProvider) { - this.contentProvider = contentProvider; - } - - public void setLabelProvider(ILabelProvider labelProvider) { - this.labelProvider = labelProvider; - } - - public void setModel(IDescription model) { - this.model = model; - } - - public void createControl(Composite parent) { - super.createControl(parent); - - getTreeViewer().setContentProvider(contentProvider); - getTreeViewer().setLabelProvider(labelProvider); - getTreeViewer().setInput(model); - getTreeViewer().addSelectionChangedListener(this); - - MenuManager menuManager = new MenuManager("#popup");//$NON-NLS-1$ - menuManager.setRemoveAllWhenShown(true); - Menu menu = menuManager.createContextMenu(getTreeViewer().getControl()); - getTreeViewer().getControl().setMenu(menu); - menuManager.addMenuListener(menuListener); - - getSite().registerContextMenu("org.eclipse.wst.wsdl.ui.popup.outline", menuManager, wsdlEditor.getSelectionManager()); //$NON-NLS-1$ - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),ASDEditorCSHelpIds.WSDL_OUTLINE_VIEW); - } - - protected boolean processingSelectionChange = false; - - public void selectionChanged(SelectionChangedEvent event) { - if (!processingSelectionChange) { - processingSelectionChange = true; - super.selectionChanged(event); - Object selection = null; - - if (((IStructuredSelection) event.getSelection()).getFirstElement() instanceof EditPart){ - EditPart newEditPart = (EditPart) ((IStructuredSelection) event.getSelection()).getFirstElement(); - selection = newEditPart.getModel(); - } - else { - selection = ((IStructuredSelection) event.getSelection()).getFirstElement(); - } - - if (selection != null) { - setSelection(new StructuredSelection(selection)); - } - processingSelectionChange = false; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlineProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlineProvider.java deleted file mode 100644 index 5cd930c60..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlineProvider.java +++ /dev/null @@ -1,156 +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.outline; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -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.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject; - -public class ASDContentOutlineProvider implements ITreeContentProvider, ILabelProvider, IASDObjectListener { - protected Viewer viewer; - - /** - * @deprecated - */ - protected ASDMultiPageEditor editor; - protected List listeners = new ArrayList(); - - /** - * @deprecated - */ - protected IDescription description; - - public ASDContentOutlineProvider() - { - } - - public ASDContentOutlineProvider(ASDMultiPageEditor editor, IDescription description) { - this.editor = editor; - this.description = description; - } - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof ITreeElement) { - ITreeElement[] kids = ((ITreeElement) parentElement).getChildren(); - for (int index = 0; index < kids.length; index++) { - attachListener(kids[index]); - } - - return kids; - } - - return new Object[0]; - } - - public Object getParent(Object element) { - if (element instanceof ITreeElement) { - return ((ITreeElement) element).getParent(); - } - - return null; - } - - public boolean hasChildren(Object element) { - if (getChildren(element).length > 0) { - return true; - } - - return false; - } - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - public void dispose() { - unattachAllListeners(); - viewer = null; - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - this.viewer = viewer; - unattachAllListeners(); - } - - public Image getImage(Object element) { - if (element instanceof ITreeElement) { - return ((ITreeElement) element).getImage(); - } - - return null; - } - - public String getText(Object element) { - String text = null; - - if (element instanceof INamedObject) { - text = ((INamedObject) element).getName(); - } - else if (element instanceof ITreeElement) { - text = ((ITreeElement) element).getText(); - } - else { - text = element.toString(); - } - - if (text == null) { - text = ""; //$NON-NLS-1$ - } - - return text; - } - - public void addListener(ILabelProviderListener listener) { - - } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - - } - - protected void attachListener(Object object) { - if (object instanceof IASDObject && !listeners.contains(object)) { - ((IASDObject) object).registerListener(this); - listeners.add(object); - } - } - - protected void unattachAllListeners() { - Iterator it = listeners.iterator(); - while (it.hasNext()) { - Object item = it.next(); - ((IASDObject) item).unregisterListener(this); - } - } - - public void propertyChanged(Object object, String property) { - if (viewer instanceof TreeViewer) { - TreeViewer treeViewer = (TreeViewer) viewer; - treeViewer.refresh(object); - treeViewer.reveal(object); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ICategoryAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ICategoryAdapter.java deleted file mode 100644 index a03d82983..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ICategoryAdapter.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.outline; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - -public interface ICategoryAdapter { - public IDescription getOwnerDescription(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ITreeElement.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ITreeElement.java deleted file mode 100644 index 11a2d7391..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ITreeElement.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.outline; - -import org.eclipse.swt.graphics.Image; - -public interface ITreeElement { - public final static ITreeElement[] EMPTY_LIST = {}; - ITreeElement[] getChildren(); - ITreeElement getParent(); - boolean hasChildren(); - String getText(); - Image getImage(); - Image getSecondaryImage(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java deleted file mode 100644 index 94c4db34b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java +++ /dev/null @@ -1,438 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -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.Listener; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.FileStoreEditorInput; -import org.eclipse.ui.part.EditorActionBarContributor; -import org.eclipse.ui.views.properties.tabbed.ISection; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener; - -public class ASDAbstractSection implements ISection, IASDObjectListener, Listener, SelectionListener -{ - private TabbedPropertySheetWidgetFactory factory; - private Object elementModel; - protected boolean isReadOnly = false; - protected Composite composite; - protected int rightMarginSpace; - protected int tableMinimumWidth = 50; - protected CustomListener customListener = new CustomListener(); - - protected List listeners = new ArrayList(); - - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) - { - createControls(parent, tabbedPropertySheetPage.getWidgetFactory()); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory aFactory) - { - this.factory = aFactory; - GC gc = new GC(parent); - Point extent = gc.textExtent(" ... "); //$NON-NLS-1$ - rightMarginSpace = extent.x; - gc.dispose(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) - */ - public void setInput(IWorkbenchPart part, ISelection selection) - { - Assert.isTrue(selection instanceof IStructuredSelection); - Object input = ((IStructuredSelection)selection).getFirstElement(); - elementModel = input; - attachListener(elementModel); - - if (input instanceof IASDObject) { - isReadOnly = ((IASDObject) input).isReadOnly(); - } - - IEditorPart owningEditor = null; - if (part!=null) { - if (part instanceof IEditorPart) { - owningEditor = (IEditorPart)part; - } else { - IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench != null) { - IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - if (window != null) { - IWorkbenchPage page = window.getActivePage(); - if (page != null) { - owningEditor = page.getActiveEditor(); - } - } - } - } - } - if (owningEditor != null) { - IEditorInput editorInput = owningEditor.getEditorInput(); - if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput)) { - isReadOnly = true; - } - } - refresh(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeShown() - */ - public void aboutToBeShown() - { - refresh(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeHidden() - */ - public void aboutToBeHidden() - { - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#dispose() - */ - public void dispose() - { - unattachAllListeners(); - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#getMinimumHeight() - */ - public int getMinimumHeight() - { - return SWT.DEFAULT; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace() - */ - public boolean shouldUseExtraSpace() - { - return true; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#refresh() - */ - public void refresh() - { - if (!composite.isDisposed()) - { - if (isReadOnly) - { - composite.setEnabled(false); - } - else - { - composite.setEnabled(true); - } - } - } - - /** - * Get the widget factory. - * @return the widget factory. - */ - public TabbedPropertySheetWidgetFactory getWidgetFactory() { - return factory; - } - - public void propertyChanged(Object object, String property) - { - refresh(); - } - - - public void doWidgetDefaultSelected(SelectionEvent e) - {} - - public void doWidgetSelected(SelectionEvent e) - {} - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent) - */ - public void widgetDefaultSelected(SelectionEvent e) - { - if (isListenerEnabled() && !isInDoHandle) - { - isInDoHandle = true; - doWidgetDefaultSelected(e); - isInDoHandle = false; - } - - } - - /** - * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent) - */ - public void widgetSelected(SelectionEvent e) - { - if (isListenerEnabled() && !isInDoHandle) - { - isInDoHandle = true; - doWidgetSelected(e); - isInDoHandle = false; - } - - } - - boolean listenerEnabled = true; - /** - * Get the value of listenerEnabled. - * @return value of listenerEnabled. - */ - public boolean isListenerEnabled() - { - return listenerEnabled; - } - - public void applyTextListeners(Control control) - { - control.addListener(SWT.FocusOut, customListener); - control.addListener(SWT.KeyDown, customListener); - } - - public void removeListeners(Control control) - { - control.removeListener(SWT.FocusOut, customListener); - control.removeListener(SWT.KeyDown, customListener); - } - - /** - * Set the value of listenerEnabled. - * @param v Value to assign to listenerEnabled. - */ - public void setListenerEnabled(boolean v) - { - this.listenerEnabled = v; - } - - public void handleEvent(Event event) - { - if (isListenerEnabled() && !isInDoHandle) - { - isInDoHandle = true; -// startDelayedEvent(event); - doHandleEvent(event); - isInDoHandle = false; - } // end of if () - } - - public void doHandleEvent(Event event) - { - - } - - protected DelayedEvent delayedTask; - - protected void startDelayedEvent(Event e) - { - if (delayedTask == null || - delayedTask.getEvent() == null) - { - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500,delayedTask); - } - else - { - Event delayedEvent = delayedTask.getEvent(); - - if (e.widget == delayedEvent.widget && - e.type == delayedEvent.type) - { - // same event, just different data, delay new event - delayedTask.setEvent(null); - } - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500,delayedTask); - } - } - - class DelayedEvent implements Runnable - { - protected Event event; - - /* - * @see Runnable#run() - */ - public void run() - { - if (event != null) - { - isInDoHandle = true; - doHandleEvent(event); - isInDoHandle = false; - event = null; - } - } - - /** - * Gets the event. - * @return Returns a Event - */ - public Event getEvent() - { - return event; - } - - /** - * Sets the event. - * @param event The event to set - */ - public void setEvent(Event event) - { - this.event = event; - } - - } - - class CustomListener implements Listener - { - boolean isHandlingEvent = false; - public void handleEvent(Event event) - { - if (isListenerEnabled() && !isReadOnly) - { - switch (event.type) - { - case SWT.KeyDown : - { - if (event.character == SWT.CR) - { - if (!isHandlingEvent) - { - isHandlingEvent = true; - doHandleEvent(event); - isHandlingEvent = false; - } - } - break; - } - case SWT.FocusOut : - { - if (!isHandlingEvent) - { - isHandlingEvent = true; - doHandleEvent(event); - isHandlingEvent = false; - } - break; - } - } - } - } - } - - protected boolean isInDoHandle; - /** - * Get the value of isInDoHandle. - * @return value of isInDoHandle. - */ - public boolean isInDoHandle() - { - return isInDoHandle; - } - - static protected IStatusLineManager getStatusLineManager(IEditorPart editorPart) - { - IStatusLineManager result = null; - try - { - EditorActionBarContributor contributor = (EditorActionBarContributor)editorPart.getEditorSite().getActionBarContributor(); - result = contributor.getActionBars().getStatusLineManager(); - } - catch (Exception e) - { - } - return result; - } - - public Object getModel() { - return elementModel; - } - - protected void attachListener(Object object) { - if (object instanceof IASDObject && !listeners.contains(object)) { - ((IASDObject) object).registerListener(this); - listeners.add(object); - } - } - - protected void unattachAllListeners() { - Iterator it = listeners.iterator(); - while (it.hasNext()) { - Object item = it.next(); - ((IASDObject) item).unregisterListener(this); - } - } - - protected void setControlForegroundColor(Control control) { - if (control != null) { - if (isReadOnly) { - control.setForeground(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else { - control.setForeground(DesignViewGraphicsConstants.defaultForegroundColor); - } - } - } - - protected void executeCommand(Command command) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - - if (page.getActiveEditor() != null && page.getActiveEditor().getAdapter(CommandStack.class) != null) { - CommandStack stack = (CommandStack) page.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - else { - command.execute(); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java deleted file mode 100644 index d1f65d62b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java +++ /dev/null @@ -1,48 +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.properties.sections; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -public class ASDTabbedPropertySheetPage extends TabbedPropertySheetPage implements ISelectionChangedListener//, IElementListener -{ - /** - * @param tabbedPropertySheetPageContributor - */ - public ASDTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor) - { - super(tabbedPropertySheetPageContributor); -// tabContributor = tabbedPropertySheetPageContributor; - } - - public void createControl(Composite parent) { - super.createControl(parent); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) - { - if (!event.getSelection().isEmpty()) { - selectionChanged(getSite().getWorkbenchWindow().getActivePage().getActivePart(), event.getSelection()); - //super.selectionChanged(getSite().getWorkbenchWindow().getActivePage().getActivePart(), event.getSelection()); - } - } - - public void dispose() { - super.dispose(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java deleted file mode 100644 index 80900da81..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension.ContentGeneratorUIExtension; -import org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension.ContentGeneratorUIExtensionRegistry; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; - -public class BindingSection extends ReferenceSection implements SelectionListener { - protected ComponentReferenceEditManager refManager; - private CLabel protocolValue; -// private CLabel optionsValue; - private Button regenBindingButton; - - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - comboLabel.setText(org.eclipse.wst.wsdl.ui.internal.asd.Messages._UI_LABEL_PORTTYPE + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - - CLabel protocolLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BINDING_PROTOCOL); - protocolValue= getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$ - - // Layout protocolLabel - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(protocolValue, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(protocolValue, 0, SWT.CENTER); - protocolLabel.setLayoutData(data); - - // Layout protocolValue - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, 0); -// data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE); - protocolValue.setLayoutData(data); - - /* - CLabel optionsLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_UI_TITLE_OPTIONS") + ":"); - optionsValue = getWidgetFactory().createCLabel(composite, ""); - - // Layout optionsLabel - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(optionsValue, 0, SWT.CENTER); - optionsLabel.setLayoutData(data); - - // Layout optionsValue - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(protocolValue, -ITabbedPropertyConstants.VSPACE); -// data.top = new FormAttachment(protocolValue, +ITabbedPropertyConstants.VSPACE); - optionsValue.setLayoutData(data); - - String buttonLabel = org.eclipse.wst.wsdl.ui.internal.asd.Messages.getString("_UI_GENERATE_BINDING_CONTENT"); - regenBindingButton = getWidgetFactory().createButton(composite, buttonLabel, SWT.PUSH); - - // Layout button - data = new FormData(); - data.left = new FormAttachment(0, 0); -// data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(optionsLabel, 0); - regenBindingButton.setLayoutData(data); - */ - - String buttonLabel = org.eclipse.wst.wsdl.ui.internal.asd.Messages._UI_GENERATE_BINDING_CONTENT; - regenBindingButton = getWidgetFactory().createButton(composite, buttonLabel, SWT.PUSH); - - // Layout button - data = new FormData(); - data.left = new FormAttachment(0, 0); -// data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(protocolLabel, 0); - regenBindingButton.setLayoutData(data); - - regenBindingButton.addSelectionListener(this); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(protocolValue, ASDEditorCSHelpIds.PROPERTIES_BINDING_PROTOCOL_TEXT); - PlatformUI.getWorkbench().getHelpSystem().setHelp(regenBindingButton, ASDEditorCSHelpIds.PROPERTIES_BINDING_GEN_BINDING_BUTTON); - PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_BINDING_PORTTYPE_COMBO); - } - - public void refresh() { - super.refresh(); - IBinding binding = getIBinding(); - String protocol = binding.getProtocol(); - ContentGeneratorUIExtensionRegistry registry = WSDLEditorPlugin.getInstance().getContentGeneratorUIExtensionRegistry(); - ContentGeneratorUIExtension ext = registry.getExtensionForName(protocol); - if (ext != null) { - protocol = ext.getLabel(); - } - - if (protocol == null || protocol.equals("")) { //$NON-NLS-1$ - protocol = "----"; //$NON-NLS-1$ - } - protocolValue.setText(protocol); - -// optionsValue.setText(""); - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() { - if (refManager != null) { - return refManager; - } - - refManager = ReferenceEditManagerHelper.getInterfaceReferenceEditManager((IASDObject) getModel()); - - return refManager; - } - - protected List getComboItems() { - ComponentReferenceEditManager manager = getComponentReferenceEditManager(); - - List items = new ArrayList(); - items.add(BROWSE_STRING); - items.add(NEW_STRING); - - if (manager != null) { - ComponentSpecification[] comboItems = manager.getQuickPicks(); - for (int index = 0; index < comboItems.length; index++) - { - items.add(comboItems[index]); - } - } - return items; - } - - protected Object getCurrentComboItem() { - IBinding binding = getIBinding(); - return binding.getInterface(); - } - - protected String getComboItemName(Object item) { - String name = ""; //$NON-NLS-1$ - if (item instanceof ComponentSpecification) { - name = ((ComponentSpecification) item).getName(); - } - else if (item instanceof IInterface) { - name = ((IInterface) item).getName(); - } - else if (item instanceof String) { - name = (String) item; - } - - return name; - } - - protected void performComboSelection(Object item) { - ComponentSpecification spec = null; - - if (item instanceof ComponentSpecification) { - spec = (ComponentSpecification) item; - ComponentReferenceEditManager manager = getComponentReferenceEditManager(); - manager.modifyComponentReference((IBinding) getModel(), spec); - } - else if (item instanceof String) { - if (item.equals(BROWSE_STRING)) { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - ASDSetExistingInterfaceAction action = new ASDSetExistingInterfaceAction(part); - action.setIBinding((IBinding) getModel()); - action.run(); - } - else if (item.equals(NEW_STRING)) { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - ASDSetNewInterfaceAction action = new ASDSetNewInterfaceAction(part); - action.setIBinding((IBinding) getModel()); - action.run(); - } - } - - refresh(); - } - - private IBinding getIBinding() { - return (IBinding) getModel(); - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == regenBindingButton) { - Command command = getIBinding().getGenerateBindingCommand(); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - } - - public void doWidgetSelected(SelectionEvent e) { - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java deleted file mode 100644 index a762c92fc..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java +++ /dev/null @@ -1,154 +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.properties.sections; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.actions.AddElementAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class DocumentationSection extends ASDAbstractSection { - Text docText; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - composite = getWidgetFactory().createFlatFormComposite(parent); - - docText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL); //$NON-NLS-1$ - docText.addListener(SWT.KeyDown, this); - FormData data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(0, 0); - data.bottom = new FormAttachment(100, 0); - docText.setLayoutData(data); - PlatformUI.getWorkbench().getHelpSystem().setHelp(docText, ASDEditorCSHelpIds.PROPERTIES_DOCUMENTATION_TAB); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - /* - * TODO: the doHandleEvent() and refresh() methods both use WSDL11 specific - * knowledge. This class (DocumentationSection) should be generic. In Post 1.5, - * we need to add documentation support methods to our facade so we don't need - * to know WSDL specific implementation....... - */ - public void refresh() - { - super.refresh(); - if (docText.isFocusControl()) - { - return; - } - setListenerEnabled(false); - docText.setText(""); //$NON-NLS-1$ - if (getModel() != null && getElement() != null) - { - Element docNode = getElement().getDocumentationElement(); - if (docNode != null) - { - Node textNode = docNode.getFirstChild(); - if (textNode != null) - { - String docValue = textNode.getNodeValue(); - if (docValue != null) - { - docText.setText(docValue); - } - } - } - } - setListenerEnabled(true); - } - - /* - * TODO: the doHandleEvent() and refresh() methods both use WSDL11 specific - * knowledge. This class (DocumentationSection) should be generic. In Post 1.5, - * we need to add documentation support methods to our facade so we don't need - * to know WSDL specific implementation....... - */ - public void doHandleEvent(Event event) - { - if (event.widget == docText) - { - String value = docText.getText(); - if (getModel() != null && getElement() != null) - { - Element docNode = getElement().getDocumentationElement(); - if (docNode != null) - { - Node textNode = docNode.getFirstChild(); - if (textNode != null) - { - textNode.setNodeValue(value); - } - else - { - if (value.length() > 0) - { - Document document = docNode.getOwnerDocument(); - org.w3c.dom.Text newTextNode = document.createTextNode(value); - docNode.appendChild(newTextNode); - } - } - } - else - { - Element element = getElement().getElement(); - AddElementAction action = new AddElementAction(element, element.getPrefix(), "documentation", element.getFirstChild()); //$NON-NLS-1$ - action.run(); - Element newDocumentation = action.getNewElement(); - - Document document = newDocumentation.getOwnerDocument(); - org.w3c.dom.Text newTextNode = document.createTextNode(value); - newDocumentation.appendChild(newTextNode); - getElement().setDocumentationElement(newDocumentation); - } - } - } - } - - private WSDLElement getElement() { - WSDLElement element = null; - Object model = getModel(); - - if (model instanceof AbstractModelCollection) { - model = ((AbstractModelCollection) model).getModel(); - } - - // TODO: Should we be handling the XML Schema case here as well? - if (model instanceof WSDLBaseAdapter) { - Object target = ((WSDLBaseAdapter) model).getTarget(); - if (target instanceof WSDLElement) { - element = (WSDLElement) target; - } - } - - return element; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java deleted file mode 100644 index 7e346d8ce..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java +++ /dev/null @@ -1,286 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension.ContentGeneratorUIExtension; -import org.eclipse.wst.wsdl.ui.internal.asd.contentgenerator.ui.extension.ContentGeneratorUIExtensionRegistry; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; - -public class EndPointSection extends ReferenceSection { - protected Text addressText; - protected CCombo protocolCombo; - - protected List bindingsInCombo = new ArrayList(); - - protected ComponentReferenceEditManager refManager; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - FormData data; - - // Address row - CLabel addressLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ADDRESS + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - addressText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(addressText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(addressText, 0, SWT.CENTER); - addressLabel.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE); - addressText.setLayoutData(data); - PlatformUI.getWorkbench().getHelpSystem().setHelp(addressText, ASDEditorCSHelpIds.PROPERTIES_PORT_ADDRESS_TEXT); - - // Protocol Row - CLabel protocolLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BINDING_PROTOCOL + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - protocolCombo = getWidgetFactory().createCCombo(composite); //$NON-NLS-1$ - - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(protocolCombo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(protocolCombo, 0, SWT.CENTER); - protocolLabel.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(addressText, +ITabbedPropertyConstants.VSPACE); - protocolCombo.setLayoutData(data); - protocolCombo.addListener(SWT.Modify, this); - PlatformUI.getWorkbench().getHelpSystem().setHelp(protocolCombo, ASDEditorCSHelpIds.PROPERTIES_PORT_PROTOCOL_TEXT); - - comboLabel.setText(Messages._UI_LABEL_BINDING + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - - PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PORT_BINDING_COMBO); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - removeListeners(addressText); - protocolCombo.removeListener(SWT.Modify, this); - - super.refresh(); - - IEndPoint endPoint = (IEndPoint) getModel(); - if (endPoint.getAddress() != null) { - if (!endPoint.getAddress().equals(addressText.getText())) { - addressText.setText(endPoint.getAddress()); - } - } - - protocolCombo.removeAll(); - if (endPoint instanceof W11EndPoint) { - String protocolValue = ((W11EndPoint) endPoint).getProtocol(); - ContentGeneratorUIExtensionRegistry registry = WSDLEditorPlugin.getInstance().getContentGeneratorUIExtensionRegistry(); - ContentGeneratorUIExtension extt = registry.getExtensionForName(protocolValue); - if (extt != null) { - protocolValue = extt.getLabel(); - } - List protocols = ((W11EndPoint) getModel()).getApplicableProtocol(); - Iterator it = protocols.iterator(); - while (it.hasNext()) { - String protocol = (String) it.next(); - ContentGeneratorUIExtension ext = registry.getExtensionForName(protocol); - if (ext != null) { - String label = ext.getLabel(); - if (label != null) { - protocolCombo.add(label); - } - } - } - - protocolCombo.setText(protocolValue); - } - - setControlForegroundColor(addressText); - setControlForegroundColor(protocolCombo); - applyTextListeners(addressText); - protocolCombo.addListener(SWT.Modify, this); - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() { - if (refManager != null) { - return refManager; - } - - refManager = ReferenceEditManagerHelper.getBindingReferenceEditManager((IASDObject) getModel()); - - return refManager; - } - - protected List getComboItems() { - ComponentReferenceEditManager manager = getComponentReferenceEditManager(); - - List items = new ArrayList(); - items.add(BROWSE_STRING); - items.add(NEW_STRING); - - if (manager != null) { - ComponentSpecification[] comboItems = manager.getQuickPicks(); - for (int index = 0; index < comboItems.length; index++) { - items.add(comboItems[index]); - } - } - return items; - } - - protected Object getCurrentComboItem() { - IEndPoint endPoint = (IEndPoint) getModel(); - return endPoint.getBinding(); - } - - protected String getComboItemName(Object item) { - String name = ""; //$NON-NLS-1$ - if (item instanceof ComponentSpecification) { - name = ((ComponentSpecification) item).getName(); - } - else if (item instanceof IBinding) { - name = ((IBinding) item).getName(); - } - else if (item instanceof String) { - name = (String) item; - } - - return name; - } - - protected void performComboSelection(Object item) { - ComponentSpecification spec = null; - - if (item instanceof ComponentSpecification) { - spec = (ComponentSpecification) item; - ComponentReferenceEditManager manager = getComponentReferenceEditManager(); - manager.modifyComponentReference((IEndPoint) getModel(), spec); - } - else if (item instanceof String) { - if (item.equals(BROWSE_STRING)) { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - ASDSetExistingBindingAction action = new ASDSetExistingBindingAction(part); - action.setIEndPoint((IEndPoint) getModel()); - action.run(); - } - else if (item.equals(NEW_STRING)) { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - ASDSetNewBindingAction action = new ASDSetNewBindingAction(part); - action.setIEndPoint((IEndPoint) getModel()); - action.run(); - } - } - - refresh(); - } - - public boolean shouldUseExtraSpace() - { - return false; - } - - public void doHandleEvent(Event event) - { - if (event.widget == addressText && !addressText.isDisposed()) { - String newAddress = addressText.getText(); - if (newAddress == null) { - newAddress = ""; //$NON-NLS-1$ - } - - String oldAddress = getOldAddress(); - if (oldAddress.equals(newAddress)) - return; - - IEndPoint endPoint = (IEndPoint) getModel(); - Command command = endPoint.getSetAddressCommand(newAddress); - executeCommand(command); - } - else if (event.widget == protocolCombo && !protocolCombo.isDisposed()) { - String newProtocol = protocolCombo.getText(); - ContentGeneratorUIExtensionRegistry registry = WSDLEditorPlugin.getInstance().getContentGeneratorUIExtensionRegistry(); - ContentGeneratorUIExtension ext = registry.getExtensionForLabel(newProtocol); - if (ext != null) - { - newProtocol = ext.getName(); - } - if (newProtocol != null && getModel() instanceof W11EndPoint) { - W11EndPoint endPoint = (W11EndPoint) getModel(); - - // Don't update the protocol if it's the same as the old one - - String oldProtocol = getOldProtocol(endPoint); - if (oldProtocol.equals(newProtocol)) - return; - - endPoint.setProtocol(newProtocol); - } - } - else { - super.doHandleEvent(event); - } - } - - private String getOldAddress() { - String value = null; - if (getModel() instanceof W11EndPoint) { - value = ((W11EndPoint) getModel()).getAddress(); - } - - if (value == null) { - value = ""; //$NON-NLS-1$ - } - return value; - } - - private String getOldProtocol(W11EndPoint endPoint) { - String value = null; - value = endPoint.getProtocol(); - - if (value == null) { - value = ""; //$NON-NLS-1$ - } - return value; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java deleted file mode 100644 index b168d54af..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.internal.impl.ImportImpl; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Import; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.emf.common.util.URI; -import org.w3c.dom.Element; - -public class ImportSection extends ASDAbstractSection -{ - protected Text namespaceText, prefixText, locationText; - private String oldPrefixValue; - Button button; - // TODO: Remove: IEditorPart editorPart - IEditorPart editorPart; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - Composite composite = getWidgetFactory().createFlatFormComposite(parent); - FormData data; - - namespaceText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - namespaceText.setEditable(false); -// namespaceText.addListener(SWT.Modify, this); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(0, 0); - namespaceText.setLayoutData(data); - - CLabel namespaceLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_NAMESPACE); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(namespaceText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(namespaceText, 0, SWT.CENTER); - namespaceLabel.setLayoutData(data); - - prefixText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ -// prefixText.setEditable(false); - applyTextListeners(prefixText); - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(namespaceText, +ITabbedPropertyConstants.VSPACE); - prefixText.setLayoutData(data); - - CLabel prefixLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_PREFIX); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(prefixText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(prefixText, 0, SWT.CENTER); - prefixLabel.setLayoutData(data); - - locationText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - locationText.setEditable(false); -// locationText.addListener(SWT.Modify, this); - - CLabel locationLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_LOCATION); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(locationText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(locationText, 0, SWT.CENTER); - locationLabel.setLayoutData(data); - - button = getWidgetFactory().createButton(composite, "", SWT.PUSH); //$NON-NLS-1$ - button.setImage(WSDLEditorPlugin.getInstance().getImage("icons/browsebutton.gif")); //$NON-NLS-1$ - - button.addSelectionListener(this); - data = new FormData(); - data.left = new FormAttachment(100, -rightMarginSpace + 2); - data.right = new FormAttachment(100,0); - data.top = new FormAttachment(locationText, 0, SWT.CENTER); - button.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(button, 0); - data.top = new FormAttachment(prefixText, +ITabbedPropertyConstants.VSPACE); - locationText.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() - { - setListenerEnabled(false); - Object obj = getModel(); - boolean refreshPrefixText = true; - boolean refreshLocationText = true; - boolean refreshNamespaceText = true; - if (prefixText.isFocusControl()) - { - refreshPrefixText = false; - } - if (locationText.isFocusControl()) - { - refreshLocationText = false; - } - if (namespaceText.isFocusControl()) - { - refreshNamespaceText = false; - } - - if (refreshPrefixText) - { - prefixText.setText(""); //$NON-NLS-1$ - } - if (refreshLocationText) - { - locationText.setText(""); //$NON-NLS-1$ - } - if (refreshNamespaceText) - { - namespaceText.setText(""); //$NON-NLS-1$ - } - if (obj instanceof IImport) - { - IImport theImport = (IImport) obj; - if (refreshLocationText) - { - String locationValue = theImport.getLocation(); - locationText.setText(locationValue != null ? locationValue : ""); //$NON-NLS-1$ - } - - String namespaceValue = theImport.getNamespace(); - if (refreshNamespaceText) - { - namespaceText.setText(namespaceValue != null ? namespaceValue : ""); //$NON-NLS-1$ - } - - if (refreshPrefixText) - { - String prefix = theImport.getNamespacePrefix(); - prefixText.setText(prefix != null ? prefix : ""); //$NON-NLS-1$ - } - } - oldPrefixValue = prefixText.getText(); - setListenerEnabled(true); - } - - public void doHandleEvent(Event event) { - // TODO: We have some WSDL11 Impl specific knowledge below... We should try to remove this... - if (event.widget == prefixText && locationText.getText().length() > 0 && namespaceText.getText().length() > 0 && getModel() instanceof W11Import) { - if (oldPrefixValue.equals(prefixText.getText())) - return; - - W11Import w11Import = (W11Import) getModel(); - Import importObj = (Import) w11Import.getTarget(); -// org.w3c.dom.Element importElement = WSDLEditorUtil.getInstance().getElementForObject(importObj); - Map namespacesMap = importObj.getEnclosingDefinition().getNamespaces(); - - if (namespacesMap.containsKey(prefixText.getText())) { - // We should add error messages......... - // setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_PREFIX_EXISTS")); - } - else { - Element definitionElement = importObj.getEnclosingDefinition().getElement(); - definitionElement.removeAttribute("xmlns:"+oldPrefixValue); //$NON-NLS-1$ - definitionElement.setAttribute("xmlns:" + prefixText.getText(), namespaceText.getText()); //$NON-NLS-1$ - -// clearErrorMessage(); - oldPrefixValue = prefixText.getText(); - } - } - } - - public void widgetSelected(SelectionEvent e) - { - // TODO: We have some WSDL11 Impl specific knowledge below... We should try to remove this... - if (e.widget == button && getModel() instanceof W11Import) - { - W11Import w11Import = (W11Import) getModel(); - - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - - SelectSingleFileDialog dialog = new SelectSingleFileDialog(WSDLEditorPlugin.getShell(), null, true); - - IFile currentWSDLFile = null; - IEditorInput editorInput = editor.getEditorInput(); - String [] filters = { "xsd", "wsdl" }; //$NON-NLS-1$ //$NON-NLS-2$ - - if (editorInput instanceof IFileEditorInput) - { - currentWSDLFile = ((IFileEditorInput)editorInput).getFile(); - IFile [] excludedFiles = { currentWSDLFile }; - dialog.addFilterExtensions(filters, excludedFiles); - } - else - { - IFile [] excludedFiles = { }; - dialog.addFilterExtensions(filters, excludedFiles); - } - - dialog.create(); - dialog.getShell().setText(org.eclipse.wst.wsdl.ui.internal.Messages._UI_TITLE_SELECT); //$NON-NLS-1$ - dialog.setTitle(org.eclipse.wst.wsdl.ui.internal.Messages._UI_TITLE_SELECT_FILE); //$NON-NLS-1$ - dialog.setMessage(org.eclipse.wst.wsdl.ui.internal.Messages._UI_DESCRIPTION_SELECT_WSDL_OR_XSD); //$NON-NLS-1$ - int rc = dialog.open(); - if (rc == IDialogConstants.OK_ID) - { - IFile selectedFile = dialog.getFile(); - - //if (selectedFile.getLocation().toOSString().equals(currentWSDLFile.getLocation().toOSString())) - //{ - // System.out.println("SAME FILE:" + currentWSDLFile.getLocation()); - //} - - String location = ComponentReferenceUtil.computeRelativeURI(selectedFile, currentWSDLFile, true); - - Import importObj = (Import) w11Import.getTarget(); -// org.w3c.dom.Element importElement = WSDLEditorUtil.getInstance().getElementForObject(importObj); - Definition definition = importObj.getEnclosingDefinition(); - org.w3c.dom.Element definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition); - - String importTargetNamespace = ""; //$NON-NLS-1$ - String prefix = prefixText.getText(); - String uniquePrefix = ""; //$NON-NLS-1$ - - URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString()); - - // note that the getTargetNamespaceURIForSchema works for both schema and wsdl files - // I should change the name of this convenience method - importTargetNamespace = WSDLEditorUtil.getTargetNamespaceURIForSchema(uri.toString()); - - if (prefix.trim().equals("")) //$NON-NLS-1$ - { - uniquePrefix = getUniquePrefix(definition, uri.fileExtension()); - } - else - { - uniquePrefix = prefix; - } - - - if (importTargetNamespace == null || - (importTargetNamespace != null && importTargetNamespace.trim().length() == 0)) - { - return; // what to do with no namespace docs? - } - - importObj.setLocationURI(location); - importObj.setNamespaceURI(importTargetNamespace); - ((ImportImpl) importObj).importDefinitionOrSchema(); - - definitionElement.setAttribute("xmlns:" + uniquePrefix, importTargetNamespace); //$NON-NLS-1$ - - namespaceText.setText(importTargetNamespace); - locationText.setText(location); - prefixText.setText(uniquePrefix); - } - refresh(); - } - } - - private String getUniquePrefix(Definition definition, String initPrefix) - { - String uniquePrefix; - Map map = definition.getNamespaces(); - - if (definition.getNamespace(initPrefix) == null) - { - uniquePrefix = initPrefix; - } - else // if used, then try to create a unique one - { - String tempPrefix = initPrefix; - int i = 1; - while(map.containsKey(tempPrefix + i)) - { - i++; - } - uniquePrefix = tempPrefix + i; - } - return uniquePrefix; - } - - // TODO: Remove metod setEditorPart() below - public void setEditorPart(IEditorPart editorPart) - { - this.editorPart = editorPart; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java deleted file mode 100644 index 230de1297..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.events.HyperlinkEvent; -import org.eclipse.ui.forms.events.IHyperlinkListener; -import org.eclipse.ui.forms.widgets.ImageHyperlink; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.ISelectionMapper; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessage; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject; -import org.eclipse.wst.wsdl.ui.internal.refactor.actions.RenameComponentAction; - -public class NameSection extends ASDAbstractSection implements IHyperlinkListener { - protected static final String NEW_STRING = Messages._UI_BUTTON_NEW; //$NON-NLS-1$ - protected static final String BROWSE_STRING = Messages._UI_BUTTON_BROWSE; //$NON-NLS-1$ - protected boolean isTraversing = false; - CLabel nameLabel; - protected Text nameText; - /** - * Clicking on it invokes the refactor->rename action. - */ - protected ImageHyperlink renameHyperlink; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - - composite = getWidgetFactory().createFlatFormComposite(parent); - - FormData data; - - nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace); - data.top = new FormAttachment(0, 0); - nameText.setLayoutData(data); - PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText, ASDEditorCSHelpIds.PROPERTIES_NAME_TEXT); - - nameLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_NAME + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, 0, SWT.CENTER); - nameLabel.setLayoutData(data); - applyTextListeners(nameText); - } - - private void showRefactorButton() { - if (isReadOnly) { - return; - } - - if (renameHyperlink == null) { - renameHyperlink = getWidgetFactory().createImageHyperlink(composite, SWT.NONE); - - renameHyperlink.setImage(WSDLEditorPlugin.getInstance().getImage("icons/quickassist.gif")); //$NON-NLS-1$ - renameHyperlink.setToolTipText(Messages._UI_TOOLTIP_RENAME_REFACTOR); - renameHyperlink.addHyperlinkListener(this); - } - - FormData data = new FormData(); - data.right = new FormAttachment(100, -rightMarginSpace); - data.top = new FormAttachment(0, 0); - renameHyperlink.setLayoutData(data); - - data = (FormData) nameText.getLayoutData(); - FormAttachment right = data.right; - right.control = renameHyperlink; - right.offset = -ITabbedPropertyConstants.HSPACE; - right.alignment = SWT.LEFT; - data.top = new FormAttachment(renameHyperlink, 0, SWT.CENTER); - renameHyperlink.setVisible(true); - } - - private void hideRefactorButton() { - if (isReadOnly) { - return; - } - - if (renameHyperlink == null) { - return; - } - FormData data = (FormData) nameText.getLayoutData(); - FormAttachment right = data.right; - right.control = null; - right.numerator = 100; - right.offset = -rightMarginSpace; - data.top = new FormAttachment(0, 0); - renameHyperlink.setVisible(false); - } - - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - if (nameText.isDisposed() || nameText.isFocusControl()) { - return; - } - - setListenerEnabled(false); - String name = null; - if (getModel() instanceof INamedObject) { - name = ((INamedObject) getModel()).getName(); - } - else if (getModel() instanceof EditPart) { - Object model = ((EditPart) getModel()).getModel(); - name = ((INamedObject) model).getName(); - } - - if (name == null) { - name = ""; //$NON-NLS-1$ - } - - nameText.setText(name); - setControlForegroundColor(nameText); - - if (canRefactor()) { - showRefactorButton(); - } - else { - hideRefactorButton(); - } - setListenerEnabled(true); - } - - public boolean shouldUseExtraSpace() - { - return false; - } - - public void doHandleEvent(Event event) - { - if (event.widget == nameText && !nameText.isDisposed()) { - String newValue = nameText.getText(); - Object model = getModel(); - INamedObject namedObject = null; - - if (model instanceof INamedObject) { - namedObject = (INamedObject) model; - } - - if (namedObject != null) { - if ( !newValue.equals( namedObject.getName() ) ){ - Command command = namedObject.getSetNameCommand(newValue); - executeCommand(command); - } - } - } - } - - private void invokeRenameRefactoring() { - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Definition definition = (Definition)editor.getAdapter(Definition.class); - ISelection selection = editor.getSite().getSelectionProvider().getSelection(); - ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class); - selection = mapper != null ? mapper.mapSelection(selection) : selection; - RenameComponentAction action = new RenameComponentAction(selection, definition); - action.update(selection); - action.run(); - } - - private Object getRealModel() { - Object realModel = getModel(); - - if (realModel instanceof EditPart) { - realModel = ((EditPart) getModel()).getModel(); - } - - return realModel; - } - - /** - * Determines if the model object's name can be refactored. - * @return true if the model object can be refactored, false otherwise. - */ - private boolean canRefactor() { - Object model = getRealModel(); - - boolean canRefactor = model instanceof IMessage || - model instanceof IBinding || - model instanceof IInterface; - return canRefactor; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkActivated(HyperlinkEvent e) - { - invokeRenameRefactoring(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkEntered(HyperlinkEvent e) - { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent) - */ - public void linkExited(HyperlinkEvent e) - { - } - - protected boolean shouldPerformComboSelection(Event event, Object selectedItem) - { - // if traversing through combobox, don't automatically pop up - // the browse and new dialog boxes - boolean wasTraversing = isTraversing; - if (isTraversing) - isTraversing = false; - - // we only care about default selecting (hitting enter in combobox) - // for browse.. and new.. - if (event.type == SWT.DefaultSelection) - { - if (!(selectedItem instanceof String)) - return false; - if (!(BROWSE_STRING.equals(selectedItem) || NEW_STRING.equals(selectedItem))) - return false; - } - - if (wasTraversing && selectedItem instanceof String) - { - if (BROWSE_STRING.equals(selectedItem) || NEW_STRING.equals(selectedItem)) - return false; - } - return true; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java deleted file mode 100644 index b83cd8266..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11EditNamespacesCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDEditNamespacesAction; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -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.ICategoryAdapter; -import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesTargetFieldDialog; -import org.eclipse.wst.xml.ui.internal.nsedit.CommonNamespaceInfoTable; - -public class NamespaceSection extends ASDAbstractSection { - protected String targetNamespace; - protected List namespaceInfoList; - protected CommonEditNamespacesTargetFieldDialog editWSDLNamespacesControl; - protected Button button; - - Text nameText; - Text prefixText; - Text targetNamespaceText; - protected CommonNamespaceInfoTable tableViewer; - private boolean handlingEvent; - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - composite = getWidgetFactory().createFlatFormComposite(parent); - - String nameString = Messages._UI_LABEL_NAME + ":"; //$NON-NLS-1$ //$NON-NLS-2$ - String prefixString = Messages._UI_LABEL_PREFIX + ":"; //$NON-NLS-1$ //$NON-NLS-2$ - String namespaceString = Messages._UI_LABEL_TARGET_NAMESPACE; //$NON-NLS-1$ - GC gc = new GC(parent); - int xoffset = Math.max(115, gc.textExtent(nameString).x + 20); // adds 20 due to borders - xoffset = Math.max(xoffset, gc.textExtent(prefixString).x + 20); // adds 20 due to borders - xoffset = Math.max(xoffset, gc.textExtent(namespaceString).x + 20); // adds 20 due to borders - gc.dispose(); - - // name - CLabel nameLabel = getWidgetFactory().createCLabel(composite, nameString); //$NON-NLS-1$ - nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText, ASDEditorCSHelpIds.PROPERTIES_NAME_TEXT); - - // prefix - CLabel prefixLabel = getWidgetFactory().createCLabel(composite, prefixString); //$NON-NLS-1$ - prefixText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - PlatformUI.getWorkbench().getHelpSystem().setHelp(prefixText, ASDEditorCSHelpIds.PROPERTIES_DEF_PREFIX_TEXT); - - // targetnamespace - CLabel targetNamespaceLabel = getWidgetFactory().createCLabel(composite, namespaceString); //$NON-NLS-1$ - targetNamespaceText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - PlatformUI.getWorkbench().getHelpSystem().setHelp(targetNamespaceText, ASDEditorCSHelpIds.PROPERTIES_DEF_TNS_TEXT); - - // Advanced button - button = getWidgetFactory().createButton(composite, Messages._UI_SECTION_ADVANCED_ATTRIBUTES + "...", SWT.PUSH); //$NON-NLS-1$ //$NON-NLS-2$ - - - ///////////////////// Labels - // name layout - FormData dataNameLabel = new FormData(); - dataNameLabel.top = new FormAttachment(nameText, 0, SWT.CENTER); - nameLabel.setLayoutData(dataNameLabel); - - // prefix layout - FormData dataPrefixLabel = new FormData(); - dataPrefixLabel.left = new FormAttachment(0, 0); - dataPrefixLabel.top = new FormAttachment(prefixText, 0, SWT.CENTER); - prefixLabel.setLayoutData(dataPrefixLabel); - - // targetNamespaceLabel layout - FormData datatnsLabel = new FormData(); - datatnsLabel.left = new FormAttachment(0, 0); - datatnsLabel.right = new FormAttachment(targetNamespaceText, 0); - datatnsLabel.top = new FormAttachment(targetNamespaceText, 0, SWT.CENTER); - targetNamespaceLabel.setLayoutData(datatnsLabel); - - - ///////////////////// Text Fields - // name text field - FormData dataNameText = new FormData(); - dataNameText.left = new FormAttachment(0, xoffset); - dataNameText.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - dataNameText.top = new FormAttachment(0, 0); - nameText.setLayoutData(dataNameText); - applyTextListeners(nameText); - - // prefix text field - FormData dataPrefixText = new FormData(); - dataPrefixText.left = new FormAttachment(0, xoffset); - dataPrefixText.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - dataPrefixText.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); - prefixText.setLayoutData(dataPrefixText); - applyTextListeners(prefixText); - - // targetnamespace text field - FormData data = new FormData(); - data.left = new FormAttachment(0, xoffset); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(prefixText, +ITabbedPropertyConstants.VSPACE); - targetNamespaceText.setLayoutData(data); - applyTextListeners(targetNamespaceText); - - // Advanced button layout - FormData dataButton = new FormData(); -// dataButton.left = new FormAttachment(100, -rightMarginSpace + 2); - dataButton.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - dataButton.top = new FormAttachment(targetNamespaceText, +ITabbedPropertyConstants.VSPACE); -// dataButton.top = new FormAttachment(targetNamespaceText, 0, SWT.CENTER); - button.setLayoutData(dataButton); - button.addSelectionListener(this); - } - - public void doHandleEvent(Event event) - { - handlingEvent = true; - Object obj = getDescription(); - if (obj instanceof IDescription) { - IDescription description = (IDescription) obj; - - if (event.widget == nameText) { - String newName = nameText.getText(); - if (!newName.equals(description.getName())) { - Command command = description.getSetNameCommand(newName); - executeCommand(command); - } - } - else if (event.widget == prefixText || event.widget == targetNamespaceText) { - String newTargetNS = targetNamespaceText.getText(); - String newPrefix = prefixText.getText(); - - boolean targetNSdiff = !newTargetNS.equals(description.getTargetNamespace()); - boolean prefixDiff = !newPrefix.equals(description.getTargetNamespacePrefix()); - if (targetNSdiff || prefixDiff ) { - // TODO: The code below is not generic. We need to revisit this to ensure it is - // generic. IDescription needs a getNamespacesInfo() and getEditNamespacesCommand()... - W11EditNamespacesCommand command = - (W11EditNamespacesCommand) ((W11Description) description).getEditNamespacesCommand(); - if (targetNSdiff) - command.setTargetNamespace(newTargetNS); - if (prefixDiff) - command.setTargetNamespacePrefix(newPrefix); - executeCommand(command); - } - } - } - - handlingEvent = false; - } - - protected Object getDescription() { - Object model = getModel(); - if (model instanceof AbstractModelCollection) { - model = ((AbstractModelCollection) model).getModel(); - if (model instanceof IDescription) { - return (IDescription) model; - } - } - else if (model instanceof ICategoryAdapter) { - return ((ICategoryAdapter) model).getOwnerDescription(); - } - - return model; - } - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() - { - super.refresh(); - - // Set nameText - if (nameText == null || nameText.isFocusControl()) { - return; - } - setListenerEnabled(false); - nameText.setText(""); //$NON-NLS-1$ - if (getDescription() instanceof INamedObject) { - nameText.setText(((INamedObject) getDescription()).getName()); - } - setListenerEnabled(true); - - - // Set targetNamespaceText and prefixText - if (targetNamespaceText == null || targetNamespaceText.isFocusControl() || handlingEvent) - { - return; - } - setListenerEnabled(false); - Object obj = getDescription(); - if (obj instanceof IDescription) - { - IDescription description = (IDescription) obj; - String targetNS = description.getTargetNamespace(); - String newPrefix = description.getTargetNamespacePrefix(); - prefixText.setText(newPrefix != null ? newPrefix : ""); //$NON-NLS-1$ - - // set targetnamespace field and prefix field - if (targetNS != null) - { - targetNamespaceText.setText(targetNS); - } - else - { - targetNamespaceText.setText(""); //$NON-NLS-1$ - } - if (newPrefix != null) - { - prefixText.setText(newPrefix); - } - } - setListenerEnabled(true); - } - - - public void widgetSelected(SelectionEvent e) - { - if (e.widget == button) { - Object obj = getDescription(); - if (obj instanceof IDescription) { - IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart(); - ASDEditNamespacesAction action = new ASDEditNamespacesAction(part, (IDescription) obj); - action.run(); - refresh(); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java deleted file mode 100644 index 2c3544689..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -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 ParameterSection extends NameSection { - protected CLabel comboLabel; - protected CCombo combo; - protected boolean handleTypeScenario = true; - protected ComponentReferenceEditManager parameterRefManager; - - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - createControlArea(); - } - - public void createControlArea() - { - FormData data; - - combo = getWidgetFactory().createCCombo(composite); - combo.setBackground(composite.getBackground()); - combo.addListener(SWT.Modify, this); - combo.addListener(SWT.DefaultSelection, this); - combo.addListener(SWT.Traverse, this); - - comboLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_TYPE + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(combo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, 0, SWT.CENTER); - comboLabel.setLayoutData(data); - -// Button button = getWidgetFactory().createButton(composite, "", SWT.PUSH); //$NON-NLS-1$ -// button.setImage(InterfaceUIPlugin.getDefault().getImage("icons/obj16/browsebutton.gif")); //$NON-NLS-1$ -// -// button.addSelectionListener(this); -// data = new FormData(); -// data.left = new FormAttachment(100, -rightMarginSpace + 2); -// data.right = new FormAttachment(100, 0); -// data.top = new FormAttachment(typeCombo, 0, SWT.CENTER); -// button.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 100); -// data.right = new FormAttachment(button, 0); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); - combo.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - if (nameText.isFocusControl()) { - return; - } - - setListenerEnabled(false); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PART_ELEMENT_COMBO); - - if (handleTypeScenario) { - refreshCombo(); - PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PART_TYPE_COMBO); - } - - setControlForegroundColor(combo); - - setListenerEnabled(true); - } - - protected void refreshCombo() { - IParameter param = null; - Object model = getModel(); - setListenerEnabled(false); - - if (model instanceof IParameter) { - param = (IParameter) model; - } - - String name = ""; //$NON-NLS-1$ - String typeName = ""; //$NON-NLS-1$ - if (param != null) { - name = param.getName(); - typeName = param.getComponentName(); - } - - if (!nameText.isFocusControl()) { - nameText.setText(name); - } - - // Populate the type Combo - combo.removeAll(); - combo.add(BROWSE_STRING); - combo.add(NEW_STRING); - - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - if (editManager != null) { - ComponentSpecification[] specs = editManager.getQuickPicks(); - for (int index = 0; index < specs.length; index++) { - combo.add((String) specs[index].getName()); - } - - specs = editManager.getHistory(); - for (int index = 0; index < specs.length; index++) { - combo.add((String) specs[index].getName()); - } - } - - // Display the type in the Combo - String[] items = combo.getItems(); - int index; - for (index = 0; index < items.length; index++) { - if (items[index].equals(typeName)) { - break; - } - } - - if (index < items.length) { - // Found a match - combo.select(index); - } - else { - combo.setText(typeName); - } - - setListenerEnabled(true); - } - - public boolean shouldUseExtraSpace() - { - return false; - } - - public void handleEvent(Event event) - { - if (event.widget == combo) { - if (isListenerEnabled() && !isInDoHandle) - { - if (event.type == SWT.Traverse) { - if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) { - isTraversing = true; - } - } - else { - isInDoHandle = true; - startDelayedEvent(event); - isInDoHandle = false; - } - } - } - else { - super.handleEvent(event); - } - } - - public void doHandleEvent(Event event) - { - super.doHandleEvent(event); - if (event.widget == combo && !combo.isDisposed()) { - String selectedItem = combo.getItem(combo.getSelectionIndex()); - if (shouldPerformComboSelection(event, selectedItem)) - { - handleComboSelection(); - refresh(); - } - } - } - - protected void handleComboSelection() { - String value = combo.getItem(combo.getSelectionIndex()); - - IParameter parameter = (IParameter) this.getModel(); - - if (value.equals(NEW_STRING)) { - Command command = parameter.getSetTypeCommand(IParameter.SET_NEW_ACTION_ID); - command.execute(); - } - else if (value.equals(BROWSE_STRING)) { - Command command = parameter.getSetTypeCommand(IParameter.SELECT_EXISTING_ACTION_ID); - command.execute(); - } - else { - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - ComponentSpecification spec = getComponentSpecificationForValue((String)value); - if (spec != null) { - editManager.modifyComponentReference(parameter, spec); - } - } - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() { - if (parameterRefManager != null) { - return parameterRefManager; - } - if (getModel() instanceof IASDObject) - { - parameterRefManager = ReferenceEditManagerHelper.getXSDTypeReferenceEditManager((IASDObject) getModel()); - } - else - { - System.out.println("model" + getModel()); //$NON-NLS-1$ - } - return parameterRefManager; - } - - // 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 Direct Edit...(TypeReferenceDirectEditManager) 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; - } - - public void dispose() - { - if (combo != null && !combo.isDisposed()) - { - combo.removeListener(SWT.Modify, this); - combo.removeListener(SWT.DefaultSelection, this); - combo.removeListener(SWT.Traverse, this); - } - super.dispose(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java deleted file mode 100644 index 8cd328bf3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -public abstract class ReferenceSection extends NameSection { - protected CCombo combo; - protected CLabel comboLabel; - - protected List itemsInCombo = new ArrayList(); - - /** - * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) - */ - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) - { - super.createControls(parent, factory); - FormData data; - - // Create Combo row of widgets - comboLabel = getWidgetFactory().createCLabel(composite, "Reference"); //$NON-NLS-1$ - combo = getWidgetFactory().createCCombo(composite); - combo.setBackground(composite.getBackground()); - - // Layout Combo Label - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(combo, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, 0, SWT.CENTER); - comboLabel.setLayoutData(data); - - // Layout Combo - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); - combo.setLayoutData(data); - - combo.addListener(SWT.Modify, this); - combo.addListener(SWT.DefaultSelection, this); - combo.addListener(SWT.Traverse, this); - } - - public void handleEvent(Event event) - { - if (event.widget == combo) { - if (isListenerEnabled() && !isInDoHandle) { - if (event.type == SWT.Traverse) { - if (event.detail == SWT.TRAVERSE_ARROW_NEXT || event.detail == SWT.TRAVERSE_ARROW_PREVIOUS) - isTraversing = true; - } - else { - isInDoHandle = true; - startDelayedEvent(event); - isInDoHandle = false; - } - } - } - else { - super.handleEvent(event); - } - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - combo.removeListener(SWT.Modify, this); - combo.removeListener(SWT.DefaultSelection, this); - combo.removeListener(SWT.Traverse, this); - - super.refresh(); - - List comboItems = getComboItems(); - if (comboItems.size() > 0) { - combo.removeAll(); - itemsInCombo.clear(); - - // We need to populate this combo with the available references - // TODO: rmah: We should include the prefix as well - String currentComboItemName = getComboItemName(getCurrentComboItem()); - int currentBindingIndex = -1; - - List items = getComboItems(); - for (int index = 0; index < items.size(); index++) { - Object item = items.get(index); - String itemName = getComboItemName(item); - combo.add(itemName); - itemsInCombo.add(item); - - if (itemName.equals(currentComboItemName)) { - currentBindingIndex = index; - } - } - - if (currentBindingIndex != -1) { - combo.select(currentBindingIndex); - } - } - - setControlForegroundColor(combo); - combo.addListener(SWT.Modify, this); - combo.addListener(SWT.DefaultSelection, this); - combo.addListener(SWT.Traverse, this); - } - - protected abstract List getComboItems(); - protected abstract Object getCurrentComboItem(); - protected abstract String getComboItemName(Object item); - protected abstract void performComboSelection(Object item); - - public boolean shouldUseExtraSpace() - { - return false; - } - - public void doHandleEvent(Event event) - { - super.doHandleEvent(event); - if (event.widget == combo && !combo.isDisposed()) { - int selectionIndex = combo.getSelectionIndex(); - Object selectedItem = itemsInCombo.get(selectionIndex); - - if (shouldPerformComboSelection(event, selectedItem)) - { - performComboSelection(selectedItem); - refresh(); - } - } - } - - public void dispose() - { - if (combo != null && !combo.isDisposed()) - { - combo.removeListener(SWT.Modify, this); - combo.removeListener(SWT.DefaultSelection, this); - combo.removeListener(SWT.Traverse, this); - } - super.dispose(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/ASDEditPartFactoryHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/ASDEditPartFactoryHelper.java deleted file mode 100644 index 389b559f2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/ASDEditPartFactoryHelper.java +++ /dev/null @@ -1,51 +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.util; - -import org.eclipse.gef.EditPartFactory; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicalViewer; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ASDEditPartFactory; - -/** - * @depracated - */ -public class ASDEditPartFactoryHelper { - private static ASDEditPartFactoryHelper instance; - - private EditPartFactory editPartFactory; - - public static ASDEditPartFactoryHelper getInstance() { - if (instance == null) { - instance = new ASDEditPartFactoryHelper(); - } - - return instance; - } - - public EditPartFactory getEditPartFactory() { - if (editPartFactory == null) { - editPartFactory = new ASDEditPartFactory(); - } - return editPartFactory; - } - - public void setEditPartFactory(EditPartFactory factory) { - editPartFactory = factory; - IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Object adapter = editor.getAdapter(GraphicalViewer.class); - if (adapter instanceof DesignViewGraphicalViewer) { - ((DesignViewGraphicalViewer) adapter).setEditPartFactory(factory); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/EndPointComparator.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/EndPointComparator.java deleted file mode 100644 index bf9a3ab6e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/EndPointComparator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.util; - -import java.util.Comparator; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; - -public class EndPointComparator implements Comparator { - public int compare(Object o1, Object o2) { - if (o1 instanceof IEndPoint && o2 instanceof IEndPoint) { - IBinding binding1 = ((IEndPoint) o1).getBinding(); - IBinding binding2 = ((IEndPoint) o2).getBinding(); - - if (binding1 != null && binding2 != null) { - IInterface interface1 = binding1.getInterface(); - IInterface interface2 = binding2.getInterface(); - - if (interface1 != null && interface2 != null) { - String name1 = interface1.getName(); - String name2 = interface2.getName(); - return name1.compareTo(name2); - } - - return doNullComparison(interface1, interface2); - } - - return doNullComparison(binding1, binding2); - } - - return doNullComparison(o1, o2); - } - - private int doNullComparison(Object o1, Object o2) { - if (o1 != null && o2 == null) { - return -1; - } - else if (o1 == null && o2 != null) { - return 1; - } - - return 0; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/IOpenExternalEditorHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/IOpenExternalEditorHelper.java deleted file mode 100644 index 8ba3df411..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/IOpenExternalEditorHelper.java +++ /dev/null @@ -1,19 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.util; - -public interface IOpenExternalEditorHelper { - public void setModel(Object object); - public void openExternalEditor(); - public boolean linkApplicable(); - public boolean isValid(); - public void showPreview(); -} |