diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal')
106 files changed, 0 insertions, 9565 deletions
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 89046b0a5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDEditorPlugin.java +++ /dev/null @@ -1,62 +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 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 d72780786..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDLabelProvider.java +++ /dev/null @@ -1,69 +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.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class ASDLabelProvider extends LabelProvider { - /** - * - */ - public ASDLabelProvider() { - super(); - } - - /** - * @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(); - - 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(); - - if (selected instanceof ITreeElement) { - result = ((ITreeElement) selected).getText(); - } - - if (selected instanceof IASDObject && ((IASDObject) selected).isReadOnly()) { - result = result + " (" + Messages.getString("_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 19407913d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/ASDMultiPageEditor.java +++ /dev/null @@ -1,232 +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.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.ui.IFileEditorInput; -import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -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.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.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.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.outline.ASDContentOutlineProvider; -import org.eclipse.wst.wsdl.ui.internal.asd.properties.sections.ASDTabbedPropertySheetPage; -import org.eclipse.wst.wsdl.ui.internal.asd.util.IOpenExternalEditorHelper; -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; - - /** - * 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$ - } - - public IContentOutlinePage getContentOutlinePage() { - if ((fOutlinePage == null) || fOutlinePage.getControl() == null || (fOutlinePage.getControl().isDisposed())) { - ASDContentOutlineProvider provider = new ASDContentOutlineProvider(this, model); - - ASDContentOutlinePage outlinePage = new ASDContentOutlinePage(this, menuProvider); - outlinePage.setContentProvider(provider); - outlinePage.setLabelProvider(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(0); - } - - protected ScrollingGraphicalViewer getGraphicalViewer() - { - return new DesignViewGraphicalViewer(this, getSelectionManager()); - } - - public void buildAndSetModel() { - model = buildModel((IFileEditorInput)getEditorInput()); - } - - abstract public IDescription buildModel(IFileEditorInput editorInput); - - protected void createActions() - { - ActionRegistry registry = getActionRegistry(); - - BaseSelectionAction 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 ASDAddSchemaAction(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(); - } - - 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()); - } - - public abstract IOpenExternalEditorHelper getOpenExternalEditorHelper(); -} 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 3d5867209..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/Messages.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.wst.wsdl.ui.internal.asd; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.wst.wsdl.ui.internal.asd.messages"; //$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 + '!'; - } - } -} 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 65921ae1b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddBindingAction.java +++ /dev/null @@ -1,46 +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.getString("_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); - } - } - } -}
\ 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 336a58bbc..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddEndPointAction.java +++ /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 - *******************************************************************************/ -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.getString("_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); - } - } - } -}
\ 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 9b0b2429b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddFaultAction.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.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.getString("_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); - } - } - } -}
\ 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 48b4f9471..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddImportAction.java +++ /dev/null @@ -1,46 +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.getString("_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); - } - } - } -}
\ 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 53b922d41..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInputAction.java +++ /dev/null @@ -1,54 +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.getString("_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); - } - } - } -}
\ 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 eb8e770f4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddInterfaceAction.java +++ /dev/null @@ -1,46 +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 ASDAddInterfaceAction extends BaseSelectionAction { - public static String ID = "ASDAddInterfaceAction"; //$NON-NLS-1$ - - public ASDAddInterfaceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_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); - } - } - } -}
\ 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/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 c75b41f46..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddMessageAction.java +++ /dev/null @@ -1,46 +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.getString("_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); - } - } - } -}
\ 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 6981f2cdf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOperationAction.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.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.getString("_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); - } - } - } -}
\ 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/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 9366de952..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddOutputAction.java +++ /dev/null @@ -1,54 +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.getString("_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); - } - } - } -}
\ 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/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 8db980483..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddSchemaAction.java +++ /dev/null @@ -1,46 +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.getString("_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); - } - } - } -}
\ 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 6ede763f4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDAddServiceAction.java +++ /dev/null @@ -1,46 +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 ASDAddServiceAction extends BaseSelectionAction { - public static String ID = "ASDAddServiceAction"; //$NON-NLS-1$ - - public ASDAddServiceAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_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); - } - } - } -}
\ 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/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 c169d8d7a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDDeleteAction.java +++ /dev/null @@ -1,77 +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; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport; -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.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 ASDDeleteAction extends BaseSelectionAction { - public static String ID = "ASDDeleteAction"; //$NON-NLS-1$ - - public ASDDeleteAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_DELETE")); //$NON-NLS-1$ - setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/delete_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object object = getSelectedObjects().get(0); - Command command = null; - - if (object instanceof IService) { - command = ((IService) object).getDeleteCommand(); - } - else if (object instanceof IEndPoint) { - command = ((IEndPoint) object).getDeleteCommand(); - } - else if (object instanceof IBinding) { - command = ((IBinding) object).getDeleteCommand(); - } - else if (object instanceof IInterface) { - command = ((IInterface) object).getDeleteCommand(); - } - else if (object instanceof IOperation) { - command = ((IOperation) object).getDeleteCommand(); - } - else if (object instanceof IMessageReference) { - command = ((IMessageReference) object).getDeleteCommand(); - } - else if (object instanceof IParameter) { - command = ((IParameter) object).getDeleteCommand(); - } - else if (object instanceof IImport) { - command = ((IImport) object).getDeleteCommand(); - } - else if (object instanceof IMessage) { - command = ((IMessage) object).getDeleteCommand(); - } - - if (command != null) { - 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/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 38d1a9ced..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, 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.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 ""; - } - - /* - * Sub-classes should override this method. - */ - public IFigure getFeedbackFigure() { - return 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/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/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 f86b172ad..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDGenerateBindingAction.java +++ /dev/null @@ -1,41 +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.getString("_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); - } - } - } -} 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 7cf20d535..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingBindingAction.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.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -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.edit.W11BindingReferenceEditManager; -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.getString("_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; - } - } - } - - if (endPoint != null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11BindingReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - ComponentReferenceEditManager refManager = (ComponentReferenceEditManager) editor.getAdapter(W11BindingReferenceEditManager.class); - 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 10f8e1683..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetExistingInterfaceAction.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.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -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; -import org.eclipse.wst.wsdl.ui.internal.edit.W11InterfaceReferenceEditManager; -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.getString("_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; - } - } - } - - if (binding != null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11InterfaceReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - ComponentReferenceEditManager refManager = (ComponentReferenceEditManager) editor.getAdapter(W11InterfaceReferenceEditManager.class); - 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 f193119b8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewBindingAction.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.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -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.edit.W11BindingReferenceEditManager; -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.getString("_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; - } - } - } - - if (endPoint != null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11BindingReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - ComponentReferenceEditManager refManager = (ComponentReferenceEditManager) editor.getAdapter(W11BindingReferenceEditManager.class); - 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 c93281a93..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/ASDSetNewInterfaceAction.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.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -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; -import org.eclipse.wst.wsdl.ui.internal.edit.W11InterfaceReferenceEditManager; -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.getString("_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; - } - } - } - - if (binding != null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11InterfaceReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - ComponentReferenceEditManager refManager = (ComponentReferenceEditManager) editor.getAdapter(W11InterfaceReferenceEditManager.class); - 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 cd1232b30..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/actions/BaseSelectionAction.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 java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.ui.actions.SelectionAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; - -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; - } -}
\ 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/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 0fcd8fa36..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewContextMenuProvider.java +++ /dev/null @@ -1,143 +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.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.design.editparts.ColumnEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.IActionProvider; - - -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; - 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 (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 (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(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 acf78c4e5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicalViewer.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.xsd.ui.internal.adt.editor.CommonSelectionManager; - -public class DesignViewGraphicalViewer extends ScrollingGraphicalViewer implements ISelectionChangedListener -{ - protected ASDSelectionChangedListener internalSelectionProvider = new ASDSelectionChangedListener(); -//TODO Make this generic - public DesignViewGraphicalViewer(IEditorPart editor, CommonSelectionManager manager) - { - super(); - setContextMenu(new DesignViewContextMenuProvider(this, this)); - editor.getEditorSite().registerContextMenu("org.eclipse.wst.wsdl.editor.popup.graph", getContextMenu(), internalSelectionProvider, false); //$NON-NLS-1$ - - // make the internalSelectionProvider listen to graph view selection changes - addSelectionChangedListener(internalSelectionProvider); - internalSelectionProvider.addSelectionChangedListener(manager); - manager.addSelectionChangedListener(this); - } - - // 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 741152774..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/DesignViewGraphicsConstants.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Display; - -/** - * A collection of color and font related constants. - */ -public interface DesignViewGraphicsConstants -{ - public final static Display display = Display.getDefault(); - - public final static Color groupBorderColor = new Color(null, 118, 134, 164); - public final static Color groupHeaderColor = new Color(null, 232, 240, 248); - - public final static Color elementBorderColor = new Color(null, 120, 152, 184); - public final static Color elementBackgroundColor = new Color(null, 232, 240, 248); - public final static Color elementLabelColor = new Color(null, 80, 102, 144); - public final static Color readOnlyBorderColor = new Color(null, 164, 164, 164); - public final static Color red = new Color(null, 255, 0, 0); - - public final static Color tableOperationHeadingColor = new Color(null, 224, 233, 246); - public final static Color tableMessageHeadingColor = new Color(null, 230, 240, 245); - public final static Color tableCellSelectionColor = new Color(null, 238, 232, 170); //new Color(null, 240, 230, 140); //1, 15, 42); - - public final static Color readOnlyBackgroundColor = ColorConstants.white; - public final static Color readOnlyLabelColor = ColorConstants.gray; - public final static Color labelColor = ColorConstants.black; - - public final static Font smallBoldFont = new Font(Display.getCurrent(), "Tahoma", 8, SWT.BOLD); //$NON-NLS-1$ - public final static Font mediumFont = new Font(Display.getCurrent(), "Tahoma", 10, SWT.NONE); //$NON-NLS-1$ - public final static Font mediumBoldFont = new Font(Display.getCurrent(), "Tahoma", 10, SWT.BOLD); //$NON-NLS-1$ -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/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/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 5ec87ce1f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ASDComboBoxCellEditor.java +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.directedit; - -import java.text.MessageFormat; - -import org.eclipse.jface.util.Assert; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -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. - */ - CCombo comboBox; - - /** - * Used to determine if the value should be applied to the cell. - */ - private boolean continueApply; - private Object selectedValue; - private ComponentReferenceEditManager componentReferenceEditManager; - - /** - * 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(); - } - - /* (non-Javadoc) - * Method declared on CellEditor. - */ - protected Control createControl(Composite parent) { - - comboBox = new CCombo(parent, getStyle()); - comboBox.setFont(parent.getFont()); - - 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) { - applyEditorValueAndDeactivate(); - } - - public void widgetSelected(SelectionEvent event) { - Object newValue = null; - continueApply = true; - selection = comboBox.getSelectionIndex(); - String stringSelection = items[selection]; - - if (stringSelection.equals(Messages.getString("_UI_BUTTON_BROWSE"))) { //$NON-NLS-1$ - newValue = invokeDialog(componentReferenceEditManager.getBrowseDialog()); - } - else if (stringSelection.equals(Messages.getString("_UI_BUTTON_NEW"))) { //$NON-NLS-1$ - newValue = invokeDialog(componentReferenceEditManager.getNewDialog()); - } - - if (continueApply) { - if (newValue == null) { - int index = comboBox.getSelectionIndex(); - if (index != -1) { - selectedValue = comboBox.getItem(index); - } - } - else { - selectedValue = newValue; - } - - applyEditorValueAndDeactivate(); - } - } - }); - - comboBox.addTraverseListener(new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - if (e.detail == SWT.TRAVERSE_ESCAPE - || e.detail == SWT.TRAVERSE_RETURN) { - e.doit = false; - } - } - }); - - comboBox.addFocusListener(new FocusAdapter() { - public void focusLost(FocusEvent e) { - ASDComboBoxCellEditor.this.focusLost(); - } - }); - return comboBox; - } - - private Object invokeDialog(IComponentDialog dialog) { - Object newValue = null; - - if (dialog == null) { - return null; - } - - if (dialog.createAndOpen() == Window.OK) { - newValue = dialog.getSelectedComponent(); - } - else { - continueApply = false; - } - - return newValue; - } - - /** - * The <code>ComboBoxCellEditor</code> implementation of - * this <code>CellEditor</code> framework method returns - * the zero-based index of the current selection. - * - * @return the zero-based index of the current selection wrapped - * as an <code>Integer</code> - */ - protected Object doGetValue() { - return new Integer(selection); - } - - /* (non-Javadoc) - * Method declared on CellEditor. - */ - protected void doSetFocus() { - comboBox.setFocus(); - } - - /** - * The <code>ComboBoxCellEditor</code> implementation of - * this <code>CellEditor</code> framework method sets the - * minimum width of the cell. The minimum width is 10 characters - * if <code>comboBox</code> is not <code>null</code> or <code>disposed</code> - * eles it is 60 pixels to make sure the arrow button and some text is visible. - * The list of CCombo will be wide enough to show its longest item. - */ - public LayoutData getLayoutData() { - LayoutData layoutData = super.getLayoutData(); - if ((comboBox == null) || comboBox.isDisposed()) - layoutData.minimumWidth = 60; - else { - // make the comboBox 10 characters wide - GC gc = new GC(comboBox); - layoutData.minimumWidth = (gc.getFontMetrics() - .getAverageCharWidth() * 10) + 10; - gc.dispose(); - } - return layoutData; - } - - /** - * The <code>ComboBoxCellEditor</code> implementation of - * this <code>CellEditor</code> framework method - * accepts a zero-based index of a selection. - * - * @param value the zero-based index of the selection wrapped - * as an <code>Integer</code> - */ - protected void doSetValue(Object value) { - Assert.isTrue(comboBox != null && (value instanceof Integer)); - selection = ((Integer) value).intValue(); - comboBox.select(selection); - } - - /** - * Updates the list of choices for the combo box for the current control. - */ - private void populateComboBoxItems() { - if (comboBox != null && items != null) { - comboBox.removeAll(); - for (int i = 0; i < items.length; i++) - comboBox.add(items[i], i); - - setValueValid(true); - selection = 0; - } - } - - /** - * Applies the currently selected value and deactiavates the cell editor - */ - void applyEditorValueAndDeactivate() { - // must set the selection before getting value - selection = comboBox.getSelectionIndex(); - Object newValue = doGetValue(); - markDirty(); - boolean isValid = isCorrect(newValue); - setValueValid(isValid); - if (!isValid) { - // try to insert the current value into the error message. - setErrorMessage(MessageFormat.format(getErrorMessage(), - new Object[] { items[selection] })); - } - fireApplyEditorValue(); - deactivate(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.CellEditor#focusLost() - */ - protected void focusLost() { - if (isActivated()) { - applyEditorValueAndDeactivate(); - } - } - - /* - * (non-Javadoc) - * @see org.eclipse.jface.viewers.CellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent) - */ - protected void keyReleaseOccured(KeyEvent keyEvent) { - if (keyEvent.character == '\u001b') { // Escape character - fireCancelEditor(); - } else if (keyEvent.character == '\t') { // tab key - applyEditorValueAndDeactivate(); - } - } - - public Object getSelectedValue() { - return selectedValue; - } -} 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 18254d3f8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/ComboBoxCellEditorManager.java +++ /dev/null @@ -1,205 +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.custom.CCombo; -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(); - - CCombo combo = (CCombo)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) - { - CCombo combo = (CCombo)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; - CCombo combo = (CCombo)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 68d81d37f..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) { - 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 09081ef45..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/LabelCellEditorLocator.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.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); - - // 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 5fa233003..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, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.directedit; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.part.CellEditorActionHandler; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.INamedEditPart; - -public class LabelEditManager extends DirectEditManager { - - private IActionBars actionBars; - private CellEditorActionHandler actionHandler; - private IAction copy, cut, paste, undo, redo, find, selectAll, delete; - private Font scaledFont; - - public LabelEditManager(GraphicalEditPart source, CellEditorLocator locator) { - super(source, null, locator); - } - - /** - * @see org.eclipse.gef.tools.DirectEditManager#bringDown() - */ - protected void bringDown() { - if (actionHandler != null) { - actionHandler.dispose(); - actionHandler = null; - } - if (actionBars != null) { - restoreSavedActions(actionBars); - actionBars.updateActionBars(); - actionBars = null; - } - - Font disposeFont = scaledFont; - scaledFont = null; - super.bringDown(); - if (disposeFont != null) - disposeFont.dispose(); - } - - public void showFeedback() { - getEditPart().showSourceFeedback(getDirectEditRequest()); - } - - protected CellEditor createCellEditorOn(Composite composite) { - return new TextCellEditor(composite, SWT.SINGLE | SWT.WRAP); - } - - protected void initCellEditor() { - Text text = (Text)getCellEditor().getControl(); - Label label = ((INamedEditPart) getEditPart()).getLabelFigure(); - - if (label != null) { - scaledFont = label.getFont(); - - // TODO: rmah: hack here to set the background color of the - // direct edit Text. Solution is to make the Text transparent... - Color color = label.getBackgroundColor(); - if (color.equals(DesignViewGraphicsConstants.tableCellSelectionColor)) { - text.setBackground(color); - } - else { - text.setBackground(ColorConstants.lightBlue); - } - - 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 0f7c69a8d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/directedit/TypeReferenceDirectEditManager.java +++ /dev/null @@ -1,150 +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.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.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; - -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.getString("_UI_BUTTON_BROWSE")); //$NON-NLS-1$ - list.add(Messages.getString("_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; - } - - protected CellEditor createCellEditor(Composite composite, String[] stringArray) - { - ASDComboBoxCellEditor cellEditor = new ASDComboBoxCellEditor(composite, stringArray, getComponentReferenceEditManager()); - //((ADTComboBoxCellEditor) cellEditor).setObjectToModify(setObject); - return cellEditor; - } - - public ComponentReferenceEditManager getComponentReferenceEditManager() { - ASDMultiPageEditor editor = (ASDMultiPageEditor) ASDEditorPlugin.getActiveEditor(); - return (ComponentReferenceEditManager) editor.getAdapter(XSDTypeReferenceEditManager.class); - } - - // 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 bc9beb126..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ASDEditPartFactory.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.jface.util.Assert; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.BindingColumn; -import org.eclipse.wst.wsdl.ui.internal.asd.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) - { - 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 5ad16e887..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/AbstractBoxtEditPart.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.ColumnData; - -public abstract class AbstractBoxtEditPart extends BaseEditPart implements INamedEditPart -{ - protected ColumnData columnData = new ColumnData(); - protected BoxComponentFigure figure; - - protected IFigure createFigure() - { - figure = new BoxComponentFigure(); - figure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(); - toolbarLayout.setStretchMinorAxis(true); - // toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_BOTTOMRIGHT); - figure.setLayoutManager(toolbarLayout); - // if(isScrollable()) - // figure.setScrollingActionListener(this); - return figure; - } - - public IFigure getContentPane() - { - return ((BoxComponentFigure) getFigure()).getContentPane(); - } - - protected void createEditPolicies() - { - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (hitTest(figure.getLabel(), cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - } - - public Label getLabelFigure() { - return figure.getLabel(); - } - - protected void refreshChildren() - { - super.refreshChildren(); - // getFigure().invalidateTree(); - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - WSDLBaseAdapter box = (WSDLBaseAdapter) getModel(); - ((BoxComponentFigure) getFigure()).getLabel().setText(box.getName()); - } - - public void addFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); - boxFigureLineBorder.setColor(ColorConstants.darkBlue); - figure.setSelected(true); - figure.repaint(); - } - - public void removeFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - figure.setSelected(false); - figure.repaint(); - } - - public ColumnData getColumnData() - { - return columnData; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java deleted file mode 100644 index b75e0cabe..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BaseEditPart.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.List; - -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -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; - - -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 addFeedback() { - - } - public void removeFeedback() { - - } - - 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); - } - - public boolean isReadOnly() { - Object model = getModel(); - if (model instanceof IASDObject) { - return ((IASDObject) model).isReadOnly(); - } - - return false; - } -} 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 c1e543cb6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingColumnEditPart.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutAnimator; -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(); - figure.setLayoutManager(layout); - return figure; - } - - protected void register() - { - super.register(); - getFigure().addLayoutListener(LayoutAnimator.getDefault()); - } - - protected void unregister() - { - getFigure().removeLayoutListener(LayoutAnimator.getDefault()); - super.unregister(); - } -} 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 f29602710..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingContentEditPart.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.design.editparts; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingOperation; - -// This class is used to represent a BindingOperation, BindingInput, BindingOutput and BindingFault -// -public class BindingContentEditPart extends BaseEditPart -{ - Label label; - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setOpaque(true); - figure.setBackgroundColor(ColorConstants.tooltipBackground); - ToolbarLayout toolbarLayout = new ToolbarLayout(true); - toolbarLayout.setStretchMinorAxis(true); - figure.setLayoutManager(toolbarLayout); - label = new Label(); - label.setBorder(new MarginBorder(5, 5, 2, 2)); - figure.add(label); - return figure; - } - - - protected List getModelChildren() - { - return Collections.EMPTY_LIST; - } - - protected void refreshVisuals() - { - if (getModel() instanceof IBindingOperation) - { - IBindingOperation bindingOperation = (IBindingOperation) getModel(); - label.setIcon(bindingOperation.getImage()); - label.setText(bindingOperation.getName()); - } - super.refreshVisuals(); - } - - protected void createEditPolicies() - { - } -} 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 0719808fe..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/BindingEditPart.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutManager; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.connections.CenteredConnectionAnchor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.connections.TopLeftConnectionAnchor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingColumnLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingContentLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.BindingLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class BindingEditPart extends BaseEditPart -{ - protected ComponentReferenceConnection connectionFigure; - protected BoxComponentFigure figure; - protected boolean isExpanded = false; - - 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 ((BoxComponentFigure) getFigure()).getContentPane(); - } - - protected List getModelChildren() - { - IBinding binding = (IBinding) getModel(); - return isExpanded ? binding.getBindingContentList() : Collections.EMPTY_LIST; - } - - public void activate() - { - super.activate(); - activateConnection(); - } - - public void deactivate() - { - super.deactivate(); - deactivateConnection(); - } - - public void addFeedback() - { - super.addFeedback(); - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); - boxFigureLineBorder.setColor(ColorConstants.darkBlue); - figure.setSelected(true); - figure.repaint(); - if (connectionFigure != null) - { - connectionFigure.setHighlight(true); - getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFigure); - } - } - - public void removeFeedback() - { - super.removeFeedback(); - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - figure.setSelected(false); - figure.repaint(); - if (connectionFigure != null) - { - connectionFigure.setHighlight(false); - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - - protected void activateConnection() - { - // If appropriate, create our connectionFigure and add it to the appropriate - // layer - if (createConnectionFigure() != null) - { - // Add our editpolicy as a listener on the connection, so it can stay in - // synch - // connectionFigure.addPropertyChangeListener((AttributeSelectionFeedbackPolicy) - // getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE)); - // connectionFigure.addMouseListener(this); - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - protected void deactivateConnection() - { - if (connectionFigure != null) - { - boolean removed = false; - removed = removeConnectionFigure(getLayer(LayerConstants.CONNECTION_LAYER)); - if (!removed) - { - removeConnectionFigure(getLayer(LayerConstants.FEEDBACK_LAYER)); - } - } - } - - - private boolean removeConnectionFigure(IFigure parent) - { - boolean contains = false; - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) - { - IFigure fig = (IFigure) it.next(); - if (fig.equals(connectionFigure)) - { - contains = true; - break; - } - } - if (contains) - { - parent.remove(connectionFigure); - } - return contains; - } - - public ComponentReferenceConnection createConnectionFigure() - { - if (connectionFigure == null && shouldDrawConnection()) - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - connectionFigure = new ComponentReferenceConnection(); - refreshConnections(); - } - } - } - return connectionFigure; - } - - protected boolean shouldDrawConnection() - { - if (isExpanded) - { - return false; - } - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - return true; - } - } - return false; - } - - protected void refreshVisuals() - { - refreshConnections(); - if (getModel() instanceof ITreeElement) - { - ITreeElement treeElement = (ITreeElement)getModel(); - figure.getLabel().setIcon(treeElement.getImage()); - } - //getViewer().getEditPartRegistry().put(Lay.class, controller); - super.refreshVisuals(); - } - - protected AbstractGraphicalEditPart getConnectionTargetEditPart() - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (connectionFigure != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - return referenceTypePart; - } - return null; - } - - protected void refreshConnections() - { - if (shouldDrawConnection()) - { - IBinding binding = (IBinding) getModel(); - Object typeBeingRef = binding.getInterface(); - if (connectionFigure != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - BoxComponentFigure boxComponentFigure = (BoxComponentFigure) referenceTypePart.getFigure(); - connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(getFigure(), CenteredConnectionAnchor.RIGHT, 0)); - connectionFigure.setTargetAnchor(new TopLeftConnectionAnchor(boxComponentFigure, boxComponentFigure.getLabel())); - connectionFigure.setHighlight(false); - connectionFigure.setVisible(true); - } - else - { - activateConnection(); - } - } - else if (connectionFigure != null) - { - connectionFigure.setVisible(false); - } - } - - protected void 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) - { - isExpanded = !isExpanded; - LayoutManager layoutManager = getFigure().getParent().getLayoutManager(); - AbstractGraphicalEditPart snapToEditPart = getConnectionTargetEditPart(); - if (layoutManager instanceof BindingColumnLayout && snapToEditPart != null) - { - BindingColumnLayout animatedBindingLayout = (BindingColumnLayout)layoutManager; - if (!isExpanded) - { - animatedBindingLayout.setExpandedBindingFigure(null); - } - else - { - animatedBindingLayout.setExpandedBindingFigure(getFigure()); - } - animatedBindingLayout.setSnapToFigure(snapToEditPart.getFigure()); - } - //Animation.markBegin(); - //Animation.run(700); - refresh(); - getFigure().invalidate(); - getFigure().getParent().invalidateTree(); - getFigure().getParent().revalidate(); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java deleted file mode 100644 index 4423a9a3b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ColumnEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - -public class ColumnEditPart extends BaseEditPart -{ - protected IFigure createFigure() - { - Figure figure = new Figure(); - ToolbarLayout layout = new ToolbarLayout(false); - layout.setStretchMinorAxis(false); - layout.setSpacing(20); - figure.setLayoutManager(layout); - return figure; - } - - public IDescription getDescription() - { - return (IDescription)getModel(); - } - - protected void createEditPolicies() - { - // TODO Auto-generated method stub - } - - protected List getModelChildren() - { - AbstractModelCollection collection = (AbstractModelCollection)getModel(); - Object children[] = collection.getChildren(); - List list = new ArrayList(); - for (int index = 0; index < children.length; index++) { - list.add(children[index]); - } - - return list; - } - - public void addFeedback() { - - } - - public void removeFeedback() { - - } -} - - - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java deleted file mode 100644 index 55fa36ee1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/DefinitionsEditPart.java +++ /dev/null @@ -1,285 +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.AbstractLayout; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Panel; -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.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; -import org.eclipse.wst.xsd.ui.internal.design.figures.SpacingFigure; - -public class DefinitionsEditPart extends BaseEditPart { - List collections = null; - Figure contentPane; - - protected IFigure createFigure() - { - Panel panel = new Panel(); - // why do we need to use a container layout? can we just set a - // margin border and get the same effect? - ContainerLayout clayout = new ContainerLayout(); - clayout.setBorder(60); - panel.setLayoutManager(clayout); - - // issue (cs) : why did we need a free form layer? - contentPane = new Figure(); - panel.add(contentPane); - - ToolbarLayout layout = new ToolbarLayout(true); - layout.setStretchMinorAxis(true); - layout.setSpacing(0); - contentPane.setLayoutManager(layout); - return panel; - } - - public IFigure getContentPane() - { - return contentPane; - } - - - protected void createEditPolicies() - { - // TODO Auto-generated method stub - } - - 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)); - } - } - return collections; - } - - public void setInput(Object object) - { - } - - // TODO: See if we really need this class. See above. If so, where should we - // put this class? - public class ContainerLayout extends AbstractLayout - { - protected boolean isHorizontal; - protected int spacing = 0; - protected int border = 0; - - public ContainerLayout() - { - this(true, 0); - } - - public ContainerLayout(boolean isHorizontal, int spacing) - { - this.isHorizontal = isHorizontal; - this.spacing = spacing; - } - - public void setHorizontal(boolean isHorizontal) - { - this.isHorizontal = isHorizontal; - } - - public void setSpacing(int spacing) - { - this.spacing = spacing; - } - - public void setBorder(int border) - { - this.border = border; - } - - protected int alignFigure(IFigure parent, IFigure child) - { - return -1; - } - - /** - * Calculates and returns the preferred size of the container - * given as input. - * - * @param figure Figure whose preferred size is required. - * @return The preferred size of the passed Figure. - * @since 2.0 - */ - protected Dimension calculatePreferredSizeHelper(IFigure parent) - { - Dimension preferred = new Dimension(); - List children = parent.getChildren(); - - for (int i=0; i < children.size(); i++) - { - IFigure child = (IFigure)children.get(i); - - Dimension childSize = child.getPreferredSize(); - - if (isHorizontal) - { - preferred.width += childSize.width; - preferred.height = Math.max(preferred.height, childSize.height); - } - else - { - preferred.height += childSize.height; - preferred.width = Math.max(preferred.width, childSize.width); - } - } - - int childrenSize = children.size(); - if (childrenSize > 1) - { - if (isHorizontal) - { - preferred.width += spacing * (childrenSize - 1); - } - else - { - preferred.height += spacing * (childrenSize - 1); - } - } - - preferred.width += border * 2; - preferred.height += border * 2; - preferred.width += parent.getInsets().getWidth(); - preferred.height += parent.getInsets().getHeight(); - - return preferred; - } - - protected Dimension calculatePreferredSize(IFigure parent, int width, int height) - { - Dimension preferred = null; - - // Here we ensure that an unexpanded container is given a size of (0,0) - // -// if (parent instanceof IExpandable) -// { -// IExpandable expandableFigure = (IExpandable)parent; -// if (!expandableFigure.isExpanded()) -// { -// preferred = new Dimension(); -// } -// } -// - if (preferred == null) - { - preferred = calculatePreferredSizeHelper(parent); - } - - return preferred; - } - - - protected void adjustLayoutLocation(IFigure parent, Dimension dimension) - { - } - - public void layout(IFigure parent) - { - List children = parent.getChildren(); - - int rx = 0; - Dimension dimension = new Dimension(); - - - for (int i=0; i < children.size(); i++) - { - IFigure child = (IFigure)children.get(i); - Dimension childSize = child.getPreferredSize(); - if (isHorizontal) - { - dimension.height = Math.max(dimension.height, childSize.height); - rx += childSize.width; - } - else - { - dimension.width = Math.max(dimension.width, childSize.width); - } - } - - //dimension.width += parent.getInsets().left; - //dimension.height += parent.getInsets().top; - - if (isHorizontal) - { - dimension.height += border*2; - dimension.width += border; - } - else - { - dimension.width += border*2; - dimension.height += border; - } - adjustLayoutLocation(parent, dimension); - - for (int i=0; i < children.size(); i++) - { - IFigure child = (IFigure)children.get(i); - Dimension childSize = child.getPreferredSize(); - - if (isHorizontal) - { - int y = -1; - - y = alignFigure(parent, child); - - if (y == -1) - { - y = (dimension.height - childSize.height) / 2; - } - - Rectangle rectangle = new Rectangle(dimension.width, y, childSize.width, childSize.height); - rectangle.translate(parent.getClientArea().getLocation()); - - - child.setBounds(rectangle); - dimension.width += childSize.width; - dimension.width += spacing; - - if (child instanceof SpacingFigure) - { - int availableHorizontalSpace = parent.getClientArea().width - rx; - dimension.width += availableHorizontalSpace; - } - } - else - { - Rectangle rectangle = new Rectangle(0, dimension.height, childSize.width, childSize.height); - rectangle.translate(parent.getClientArea().getLocation()); - - - child.setBounds(rectangle); - dimension.height += childSize.height; - dimension.height += spacing; - } - } - } - } -} 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 f915e75b7..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/EndPointEditPart.java +++ /dev/null @@ -1,316 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureCanvas; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.Panel; -import org.eclipse.draw2d.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.EditPartViewer; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalViewer; -import org.eclipse.gef.LayerConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editparts.AbstractGraphicalEditPart; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.connections.CenteredConnectionAnchor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.ComponentReferenceConnection; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; - -public class EndPointEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Label nameLabel; - protected Label addressLabel; - protected Figure addressBoxFigure; - protected ComponentReferenceConnection connectionFigure; - protected final static int MAX_ADDRESS_WIDTH = 150; - - protected IFigure createFigure() - { - figure = new Panel(); - figure.setBorder(new MarginBorder(4)); - ToolbarLayout layout = new ToolbarLayout(false); - // layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); - layout.setStretchMinorAxis(true); - figure.setLayoutManager(layout); - nameLabel = new Label(); - nameLabel.setIcon(((IEndPoint) getModel()).getImage()); - nameLabel.setLabelAlignment(Label.LEFT); - // nameLabel.setTextPlacement(PositionConstants.WEST); - figure.add(nameLabel); - Figure f1 = new Figure(); - f1.setBorder(new MarginBorder(0, 20, 0, 0)); - f1.setLayoutManager(new ToolbarLayout()); - figure.add(f1); - addressBoxFigure = new RectangleFigure(); - addressBoxFigure.setForegroundColor(ColorConstants.lightGray); - addressBoxFigure.setLayoutManager(new ToolbarLayout() - { - // here' we tweak the layout so that address labels aren't sized too wide - // the Label class automatically handles the addition of the '...' - // - protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint) - { - Dimension d = super.calculatePreferredSize(container, wHint, hHint); - d.width = Math.min(d.width, MAX_ADDRESS_WIDTH); - return d; - } - }); - f1.add(addressBoxFigure); - addressLabel = new Label(); - - addressLabel.setForegroundColor(ColorConstants.black); - addressLabel.setBorder(new MarginBorder(2, 6, 2, 6)); - addressLabel.setLabelAlignment(Label.LEFT); - addressBoxFigure.add(addressLabel); - - if (isReadOnly()) { - nameLabel.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - addressLabel.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - else { - nameLabel.setForegroundColor(DesignViewGraphicsConstants.labelColor); - addressLabel.setForegroundColor(DesignViewGraphicsConstants.labelColor); - } - - return figure; - } - - protected void 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 (hitTest(getLabelFigure(), cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - } - - public Label getLabelFigure() - { - if (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()); - refreshConnections(); - super.refreshVisuals(); - } - - public void activate() - { - super.activate(); - activateConnection(); - } - - public void deactivate() - { - super.deactivate(); - deactivateConnection(); - } - - protected void activateConnection() - { - if (createConnectionFigure() != null) - { - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - protected void deactivateConnection() - { - if (connectionFigure != null) - { - boolean removed = false; - removed = removeConnectionFigure(getLayer(LayerConstants.CONNECTION_LAYER)); - - if (!removed) { - removeConnectionFigure(getLayer(LayerConstants.FEEDBACK_LAYER)); - } - } - } - - private boolean removeConnectionFigure(IFigure parent) { - boolean contains = false; - Iterator it = parent.getChildren().iterator(); - while (it.hasNext()) { - IFigure fig = (IFigure) it.next(); - if (fig.equals(connectionFigure)) { - contains = true; - break; - } - } - - if (contains) { - parent.remove(connectionFigure); - } - - return contains; - } - - protected boolean shouldDrawConnection() - { - Object typeBeingRef = getReferencedModel(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - return true; - } - } - - return false; - } - - public ComponentReferenceConnection createConnectionFigure() - { - if (connectionFigure == null && shouldDrawConnection()) - { - Object typeBeingRef = getReferencedModel(); - if (typeBeingRef != null) - { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - if (referenceTypePart != null) - { - // We do reference another Type. Build a connection. We can make - // assumptions about anchor positioning since an attribute can only - // have a "reference" relationship, no "inheritance", no - // "is-referenced-by" - connectionFigure = new ComponentReferenceConnection(); - refreshConnections(); - } - } - } - return connectionFigure; - } - - protected void refreshConnections() { - if (shouldDrawConnection()) { - Object typeBeingRef = getReferencedModel(); - if (connectionFigure != null) { - AbstractGraphicalEditPart referenceTypePart = (AbstractGraphicalEditPart) getViewer().getEditPartRegistry().get(typeBeingRef); - connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(addressBoxFigure, CenteredConnectionAnchor.RIGHT, 0, 0)); - IFigure targetFigure = referenceTypePart.getFigure(); - connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(targetFigure, CenteredConnectionAnchor.HEADER_LEFT, 0, 10)); - connectionFigure.setHighlight(false); - connectionFigure.setVisible(true); - } - else { - activateConnection(); - } - } - else if (connectionFigure != null){ - connectionFigure.setVisible(false); - } - } - - private IFigure getFigureForFeedback() - { - return figure; - } - - public void addFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - - if (connectionFigure != null) { - connectionFigure.setHighlight(true); - getLayer(LayerConstants.FEEDBACK_LAYER).add(connectionFigure); - } - } - - public void removeFeedback() - { - IFigure figure = getFigureForFeedback(); - figure.setBackgroundColor(figure.getParent().getBackgroundColor()); - - if (connectionFigure != null) { - connectionFigure.setHighlight(false); - getLayer(LayerConstants.CONNECTION_LAYER).add(connectionFigure); - } - } - - // TODO: rmah: VERY UGLY HACK.... I don't see any other way to solve this - // issue at this time. - // EndPointEditPart contains two labels which can be direct edited. The facade - // driving EndPointEditPart - // contains a getSetNameCommand() and a getSetAddressCommand()... however, - // this class (LabelDirectEditPolicy) - // only knows about getSetNameCommand()..... This is the problem we face when - // combining two labels into - // one EditPart..... - // See LabelDirectEditPolicy.getDirectEditCommand(DirectEditRequest) - public Command getSetProperLabelCommand(String newValue) - { - // TODO: rmah: We need to translate the point... - if (translateBounds(nameLabel.getBounds()).contains(cursorLocation)) - { - return ((IEndPoint) getModel()).getSetNameCommand(newValue); - } - else if (translateBounds(addressLabel.getBounds()).contains(cursorLocation)) - { - return ((IEndPoint) getModel()).getSetAddressCommand(newValue); - } - return null; - } -} 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 6346313f0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/InterfaceEditPart.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LineBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.gef.EditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.BoxComponentFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; - -public class InterfaceEditPart extends AbstractBoxtEditPart implements IFeedbackHandler -{ - 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() - { - BoxComponentFigure figure = (BoxComponentFigure)super.createFigure(); - figure.getLabel().setIcon(((IInterface) getModel()).getImage()); - figure.setBackgroundColor(ColorConstants.orange); - figure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - figure.setLayoutManager(toolbarLayout); - return figure; - } - - 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(); - } -} 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 00c0d05f4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/MessageReferenceEditPart.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -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.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; - -public class MessageReferenceEditPart extends BaseEditPart implements IFeedbackHandler -{ - protected Figure contentPane; - protected Label label; - protected RowLayout rowLayout; - - 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(); - //label.setFont(DesignViewGraphicsConstants.mediumFont); - label.setBorder(new MarginBorder(2, 16, 2 ,10)); - figure.add(label); - - /* - RectangleFigure partsList = new RectangleFigure(); - partsList.setLayoutManager(new ToolbarLayout(false)); - partsList.add(new Label("parts1")); - partsList.add(new Label("parst2")); - figure.add(partsList); - */ - contentPane = new ListFigure(); - contentPane.setForegroundColor(ColorConstants.lightGray); - ((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(partsList, "PartsList"); - rowLayout.setConstraint(contentPane, "MessageContentPane"); //$NON-NLS-1$ - - if (isReadOnly()) { - label.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - - return figure; - } - - protected void createEditPolicies() - { - 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(); - label.setText(message.getText()); - label.setIcon(message.getImage()); - } - - protected List getModelChildren() - { - IMessageReference theMessage = (IMessageReference)getModel(); - return theMessage.getParameters(); - } - - public void addNotify() - { - InterfaceEditPart.attachToInterfaceEditPart(this, rowLayout); - super.addNotify(); - } - - public void addFeedback() { - - } - - public void removeFeedback() { - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/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 a8a86269d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/OperationEditPart.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.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.gef.EditPolicy; -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.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation; - - -public class OperationEditPart extends BaseEditPart implements INamedEditPart -{ - protected Figure contentPane; - protected Label label; - protected Label previewLabel; - private Color unselectedColor; - private Figure labelHolder; - - public OperationEditPart() - { - } - - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT); - figure.setLayoutManager(toolbarLayout); - - labelHolder = new Panel(); - labelHolder.setBackgroundColor(DesignViewGraphicsConstants.tableOperationHeadingColor); - labelHolder.setLayoutManager(new ToolbarLayout(true)); - figure.add(labelHolder); - - label = new Label("Operation"); //$NON-NLS-1$ -// label.setFont(DesignViewGraphicsConstants.smallBoldFont); - label.setBorder(new MarginBorder(2, 2,2,2)); - label.setTextAlignment(Label.LEFT); - labelHolder.add(label); - - previewLabel = new Label("preivew"); //$NON-NLS-1$ -// previewLabel.setFont(DesignViewGraphicsConstants.smallBoldFont); - previewLabel.setForegroundColor(ColorConstants.gray); - previewLabel.setBorder(new MarginBorder(2, 2,2,2)); - previewLabel.setTextAlignment(Label.LEFT); - labelHolder.add(previewLabel); - - contentPane = new ListFigure(); - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - figure.add(contentPane); - - if (isReadOnly()) { - label.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - - return figure; - } - - protected void createEditPolicies() - { - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (hitTest(label, cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - } - - public Label getLabelFigure() { - return label; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IOperation operation = (IOperation)getModel(); - label.setText(operation.getName());// + "---" + getModel()); - label.setIcon(operation.getImage()); - - previewLabel.setText(getOperationPreview()); - } - - protected String getOperationPreview() { - String inputPreview = "()"; //$NON-NLS-1$ - String outputPreview = "()"; //$NON-NLS-1$ - - Iterator kids = getModelChildren().iterator(); - while (kids.hasNext()) { - Object kid = kids.next(); - if (kid instanceof IMessageReference) { - IMessageReference messageRef = (IMessageReference) kid; - if (messageRef.getKind() == IMessageReference.KIND_INPUT) { - inputPreview = messageRef.getPreview(); - } - else if (messageRef.getKind() == IMessageReference.KIND_OUTPUT) { - outputPreview = messageRef.getPreview(); - } - } - } - - return inputPreview + " --> " + outputPreview; //$NON-NLS-1$ - } - - 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); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.java deleted file mode 100644 index 31883df31..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterEditPart.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.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.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.Request; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDDragAndDropEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDGraphNodeDragTracker; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.layouts.RowLayout; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class ParameterEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Figure contentPane; - protected Label parameterName; - protected RowLayout rowLayout = new RowLayout(); - protected Image labelImage; - - protected ASDSelectionEditPolicy selectionHandlesEditPolicy = new ASDSelectionEditPolicy(); - - protected IFigure createFigure() - { - IFigure figure = new Figure() - { - public void paint(Graphics graphics) - { - super.paint(graphics); - // 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); - } - }; - //toolbarLayout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER); - figure.setForegroundColor(ColorConstants.black); - figure.setLayoutManager(rowLayout); - /* - String x = ""; - int size = (int)(Math.random()*50); - for (int i = 0; i < size; i++) - { - x += "x"; - } - String y = ""; - int sizey = (int)(Math.random()*50); - for (int i = 0; i < sizey; i++) - { - y += "y"; - } */ - - contentPane = new Figure(); - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - - IFigure parameterNamePane = new Panel(); - toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - parameterNamePane.setLayoutManager(toolbarLayout2); - - parameterName = new Label(); - parameterName.setLabelAlignment(Label.LEFT); - parameterName.setBorder(new MarginBorder(4,10,4,10)); - - parameterNamePane.add(parameterName); - figure.add(parameterNamePane); - figure.add(contentPane); - rowLayout.setConstraint(parameterNamePane, "parameterName"); //$NON-NLS-1$ - rowLayout.setConstraint(contentPane, "parameterType"); //$NON-NLS-1$ - - labelImage = ((IParameter) getModel()).getImage(); - - if (isReadOnly()) { - parameterName.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - return figure; - } - - public void addNotify() - { - InterfaceEditPart.attachToInterfaceEditPart(this, rowLayout); - super.addNotify(); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (hitTest(parameterName, cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - } - - protected void createEditPolicies() - { - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - 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); - } - } - - 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()); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/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 4559c14d5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ParameterTypeEditPart.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts; - -import java.util.Iterator; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.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.Polygon; -import org.eclipse.draw2d.XYLayout; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.LayerConstants; -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.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.util.IOpenExternalEditorHelper; - -import org.eclipse.draw2d.MouseMotionListener.Stub; - -public class ParameterTypeEditPart extends BaseEditPart implements IFeedbackHandler, INamedEditPart -{ - protected Label parameterType; - protected RowLayout rowLayout = new RowLayout(); - - protected MyMouseEventListener mouseEventListener; - - protected IFigure createFigure() - { - IFigure figure = new Panel(); - figure.setLayoutManager(rowLayout); - - parameterType = new Label(); - parameterType.setLabelAlignment(Label.LEFT); - parameterType.setBorder(new MarginBorder(4,12,4,12)); - figure.add(parameterType); - - if (isReadOnly()) { - parameterType.setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - - return figure; - } - - protected void refreshVisuals() - { - super.refreshVisuals(); - IParameter param = (IParameter) getModel(); - String name = param.getComponentName(); - parameterType.setText(name); - } - - public void addFeedback() { - figure.setBackgroundColor(DesignViewGraphicsConstants.tableCellSelectionColor); - } - - public void removeFeedback() { - figure.setBackgroundColor(figure.getParent().getBackgroundColor()); - } - - public Label getLabelFigure() { - return parameterType; - } - - protected void createEditPolicies() - { - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - public void performDirectEdit(Point cursorLocation) { - } - - public void activate() { - super.activate(); - - // Setup a MouseMotionListener so we know when to display the 'open in XSD Editor' figure - IFigure feedBackLayer = getLayer(LayerConstants.FEEDBACK_LAYER); - if (!(feedBackLayer.getLayoutManager() instanceof XYLayout)) { - feedBackLayer.setLayoutManager(new XYLayout()); // We could probably move this line elsewhere - } - - IFigure primaryLayer = getLayer(LayerConstants.PRIMARY_LAYER); - mouseEventListener = new MyMouseEventListener(getModel()); - primaryLayer.addMouseMotionListener(mouseEventListener); - primaryLayer.addMouseListener(mouseEventListener); - } - - public void deactivate() { - if (mouseEventListener != null) { - mouseEventListener.discardLinkFigure(); - IFigure primaryLayer = getLayer(LayerConstants.PRIMARY_LAYER); - primaryLayer.removeMouseMotionListener(mouseEventListener); - primaryLayer.removeMouseListener(mouseEventListener); - } - } - - private class MyLinkFigure extends Polygon { - private PointList points = new PointList(); - public int horizontalBuffer = 4; - public int verticalBuffer = 6; - - public MyLinkFigure() { - // 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); - } - - public void setLocation(Point newLocation) { - PointList translatedPoints = new PointList(); - - for (int index = 0; index < points.size(); index++) { - Point origPoint = points.getPoint(index); - translatedPoints.addPoint(origPoint.translate(newLocation)); - } - - setPoints(translatedPoints); - } - } - - private class MyMouseEventListener extends Stub implements MouseListener { - private MyLinkFigure linkFigure; - private Object object; - private IOpenExternalEditorHelper openExternalEditorHelper; - - public MyMouseEventListener(Object object) { - this.object = object; - linkFigure = new MyLinkFigure(); - unemphasizeLinkFigure(); - } - - public void mouseMoved(MouseEvent me) { - Point pointer = me.getLocation(); - Rectangle figBounds = getFigure().getParent().getParent().getBounds(); - - if (getExternalEditorOpener().linkApplicable()) { - getLayer(LayerConstants.FEEDBACK_LAYER).add(linkFigure); - setLinkFigureLocation(); - if (pointerInRange(figBounds, pointer)) { - emphasizeLinkFigure(); - } - else { - unemphasizeLinkFigure(); - } - } - else { - if (containsLinkFigure()) { - getLayer(LayerConstants.FEEDBACK_LAYER).remove(linkFigure); - } - } - } - - private boolean containsLinkFigure() { - IFigure figure = getLayer(LayerConstants.FEEDBACK_LAYER); - Iterator it = figure.getChildren().iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item.equals(linkFigure)) { - return true; - } - } - - return false; - } - - private Rectangle getLinkFigureBounds() { - if (containsLinkFigure()) { - return linkFigure.getBounds(); - } - else { - return null; - } - } - - private boolean pointerInRange(Rectangle figBounds, Point pointer) { - Rectangle linkBounds = getLinkFigureBounds(); - - int entireX = figBounds.x; - int entireY = figBounds.y; - int entireWidth = figBounds.width + linkBounds.width + linkFigure.horizontalBuffer; - int entireHeight = figBounds.height; - Rectangle entireBounds = new Rectangle(entireX, entireY, entireWidth, entireHeight); - - return entireBounds.contains(pointer); - } - - protected void setLinkFigureLocation() { - Rectangle figureBounds = getFigure().getBounds(); - int xStart = figureBounds.x + figureBounds.width; - int yStart = figureBounds.y; - - Point aPoint = new Point(xStart, yStart); - linkFigure.setLocation(aPoint); - } - - public void discardLinkFigure() { - if (containsLinkFigure()) { - getLayer(LayerConstants.FEEDBACK_LAYER).remove(linkFigure); - } - } - - protected void emphasizeLinkFigure() { - linkFigure.setForegroundColor(ColorConstants.blue); - linkFigure.setBackgroundColor(ColorConstants.blue); - } - - protected void unemphasizeLinkFigure() { - linkFigure.setForegroundColor(ColorConstants.lightGray); - linkFigure.setBackgroundColor(ColorConstants.lightGray); - } - - public void mouseReleased(MouseEvent me) { } - public void mouseDoubleClicked(MouseEvent me) { } - public void mousePressed(MouseEvent me) { - Point pointer = me.getLocation(); - Rectangle linkFigBounds = getLinkFigureBounds(); - if (linkFigBounds == null) { - return; - } - - Rectangle testbounds = new Rectangle(linkFigBounds.x, linkFigBounds.y, 0, linkFigBounds.height); - - if (getExternalEditorOpener().linkApplicable() && pointerInRange(testbounds, pointer)) { - setLinkFigureLocation(); - // Open in XSD Editor - getExternalEditorOpener().openExternalEditor(); - } - } - - private IOpenExternalEditorHelper getExternalEditorOpener() { - if (openExternalEditorHelper == null) { - openExternalEditorHelper = ((ASDMultiPageEditor) ASDEditorPlugin.getActiveEditor()).getOpenExternalEditorHelper(); - openExternalEditorHelper.setModel(object); - } - - return openExternalEditorHelper; - } - } - }
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java deleted file mode 100644 index 9ef14bc6f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/ServiceEditPart.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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.tools.DirectEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelCellEditorLocator; -import org.eclipse.wst.wsdl.ui.internal.asd.design.directedit.LabelEditManager; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDLabelDirectEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies.ASDSelectionEditPolicy; -import org.eclipse.wst.wsdl.ui.internal.asd.design.figures.HeadingFigure; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; - -public class ServiceEditPart extends BaseEditPart implements INamedEditPart -{ - IFigure contentPane; - HeadingFigure headingFigure; - - public void addFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(2); - boxFigureLineBorder.setColor(ColorConstants.darkBlue); - headingFigure.setSelected(true); - figure.repaint(); - } - - public void removeFeedback() - { - LineBorder boxFigureLineBorder = (LineBorder) figure.getBorder(); - boxFigureLineBorder.setWidth(1); - boxFigureLineBorder.setColor(ColorConstants.black); - headingFigure.setSelected(false); - figure.repaint(); - } - - protected IFigure createFigure() - { - Figure figure = new Figure(); - figure.setBorder(new LineBorder(1)); - ToolbarLayout toolbarLayout = new ToolbarLayout(false); - toolbarLayout.setStretchMinorAxis(true); - figure.setLayoutManager(toolbarLayout); - headingFigure = new HeadingFigure(); - headingFigure.getLabel().setIcon(((IService) getModel()).getImage()); - figure.add(headingFigure); - - contentPane = new Figure() - { - public void paint(Graphics graphics) - { - super.paint(graphics); - boolean isFirst = false; - for (Iterator i = getChildren().iterator(); i.hasNext(); ) - { - Figure figure = (Figure)i.next(); - if (isFirst) - { - isFirst = false; - } - else - { - Rectangle r = figure.getBounds(); - graphics.drawLine(r.x, r.y +1, r.x + r.width, r.y + 1); - } - } - } - }; - ToolbarLayout toolbarLayout2 = new ToolbarLayout(false); - toolbarLayout2.setStretchMinorAxis(true); - contentPane.setLayoutManager(toolbarLayout2); - figure.add(contentPane); - - if (isReadOnly()) { - headingFigure.getLabel().setForegroundColor(DesignViewGraphicsConstants.readOnlyLabelColor); - } - - return figure; - } - - public IFigure getContentPane() - { - return contentPane; - } - - protected void createEditPolicies() - { - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ASDLabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ASDSelectionEditPolicy()); - } - - private DirectEditManager manager; - - public void performDirectEdit(Point cursorLocation){ - if (hitTest(headingFigure.getLabel(), cursorLocation) && !isReadOnly()) { - manager = new LabelEditManager(this, new LabelCellEditorLocator(this, cursorLocation)); - manager.show(); - } - } - - public Label getLabelFigure() { - return headingFigure.getLabel(); - } - - protected List getModelChildren() - { - IService service = (IService)getModel(); - return service.getEndPoints(); - } - - protected void refreshVisuals() - { - IService service = (IService)getModel(); - headingFigure.getLabel().setText(service.getName()); - super.refreshVisuals(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java deleted file mode 100644 index 54eeadbf0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/AbstractModelCollection.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public abstract class AbstractModelCollection implements IASDObject, ITreeElement -{ - IASDObject model; - String kind; - - public AbstractModelCollection(IASDObject model, String kind) - { - this.model = model; - this.kind = kind; - } - - public Object getModel() - { - return model; - } - - public void setModel(IASDObject model) - { - this.model = model; - } - - public String getKind() - { - return kind; - } - - public void setKind(String kind) - { - this.kind = kind; - } - - public Image getImage() { - return null; - } - - public ITreeElement getParent() { - return null; - } - - public boolean isReadOnly() { - return false; - } - - public void registerListener(IASDObjectListener listener) - { - model.registerListener(listener); - } - - public void unregisterListener(IASDObjectListener listener) - { - model.unregisterListener(listener); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/BindingColumn.java deleted file mode 100644 index 886dd74c7..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,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.editparts.model; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -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() { - Object array[] = ((IDescription)model).getBindings().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 "description"; //$NON-NLS-1$ - } -} 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 f47677ec3..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,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.editparts.model; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -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() { - Object array[] = ((IDescription)model).getInterfaces().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 "description"; //$NON-NLS-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 63b923a1c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editparts/model/ServiceColumn.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model; - -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class ServiceColumn extends AbstractModelCollection { - public ServiceColumn(IDescription description) { - super(description, "ServiceColumn"); //$NON-NLS-1$ - } - - public ITreeElement[] getChildren() { - Object array[] = ((IDescription)model).getServices().toArray(); - ITreeElement treeElement[] = new ITreeElement[array.length]; - for (int index = 0; index < array.length; index++) { - treeElement[index] = (ITreeElement) array[index]; - } - - return treeElement; - } - - public boolean hasChildren() { - ITreeElement treeElement[] = getChildren(); - if (treeElement.length > 0) { - return true; - } - - return false; - } - - public String getText() { - return "description"; //$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java deleted file mode 100644 index 68301db17..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropCommand.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import org.eclipse.draw2d.FigureCanvas; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDragAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDragReorderAction; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.MessageReferenceEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.ParameterEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class ASDDragAndDropCommand extends Command { - protected EditPartViewer viewer; - protected ChangeBoundsRequest request; - protected Point location; - protected ASDDragAction dragAction; - protected boolean canExecute = false; - - public ASDDragAndDropCommand(EditPartViewer viewer, ChangeBoundsRequest request) - { - this.viewer = viewer; - this.request = request; - - location = request.getLocation(); - EditPart targetEditPart = viewer.findObjectAt(location); - - if (targetEditPart instanceof ParameterEditPart || targetEditPart instanceof MessageReferenceEditPart) { - ((GraphicalEditPart)viewer.getRootEditPart()).getFigure().translateToRelative(location); - GraphicalEditPart movingChildEditPart; - Vector dragActions = new Vector(); - if (request.getType().equals(RequestConstants.REQ_ADD)) { // This really shouldn't be REQ_ADD.... - List list = request.getEditParts(); - if (list.size() <= 0) { - canExecute = false; - return; - } - - // Grabbing the fist selection - movingChildEditPart = (GraphicalEditPart) list.get(0); - Object model = movingChildEditPart.getModel(); - EditPart pointerEditPart = viewer.findObjectAt(location); - - if (model instanceof IParameter) { - dragActions.add(new ASDDragReorderAction(movingChildEditPart, pointerEditPart, getPointerLocation(location))); - } - else if (model instanceof IMessageReference) { - IMessageReference messageRef = (IMessageReference) model; - if (messageRef.getKind() == IMessageReference.KIND_INPUT || messageRef.getKind() == IMessageReference.KIND_OUTPUT) { - dragActions.add(new ASDDragReorderAction(movingChildEditPart, pointerEditPart, getPointerLocation(location))); -// dragActions.add(new WSDLDragSetMessageAction(movingChildEditPart, pointerEditPart, location)); - } - } - -// else if (model instanceof Fault) { -// dragActions.add(new WSDLDragSetMessageAction(movingChildEditPart, pointerEditPart, location)); -// } - } -// else if (request.getType().equals(RequestConstants.REQ_CLONE)) { -// List list = request.getEditParts(); -// if (list.size() > 0) -// { -// // Grabbing the fist selection -// movingChildEditPart = (WSDLTreeNodeEditPart) list.get(0); -// -// dragActions.add(new CopyWSDLElementAction(viewer, -// (WSDLElement) movingChildEditPart.getModel(), -// (WSDLElement) targetEditPart.getModel(), -// null)); -// } -// } - - Iterator it = dragActions.iterator(); - while (it.hasNext()) { - dragAction = (ASDDragAction) it.next(); - canExecute = dragAction.canExecute(); - if (canExecute) - break; - } - } - } - - public boolean canExecute() - { - return canExecute; - } - - public void execute() { - if (canExecute) - { - dragAction.run(); - } - } - - public IFigure getFeedbackFigure() { - if (dragAction != null) { - return dragAction.getFeedbackFigure(); - } - else { - return null; - } - } - - /* - * This method compensates for the current scroll position - */ - private Point getPointerLocation(Point origPointerLocation) { - Point compensatedLocation = origPointerLocation; - FigureCanvas figureCanvas = (FigureCanvas) viewer.getControl(); - int yOffset = figureCanvas.getViewport().getVerticalRangeModel().getValue(); - compensatedLocation.y = compensatedLocation.y + yOffset; - - return compensatedLocation; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java deleted file mode 100644 index 5c23ef3a6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDDragAndDropEditPolicy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies; - -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.ChangeBoundsRequest; - -public class ASDDragAndDropEditPolicy extends org.eclipse.gef.editpolicies.GraphicalEditPolicy { - protected EditPartViewer viewer; - protected ASDSelectionEditPolicy selectionHandlesEditPolicy; - - public ASDDragAndDropEditPolicy(EditPartViewer viewer, ASDSelectionEditPolicy selectionHandlesEditPolicy) { - this.viewer = viewer; - this.selectionHandlesEditPolicy = selectionHandlesEditPolicy; - } - - public boolean understandsRequest(Request req) { - return true; - } - - public org.eclipse.gef.commands.Command getCommand(Request request) { - ASDDragAndDropCommand command = null; - if (request instanceof ChangeBoundsRequest) { - command = new ASDDragAndDropCommand(viewer, (ChangeBoundsRequest)request); - selectionHandlesEditPolicy.setDragAndDropCommand(command); - } - return command; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java deleted file mode 100644 index 9e9f6c5fd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDGraphNodeDragTracker.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.tools.DragEditPartsTracker; - -public class ASDGraphNodeDragTracker extends DragEditPartsTracker { - protected EditPart editPart; - - public ASDGraphNodeDragTracker(EditPart editPart) { - super(editPart); - this.editPart = editPart; - } - - protected Command getCommand() { - Request request = getTargetRequest(); - return editPart.getCommand(request); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java deleted file mode 100644 index b54b6fe75..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDLabelDirectEditPolicy.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies; - -import org.eclipse.gef.EditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.DirectEditPolicy; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.EndPointEditPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject; - -public class ASDLabelDirectEditPolicy extends DirectEditPolicy { - protected Command getDirectEditCommand(DirectEditRequest request) { - Command command = null; - String labelText = (String) request.getCellEditor().getValue(); - EditPart editPart= getHost(); - - // TODO: rmah: Start VERY UGLY HACK.... I don't see any other way to solve this issue at this time. - // EndPointEditPart contains two labels which can be direct edited. The facade driving EndPointEditPart - // contains a getSetNameCommand() and a getSetAddressCommand()... however, this class (LabelDirectEditPolicy) - // only knows about getSetNameCommand()..... This is the problem we face when combining two labels into - // one EditPart..... - if (editPart instanceof EndPointEditPart) { - command = ((EndPointEditPart) editPart).getSetProperLabelCommand(labelText); - } - // End VERY UGLY HACK - else if (editPart.getModel() instanceof INamedObject) { - command = ((INamedObject) editPart.getModel()).getSetNameCommand(labelText); - } - - return command; - } - - protected void showCurrentEditValue(DirectEditRequest request) { - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java deleted file mode 100644 index fcafff427..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/editpolicies/ASDSelectionEditPolicy.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.editpolicies; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.Request; -import org.eclipse.gef.editpolicies.SelectionEditPolicy; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.IFeedbackHandler; - -public class ASDSelectionEditPolicy extends SelectionEditPolicy { - protected ASDDragAndDropCommand dragAndDropCommand; - protected IFigure feedback; - - public void setDragAndDropCommand(ASDDragAndDropCommand dragAndDropCommand) { - this.dragAndDropCommand = dragAndDropCommand; - } - - public void showSourceFeedback(Request request) - { - eraseChangeBoundsFeedback(null); - - if (dragAndDropCommand != null && dragAndDropCommand.canExecute()) { - if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType())) { - showMoveChangeBoundsFeedback((ChangeBoundsRequest) request); - } -// else if (REQ_CLONE.equals(request.getType())) { -// showCopyChangeBoundsFeedback((ChangeBoundsRequest) request); -// } - } - } - - /** - * Erase feedback indicating that the receiver object is - * being dragged. This method is called when a drag is - * completed or cancelled on the receiver object. - * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag. - */ - public void eraseSourceFeedback(Request request) - { - if (REQ_MOVE.equals(request.getType()) || REQ_ADD.equals(request.getType())) - { - eraseChangeBoundsFeedback((ChangeBoundsRequest)request); - } - } - - /** - * Erase feedback indicating that the receiver object is - * being dragged. This method is called when a drag is - * completed or cancelled on the receiver object. - * @param dragTracker org.eclipse.gef.tools.DragTracker The drag tracker of the tool performing the drag. - */ - protected void eraseChangeBoundsFeedback(ChangeBoundsRequest request) - { - if (feedback != null) - { - removeFeedback(feedback); - } - feedback = null; - } - - protected void showMoveChangeBoundsFeedback(ChangeBoundsRequest request) - { - if (dragAndDropCommand != null && dragAndDropCommand.getFeedbackFigure() != null) { - feedback = dragAndDropCommand.getFeedbackFigure(); - addFeedback(feedback); - } - } - - protected void hideSelection() { - if (getHost() instanceof IFeedbackHandler) { - ((IFeedbackHandler) getHost()).removeFeedback(); - } - } - - protected void showSelection() { - if (getHost() instanceof IFeedbackHandler) { - ((IFeedbackHandler) getHost()).addFeedback(); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java deleted file mode 100644 index 5ba5c3d2b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/BoxComponentFigure.java +++ /dev/null @@ -1,53 +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 -{ - 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(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java deleted file mode 100644 index 22602a73e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ComponentReferenceConnection.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.figures; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.ConnectionRouter; -import org.eclipse.draw2d.PolygonDecoration; -import org.eclipse.draw2d.PolylineConnection; -import org.eclipse.swt.graphics.Color; - -public class ComponentReferenceConnection extends PolylineConnection -{ - protected boolean highlight = false; - protected static final Color activeConnection = ColorConstants.black; - protected static final Color inactiveConnection = new Color(null, 198, 195, 198); - - /** - * Default constructor - */ - public ComponentReferenceConnection() - { - super(); - setTargetDecoration(new PolygonDecoration()); - } - - public void setConnectionRouter(ConnectionRouter cr) - { - if (cr != null && getConnectionRouter() != null)// TODO:.... && !(getConnectionRouter() instanceof BOManhattanConnectionRouter)) - super.setConnectionRouter(cr); - } - - /** - * @return Returns the current highlight status. - */ - public boolean isHighlighted() - { - return highlight; - } - - /** - * @param highlight - * The highlight to set. - */ - public void setHighlight(boolean highlight) - { - this.highlight = highlight; - setForegroundColor(highlight ? activeConnection : inactiveConnection); - setOpaque(highlight); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.java deleted file mode 100644 index 7a63d2d83..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/HeadingFigure.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.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 -{ - 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 = isSelected ? (isReadOnly ? gradientColor[3] : gradientColor[2]) : gradientColor[1]; - 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/ListFigure.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java deleted file mode 100644 index 028563aca..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/figures/ListFigure.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.design.figures; - -import java.util.Iterator; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.geometry.Rectangle; - -public class ListFigure extends Figure -{ - boolean isOpaque = false; - boolean isHorizontal = false; - boolean paintFirstLine = true; - - public ListFigure(boolean isHorizontal) - { - this.isHorizontal = isHorizontal; - } - - public ListFigure() - { - this(false); - } - - public void paint(Graphics graphics) - { - super.paint(graphics); - boolean isFirst = true; - for (Iterator i = getChildren().iterator(); i.hasNext();) - { - Figure figure = (Figure) i.next(); - if (isFirst && !paintFirstLine) - { - isFirst = false; - } - else - { - Rectangle r = figure.getBounds(); - if (isHorizontal) - { - graphics.drawLine(r.x, r.y, r.x, r.y + r.height); - } - else - { - graphics.drawLine(r.x, r.y, r.x + r.width, r.y); - } - } - } - } - - public boolean isOpaque() - { - return isOpaque; - } - - public void setOpaque(boolean isOpaque) - { - this.isOpaque = isOpaque; - } - - public boolean isPaintFirstLine() - { - return paintFirstLine; - } - - public void setPaintFirstLine(boolean paintFirstLine) - { - this.paintFirstLine = paintFirstLine; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java deleted file mode 100644 index 60e8090be..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingColumnLayout.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.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; - -public class BindingColumnLayout extends AbstractLayout -{ - IFigure expandedBindingFigure; - IFigure snapToFigure; - - 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) - { - 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; - - if (child == expandedBindingFigure && snapToFigure != null) - { - Rectangle b = snapToFigure.getBounds(); - int width = 30; - child.setBounds(new Rectangle(b.x - width, b.y, width, b.height)); - } - - r.y += d.height; - r.y += 80; - } - /* - int space = clientArea.height - used; - int spacePerThingee = space / container.getChildren().size() - 1; - boolean isFirst = true; - for (Iterator i = container.getChildren().iterator(); i.hasNext();) - { - Figure child = (Figure) i.next(); - if (isFirst) - { - isFirst = false; - } - else if (child != expandedBindingFigure || snapToFigure == null) - { - child.getBounds().y += spacePerThingee; - } - }*/ - } - - public IFigure getExpandedBindingFigure() - { - return expandedBindingFigure; - } - - public void setExpandedBindingFigure(IFigure expandedBindingFigure) - { - this.expandedBindingFigure = expandedBindingFigure; - } - - public IFigure getSnapToFigure() - { - return snapToFigure; - } - - public void setSnapToFigure(IFigure snapToFigure) - { - this.snapToFigure = snapToFigure; - } -} 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 5f5564e1e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/design/layouts/BindingContentLayout.java +++ /dev/null @@ -1,99 +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.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); - } - 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 8d0b3d845..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IASDObject.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; - - -public interface IASDObject -{ - public void registerListener(IASDObjectListener listener); - public void unregisterListener(IASDObjectListener listener); - - public boolean isReadOnly(); -}
\ No newline at end of file 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 444b9cca3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IBinding.java +++ /dev/null @@ -1,29 +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 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(); - public Command getDeleteCommand(); -} 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 5e962d1ca..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IDescription.java +++ /dev/null @@ -1,36 +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 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(); -} 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 a2efcd306..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, 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 org.eclipse.gef.commands.Command; - -public interface IEndPoint extends INamedObject -{ - public IService getOwnerService(); - public String getAddress(); - public IBinding getBinding(); - - public Command getSetBindingCommand(IBinding binding); - public Command getSetAddressCommand(String newAddress); - public Command getDeleteCommand(); -} 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 a66910c1b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IImport.java +++ /dev/null @@ -1,22 +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 org.eclipse.gef.commands.Command; - -public interface IImport extends INamedObject { - public String getNamespace(); - public String getNamespacePrefix(); - public String getLocation(); - - public IDescription getOwnerDescription(); - public Command getDeleteCommand(); -} 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 a9c60a46c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IInterface.java +++ /dev/null @@ -1,22 +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 IInterface extends INamedObject { - public List getOperations(); - - public Command getAddOperationCommand(); - public Command getDeleteCommand(); -} 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 5c5544b05..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessage.java +++ /dev/null @@ -1,24 +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 IMessage extends INamedObject { - public List getParts(); - - public IDescription getOwnerDescription(); - - public Command getAddPartCommand(); - public Command getDeleteCommand(); -} 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 e09c76407..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IMessageReference.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.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 String getPreview(); - - public Command getReorderParametersCommand(IParameter leftSibling, IParameter rightSibling, IParameter movingParameter); - public Command getDeleteCommand(); -} 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 1a3c420a2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/INamedObject.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.asd.facade; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public interface INamedObject extends IASDObject, ITreeElement -{ - 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 0262b1aa1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IOperation.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.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); - public Command getDeleteCommand(); -} 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 dd8ef13ff..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IParameter.java +++ /dev/null @@ -1,39 +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 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(); - public String getPreview(); - //? int getMinOccurs(); - //? int getMaxOccurs(); - - // 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); - public Command getDeleteCommand(); -} 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 108d095be..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IService.java +++ /dev/null @@ -1,22 +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 IService extends INamedObject -{ - public List getEndPoints(); - public IDescription getOwnerDescription(); - public Command getAddEndPointCommand(); - public Command getDeleteCommand(); -} 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 033e3026d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/facade/IType.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 IType extends INamedObject { - public IDescription getOwnerDescription(); -} 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 6ccc672bb..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/messages.properties +++ /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 -############################################################################### -_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 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 9cc7d9453..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlinePage.java +++ /dev/null @@ -1,95 +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.views.contentoutline.ContentOutlinePage; -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.wsdleditor", menuManager, wsdlEditor.getSelectionManager()); //$NON-NLS-1$ - } - - 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 80edf969d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ASDContentOutlineProvider.java +++ /dev/null @@ -1,137 +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.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; - protected ASDMultiPageEditor editor; - protected List listeners = new ArrayList(); - protected IDescription description; - - public ASDContentOutlineProvider(ASDMultiPageEditor editor, IDescription description) { - this.editor = editor; - this.description = description; - } - - public Object[] getChildren(Object parentElement) { - attachListener(parentElement); - if (parentElement instanceof ITreeElement) { - return ((ITreeElement) parentElement).getChildren(); - } - - 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 != null) { - viewer.refresh(); - } - } -}
\ 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 194fb5fee..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/outline/ITreeElement.java +++ /dev/null @@ -1,22 +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.swt.graphics.Image; - -public interface ITreeElement { - public final static ITreeElement[] EMPTY_LIST = {}; - ITreeElement[] getChildren(); - ITreeElement getParent(); - boolean hasChildren(); - String getText(); - Image getImage(); -} 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 3c0cbbe59..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java +++ /dev/null @@ -1,340 +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 java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.util.Assert; -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.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -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 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(); - } - - 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 (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; - } - - /** - * 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); - 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; - } - - } - - 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.labelColor); - } - } - } -} 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 1d917aea8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java +++ /dev/null @@ -1,107 +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 java.util.ArrayList; -import java.util.List; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -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.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -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.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.edit.W11InterfaceReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; - -public class BindingSection extends ReferenceSection { - protected ComponentReferenceEditManager refManager; - - public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { - super.createControls(parent, factory); - comboLabel.setText(Messages.getString("_UI_LABEL_PORTTYPE") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected List getComboItems() { - if (refManager == null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11InterfaceReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - refManager = (ComponentReferenceEditManager) editor.getAdapter(W11InterfaceReferenceEditManager.class); - } - - List items = new ArrayList(); - items.add(BROWSE_STRING); - items.add(NEW_STRING); - - ComponentSpecification[] comboItems = refManager.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; - refManager.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(); - } -} 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 70acdb10b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java +++ /dev/null @@ -1,113 +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.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -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.Modify, 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); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() - { - super.refresh(); - if (docText.isFocusControl()) - { - return; - } - setListenerEnabled(false); - docText.setText(""); //$NON-NLS-1$ - if (getModel() != 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); - } - - public void doHandleEvent(Event event) - { - if (event.widget == docText) - { -// String value = docText.getText(); - if (getModel() != 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); -// } - } - } - } -} 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 1cdc838a9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java +++ /dev/null @@ -1,203 +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 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.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.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.asd.ASDEditorPlugin; -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.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.edit.W11BindingReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; - -public class EndPointSection extends ReferenceSection { - protected Text addressText; - protected CLabel protocolValueLabel; - - 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.getString("_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); - - // Protocol Row - CLabel protocolLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_UI_LABEL_BINDING_PROTOCOL") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - protocolValueLabel = getWidgetFactory().createCLabel(composite, "----"); //$NON-NLS-1$ - - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(protocolValueLabel, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(protocolValueLabel, 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); - protocolValueLabel.setLayoutData(data); - protocolValueLabel.addListener(SWT.Modify, this); - - comboLabel.setText(Messages.getString("_UI_LABEL_BINDING") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - addressText.removeListener(SWT.Modify, this); - - super.refresh(); - - IEndPoint endPoint = (IEndPoint) getModel(); - if (endPoint.getAddress() != null) { - addressText.setText(endPoint.getAddress()); - } - if (endPoint.getBinding() != null) { - String protocolValue = endPoint.getBinding().getProtocol(); - if (protocolValue.equals("")) { //$NON-NLS-1$ - protocolValue = "----"; //$NON-NLS-1$ - } - protocolValueLabel.setText(protocolValue); - } - - setControlForegroundColor(addressText); - setControlForegroundColor(protocolValueLabel); - addressText.addListener(SWT.Modify, this); - } - - protected List getComboItems() { - if (refManager == null) { - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - // TODO: rmah: We should not know about W11BindingReferenceEditManager here.... We should a better - // way to retrieve the appropriate Reference Manager - refManager = (ComponentReferenceEditManager) editor.getAdapter(W11BindingReferenceEditManager.class); - } - - List items = new ArrayList(); - items.add(BROWSE_STRING); - items.add(NEW_STRING); - - ComponentSpecification[] comboItems = refManager.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; - refManager.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) - { - super.doHandleEvent(event); - - if (event.widget == addressText && !addressText.isDisposed()) { - String newAddress = addressText.getText(); - if (newAddress == null) { - newAddress = ""; //$NON-NLS-1$ - } - - IEndPoint endPoint = (IEndPoint) getModel(); - Command command = endPoint.getSetAddressCommand(newAddress); - 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/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 c52388621..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java +++ /dev/null @@ -1,295 +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.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.IEditorPart; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport; - -public class ImportSection extends ASDAbstractSection -{ - protected Text namespaceText, prefixText, locationText; - private String oldPrefixValue; - Button button; - 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.getString("_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); - prefixText.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(namespaceText, +ITabbedPropertyConstants.VSPACE); - prefixText.setLayoutData(data); - - CLabel prefixLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_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.getString("_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) { - if (event.widget == prefixText && locationText.getText().length() > 0 && namespaceText.getText().length() > 0) { - /* - Object input = getElement(); - Import importObj = (Import)input; -// 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); - definitionElement.setAttribute("xmlns:" + prefixText.getText(), namespaceText.getText()); - -// clearErrorMessage(); - oldPrefixValue = prefixText.getText(); - } - */ - } - } - - public void widgetSelected(SelectionEvent e) - { - if (e.widget == button) - { - /* - Object input = getElement(); - - WSDLEditor editor = (WSDLEditor)editorPart; - IFile currentWSDLFile = ((IFileEditorInput)editor.getEditorInput()).getFile(); - - SelectSingleFileDialog dialog = new SelectSingleFileDialog(WSDLEditorPlugin.getShell(), null, true); - String [] filters = { "xsd", "wsdl" }; //$NON-NLS-1$ - IFile [] excludedFiles = { currentWSDLFile }; - - dialog.addFilterExtensions(filters, excludedFiles); - dialog.create(); - dialog.getShell().setText(WSDLEditorPlugin.getWSDLString("_UI_TITLE_SELECT")); //$NON-NLS-1$ - dialog.setTitle(WSDLEditorPlugin.getWSDLString("_UI_TITLE_SELECT_FILE")); //$NON-NLS-1$ - dialog.setMessage(WSDLEditorPlugin.getWSDLString("_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)input; - 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 = XMLQuickScan.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; - } - */ - - 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 301354fa3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java +++ /dev/null @@ -1,106 +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.gef.EditPart; -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.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.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -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.INamedObject; - -public class NameSection extends ASDAbstractSection { - CLabel nameLabel; - protected Text nameText; - - /** - * @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 - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(0, 0); - nameText.setLayoutData(data); - - nameLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_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); - nameText.addListener(SWT.Modify, this); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - if (nameText.isFocusControl()) { - return; - } - - setListenerEnabled(false); - nameText.setText(""); //$NON-NLS-1$ - String name = ""; //$NON-NLS-1$ - if (getModel() instanceof INamedObject) { - name = ((INamedObject) getModel()).getName(); - } - else if (getModel() instanceof EditPart) { - Object model = ((EditPart) getModel()).getModel(); - name = ((INamedObject) model).getName(); - } - - nameText.setText(name); - setControlForegroundColor(nameText); - 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) { - Command command = namedObject.getSetNameCommand(newValue); - 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/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 bfca33e0e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java +++ /dev/null @@ -1,281 +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 java.util.List; - -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.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; -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.facade.IDescription; -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.getString("_UI_LABEL_NAME") + ":"; //$NON-NLS-1$ //$NON-NLS-2$ - String prefixString = Messages.getString("_UI_LABEL_PREFIX") + ":"; //$NON-NLS-1$ //$NON-NLS-2$ - String namespaceString = Messages.getString("_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$ - - // prefix - CLabel prefixLabel = getWidgetFactory().createCLabel(composite, prefixString); //$NON-NLS-1$ - prefixText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - - // targetnamespace - CLabel targetNamespaceLabel = getWidgetFactory().createCLabel(composite, namespaceString); //$NON-NLS-1$ - targetNamespaceText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$ - - // Advanced button - button = getWidgetFactory().createButton(composite, Messages.getString("_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); - nameText.addListener(SWT.Modify, this); - - // 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); - prefixText.addListener(SWT.Modify, this); - - // 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); - targetNamespaceText.addListener(SWT.Modify, this); - - // 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; - /* - if (event.widget == nameText) { - Object obj = getElement(); - if (obj instanceof Definition) { - Definition definition = (Definition) obj; - String uri = ""; - if (definition.getQName() != null) { - uri = definition.getQName().getNamespaceURI(); - } - definition.setQName(new QName(uri, nameText.getText())); - } - } - else if (event.widget == prefixText) { - Object obj = getElement(); - if (obj instanceof Definition) { - Definition definition = (Definition) obj; - Element element = definition.getElement(); - - // Remove the old prefix - String oldPrefix = definition.getPrefix(definition.getTargetNamespace()); - element.removeAttribute("xmlns:"+oldPrefix); - - // Set the new prefix - element.setAttribute("xmlns:" + prefixText.getText(), definition.getTargetNamespace()); - } - } - else if (event.widget == targetNamespaceText) - { - Object obj = getElement(); - if (obj instanceof Definition) - { - Definition definition = (Definition)obj; - String newValue = targetNamespaceText.getText(); - String prefix = definition.getPrefix(definition.getTargetNamespace()); - definition.setTargetNamespace(newValue); - definition.getElement().setAttribute("xmlns:" + prefix, newValue); - } - } - */ - 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(); - - 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); - - // set targetnamespace field and prefix field - if (targetNS != null) - { - targetNamespaceText.setText(targetNS); - - /* - Element element = definition.getElement(); - - String newPrefix = definition.getPrefix(targetNS); - if (newPrefix == null) newPrefix = ""; - // TODO: remove this code - if (element != null) - { - for (int index = 0; index < element.getAttributes().getLength(); index++) { - AttrImpl attr = (AttrImpl) element.getAttributes().item(index); - String nodeName = attr.getNodeName(); - String nsValue = attr.getNodeValue(); - if (nsValue.equals(targetNS)) { - if (nodeName.indexOf(":") != -1) { - String xmlnsString = nodeName.substring(0, nodeName.indexOf(":")); - - if (xmlnsString.equals("xmlns")) { - newPrefix = attr.getLocalName(); - break; - } - } - } - } - } - prefixText.setText(newPrefix); - */ - } - - - - // set name field - nameText.setText(description.getName()); - -// if (getElement() != null) -// { -// if (getElement().getElement()!= null) -// { -// String name = getElement().getElement().getAttribute("name"); //$NON-NLS-1$ -// if (name==null) name=""; -// nameText.setText(name); -// } -// } - } - setListenerEnabled(true); - } - - - public void widgetSelected(SelectionEvent e) - { - if (e.widget == button) - { - /* - Object obj = getElement(); - if (obj instanceof Definition) - { - Definition definition = (Definition)obj; - EditNamespacesAction action = new EditNamespacesAction(definition); - 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 de4bb1b5d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java +++ /dev/null @@ -1,219 +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.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.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.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; - -public class ParameterSection extends NameSection { - protected static String NEW_STRING = Messages.getString("_UI_BUTTON_NEW"); //$NON-NLS-1$ - protected static String BROWSE_STRING = Messages.getString("_UI_BUTTON_BROWSE"); //$NON-NLS-1$ - protected CLabel comboLabel; - protected CCombo combo; - protected boolean handleTypeScenario = true; - - 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.addSelectionListener(this); - - comboLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_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; - } - - if (handleTypeScenario) { - refreshCombo(); - } - - setControlForegroundColor(combo); - } - - 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 = "ParameterSection.java"; //$NON-NLS-1$ - if (param != null) { - name = param.getName(); - typeName = param.getComponentName(); - } - - 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()); - } - } - - // 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 doHandleEvent(Event event) - { - super.doHandleEvent(event); - if (event.widget == combo && handleTypeScenario) { - handleComboSelection(); - } - } - - 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() { - ASDMultiPageEditor editor = (ASDMultiPageEditor) ASDEditorPlugin.getActiveEditor(); - return (ComponentReferenceEditManager) editor.getAdapter(XSDTypeReferenceEditManager.class); - } - - // 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; - } -}
\ 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/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 0136ecda5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java +++ /dev/null @@ -1,123 +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 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; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; - -public abstract class ReferenceSection extends NameSection { - public static String BROWSE_STRING = Messages.getString("_UI_BUTTON_BROWSE"); //$NON-NLS-1$ - public static String NEW_STRING = Messages.getString("_UI_BUTTON_NEW"); //$NON-NLS-1$ - 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); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - combo.removeListener(SWT.Modify, 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); - } - - 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(); - performComboSelection(itemsInCombo.get(selectionIndex)); - refresh(); - } - } -} 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 5741cd7e5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/ASDEditPartFactoryHelper.java +++ /dev/null @@ -1,38 +0,0 @@ -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; - -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/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 ebbe6d7f6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/util/IOpenExternalEditorHelper.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.util; - -public interface IOpenExternalEditorHelper { - public void setModel(Object object); - public void openExternalEditor(); - public boolean linkApplicable(); -} |