diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org')
232 files changed, 0 insertions, 22748 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/IDesignViewerActionBarContributor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/IDesignViewerActionBarContributor.java deleted file mode 100644 index fc201a3c2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/IDesignViewerActionBarContributor.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal; - -import org.eclipse.ui.IActionBars; -import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; - -public interface IDesignViewerActionBarContributor extends ISourceViewerActionBarContributor { - public void initViewerSpecificContributions(IActionBars bars); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ISelectionMapper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ISelectionMapper.java deleted file mode 100644 index 2b6dafd95..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ISelectionMapper.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; - -import org.eclipse.jface.viewers.ISelection; - -public interface ISelectionMapper { - ISelection mapSelection(ISelection selectedObject); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/InternalWSDLMultiPageEditor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/InternalWSDLMultiPageEditor.java deleted file mode 100644 index a85aeea99..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/InternalWSDLMultiPageEditor.java +++ /dev/null @@ -1,399 +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; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.gef.ui.actions.ActionRegistry; -import org.eclipse.jface.viewers.IPostSelectionProvider; -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.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11AddPartAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingElementAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingMessageAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingTypeAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewElementAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewMessageAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewTypeAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddMessageAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.util.ASDEditPartFactoryHelper; -import org.eclipse.wst.wsdl.ui.internal.asd.util.IOpenExternalEditorHelper; -import org.eclipse.wst.wsdl.ui.internal.edit.W11BindingReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.W11InterfaceReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.W11MessageReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDElementReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDTypeReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.text.WSDLModelAdapter; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.W11OpenExternalEditorHelper; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLResourceUtil; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; -import org.eclipse.xsd.XSDSchema; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -public class InternalWSDLMultiPageEditor extends ASDMultiPageEditor -{ - ResourceSet resourceSet; - Resource wsdlResource; - - protected WSDLEditorResourceChangeHandler resourceChangeHandler; - - protected WSDLModelAdapter modelAdapter; - protected SourceEditorSelectionListener fSourceEditorSelectionListener; - protected WSDLSelectionManagerSelectionListener fWSDLSelectionListener; - - public IDescription buildModel(IFileEditorInput editorInput) - { - try - { - Object obj = null; - Document document = ((IDOMModel) getTextEditor().getModel()).getDocument(); - if (document instanceof INodeNotifier) { - INodeNotifier notifier = (INodeNotifier) document; - modelAdapter = (WSDLModelAdapter) notifier.getAdapterFor(WSDLModelAdapter.class); - if (modelAdapter == null) { - modelAdapter = new WSDLModelAdapter(); - notifier.addAdapter(modelAdapter); - obj = modelAdapter.createDefinition(document.getDocumentElement(), document); - } - if (obj == null) { - obj = modelAdapter.createDefinition(document.getDocumentElement(), document); - } - } - - if (obj instanceof Definition) - { - Definition definition = (Definition) obj; - model = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(definition); - } -// wsdlResource.setModified(false); -// } - } - catch (StackOverflowError e) - { - } - catch (Exception ex) - { - } - - return model; - } - - private XSDSchema[] getInlineSchemas() { - List types = getModel().getTypes(); - XSDSchema[] schemas = new XSDSchema[types.size()]; - for (int index = 0; index < types.size(); index++) { - W11Type type = (W11Type) types.get(index); - schemas[index] = (XSDSchema) type.getTarget(); - } - - return schemas; - } - - public Object getAdapter(Class type) { - if (type == ISelectionMapper.class) - { - return new WSDLSelectionMapper(); - } - else if (type == Definition.class && model instanceof Adapter) - { - return ((Adapter)model).getTarget(); - } - else if (type == XSDTypeReferenceEditManager.class) - { - IEditorInput editorInput = getEditorInput(); - if (editorInput instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; - WSDLXSDTypeReferenceEditManager refManager = new WSDLXSDTypeReferenceEditManager(fileEditorInput.getFile(), null); - refManager.setSchemas(getInlineSchemas()); - return refManager; - } - } - else if (type == XSDElementReferenceEditManager.class) - { - IEditorInput editorInput = getEditorInput(); - if (editorInput instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; - WSDLXSDElementReferenceEditManager refManager = new WSDLXSDElementReferenceEditManager(fileEditorInput.getFile(), null); - refManager.setSchemas(getInlineSchemas()); - return refManager; - } - } - else if (type == W11BindingReferenceEditManager.class) { - IEditorInput editorInput = getEditorInput(); - if (editorInput instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; - return new W11BindingReferenceEditManager((W11Description) getModel(), fileEditorInput.getFile()); - } - } - else if (type == W11InterfaceReferenceEditManager.class) { - IEditorInput editorInput = getEditorInput(); - if (editorInput instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; - return new W11InterfaceReferenceEditManager((W11Description) getModel(), fileEditorInput.getFile()); - } - } - else if (type == W11MessageReferenceEditManager.class) { - IEditorInput editorInput = getEditorInput(); - if (editorInput instanceof IFileEditorInput) - { - IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput; - return new W11MessageReferenceEditManager((W11Description) getModel(), fileEditorInput.getFile()); - } - } - - return super.getAdapter(type); - } - - /** - * Listener on SSE's source editor's selections that converts DOM - * selections into xsd selections and notifies WSDL selection manager - */ - private class SourceEditorSelectionListener implements ISelectionChangedListener { - /** - * Determines WSDL node based on object (DOM node) - * - * @param object - * @return - */ - private Object getWSDLNode(Object object) { - // get the element node - Element element = null; - if (object instanceof Node) { - Node node = (Node) object; - if (node != null) { - if (node.getNodeType() == Node.ELEMENT_NODE) { - element = (Element) node; - } - else if (node.getNodeType() == Node.ATTRIBUTE_NODE) { - element = ((Attr) node).getOwnerElement(); - } - } - } - Object o = element; - if (element != null) { - Definition def = (Definition) ((W11Description) model).getTarget(); - Object modelObject = WSDLEditorUtil.getInstance().findModelObjectForElement(def, element); - if (modelObject != null) { - o = WSDLAdapterFactoryHelper.getInstance().adapt((Notifier) modelObject); - } - } - return o; - } - - public void selectionChanged(SelectionChangedEvent event) { - if (getSelectionManager().getEnableNotify() && getActivePage() == 1) - { - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection) - { - List selections = new ArrayList(); - for (Iterator i = ((IStructuredSelection) selection).iterator(); i.hasNext();) - { - Object domNode = i.next(); - Object node = getWSDLNode(domNode); - if (node != null) - { - selections.add(node); - } - } - - if (!selections.isEmpty()) - { - StructuredSelection wsdlSelection = new StructuredSelection(selections); - getSelectionManager().setSelection(wsdlSelection, getTextEditor().getSelectionProvider()); - } - } - } - } - } - - /** - * Listener on WSDL's selection manager's selections that converts WSDL - * selections into DOM selections and notifies SSE's selection provider - */ - private class WSDLSelectionManagerSelectionListener implements ISelectionChangedListener { - /** - * Determines DOM node based on object (wsdl node) - * - * @param object - * @return - */ - private Object getObjectForOtherModel(Object object) { - Node node = null; - - if (object instanceof Node) { - node = (Node) object; - } - else { - node = WSDLEditorUtil.getInstance().getNodeForObject(object); - } - - // the text editor can only accept sed nodes! - // - if (!(node instanceof IDOMNode)) { - node = null; - } - return node; - } - - public void selectionChanged(SelectionChangedEvent event) { - // do not fire selection in source editor if selection event came - // from source editor - if (event.getSource() != getTextEditor().getSelectionProvider()) { - ISelection selection = event.getSelection(); - if (selection instanceof IStructuredSelection) { - List otherModelObjectList = new ArrayList(); - for (Iterator i = ((IStructuredSelection) selection).iterator(); i.hasNext();) { - Object facadeObject = i.next(); - if (facadeObject instanceof WSDLBaseAdapter) { - Object wsdlObject = ((WSDLBaseAdapter) facadeObject).getTarget(); - Object otherModelObject = getObjectForOtherModel(wsdlObject); - if (otherModelObject != null) { - otherModelObjectList.add(otherModelObject); - } - } - } - if (!otherModelObjectList.isEmpty()) { - StructuredSelection nodeSelection = new StructuredSelection(otherModelObjectList); - getTextEditor().getSelectionProvider().setSelection(nodeSelection); - } - } - } - } - } - - protected void configureGraphicalViewer() { - super.configureGraphicalViewer(); - setEditPartFactory(ASDEditPartFactoryHelper.getInstance().getEditPartFactory()); - } - - protected void createPages() { - super.createPages(); - - if (resourceChangeHandler == null) { - resourceChangeHandler = new WSDLEditorResourceChangeHandler(this); - resourceChangeHandler.attach(); - } - - fSourceEditorSelectionListener = new SourceEditorSelectionListener(); - ISelectionProvider provider = getTextEditor().getSelectionProvider(); - if (provider instanceof IPostSelectionProvider) { - ((IPostSelectionProvider) provider).addPostSelectionChangedListener(fSourceEditorSelectionListener); - } - else { - provider.addSelectionChangedListener(fSourceEditorSelectionListener); - } - - fWSDLSelectionListener = new WSDLSelectionManagerSelectionListener(); - getSelectionManager().addSelectionChangedListener(fWSDLSelectionListener); - } - - public void dispose() { - if (resourceChangeHandler != null) { - resourceChangeHandler.dispose(); - } - } - - public void reloadDependencies() { - try { - Definition definition = (Definition) ((W11Description) getModel()).getTarget(); - if (definition != null) { - WSDLResourceUtil.reloadDirectives(definition); - ComponentReferenceUtil.updateBindingReferences(definition); - ComponentReferenceUtil.updatePortTypeReferences(definition); - ComponentReferenceUtil.updateMessageReferences(definition); - ComponentReferenceUtil.updateSchemaReferences(definition); - // the line below simply causes a notification in order to - // update our - // views - // - definition.setDocumentationElement(definition.getDocumentationElement()); - } - } - finally { - } - } - - protected void createActions() { - super.createActions(); - ActionRegistry registry = getActionRegistry(); - - BaseSelectionAction action = new ASDAddMessageAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11AddPartAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetNewMessageAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetExistingMessageAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetNewTypeAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetExistingTypeAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetNewElementAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - - action = new W11SetExistingElementAction(this); - action.setSelectionProvider(getSelectionManager()); - registry.registerAction(action); - } - - public IOpenExternalEditorHelper getOpenExternalEditorHelper() { - return new W11OpenExternalEditorHelper(((IFileEditorInput) getEditorInput()).getFile()); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java deleted file mode 100644 index 818f265b6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/Messages.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.wst.wsdl.ui.internal; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.wst.wsdl.ui.internal.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 + '!'; - } - } - - public static String getString(String key, String arg0) { - return MessageFormat.format(getString(key), new Object [] { arg0 }); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ReloadDependenciesActionDelegate.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ReloadDependenciesActionDelegate.java deleted file mode 100644 index 2e2c438a1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/ReloadDependenciesActionDelegate.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; - -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.IEditorActionDelegate; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.ActionDelegate; - -public class ReloadDependenciesActionDelegate extends ActionDelegate implements IEditorActionDelegate -{ - private InternalWSDLMultiPageEditor wsdlEditor; - - public void setActiveEditor(IAction action, IEditorPart targetEditor) - { - wsdlEditor = (targetEditor instanceof InternalWSDLMultiPageEditor) ? (InternalWSDLMultiPageEditor)targetEditor : null; - } - - public void run(IAction action) - { - if (wsdlEditor != null) - { - try - { - wsdlEditor.reloadDependencies(); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourceEditorActionBarContributor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourceEditorActionBarContributor.java deleted file mode 100644 index f8a7dd09e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourceEditorActionBarContributor.java +++ /dev/null @@ -1,208 +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; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IStatusLineManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IEditorActionBarContributor; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.part.EditorActionBarContributor; -import org.eclipse.ui.part.MultiPageEditorActionBarContributor; -import org.eclipse.wst.sse.ui.StructuredTextEditor; -import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; -import org.eclipse.wst.sse.ui.internal.IExtendedContributor; -import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; - -public class SourceEditorActionBarContributor extends MultiPageEditorActionBarContributor implements IExtendedContributor { - - protected IEditorActionBarContributor designViewerActionBarContributor = null; - protected IEditorActionBarContributor sourceViewerActionContributor = null; - protected InternalWSDLMultiPageEditor multiPageEditor = null; - - // EditorExtension - private static final String EDITOR_ID = "org.eclipse.wst.wsdl.ui.internal.actions.XMLMultiPageEditorPart"; //$NON-NLS-1$ - private IExtendedContributor extendedContributor; - - public SourceEditorActionBarContributor() { - super(); - - sourceViewerActionContributor = new SourcePageActionContributor(); - - // Read action extensions. - ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder(); - extendedContributor = builder.readActionExtensions(EDITOR_ID); - } - - public void init(IActionBars actionBars) { - super.init(actionBars); - - if (actionBars != null) { - initDesignViewerActionBarContributor(actionBars); - initSourceViewerActionContributor(actionBars); - } - } - - protected void initDesignViewerActionBarContributor(IActionBars actionBars) { - if (designViewerActionBarContributor != null) - designViewerActionBarContributor.init(actionBars, getPage()); - } - - protected void initSourceViewerActionContributor(IActionBars actionBars) { - if (sourceViewerActionContributor != null) - sourceViewerActionContributor.init(actionBars, getPage()); - } - - public void dispose() { - super.dispose(); - - if (designViewerActionBarContributor != null) - designViewerActionBarContributor.dispose(); - - if (sourceViewerActionContributor != null) - sourceViewerActionContributor.dispose(); - - if (extendedContributor != null) - extendedContributor.dispose(); - } - - /** - * @see EditorActionBarContributor#contributeToMenu(IMenuManager) - */ - public final void contributeToMenu(IMenuManager menu) { - super.contributeToMenu(menu); - - addToMenu(menu); - - if (extendedContributor != null) - extendedContributor.contributeToMenu(menu); - } - - protected void addToMenu(IMenuManager menu) { - } - - /** - * @see IExtendedContributor#contributeToPopupMenu(IMenuManager) - */ - public final void contributeToPopupMenu(IMenuManager menu) { - - addToPopupMenu(menu); - - if (extendedContributor != null) - extendedContributor.contributeToPopupMenu(menu); - } - - protected void addToPopupMenu(IMenuManager menu) { - } - - /** - * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager) - */ - public final void contributeToToolBar(IToolBarManager toolBarManager) { - super.contributeToToolBar(toolBarManager); - - addToToolBar(toolBarManager); - - if (extendedContributor != null) - extendedContributor.contributeToToolBar(toolBarManager); - } - - protected void addToToolBar(IToolBarManager toolBarManager) { - } - - /** - * @see EditorActionBarContributor#contributeToStatusLine(IStatusLineManager) - */ - public final void contributeToStatusLine(IStatusLineManager manager) { - super.contributeToStatusLine(manager); - - addToStatusLine(manager); - - if (extendedContributor != null) - extendedContributor.contributeToStatusLine(manager); - } - - protected void addToStatusLine(IStatusLineManager manager) { - } - - /** - * @see IExtendedContributor#updateToolbarActions() - */ - public void updateToolbarActions() { - if (extendedContributor != null) - extendedContributor.updateToolbarActions(); - } - - public void setActiveEditor(IEditorPart targetEditor) { - // save multiPageEditor before calling super.setActiveEditor(targetEditor) - // super.setActiveEditor will call setActivePage(IEditorPart activeEditor) - // multiPageEditor is needed in setActivePage(IEditorPart activeEditor) - if (targetEditor instanceof InternalWSDLMultiPageEditor) - multiPageEditor = (InternalWSDLMultiPageEditor) targetEditor; - - super.setActiveEditor(targetEditor); - - updateToolbarActions(); - - if (extendedContributor != null) - extendedContributor.setActiveEditor(targetEditor); - } - - public void setActivePage(IEditorPart activeEditor) { - // This contributor is designed for StructuredTextMultiPageEditorPart. - // To safe-guard this from problems caused by unexpected usage by other editors, the following - // check is added. - if (multiPageEditor != null) { - if (activeEditor != null && activeEditor instanceof StructuredTextEditor) - activateSourcePage(activeEditor); - else - activateDesignPage(activeEditor); - } - - updateToolbarActions(); - - IActionBars actionBars = getActionBars(); - if (actionBars != null) { - // update menu bar and tool bar - actionBars.updateActionBars(); - } - } - - protected void activateDesignPage(IEditorPart activeEditor) { - if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { - designViewerActionBarContributor.setActiveEditor(multiPageEditor); - } - - if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { - // if design page is not really an IEditorPart, activeEditor == null, so pass in multiPageEditor instead (d282414) - if (activeEditor == null) { - sourceViewerActionContributor.setActiveEditor(multiPageEditor); - } - else { - sourceViewerActionContributor.setActiveEditor(activeEditor); - } - ((ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(false); - } - } - - protected void activateSourcePage(IEditorPart activeEditor) { - if (designViewerActionBarContributor != null && designViewerActionBarContributor instanceof IDesignViewerActionBarContributor) { - designViewerActionBarContributor.setActiveEditor(multiPageEditor); - } - - if (sourceViewerActionContributor != null && sourceViewerActionContributor instanceof ISourceViewerActionBarContributor) { - sourceViewerActionContributor.setActiveEditor(activeEditor); - ((ISourceViewerActionBarContributor) sourceViewerActionContributor).setViewerSpecificContributionsEnabled(true); - } - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourcePageActionContributor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourcePageActionContributor.java deleted file mode 100644 index 60fc70dfe..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/SourcePageActionContributor.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; - -import org.eclipse.ui.IActionBars; -import org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML; - - -/** - * SourcePageActionContributor - * - * This class is for multi page editor's source page contributor. - * - * Use WSDLEditorActionContributor for single page editor - * */ -public class SourcePageActionContributor extends ActionContributorXML { - - private IActionBars fBars; - - /** - * This method calls: - * <ul> - * <li><code>contributeToMenu</code> with <code>bars</code>' menu manager</li> - * <li><code>contributeToToolBar</code> with <code>bars</code>' tool bar - * manager</li> - * <li><code>contributeToStatusLine</code> with <code>bars</code>' status line - * manager</li> - * </ul> - * The given action bars are also remembered and made accessible via - * <code>getActionBars</code>. - * - * @param bars the action bars - * - */ - public void init(IActionBars bars) { - fBars = bars; - contributeToMenu(bars.getMenuManager()); - contributeToToolBar(bars.getToolBarManager()); - contributeToStatusLine(bars.getStatusLineManager()); - } - - /** - * Returns this contributor's action bars. - * - * @return the action bars - */ - public IActionBars getActionBars() { - return fBars; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/StructuredTextViewerConfigurationWSDL.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/StructuredTextViewerConfigurationWSDL.java deleted file mode 100644 index 8433eebcf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/StructuredTextViewerConfigurationWSDL.java +++ /dev/null @@ -1,40 +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; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.jface.text.hyperlink.IHyperlinkDetector; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; -import org.eclipse.wst.wsdl.ui.internal.text.WSDLHyperlinkDetector; -import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML; - -public class StructuredTextViewerConfigurationWSDL extends StructuredTextViewerConfigurationXML { - public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) { - if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED)) - return null; - - List allDetectors = new ArrayList(0); - // add WSDL Hyperlink detector - allDetectors.add(new WSDLHyperlinkDetector()); - - IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer); - for (int m = 0; m < superDetectors.length; m++) { - IHyperlinkDetector detector = superDetectors[m]; - if (!allDetectors.contains(detector)) { - allDetectors.add(detector); - } - } - return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLActionBarContributor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLActionBarContributor.java deleted file mode 100644 index fb58adde3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLActionBarContributor.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; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.part.MultiPageEditorActionBarContributor; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.ITextEditorActionConstants; -import org.eclipse.wst.wsdl.ui.internal.actions.IWSDLToolbarAction; - -public class WSDLActionBarContributor extends MultiPageEditorActionBarContributor -{ - protected ITextEditor textEditor; - - /** - * Constructor for WSDLActionBarContributor. - */ - public WSDLActionBarContributor() - { - super(); - } - - public void setActivePage(IEditorPart activeEditor) - { - // always enable undo/redo regardless of which page we're on. The undo/redo comes from the editor - // - updateAction(ActionFactory.UNDO.getId(), ITextEditorActionConstants.UNDO, true); - updateAction(ActionFactory.REDO.getId(), ITextEditorActionConstants.REDO, true); - - // turn these off so that the actionhandler will handle it for us - // - //updateAction(IWorkbenchActionConstants.CUT, ITextEditorActionConstants.CUT, false); - //updateAction(IWorkbenchActionConstants.COPY, ITextEditorActionConstants.COPY, false); - //updateAction(IWorkbenchActionConstants.PASTE, ITextEditorActionConstants.PASTE, false); - - getActionBars().updateActionBars(); - } - - protected void updateAction(String globalActionId, String textEditorActionId, boolean enable) - { - getActionBars().setGlobalActionHandler(globalActionId, enable ? getAction(textEditor, textEditorActionId) : null); - } - - /** - * Returns the action registed with the given text editor. - * @return IAction or null if editor is null. - */ - protected IAction getAction(ITextEditor editor, String actionID) - { - try - { - return (editor == null ? null : editor.getAction(actionID)); - } - catch (Exception e) - { - return null; - } - } - - public void contributeToToolBar(IToolBarManager manager) - { - manager.add(new GroupMarker("WSDLEditor")); //$NON-NLS-1$ - List list = WSDLEditorPlugin.getInstance().getWSDLEditorConfiguration().getToolbarActions(); - for (Iterator i = list.iterator(); i.hasNext(); ) - { - manager.add((IWSDLToolbarAction)i.next()); - } - -// manager.add(new Separator()); -// String[] zoomStrings = new String[] { ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH }; -// manager.add(new ZoomComboContributionItem(getPage(), zoomStrings)); - } - - public void setActiveEditor(IEditorPart activeEditor) - { - super.setActiveEditor(activeEditor); - textEditor = null; - if (activeEditor instanceof InternalWSDLMultiPageEditor) - { - textEditor = ((InternalWSDLMultiPageEditor) activeEditor).getTextEditor(); - } - - updateAction(ActionFactory.UNDO.getId(), ITextEditorActionConstants.UNDO, true); - updateAction(ActionFactory.REDO.getId(), ITextEditorActionConstants.REDO, true); - - List list = WSDLEditorPlugin.getInstance().getWSDLEditorConfiguration().getToolbarActions(); - for (Iterator i = list.iterator(); i.hasNext(); ) - { - ((IWSDLToolbarAction)i.next()).setEditorPart(activeEditor); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorPlugin.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorPlugin.java deleted file mode 100644 index 1a4721eea..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorPlugin.java +++ /dev/null @@ -1,412 +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; - -import java.io.IOException; -import java.net.URL; -import java.util.HashMap; -import java.util.Hashtable; - -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.wsdl.ui.internal.extensions.NSKeyedExtensionRegistry; -import org.eclipse.wst.wsdl.ui.internal.extensions.WSDLEditorConfiguration; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionsSchemasRegistry; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -public class WSDLEditorPlugin extends AbstractUIPlugin //, IPluginHelper -{ - public static final String DEFAULT_PAGE = "org.eclipse.wst.wsdl.ui.internal.defaultpage"; //$NON-NLS-1$ - public static final String GRAPH_PAGE = "org.eclipse.wst.wsdl.ui.internal.graphpage"; //$NON-NLS-1$ - public static final String SOURCE_PAGE = "org.eclipse.wst.wsdl.ui.internal.sourcepage"; //$NON-NLS-1$ - - public final static String PLUGIN_ID = "org.eclipse.wst.wsdl.ui"; //$NON-NLS-1$ - public final static String XSD_EDITOR_ID = "org.eclipse.wst.xsd.ui.XSDEditor"; //$NON-NLS-1$ - - public final static String DEFAULT_TARGET_NAMESPACE = "http://www.example.org"; //$NON-NLS-1$ - - public static int DEPENDECIES_CHANGED_POLICY_PROMPT = 0; - public static int DEPENDECIES_CHANGED_POLICY_IGNORE = 1; - public static int DEPENDECIES_CHANGED_POLICY_RELOAD = 2; - - protected static WSDLEditorPlugin instance; - private ExtensionsSchemasRegistry registry; - private WSDLEditorConfiguration wsdlEditorConfiguration = null; - - private NSKeyedExtensionRegistry extensiblityElementFilterRegistry; - private int dependenciesChangedPolicy = DEPENDECIES_CHANGED_POLICY_RELOAD; - - public WSDLEditorConfiguration getWSDLEditorConfiguration() - { - if (wsdlEditorConfiguration == null) - { - wsdlEditorConfiguration = new WSDLEditorConfiguration(); - } - return wsdlEditorConfiguration; - } - - public ExtensionsSchemasRegistry getExtensionsSchemasRegistry() { - if (registry == null) { - registry = new ExtensionsSchemasRegistry("org.eclipse.wst.wsdl.ui.ExtensionsSchemasDescription"); //$NON-NLS-1$ - } - - return registry; - } - - public static void logMessage(String message) - { - } - - /** - * Resources helper. - */ - - public WSDLEditorPlugin() - { - super(); - instance = this; - - // TODO... remove this code when we add 'dependenciesChangedPolicy' - // to an editor preferences page - try - { - // _DEBUG_UPDATE_POLICY = 0Dummy.label= - String string = "0Dummy.label"; //$NON-NLS-1$ - int policy = Integer.parseInt(string); - if (policy >= 0 && policy <= DEPENDECIES_CHANGED_POLICY_RELOAD) - { - dependenciesChangedPolicy = policy; - } - } - catch (Exception e) - { - } - } - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception - { - super.start(context); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception - { - super.stop(context); - } - - public NSKeyedExtensionRegistry getExtensiblityElementFilterRegistry() - { - if (extensiblityElementFilterRegistry == null) - { - extensiblityElementFilterRegistry = new NSKeyedExtensionRegistry(); - new ElementContentFilterExtensionRegistryReader(extensiblityElementFilterRegistry).readRegistry(); - } - return extensiblityElementFilterRegistry; - } - - /** - * Get the Install URL - */ - public static URL getInstallURL() - { - try - { - return FileLocator.resolve(instance.getBundle().getEntry("/")); //$NON-NLS-1$ - } - catch (IOException e) - { - return null; - } - } - - /** - * Return the plugin physical directory location - */ - public static IPath getPluginLocation() - { - try - { - IPath installPath = new Path(getInstallURL().toExternalForm()).removeTrailingSeparator(); - String installStr = FileLocator.toFileURL(new URL(installPath.toString())).getFile(); - return new Path(installStr); - } - catch (IOException e) - { - //System.out.println("WSDLEditorPlugin.getPluginLocation() exception.." + e); - } - return null; - } - - protected Hashtable imageDescriptorCache = new Hashtable(); - - protected ImageDescriptor internalGetImageDescriptor(String key) - { - ImageDescriptor imageDescriptor = (ImageDescriptor) imageDescriptorCache.get(key); - if (imageDescriptor == null) - { - imageDescriptor = ImageDescriptor.createFromFile(WSDLEditorPlugin.class, key); - if (imageDescriptor != null) - { - imageDescriptorCache.put(key, imageDescriptor); - } - } - return imageDescriptor; - } - - public static ImageDescriptor getImageDescriptor(String key) - { - return getInstance().internalGetImageDescriptor(key); - } - - 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 Image getImage(String key, boolean isGrayed) - { - Image image = null; - if (!isGrayed) - { - image = super.getImage(key); - } - else - { - image = (Image)grayedImageMap.get(key); - if (image == null) - { - Image colorImage = super.getImage(key); - if (colorImage != null) - { - image = new Image(Display.getCurrent(), colorImage, SWT.IMAGE_GRAY);//SWT.IMAGE_DISABLE); - grayedImageMap.put(key, image); - } - } - } - return image; - } - */ - - /** - * Get the metadata directory for this plugin - */ - public static String getMetaDataDirectory() - { - return getInstance().getStateLocation().toOSString(); - } - - /** - * Get the singleton instance. - */ - public static WSDLEditorPlugin getInstance() - { - if (instance == null) - { - new WSDLEditorPlugin(); - } - - return instance; - } - - public IWorkspace getWorkspace() - { - return ResourcesPlugin.getWorkspace(); - } - - public static Shell getShell() - { - return getInstance().getWorkbench().getActiveWorkbenchWindow().getShell(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeDefaultPreferences(org.eclipse.jface.preference.IPreferenceStore) - */ - protected void initializeDefaultPreferences(IPreferenceStore store) - { - store.setDefault(DEFAULT_PAGE, GRAPH_PAGE); - - // WSDLPreferencePage prefs - store.setDefault(Messages.getString("_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE"), DEFAULT_TARGET_NAMESPACE); //$NON-NLS-1$ - store.setDefault(Messages.getString("_UI_PREF_PAGE_AUTO_REGENERATE_BINDING"), false); //$NON-NLS-1$ - store.setDefault(Messages.getString("_UI_PREF_PAGE_PROMPT_REGEN_BINDING_ON_SAVE"), false); // TODO: Externalize //$NON-NLS-1$ - // Do we need this preference below? Look at WSDLPreferencePage.java -// store.setDefault("Defualt Location:", "http://www.example.com"); - } - - /** - * setDefaultPage - * Set the default page to open when the editor starts. Maintains the state - * when WSAD is shutdown and restarted. - * @param page - */ - public void setDefaultPage(String page) - { - getPreferenceStore().setValue(DEFAULT_PAGE, page); - } - - public String getDefaultPage() - { - return getPreferenceStore().getString(DEFAULT_PAGE); - } - - public int getDependenciesChangedPolicy() - { - //return getPreferenceStore().getInt(DEPENDECIES_CHANGED_POLICY); - return dependenciesChangedPolicy; - } -} - -class BaseRegistryReader -{ - protected static final String PLUGIN_ID = "org.eclipse.wst.wsdl.ui"; //$NON-NLS-1$ - - /** - * read from plugin registry and parse it. - */ - public void readRegistry(String extensionPointId) - { - IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry(); - IExtensionPoint point = extensionRegistry.getExtensionPoint(PLUGIN_ID, extensionPointId); - - if (point != null) - { - IConfigurationElement[] elements = point.getConfigurationElements(); - for (int i = 0; i < elements.length; i++) - { - readElement(elements[i]); - } - } - } - - protected void readElement(IConfigurationElement element) - { - } -} - -/** - * - */ -abstract class NSKeyedExtensionRegistryReader extends BaseRegistryReader -{ - protected static final String ATT_NAME_SPACE = "namespace"; //$NON-NLS-1$ - protected String extensionPointId; - protected String tagName; - protected String[] attributeNames; - protected NSKeyedExtensionRegistry nsKeyedExtensionRegistry; - - private NSKeyedExtensionRegistryReader(String extensionPointId, String tagName, NSKeyedExtensionRegistry nsKeyedExtensionRegistry) - { - this.extensionPointId = extensionPointId; - this.tagName = tagName; - this.nsKeyedExtensionRegistry = nsKeyedExtensionRegistry; - } - - public NSKeyedExtensionRegistryReader(String extensionPointId, String tagName, String attributeName, NSKeyedExtensionRegistry nsKeyedExtensionRegistry) - { - this(extensionPointId, tagName, nsKeyedExtensionRegistry); - attributeNames = new String[1]; - attributeNames[0] = attributeName; - } - - public NSKeyedExtensionRegistryReader(String extensionPointId, String tagName, String[] attributeNames, NSKeyedExtensionRegistry nsKeyedExtensionRegistry) - { - this(extensionPointId, tagName, nsKeyedExtensionRegistry); - this.attributeNames = attributeNames; - } - /** - * read from plugin registry and parse it. - */ - public void readRegistry() - { - super.readRegistry(extensionPointId); - } - - /** - * readElement() - */ - protected void readElement(IConfigurationElement element) - { - if (element.getName().equals(tagName)) - { - String namespace = element.getAttribute(ATT_NAME_SPACE); - if (namespace != null) - { - Bundle bundle = Platform.getBundle(element.getDeclaringExtension().getContributor().getName()); - if (attributeNames.length == 1) - { - String className = element.getAttribute(attributeNames[0]); - if (className != null) - { - nsKeyedExtensionRegistry.put(namespace, className, bundle); - } - } - else - { - HashMap map = new HashMap(); - for (int i = 0; i < attributeNames.length; i++) - { - String attributeName = attributeNames[i]; - String className = element.getAttribute(attributeName); - if (className != null && className.length() > 0) - { - map.put(attributeName, className); - } - } - nsKeyedExtensionRegistry.put(namespace, map, bundle); - } - } - } - } -} - -/** - * - */ -class ElementContentFilterExtensionRegistryReader extends NSKeyedExtensionRegistryReader -{ - protected static final String EXTENSION_POINT_ID = "extensibilityElementFilter"; //$NON-NLS-1$ - protected static final String TAG_NAME = "extensibilityElementFilter"; //$NON-NLS-1$ - - public ElementContentFilterExtensionRegistryReader(NSKeyedExtensionRegistry nsKeyedExtensionRegistry) - { - super(EXTENSION_POINT_ID, TAG_NAME, "class", nsKeyedExtensionRegistry); //$NON-NLS-1$ - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorResourceChangeHandler.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorResourceChangeHandler.java deleted file mode 100644 index bb0f92092..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLEditorResourceChangeHandler.java +++ /dev/null @@ -1,317 +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; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IPartListener; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; - - -public class WSDLEditorResourceChangeHandler -{ - protected InternalWSDLMultiPageEditor wsdlEditor; - protected boolean isUpdateRequired; - protected InternalResourceChangeListener resourceChangeListener; - protected InternalPartListener partListener; - - public WSDLEditorResourceChangeHandler(InternalWSDLMultiPageEditor wsdlEditor) - { - this.wsdlEditor = wsdlEditor; - resourceChangeListener = new InternalResourceChangeListener(); - partListener = new InternalPartListener(); - } - - public void attach() - { - ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener); - wsdlEditor.getSite().getWorkbenchWindow().getPartService().addPartListener(partListener); - } - - public void dispose() - { - ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); - wsdlEditor.getSite().getWorkbenchWindow().getPartService().removePartListener(partListener); - } - - protected Map computeDependencyMap() - { - Map map = new HashMap(); - IDescription description = ((InternalWSDLMultiPageEditor) wsdlEditor).getModel(); - Definition definition = (Definition) ((W11Description) description).getTarget(); - ResourceSet resourceSet = definition.eResource().getResourceSet(); - for (Iterator i = resourceSet.getResources().iterator(); i.hasNext();) - { - Resource resource = (Resource)i.next(); - if (resource != definition.eResource()) - { - String uri = resource.getURI().toString(); - if (map.get(uri) == null) - { - map.put(uri, uri); - } - } - } - return map; - } - - public void performReload() - { - boolean doReload = false; - int policy = WSDLEditorPlugin.getInstance().getDependenciesChangedPolicy(); - - if (policy == WSDLEditorPlugin.DEPENDECIES_CHANGED_POLICY_PROMPT) - { - doReload = MessageDialog.openQuestion(wsdlEditor.getSite().getShell(), Messages.getString("_UI_DEPENDENCIES_CHANGED"), Messages.getString("_UI_DEPENDENCIES_CHANGED_REFRESH")); //$NON-NLS-1$ //$NON-NLS-2$ - } - else if (policy == WSDLEditorPlugin.DEPENDECIES_CHANGED_POLICY_RELOAD) - { - doReload = true; - } - - if (doReload) - { - wsdlEditor.reloadDependencies(); - } - } - - public boolean isListeningToResourceChanges() - { - int policy = WSDLEditorPlugin.getInstance().getDependenciesChangedPolicy(); - return policy == WSDLEditorPlugin.DEPENDECIES_CHANGED_POLICY_PROMPT || - policy == WSDLEditorPlugin.DEPENDECIES_CHANGED_POLICY_RELOAD; - } - - - class InternalResourceChangeListener implements IResourceChangeListener, IResourceDeltaVisitor - { - protected List list = new ArrayList(); - protected boolean isPending = false; - protected int count = 0; - - public void resourceChanged(IResourceChangeEvent event) - { - Display display = Display.getCurrent(); - - if (display != null && isListeningToResourceChanges() && !isUpdateRequired) - { - if (event.getType() == IResourceChangeEvent.POST_CHANGE) - { - IResourceDelta[] deltas = event.getDelta().getAffectedChildren(); - for (int i = 0; i < deltas.length; i++) - { - try - { - deltas[i].accept(this); - } - catch (Exception e) - { - } - } - } - if (list.size() > 0) - { - if (!isPending) - { - isPending = true; - display.timerExec(2000, new TimerEvent()); - } - } - } - } - - public boolean visit(IResourceDelta delta) throws CoreException - { - IResource resource = delta.getResource(); - if (resource.getType() == IResource.FILE) - { - if (!list.contains(resource)) - { - list.add(resource); - } - } - return true; - } - - class TimerEvent implements Runnable - { - public TimerEvent() - { - //System.out.println("NewTimerEvent(" + wsdlEditor.getDefinition().eResource().getURI() + ") " + count); - } - - public void run() - { -// for (Iterator i = list.iterator(); i.hasNext();) -// { -// IResource resource = (IResource)i.next(); -// String platformPath = URI.createPlatformResourceURI(resource.getFullPath().toString()).toString(); -// } - - Map dependencyMap = computeDependencyMap(); - - for (Iterator i = list.iterator(); i.hasNext();) - { - IResource resource = (IResource)i.next(); - String platformPath = URI.createPlatformResourceURI(resource.getFullPath().toString()).toString(); - if (dependencyMap.get(platformPath) != null) - { - isUpdateRequired = true; - if (wsdlEditor.getSite().getWorkbenchWindow().getPartService().getActivePart() == wsdlEditor) - { - isUpdateRequired = false; - performReload(); - } - } - } - - isPending = false; - list = new ArrayList(); - } - } - } - - class InternalPartListener implements IPartListener - { - public void partActivated(IWorkbenchPart part) - { - if (part == wsdlEditor) - { - if (isUpdateRequired) - { - isUpdateRequired = false; - performReload(); - } - } - } - - public void partBroughtToTop(IWorkbenchPart part) - { - } - - public void partClosed(IWorkbenchPart part) - { - } - - - public void partDeactivated(IWorkbenchPart part) - { - } - - public void partOpened(IWorkbenchPart part) - { - } - } - - -} - -/* -class DependencyVisitor -{ - public void visitImport(Import theImport) - { - if (theImport.getEDefinition() != null) - { - visitDefinition(theImport.getEDefinition()); - } - else if (theImport.getESchema() != null) - { - visitSchema(theImport.getESchema()); - } - } - - public void visitXSDSchemaDirective(XSDSchemaDirective directive) - { - XSDSchema referencedSchema = directive.getResolvedSchema(); - if (referencedSchema != null) - { - visitSchema(referencedSchema); - } - } - - public void visitDefinition(Definition definition) - { - if (definition != null) - { - for (Iterator i = definition.getEImports().iterator(); i.hasNext();) - { - visitImport((Import)i.next()); - } - Types types = definition.getETypes(); - if (types != null) - { - - for (Iterator i = types.getEExtensibilityElements().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaExtensibilityElement) - { - XSDSchemaExtensibilityElement e = (XSDSchemaExtensibilityElement)o; - if (e.getEXSDSchema() != null) - { - visitSchema(e.getEXSDSchema()); - } - } - } - } - } - } - - public void visitSchema(XSDSchema schema) - { - for (Iterator i = schema.getContents().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaDirective) - { - visitXSDSchemaDirective((XSDSchemaDirective)o); - } - } - } -} - -class ReloadDependencyVisitor extends DependencyVisitor -{ - public void visitImport(Import theImport) - { - ComponentHandler handler = WSDLReconciler.getReconciler(theImport); - Element element = WSDLUtil.getInstance().getElementForObject(theImport); - if (element != null && handler != null) - { - handler.reconcile(wsdlEditor.getDefinition(), theImport, element); - } - } - - public void visitXSDSchemaDirective(XSDSchemaDirective directive) - { - - } -}*/
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLPreferencePage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLPreferencePage.java deleted file mode 100644 index 3d1b5e869..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLPreferencePage.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; - -public class WSDLPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - public WSDLPreferencePage() - { - super(FieldEditorPreferencePage.FLAT); - setPreferenceStore(WSDLEditorPlugin.getInstance().getPreferenceStore()); - } - - public void init(IWorkbench workbench) - { - } - - protected void createFieldEditors() - { - Composite parent = getFieldEditorParent(); - GridLayout parentLayout = new GridLayout(); - parentLayout.marginWidth = 0; - parent.setLayout(parentLayout); - -// WorkbenchHelp.setHelp(getControl(), some context id here); - - Group group = new Group(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.numColumns = 2; - group.setLayout(layout); - group.setText(Messages.getString("_UI_PREF_PAGE_CREATING_FILES")); //$NON-NLS-1$ - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - group.setLayoutData(data); - - Composite composite = new Composite(group, SWT.NULL); - GridData data1 = new GridData(); - data1.verticalAlignment = GridData.FILL; - data1.horizontalAlignment = GridData.FILL; - data1.grabExcessHorizontalSpace = true; - composite.setLayoutData(data1); - - String namespaceLabel = Messages.getString("_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE"); //$NON-NLS-1$ - StringFieldEditor targetNamespace = new StringFieldEditor(namespaceLabel, namespaceLabel, composite); // Externalize - GridLayout compositeLayout = (GridLayout)composite.getLayout(); - compositeLayout.marginWidth = 5; // Default value - compositeLayout.numColumns = 2; - addField(targetNamespace); - targetNamespace.setFocus(); - - String generateLabel = Messages.getString("_UI_PREF_PAGE_AUTO_REGENERATE_BINDING"); //$NON-NLS-1$ - BooleanFieldEditor generateBindingOnSave = new BooleanFieldEditor(generateLabel, generateLabel, parent); - addField(generateBindingOnSave); - - String showGenerateDialogLabel = Messages.getString("_UI_PREF_PAGE_PROMPT_REGEN_BINDING_ON_SAVE"); // TODO: Externalize //$NON-NLS-1$ - BooleanFieldEditor showGenerateDialog = new BooleanFieldEditor(showGenerateDialogLabel, showGenerateDialogLabel, parent); - addField(showGenerateDialog); - - /* Do we need this preference below? If so, change WSDLEditorPlugin.java and use this preference in: - HttpContentGenerator.java - SoapContentGenerator.java - SoapPortOptionsPage.java - */ -// HttpPortOptionsPage.java StringFieldEditor location = new StringFieldEditor("Defualt Location:", "Default Location:", editorGroup1); // Externalize -// addField(location); - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLSelectionMapper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLSelectionMapper.java deleted file mode 100644 index 5c888d360..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/WSDLSelectionMapper.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; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; - -public class WSDLSelectionMapper implements ISelectionMapper { - - public ISelection mapSelection(ISelection selection) { - List list = new ArrayList(); - if (selection instanceof StructuredSelection) { - StructuredSelection structuredSelection = (StructuredSelection)selection; - for (Iterator i = structuredSelection.iterator(); i.hasNext(); ) { - Object o = i.next(); - if (o instanceof Adapter) { - list.add(((Adapter)o).getTarget()); - } - else { - list.add(o); - } - } - } - return new StructuredSelection(list); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementAction.java deleted file mode 100644 index 664071a93..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementAction.java +++ /dev/null @@ -1,330 +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.actions; - -import java.util.HashMap; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.dialogs.NewComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -public class AddElementAction extends BaseNodeAction { - protected Node parentNode; - protected String prefix; - protected String nodeName; - protected Element newElement; - protected Node relativeNode = null; - protected IEditorPart editorPart; - protected Definition definition; - protected Document document; - protected boolean computeTopLevelRefChild; - - protected boolean selectNewlyCreatedObject = true; // We should not be - // selecting the - // object in the - // action..... TODO - - public AddElementAction(String text, String imageDescriptorKey, Node parentNode, String nodeName) { - setText(text); - setImageDescriptor(WSDLEditorPlugin.getImageDescriptor(imageDescriptorKey)); - this.parentNode = parentNode; - this.nodeName = nodeName; - } - - public AddElementAction(String text, String imageDescriptorKey, Node parentNode, String prefix, String localName) { - setText(text); - setImageDescriptor(WSDLEditorPlugin.getImageDescriptor(imageDescriptorKey)); - this.parentNode = parentNode; - this.prefix = prefix; - this.nodeName = localName; - } - - public AddElementAction(String text, Node parentNode, String prefix, String localName) { - setText(text); - setImageDescriptor(null); - this.parentNode = parentNode; - this.prefix = prefix; - this.nodeName = localName; - } - - public AddElementAction(Node parentNode, String prefix, String localName, Node relativeNode) { - this.parentNode = parentNode; - this.prefix = prefix; - this.nodeName = localName; - this.relativeNode = relativeNode; - } - - public void setComputeTopLevelRefChild(boolean isEnabled) { - computeTopLevelRefChild = isEnabled; - } - - protected void setEditorPart(IEditorPart editorPart) { - this.editorPart = editorPart; - } - - protected boolean showDialog() { - return true; - } - - public void run() { - boolean ok = showDialog(); - if (ok) { - beginRecording(); - performAddElement(); - endRecording(); - } - } - - protected void performAddElement() { - if (parentNode != null) { - newElement = createElement(nodeName); - addAttributes(newElement); - if (relativeNode == null && computeTopLevelRefChild) { - relativeNode = computeTopLevelRefChild(newElement); - } - - if (relativeNode == null) { - parentNode.appendChild(newElement); - } - else { - parentNode.insertBefore(newElement, relativeNode); - } - // format(parentNode); - format(newElement); - // Ugly..... We should not be selecting the object in the graph - // view in the Action. - // This should be refactored out. We add this boolean check - // because WSDLSetTypeDialog.java - // uses AddImportAction.java but we should not be selecting the - // newly created import.... - if (selectNewlyCreatedObject) { - selectObjectForNewElement(); - } - } - } - - // Ugly..... We should not be selecting the object in the graph view in - // the Action. - // This should be refactored out. We add this boolean check because - // WSDLSetTypeDialog.java - // uses AddImportAction.java but we should not be selecting the newly - // created import.... - // We should call this method before calling run() - public void selectObjectForNewElement(boolean select) { - selectNewlyCreatedObject = select; - } - - public Node getNode() { - if (parentNode != null) { - return parentNode; - } - else { - return document; - } - } - - - public String getUndoDescription() { - return Messages.getString("_UI_ACTION_ADD"); //$NON-NLS-1$ - } - - - protected Element createElement(String nodeName) { - Document document = parentNode.getOwnerDocument(); - - Element element = (prefix != null && prefix.length() > 0) ? document.createElement(prefix + ":" + nodeName) : document.createElement(nodeName); //$NON-NLS-1$ - - return element; - } - - protected void addAttributes(Element newElement) { - } - - - protected void format(Node parentNode) { - if (parentNode instanceof IDOMNode) { - // format selected node - FormatProcessorXML formatProcessorXML = new FormatProcessorXML(); - formatProcessorXML.formatNode((IDOMNode) parentNode); - - } - } - - protected Element getDefinitionElement(Element parentElement) { - Element definitionElement = null; - - for (Node node = parentElement.getOwnerDocument().getFirstChild(); node != null; node = node.getNextSibling()) { - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element element = (Element) node; - if (WSDLEditorUtil.getInstance().getWSDLType(element) == WSDLConstants.DEFINITION) { - definitionElement = element; - break; - } - } - } - return definitionElement; - } - - public Element getNewElement() { - return newElement; - } - - public void setDefinition(Definition definition) { - this.definition = definition; - } - - public void selectObjectForNewElement() { - if (editorPart == null) { - editorPart = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - } - if (editorPart != null && definition != null) { - Object object = WSDLEditorUtil.getInstance().findModelObjectForElement(definition, newElement); - if (object != null) { - ISelectionProvider selectionProvider = (ISelectionProvider) editorPart.getAdapter(ISelectionProvider.class); - if (selectionProvider != null) { - selectionProvider.setSelection(new StructuredSelection(object)); - } - } - } - } - - public void selectObject(WSDLElement object) { - if (editorPart == null) { - editorPart = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - } - if (editorPart != null && definition != null) { - if (object != null) { - ISelectionProvider selectionProvider = (ISelectionProvider) editorPart.getAdapter(ISelectionProvider.class); - if (selectionProvider != null) { - selectionProvider.setSelection(new StructuredSelection(object)); - } - } - } - } - - public String showDialogHelper(String title, String defaultName, List usedNames) { - String result = defaultName; - NewComponentDialog dialog = new NewComponentDialog(WSDLEditorPlugin.getShell(), title, defaultName, usedNames); - int rc = dialog.createAndOpen(); - if (rc == IDialogConstants.OK_ID) { - result = dialog.getName(); - } - else { - result = null; - } - return result; - } - - protected Node computeTopLevelRefChild(Node nodeToAdd) { - Node result = null; - int a = getPrecedence(nodeToAdd); - - for (Node node = parentNode.getFirstChild(); node != null; node = node.getNextSibling()) { - if (node.getNodeType() == Node.ELEMENT_NODE) { - int b = getPrecedence(node); - if (b > a) { - result = node; - break; - } - } - } - return result; - } - - protected void createDefinitionStub() { - if (document != null) { - // Create the Definitions element with proper namespace - Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences(); - String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET); - if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$ - charSet = "UTF-8"; //$NON-NLS-1$ - } - document.appendChild(document.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"" + charSet + "\"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Element root = document.createElement("wsdl:definitions"); //$NON-NLS-1$ - document.appendChild(root); - - // Add various namespace attributes here. - root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/wsdl/soap/"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("xmlns:tns", getDefaultNamespace()); //$NON-NLS-1$ - root.setAttribute("xmlns:wsdl", "http://schemas.xmlsoap.org/wsdl/"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("name", getFileName()); //$NON-NLS-1$ - root.setAttribute("targetNamespace", getDefaultNamespace()); //$NON-NLS-1$ - - definition.setElement(root); - parentNode = root; - prefix = definition.getPrefix(WSDLConstants.WSDL_NAMESPACE_URI); - } - } - - private String getDefaultNamespace() { - String namespace = WSDLEditorPlugin.getInstance().getPreferenceStore().getString(Messages.getString("_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE")); //$NON-NLS-1$ - if (!namespace.endsWith("/")) { //$NON-NLS-1$ - namespace = namespace.concat("/"); //$NON-NLS-1$ - } - - namespace += getFileName() + "/"; //$NON-NLS-1$ - - return namespace; - } - - private String getFileName() { - String fileLocation = definition.getLocation(); - IPath filePath = new Path(fileLocation); - return filePath.removeFileExtension().lastSegment().toString(); - } - - protected static HashMap precedenceMap = createPrecedenceMap(); - - protected static int getPrecedence(Node node) { - int result = 2; - String localName = node.getLocalName(); - if (localName != null) { - Integer integer = (Integer) precedenceMap.get(localName); - if (integer != null) { - result = integer.intValue(); - } - } - return result; - } - - protected static HashMap createPrecedenceMap() { - HashMap hashMap = new HashMap(); - hashMap.put(WSDLConstants.DOCUMENTATION_ELEMENT_TAG, new Integer(1)); - hashMap.put(WSDLConstants.IMPORT_ELEMENT_TAG, new Integer(3)); - hashMap.put(WSDLConstants.TYPES_ELEMENT_TAG, new Integer(4)); - hashMap.put(WSDLConstants.MESSAGE_ELEMENT_TAG, new Integer(5)); - hashMap.put(WSDLConstants.PORT_TYPE_ELEMENT_TAG, new Integer(6)); - hashMap.put(WSDLConstants.BINDING_ELEMENT_TAG, new Integer(7)); - hashMap.put(WSDLConstants.SERVICE_ELEMENT_TAG, new Integer(8)); - return hashMap; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementDeclarationAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementDeclarationAction.java deleted file mode 100644 index 59f406761..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddElementDeclarationAction.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.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - -public class AddElementDeclarationAction extends Action -{ - protected Definition definition; - protected String namespace; - protected String prefix; - - public AddElementDeclarationAction(Definition definition, String namespace, String suggestedPrefix) - { - this.definition = definition; - this.namespace = namespace; - this.prefix = suggestedPrefix; - } - - public void run() - { - String existingPrefix = definition.getPrefix(namespace); - if (existingPrefix != null) - { - prefix = existingPrefix; - } - else - { - prefix = NameUtil.buildUniquePrefix(definition, prefix); - Element definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition); - if (definitionElement != null) - { - definitionElement.setAttribute("xmlns:" + prefix, namespace); //$NON-NLS-1$ - } - } - } - - public String getPrefix() - { - return prefix; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddImportAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddImportAction.java deleted file mode 100644 index e506dd15b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddImportAction.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.actions; - -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class AddImportAction extends AddElementAction -{ - protected String namespace; - protected String location; - protected String elementDeclarationNamespacePrefix; - - public AddImportAction(IEditorPart part, Definition definition, Node parentNode, String prefix) - { - this(part, definition, parentNode, prefix, null, null); - } - - public AddImportAction(IEditorPart part, Definition definition, Node parentNode, String prefix, String namespace, String location) - { - super(Messages.getString("_UI_ACTION_ADD_IMPORT"), "icons/import_obj.gif", parentNode, prefix, "import"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - setDefinition(definition); - setComputeTopLevelRefChild(true); - this.namespace = namespace; - this.location = location; - setEditorPart(part); - - if (part instanceof InternalWSDLMultiPageEditor) { - document = ((IDOMModel) ((InternalWSDLMultiPageEditor) part).getModel()).getDocument(); - } - } - - protected Element createElement(String nodeName) - { - if (elementDeclarationNamespacePrefix != null && namespace != null) - { - Element definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition); - if (definitionElement != null) - { - definitionElement.setAttribute("xmlns:" + elementDeclarationNamespacePrefix, namespace); //$NON-NLS-1$ - } - } - return super.createElement(nodeName); - } - - public void setElementDeclarationNamespacePrefix(String nsPrefix) - { - this.elementDeclarationNamespacePrefix = nsPrefix; - } - - protected void addAttributes(Element newElement) - { - newElement.setAttribute("namespace", namespace != null ? namespace : ""); //$NON-NLS-1$ //$NON-NLS-2$ - newElement.setAttribute("location", location != null ? location : ""); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public void performAddElement() { - if (parentNode == null || (document != null && document.getChildNodes().getLength() == 0)) { - createDefinitionStub(); - } - - super.performAddElement(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddWSISchemaImportAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddWSISchemaImportAction.java deleted file mode 100644 index 77557741a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/AddWSISchemaImportAction.java +++ /dev/null @@ -1,202 +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.actions; - - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - - -public class AddWSISchemaImportAction extends BaseNodeAction -{ - protected Definition definition; - protected Element definitionElement; - protected String namespace; - protected String location; - protected String elementDeclarationNamespacePrefix; - - public AddWSISchemaImportAction(Definition definition, String namespace, String location) - { - this.definition = definition; - this.namespace = namespace; - this.location = location; - definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition); - } - - public Node getNode() - { - return definitionElement; - } - - public String getUndoDescription() - { - return Messages.getString("_UI_ACTION_ADD_IMPORT"); //$NON-NLS-1$ - } - - protected Element getOrCreateTypesElement() - { - Element typesElement = null; - if (definition.getTypes() == null) - { - if (definitionElement != null) - { - AddElementAction addTypesAction = new AddElementAction("", "icons/xsd_obj.gif", definitionElement, definitionElement.getPrefix(), "types"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - addTypesAction.setComputeTopLevelRefChild(true); - addTypesAction.run(); - typesElement = addTypesAction.getNewElement(); - format(typesElement); - } - } - else - { - typesElement = WSDLEditorUtil.getInstance().getElementForObject(definition.getTypes()); - } - return typesElement; - } - - protected Element getImportHolderElement(Element typesElement) { - Element importHolderElement = null; - NodeList nodeList = typesElement.getChildNodes(); - for (int i = 0; i < nodeList.getLength(); i++) - { - Node node = nodeList.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE) - { - Element element = (Element) node; - if ("schema".equals(element.getLocalName()) && element.getAttribute("targetNamespace") == null) //$NON-NLS-1$ //$NON-NLS-2$ - { - importHolderElement = element; - break; - } - } - } - - return importHolderElement; - } - - public Element getOrCreateImportHolderElement(Element typesElement) - { - Element importHolderElement = getImportHolderElement(typesElement); - if (importHolderElement == null) - { - AddElementAction addImportHolderAction = new AddElementAction("", "icons/xsd_obj.gif", typesElement, "xsd", "schema") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - { - protected void addAttributes(Element newElement) - { - newElement.setAttribute("xmlns:xsd", WSDLConstants.XSD_NAMESPACE_URI); //$NON-NLS-1$ - } - }; - addImportHolderAction.run(); - importHolderElement = addImportHolderAction.getNewElement(); - format(importHolderElement); - } - return importHolderElement; - } - - // We don't want to add the import if it's already there - protected boolean importNotAlreadyExists() { - boolean notExists = true; - - if (definition.getTypes() != null) { - Element typesElement = WSDLEditorUtil.getInstance().getElementForObject(definition.getTypes()); - Element schemaElement = getImportHolderElement(typesElement); - - if (schemaElement != null) { - // Collect children - Node node = schemaElement.getFirstChild(); - java.util.Vector schemaChildren = new java.util.Vector(); - if (node != null) { - Node child = node; - - if (!(child instanceof org.eclipse.wst.xml.core.internal.document.TextImpl)) { - schemaChildren.addElement(child); - } - - while (child.getNextSibling() != null) { - child = child.getNextSibling(); - if (!(child instanceof org.eclipse.wst.xml.core.internal.document.TextImpl)) { - schemaChildren.addElement(child); - } - } - - for (int index = 0; index < schemaChildren.size(); index++) { - Element schemaChild = (Element) schemaChildren.elementAt(index); - String schemaLocation = schemaChild.getAttribute("schemaLocation"); //$NON-NLS-1$ - String schemaNamespace = schemaChild.getAttribute("namespace"); //$NON-NLS-1$ - - if (schemaLocation != null && namespace != null && - schemaLocation.equals(location) && schemaNamespace.equals(namespace)) { - notExists = false; - break; - } - } - } - } - } - - return notExists; - } - - public void run() - { - if (definitionElement != null && importNotAlreadyExists()) - { - beginRecording(); - performAddElement(); - endRecording(); - } - } - public void performAddElement() - { - try - { - Element typesElement = getOrCreateTypesElement(); - Element importHolderElement = getOrCreateImportHolderElement(typesElement); - - AddElementAction addImportAction = new AddElementAction("", "icons/xsd_obj.gif", importHolderElement, importHolderElement.getPrefix(), "import") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - { - protected void addAttributes(Element newElement) - { - newElement.setAttribute("namespace", namespace); //$NON-NLS-1$ - newElement.setAttribute("schemaLocation", location); //$NON-NLS-1$ - } - }; - addImportAction.run(); - Element newElement = addImportAction.getNewElement(); - format(newElement); - } - catch (Exception e) - { - } - } - - public void setElementDeclarationNamespacePrefix(String nsPrefix) - { - this.elementDeclarationNamespacePrefix = nsPrefix; - } - - protected static void format(Node parentNode) - { - if (parentNode instanceof IDOMNode) - { - // format selected node - FormatProcessorXML formatProcessorXML = new FormatProcessorXML(); - formatProcessorXML.formatNode((IDOMNode)parentNode); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/BaseNodeAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/BaseNodeAction.java deleted file mode 100644 index ced35be99..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/BaseNodeAction.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.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Node; - -public abstract class BaseNodeAction extends Action -{ - public abstract Node getNode(); - public abstract String getUndoDescription(); - - public void beginRecording() - { - Node node = getNode(); - if (node instanceof IDOMNode) - { - ((IDOMNode)node).getModel().beginRecording(this, getUndoDescription()); - } - } - - public void endRecording() - { - Node node = getNode(); - if (node instanceof IDOMNode) - { - ((IDOMNode)node).getModel().endRecording(this); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/EditNamespacesAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/EditNamespacesAction.java deleted file mode 100644 index e8dfb5eca..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/EditNamespacesAction.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.actions; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.dialogs.EditNamespacesDialog; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMNamespaceInfoManager; -import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo; -import org.w3c.dom.Element; - - -public class EditNamespacesAction extends Action -{ - protected Definition definition; - - public EditNamespacesAction(Definition definition) - { - setText(Messages.getString("_UI_EDIT_NAMESPACES")); //$NON-NLS-1$ - this.definition = definition; - } - - public void run() - { - DOMNamespaceInfoManager namespaceInfoManager = new DOMNamespaceInfoManager(); - Element element = WSDLEditorUtil.getInstance().getElementForObject(definition); - if (element != null) - { - List namespaceInfoList = namespaceInfoManager.getNamespaceInfoList(element); -// List oldNamespaceInfoList = NamespaceInfo.cloneNamespaceInfoList(namespaceInfoList); - - // here we store a copy of the old info for each NamespaceInfo - // this info will be used in createPrefixMapping() to figure out how to update the document - // in response to these changes - for (Iterator i = namespaceInfoList.iterator(); i.hasNext();) - { - NamespaceInfo info = (NamespaceInfo) i.next(); - NamespaceInfo oldCopy = new NamespaceInfo(info); - info.setProperty("oldCopy", oldCopy); //$NON-NLS-1$ - } - - IPath path = new Path(definition.getDocumentBaseURI()); - EditNamespacesDialog dialog = new EditNamespacesDialog(WSDLEditorPlugin.getShell(), path, Messages.getString("_UI_EDIT_NAMESPACES_DIALOG_TITLE"), definition.getTargetNamespace(), namespaceInfoList); //$NON-NLS-1$ - int rc = dialog.createAndOpen(); - if (rc == IDialogConstants.OK_ID) - { - element.setAttribute("targetNamespace", dialog.getTargetNamespace()); //$NON-NLS-1$ - - List newInfoList = dialog.getNamespaceInfoList(); - namespaceInfoManager.removeNamespaceInfo(element); - namespaceInfoManager.addNamespaceInfo(element, newInfoList, false); - -/* - // see if we need to rename any prefixes - Map prefixMapping = createPrefixMapping(oldNamespaceInfoList, namespaceInfoList); - if (prefixMapping.size() > 0) - { - //manager.getModel().aboutToChangeModel(); - ReplacePrefixAction replacePrefixAction = new ReplacePrefixAction(element, prefixMapping); - replacePrefixAction.run(); - //manager.getModel().changedModel(); - } -*/ - } - } - } - - protected Map createPrefixMapping(List oldList, List newList) - { - Map map = new Hashtable(); - - Hashtable oldURIToPrefixTable = new Hashtable(); - for (Iterator i = oldList.iterator(); i.hasNext();) - { - NamespaceInfo oldInfo = (NamespaceInfo) i.next(); - oldURIToPrefixTable.put(oldInfo.uri, oldInfo); - } - - for (Iterator i = newList.iterator(); i.hasNext();) - { - NamespaceInfo newInfo = (NamespaceInfo) i.next(); - NamespaceInfo oldInfo = (NamespaceInfo) oldURIToPrefixTable.get(newInfo.uri != null ? newInfo.uri : ""); //$NON-NLS-1$ - - // if oldInfo is non null ... there's a matching URI in the old set - // we can use its prefix to detemine out mapping - // - // if oldInfo is null ... we use the 'oldCopy' we stashed away - // assuming that the user changed the URI and the prefix - if (oldInfo == null) - { - oldInfo = (NamespaceInfo) newInfo.getProperty("oldCopy"); //$NON-NLS-1$ - } - - if (oldInfo != null) - { - String newPrefix = newInfo.prefix != null ? newInfo.prefix : ""; //$NON-NLS-1$ - String oldPrefix = oldInfo.prefix != null ? oldInfo.prefix : ""; //$NON-NLS-1$ - if (!oldPrefix.equals(newPrefix)) - { - map.put(oldPrefix, newPrefix); - } - } - } - return map; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/IWSDLToolbarAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/IWSDLToolbarAction.java deleted file mode 100644 index e8fb25f38..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/IWSDLToolbarAction.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.actions; - -import org.eclipse.jface.action.IAction; -import org.eclipse.ui.IEditorPart; - -public interface IWSDLToolbarAction extends IAction{ - public void setEditorPart(IEditorPart editorPart); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/RenameAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/RenameAction.java deleted file mode 100644 index befd4d9a3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/RenameAction.java +++ /dev/null @@ -1,142 +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.actions; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.ui.internal.visitor.BindingRenamer; -import org.eclipse.wst.wsdl.ui.internal.visitor.MessageRenamer; -import org.eclipse.wst.wsdl.ui.internal.visitor.PortTypeRenamer; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -//import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; - -public class RenameAction //extends BaseNodeAction implements Runnable -{ - protected Object modelObject; - protected String newName; - protected Node node; - - public RenameAction(Object modelObject, String newName) - { - this.modelObject = modelObject; - this.newName = newName; - this.node = WSDLEditorUtil.getInstance().getNodeForObject(modelObject); - } - - /* - public Node getNode() - { - return node; - } - */ - - /* - public String getUndoDescription() - { - return WSDLEditorPlugin.getWSDLString("_UI_ACTION_RENAME"); //$NON-NLS-1$ - } - */ - - public void run() - { - if (modelObject instanceof Operation) - { - renameOperationHelper((Operation)modelObject); - } - else if (modelObject instanceof Input || - modelObject instanceof Output || - modelObject instanceof Fault) - { - renameIOFHelper((WSDLElement)modelObject); - } - else - { - renameModelObjectHelper(modelObject, newName); - } - } - - protected void renameModelObjectHelper(Object modelObject, String theNewName) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(modelObject); - if (element != null) - { - element.setAttribute("name", theNewName); //$NON-NLS-1$ - } - - if (modelObject instanceof Message) - { - MessageRenamer renamer = new MessageRenamer((Message)modelObject, theNewName); - renamer.visitBindings(); - } - else if (modelObject instanceof PortType) - { - PortTypeRenamer renamer = new PortTypeRenamer((PortType)modelObject, theNewName); - renamer.visitBindings(); - } - else if (modelObject instanceof Binding) - { - BindingRenamer renamer = new BindingRenamer((Binding)modelObject, theNewName); - renamer.visitServices(); - } - } - - protected void renameOperationHelper(Operation operation) - { - renameModelObjectHelper(operation, newName); - } - - - protected void renameIOFHelper(WSDLElement object) - { - Definition definition = object.getEnclosingDefinition(); - ComponentReferenceUtil util = new ComponentReferenceUtil(definition); - - List list = null; - - if (object instanceof Input) - { - list = util.getBindingInputs((Input)object); - } - else if (object instanceof Output) - { - list = util.getBindingOutputs((Output)object); - } - else // fault - { - list = util.getBindingFaults((Fault)object); - } - - if (list != null) - { - for (Iterator i = list.iterator(); i.hasNext(); ) - { - Object bindingObject = i.next(); - renameModelObjectHelper(bindingObject, newName); - } - } - - renameModelObjectHelper(object, newName); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/SmartRenameAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/SmartRenameAction.java deleted file mode 100644 index 675fe37f4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/actions/SmartRenameAction.java +++ /dev/null @@ -1,551 +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.actions; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.xsd.XSDElementDeclaration; -import org.w3c.dom.Node; - - -/* - * This class renames 'related' WSDLElements. The scenario is as follows: - * The user renames a WSDLElement in the editor, say a Message. This class - * will find the 'related' elements to this Message and rename them as well. - * It will only rename a 'related' element if the element name (or part of it) - * is generated. - * - * See NameUtil.java - */ -public class SmartRenameAction extends BaseNodeAction implements Runnable { - protected Object element; - protected String newName; - private List messageReferences; // This variable should be accessed by method getAllMessageReferences() - protected Node node; - - public SmartRenameAction(Object element, String newName) { - setText("Smart Rename Action"); // Do not translate //$NON-NLS-1$ - this.element = element; - this.newName = newName; - this.node = WSDLEditorUtil.getInstance().getNodeForObject(element); - } - - public Node getNode() { - return node; - } - - public String getUndoDescription() { - return Messages.getString("_UI_ACTION_RENAME"); //$NON-NLS-1$ - } - - public void run() { - RenameAction renamer; - String oldName; - - beginRecording(); - if (element instanceof Operation) { - Operation operation = (Operation) element; - oldName = operation.getName(); - - if (oldName.equals(newName)) { - return; - } - - // Rename Operation - renamer = new RenameAction(operation, newName); - renamer.run(); - - // Rename Input - Input input = operation.getEInput(); - /* - if (input != null && isInputOutputNameGenerated(oldName, input.getName())) { - renamer = new RenameAction(input, newName); - renamer.run(); - } - */ - - // Rename Output - Output output = operation.getEOutput(); - /* - if (output != null && isInputOutputNameGenerated(oldName, output.getName())) { - renamer = new RenameAction(output, newName); - renamer.run(); - } - */ - - // Rename Messages and Parts - Message msg; - - // Input - if (input != null && input.getEMessage() != null) { - msg = input.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - - if (isMessageNameGenerated(oldMessageName, oldName, "Request")) { //$NON-NLS-1$ - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - } - } - - // Output - if (output != null && output.getMessage() != null) { - msg = output.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - - if (isMessageNameGenerated(oldMessageName, oldName, "Response")) { //$NON-NLS-1$ - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - - } - } - - // Faults - List faults = operation.getEFaults(); - if (faults != null) { - Iterator it = faults.iterator(); - while (it.hasNext()) { - Fault fault = (Fault) it.next(); - msg = fault.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - - if (isMessageNameGenerated(oldMessageName, oldName, fault.getName())) { - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - } - } - } - } - else if (element instanceof Input) { - Input input = (Input) element; - oldName = input.getName(); - if (oldName == null) { - oldName = ""; //$NON-NLS-1$ - } - - if (oldName.equals(newName)) { - return; - } - - input.setName(newName); - -// Rename Messages and Parts - Message msg; - - // Input - if (input != null && input.getEMessage() != null) { - msg = input.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - - if (isMessageNameGenerated(oldMessageName, oldName, "Request")) { //$NON-NLS-1$ - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - } - } - } - else if (element instanceof Output) { - Output output = (Output) element; - oldName = output.getName(); - if (oldName == null) { - oldName = ""; //$NON-NLS-1$ - } - - if (oldName.equals(newName)) { - return; - } - - output.setName(newName); - -// Rename Messages and Parts - Message msg; - - // Output - if (output != null && output.getMessage() != null) { - msg = output.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - if (isMessageNameGenerated(oldMessageName, oldName, "Response")) { //$NON-NLS-1$ - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - } - } - } - else if (element instanceof Fault) { - Fault fault = (Fault) element; - Message msg = fault.getEMessage(); - String oldMessageName = ""; //$NON-NLS-1$ - oldName = fault.getName(); - - if (oldName.equals(newName)) { - return; - } - - // Rename the Fault - renamer = new RenameAction(fault, newName); - renamer.run(); - - // Rename the Message and Parts - if (msg != null) { - oldMessageName = msg.getQName().getLocalPart(); - - Operation op = (Operation) fault.eContainer(); - if (isMessageNameGenerated(oldMessageName, op.getName(), oldName)) { - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renameFaultParts(msg.getEParts(), op.getName(), oldName, newName); - } - } - } - else if (element instanceof Message) { - Message msg = (Message) element; - oldName = msg.getQName().getLocalPart(); - String oldMessageName = msg.getQName().getLocalPart(); - - if (oldName.equals(newName)) { - return; - } - - renameMessageHelper(msg, computeNewMessageName(msg, oldName, newName)); - - if (msg.getEParts() != null) - renamePartsHelper(msg.getEParts(), oldMessageName, msg.getQName().getLocalPart(), true); - } - else if (element instanceof Part) { - Part part = (Part) element; - String oldPartName = part.getName(); - - if (oldPartName.equals(newName)) { - return; - } - - renamer = new RenameAction(element, newName); - renamer.run(); - -// Rename Elements - renameXSDElement(part, oldPartName, newName); - } - else if (element instanceof Port) { - Port port = (Port) element; - String oldPortName = port.getName(); - - renamer = new RenameAction(element, newName); - renamer.run(); - -// Rename Binding - Binding binding = port.getEBinding(); - if (binding != null && binding.getQName().getLocalPart().equals(oldPortName)) { - renamer = new RenameAction(binding, newName); - renamer.run(); - } - } - endRecording(); - } - - // boolean isInputOutput should be set to true if the part is an Input or Output. - // Set false if the part is a Fault. - private void renamePartsHelper(List partsList, String oldSubString, String newSubString, boolean isInputOutput) { - RenameAction renamer; - - if (partsList != null) { - Iterator pIt = partsList.iterator(); - while (pIt.hasNext()) { - Part part = (Part) pIt.next(); - String oldPartName = part.getName(); - - if (isPartNameGenerated(oldPartName, oldSubString)) { - String newPartName; - if (isInputOutput) { - newPartName = computeNewPartName(part, oldSubString, newSubString); - } - else { - newPartName = computeNewFaultPartName(part, oldSubString, newSubString); - } - - renamer = new RenameAction(part, newPartName); - renamer.run(); - - // Rename Elements - renameXSDElement(part, oldPartName, newPartName); - } - } - } - } - - // This method is used to update the Part name when the Fault name is changed. Only - // change the Part name if the part name is a generated name. - // Compare to renamePartsHelper(). The renamePartsHelper() method is called when a Fault - // has NOT been renamed, rather, it is triggered by some other naming (ex. Operation - // renaming). It will updat Input/Output, AND Fault Parts. - private void renameFaultParts(List partsList, String baseName, String oldSubString, String newSubString) { - RenameAction renamer; - - if (partsList != null) { - Iterator pIt = partsList.iterator(); - while (pIt.hasNext()) { - Part part = (Part) pIt.next(); - String oldPartName = part.getName(); - - if (isPartNameGenerated(oldPartName, baseName, oldSubString)) { - String newPartName; - newPartName = computeNewFaultPartName(part, oldSubString, newSubString); - renamer = new RenameAction(part, newPartName); - renamer.run(); - - // Rename Elements - renameXSDElement(part, oldPartName, newPartName); - } - } - } - } - - private String computeNewMessageName(Message message, String oldSubString, String newSubString) { - String string = message.getQName().getLocalPart(); - return replaceSectionWithSubString(string, oldSubString, newSubString, 0); - } - -// private String computeNewFaultMessageName(Message message, String oldSubString, String newSubString) { -// String string = message.getQName().getLocalPart(); -// return replaceSectionWithSubString(string, oldSubString, newSubString, 1); -// } - - // Method for Input, Output, and Fault Parts - // See computeNewFaultPartName() for comparison - private String computeNewPartName(Part part, String oldSubString, String newSubString) { - String string = part.getName(); - return replaceSectionWithSubString(string, oldSubString, newSubString, 0); - } - - // Method for Fault Parts - // This method behaves in the exact same way as computeNewPartName() except it starts searching for a match - // after the first character. This method is intended for users who wish to rename a generated (Fault) part - // where the Fault name has changed. We start our search after the first character because the generated name - // of the part is built by appending the Fault name after the Operation name. - private String computeNewFaultPartName(Part part, String oldSubString, String newSubString) { - String string = part.getName(); - return replaceSectionWithSubString(string, oldSubString, newSubString, 1); - } - - private String replaceSectionWithSubString(String fullString, String oldSubString, String newSubString, int startSearchIndex) { - StringBuffer fullSB = new StringBuffer(fullString); - int index = fullSB.indexOf(oldSubString, startSearchIndex); - if (index >= 0) { - return fullSB.replace(index, index + oldSubString.length(), newSubString).toString(); - } - - return ""; //$NON-NLS-1$ - } - - //////////////////////////////////////////////////////////////////////////////////////// - - private static boolean commonNameGeneratorCheck(String targetName, String baseName, String appendName) { - // First criteria is targetName must start with the baseName - if (!targetName.startsWith(baseName)) - return false; - - if (appendName.trim().length() > 0) { - // Second criteria. The appended name must be in the targetName and begin right - // after the baseName location - if (!targetName.startsWith(appendName, baseName.length())) - return false; - } - - // Third criteria (if necessary). If baseName + appendName is shorter than targetName, - // then there must be 'extra' characters at the end of targetName. These characters must - // make up an integer. If not, it is not a generated string. - int subLength = baseName.length() + appendName.length(); - if (targetName.length() > subLength) { - // We have 'extra' characters - String extras = targetName.substring(subLength); - - if(!isDigit(extras)) - return false; - } - - return true; - } - - public static boolean isOperationNameGenerated(String opName, String name) { - return opName.equals(name); - } - - public static boolean isMessageNameGenerated(String msgName, String baseName, String appendName) { - return commonNameGeneratorCheck(msgName, baseName, appendName); - } - - public static boolean isInputOutputNameGenerated(String inOutName, String name) { - return inOutName.equals(name); - } - - public static boolean isFaultNameGenerated(String faultName, String name) { - return faultName.equals(name); - } - - public static boolean isPartNameGenerated(String partName, String baseName) { - return commonNameGeneratorCheck(partName, baseName, ""); //$NON-NLS-1$ - } - - private boolean isPartNameGenerated(String partName, String baseName, String appendName) { - return commonNameGeneratorCheck(partName, baseName, appendName); - } - - private static boolean isDigit(String string) { - boolean rValue = true; - char[] chars = string.toCharArray(); - - for (int index = 0; index < chars.length; index++) { - if (!Character.isDigit(chars[index])) { - rValue = false; - break; - } - } - - return rValue; - } - - /* - * The following classes aid in renaming a message - */ - private void renameMessageHelper(Message msg, String newName) { - List messageRefs = getReferencingMessageReferences(msg, getAllMessageReferences()); - - RenameAction renamer = new RenameAction(msg, newName); - renamer.run(); - - Iterator iterator = messageRefs.iterator(); - while (iterator.hasNext()) { - MessageReference messageReference = (MessageReference) iterator.next(); - messageReference.setEMessage(msg); - } - } - - private List getReferencingMessageReferences(Message msg, List messageRefs) { - Vector referencesVector = new Vector(); - QName messageQName = msg.getQName(); - Iterator iterator = messageRefs.iterator(); - - while (iterator.hasNext()) { - MessageReference messageReference = (MessageReference) iterator.next(); - if (messageReference.getEMessage() != null && messageQName.equals(messageReference.getEMessage().getQName())) { - referencesVector.addElement(messageReference); - } - } - - return referencesVector; - } - - private List getAllMessageReferences() { - if (messageReferences == null) { - messageReferences = new Vector(); - Definition definition = ((WSDLElement) element).getEnclosingDefinition(); - List portTypes = definition.getEPortTypes(); - - if (portTypes != null) { - Iterator portTypeIterator = portTypes.iterator(); - while (portTypeIterator.hasNext()) { - List operationsList = ((PortType) portTypeIterator.next()).getEOperations(); - - if (operationsList != null) { - Iterator operationsIterator = operationsList.iterator(); - while (operationsIterator.hasNext()) { - messageReferences.addAll(getAllMessageReferences((Operation) operationsIterator.next())); - } - } - } - } - } - - return messageReferences; - } - - private Vector getAllMessageReferences(Operation operation) { - Vector iofs = new Vector(); - Iterator it = operation.getEFaults().iterator(); - while (it.hasNext()) { - iofs.addElement(it.next()); - } - - if (iofs == null) - iofs = new Vector(); - - if (operation.getEInput() != null) - iofs.addElement(operation.getEInput()); - - if (operation.getEOutput() != null) - iofs.addElement(operation.getEOutput()); - - return iofs; - } - - private void renameXSDElement(Part part, String oldXSDName, String newXSDName) { - XSDElementDeclaration elementDeclaration = part.getElementDeclaration(); - if (elementDeclaration != null && oldXSDName.equals(elementDeclaration.getName())) { - renameElementDeclarationHelper(elementDeclaration, oldXSDName, newXSDName); - - // Here we rename the element reference. - // - QName qname = new QName(part.getElementName().getNamespaceURI(), newXSDName); - part.setElementName(qname); - } - } - - private void renameElementDeclarationHelper(XSDElementDeclaration elementDeclaration, String oldXSDName, String newXSDName) { - if (elementDeclaration != null && elementDeclaration.getName().equals(oldXSDName)) { - elementDeclaration.setName(newXSDName); - } - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLAdapterFactory.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLAdapterFactory.java deleted file mode 100644 index dd2e02f7b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLAdapterFactory.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.adapters; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingFault; -import org.eclipse.wst.wsdl.BindingInput; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.BindingOutput; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ExtensibilityElement; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.binding.http.HTTPAddress; -import org.eclipse.wst.wsdl.binding.soap.SOAPAddress; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11BindingMessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11BindingOperation; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Import; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Interface; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Message; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Operation; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Service; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.adapters.specialized.W11AddressExtensibilityElementAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.specialized.W11ExtensibilityElementAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; - -public class WSDLAdapterFactory extends AdapterFactoryImpl -{ - static WSDLAdapterFactory instance; - - public static WSDLAdapterFactory getInstance() - { - if (instance == null) - { - instance = new WSDLAdapterFactory(); - } - return instance; - } - - public Adapter createAdapter(Notifier target) - { - Adapter adapter = null; - - if (target instanceof Definition) { - adapter = new W11Description(); - } - else if (target instanceof Service) { - adapter = new W11Service(); - } - else if (target instanceof Binding) { - adapter = new W11Binding(); - } - else if (target instanceof BindingOperation) { - adapter = new W11BindingOperation(); - } - else if (target instanceof BindingInput || - target instanceof BindingOutput || - target instanceof BindingFault) - { - adapter = new W11BindingMessageReference(); - } - else if (target instanceof Port) { - adapter = new W11EndPoint(); - } - else if (target instanceof PortType) { - adapter = new W11Interface(); - } - else if (target instanceof Operation) { - adapter = new W11Operation(); - } - else if (target instanceof MessageReference) - { - int kind = -1; - if (target instanceof Input) - { - kind = IMessageReference.KIND_INPUT; - } - else if (target instanceof Output) - { - kind = IMessageReference.KIND_OUTPUT; - } - else if (target instanceof Fault) - { - kind = IMessageReference.KIND_FAULT; - } - adapter = new W11MessageReference(kind); - } - else if (target instanceof Import) { - adapter = new W11Import(); - } - else if (target instanceof XSDSchema) { - adapter = new W11Type(); - } - else if (target instanceof Message) { - adapter = new W11Message(); - } - else if (target instanceof Part) - { - adapter = new W11ParameterForPart(); - } - else if (target instanceof Message || - target instanceof XSDConcreteComponent) - { - // not we only need this adapter to serve as an 'otherThingsToListenTo' adapter - // for use by the W11MessageReference when computing a parameter list - adapter = new WSDLBaseAdapter(); - } - else if (target instanceof SOAPAddress || - target instanceof HTTPAddress) - { - // TODO.. we need to enable the factory to delegate to extension language adapter factories - // there should be no references to SOAP or HTTP stuff from within this class - // - adapter = new W11AddressExtensibilityElementAdapter(); - } - else if (target instanceof ExtensibilityElement) - { - adapter = new W11ExtensibilityElementAdapter(); - } - if (adapter == null) - { - System.out.println("NO ADAPTER CREATED FOR " + target); //$NON-NLS-1$ - Thread.dumpStack(); - } - - return adapter; - } - - public Adapter adapt(Notifier target) - { - return adapt(target, this); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLBaseAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLBaseAdapter.java deleted file mode 100644 index e57fe7e1d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/WSDLBaseAdapter.java +++ /dev/null @@ -1,155 +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.adapters; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.gef.commands.Command; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11RenameCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.IActionProvider; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; -import org.eclipse.wst.xml.core.internal.document.ElementImpl; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.xsd.XSDConcreteComponent; -import org.w3c.dom.Element; - -public class WSDLBaseAdapter extends AdapterImpl implements IASDObject, IActionProvider { - protected List listenerList = new ArrayList(); - protected WSDLBaseAdapter owner; - - public void registerListener(IASDObjectListener listener) { - if (!listenerList.contains(listener)) - { - listenerList.add(listener); - } - } - - public void unregisterListener(IASDObjectListener listener) { - listenerList.remove(listener); - } - - public void populateAdapterList(List notifierList, List adapterList) { - for (Iterator i = notifierList.iterator(); i.hasNext();) { - Object o = i.next(); - if (o instanceof Notifier) - { - Notifier component = (Notifier)o; - Adapter adapter = WSDLAdapterFactoryHelper.getInstance().adapt(component); - adapterList.add(adapter); - - if (adapter instanceof WSDLBaseAdapter) { - ((WSDLBaseAdapter) adapter).setOwner(this); - } - } - else - { - System.out.println("populateAdapterListError" + o); //$NON-NLS-1$ - } - } - } - - public Adapter createAdapter(Notifier notifier) { - Adapter adapter = WSDLAdapterFactoryHelper.getInstance().adapt(notifier); - - if (adapter instanceof WSDLBaseAdapter && ((WSDLBaseAdapter) adapter).owner == null) { - ((WSDLBaseAdapter) adapter).setOwner(this); - } - - return adapter; - } - - public String getName() { - return null; - } - - public void setOwner(WSDLBaseAdapter owner) { - this.owner = owner; - } - - public boolean isAdapterForType(Object type) { - return type == WSDLAdapterFactoryHelper.getInstance().getWSDLAdapterFactory(); - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[0]; - - return actionIDs; - } - - public void notifyChanged(Notification msg) - { - super.notifyChanged(msg); - notifyListeners(this, null); - } - - protected void notifyListeners(Object changedObject, String property) - { - List clonedListenerList = new ArrayList(); - clonedListenerList.addAll(listenerList); - for (Iterator i = clonedListenerList.iterator(); i.hasNext(); ) - { - IASDObjectListener listener = (IASDObjectListener)i.next(); - listener.propertyChanged(this, null); - } - } - - public Command getSetNameCommand(String newName) { - return new W11RenameCommand(this, newName); - } - - public boolean isReadOnly() { - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - - if (window != null && window.getActivePage() != null) { - IEditorPart editor = window.getActivePage().getActiveEditor(); - - if (target instanceof WSDLElement && editor instanceof ASDMultiPageEditor) { - Definition definition = ((WSDLElement) target).getEnclosingDefinition(); - W11Description description = (W11Description) ((ASDMultiPageEditor) editor).getModel(); - if (!definition.equals(description.getTarget())) { - return true; - } - } - } - - return fallBackCheckIsReadOnly(); - } - - private boolean fallBackCheckIsReadOnly() { - Element element = null; - if (target instanceof WSDLElement) { - element = ((WSDLElement) target).getElement(); - } - else if (target instanceof XSDConcreteComponent) { - element = ((XSDConcreteComponent) target).getElement(); - } - - if (element instanceof IDOMNode || element instanceof ElementImpl) { - return false; - } - return true; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11AddPartAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11AddPartAction.java deleted file mode 100644 index 2590aa7c9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11AddPartAction.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.adapters.actions; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -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.facade.IMessage; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.commands.AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; - -public class W11AddPartAction extends BaseSelectionAction { - public static String ID = "ASDAddPartAction"; //$NON-NLS-1$ - - public W11AddPartAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_ADD_PART")); //$NON-NLS-1$ - setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/part_obj.gif")); //$NON-NLS-1$ - } - - public void run() { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - MessageReference messageRef = null; - IMessage iMessage = null; - Message message = null; - - if (o instanceof W11MessageReference) { - messageRef = (MessageReference) ((W11MessageReference) o).getTarget(); - message = messageRef.getEMessage(); - } - else if (o instanceof IParameter) { - IParameter param = (IParameter) o; - if (param.getOwner() instanceof IMessage) { - iMessage = (IMessage) param.getOwner(); - } - else if (param.getOwner() instanceof W11MessageReference) { - messageRef = (MessageReference) ((W11MessageReference) param.getOwner()).getTarget(); - message = messageRef.getEMessage(); - } - } - else if (o instanceof IMessage) { - iMessage = (IMessage) o; - } - - if (message == null && iMessage == null && messageRef != null) { - InternalWSDLMultiPageEditor editor = (InternalWSDLMultiPageEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - Definition definition = (Definition) ((W11Description) editor.getModel()).getTarget(); - String messageName = NameUtil.buildUniqueMessageName(definition, "NewMessage"); //$NON-NLS-1$ - AddMessageCommand command = new AddMessageCommand(definition, messageName, false); - command.run(); - message = (Message) command.getWSDLElement(); - messageRef.setEMessage(message); - } - - if (message != null) { - iMessage = (IMessage) WSDLAdapterFactoryHelper.getInstance().adapt(message); - } - - if (iMessage != null) { - Command command = iMessage.getAddPartCommand(); - 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-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingElementAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingElementAction.java deleted file mode 100644 index 3232b5c0a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingElementAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11SetExistingElementAction extends BaseSelectionAction { - public static String ID = "ASDSetExistingElementAction"; //$NON-NLS-1$ - protected WSDLBaseAdapter wsdlBaseAdapter; - - public W11SetExistingElementAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_EXISTING_ELEMENT")); //$NON-NLS-1$ -// setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/message_obj.gif")); - } - - public void run() { - if (wsdlBaseAdapter == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IParameter && o instanceof WSDLBaseAdapter) { - wsdlBaseAdapter = (WSDLBaseAdapter) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getXSDElementReferenceEditManager(wsdlBaseAdapter); - if (wsdlBaseAdapter != null && refManager != null) { - IComponentDialog dialog = refManager.getBrowseDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(wsdlBaseAdapter.getTarget(), spec); - } - } - - wsdlBaseAdapter = null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingMessageAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingMessageAction.java deleted file mode 100644 index bc8e7c9c0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingMessageAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11SetExistingMessageAction extends BaseSelectionAction { - public static String ID = "ASDSetMessageInterfaceAction"; //$NON-NLS-1$ - protected IMessageReference messageReference; - - - public W11SetExistingMessageAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_EXISTING_MESSAGE")); //$NON-NLS-1$ -// setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/message_obj.gif")); - } - - public void run() { - if (messageReference == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IMessageReference) { - messageReference = (IMessageReference) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getMessageReferenceEditManager(messageReference); - if (messageReference != null && refManager != null) { - IComponentDialog dialog = refManager.getBrowseDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(messageReference, spec); - } - } - - messageReference = null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingTypeAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingTypeAction.java deleted file mode 100644 index 037d315b9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetExistingTypeAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11SetExistingTypeAction extends BaseSelectionAction { - public static String ID = "ASDSetExistingTypeAction"; //$NON-NLS-1$ - protected WSDLBaseAdapter wsdlBaseAdapter; - - public W11SetExistingTypeAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_EXISTING_TYPE")); //$NON-NLS-1$ -// setImageDescriptor(ASDEditorPlugin.getImageDescriptor("icons/message_obj.gif")); - } - - public void run() { - if (wsdlBaseAdapter == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IParameter && o instanceof WSDLBaseAdapter) { - wsdlBaseAdapter = (WSDLBaseAdapter) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getXSDTypeReferenceEditManager(wsdlBaseAdapter); - if (wsdlBaseAdapter != null && refManager != null) { - IComponentDialog dialog = refManager.getBrowseDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(wsdlBaseAdapter.getTarget(), spec); - } - } - - wsdlBaseAdapter = null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewElementAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewElementAction.java deleted file mode 100644 index 4566fc808..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewElementAction.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11SetNewElementAction extends BaseSelectionAction { - public static String ID = "ASDSetNewElementAction"; //$NON-NLS-1$ - protected WSDLBaseAdapter wsdlBaseAdapter; - - public W11SetNewElementAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_NEW_ELEMENT")); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void run() { - if (wsdlBaseAdapter == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IParameter && o instanceof WSDLBaseAdapter) { - wsdlBaseAdapter = (WSDLBaseAdapter) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getXSDElementReferenceEditManager(wsdlBaseAdapter); - if (wsdlBaseAdapter != null && refManager != null) { - IComponentDialog dialog = refManager.getNewDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(wsdlBaseAdapter, spec); - } - } - - wsdlBaseAdapter = null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewMessageAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewMessageAction.java deleted file mode 100644 index 4aca01459..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewMessageAction.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11SetNewMessageAction extends BaseSelectionAction { - public static String ID = "ASDSetNewMessageAction"; //$NON-NLS-1$ - protected IMessageReference messageReference; - - public W11SetNewMessageAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_NEW_MESSAGE")); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void setIMessageReference(IMessageReference messageReference) { - this.messageReference = messageReference; - } - - public void run() { - if (messageReference == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IMessageReference) { - messageReference = (IMessageReference) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getMessageReferenceEditManager(messageReference); - if (messageReference != null && refManager != null) { - IComponentDialog dialog = refManager.getNewDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(messageReference, spec); - } - } - - messageReference = null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewTypeAction.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewTypeAction.java deleted file mode 100644 index 6a1fe8181..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/actions/W11SetNewTypeAction.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.adapters.actions; - -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDTypeReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; - -public class W11SetNewTypeAction extends BaseSelectionAction { - public static String ID = "ASDSetNewTypeAction"; //$NON-NLS-1$ - protected WSDLBaseAdapter wsdlBaseAdapter; - - public W11SetNewTypeAction(IWorkbenchPart part) { - super(part); - setId(ID); - setText(Messages.getString("_UI_ACTION_NEW_TYPE")); //$NON-NLS-1$ -// setImageDescriptor(WSDLEditorPlugin.getImageDescriptor("icons/service_obj.gif")); - } - - public void run() { - if (wsdlBaseAdapter == null) { - if (getSelectedObjects().size() > 0) { - Object o = getSelectedObjects().get(0); - if (o instanceof IParameter && o instanceof WSDLBaseAdapter) { - wsdlBaseAdapter = (WSDLBaseAdapter) o; - } - } - } - - ComponentReferenceEditManager refManager = ReferenceEditManagerHelper.getXSDTypeReferenceEditManager(wsdlBaseAdapter); - if (wsdlBaseAdapter != null && refManager != null) { - IComponentDialog dialog = refManager.getNewDialog(); - if (dialog.createAndOpen() == Window.OK) { - ComponentSpecification spec = dialog.getSelectedComponent(); - refManager.modifyComponentReference(wsdlBaseAdapter, spec); - } - } - - wsdlBaseAdapter = null; - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(XSDTypeReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(XSDTypeReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput) { - WSDLElement element = (WSDLElement) wsdlBaseAdapter.getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new WSDLXSDTypeReferenceEditManager(((IFileEditorInput) input).getFile(), null, description); - } - } - - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Binding.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Binding.java deleted file mode 100644 index ba5a9695c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Binding.java +++ /dev/null @@ -1,183 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.binding.http.HTTPBinding; -import org.eclipse.wst.wsdl.binding.soap.SOAPBinding; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11GenerateBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11SetInterfaceCommand; -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.ASDSetExistingInterfaceAction; -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.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11Binding extends WSDLBaseAdapter implements IBinding { - - public IInterface getInterface() { - PortType portType = ((Binding) target).getEPortType(); - if (portType != null) - { - return (IInterface) createAdapter(portType); - } - return null; - } - - public List getBindingContentList() - { - List list = new ArrayList(); - for (Iterator i = ((Binding)target).getEBindingOperations().iterator(); i.hasNext(); ) - { - BindingOperation bindingOperation = (BindingOperation)i.next(); - list.add(bindingOperation); - if (bindingOperation.getEBindingInput() != null) - { - list.add(bindingOperation.getEBindingInput()); - } - if (bindingOperation.getEBindingOutput() != null) - { - list.add(bindingOperation.getEBindingOutput()); - } - list.addAll(bindingOperation.getEBindingFaults()); - } - List adapterList = new ArrayList(); - populateAdapterList(list, adapterList); - return adapterList; - } - - public List getExtensiblityObjects() { - - return null; - } - - public String getName() { - return ((Binding) target).getQName().getLocalPart(); - } - - public String getProtocol() { - Iterator it = ((Binding) target).getEExtensibilityElements().iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item instanceof SOAPBinding) { - return "SOAP"; //$NON-NLS-1$ - } - else if (item instanceof HTTPBinding) { - return "HTTP"; //$NON-NLS-1$ - } - } - - return ""; //$NON-NLS-1$ - } - - public IDescription getOwnerDescription() { - return (IDescription) owner; - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[6]; - actionIDs[0] = ASDGenerateBindingAction.ID; - actionIDs[1] = BaseSelectionAction.SUBMENU_START_ID + Messages.getString("_UI_ACTION_SET_PORTTYPE"); //$NON-NLS-1$ - actionIDs[2] = ASDSetNewInterfaceAction.ID; - actionIDs[3] = ASDSetExistingInterfaceAction.ID; - actionIDs[4] = BaseSelectionAction.SUBMENU_END_ID; - actionIDs[5] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getSetInterfaceCommand(IInterface newInterface) { - W11Interface w11Interface = (W11Interface) newInterface; - return new W11SetInterfaceCommand((Binding) target, (PortType) w11Interface.getTarget()); - } - - public Command getGenerateBindingCommand() { - return new W11GenerateBindingCommand((Binding) this.getTarget()); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Image getImage() - { - // TODO (cs) this is evil code, we need an extension driven - // way to compute this stuff so don't hardcode HTTP or SOAP stuff - // - String protocol = getProtocol(); - String imageName = "icons/binding_obj.gif"; //$NON-NLS-1$ - if (protocol != null) - { - if (protocol.equals("HTTP")) //$NON-NLS-1$ - { - imageName = "icons/httpbinding_obj.gif"; //$NON-NLS-1$ - } - else if (protocol.equals("SOAP")) //$NON-NLS-1$ - { - imageName = "icons/soapbinding_obj.gif"; //$NON-NLS-1$ - } - } - return WSDLEditorPlugin.getInstance().getImage(imageName); - } - - public String getText() - { - return "binding"; - } - - public ITreeElement[] getChildren() - { - List list = getBindingOperations(); - ITreeElement[] result = new ITreeElement[list.size()]; - list.toArray(result); - return result; - } - - public boolean hasChildren() { - if (getBindingOperations().size() > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } - - public List getBindingOperations() - { - List list = new ArrayList(); - populateAdapterList(((Binding)target).getEBindingOperations(), list); - return list; - } - - public List getBindingOperations(boolean createMissingOperations, boolean showExtraOperations) - { - return getBindingOperations(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingMessageReference.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingMessageReference.java deleted file mode 100644 index 89eef5f18..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingMessageReference.java +++ /dev/null @@ -1,108 +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.adapters.basic; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.BindingFault; -import org.eclipse.wst.wsdl.BindingInput; -import org.eclipse.wst.wsdl.BindingOutput; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; - - -public class W11BindingMessageReference extends WSDLBaseAdapter implements IBindingMessageReference, ITreeElement -{ - public ITreeElement[] getChildren() - { - return ITreeElement.EMPTY_LIST; - } - - public boolean hasChildren() { - return false; - } - - public ITreeElement getParent() { - return null; - } - - public Image getImage() - { - String imageName = null; - if (target instanceof BindingInput) - { - imageName = "icons/input_obj.gif"; //$NON-NLS-1$ - } - else if (target instanceof BindingOutput) - { - imageName = "icons/output_obj.gif"; //$NON-NLS-1$ - } - else //if (target instanceof BindingFault) - { - imageName = "icons/fault_obj.gif"; //$NON-NLS-1$ - } - return WSDLEditorPlugin.getInstance().getImage(imageName); - } - - public String getName() - { - String name = ""; //$NON-NLS-1$ - if (target instanceof BindingInput) - { - name = "input"; - } - else if (target instanceof BindingOutput) - { - name = "output"; - } - else //if (target instanceof BindingFault) - { - name = "fault"; - } - - return name; - } - - public String getText() - { - return getName(); - } - - public IMessageReference getMessageReference() - { - EObject resultNotifier = null; - if (target instanceof BindingInput) - { - resultNotifier = ComponentReferenceUtil.computeInput((BindingInput)target); - } - else if (target instanceof BindingOutput) - { - resultNotifier = ComponentReferenceUtil.computeOutput((BindingOutput)target); - } - else if (target instanceof BindingFault) - { - resultNotifier = ComponentReferenceUtil.computeFault((BindingFault)target); - } - return resultNotifier != null ? (IMessageReference)createAdapter(resultNotifier) : null; - } - - public List getExtensiblityObjects() - { - return Collections.EMPTY_LIST; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingOperation.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingOperation.java deleted file mode 100644 index 2e3ded44f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11BindingOperation.java +++ /dev/null @@ -1,96 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBindingOperation; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; - -public class W11BindingOperation extends WSDLBaseAdapter implements IBindingOperation, ITreeElement -{ - - public IOperation getOperation() - { - BindingOperation bindingOperation = (BindingOperation)target; - Operation operation = ComponentReferenceUtil.computeOperation(bindingOperation); - return operation != null ? (IOperation)createAdapter(operation) : null; - } - - public List getBindingMessages() - { - List list = new ArrayList(); - BindingOperation bindingOperation = (BindingOperation)target; - if (bindingOperation.getEBindingInput() != null) - { - list.add(bindingOperation.getEBindingInput()); - } - if (bindingOperation.getEBindingOutput() != null) - { - list.add(bindingOperation.getEBindingOutput()); - } - list.addAll(bindingOperation.getEBindingFaults()); - List result = new ArrayList(); - populateAdapterList(list, result); - return result; - } - - public String getName() - { - BindingOperation bindingOperation = (BindingOperation)target; - return bindingOperation.getEOperation().getName(); - } - - public List getExtensiblityObjects() - { - return Collections.EMPTY_LIST; - } - - public ITreeElement[] getChildren() - { - List list = getBindingMessages(); - ITreeElement[] result = new ITreeElement[list.size()]; - list.toArray(result); - return result; - } - - public boolean hasChildren() { - if (getBindingMessages().size() > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } - - public Image getImage() - { - String imageName = "icons/operationbinding_obj.gif"; //$NON-NLS-1$ - return WSDLEditorPlugin.getInstance().getImage(imageName); - } - - public String getText() - { - return getName(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11CategoryAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11CategoryAdapter.java deleted file mode 100644 index d8df6e6f3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11CategoryAdapter.java +++ /dev/null @@ -1,144 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddImportAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddMessageAction; -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.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11CategoryAdapter extends WSDLBaseAdapter implements ICategoryAdapter, ITreeElement { - public final static int IMPORTS = 1; - public final static int TYPES = 2; - public final static int SERVICES = 3; - public final static int BINDINGS = 5; - public final static int INTERFACES = 6; - public final static int MESSAGES = 7; - - public static String IMPORTS_HEADER_TEXT = Messages.getString("_UI_FOLDER_IMPORTS"); //$NON-NLS-1$ - public static String TYPES_HEADER_TEXT = Messages.getString("_UI_FOLDER_TYPES"); //$NON-NLS-1$ - public static String SERVICE_HEADER_TEXT = Messages.getString("_UI_FOLDER_SERVICES"); //$NON-NLS-1$ - public static String BINDING_HEADER_TEXT = Messages.getString("_UI_FOLDER_BINDINGS"); //$NON-NLS-1$ - public static String INTERFACE_HEADER_TEXT = Messages.getString("_UI_FOLDER_PORTTYPES"); //$NON-NLS-1$ - public static String MESSAGE_HEADER_TEXT = Messages.getString("_UI_FOLDER_MESSAGES"); //$NON-NLS-1$ - - protected String text; - protected Image image; - protected int groupType; - protected Collection children; - protected IDescription description; - - public W11CategoryAdapter(IDescription description, String label, Image image, Collection children, int groupType) { - this.text = label; - this.image = image; - this.description = description; - this.target = ((W11Description) description).getTarget(); - this.children = children; - this.groupType = groupType; - } - - public Definition getDefinition() { - return (Definition) target; - } - - public IDescription getOwnerDescription() { - return description; - } - - public int getGroupType() { - return groupType; - } - - public Image getImage() { - return image; - } - - public String getText() { - return text; - } - - public ITreeElement[] getChildren() { - return (ITreeElement[]) children.toArray(new ITreeElement[0]); - } - - public void setChildren(Collection list) { - children = list; - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - return true; - } - - public String[] getActions(Object object) { - Collection actionIDs = new ArrayList(); - - switch (groupType) { - case IMPORTS : { - actionIDs.add(ASDAddImportAction.ID); - break; - } - case TYPES : { - actionIDs.add(ASDAddSchemaAction.ID); - break; - } - case SERVICES : { - actionIDs.add(ASDAddServiceAction.ID); - break; - } - case BINDINGS : { - actionIDs.add(ASDAddBindingAction.ID); - break; - } - case INTERFACES : { - actionIDs.add(ASDAddInterfaceAction.ID); - break; - } - case MESSAGES : { - actionIDs.add(ASDAddMessageAction.ID); - break; - } - } - return (String [])actionIDs.toArray(new String[0]); - } - - public void propertyChanged(Object object, String property) { - if (getText().equals(property)) - notifyListeners(this, property); - } - - public ITreeElement getParent() { - return null; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Description.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Description.java deleted file mode 100644 index 621110263..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Description.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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.impl.NotificationImpl; -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.WSDLPackage; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddImportCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddInterfaceCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddSchemaCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddServiceCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddBindingAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddInterfaceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddServiceAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; - -public class W11Description extends WSDLBaseAdapter implements IDescription { - protected W11CategoryAdapter getCategory(int categoryId) { - Iterator it = getCategoryAdapters().iterator(); - while (it.hasNext()) { - W11CategoryAdapter adapter = (W11CategoryAdapter) it.next(); - if (adapter.getGroupType() == categoryId) { - return adapter; - } - } - - return null; - } - - private List getCategoryAdapters() { - return createCategoryAdapters(); - } - - protected List createCategoryAdapters() { - List categories = new ArrayList(); - - List importList = getImports(); - List schemaList = getTypes(); - List serviceList = getServices(); - List bindingList = getBindings(); - List interfaceList = getInterfaces(); - List messageList = getMessages(); - - String categoryTitle = W11CategoryAdapter.IMPORTS_HEADER_TEXT; - Image categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/importheader_obj.gif"); //$NON-NLS-1$ - W11CategoryAdapter category = new W11CategoryAdapter(this, categoryTitle, categoryImage, importList, W11CategoryAdapter.IMPORTS); - categories.add(category); - - categoryTitle = W11CategoryAdapter.TYPES_HEADER_TEXT; - categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/types_obj.gif"); //$NON-NLS-1$ - category = new W11CategoryAdapter(this, categoryTitle, categoryImage, schemaList, W11CategoryAdapter.TYPES); - categories.add(category); - - categoryTitle = W11CategoryAdapter.SERVICE_HEADER_TEXT; - categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/serviceheader_obj.gif"); //$NON-NLS-1$ - category = new W11CategoryAdapter(this, categoryTitle, categoryImage, serviceList, W11CategoryAdapter.SERVICES); - categories.add(category); - - categoryTitle = W11CategoryAdapter.BINDING_HEADER_TEXT; - categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/bindingheader_obj.gif"); //$NON-NLS-1$ - category = new W11CategoryAdapter(this, categoryTitle, categoryImage, bindingList, W11CategoryAdapter.BINDINGS); - categories.add(category); - - categoryTitle = W11CategoryAdapter.INTERFACE_HEADER_TEXT; - categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/porttypeheader_obj.gif"); //$NON-NLS-1$ - category = new W11CategoryAdapter(this, categoryTitle, categoryImage, interfaceList, W11CategoryAdapter.INTERFACES); - categories.add(category); - - categoryTitle = W11CategoryAdapter.MESSAGE_HEADER_TEXT; - categoryImage = WSDLEditorPlugin.getInstance().getImage("icons/messageheader_obj.gif"); //$NON-NLS-1$ - category = new W11CategoryAdapter(this, categoryTitle, categoryImage, messageList, W11CategoryAdapter.MESSAGES); - categories.add(category); - - return categories; - } - - public String getTargetNamespace() { - return ((Definition) target).getTargetNamespace(); - } - - public String getTargetNamespacePrefix() { - String tns = getTargetNamespace(); - return ((Definition) target).getPrefix(tns); - } - - public List getServices() { - List adapterList = new ArrayList(); - ComponentReferenceUtil util = new ComponentReferenceUtil((Definition) getTarget()); - List services = util.getServices(); - populateAdapterList(services, adapterList); - - return adapterList; - } - - public List getBindings() { - List adapterList = new ArrayList(); - ComponentReferenceUtil util = new ComponentReferenceUtil((Definition) getTarget()); - List bindings = util.getBindings(); - populateAdapterList(bindings, adapterList); - - return adapterList; - } - - public List getInterfaces() { - List adapterList = new ArrayList(); - ComponentReferenceUtil util = new ComponentReferenceUtil((Definition) getTarget()); - List portTypes = util.getPortTypes(); - populateAdapterList(portTypes, adapterList); - - return adapterList; - } - - public List getImports() { - List adapterList = new ArrayList(); - populateAdapterList(((Definition) target).getEImports(), adapterList); - - return adapterList; - } - - public List getTypes() { - List adapterList = new ArrayList(); - Types types = ((Definition) target).getETypes(); - if (types != null) - { - populateAdapterList(types.getSchemas(), adapterList); - } - return adapterList; - } - - public List getMessages() { - List adapterList = new ArrayList(); - ComponentReferenceUtil util = new ComponentReferenceUtil((Definition) getTarget()); - List messages = util.getMessages(); - populateAdapterList(messages, adapterList); - - return adapterList; - } - - public String getName() { - String name = ""; //$NON-NLS-1$ - - Definition definition = ((Definition) target); - if (definition.getQName() != null) { - name = definition.getQName().getLocalPart(); - } - return name; - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[3]; - actionIDs[0] = ASDAddServiceAction.ID; - actionIDs[1] = ASDAddBindingAction.ID; - actionIDs[2] = ASDAddInterfaceAction.ID; - - return actionIDs; - } - - public Command getAddImportCommand() { - return new W11AddImportCommand((Definition) target); - } - - public Command getAddSchemaCommand() { - return new W11AddSchemaCommand((Definition) target); - } - - public Command getAddServiceCommand() { - return new W11AddServiceCommand((Definition) target); - } - - public Command getAddBindingCommand() { - return new W11AddBindingCommand((Definition) target); - } - - public Command getAddInterfaceCommand() { - return new W11AddInterfaceCommand((Definition) target); - } - - public Command getAddMessageCommand() { - return new W11AddMessageCommand((Definition) target); - } - - public Image getImage() { - return null; - } - - public String getText() { - return "description"; - } - - public ITreeElement[] getChildren() { - List children = getCategoryAdapters(); - return (ITreeElement[]) children.toArray(new ITreeElement[0]); - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } - - public void notifyChanged(final Notification msg) { - class CategoryNotification extends NotificationImpl { - protected Object category; - - public CategoryNotification(Object category) { - super(msg.getEventType(), msg.getOldValue(), msg.getNewValue(), msg.getPosition()); - this.category = category; - } - - public Object getNotifier() { - return category; - } - - public Object getFeature() { - return msg.getFeature(); - } - } - - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_EImports()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.IMPORTS); - Assert.isTrue(adapter != null); - adapter.setChildren(getImports()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_ETypes()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.IMPORTS); - Assert.isTrue(adapter != null); - adapter.setChildren(getImports()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_EServices()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.SERVICES); - Assert.isTrue(adapter != null); - adapter.setChildren(getServices()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_EBindings()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.BINDINGS); - Assert.isTrue(adapter != null); - adapter.setChildren(getBindings()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_EPortTypes()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.INTERFACES); - Assert.isTrue(adapter != null); - adapter.setChildren(getInterfaces()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - if (msg.getFeature() == WSDLPackage.eINSTANCE.getDefinition_EMessages()) { - W11CategoryAdapter adapter = getCategory(W11CategoryAdapter.MESSAGES); - Assert.isTrue(adapter != null); - adapter.setChildren(getMessages()); - notifyListeners(new CategoryNotification(adapter), adapter.getText()); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11EndPoint.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11EndPoint.java deleted file mode 100644 index dd39505d4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11EndPoint.java +++ /dev/null @@ -1,197 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.binding.http.HTTPAddress; -import org.eclipse.wst.wsdl.binding.soap.SOAPAddress; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11SetAddressCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11SetBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.specialized.W11AddressExtensibilityElementAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddEndPointAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -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.actions.BaseSelectionAction; -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.IBinding; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11EndPoint extends WSDLBaseAdapter implements IEndPoint, IASDObjectListener { - - protected List addressExtensiblityElements = null; - protected List thingsToListenTo = null; - - public String getAddress() { - List list = getAddressExtensiblityElements(); - if (list.size() > 0) - { - W11AddressExtensibilityElementAdapter addressEE = (W11AddressExtensibilityElementAdapter)list.get(0); - return addressEE.getLocationURI(); - } - return ""; //$NON-NLS-1$ - } - - protected List getAddressExtensiblityElements() - { - if (addressExtensiblityElements == null || addressExtensiblityElements.size() == 0) - { - addressExtensiblityElements = new ArrayList(); - thingsToListenTo = new ArrayList(); - Port port = (Port) getTarget(); - for (Iterator it = port.getEExtensibilityElements().iterator(); it.hasNext(); ) - { - Notifier item = (Notifier)it.next(); - Adapter adapter = createAdapter(item); - if (adapter instanceof W11AddressExtensibilityElementAdapter) - { - addressExtensiblityElements.add(adapter); - } - if (adapter instanceof IASDObject) - { - thingsToListenTo.add(adapter); - } - } - for (Iterator i = thingsToListenTo.iterator(); i.hasNext(); ) - { - IASDObject object = (IASDObject)i.next(); - object.registerListener(this); - } - } - return addressExtensiblityElements; - } - - protected void clearAddressExtensiblityElements() - { - if (thingsToListenTo != null) - { - for (Iterator i = thingsToListenTo.iterator(); i.hasNext(); ) - { - IASDObject object = (IASDObject)i.next(); - object.unregisterListener(this); - } - } - thingsToListenTo = null; - addressExtensiblityElements = null; - } - - public IBinding getBinding() { - if (getPort().getEBinding() != null) { - return (IBinding) createAdapter(getPort().getEBinding()); - } - - return null; - } - - public String getName() { - return getPort().getName(); - } - - public String getTypeName() { - String value = ""; //$NON-NLS-1$ - List eeElements = getPort().getEExtensibilityElements(); - if (eeElements.size() > 0) { - Object object = eeElements.get(0); - if (object instanceof SOAPAddress) { - value = ((SOAPAddress) object).getLocationURI(); - } - else if (object instanceof HTTPAddress) { - value = ((HTTPAddress) object).getLocationURI(); - } - } - - if (value == null || value.equals("")) { //$NON-NLS-1$ - value = "No Address"; - } - - return value; - } - - public Object getType() { - return getBinding(); - } - - private Port getPort() { - return (Port) target; - } - - public IService getOwnerService() { - return (IService) owner; - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[6]; - actionIDs[0] = ASDAddEndPointAction.ID; - actionIDs[1] = BaseSelectionAction.SUBMENU_START_ID + Messages.getString("_UI_ACTION_SET_BINDING"); //$NON-NLS-1$ - actionIDs[2] = ASDSetNewBindingAction.ID; - actionIDs[3] = ASDSetExistingBindingAction.ID; - actionIDs[4] = BaseSelectionAction.SUBMENU_END_ID; - actionIDs[5] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getSetBindingCommand(IBinding binding) { - W11Binding w11Binding = (W11Binding) binding; - return new W11SetBindingCommand((Port) target, (Binding) w11Binding.getTarget()); - } - - public Command getSetAddressCommand(String newAddress) { - return new W11SetAddressCommand((Port) this.getTarget(), newAddress); - } - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public void propertyChanged(Object object, String property) - { - // this is called when one of the 'address' extensibility element adapters we're listening to changes - // - clearAddressExtensiblityElements(); - notifyListeners(this, null); - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/port_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "port"; - } - - public ITreeElement[] getChildren() { - return ITreeElement.EMPTY_LIST; - } - - public boolean hasChildren() { - return false; - } - - public ITreeElement getParent() { - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Import.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Import.java deleted file mode 100644 index 18fa96cbf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Import.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.basic; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11Import extends WSDLBaseAdapter implements IImport { - - public Import getImport() { - return (Import) target; - } - - public String getNamespace() { - return getImport().getNamespaceURI(); - } - - public String getNamespacePrefix() { - return getImport().getEnclosingDefinition().getPrefix(getNamespace()); - } - - public String getLocation() { - return getImport().getLocationURI(); - } - - public IDescription getOwnerDescription() { - return (IDescription) owner; - } - - public String getName() { - Import theImport = (Import) target; - return theImport.getLocationURI(); - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[1]; - actionIDs[0] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/import_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "import"; - } - - public ITreeElement[] getChildren() { - return ITreeElement.EMPTY_LIST; - } - - public boolean hasChildren() { - return false; - } - - public ITreeElement getParent() { - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Interface.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Interface.java deleted file mode 100644 index 0c15b80ce..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Interface.java +++ /dev/null @@ -1,87 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddOperationCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddOperationAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11Interface extends WSDLBaseAdapter implements IInterface { - - public List getOperations() { - List adapterList = new ArrayList(); - populateAdapterList(((PortType) target).getEOperations(), adapterList); - - return adapterList; - } - - public String getName() { - return ((PortType) target).getQName().getLocalPart(); - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[2]; - actionIDs[0] = ASDAddOperationAction.ID; - actionIDs[1] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getAddOperationCommand() { - return new W11AddOperationCommand((PortType) target); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/porttype_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "portType"; - } - - public ITreeElement[] getChildren() { - List operations = getOperations(); - ITreeElement[] treeElements = new ITreeElement[operations.size()]; - - for (int index = 0; index < operations.size(); index++) { - treeElements[index] = (ITreeElement) operations.get(index); - } - - return treeElements; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Message.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Message.java deleted file mode 100644 index 353c47a03..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Message.java +++ /dev/null @@ -1,108 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11AddPartAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddPartCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessage; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; - - -public class W11Message extends WSDLBaseAdapter implements IMessage { - - public List getParts() { - List adapterList = new ArrayList(); -// populateAdapterList(((Message) target).getEParts(), adapterList); - Iterator parts = ((Message) target).getEParts().iterator(); - while (parts.hasNext()) { - Notifier component = (Notifier) parts.next(); - Adapter adapter = WSDLAdapterFactoryHelper.getInstance().adapt(component); - adapterList.add(adapter); - } - - return adapterList; - } - - public IDescription getOwnerDescription() { - return (IDescription) owner; - } - - public String getName() { - return ((Message) target).getQName().getLocalPart(); - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[2]; - actionIDs[0] = W11AddPartAction.ID; - actionIDs[1] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getAddPartCommand() { - return new W11AddPartCommand((Message) target); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Command getSetNameCommand(String newName) { - - return null; - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/message_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "message"; - } - - public ITreeElement[] getChildren() { - List parts = getParts(); - ITreeElement[] treeElements = new ITreeElement[parts.size()]; - - for (int index = 0; index < parts.size(); index++) { - treeElements[index] = (ITreeElement) parts.get(index); - } - - return treeElements; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java deleted file mode 100644 index 9e3c66d92..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11MessageReference.java +++ /dev/null @@ -1,282 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11AddPartAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingMessageAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewMessageAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11ReorderParametersCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddFaultAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddOperationAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -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.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.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.visitor.WSDLVisitorForParameters; - - -public class W11MessageReference extends WSDLBaseAdapter implements IMessageReference, IASDObjectListener -{ - protected int messageKind = -1; - protected List parameters = null; - protected List otherThingsToListenTo = null; - - public W11MessageReference(int messageKind) - { - this.messageKind = messageKind; - } - - public IOperation getOwnerOperation() - { - return (IOperation) owner; - } - - public String getPreview() { - String previewString = "()"; - List params = getParameters(); - // For now, just look at the first Part for the preview - if (params.size() > 0) { - IParameter param = (IParameter) params.get(0); - - previewString = param.getPreview(); - } - - return previewString; - } - - // Convenience method - public MessageReference getMessageReference() - { - return (MessageReference) target; - } - - protected void computeMessageKind() - { - if (getMessageReference() instanceof Input) - { - messageKind = KIND_INPUT; - } - else if (getMessageReference() instanceof Output) - { - messageKind = KIND_OUTPUT; - } - else if (getMessageReference() instanceof Fault) - messageKind = KIND_FAULT; - } - - public int getKind() - { - if (messageKind == -1) - { - computeMessageKind(); - } - return messageKind; - } - - public String getName() - { - if (getKind() == KIND_INPUT) - { - return "input"; - } - else if (getKind() == KIND_OUTPUT) - { - return "output"; - } - else if (getKind() == KIND_FAULT) - { - return "fault"; - } - return "NoName"; - } - - /* - * XSD Elements or WSDL Parts... - */ - public List getParameters() - { - List parameters = new ArrayList(); - List parts = new ArrayList(); - MessageReference messageRef = getMessageReference(); - if (messageRef != null) { - if (messageRef.getEMessage() != null) { - if (messageRef.getEMessage().getEParts() != null) { - parts = messageRef.getEMessage().getEParts(); - } - } - } - - populateAdapterList(parts, parameters); - - otherThingsToListenTo = new ArrayList(); - WSDLVisitorForParameters visitorForParameters = new WSDLVisitorForParameters(); - visitorForParameters.visitMessageReference(messageRef); - populateAdapterList(visitorForParameters.concreteComponents, otherThingsToListenTo); - populateAdapterList(visitorForParameters.thingsToListenTo, otherThingsToListenTo); - - // now we listen to all the 'things we need to listen to' - // - for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext();) - { - Adapter adapter = (Adapter) i.next(); - if (adapter instanceof IASDObject) - { - IASDObject asdObject = (IASDObject) adapter; - asdObject.registerListener(this); - } - } - - return parameters; - } - - public void propertyChanged(Object object, String property) - { - // this method is called when one of the 'otherThingsToListenTo' has changed - // when one of these things changes it means our paramter list may have changes - // so we need to recompute it - Object notifier = null; - if (object instanceof Adapter) - { - notifier = ((Adapter)object).getTarget(); - } - //System.out.println("something in the 'otherThingsToListenTo' list has changed " + notifier); - clearParameters(); - notifyListeners(this, null); - } - - protected void clearParameters() - { - if (otherThingsToListenTo != null) - { - for (Iterator i = otherThingsToListenTo.iterator(); i.hasNext();) - { - Adapter adapter = (Adapter) i.next(); - if (adapter instanceof IASDObject) - { - IASDObject asdObject = (IASDObject) adapter; - asdObject.unregisterListener(this); - } - } - } - parameters = null; - otherThingsToListenTo = null; - } - - public void notifyChanged(Notification msg) - { - clearParameters(); - super.notifyChanged(msg); - } - - public String[] getActions(Object object) - { - List actions = new ArrayList(); - actions.add(ASDAddOperationAction.ID); - actions.addAll(((W11Operation) getOwnerOperation()).getValidInputOutpuActions()); - actions.add(ASDAddFaultAction.ID); - actions.add(W11AddPartAction.ID); - actions.add(ASDDeleteAction.ID); - actions.add(BaseSelectionAction.SUBMENU_START_ID + Messages.getString("_UI_ACTION_SET_MESSAGE")); //$NON-NLS-1$ - actions.add(W11SetNewMessageAction.ID); - actions.add(W11SetExistingMessageAction.ID); - actions.add(BaseSelectionAction.SUBMENU_END_ID); - - String[] actionIDs = new String[actions.size()]; - for (int index = 0; index < actions.size(); index++) { - actionIDs[index] = (String) actions.get(index); - } - - return actionIDs; - } - - public Command getReorderParametersCommand(IParameter leftSibling, IParameter rightSibling, IParameter movingParameter) { - return new W11ReorderParametersCommand(leftSibling, rightSibling, movingParameter); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Image getImage() { - if (getKind() == KIND_INPUT) - { - return WSDLEditorPlugin.getInstance().getImage("icons/input_obj.gif"); //$NON-NLS-1$ - } - else if (getKind() == KIND_OUTPUT) - { - return WSDLEditorPlugin.getInstance().getImage("icons/output_obj.gif"); //$NON-NLS-1$ - } - else if (getKind() == KIND_FAULT) - { - return WSDLEditorPlugin.getInstance().getImage("icons/fault_obj.gif"); //$NON-NLS-1$ - } - return null; - } - - public String getText() { - if (getKind() == KIND_INPUT) - { - return "Input(s)"; - } - else if (getKind() == KIND_OUTPUT) - { - return "Output(s)"; - } - else if (getKind() == KIND_FAULT) - { - return "Fault(s)"; - } - return "NoName"; - } - - public ITreeElement[] getChildren() { - List parts = getParameters(); - ITreeElement[] treeElements = new ITreeElement[parts.size()]; - - for (int index = 0; index < parts.size(); index++) { - treeElements[index] = (ITreeElement) parts.get(index); - } - - return treeElements; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } - }
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Operation.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Operation.java deleted file mode 100644 index 84e5d5749..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Operation.java +++ /dev/null @@ -1,179 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.wsdl.OperationType; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddFaultParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddInputParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddOutputParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11ReorderMessageReferencesCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddFaultAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddInputAction; -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.ASDDeleteAction; -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.outline.ITreeElement; - -public class W11Operation extends WSDLBaseAdapter implements IOperation { - public List getMessages() - { - List modelAdapterList = new ArrayList(getOperation().getEFaults().size() + 2); - - Input input = getOperation().getEInput(); - Output output = getOperation().getEOutput(); - - OperationType operationType = getOperation().getStyle(); - if (operationType != null) { - if (operationType.equals(OperationType.REQUEST_RESPONSE) && input != null && output != null) { - // Input, Output - modelAdapterList.add(createAdapter(input)); - modelAdapterList.add(createAdapter(output)); - } - else if (operationType.equals(OperationType.SOLICIT_RESPONSE) && input != null && output != null) { - // Output, Input - modelAdapterList.add(createAdapter(output)); - modelAdapterList.add(createAdapter(input)); - } - else if (operationType.equals(OperationType.ONE_WAY) && input != null) { - // Input - modelAdapterList.add(createAdapter(input)); - } - else if (operationType.equals(OperationType.NOTIFICATION) && output != null) { - //Output - modelAdapterList.add(createAdapter(output)); - } - } - - for (Iterator i = getOperation().getEFaults().iterator(); i.hasNext();) { - EObject o = (EObject) i.next(); - modelAdapterList.add(createAdapter(o)); - } - - return modelAdapterList; - } - - // Convienence method - public Operation getOperation() - { - return (Operation) target; - } - - public String getName() - { - return getOperation().getName(); - } - - public IInterface getOwnerInterface() - { - return (IInterface)owner; - } - - public String[] getActions(Object object) { - List actions = new ArrayList(); - actions.add(ASDAddOperationAction.ID); - actions.addAll(getValidInputOutpuActions()); - actions.add(ASDAddFaultAction.ID); - actions.add(ASDDeleteAction.ID); - - String[] actionIDs = new String[actions.size()]; - for (int index = 0; index < actions.size(); index++) { - actionIDs[index] = (String) actions.get(index); - } - - return actionIDs; - } - - public Command getAddInputCommand() { - return new W11AddInputParameterCommand(getOperation()); - } - - public Command getAddOutputCommand() { - return new W11AddOutputParameterCommand(getOperation()); - } - - public Command getAddFaultCommand(Object fault) { - Fault aFault = null; - if (fault instanceof Fault) { - aFault = (Fault) fault; - } - return new W11AddFaultParameterCommand(getOperation(), aFault); - } - - public Command getReorderMessageReferencesCommand(IMessageReference leftSibling, IMessageReference rightSibling, IMessageReference movingMessageRef) { - return new W11ReorderMessageReferencesCommand(leftSibling, rightSibling, movingMessageRef); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public List getValidInputOutpuActions() { - List list = new ArrayList(); - - if (getOperation().getEInput() == null) { - list.add(ASDAddInputAction.ID); - } - if (getOperation().getEOutput() == null) { - list.add(ASDAddOutputAction.ID); - } - - return list; - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/operation_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "operation"; - } - - public ITreeElement[] getChildren() { - List messages = getMessages(); - ITreeElement[] treeElements = new ITreeElement[messages.size()]; - - for (int index = 0; index < messages.size(); index++) { - treeElements[index] = (ITreeElement) messages.get(index); - } - - return treeElements; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java deleted file mode 100644 index edf8dda9b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11ParameterForPart.java +++ /dev/null @@ -1,233 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.part.MultiPageEditorPart; -import org.eclipse.ui.views.contentoutline.ContentOutline; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11AddPartAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingElementAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetExistingTypeAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewElementAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.actions.W11SetNewTypeAction; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11SetElementCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11SetTypeCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddFaultAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddOperationAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IOperation; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.wst.wsdl.ui.internal.visitor.WSDLVisitorForParameters; -import org.eclipse.xsd.XSDAttributeUse; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; - - -public class W11ParameterForPart extends WSDLBaseAdapter implements IParameter -{ - protected Part getPart() - { - return (Part) target; - } - - public String getName() - { - return getPart().getName(); - } - - public String getComponentName() - { - if (getPart().getElementDeclaration() != null) - { - return getPart().getElementDeclaration().getName(); - } - else if (getPart().getTypeDefinition() != null) - { - return getPart().getTypeDefinition().getName(); - } - else - { - return "(no name specified)"; - } - } - - public String getComponentNameQualifier() - { - if (getPart().getElementDeclaration() != null) - { - return getPart().getElementDeclaration().getTargetNamespace(); - } - else if (getPart().getTypeDefinition() != null) - { - return getPart().getTypeDefinition().getTargetNamespace(); - } - else - { - return "(no namespace specified)"; - } - } - - public String getPreview() { - String preview = ""; //$NON-NLS-1$ - -// parameters = new ArrayList(); -// otherThingsToListenTo = new ArrayList(); - WSDLVisitorForParameters visitorForParameters = new WSDLVisitorForParameters(); - visitorForParameters.visitMessage((Message) getPart().eContainer()); - - Iterator it = visitorForParameters.concreteComponents.iterator(); - while (it.hasNext()) { - String stringItem = null; - Object item = it.next(); - if (item instanceof XSDElementDeclaration) { - XSDElementDeclaration xsdElement = (XSDElementDeclaration) item; - xsdElement = xsdElement.getResolvedElementDeclaration(); - if (xsdElement.getTypeDefinition() != null) { - stringItem = xsdElement.getTypeDefinition().getName(); - } - } - else if (item instanceof XSDAttributeUse) { - stringItem = ((XSDAttributeUse) item).getAttributeDeclaration().getName(); - } - - else if (item instanceof Part) { - if (((Part) item).getTypeDefinition() != null) { - stringItem = ((Part) item).getTypeDefinition().getName(); - } - } - - if (stringItem != null) { - preview = preview + stringItem + ", "; //$NON-NLS-1$ - } - } - - if (preview.length() -2 > 0) { - preview = preview.substring(0, preview.length() - 2); - } - - return "(" + preview + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - public String[] getActions(Object object) { - if (object instanceof MultiPageEditorPart) { - IOperation operation = ((IMessageReference) getOwner()).getOwnerOperation(); - - List actions = new ArrayList(); - actions.add(W11AddPartAction.ID); - actions.add(ASDAddOperationAction.ID); - actions.addAll(((W11Operation) operation).getValidInputOutpuActions()); - actions.add(ASDAddFaultAction.ID); - - actions.add(BaseSelectionAction.SUBMENU_START_ID + Messages.getString("_UI_ACTION_SET_TYPE")); //$NON-NLS-1$ - actions.add(W11SetNewTypeAction.ID); - actions.add(W11SetExistingTypeAction.ID); - actions.add(BaseSelectionAction.SUBMENU_END_ID); - - actions.add(BaseSelectionAction.SUBMENU_START_ID + Messages.getString("_UI_ACTION_SET_ELEMENT")); //$NON-NLS-1$ - actions.add(W11SetNewElementAction.ID); - actions.add(W11SetExistingElementAction.ID); - actions.add(BaseSelectionAction.SUBMENU_END_ID); - - actions.add(ASDDeleteAction.ID); - - String[] actionIDs = new String[actions.size()]; - for (int index = 0; index < actions.size(); index++) { - actionIDs[index] = (String) actions.get(index); - } - - return actionIDs; - } - if (object instanceof ContentOutline) { - String[] actionIDs = new String[2]; - actionIDs[0] = W11AddPartAction.ID; - actionIDs[1] = ASDDeleteAction.ID; - - return actionIDs; - } - - return new String[0]; - } - - public Command getDeleteCommand() - { - return new W11DeleteCommand(this); - } - - public Object getOwner() - { - return owner; - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/part_obj.gif"); //$NON-NLS-1$ - } - - public Image getSecondaryImage() { - - if (getPart().getElementDeclaration() != null) - { - return WSDLEditorPlugin.getInstance().getImage("icons/element_obj.gif"); - } - else if (getPart().getTypeDefinition() != null) - { - if (getPart().getTypeDefinition() instanceof XSDComplexTypeDefinition) - { - return WSDLEditorPlugin.getInstance().getImage("icons/complextype_obj.gif"); - } - else - { - return WSDLEditorPlugin.getInstance().getImage("icons/simpletype_obj.gif"); - } - } - else - { - return WSDLEditorPlugin.getInstance().getImage("icons/part_obj.gif"); //$NON-NLS-1$ - } - } - - public String getText() { - return "part"; - } - - public ITreeElement[] getChildren() { - return new ITreeElement[0]; - } - - public boolean hasChildren() { - return false; - } - - public ITreeElement getParent() { - return null; - } - - public Command getSetTypeCommand(String actionId) { - return new W11SetTypeCommand((Part) this.getTarget(), actionId); - } - - public Command getSetElementCommand(String actionId) { - return new W11SetElementCommand((Part) this.getTarget(), actionId); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Service.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Service.java deleted file mode 100644 index c92128c75..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Service.java +++ /dev/null @@ -1,96 +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.adapters.basic; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddEndPointCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11DeleteCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDAddEndPointAction; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IService; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; - -public class W11Service extends WSDLBaseAdapter implements IService { - - public List getEndPoints() { - List adapterList = new ArrayList(); - populateAdapterList(((Service) target).getEPorts(), adapterList); - - return adapterList; - } - - public String getName() { - return ((Service) target).getQName().getLocalPart(); - } - - public List getFields() { - return getEndPoints(); - } - - public IDescription getOwnerDescription() { - return (IDescription) owner; - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[2]; - actionIDs[0] = ASDAddEndPointAction.ID; - actionIDs[1] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Command getAddEndPointCommand() { - return new W11AddEndPointCommand((Service)target); - } - - public Command getDeleteCommand() { - return new W11DeleteCommand(this); - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/service_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "service"; - } - - public ITreeElement[] getChildren() { - List endPoints = getEndPoints(); - ITreeElement[] treeElements = new ITreeElement[endPoints.size()]; - - for (int index = 0; index < endPoints.size(); index++) { - treeElements[index] = (ITreeElement) endPoints.get(index); - } - - return treeElements; - } - - public boolean hasChildren() { - if (getChildren().length > 0) { - return true; - } - - return false; - } - - public ITreeElement getParent() { - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Type.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Type.java deleted file mode 100644 index 3021ea03e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/basic/W11Type.java +++ /dev/null @@ -1,57 +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.adapters.basic; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDDeleteAction; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IType; -import org.eclipse.wst.wsdl.ui.internal.asd.outline.ITreeElement; -import org.eclipse.xsd.XSDSchema; - -public class W11Type extends WSDLBaseAdapter implements IType { - public IDescription getOwnerDescription() { - return (IDescription) owner; - } - - public String getName() { - XSDSchema schema= (XSDSchema) target; - return schema.getTargetNamespace(); - } - - public String[] getActions(Object object) { - String[] actionIDs = new String[1]; - actionIDs[0] = ASDDeleteAction.ID; - - return actionIDs; - } - - public Image getImage() { - return WSDLEditorPlugin.getInstance().getImage("icons/xsd_obj.gif"); //$NON-NLS-1$ - } - - public String getText() { - return "schema"; - } - public ITreeElement[] getChildren() { - return new ITreeElement[0]; - } - - public boolean hasChildren() { - return false; - } - - public ITreeElement getParent() { - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddBindingCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddBindingCommand.java deleted file mode 100644 index ef3d5b06b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddBindingCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddBindingCommand extends Command { - private Definition definition; - private String newName; - private Binding newBinding; - - public W11AddBindingCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_BINDING")); - this.definition = definition; - } - - public void setNewBindingName(String newName) { - this.newName = newName; - } - - public Binding getNewBinding() { - return newBinding; - } - - public void execute() { - if (newName == null || newName.equals("")) { //$NON-NLS-1$ - newName = NameUtil.buildUniqueBindingName(definition, "NewBinding"); //$NON-NLS-1$ - } - - AddBindingCommand command = new AddBindingCommand(definition, newName); - command.run(); - - newBinding = (Binding) command.getWSDLElement(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddEndPointCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddEndPointCommand.java deleted file mode 100644 index 09b62f937..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddEndPointCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddPortCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddEndPointCommand extends Command -{ - private Service service; - - public W11AddEndPointCommand(Service service) { - super(Messages.getString("_UI_ACTION_ADD")); - this.service = service; - } - - public void execute() { - AddPortCommand command = new AddPortCommand(service, NameUtil.buildUniquePortName(service, "NewPort")); //$NON-NLS-1$ - command.run(); - Port port = (Port) command.getWSDLElement(); - - // Set a default address - String address = "http://www.example.org/"; //$NON-NLS-1$ - W11SetAddressCommand addressCommand = new W11SetAddressCommand(port, address); - addressCommand.execute(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddFaultParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddFaultParameterCommand.java deleted file mode 100644 index a129112a7..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddFaultParameterCommand.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBaseParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddFaultParameterCommand; - -public class W11AddFaultParameterCommand extends Command { - protected Operation operation; - protected Fault fault; - - public W11AddFaultParameterCommand(Operation operation, Fault fault) { - super(Messages.getString("_UI_ACTION_ADD_FAULT")); - this.operation = operation; - this.fault = fault; - } - - public void execute() { - // Determine which Pattern we should use. For example, ADDBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT -// int pattern = getParameterPattern(); - AddFaultParameterCommand command = new AddFaultParameterCommand(operation, fault); - command.setStyle(AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT); - command.run(); - } - -// private int getParameterPattern() { -// int pattern = AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT; -// -// if (operation.getEInput() != null) { -// Input input = operation.getEInput(); -// -// if (input.getEMessage() != null) { -// Message message = input.getEMessage(); -// List parts = message.getEParts(); -// -// if (parts.size() > 0) { -// Part part = (Part) parts.get(0); -// if (part.getTypeDefinition() != null) { -// pattern = AddBaseParameterCommand.PART_COMPLEXTYPE_SEQ_ELEMENT; -// } -// } -// } -// } -// -// return pattern; -// } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddImportCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddImportCommand.java deleted file mode 100644 index edb1c65fa..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddImportCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddImportCommand; - -public class W11AddImportCommand extends Command { - private Definition definition; - - public W11AddImportCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_IMPORT")); - this.definition = definition; - } - - public void execute() { - String namespace = ""; //$NON-NLS-1$ - String location = ""; //$NON-NLS-1$ - AddImportCommand command = new AddImportCommand(definition, namespace, location); - command.run(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInputParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInputParameterCommand.java deleted file mode 100644 index 0ca01ef05..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInputParameterCommand.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.adapters.commands; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBaseParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddInputParameterCommand; - -public class W11AddInputParameterCommand extends Command { - protected Operation operation; - - public W11AddInputParameterCommand(Operation operation) { - super(Messages.getString("_UI_ACTION_ADD_INPUT")); - this.operation = operation; - } - - public void execute() { - // Determine which Pattern we should use. For example, ADDBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT - int pattern = getParameterPattern(); - AddInputParameterCommand command = new AddInputParameterCommand(operation, pattern); - command.run(); - } - - private int getParameterPattern() { - int pattern = AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT; - - // TODO: rmah: Should we be checking if there's an existing Output. If so, we should - // try to determine the pattern from there if we fail to get it from the Input??? - if (operation.getEInput() != null) { - Input input = operation.getEInput(); - - if (input.getEMessage() != null) { - Message message = input.getEMessage(); - List parts = message.getEParts(); - - if (parts.size() > 0) { - Part part = (Part) parts.get(0); - if (part.getTypeDefinition() != null) { - pattern = AddBaseParameterCommand.PART_COMPLEXTYPE_SEQ_ELEMENT; - } - } - } - } - - return pattern; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInterfaceCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInterfaceCommand.java deleted file mode 100644 index 76213e639..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddInterfaceCommand.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.PortType; -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.commands.AddPortTypeCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; - -public class W11AddInterfaceCommand extends Command { - private Definition definition; - private String newName; - private PortType newPortType; - - public W11AddInterfaceCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_PORTTYPE")); - this.definition = definition; - } - - public void setNewPortTypeName(String newName) { - this.newName = newName; - } - - public PortType getNewPortType() { - return newPortType; - } - - public void execute() { - if (newName == null || newName.equals("")) { //$NON-NLS-1$ - newName = NameUtil.buildUniquePortTypeName(definition, "NewPortType"); //$NON-NLS-1$ - } - // Add the Port Type - AddPortTypeCommand command = new AddPortTypeCommand(definition, newName, false); - command.run(); - - newPortType = (PortType) command.getWSDLElement(); - - // Add the Operation - IInterface iInterface = (IInterface) WSDLAdapterFactoryHelper.getInstance().adapt(newPortType); - Command addOperationCommand = iInterface.getAddOperationCommand(); - addOperationCommand.execute(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddMessageCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddMessageCommand.java deleted file mode 100644 index 5d77d19d9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddMessageCommand.java +++ /dev/null @@ -1,47 +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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddMessageCommand extends Command { - private Definition definition; - private String newName; - private Message message; - - public W11AddMessageCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_MESSAGE")); - this.definition = definition; - } - - public void setNewMessageName(String newName) { - this.newName = newName; - } - - public void execute() { - if (newName == null || newName.equals("")) { //$NON-NLS-1$ - newName = NameUtil.buildUniqueMessageName(definition, "NewMessage"); //$NON-NLS-1$ - } - - AddMessageCommand command = new AddMessageCommand(definition, newName, true); - command.run(); - message = (Message) command.getWSDLElement(); - } - - public Message getNewMessage() { - return message; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOperationCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOperationCommand.java deleted file mode 100644 index 821ae14f2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOperationCommand.java +++ /dev/null @@ -1,109 +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.adapters.commands; - -import javax.wsdl.OperationType; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.PortType; -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.IParameter; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBaseParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddFaultCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddInputCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddInputParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddMessageReferenceCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOperationCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOutputCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOutputParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.xsd.XSDTypeDefinition; - -public class W11AddOperationCommand extends Command { - private PortType portType; - - public W11AddOperationCommand(PortType portType) { - super(Messages.getString("_UI_ACTION_ADD_OPERATION")); - this.portType = portType; - } - - public void execute() { - String name = NameUtil.getOperationName(portType); - AddOperationCommand operationCommand = new AddOperationCommand(portType, name); - operationCommand.run(); - Operation operation = (Operation) operationCommand.getWSDLElement(); - - createMessage(operation, IMessageReference.KIND_INPUT); - createMessage(operation, IMessageReference.KIND_OUTPUT); - - createParameter(operation, null, IMessageReference.KIND_INPUT); - createParameter(operation, null, IMessageReference.KIND_OUTPUT); - - operation.setStyle(OperationType.REQUEST_RESPONSE); - } - - private MessageReference createMessage(Operation operation, int messageKind) { - MessageReference messageRef = null; - AddMessageReferenceCommand messageRefCommand = null; - if (messageKind == IMessageReference.KIND_INPUT) - { - messageRefCommand = new AddInputCommand(operation, null); - } - else if (messageKind == IMessageReference.KIND_OUTPUT) - { - messageRefCommand = new AddOutputCommand(operation, null); - } - else if (messageKind == IMessageReference.KIND_FAULT) - { - messageRefCommand = new AddFaultCommand(operation, NameUtil.getFaultName(operation)); - } - messageRefCommand.run(); - messageRef = (MessageReference) messageRefCommand.getWSDLElement(); - - AddMessageCommand command = new AddMessageCommand(messageRef.getEnclosingDefinition(), NameUtil.getMessageName(messageRef)); - command.run(); - messageRef.setEMessage((Message) command.getWSDLElement()); - - return messageRef; - } - - private void createParameter(Operation operation, Part part, int kind) { - IParameter parameter = null; - AddBaseParameterCommand addParameterCommand = null; - - if (kind == IMessageReference.KIND_INPUT) { - addParameterCommand = new AddInputParameterCommand(operation, AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT); - } - else if (kind == IMessageReference.KIND_OUTPUT) { - addParameterCommand = new AddOutputParameterCommand(operation, AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT); - } - - /******************************************************************************************/ - if (part != null) { - if (part.getTypeDefinition() instanceof XSDTypeDefinition) { - addParameterCommand.setStyle(AddBaseParameterCommand.PART_COMPLEXTYPE_SEQ_ELEMENT); - } - - addParameterCommand.run(); - } - - if (parameter == null && addParameterCommand != null) { - // Create a Part --> Anonymous --> Sequence --> Element pattern - addParameterCommand.run(); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOutputParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOutputParameterCommand.java deleted file mode 100644 index f778ccd61..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddOutputParameterCommand.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.adapters.commands; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBaseParameterCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOutputParameterCommand; - -public class W11AddOutputParameterCommand extends Command { - protected Operation operation; - - public W11AddOutputParameterCommand(Operation operation) { - super(Messages.getString("_UI_ACTION_ADD_OUTPUT")); - this.operation = operation; - } - - public void execute() { - // Determine which Pattern we should use. For example, ADDBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT - int pattern = getParameterPattern(); - AddOutputParameterCommand command = new AddOutputParameterCommand(operation, pattern); - command.run(); - } - - private int getParameterPattern() { - int pattern = AddBaseParameterCommand.PART_ELEMENT_SEQ_ELEMENT; - - // TODO: rmah: Should we be checking if there's an existing Input. If so, we should - // try to determine the pattern from there if we fail to get it from the Output??? - if (operation.getEOutput() != null) { - Output output = operation.getEOutput(); - - if (output.getEMessage() != null) { - Message message = output.getEMessage(); - List parts = message.getEParts(); - - if (parts.size() > 0) { - Part part = (Part) parts.get(0); - if (part.getTypeDefinition() != null) { - pattern = AddBaseParameterCommand.PART_COMPLEXTYPE_SEQ_ELEMENT; - } - } - } - } - - return pattern; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddPartCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddPartCommand.java deleted file mode 100644 index 9a998936d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddPartCommand.java +++ /dev/null @@ -1,31 +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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddPartCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddPartCommand extends Command { - private Message message; - - public W11AddPartCommand(Message message) { - super(Messages.getString("_UI_ACTION_ADD_PART")); - this.message = message; - } - - public void execute() { - AddPartCommand command = new AddPartCommand(message, NameUtil.buildUniquePartName(message, "NewPart")); //$NON-NLS-1$ - command.run(); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddSchemaCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddSchemaCommand.java deleted file mode 100644 index 4e1f85772..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddSchemaCommand.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.adapters.commands; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDSchemaCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddSchemaCommand extends Command { - private Definition definition; - - public W11AddSchemaCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_SCHEMA")); - this.definition = definition; - } - - public void execute() { - String tns = definition.getTargetNamespace(); - List existingNamespaces = new ArrayList(); - Iterator eeIt = definition.getETypes().getEExtensibilityElements().iterator(); - while (eeIt.hasNext()) { - Object item = eeIt.next(); - if (item instanceof XSDSchemaExtensibilityElement) { - String ns = ((XSDSchemaExtensibilityElement) item).getSchema().getTargetNamespace(); - existingNamespaces.add(ns); - } - } - tns = NameUtil.getUniqueNameHelper(tns, existingNamespaces); - - AddXSDSchemaCommand command = new AddXSDSchemaCommand(definition, tns); - command.run(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddServiceCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddServiceCommand.java deleted file mode 100644 index a1c8d90b1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11AddServiceCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.commands.AddServiceCommand; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class W11AddServiceCommand extends Command { - private Definition definition; - - public W11AddServiceCommand(Definition definition) { - super(Messages.getString("_UI_ACTION_ADD_SERVICE")); - this.definition = definition; - } - - public void execute() { - String newName = NameUtil.buildUniqueServiceName(definition); - AddServiceCommand command = new AddServiceCommand(definition, newName, true); - command.run(); - Service service = (Service) command.getWSDLElement(); - if (service.getEPorts().size() > 0) { - Port port = (Port) service.getEPorts().get(0); - - // Set a default protocol - - - // Set a default address - String address = "http://www.example.org/"; //$NON-NLS-1$ - W11SetAddressCommand addressCommand = new W11SetAddressCommand(port, address); - addressCommand.execute(); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteCommand.java deleted file mode 100644 index 32d7b00ea..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Interface; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Operation; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Service; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessage; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IType; - -public class W11DeleteCommand extends Command { - protected WSDLBaseAdapter object; - - public W11DeleteCommand(WSDLBaseAdapter object) { - super(Messages.getString("_UI_ACTION_DELETE")); - this.object = object; - } - - public void execute() { - if (object instanceof W11Service) { - Service service = (Service) object.getTarget(); - service.getEnclosingDefinition().getEServices().remove(service); - } - else if (object instanceof W11EndPoint) { - Service service = (Service) ((W11Service) ((W11EndPoint) object).getOwnerService()).getTarget(); - Port port = (Port) object.getTarget(); - service.getEPorts().remove(port); - } - else if (object instanceof W11Binding) { - Binding binding = (Binding) object.getTarget(); - binding.getEnclosingDefinition().getEBindings().remove(binding); - } - else if (object instanceof W11Interface) { - PortType portType = (PortType) object.getTarget(); - portType.getEnclosingDefinition().getEPortTypes().remove(portType); - } - else if (object instanceof W11Operation) { - PortType portType = (PortType) ((W11Interface) ((W11Operation) object).getOwnerInterface()).getTarget(); - Operation operation = (Operation) object.getTarget(); - portType.getEOperations().remove(operation); - } - else if (object instanceof IParameter) { - Part part = (Part) object.getTarget(); - Message message = (Message) part.eContainer(); - message.getEParts().remove(part); - } - else if (object instanceof IImport) { - Import theImport = (Import) object.getTarget(); - theImport.getEnclosingDefinition().getEImports().remove(theImport); - } - else if (object instanceof IType) { - - } - else if (object instanceof IMessageReference) { - MessageReference messageRef = (MessageReference) object.getTarget(); - Operation operation = (Operation)messageRef.eContainer(); - if (messageRef instanceof Input) { - operation.setEInput(null); - } - else if (messageRef instanceof Output) { - operation.setEOutput(null); - } - else if (messageRef instanceof Fault) { - operation.getEFaults().remove(messageRef); - } - } - else if (object instanceof IMessage) { - Message message = (Message) object.getTarget(); - message.getEnclosingDefinition().getEMessages().remove(message); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteParameterCommand.java deleted file mode 100644 index a56295c87..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11DeleteParameterCommand.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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDSchema; - - -public class W11DeleteParameterCommand extends Command { - private IParameter parameter; - - public W11DeleteParameterCommand(IParameter paramter) { - super(Messages.getString("_UI_ACTION_DELETE")); - this.parameter = paramter; - } - - public void execute() { - delete(); - } - - private void delete() { - Object object = ((WSDLBaseAdapter) parameter).getTarget(); - - if (object instanceof XSDElementDeclaration) { - XSDConcreteComponent xsdComponent = ((XSDElementDeclaration) object).getContainer(); - - if (xsdComponent instanceof XSDParticle) { - XSDParticle particle = (XSDParticle) xsdComponent; - if (particle.getContainer() instanceof XSDModelGroup) { - XSDModelGroup modelGroup = (XSDModelGroup) particle.getContainer(); - if (modelGroup.getContents().size() >= 2) { - modelGroup.getContents().remove(particle); - } - else { - modelGroup.getContents().remove(particle); - // TODO: We need the line below to delete the Message and Part -// removeMessageAndPart(wParameter.getPart()); - // TODO: Remove the XSD components as well..... - } - } - } - else if (xsdComponent instanceof XSDSchema){ - // TODO: We need the line below to delete the Message and Part -// removeMessageAndPart(wParameter.getPart()); // Delete the part as well - XSDSchema xsdSchema = (XSDSchema) xsdComponent; - xsdSchema.getContents().remove(object); - } - } - else if (object instanceof Part) { - removeMessageAndPart((Part) object); - } - else if (object instanceof Message) { - removeMessageAndPart((Part) ((Message) object).getEParts().get(0)); - } - - // Do we want to remove the Input/Output/Fault MessageReference as well if - // there are no more "inputs"?.... - } - - protected void removeMessageAndPart(Part part) { - W11MessageReference wMessage = null; - /* - if (parameter instanceof W11ParameterForElement) { - wMessage = (W11MessageReference) ((W11ParameterForElement) parameter).getOwner(); - } - else */if (parameter instanceof W11ParameterForPart) { - wMessage = (W11MessageReference) ((W11ParameterForPart) parameter).getOwner(); - } - - Message message = wMessage.getMessageReference().getEMessage(); - message.getEParts().remove(part); - - ((Definition) part.getEnclosingDefinition()).getEMessages().remove(message); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11GenerateBindingCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11GenerateBindingCommand.java deleted file mode 100644 index f12cfb624..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11GenerateBindingCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.ui.internal.asd.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.wizards.BindingWizard; - -public class W11GenerateBindingCommand extends Command { - protected Binding binding; - - public W11GenerateBindingCommand(Binding binding) { - super(Messages.getString("_UI_GENERATE_BINDING_CONTENT")); - this.binding = binding; - } - - public void execute() { - BindingWizard wizard = new BindingWizard(binding.getEnclosingDefinition(), binding, BindingWizard.KIND_REGENERATE_BINDING); - wizard.setBindingName(ComponentReferenceUtil.getName(binding)); - wizard.setPortTypeName(ComponentReferenceUtil.getPortTypeReference(binding)); - WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); - wizardDialog.create(); - wizardDialog.open(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11RenameCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11RenameCommand.java deleted file mode 100644 index c19b78eed..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11RenameCommand.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.adapters.commands; - -import javax.xml.namespace.QName; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Interface; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Operation; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Service; - -public class W11RenameCommand extends Command { - protected WSDLBaseAdapter object; - protected String newName = ""; //$NON-NLS-1$ - - public W11RenameCommand(WSDLBaseAdapter object, String newName) { - super(Messages.getString("_UI_ACTION_RENAME")); - this.object = object; - this.newName = newName; - } - - public void execute() { - if (object instanceof W11Description) { - Definition definition = (Definition) object.getTarget(); - String ns = definition.getQName().getNamespaceURI(); - definition.setQName(new QName(ns, newName)); - } - else if (object instanceof W11Service) { - Service service = (Service) object.getTarget(); - String ns = service.getQName().getNamespaceURI(); - service.setQName(new QName(ns, newName)); - } - else if (object instanceof W11EndPoint) { - Port port = (Port) object.getTarget(); - port.setName(newName); - } - else if (object instanceof W11Binding) { - Binding binding = (Binding) object.getTarget(); - String ns = binding.getQName().getNamespaceURI(); - binding.setQName(new QName(ns, newName)); - } - else if (object instanceof W11Interface) { - PortType portType = (PortType) object.getTarget(); - String ns = portType.getQName().getNamespaceURI(); - portType.setQName(new QName(ns, newName)); - } - else if (object instanceof W11Operation) { - Operation operation = (Operation) object.getTarget(); - operation.setName(newName); - } - else if (object instanceof W11MessageReference) { - W11Operation w11Operation = (W11Operation) ((W11MessageReference) object).getOwnerOperation(); - Operation operation = w11Operation.getOperation(); - operation.setName(newName); - } - else if (object instanceof W11ParameterForPart) { - Part part = (Part) ((W11ParameterForPart) object).getTarget(); - part.setName(newName); - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderMessageReferencesCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderMessageReferencesCommand.java deleted file mode 100644 index da9552365..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderMessageReferencesCommand.java +++ /dev/null @@ -1,118 +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.adapters.commands; - -import javax.wsdl.OperationType; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Operation; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; - -public class W11ReorderMessageReferencesCommand extends Command { - protected IMessageReference leftSibling; - protected IMessageReference rightSibling; - protected IMessageReference movingParameter; - - public W11ReorderMessageReferencesCommand(IMessageReference leftSibling, IMessageReference rightSibling, IMessageReference movingParameter) { - super(""); // TODO: Need to add String here... - this.leftSibling = leftSibling; - this.rightSibling = rightSibling; - this.movingParameter = movingParameter; - } - - public void execute() { - IMessageReference leftSibElement = null; - IMessageReference movingChild = null; - - if (leftSibling instanceof IMessageReference) { - leftSibElement = (IMessageReference) leftSibling; - } - if (movingParameter instanceof IMessageReference) { - movingChild = (IMessageReference) movingParameter; - } - - if (movingChild.getKind() == IMessageReference.KIND_INPUT) { - W11Operation w11Operation = (W11Operation) movingChild.getOwnerOperation(); - Operation operation = (Operation) w11Operation.getTarget(); - - if (leftSibElement == null) { - // Input/Output style - setInputOutputOrder(operation, true); - } - else if (leftSibElement != null && leftSibElement.getKind() == IMessageReference.KIND_INPUT) { - if (rightSibling.getKind() == IMessageReference.KIND_OUTPUT) { - // Input/Output style - setInputOutputOrder(operation, true); - } - } - else { - // Output/Input style - setInputOutputOrder(operation, false); - } - } - else if (movingChild.getKind() == IMessageReference.KIND_OUTPUT) { - W11Operation w11Operation = (W11Operation) movingChild.getOwnerOperation(); - Operation operation = (Operation) w11Operation.getTarget(); - - if (leftSibElement == null) { - // Output/Input style - setInputOutputOrder(operation, false); - } - else if (leftSibElement != null && leftSibElement.getKind() == IMessageReference.KIND_OUTPUT) { - if (rightSibling.getKind() == IMessageReference.KIND_INPUT) { - // Output/Input style - setInputOutputOrder(operation, false); - } - } - else { - // Input/Output style - setInputOutputOrder(operation, true); - } - } - } - - // boolean inputFirst = true if the Input is the first in the order of Input and Output - private void setInputOutputOrder(Operation operation, boolean inputFirst) { - // We need to determine more info before we can set the style - if (inputFirst && operation.getEInput() != null) { - // Check if there is an Output - if (operation.getEOutput() != null) { - // Order is: Input, Output - setOperationStyle(operation, OperationType.REQUEST_RESPONSE); - } - else { - // Order is: Input - setOperationStyle(operation, OperationType.ONE_WAY); - } - } - else if (operation.getEOutput() != null) { - // Check if there is an Input - if (operation.getEInput() != null) { - // Order is: Output, Input - setOperationStyle(operation, OperationType.SOLICIT_RESPONSE); - } - else { - // Order is: Output - setOperationStyle(operation, OperationType.NOTIFICATION); - } - } - } - - private void setOperationStyle(Operation operation, OperationType operationType) { - // If there is no style to begin with, don't set one now - if (operation.getStyle() == null) { - return; - } - - operation.setStyle(operationType); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderParametersCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderParametersCommand.java deleted file mode 100644 index 06b6b807f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11ReorderParametersCommand.java +++ /dev/null @@ -1,80 +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.adapters.commands; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class W11ReorderParametersCommand extends Command { - protected IParameter leftSibling; - protected IParameter rightSibling; - protected IParameter movingParameter; - - public W11ReorderParametersCommand(IParameter leftSibling, IParameter rightSibling, IParameter movingParameter) { - super(""); // TODO: Need to add String here... - this.leftSibling = leftSibling; - this.rightSibling = rightSibling; - this.movingParameter = movingParameter; - } - - public void execute() { - Part leftSibElement = null; - Part rightSibElement = null; - Part movingChild = null; - - if (leftSibling instanceof W11ParameterForPart) { - leftSibElement = (Part) ((W11ParameterForPart) leftSibling).getTarget(); - } - if (rightSibling instanceof W11ParameterForPart) { - rightSibElement = (Part) ((W11ParameterForPart) rightSibling).getTarget(); - } - if (movingParameter instanceof W11ParameterForPart) { - movingChild = (Part) ((W11ParameterForPart) movingParameter).getTarget(); - } - - if (movingChild.equals(leftSibElement) || movingChild.equals(rightSibElement)) { - return; - } - - if (movingChild != null) { - Message message = (Message) movingChild.eContainer(); - List parts = message.getEParts(); - - parts.remove(movingChild); - - int leftIndex = -1, rightIndex = -1; - if (leftSibElement != null) { - leftIndex = parts.indexOf(leftSibElement); - } - if (rightSibElement != null) { - rightIndex = parts.indexOf(rightSibElement); - } - - if (leftIndex == -1) { - // Add moving child to the front - parts.add(0, movingChild); - } - else if (rightIndex == -1) { - // Add moving child to the end - parts.add(movingChild); - } - else { - // Add moving child after the occurence of the left sibling - parts.add(leftIndex + 1, movingChild); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetAddressCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetAddressCommand.java deleted file mode 100644 index 02f57be19..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetAddressCommand.java +++ /dev/null @@ -1,201 +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.adapters.commands; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.ExtensibilityElement; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.binding.http.HTTPAddress; -import org.eclipse.wst.wsdl.binding.soap.SOAPAddress; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQueryAction; -import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilder; -import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl; -import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -public class W11SetAddressCommand extends Command { - private Port port; - private String newAddress; - - public W11SetAddressCommand(Port port, String newAddress) { - super(""); // TODO: Need to add String here... - this.port = port; - this.newAddress = newAddress; - } - - public void execute() { - // Should the actual set address code live in it's 'own separate' command?? - if (!setAddress()) { - createNewExtensibilityElement(); - setAddress(); - } - } - - private boolean setAddress() { - boolean success = false; - - if (port.getEExtensibilityElements().size() > 0) { - Iterator eeIt = port.getEExtensibilityElements().iterator(); - while (eeIt.hasNext()) { - ExtensibilityElement ee = ((ExtensibilityElement) eeIt.next()); - if (ee instanceof SOAPAddress) { - ((SOAPAddress) ee).setLocationURI(newAddress); - success = true; - } - else if (ee instanceof HTTPAddress) { - ((HTTPAddress) ee).setLocationURI(newAddress); - success = true; - } - // ee.getElement().setAttribute("location", newAddress); - } - } - - return success; - } - - /* - * TODO: rmah: We need to clean the code below..... - * Things should be wrapped up and placed in a common location. Currently, this is - * from the AddEEMenuActionContriubor.java class - */ - private void createNewExtensibilityElement() { - List modelQueryActionList = new ArrayList(); - ModelQuery modelQuery = ModelQueryUtil.getModelQuery(port.getElement().getOwnerDocument()); - CMElementDeclaration ed = modelQuery.getCMElementDeclaration(port.getElement()); - - if (ed != null) - { - // add insert child node actions - // - int ic = ModelQuery.INCLUDE_CHILD_NODES; - int vc = ModelQuery.VALIDITY_STRICT; - - modelQuery.getInsertActions(port.getElement(), ed, -1, ic, vc, modelQueryActionList); - } - - createNewExtensibilityElementHelper1(modelQueryActionList); - } - - private void createNewExtensibilityElementHelper1(List modelQueryActionList) - { - for (Iterator i = modelQueryActionList.iterator(); i.hasNext(); ) - { - ModelQueryAction action = (ModelQueryAction)i.next(); - CMNode cmnode = action.getCMNode(); - if (cmnode != null) - { - boolean isOtherNamespace = false; - CMDocument cmDocument = (CMDocument)cmnode.getProperty("CMDocument"); //$NON-NLS-1$ - if (cmDocument != null) - { - String namespaceURI = (String)cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI"); //$NON-NLS-1$ - isOtherNamespace = namespaceURI != null && !namespaceURI.equals(WSDLConstants.WSDL_NAMESPACE_URI); - } - - if (isOtherNamespace) - { - int cmNodeType = cmnode.getNodeType(); - if (action.getKind() == ModelQueryAction.INSERT) - { - switch (cmNodeType) - { - case CMNode.ELEMENT_DECLARATION : - { - createNewExtensibilityElementHelper2((CMElementDeclaration)cmnode, action.getParent(), action.getStartIndex()); - return; - } - } - } - } - } - } - } - - public void createNewExtensibilityElementHelper2(CMNode cmnode, Node parent, int index) - { - if (cmnode != null && parent != null) - { - Document document = parent.getNodeType() == Node.DOCUMENT_NODE ? (Document)parent : parent.getOwnerDocument(); - - DOMContentBuilder builder = new DOMContentBuilderImpl(document); - builder.setProperty(DOMContentBuilder.PROPERTY_BUILD_BLANK_TEXT_NODES, Boolean.TRUE); - builder.setBuildPolicy(DOMContentBuilder.BUILD_ONLY_REQUIRED_CONTENT); - builder.build(parent, cmnode); - insertNodesAtIndex(parent, builder.getResult(), index, true); - } - } - - public void insertNodesAtIndex(Node parent, List list, int index, boolean format) - { - NodeList nodeList = parent.getChildNodes(); - if (index == -1) - { - index = nodeList.getLength(); - } - Node refChild = (index < nodeList.getLength()) ? nodeList.item(index) : null; - - // here we consider the case where the previous node is a 'white space' Text node - // we should really do the insert before this node - // - int prevIndex = index - 1; - Node prevChild = (prevIndex < nodeList.getLength()) ? nodeList.item(prevIndex) : null; - if (isWhitespaceTextNode(prevChild)) - { - refChild = prevChild; - } - - for (Iterator i = list.iterator(); i.hasNext(); ) - { - Node newNode = (Node)i.next(); - - if (newNode.getNodeType() == Node.ATTRIBUTE_NODE) - { - Element parentElement = (Element)parent; - parentElement.setAttributeNode((Attr)newNode); - } - else - { - parent.insertBefore(newNode, refChild); - } - } - - for (Iterator i = list.iterator(); i.hasNext(); ) - { - Node newNode = (Node)i.next(); - if (format) - { - FormatProcessorXML formatProcessorXML = new FormatProcessorXML(); - formatProcessorXML.formatNode((IDOMNode)newNode); - } - } - //setViewerSelection(list); - } - - protected boolean isWhitespaceTextNode(Node node) - { - return (node != null) && (node.getNodeType() == Node.TEXT_NODE) && (node.getNodeValue().trim().length() == 0); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetBindingCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetBindingCommand.java deleted file mode 100644 index b51e0759d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetBindingCommand.java +++ /dev/null @@ -1,31 +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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.ui.internal.Messages; - -public class W11SetBindingCommand extends Command { - private Port port; - private Binding binding; - - public W11SetBindingCommand(Port port, Binding binding) { - super(Messages.getString("_UI_ACTION_SET_BINDING")); - this.port = port; - this.binding = binding; - } - - public void execute() { - port.setEBinding(binding); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetElementCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetElementCommand.java deleted file mode 100644 index 9e6f4770d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetElementCommand.java +++ /dev/null @@ -1,142 +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.adapters.commands; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDElementReferenceEditManager; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; -import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager; -import org.eclipse.xsd.XSDSchema; -import org.w3c.dom.Element; - -public class W11SetElementCommand extends Command { - private Object parent; - private String action; - private boolean continueApply; - - public W11SetElementCommand(Object parent, String action) { - super(Messages.getString("_UI_ACTION_SET_ELEMENT")); - this.parent = parent; - this.action = action; - } - - public void execute() - { - ComponentReferenceEditManager componentReferenceEditManager = getComponentReferenceEditManager(); - continueApply = true; - if (parent instanceof Part) - { - Part part = (Part) parent; - if (action.equals(IParameter.SET_NEW_ACTION_ID)) - { - ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getNewDialog()); - - // Set the reference to the new type - if (continueApply) - componentReferenceEditManager.modifyComponentReference(part, newValue); - } - else - { - ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getBrowseDialog()); - if (continueApply) - componentReferenceEditManager.modifyComponentReference(part, newValue); - } - formatChild(part.getElement()); - } - - } - - 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; - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() - { - ComponentReferenceEditManager result = null; - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - if (editor != null) - { - System.out.println("\nW11SetElementCommand.java, line 98"); - result = (ComponentReferenceEditManager)editor.getAdapter(XSDElementReferenceEditManager.class); - - if (editor instanceof InternalWSDLMultiPageEditor) - { - InternalWSDLMultiPageEditor wsdlEditor = (InternalWSDLMultiPageEditor) editor; - - List types = wsdlEditor.getModel().getTypes(); - XSDSchema[] schemas = new XSDSchema[types.size()]; - for (int index = 0; index < types.size(); index++) { - W11Type type = (W11Type) types.get(index); - schemas[index] = (XSDSchema) type.getTarget(); - } - - ((WSDLXSDElementReferenceEditManager) result).setSchemas(schemas); - - return result; - } - } - return result; - } - - protected void formatChild(Element child) - { - if (child instanceof IDOMNode) - { - IDOMModel model = ((IDOMNode)child).getModel(); - try - { - // tell the model that we are about to make a big model change - model.aboutToChangeModel(); - - IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); - formatProcessor.formatNode(child); - } - finally - { - // tell the model that we are done with the big model change - model.changedModel(); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetInterfaceCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetInterfaceCommand.java deleted file mode 100644 index 6c12a8515..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetInterfaceCommand.java +++ /dev/null @@ -1,31 +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.adapters.commands; - -import org.eclipse.gef.commands.Command; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.ui.internal.Messages; - -public class W11SetInterfaceCommand extends Command { - private Binding binding; - private PortType portType; - - public W11SetInterfaceCommand(Binding binding, PortType portType) { - super(Messages.getString("_UI_ACTION_SET_PORTTYPE")); - this.binding = binding; - this.portType = portType; - } - - public void execute() { - binding.setEPortType(portType); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetTypeCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetTypeCommand.java deleted file mode 100644 index 893f346c1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/commands/W11SetTypeCommand.java +++ /dev/null @@ -1,144 +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.adapters.commands; - -import java.util.List; - -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.window.Window; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.sse.core.internal.format.IStructuredFormatProcessor; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDTypeReferenceEditManager; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; -import org.w3c.dom.Element; - -public class W11SetTypeCommand extends Command { - private Object parent; - private String action; - private boolean continueApply; - - public W11SetTypeCommand(Object parent, String action) { - super(Messages.getString("_UI_ACTION_SET_TYPE")); - this.parent = parent; - this.action = action; - } - - public void execute() - { - ComponentReferenceEditManager componentReferenceEditManager = getComponentReferenceEditManager(); - continueApply = true; - if (action.equals(IParameter.SET_NEW_ACTION_ID)) - { - ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getNewDialog()); - - // Set the reference to the new type - if (continueApply) - componentReferenceEditManager.modifyComponentReference(parent, newValue); - } - else - { - ComponentSpecification newValue = (ComponentSpecification)invokeDialog(componentReferenceEditManager.getBrowseDialog()); - if (continueApply) - componentReferenceEditManager.modifyComponentReference(parent, newValue); - } - - // Format - if (parent instanceof WSDLElement) { - formatChild(((WSDLElement) parent).getElement()); - } - else if (parent instanceof XSDConcreteComponent) { - formatChild(((XSDConcreteComponent) parent).getElement()); - } - } - - 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; - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() - { - ComponentReferenceEditManager result = null; - IEditorPart editor = ASDEditorPlugin.getActiveEditor(); - if (editor != null) - { - result = (ComponentReferenceEditManager)editor.getAdapter(XSDTypeReferenceEditManager.class); - - if (editor instanceof InternalWSDLMultiPageEditor) - { - InternalWSDLMultiPageEditor wsdlEditor = (InternalWSDLMultiPageEditor) editor; - - List types = wsdlEditor.getModel().getTypes(); - XSDSchema[] schemas = new XSDSchema[types.size()]; - for (int index = 0; index < types.size(); index++) { - W11Type type = (W11Type) types.get(index); - schemas[index] = (XSDSchema) type.getTarget(); - } - - ((WSDLXSDTypeReferenceEditManager) result).setSchemas(schemas); - - return result; - } - } - return result; - } - - protected void formatChild(Element child) - { - if (child instanceof IDOMNode) - { - IDOMModel model = ((IDOMNode)child).getModel(); - try - { - // tell the model that we are about to make a big model change - model.aboutToChangeModel(); - - IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); - formatProcessor.formatNode(child); - } - finally - { - // tell the model that we are done with the big model change - model.changedModel(); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11AddressExtensibilityElementAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11AddressExtensibilityElementAdapter.java deleted file mode 100644 index cea279d54..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11AddressExtensibilityElementAdapter.java +++ /dev/null @@ -1,47 +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.adapters.specialized; - -import org.eclipse.wst.wsdl.binding.http.HTTPAddress; -import org.eclipse.wst.wsdl.binding.soap.SOAPAddress; - -public class W11AddressExtensibilityElementAdapter extends W11ExtensibilityElementAdapter -{ - // TODO... make this class abstract and provide concrete implementations in - // SOAP and HTTP packages. The WSDLAdapterFactory needs to know to delegate to extension - // adapters to support the addition of more extension languages - // - public String getLocationURI() - { - String address = null; - if (target instanceof SOAPAddress) - { - address = ((SOAPAddress) target).getLocationURI(); - } - else if (target instanceof HTTPAddress) - { - address = ((HTTPAddress) target).getLocationURI(); - } - return address; - } - - public void setLocationURI(String address) - { - if (target instanceof SOAPAddress) - { - ((SOAPAddress) target).setLocationURI(address); - } - else if (target instanceof HTTPAddress) - { - ((HTTPAddress) target).setLocationURI(address); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11ExtensibilityElementAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11ExtensibilityElementAdapter.java deleted file mode 100644 index 0dd4fb990..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/specialized/W11ExtensibilityElementAdapter.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.adapters.specialized; - -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; - -public class W11ExtensibilityElementAdapter extends WSDLBaseAdapter -{ - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitor.java deleted file mode 100644 index 8ce92457c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitor.java +++ /dev/null @@ -1,212 +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.adapters.visitor; - -import java.util.Iterator; -import org.eclipse.xsd.XSDAttributeDeclaration; -import org.eclipse.xsd.XSDAttributeGroupDefinition; -import org.eclipse.xsd.XSDAttributeUse; -import org.eclipse.xsd.XSDComplexTypeContent; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDIdentityConstraintDefinition; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDModelGroupDefinition; -import org.eclipse.xsd.XSDNotationDeclaration; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDParticleContent; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; -import org.eclipse.xsd.XSDWildcard; - -public class W11XSDVisitor -{ - public W11XSDVisitor() - { - } - - protected XSDSchema schema; - - public void visitSchema(XSDSchema schema) - { - this.schema = schema; - for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext();) - { - XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next(); - visitAttributeDeclaration(attr); - } - for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext();) - { - XSDTypeDefinition type = (XSDTypeDefinition) iterator.next(); - visitTypeDefinition(type); - } - for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext();) - { - XSDElementDeclaration element = (XSDElementDeclaration) iterator.next(); - visitElementDeclaration(element); - } - for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext();) - { - XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next(); - visitIdentityConstraintDefinition(identityConstraint); - } - for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext();) - { - XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next(); - visitModelGroupDefinition(modelGroup); - } - for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext();) - { - XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next(); - visitAttributeGroupDefinition(attributeGroup); - } - for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext();) - { - XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next(); - visitNotationDeclaration(element); - } - - } - - public void visitAttributeDeclaration(XSDAttributeDeclaration attr) - { - } - - public void visitTypeDefinition(XSDTypeDefinition type) - { - if (type instanceof XSDSimpleTypeDefinition) - { - visitSimpleTypeDefinition((XSDSimpleTypeDefinition)type); - } - else if (type instanceof XSDComplexTypeDefinition) - { - visitComplexTypeDefinition((XSDComplexTypeDefinition)type); - } - } - - public void visitElementDeclaration(XSDElementDeclaration element) - { - if (element.isElementDeclarationReference()) - { - } - else if (element.getAnonymousTypeDefinition() != null) - { - visitTypeDefinition(element.getAnonymousTypeDefinition()); - } - } - - public void visitIdentityConstraintDefinition(XSDIdentityConstraintDefinition identityConstraint) - { - } - - public void visitModelGroupDefinition(XSDModelGroupDefinition modelGroupDef) - { - if (!modelGroupDef.isModelGroupDefinitionReference()) - { - if (modelGroupDef.getModelGroup() != null) - { - visitModelGroup(modelGroupDef.getModelGroup()); - } - } - else - { - XSDModelGroup modelGroup = modelGroupDef.getResolvedModelGroupDefinition().getModelGroup(); - if (modelGroup != null) - { - visitModelGroup(modelGroup); - } - } - } - - public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup) - { - for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); ) - { - Object o = it.next(); - if (o instanceof XSDAttributeUse) - { - XSDAttributeUse attrUse = (XSDAttributeUse)o; - visitAttributeDeclaration(attrUse.getContent()); - } - else if (o instanceof XSDAttributeGroupDefinition) - { - XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)o; - visitAttributeGroupDefinition(attrGroup); - } - } - } - - public void visitNotationDeclaration(XSDNotationDeclaration notation) - { - } - - public void visitSimpleTypeDefinition(XSDSimpleTypeDefinition type) - { - } - - public void visitComplexTypeDefinition(XSDComplexTypeDefinition type) - { - if (type.getContent() != null) - { - XSDComplexTypeContent complexContent = type.getContent(); - if (complexContent instanceof XSDSimpleTypeDefinition) - { - visitSimpleTypeDefinition((XSDSimpleTypeDefinition)complexContent); - } - else if (complexContent instanceof XSDParticle) - { - visitParticle((XSDParticle) complexContent); - } - } - } - - public void visitParticle(XSDParticle particle) - { - visitParticleContent(particle.getContent()); - } - - public void visitParticleContent(XSDParticleContent particleContent) - { - if (particleContent instanceof XSDModelGroupDefinition) - { - visitModelGroupDefinition((XSDModelGroupDefinition) particleContent); - } - else if (particleContent instanceof XSDModelGroup) - { - visitModelGroup((XSDModelGroup)particleContent); - } - else if (particleContent instanceof XSDElementDeclaration) - { - visitElementDeclaration((XSDElementDeclaration)particleContent); - } - else if (particleContent instanceof XSDWildcard) - { - visitWildcard((XSDWildcard)particleContent); - } - } - - public void visitModelGroup(XSDModelGroup modelGroup) - { - if (modelGroup.getContents() != null) - { - for (Iterator iterator = modelGroup.getContents().iterator(); iterator.hasNext();) - { - XSDParticle particle = (XSDParticle) iterator.next(); - visitParticle(particle); - } - } - } - - public void visitWildcard(XSDWildcard wildcard) - { - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitorForFields.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitorForFields.java deleted file mode 100644 index 02e6dd4cd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/adapters/visitor/W11XSDVisitorForFields.java +++ /dev/null @@ -1,109 +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.adapters.visitor; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.xsd.XSDAttributeDeclaration; -import org.eclipse.xsd.XSDAttributeGroupContent; -import org.eclipse.xsd.XSDAttributeGroupDefinition; -import org.eclipse.xsd.XSDAttributeUse; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; - -public class W11XSDVisitorForFields extends W11XSDVisitor -{ - public W11XSDVisitorForFields() - { - } - - List concreteComponentList = new ArrayList(); - List thingsWeNeedToListenTo = new ArrayList(); - - public void visitComplexTypeDefinition(XSDComplexTypeDefinition type) - { - super.visitComplexTypeDefinition(type); - if (type.getAttributeContents() != null) - { - for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); ) - { - XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent)iter.next(); - if (attrGroupContent instanceof XSDAttributeUse) - { - XSDAttributeUse attrUse = (XSDAttributeUse)attrGroupContent; - concreteComponentList.add(attrUse); - } - else if (attrGroupContent instanceof XSDAttributeGroupDefinition) - { - XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)attrGroupContent; - thingsWeNeedToListenTo.add(attrGroup); - visitAttributeGroupDefinition(attrGroup); - } - } - } - } - - - public void visitModelGroup(XSDModelGroup modelGroup) - { - super.visitModelGroup(modelGroup); - thingsWeNeedToListenTo.add(modelGroup); - } - - public void visitAttributeGroupDefinition(XSDAttributeGroupDefinition attributeGroup) - { - for (Iterator it = attributeGroup.getContents().iterator(); it.hasNext(); ) - { - Object o = it.next(); - if (o instanceof XSDAttributeUse) - { - XSDAttributeUse attributeUse = (XSDAttributeUse)o; - concreteComponentList.add(attributeUse); - } - else if (o instanceof XSDAttributeGroupDefinition) - { - XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition)o; - thingsWeNeedToListenTo.add(attrGroup); - if (attrGroup.isAttributeGroupDefinitionReference()) - { - attrGroup = attrGroup.getResolvedAttributeGroupDefinition(); - visitAttributeGroupDefinition(attrGroup); - } - } - } - } - - public void visitElementDeclaration(XSDElementDeclaration element) - { - //super.visitElementDeclaration(element); - concreteComponentList.add(element); - } - - public void visitAttributeDeclaration(XSDAttributeDeclaration attr) - { - super.visitAttributeDeclaration(attr); - concreteComponentList.add(attr); - } - - - public List getConcreteComponentList() - { - return concreteComponentList; - } - - - public List getThingsWeNeedToListenTo() - { - return thingsWeNeedToListenTo; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBaseParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBaseParameterCommand.java deleted file mode 100644 index 52eee0a31..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBaseParameterCommand.java +++ /dev/null @@ -1,268 +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.commands; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.ui.internal.util.XSDComponentHelper; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; - -public abstract class AddBaseParameterCommand { - public static int PART_ELEMENT_SEQ_ELEMENT = 0; - public static int PART_ELEMENT = 1; - public static int PART_COMPLEXTYPE_SEQ_ELEMENT = 2; - public static int PART_COMPLEXTYPE = 3; - - protected int style = 0; - protected Operation operation; - protected XSDElementDeclaration newXSDElement; - - protected String newAnonymousXSDElementName; - protected String newXSDElementName; - protected String newWSDLMessageName; - protected String newWSDLPartName; - - public abstract void run(); - - public AddBaseParameterCommand(Operation operation, int style) { - this.operation = operation; - this.style = style; - } - - public void setStyle(int style) { - this.style = style; - } - - public XSDElementDeclaration getXSDElementDeclaration() { - return newXSDElement; - } - - protected boolean isPartElementReference() { - if (style == PART_ELEMENT || style == PART_ELEMENT_SEQ_ELEMENT) { - return true; - } - - return false; - } - - protected XSDElementDeclaration createPartElementReferenceComponents(Part part) { - XSDElementDeclaration returnedXSDElement = null; - XSDElementDeclaration partElement = part.getElementDeclaration(); - - if (style == PART_ELEMENT_SEQ_ELEMENT) { - XSDElementDeclaration originalElement = null; - XSDElementDeclaration anonXSDElement = null; - - // Create the XSDElement (anonymous) referenced by the Part if necessary - if (partElement == null || partElement.getAnonymousTypeDefinition() == null) { - anonXSDElement = XSDComponentHelper.createAnonymousXSDElementDefinition(getAnonymousXSDElementBaseName(), part); -// part.setElementDeclaration(anonXSDElement); - String prefixedName = getPrefixedComponentName(part.getEnclosingDefinition(), anonXSDElement); - ComponentReferenceUtil.setComponentReference(part, false, prefixedName); - part.setTypeDefinition(null); - - if (partElement != null) { - originalElement = partElement; - // Remove the 'original' XSDElement as a Global Element - partElement.getSchema().getContents().remove(partElement); - } - } - else { - anonXSDElement = partElement; - } - - // Create a new XSDElement - XSDModelGroup modelGroup = XSDComponentHelper.getXSDModelGroup(anonXSDElement, part.getEnclosingDefinition()); - returnedXSDElement = XSDComponentHelper.createXSDElementDeclarationCommand(null, getNewXSDElementBaseName(), modelGroup); - - // Add the newly created XSDElement to the ModelGroup - XSDComponentHelper.addXSDElementToModelGroup(anonXSDElement, returnedXSDElement); - - // Add the 'original' XSDElement if it's type wasn't anonymous - if (originalElement != null) { - XSDComponentHelper.addXSDElementToModelGroup(anonXSDElement, originalElement); - } - } - else if (style == PART_ELEMENT) { - if (partElement == null) { - returnedXSDElement = XSDComponentHelper.createXSDElementDeclarationCommand(part.getEnclosingDefinition(), getNewXSDElementBaseName(), part); - } - else { - // TODO: What should we do here..... We can default to the PART_ELEMENT_SEQ_ELEMENT style - // since it handles 'multiple' XSDElements.... OR ..... we can 'overwrite and set a new - // XSDElement - } - - if (returnedXSDElement != null && !returnedXSDElement.equals(part.getElementDeclaration())) { -// part.setElementDeclaration(returnedXSDElement); - String prefixedName = getPrefixedComponentName(part.getEnclosingDefinition(), returnedXSDElement); - ComponentReferenceUtil.setComponentReference(part, false, prefixedName); - - } - } - - return returnedXSDElement; - } - - protected XSDElementDeclaration createPartComplexTypeReference(Part part) { - XSDElementDeclaration returnedXSDElement = null; - - if (style == PART_COMPLEXTYPE_SEQ_ELEMENT) { - XSDTypeDefinition originalType = null; - XSDComplexTypeDefinition topLevelType = null; - - // Create the ComplexType referenced by the Part if necessary - if (part.getTypeDefinition() == null || part.getTypeDefinition() instanceof XSDSimpleTypeDefinition) { - XSDSchema schema = XSDComponentHelper.getXSDSchema(part.getEnclosingDefinition()); - String topLevelName = NameUtil.getXSDComplexTypeName(part.getName(), schema); - topLevelType = XSDComponentHelper.createXSDComplexTypeDefiniion(topLevelName, part); - - if (part.getTypeDefinition() instanceof XSDSimpleTypeDefinition) { - originalType = part.getTypeDefinition(); - } - } - else if (part.getTypeDefinition() instanceof XSDComplexTypeDefinition){ - topLevelType = (XSDComplexTypeDefinition) part.getTypeDefinition(); - } - - // Create a new XSDElement - XSDModelGroup modelGroup = XSDComponentHelper.getXSDModelGroup(topLevelType); - returnedXSDElement = XSDComponentHelper.createXSDElementDeclarationCommand(null, getNewXSDElementBaseName(), modelGroup); - - // Add the 'original' XSDElement if it's type wasn't anonymous - if (originalType != null) { - // Create another new XSDElement to 'contain' the originally referenced XSDSimpleType - XSDElementDeclaration origXSDElement = XSDComponentHelper.createXSDElementDeclarationCommand(null, getNewXSDElementBaseName(), modelGroup); - origXSDElement.setTypeDefinition(originalType); - } - - // Change Part reference -// part.setTypeDefinition(topLevelType); - String prefixedName = getPrefixedComponentName(part.getEnclosingDefinition(), topLevelType); - ComponentReferenceUtil.setComponentReference(part, true, prefixedName); - - - } - else if (style == PART_COMPLEXTYPE) { - XSDComplexTypeDefinition complexType = null; - if (part.getTypeDefinition() == null) { - // Create a new ComplexType - XSDSchema schema = XSDComponentHelper.getXSDSchema(part.getEnclosingDefinition()); - String complexName = NameUtil.getXSDComplexTypeName(part.getName(), schema); - complexType = XSDComponentHelper.createXSDComplexTypeDefiniion(complexName, part); - - // Create an XSDElement for the ComplexType - XSDModelGroup xsdModelGroup = XSDComponentHelper.getXSDModelGroup(complexType); - returnedXSDElement = XSDComponentHelper.createXSDElementDeclarationCommand(null, getNewXSDElementBaseName(), xsdModelGroup); - } - else { - // TODO: What should we do here..... We can default to the PART_ELEMENT_SEQ_ELEMENT style - // since it handles 'multiple' XSDElements.... OR ..... we can 'overwrite and set a new - // XSDElement - } - - if (complexType != null && !complexType.equals(part.getTypeDefinition())) { -// part.setTypeDefinition(complexType); - String prefixedName = getPrefixedComponentName(part.getEnclosingDefinition(), complexType); - ComponentReferenceUtil.setComponentReference(part, true, prefixedName); - } - } - - return returnedXSDElement; - } - /* - * Create if necessary a Message and Part for the given MessageReference - * and return it's Part - */ - protected Part createWSDLComponents(MessageReference messageRef) { - Message message = messageRef.getEMessage(); - Part part = null; - - if (message == null) { - // Create Message - AddMessageCommand command = new AddMessageCommand(messageRef.getEnclosingDefinition(), getWSDLMessageName()); - command.run(); - message = (Message) command.getWSDLElement(); - messageRef.setEMessage(message); - } - - if (message.getEParts().size() == 0) { - // Create Part - AddPartCommand command = new AddPartCommand(message, getWSDLPartName()); - command.run(); - part = (Part) command.getWSDLElement(); - } - else { - part = (Part) message.getEParts().get(0); - } - - return part; - } - - protected XSDElementDeclaration createXSDObjects(Part part) { - XSDElementDeclaration returnedXSDElement = null; - if (isPartElementReference()) { - // Is a Part --> Element reference - returnedXSDElement = createPartElementReferenceComponents(part); - } - else { - // Is a Part --> Complex Type reference - returnedXSDElement = createPartComplexTypeReference(part); - } - - return returnedXSDElement; - } - - private String getPrefixedComponentName(Definition definition, XSDNamedComponent component) { - String name = component.getName(); - String tns = component.getTargetNamespace(); - List prefixes = getPrefixes(definition, tns); - if (prefixes.size() > 0) { - name = prefixes.get(0) + ":" + name; //$NON-NLS-1$ - } - - return name; - } - - private List getPrefixes(Definition definition, String namespace) { - List list = new ArrayList(); - Map map = definition.getNamespaces(); - for (Iterator i = map.keySet().iterator(); i.hasNext();) { - String prefix = (String) i.next(); - String theNamespace = (String) map.get(prefix); - if (theNamespace != null && theNamespace.equals(namespace)) { - list.add(prefix); - } - } - return list; - } - - protected abstract String getAnonymousXSDElementBaseName(); - protected abstract String getNewXSDElementBaseName(); - protected abstract String getWSDLMessageName(); - protected abstract String getWSDLPartName(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingCommand.java deleted file mode 100644 index 21251bb3e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingCommand.java +++ /dev/null @@ -1,47 +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.commands; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - - -public final class AddBindingCommand extends WSDLElementCommand -{ - private Definition definition; - private String localName; - private Binding binding; - - public AddBindingCommand - (Definition definition, - String localName) - { - this.definition = definition; - this.localName = localName; - } - - public WSDLElement getWSDLElement() - { - return binding; - } - - public void run() - { - binding = WSDLFactory.eINSTANCE.createBinding(); - binding.setQName(new QName(definition.getTargetNamespace(),localName)); - binding.setEnclosingDefinition(definition); - definition.addBinding(binding); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingFaultCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingFaultCommand.java deleted file mode 100644 index 0099bb306..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingFaultCommand.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.commands; - -import org.eclipse.wst.wsdl.BindingFault; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddBindingFaultCommand extends WSDLElementCommand -{ - BindingFault bindingFault; - BindingOperation bindingOperation; - String name; - - public AddBindingFaultCommand(BindingOperation bindingOperation, String name) - { - this.bindingOperation = bindingOperation; - this.name = name; - } - - public void run() - { - bindingFault = WSDLFactory.eINSTANCE.createBindingFault(); - bindingFault.setName(name); - bindingFault.setEnclosingDefinition(bindingOperation.getEnclosingDefinition()); - bindingOperation.addBindingFault((BindingFault)bindingFault); - } - - public WSDLElement getWSDLElement() - { - return bindingFault; - } -} - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingInputCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingInputCommand.java deleted file mode 100644 index fa8825bd1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingInputCommand.java +++ /dev/null @@ -1,42 +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.commands; - -import org.eclipse.wst.wsdl.BindingInput; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddBindingInputCommand extends WSDLElementCommand -{ - BindingInput bindingInput; - BindingOperation bindingOperation; - String name; - - public AddBindingInputCommand(BindingOperation bindingOperation, String name) - { - this.bindingOperation = bindingOperation; - this.name = name; - } - - public void run() - { - bindingInput = WSDLFactory.eINSTANCE.createBindingInput(); - bindingInput.setName(name); - bindingInput.setEnclosingDefinition(bindingOperation.getEnclosingDefinition()); - bindingOperation.setBindingInput((BindingInput)bindingInput); - } - - public WSDLElement getWSDLElement() - { - return bindingInput; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOperationCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOperationCommand.java deleted file mode 100644 index 09a4644d7..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOperationCommand.java +++ /dev/null @@ -1,104 +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.commands; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddBindingOperationCommand extends WSDLElementCommand -{ - private Binding binding; - - private String name; - private String bindingInputName = ""; //$NON-NLS-1$ - private String bindingOutputName = ""; //$NON-NLS-1$ - private String bindingFaultName =""; //$NON-NLS-1$ - - private BindingOperation bindingOperation; - - private boolean createBindingInput = false; - private boolean createBindingOutput = false; - private boolean createBindingFault = false; - - public AddBindingOperationCommand(Binding binding,String name) - { - this.binding = binding; - this.name = name; - } - - public AddBindingOperationCommand - (Binding binding, - String name, - boolean createBindingInput, - boolean createBindingOutput, - boolean createBindingFault) - { - this.binding = binding; - this.name = name; - this.createBindingInput = createBindingInput; - this.createBindingOutput = createBindingOutput; - this.createBindingFault = createBindingFault; - } - - public void run() - { - bindingOperation = WSDLFactory.eINSTANCE.createBindingOperation(); - bindingOperation.setName(name); - bindingOperation.setEnclosingDefinition(binding.getEnclosingDefinition()); - binding.addBindingOperation(bindingOperation); - - WSDLElementCommand command = null; - if (createBindingInput) - { - command = new AddBindingInputCommand(bindingOperation,bindingInputName); - command.run(); - } - - if (createBindingOutput) - { - command = new AddBindingOutputCommand(bindingOperation,bindingOutputName); - command.run(); - } - - if (createBindingFault) - { - command = new AddBindingFaultCommand(bindingOperation,bindingFaultName); - command.run(); - } - } - - public WSDLElement getWSDLElement() - { - return bindingOperation; - } - - public void setName(String name) - { - this.name = name; - } - - public void setBindingInputName(String name) - { - this.bindingInputName = name; - } - - public void setBindingOutputName(String name) - { - this.bindingOutputName = name; - } - - public void setBindingFaultName(String name) - { - this.bindingFaultName = name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOutputCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOutputCommand.java deleted file mode 100644 index 480da5079..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddBindingOutputCommand.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.commands; - -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.BindingOutput; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddBindingOutputCommand extends WSDLElementCommand -{ - BindingOutput bindingOutput; - BindingOperation bindingOperation; - String name; - - public AddBindingOutputCommand(BindingOperation bindingOperation, String name) - { - this.bindingOperation = bindingOperation; - this.name = name; - } - - public void run() - { - bindingOutput = WSDLFactory.eINSTANCE.createBindingOutput(); - bindingOutput.setName(name); - bindingOutput.setEnclosingDefinition(bindingOperation.getEnclosingDefinition()); - bindingOperation.setBindingOutput((BindingOutput)bindingOutput); - } - - public WSDLElement getWSDLElement() - { - return bindingOutput; - } -} - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddExtensionElementCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddExtensionElementCommand.java deleted file mode 100644 index 055bb222f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddExtensionElementCommand.java +++ /dev/null @@ -1,61 +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.commands; - -import org.eclipse.wst.wsdl.ExtensibleElement; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddExtensionCommand; -import org.eclipse.xsd.XSDElementDeclaration; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class AddExtensionElementCommand extends AddExtensionCommand -{ - ExtensibleElement input; - XSDElementDeclaration element; - Element appInfo; - Element newElement; - - public AddExtensionElementCommand(String label, ExtensibleElement input, XSDElementDeclaration element) - { - super(label); - this.input = input; - this.element = element; - } - - public void execute() - { - super.execute(); - Element parentElement = input.getElement(); - Document doc = parentElement.getOwnerDocument(); - Element rootElement = doc.createElementNS(extensionsSchemaSpec.getNamespaceURI(), element.getName()); - -// TODO (cs) gotta fix this... need a simple way to compute a unique prefix -// createUniquePrefix(parentElement); - String prefix = "p"; - rootElement.setPrefix(prefix); - newElement = rootElement; - - Attr nsURIAttribute = doc.createAttribute("xmlns:"+prefix); - nsURIAttribute.setValue(extensionsSchemaSpec.getNamespaceURI()); - rootElement.setAttributeNode(nsURIAttribute); - parentElement.appendChild(rootElement); - } - - public void undo() - { - // TODO (cs) do we need to implement? - } - public Object getNewObject() - { - return newElement; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultCommand.java deleted file mode 100644 index 1853f0653..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultCommand.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.commands; - -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - - -public final class AddFaultCommand extends AddMessageReferenceCommand -{ - private Fault originalFault; - - public AddFaultCommand(Operation operation, String name) - { - super(operation,name); - } - - public AddFaultCommand(Operation operation, String name, boolean createMessage) - { - super(operation,name,createMessage); - } - - /* - * Constructor used to create a Fault based on the given Fault. In essence, this will - * create a copy of the given Fault. - */ - public AddFaultCommand(Operation operation, Fault originalFault, String name) { - super(operation, name, false); - - this.originalFault = originalFault; - } - - public void run() - { - messageReference = WSDLFactory.eINSTANCE.createFault(); - messageReference.setName(name); - messageReference.setEnclosingDefinition(operation.getEnclosingDefinition()); - operation.addFault((Fault)messageReference); - - // TBD - add binding fault - - if (originalFault == null) { - if (createMessage) - createMessage(); - } - else { - // Do necessary copying of data from original Fault to new Fault - if (originalFault.getEMessage() != null) { -// String originalMsgName = originalFault.getEMessage().getQName().getLocalPart(); -// -// boolean gened = false; -// if (originalFault.eContainer() instanceof Operation) -// gened = SmartRenameAction.isMessageNameGenerated(originalMsgName, ((Operation) originalFault.eContainer()).getName(), ""); -// -// String newMsgName = ""; -// if (gened) { -// newMsgName = NameUtil.buildUniqueMessageName(operation.getEnclosingDefinition(), messageReference); -// } -// else { -// Definition definition = operation.getEnclosingDefinition(); -// Message tMessage = originalFault.getEMessage(); -// newMsgName = NameUtil.buildUniqueMessageName(definition, tMessage.getQName().getLocalPart()); -// } - - createMessage(originalFault, NameUtil.buildUniqueMessageName(operation.getEnclosingDefinition(), messageReference)); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultParameterCommand.java deleted file mode 100644 index ab8a4f4bd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddFaultParameterCommand.java +++ /dev/null @@ -1,87 +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.commands; - -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class AddFaultParameterCommand extends AddBaseParameterCommand { - protected Fault fault; - private String faultName; - - public AddFaultParameterCommand(Operation operation, Fault fault) { - super(operation, AddBaseParameterCommand.PART_ELEMENT); - this.fault = fault; - } - - /* - * - */ - public void run() { - if (fault == null) { - AddFaultCommand command = new AddFaultCommand(operation, getFaultName()); - command.run(); - fault = (Fault) command.getWSDLElement(); - } - - Part part = createWSDLComponents(fault); - - // Create necessary XSD Objects starting with the Part reference - newXSDElement = createXSDObjects(part); - } - - protected String getAnonymousXSDElementBaseName() { - if (newAnonymousXSDElementName == null) { - newAnonymousXSDElementName = operation.getName() + "_" + getFaultName(); //$NON-NLS-1$ - } - - return newAnonymousXSDElementName; - } - - protected String getNewXSDElementBaseName() { - if (newXSDElementName == null) { - newXSDElementName = operation.getName() + "_" + getFaultName(); //$NON-NLS-1$ - } - - return newXSDElementName; - } - - protected String getWSDLMessageName() { - if (newWSDLMessageName == null) { - newWSDLMessageName = operation.getName() + "_" + getFaultName() + "Msg"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - return newWSDLMessageName; - } - - protected String getWSDLPartName() { - if (newWSDLPartName == null) { - newWSDLPartName = getFaultName(); - } - - return newWSDLPartName; - } - - private String getFaultName() { - if (faultName == null) { - if (fault != null) { - faultName = fault.getName(); - } - else { - faultName = NameUtil.getFaultName(operation); - } - } - - return faultName; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddImportCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddImportCommand.java deleted file mode 100644 index 8439dbfbd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddImportCommand.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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddImportCommand extends WSDLElementCommand -{ - private Definition definition; - private String namespace; - private String location; - private Import importElement; - - public AddImportCommand - (Definition definition, - String namespace, - String location) - { - this.definition = definition; - this.namespace = namespace; - this.location = location; - } - - public WSDLElement getWSDLElement() - { - return importElement; - } - - public void run() - { - importElement = WSDLFactory.eINSTANCE.createImport(); - importElement.setNamespaceURI(namespace); - importElement.setLocationURI(location); - importElement.setEnclosingDefinition(definition); - definition.addImport(importElement); - } - - public void setNamespaceURI(String namespace) - { - this.namespace = namespace; - } - - public void setLocationURI(String location) - { - this.location = location; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputCommand.java deleted file mode 100644 index db575f2c9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputCommand.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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.ui.internal.actions.SmartRenameAction; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - - -public final class AddInputCommand extends AddMessageReferenceCommand -{ - private Input originalInput; - - public AddInputCommand(Operation operation, String name) - { - super(operation,name); - } - - public AddInputCommand(Operation operation, String name, boolean createMessage) - { - super(operation,name,createMessage); - } - - /* - * Constructor used to create an Input based on the given Input. In essence, this will - * create a copy of the given Input. - */ - public AddInputCommand(Operation operation, Input originalInput, String name) { - super(operation, name, false); - - this.originalInput = originalInput; - } - - public void run() - { - messageReference = WSDLFactory.eINSTANCE.createInput(); - // messageReference.setName(name); - messageReference.setEnclosingDefinition(operation.getEnclosingDefinition()); - operation.setInput((Input)messageReference); - - // TBD - add binding input - - if (originalInput == null) { - if (createMessage) - createMessage(); - } - else { - // Do necessary copying of data from original Input to new Input - if (originalInput.getEMessage() != null) { - String originalMsgName = originalInput.getEMessage().getQName().getLocalPart(); - - boolean gened = false; - if (originalInput.eContainer() instanceof Operation) - gened = SmartRenameAction.isMessageNameGenerated(originalMsgName, ((Operation) originalInput.eContainer()).getName(), "Request"); //$NON-NLS-1$ - - String newMsgName = ""; //$NON-NLS-1$ - if (gened) { - newMsgName = NameUtil.buildUniqueMessageName(operation.getEnclosingDefinition(), messageReference); - } - else { - Definition definition = operation.getEnclosingDefinition(); - Message tMessage = originalInput.getEMessage(); - newMsgName = NameUtil.buildUniqueMessageName(definition, tMessage.getQName().getLocalPart()); - } - - createMessage(originalInput, newMsgName); - } - } - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputParameterCommand.java deleted file mode 100644 index 1c451cfc0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddInputParameterCommand.java +++ /dev/null @@ -1,75 +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.commands; - -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class AddInputParameterCommand extends AddBaseParameterCommand { - public AddInputParameterCommand(Operation operation, int style) { - super(operation, style); - } - - /* - * - */ - public void run() { - Part part = null; - if (operation.getEInput() != null) { - part = createWSDLComponents(operation.getEInput()); - } - else { - AddInputCommand command = new AddInputCommand(operation, null); - command.run(); - Input input = (Input) command.getWSDLElement(); - part = createWSDLComponents(input); - } - - // Create necessary XSD Objects starting with the Part reference - newXSDElement = createXSDObjects(part); - } - - protected String getAnonymousXSDElementBaseName() { - if (newAnonymousXSDElementName == null) { - newAnonymousXSDElementName = operation.getName() + "Request"; //$NON-NLS-1$ - } - - return newAnonymousXSDElementName; - } - - protected String getNewXSDElementBaseName() { - if (newXSDElementName == null) { - newXSDElementName = "input"; //$NON-NLS-1$ - } - - return newXSDElementName; - } - - protected String getWSDLMessageName() { - if (newWSDLMessageName == null) { - if (operation.getEInput() != null) { - newWSDLMessageName= NameUtil.getMessageName(operation.getEInput()); - } - } - - return newWSDLMessageName; - } - - protected String getWSDLPartName() { - if (newWSDLPartName == null) { - newWSDLPartName = NameUtil.getPartName(operation.getEInput()); - } - - return newWSDLPartName; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageCommand.java deleted file mode 100644 index 87bda0532..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageCommand.java +++ /dev/null @@ -1,109 +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.commands; - -import java.util.Iterator; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.ui.internal.actions.SmartRenameAction; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.util.WSDLConstants; - - -public final class AddMessageCommand extends WSDLElementCommand -{ - private Definition definition; - private String localName; - private Message message; - private Message originalMessage; - - private boolean createPart = false; - private final String DEFAULT_PART_NAME = "NewPart"; //$NON-NLS-1$ - - public AddMessageCommand - (Definition definition, - String localName) - { - this.definition = definition; - this.localName = localName; - } - - public AddMessageCommand - (Definition definition, - String localName, - boolean createPart) - { - this.definition = definition; - this.localName = localName; - this.createPart = createPart; - } - - /* - * Constructor used to create a Message based on the given Message. In essence, this will - * create a copy of the given Message. - */ - public AddMessageCommand(Definition definition, Message originalMessage, String localName, boolean copyPart) { - this.definition = definition; - this.localName = localName; - this.createPart = copyPart; - this.originalMessage = originalMessage; - } - - public void run() - { - message = WSDLFactory.eINSTANCE.createMessage(); - message.setQName(new QName(definition.getTargetNamespace(),localName)); - message.setEnclosingDefinition(definition); - definition.addMessage(message); - - if (originalMessage == null) { - if (createPart) - { - AddPartCommand command = - new AddPartCommand(message,DEFAULT_PART_NAME,WSDLConstants.SCHEMA_FOR_SCHEMA_URI_2001,"string",true); //$NON-NLS-1$ - command.run(); - } - } - else { - if (originalMessage.getEParts() != null) { - Iterator it = originalMessage.getEParts().iterator(); - - while (it.hasNext()) { - Part part = (Part) it.next(); - AddPartCommand command; - if (SmartRenameAction.isPartNameGenerated(part.getName(), originalMessage.getQName().getLocalPart())) - command = new AddPartCommand(message, part, NameUtil.buildUniquePartName(message, message.getQName().getLocalPart())); - else - command = new AddPartCommand(message, part, part.getName()); - - - command.run(); - } - } - } - } - - public void setLocalName(String name) - { - this.localName = name; - } - - public WSDLElement getWSDLElement() - { - return message; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageReferenceCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageReferenceCommand.java deleted file mode 100644 index ae939f7e1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddMessageReferenceCommand.java +++ /dev/null @@ -1,71 +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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.WSDLElement; - -abstract public class AddMessageReferenceCommand extends WSDLElementCommand -{ - protected String name; - protected MessageReference messageReference; - protected Operation operation; - protected boolean createMessage = false; - private final String DEFAULT_MESSAGE_NAME = "NewMessage"; //$NON-NLS-1$ - - public AddMessageReferenceCommand(Operation operation, String name) - { - this.operation = operation; - this.name = name; - } - - public AddMessageReferenceCommand(Operation operation, String name, boolean createMessage) - { - this.operation = operation; - this.name = name; - this.createMessage = createMessage; - } - - protected void createMessage() - { - Definition definition = operation.getEnclosingDefinition(); - AddMessageCommand command = - new AddMessageCommand(definition,DEFAULT_MESSAGE_NAME,createMessage); - command.run(); - messageReference.setEMessage((Message)command.getWSDLElement()); - } - - /* - * Overloaded createMessage(arg) method. Similar to to createMessage() but takes in a MessageReference. - * Method used to create a copy of the original Message (contained in the passed in MessageReference). - */ - protected void createMessage(MessageReference originalMRef, String newMessageRefName) { - Definition definition = operation.getEnclosingDefinition(); - Message tMessage = originalMRef.getEMessage(); - AddMessageCommand command = - new AddMessageCommand(definition, tMessage, newMessageRefName, true); - command.run(); - messageReference.setEMessage((Message)command.getWSDLElement()); - } - - public WSDLElement getWSDLElement() - { - return messageReference; - } - - public void setName(String name) - { - this.name = name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOperationCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOperationCommand.java deleted file mode 100644 index aef70d0b3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOperationCommand.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.commands; - -import java.util.Iterator; - -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - - -public final class AddOperationCommand extends WSDLElementCommand -{ - private PortType portType; - private String name; - private Operation operation; - private Operation originalOperation; - private boolean copyInOutFault; - - private boolean createInput = false; - private boolean createOutput = false; - private boolean createFault = false; - - private final String DEFAULT_INPUT_NAME = ""; //$NON-NLS-1$ - private final String DEFAULT_OUTPUT_NAME = ""; //$NON-NLS-1$ - private final String DEFAULT_FAULT_NAME = ""; //$NON-NLS-1$ - - public AddOperationCommand - (PortType portType, - String name) - { - this.portType = portType; - this.name = name; - } - - public AddOperationCommand - (PortType portType, - String name, - boolean createInput, - boolean createOutput, - boolean createFault) - { - this.portType = portType; - this.name = name; - this.createInput = createInput; - this.createOutput = createOutput; - this.createFault = createFault; - } - - /* - * Constructor used to create an Operation based on the given Operation. In essence, this will - * create a copy of the given Operation. - */ - public AddOperationCommand(PortType portType, Operation originalOperation, String name, boolean copyInOutFault) { - this.portType = portType; - this.originalOperation = originalOperation; - this.name = name; - this.copyInOutFault = copyInOutFault; - } - - public void run() - { - operation = WSDLFactory.eINSTANCE.createOperation(); - operation.setName(name); - operation.setEnclosingDefinition(portType.getEnclosingDefinition()); - portType.addOperation(operation); - - if (originalOperation == null) { - WSDLElementCommand command = null; - if (createInput) - { - command = new AddInputCommand(operation,DEFAULT_INPUT_NAME,true); - command.run(); - } - - if (createOutput) - { - command = new AddOutputCommand(operation,DEFAULT_OUTPUT_NAME,true); - command.run(); - } - - if (createFault) - { - command = new AddFaultCommand(operation,DEFAULT_FAULT_NAME,true); - command.run(); - } - } - else { - // Do necessary copying of data from original operation to new operation - // Paramater ordering? Documentation? This part still needs to be worked on - // Copy 'kids' if necessary - if (copyInOutFault) { - WSDLElementCommand command = null; - - if (originalOperation.getEOutput() != null) - { - Output output = originalOperation.getEOutput(); - command = new AddOutputCommand(operation, output, NameUtil.buildUniqueOutputName(portType, operation.getName(), "")); //$NON-NLS-1$ - command.run(); - } - - if (originalOperation.getEInput() != null) - { - Input input = originalOperation.getEInput(); - command = new AddInputCommand(operation, input, NameUtil.buildUniqueInputName(portType, operation.getName(), "")); //$NON-NLS-1$ - command.run(); - } - - if (originalOperation.getEFaults() != null) - { - Iterator it = originalOperation.getEFaults().iterator(); - while (it.hasNext()) { - Fault fault = (Fault) it.next(); - command = new AddFaultCommand(operation, fault, NameUtil.buildUniqueFaultName(originalOperation, fault.getName())); - command.run(); - } - } - - } - } - } - - public WSDLElement getWSDLElement() - { - return operation; - } - - public void setName(String name) - { - this.name = name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputCommand.java deleted file mode 100644 index 28811d23d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputCommand.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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.ui.internal.actions.SmartRenameAction; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - - -public final class AddOutputCommand extends AddMessageReferenceCommand -{ - private Output originalOutput; - - public AddOutputCommand(Operation operation, String name) - { - super(operation,name); - } - - public AddOutputCommand(Operation operation, String name, boolean createMessage) - { - super(operation,name,createMessage); - } - - /* - * Constructor used to create an Output based on the given Output. In essence, this will - * create a copy of the given Output. - */ - public AddOutputCommand(Operation operation, Output originalOutput, String name) { - super(operation, name, false); - - this.originalOutput = originalOutput; - } - - public void run() - { - messageReference = WSDLFactory.eINSTANCE.createOutput(); -// messageReference.setName(name); - messageReference.setEnclosingDefinition(operation.getEnclosingDefinition()); - operation.setOutput((Output)messageReference); - - // TBD - add binding output - - if (originalOutput == null) { - if (createMessage) - createMessage(); - } - else { - // Do necessary copying of data from original Output to new Output - if (originalOutput.getEMessage() != null) { - String originalMsgName = originalOutput.getEMessage().getQName().getLocalPart(); - - boolean gened = false; - if (originalOutput.eContainer() instanceof Operation) - gened = SmartRenameAction.isMessageNameGenerated(originalMsgName, ((Operation) originalOutput.eContainer()).getName(), "Response"); //$NON-NLS-1$ - - String newMsgName = ""; //$NON-NLS-1$ - if (gened) { - newMsgName = NameUtil.buildUniqueMessageName(operation.getEnclosingDefinition(), messageReference); - } - else { - Definition definition = operation.getEnclosingDefinition(); - Message tMessage = originalOutput.getEMessage(); - newMsgName = NameUtil.buildUniqueMessageName(definition, tMessage.getQName().getLocalPart()); - } - - createMessage(originalOutput, newMsgName); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputParameterCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputParameterCommand.java deleted file mode 100644 index 0868d0f11..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddOutputParameterCommand.java +++ /dev/null @@ -1,75 +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.commands; - -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class AddOutputParameterCommand extends AddBaseParameterCommand { - public AddOutputParameterCommand(Operation operation, int style) { - super(operation, style); - } - - /* - * - */ - public void run() { - Part part = null; - if (operation.getEOutput() != null) { - part = createWSDLComponents(operation.getEOutput()); - } - else { - AddOutputCommand command = new AddOutputCommand(operation, null); - command.run(); - Output output = (Output) command.getWSDLElement(); - part = createWSDLComponents(output); - } - - // Create necessary XSD Objects starting with the Part reference - newXSDElement = createXSDObjects(part); - } - - protected String getAnonymousXSDElementBaseName() { - if (newAnonymousXSDElementName == null) { - newAnonymousXSDElementName = operation.getName() + "Response"; //$NON-NLS-1$ - } - - return newAnonymousXSDElementName; - } - - protected String getNewXSDElementBaseName() { - if (newXSDElementName == null) { - newXSDElementName = "output"; //$NON-NLS-1$ - } - - return newXSDElementName; - } - - protected String getWSDLMessageName() { - if (newWSDLMessageName == null) { - if (operation.getEOutput() != null) { - newWSDLMessageName= NameUtil.getMessageName(operation.getEOutput()); - } - } - - return newWSDLMessageName; - } - - protected String getWSDLPartName() { - if (newWSDLPartName == null) { - newWSDLPartName = NameUtil.getPartName(operation.getEOutput()); - } - - return newWSDLPartName; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPartCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPartCommand.java deleted file mode 100644 index b96db3857..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPartCommand.java +++ /dev/null @@ -1,210 +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.commands; - -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.internal.impl.PartImpl; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; - - -public final class AddPartCommand extends WSDLElementCommand -{ - private Message message; - private String name; - private Part part; - private Part originalPart; - - private QName typeOrElementName; - private boolean useType = true; - - public AddPartCommand - (Message message, - String name) - { - this.message = message; - this.name = name; - } - - public AddPartCommand - (Message message, - String name, - String namespace, - String localName, - boolean useType) - { - this.message = message; - this.name = name; - this.useType = useType; - typeOrElementName = new QName(namespace,localName); - } - - /* - * Constructor used to create a Part based on the given Part. In essence, this will - * create a copy of the given Part. - */ - public AddPartCommand - (Message message, - Part originalPart, - String name) - { - this.message = message; - this.name = name; - this.originalPart = originalPart; - } - - /** - * @deprecated - */ - public AddPartCommand - (Message message, - String name, - String namespace, - String localName) - { - this.message = message; - this.name = name; - typeOrElementName = new QName(namespace,localName); - } - - public void setName(String name) - { - this.name = name; - } - - public WSDLElement getWSDLElement() - { - return part; - } - - public void run() - { - if (typeOrElementName == null) - typeOrElementName = createDefaultTypeName(); - - // Add namespace to the Definitions if it is not there yet. - addNamespaceDeclaration(); - - part = WSDLFactory.eINSTANCE.createPart(); - part.setName(name); - - if (originalPart == null) { - if (useType) - part.setTypeName(typeOrElementName); - else - part.setElementName(typeOrElementName); - } - else { - if (originalPart.getTypeName() != null) - part.setTypeName(originalPart.getTypeName()); - - String newElementName = null; - if (originalPart.getElementName() != null) { - - boolean createNewElement = true; - if (originalPart.getElementDeclaration() != null && originalPart.getElementDeclaration().getElement() != null) { - if (!(originalPart.getElementDeclaration().getElement() instanceof IDOMNode)) { - createNewElement = false; - } - } - - if (createNewElement) { - newElementName = getNewNameHelper(name, originalPart.getEnclosingDefinition(), false); - part.setElementName(new QName(originalPart.getElementName().getNamespaceURI(), newElementName)); - - if (originalPart.getEnclosingDefinition() != null) { - if (newElementName == null) { - newElementName = getNewNameHelper(name, originalPart.getEnclosingDefinition(), false); - } - - AddXSDElementDeclarationCommand elementAction = new AddXSDElementDeclarationCommand(originalPart.getEnclosingDefinition(), newElementName); - elementAction.run(); - } - } - else { - part.setElementName(new QName(originalPart.getElementName().getNamespaceURI(), originalPart.getElementName().getLocalPart())); - } - } - } - - part.setEnclosingDefinition(message.getEnclosingDefinition()); - ((PartImpl)part).reconcileReferences(false); - message.addPart(part); - } - - private void addNamespaceDeclaration() - { - Definition definition = message.getEnclosingDefinition(); - if (!definition.getNamespaces().containsValue(typeOrElementName.getNamespaceURI())) - { - definition.addNamespace("p",typeOrElementName.getNamespaceURI()); //$NON-NLS-1$ - ((WSDLElementImpl)definition).updateElement(false); - } - } - - private QName createDefaultTypeName() - { - QName qname = new QName(WSDLConstants.SCHEMA_FOR_SCHEMA_URI_2001,"string"); //$NON-NLS-1$ - return qname; - } - - private String getNewNameHelper(String base, Definition def, boolean isType) - { - String name = base; - int count = 0; - - // Ugly.... Redo this... - // Get a list of Elements... - List elementList = null; - if (def.getETypes() != null) { - List xsdsList = def.getETypes().getEExtensibilityElements(); - if (xsdsList != null) { - Iterator xsdsIterator = xsdsList.iterator(); - XSDSchemaExtensibilityElement xsdElement = (XSDSchemaExtensibilityElement) xsdsIterator.next(); - XSDSchema schema = xsdElement.getSchema(); - if (schema != null) { - elementList = schema.getElementDeclarations(); - } - } - } - - if (elementList != null) { - int index = 0; - while (index < elementList.size()) { - XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) elementList.get(index); - - if (name.equals(elementDeclaration.getName())) { - count++; - name = name + count; - index = 0; - } - else { - index++; - } - } - } - - return name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortCommand.java deleted file mode 100644 index c326901bf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortCommand.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.commands; - -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -public final class AddPortCommand extends WSDLElementCommand -{ - private Service service; - private String name; - private Port port; - - public AddPortCommand - (Service service, - String name) - { - this.service = service; - this.name = name; - } - - public void setName(String name) - { - this.name = name; - } - - public WSDLElement getWSDLElement() - { - return port; - } - - public void run() - { - port = WSDLFactory.eINSTANCE.createPort(); - port.setName(name); - port.setEnclosingDefinition(service.getEnclosingDefinition()); - service.addPort(port); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortTypeCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortTypeCommand.java deleted file mode 100644 index b26feb543..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddPortTypeCommand.java +++ /dev/null @@ -1,75 +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.commands; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - - -public final class AddPortTypeCommand extends WSDLElementCommand -{ - private Definition definition; - private String localName; - private PortType portType; - - private boolean createOperation = false; - private final String DEFAULT_OPERATION_NAME = "NewOperation"; //$NON-NLS-1$ - - public AddPortTypeCommand - (Definition definition, - String localName) - { - this.definition = definition; - this.localName = localName; - } - - public AddPortTypeCommand - (Definition definition, - String localName, - boolean createOperation) - { - this.definition = definition; - this.localName = localName; - this.createOperation = createOperation; - } - - /* (non-Javadoc) - * @see org.eclipse.wst.wsdl.ui.internal.commands.WSDLElementAction#getWSDLElement() - */ - public WSDLElement getWSDLElement() - { - return portType; - } - - public void run() - { - portType = WSDLFactory.eINSTANCE.createPortType(); - portType.setQName(new QName(definition.getTargetNamespace(),localName)); - portType.setEnclosingDefinition(definition); - definition.addPortType(portType); - - if (createOperation) - { - AddOperationCommand command = - new AddOperationCommand(portType,DEFAULT_OPERATION_NAME,true,true,false); - command.run(); - } - } - - public void setLocalName(String name) - { - localName = name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddServiceCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddServiceCommand.java deleted file mode 100644 index 955cf1893..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddServiceCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.commands; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - - -public final class AddServiceCommand extends WSDLElementCommand -{ - private Definition definition; - private String localName; - private Service service; - - private boolean createPort = false; - private final String DEFAULT_PORT_NAME = "NewPort"; //$NON-NLS-1$ - - public AddServiceCommand - (Definition definition, - String localName) - { - this.definition = definition; - this.localName = localName; - } - - public AddServiceCommand - (Definition definition, - String localName, - boolean createPort) - { - this.definition = definition; - this.localName = localName; - this.createPort = createPort; - } - - public WSDLElement getWSDLElement() - { - return service; - } - - public void run() - { - service = WSDLFactory.eINSTANCE.createService(); - service.setQName(new QName(definition.getTargetNamespace(),localName)); - service.setEnclosingDefinition(definition); - definition.addService(service); - - if (createPort) - { - AddPortCommand command = - new AddPortCommand(service,DEFAULT_PORT_NAME); - command.run(); - } - } - - public void setLocalName(String name) - { - localName = name; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddTypesCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddTypesCommand.java deleted file mode 100644 index d87e58c52..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddTypesCommand.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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; - -// Definition must not have "types" element to run this command. -public final class AddTypesCommand extends WSDLElementCommand -{ - private Definition definition; - private Types types; - - public AddTypesCommand(Definition definition) - { - this.definition = definition; - } - - public void run() - { - if ((types = definition.getETypes()) != null) - return; // "types" already exists. - - types = WSDLFactory.eINSTANCE.createTypes(); - types.setEnclosingDefinition(definition); - definition.setTypes(types); - } - - public WSDLElement getWSDLElement() - { - return types; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddUnknownExtensibilityElementCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddUnknownExtensibilityElementCommand.java deleted file mode 100644 index f0487bc15..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddUnknownExtensibilityElementCommand.java +++ /dev/null @@ -1,80 +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.commands; - -import java.util.Iterator; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.ExtensibleElement; -import org.eclipse.wst.wsdl.UnknownExtensibilityElement; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.internal.impl.UnknownExtensibilityElementImpl; - -public final class AddUnknownExtensibilityElementCommand extends WSDLElementCommand -{ - private ExtensibleElement extensibleElement; - private String namespaceURI; - private String localName; - private UnknownExtensibilityElement extensibilityElement; - private Map properties; - - public AddUnknownExtensibilityElementCommand - (ExtensibleElement extensibleElement, - String namespaceURI, - String localName) - { - this.extensibleElement = extensibleElement; - this.namespaceURI = namespaceURI; - this.localName = localName; - } - - public AddUnknownExtensibilityElementCommand - (ExtensibleElement extensibleElement, - String namespaceURI, - String localName, - Map properties) - { - this.extensibleElement = extensibleElement; - this.namespaceURI = namespaceURI; - this.localName = localName; - this.properties = properties; - } - - public WSDLElement getWSDLElement() - { - return extensibilityElement; - } - - public void run() - { - extensibilityElement = WSDLFactory.eINSTANCE.createUnknownExtensibilityElement(); - extensibilityElement.setElementType(new QName(namespaceURI,localName)); - - if (properties != null) - { - Iterator iterator = properties.entrySet().iterator(); - Map.Entry entry = null; - while (iterator.hasNext()) - { - entry = (Map.Entry)iterator.next(); - String attribute = (String)entry.getKey(); - String value = (String)entry.getValue(); - ((UnknownExtensibilityElementImpl)extensibilityElement).setAttribute(attribute,value); - } - } - - extensibilityElement.setEnclosingDefinition(extensibleElement.getEnclosingDefinition()); - extensibleElement.addExtensibilityElement(extensibilityElement); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDElementDeclarationCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDElementDeclarationCommand.java deleted file mode 100644 index ce14e6757..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDElementDeclarationCommand.java +++ /dev/null @@ -1,147 +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.commands; - -import java.util.Iterator; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDFactory; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; - - -// This class is used to create a new XSDElementDeclaration in the targetNamespace. -public final class AddXSDElementDeclarationCommand extends WSDLElementCommand -{ - private Definition definition; - private String targetNamespace; - private String elementName; - private XSDSchema schema; - private XSDElementDeclaration xsdElement; - - /** - * TODO: - * We have a potential problem here.... What if the definition targetnamespace is null.... - */ - public AddXSDElementDeclarationCommand(Definition definition, String elementName) - { - this.definition = definition; - this.targetNamespace = definition.getTargetNamespace(); - this.elementName = elementName; - } - - /** - * @deprecated - * Use AddXSDElementDeclarationCommand(Definition definition, String typeName) - */ - public AddXSDElementDeclarationCommand - (Definition definition, - String targetNamespace, - String elementName) - { - this.definition = definition; - this.targetNamespace = targetNamespace; - this.elementName = elementName; - } - - public void run() - { - XSDSchema xsdSchema = getSchema(); - XSDElementDeclaration elementDecl = - XSDFactory.eINSTANCE.createXSDElementDeclaration(); - elementDecl.setName(elementName); - - XSDSimpleTypeDefinition simpleTypeDefinition = getXSDStringType(xsdSchema); - elementDecl.setTypeDefinition(simpleTypeDefinition); - xsdSchema.getContents().add(elementDecl); - - xsdElement = elementDecl; - } - - public void run(String newElementName) { - elementName = newElementName; - run(); - } - - /* - * Specify which Schema to use when creating the Type. - * Call this method before calling run(). Otherwise it will use the first - * Schema it finds. - */ - public void setSchema(XSDSchema schema) { - this.schema = schema; - } - - /* - * Return the Schema used to create the Type - */ - public XSDSchema getSchema() { - if (schema == null) { - return getXSDSchema(targetNamespace); - } - else { - return schema; - } - } - - private XSDSimpleTypeDefinition getXSDStringType(XSDSchema schema) - { - return schema.getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ - } - - private XSDSchema getXSDSchema(String targetNamespace) - { - XSDSchema xsdSchema; - - // Do we have a schema already? - Iterator iterator = getTypes().getSchemas(targetNamespace).iterator(); - if (iterator.hasNext()) - { - xsdSchema = (XSDSchema)iterator.next(); // Get the first one. - return xsdSchema; - } - else - { - // Create a new schema because there's none. - AddXSDSchemaCommand command = new AddXSDSchemaCommand(definition,targetNamespace); - command.run(); - return ((XSDSchemaExtensibilityElement)command.getWSDLElement()).getSchema(); - } - } - - private Types getTypes() - { - // Types is created if it does not exist yet. - Types types = (Types)definition.getTypes(); - if (types != null) - return types; - else - { - AddTypesCommand command = new AddTypesCommand(definition); - command.run(); - return (Types)command.getWSDLElement(); - } - } - - public WSDLElement getWSDLElement() - { - return null; - } - - public XSDElementDeclaration getXSDElement() - { - return xsdElement; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDSchemaCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDSchemaCommand.java deleted file mode 100644 index 18c4a6f52..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDSchemaCommand.java +++ /dev/null @@ -1,80 +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.commands; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.xsd.XSDFactory; -import org.eclipse.xsd.XSDSchema; - - - -public final class AddXSDSchemaCommand extends WSDLElementCommand -{ - private Definition definition; - private XSDSchemaExtensibilityElement extensibilityElement; - private String targetNamespace; - - public AddXSDSchemaCommand(Definition definition) - { - this.definition = definition; - this.targetNamespace = definition.getTargetNamespace(); - } - - public AddXSDSchemaCommand(Definition definition, String targetNamespace) - { - this.definition = definition; - this.targetNamespace = targetNamespace; - } - - public void run() - { - extensibilityElement = WSDLFactory.eINSTANCE.createXSDSchemaExtensibilityElement(); - extensibilityElement.setEnclosingDefinition(definition); - - XSDSchema xsdSchema = XSDFactory.eINSTANCE.createXSDSchema(); - xsdSchema.setSchemaForSchemaQNamePrefix("xsd"); //$NON-NLS-1$ - xsdSchema.setTargetNamespace(targetNamespace); - // Choose the prefix Choose the prefix used for this schema's namespace and the schema for schema's namespace. - // - java.util.Map qNamePrefixToNamespaceMap = xsdSchema.getQNamePrefixToNamespaceMap(); -// qNamePrefixToNamespaceMap.put("p", xsdSchema.getTargetNamespace()); - qNamePrefixToNamespaceMap.put - (xsdSchema.getSchemaForSchemaQNamePrefix(),org.eclipse.xsd.util.XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); - extensibilityElement.setSchema(xsdSchema); - - // TBD - Check if multiple schemas with the same targetNamespace can co-exist. - Types types = getTypes(); - types.addExtensibilityElement(extensibilityElement); - } - - private Types getTypes() - { - // Types is created if it does not exist. - Types types = (Types)definition.getTypes(); - if (types != null) - return types; - else - { - AddTypesCommand command = new AddTypesCommand(definition); - command.run(); - return (Types)command.getWSDLElement(); - } - } - - public WSDLElement getWSDLElement() - { - return extensibilityElement; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDTypeDefinitionCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDTypeDefinitionCommand.java deleted file mode 100644 index 5cd7cea45..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/AddXSDTypeDefinitionCommand.java +++ /dev/null @@ -1,162 +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.commands; - -import java.util.Iterator; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.xsd.XSDFactory; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDTypeDefinition; - -// This class is used to create a new XSDTypeDefinition in the targetNamespace. -public final class AddXSDTypeDefinitionCommand extends WSDLElementCommand -{ - private Definition definition; - private String targetNamespace; - private String typeName; - private XSDSchema schema; - private XSDTypeDefinition xsdType; - private boolean isComplexType = true; - - /** - * TODO: - * We have a potential problem here.... What if the definition targetnamespace is null.... - */ - public AddXSDTypeDefinitionCommand(Definition definition, String typeName) - { - this.definition = definition; - this.targetNamespace = definition.getTargetNamespace(); - this.typeName = typeName; - } - - public AddXSDTypeDefinitionCommand(Definition definition, String typeName, boolean isComplexType) - { - this(definition, typeName); - this.isComplexType = isComplexType; - } - - /** - * @deprecated - * Use AddXSDTypeDefinitionCommand(Definition definition, String typeName) - */ - public AddXSDTypeDefinitionCommand - (Definition definition, - String targetNamespace, - String typeName) - { - this.definition = definition; - this.targetNamespace = targetNamespace; - this.typeName = typeName; - } - - public void run() - { - XSDSchema xsdSchema = getSchema(); - XSDTypeDefinition typeDef; - - if (isComplexType) { - typeDef = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition(); - } - else { - typeDef = XSDFactory.eINSTANCE.createXSDSimpleTypeDefinition(); - } - - typeDef.setName(typeName); - xsdSchema.getContents().add(typeDef); - - xsdType = typeDef; - } - - public void run(String newTypeName) { - typeName = newTypeName; - run(); - } - - /* - * Specifiy if we should create a complex or simple type. This should should be - * called before run(). - * Overrides the value set when the constructor - * AddXSDTypeDefinitionCommand(Definition definition, String typeName, boolean isComplexType) - * is used. - */ - public void isComplexType(boolean isComplexType) { - this.isComplexType = isComplexType; - } - - /* - * Specify which Schema to use when creating the Type. - * Call this method before calling run(). Otherwise it will use the first - * Schema it finds. - */ - public void setSchema(XSDSchema schema) { - this.schema = schema; - } - - /* - * Return the Schema used to create the Type - */ - public XSDSchema getSchema() { - if (schema == null) { - return getXSDSchema(targetNamespace); - } - else { - return schema; - } - } - - private XSDSchema getXSDSchema(String targetNamespace) - { - XSDSchema xsdSchema; - - // Do we have a schema already? - Iterator iterator = getTypes().getSchemas(targetNamespace).iterator(); - if (iterator.hasNext()) - { - xsdSchema = (XSDSchema)iterator.next(); // Get the first one. - return xsdSchema; - } - else - { - // Create a new schema because there's none. - AddXSDSchemaCommand command = new AddXSDSchemaCommand(definition,targetNamespace); - command.run(); - return ((XSDSchemaExtensibilityElement)command.getWSDLElement()).getSchema(); - } - } - - private Types getTypes() - { - // Types is created if it does not exist yet. - Types types = (Types)definition.getTypes(); - if (types != null) - return types; - else - { - AddTypesCommand command = new AddTypesCommand(definition); - command.run(); - return (Types)command.getWSDLElement(); - } - } - - public WSDLElement getWSDLElement() - { - return null; - } - - public XSDTypeDefinition getXSDElement() - { - return xsdType; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/WSDLElementCommand.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/WSDLElementCommand.java deleted file mode 100644 index a01805165..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/commands/WSDLElementCommand.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.commands; - -import org.eclipse.wst.wsdl.WSDLElement; - -public abstract class WSDLElementCommand -{ - public abstract WSDLElement getWSDLElement(); - public abstract void run(); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/EditNamespacesDialog.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/EditNamespacesDialog.java deleted file mode 100644 index ad4eba5c0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/EditNamespacesDialog.java +++ /dev/null @@ -1,126 +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.dialogs; - -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesTargetFieldDialog; - -public class EditNamespacesDialog extends Dialog -{ - protected Button okButton; - protected String title; - protected String targetNamespace; - protected List namespaceInfoList; - protected CommonEditNamespacesTargetFieldDialog editWSDLNamespacesControl; - protected IPath resourceLocation; - // protected Label errorMessageLabel; - // protected String errorMessage; - - //protected Label errorMessageLabel; - - public EditNamespacesDialog(Shell parentShell, IPath resourceLocation, String title, String targetNamespace, List namespaceList) - { - super(parentShell); - this.resourceLocation = resourceLocation; - setShellStyle(getShellStyle() | SWT.RESIZE); - this.title = title; - this.targetNamespace = targetNamespace; - this.namespaceInfoList = namespaceList; - } - - public int createAndOpen() - { - create(); - getShell().setText(title); - setBlockOnOpen(true); - return open(); - } - - protected Control createContents(Composite parent) - { - Control control = super.createContents(parent); - updateErrorMessage(); - return control; - } - - protected void createButtonsForButtonBar(Composite parent) - { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - - protected Control createDialogArea(Composite parent) - { - Composite dialogArea = (Composite) super.createDialogArea(parent); - editWSDLNamespacesControl = new CommonEditNamespacesTargetFieldDialog(dialogArea, resourceLocation); - editWSDLNamespacesControl.setNamespaceInfoList(namespaceInfoList); - editWSDLNamespacesControl.setTargetNamespace(targetNamespace); - - return dialogArea; - } - - public void modifyText(ModifyEvent e) - { - updateErrorMessage(); - } - - protected String computeErrorMessage(String name) - { - return null; - } - - protected void updateErrorMessage() - { - String errorMessage = null; - /* - String name = nameField.getText().trim(); - if (name.length() > 0) - { - errorMessage = computeErrorMessage(name); - } - else - { - errorMessage = ""; - }*/ - - //errorMessageLabel.setText(errorMessage != null ? errorMessage : ""); - okButton.setEnabled(errorMessage == null); - } - - protected void buttonPressed(int buttonId) - { - if (buttonId == IDialogConstants.OK_ID) - { - targetNamespace = editWSDLNamespacesControl.getTargetNamespace(); - } - super.buttonPressed(buttonId); - } - - public List getNamespaceInfoList() - { - return namespaceInfoList; - } - - public String getTargetNamespace() - { - return targetNamespace; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/GenerateBindingOnSaveDialog.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/GenerateBindingOnSaveDialog.java deleted file mode 100644 index 77a78cc30..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/GenerateBindingOnSaveDialog.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.dialogs; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; - -public class GenerateBindingOnSaveDialog extends MessageDialog implements SelectionListener { - private static String dialogTitle = Messages.getString("_UI_REGEN_BINDINDS_ON_SAVE"); // TODO: Translations needed.... //$NON-NLS-1$ - private static String dialogMessage = Messages.getString("_UI_REGEN_BINDINGS_ON_SAVE_QUESTIONMARK"); //$NON-NLS-1$ - private static String[] buttons = new String[]{Messages.getString("_UI_YES_LABEL"), Messages.getString("_UI_NO_LABEL"), Messages.getString("_UI_CANCEL_LABEL")}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - private Button rememberDecisionBox; - private boolean rememberDecision = false; - - public GenerateBindingOnSaveDialog(Shell shell) { - super(shell, dialogTitle, null, dialogMessage, MessageDialog.QUESTION, buttons, 0); - } - - - protected Control createCustomArea(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - comp.setLayout(layout); - comp.setData(new GridData()); - - // Spacer - new Label(comp, SWT.NONE); - new Label(comp, SWT.NONE); - - rememberDecisionBox = new Button(comp, SWT.CHECK); - rememberDecisionBox.setText(Messages.getString("_UI_REMEMBER_MY_DECISION_LABEL")); // TODO: Externalize... //$NON-NLS-1$ - rememberDecisionBox.addSelectionListener(this); - - return parent; - } - - private void storePromptPreference(int swtValue) { - // Store the new preference for displaying this dialog. - if (rememberDecision) { - WSDLEditorPlugin.getInstance().getPluginPreferences().setValue(Messages.getString("_UI_PREF_PAGE_PROMPT_REGEN_BINDING_ON_SAVE"), false); //$NON-NLS-1$ - - String generateID = Messages.getString("_UI_PREF_PAGE_AUTO_REGENERATE_BINDING"); //$NON-NLS-1$ - if (swtValue == SWT.YES) { - WSDLEditorPlugin.getInstance().getPluginPreferences().setValue(generateID, true); - } - else if (swtValue == SWT.NO) { - WSDLEditorPlugin.getInstance().getPluginPreferences().setValue(generateID, false); - } - } - } - - public int open() { - int rValue = super.open(); - - if (rValue ==0) { - storePromptPreference(SWT.YES); - return SWT.YES; - } - else if (rValue == 1) { - storePromptPreference(SWT.NO); - return SWT.NO; - } - else if (rValue == 2) { - storePromptPreference(SWT.CANCEL); - return SWT.CANCEL; - } - - return rValue; - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == rememberDecisionBox) { - rememberDecision = rememberDecisionBox.getSelection(); - } - } - - public void widgetDefaultSelected(SelectionEvent e) {} -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/NewComponentDialog.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/NewComponentDialog.java deleted file mode 100644 index a4cdacfc3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/NewComponentDialog.java +++ /dev/null @@ -1,186 +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.dialogs; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.wst.wsdl.ui.internal.Messages; - -public class NewComponentDialog extends Dialog implements ModifyListener -{ - protected Text nameField; - protected Button okButton; - protected String name; - protected String title; - protected Label errorMessageLabel; - protected List usedNames; - - public NewComponentDialog(Shell parentShell, String title, String defaultName) - { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - name = defaultName; - this.title = title; - } - - public NewComponentDialog(Shell parentShell, String title, String defaultName, List usedNames) - { - super(parentShell); - setShellStyle(getShellStyle() | SWT.RESIZE); - name = defaultName; - this.title = title; - this.usedNames = usedNames; - } - - public int createAndOpen() - { - create(); - getShell().setText(title); - setBlockOnOpen(true); - return open(); - } - - protected Control createContents(Composite parent) - { - Control control = super.createContents(parent); - nameField.forceFocus(); - nameField.selectAll(); - updateErrorMessage(); - return control; - } - - - protected void createButtonsForButtonBar(Composite parent) - { - okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); - } - - protected void createHeaderContent(Composite parent) - { - } - - protected void createExtendedContent(Composite parent) - { - } - - protected Control createDialogArea(Composite parent) - { - Composite dialogArea = (Composite)super.createDialogArea(parent); - - createHeaderContent(dialogArea); - - Composite composite = new Composite(dialogArea, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - composite.setLayout(layout); - - GridData gdFill= new GridData(); - gdFill.horizontalAlignment= GridData.FILL; - gdFill.grabExcessHorizontalSpace= true; - gdFill.verticalAlignment= GridData.FILL; - gdFill.grabExcessVerticalSpace= true; - composite.setLayoutData(gdFill); - - Label nameLabel = new Label(composite, SWT.NONE); - nameLabel.setText(Messages.getString("_UI_LABEL_NAME")); //$NON-NLS-1$ - - nameField = new Text(composite, SWT.SINGLE | SWT.BORDER); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= true; - gd.widthHint = 200; - nameField.setLayoutData(gd); - nameField.setText(name); - nameField.addModifyListener(this); - - createExtendedContent(dialogArea); - - // error message - errorMessageLabel = new Label(dialogArea, SWT.NONE); - errorMessageLabel.setText("error message goes here"); - GridData gd2 = new GridData(); - gd2.horizontalAlignment= GridData.FILL; - gd2.grabExcessHorizontalSpace= true; - gd2.widthHint = 200; - errorMessageLabel.setLayoutData(gd2); -// Color color = new Color(errorMessageLabel.getDisplay(), 200, 0, 0); -// errorMessageLabel.setForeground(color); - - return dialogArea; - } - - public void modifyText(ModifyEvent e) - { - updateErrorMessage(); - } - - protected String computeErrorMessage(String name) - { - if (usedNames == null) - return null; - - Iterator iterator = usedNames.iterator(); - while (iterator.hasNext()) { - if (name.equalsIgnoreCase((String) iterator.next())) { - return Messages.getString("_UI_LABEL_WARNING_DUPLICATE_NAME_EXISTS"); //$NON-NLS-1$ - } - } - - return null; - } - - protected void updateErrorMessage() - { - String errorMessage = null; - String name = nameField.getText().trim(); - if (name.length() > 0) - { - errorMessage = computeErrorMessage(name); - } - else - { - errorMessage = ""; //$NON-NLS-1$ - } - errorMessageLabel.setText(errorMessage != null ? errorMessage : ""); //$NON-NLS-1$ -// okButton.setEnabled(errorMessage == null); - } - - protected void buttonPressed(int buttonId) - { - if (buttonId == IDialogConstants.OK_ID) - { - name = nameField.getText(); - } - super.buttonPressed(buttonId); - } - - public String getName() - { - return name; - } -} - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/ProtocolComponentControl.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/ProtocolComponentControl.java deleted file mode 100644 index a38b47d1a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/ProtocolComponentControl.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.dialogs; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.part.PageBook; -import org.eclipse.wst.wsdl.internal.generator.BaseGenerator; -import org.eclipse.wst.wsdl.internal.generator.ContentGenerator; -import org.eclipse.wst.wsdl.internal.generator.extension.ContentGeneratorExtensionFactoryRegistry; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.wizards.ContentGeneratorOptionsPage; - -public abstract class ProtocolComponentControl extends Composite implements SelectionListener, ModifyListener -{ - protected BaseGenerator generator; - - protected Text componentNameField; - protected Combo refNameCombo; - protected Button refBrowseButton; - protected Combo protocolCombo; - protected Button overwriteButton; - protected PageBook pageBook; - protected Composite emptySettingsPage; - protected Map pageMap = new HashMap(); - - // List of ContentGenerators for each Protocol found in protocolCombo - protected List contentGenerators; - - //protected boolean isBindingComponent = true; - //protected boolean isNewComponent = true; - protected String name; - protected String refName; - - protected String UNSPECIFIED = Messages.getString("_UI_UNSPECIFIED"); //$NON-NLS-1$ - //protected BindingGenerator bindingGenerator; - - public ProtocolComponentControl(Composite parent, BaseGenerator generator, boolean showOverwriteButton) - { - super(parent, SWT.NONE); - this.generator = generator; - contentGenerators = new ArrayList(); - - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - setLayout(layout); - setLayoutData(createGridData(true, 1)); - - Composite labelValueComposite = new Composite(this, SWT.NONE); - labelValueComposite.setLayout(new GridLayout(2, false)); - labelValueComposite.setLayoutData(createGridData(false, 1)); - - // row 1 - // - Label componentNameLabel = new Label(labelValueComposite, SWT.NONE); - componentNameLabel.setText(getComponentNameLabelText()); //$NON-NLS-1$ - - componentNameField = new Text(labelValueComposite, SWT.BORDER); - GridData gdName= new GridData(); - gdName.horizontalAlignment= GridData.FILL; - gdName.grabExcessHorizontalSpace= true; - componentNameField.setLayoutData(gdName); - componentNameField.addModifyListener(this); - //createPlaceHolder(labelValueComposite); - - // row 2 - // - Label refNameLabel = new Label(labelValueComposite, SWT.NONE); - refNameLabel.setText(getRefNameLabelText()); //$NON-NLS-1$ - refNameCombo = new Combo(labelValueComposite, SWT.READ_ONLY); - GridData gdRefName= new GridData(); - gdRefName.horizontalAlignment= GridData.FILL; - gdRefName.grabExcessHorizontalSpace= true; - refNameCombo.setLayoutData(gdRefName); - refNameCombo.addSelectionListener(this); - - //refBrowseButton = new Button(labelValueComposite, SWT.NONE); - //refBrowseButton.setText(" ... "); - //GridData gd = new GridData(); - //gd.grabExcessHorizontalSpace = false; - //gd.heightHint = 17; - //gd.widthHint = 24; - //refBrowseButton.setLayoutData(gd); - //refBrowseButton.addSelectionListener(this); - //createPlaceHolder(labelValueComposite); - - // row 3 - // - Label protocolLabel = new Label(labelValueComposite, SWT.NONE); - protocolLabel.setText(Messages.getString("_UI_LABEL_BINDING_PROTOCOL")); //$NON-NLS-1$ - protocolCombo = new Combo(labelValueComposite, SWT.READ_ONLY); - GridData gdProtocol= new GridData(); - gdProtocol.horizontalAlignment= GridData.FILL; - gdProtocol.grabExcessHorizontalSpace= true; - protocolCombo.setLayoutData(gdProtocol); - protocolCombo.addSelectionListener(this); - //createPlaceHolder(labelValueComposite); - - // optional overwrite button - // - if (showOverwriteButton) - { - overwriteButton = new Button(this, SWT.CHECK); - overwriteButton.setText(Messages.getString("_UI_CHECKBOX_OVERWRITE")); //$NON-NLS-1$ - overwriteButton.addSelectionListener(this); - } - - // protocol specific settings - // - pageBook = new PageBook(this, SWT.NONE); - GridData gdFill= new GridData(); - gdFill.horizontalAlignment= GridData.FILL; - gdFill.grabExcessHorizontalSpace= true; - gdFill.verticalAlignment= GridData.FILL; - gdFill.grabExcessVerticalSpace= true; - pageBook.setLayoutData(gdFill); - - emptySettingsPage = new Composite(pageBook, SWT.NONE); - for (int i = 0; i < 6; i++) - { - new Label(emptySettingsPage, SWT.NONE); - } - } - - public void initFields() - { - // prime the fields - // - componentNameField.setText(getDefaultName()); - updateRefNameCombo(); - updateProtocolCombo(); - updatePageBook(generator.getProtocol()); - } - - public Text getComponentNameField() - { - return componentNameField; - } - - public String getComponentNameLabelText() - { - return Messages.getString("_UI_LABEL_NAME"); //$NON-NLS-1$ - } - - private GridData createGridData(boolean both, int span) - { - GridData gd = new GridData(both ? GridData.FILL_BOTH : GridData.FILL_HORIZONTAL); - gd.horizontalSpan = span; - return gd; - } - -// private Control createPlaceHolder(Composite parent) -// { -// Label label = new Label(parent, SWT.NONE); -// return label; -// } - public BaseGenerator getGenerator() - { - return generator; - } - - // implements SelectionListener - // - public void widgetDefaultSelected(SelectionEvent event) - { - } - - public void widgetSelected(SelectionEvent event) - { - if (event.widget == overwriteButton && overwriteButton != null) - { - getGenerator().setOverwrite(overwriteButton.getSelection()); - } - else if (event.widget == refNameCombo) - { - int index = refNameCombo.getSelectionIndex(); - String refName = refNameCombo.getItem(index); - if (refName.equals(UNSPECIFIED)) { - getGenerator().setRefName(""); //$NON-NLS-1$ - } - else { - getGenerator().setRefName(refName); - } - } - else if (event.widget == protocolCombo) - { - int index = protocolCombo.getSelectionIndex(); - String protocol = (index != -1) ? protocolCombo.getItem(index) : null; - getGenerator().setContentGenerator((ContentGenerator) contentGenerators.get(index)); - updatePageBook(protocol); - } - } - - private static final String IS_OVERWRITE_APPLICABLE = "IS_OVERWRITE_APPLICABLE"; //$NON-NLS-1$ - protected void updatePageBook(String protocol) - { - if (protocol != null) - { - ContentGeneratorOptionsPage page = (ContentGeneratorOptionsPage) pageMap.get(protocol); - if (page == null) - { - page = createContentGeneratorOptionsPage(protocol); - - if (page != null) - { - page.init(getGenerator()); - Control control = page.createControl(pageBook); - control.setData(IS_OVERWRITE_APPLICABLE, new Boolean(page.isOverwriteApplicable())); - pageMap.put(protocol, page); - } - -// if (page != null) -// { -// pageMap.put(protocol, page); -// } - } - - boolean enableOverwriteButton = true; - if (page != null) - { - if (overwriteButton != null) - { - Boolean data = (Boolean) page.getControl().getData(IS_OVERWRITE_APPLICABLE); - enableOverwriteButton = data == null || data.equals(Boolean.TRUE); - } - pageBook.showPage(page.getControl()); - pageBook.layout(); - pageBook.getParent().layout(); - - page.setOptionsOnGenerator(); - } - else - { - pageBook.showPage(emptySettingsPage); - } - - if (overwriteButton != null) - { - if (enableOverwriteButton) - { - overwriteButton.setEnabled(true); - overwriteButton.setSelection(generator.getOverwrite()); - } - else - { - overwriteButton.setEnabled(false); - overwriteButton.setSelection(true); - } - } - } - } - - protected void updateProtocolCombo() - { - protocolCombo.removeAll(); - - List list = new ArrayList(); - list.add(UNSPECIFIED); -// list.addAll(WSDLEditorPlugin.getInstance().getContentGeneratorExtensionRegistry().getBindingExtensionNames()); - list.addAll(ContentGeneratorExtensionFactoryRegistry.getInstance().getBindingExtensionNames()); - - String protocolText = generator.getProtocol(); - - for (Iterator i = list.iterator(); i.hasNext();) - { - String protocol = (String) i.next(); - protocolCombo.add(protocol); - - if (protocol.equals(UNSPECIFIED)) { - contentGenerators.add(null); - } - else { - ContentGenerator gen = ContentGeneratorExtensionFactoryRegistry.getInstance().getGeneratorClassFromName(protocol); - contentGenerators.add(gen); - } - } - - if (protocolText == null && protocolCombo.getItemCount() > 0) - { - protocolText = protocolCombo.getItem(0); -// generator.setProtocol(!UNSPECIFIED.equals(protocolText) ? protocolText : null); - } - protocolCombo.setText(protocolText); - - ContentGenerator gen = ContentGeneratorExtensionFactoryRegistry.getInstance().getGeneratorClassFromName(protocolText); - generator.setContentGenerator(gen); - } - - protected void updateRefNameCombo() - { - refNameCombo.removeAll(); - - refNameCombo.add(UNSPECIFIED); - for (Iterator i = getRefNames().iterator(); i.hasNext();) - { - refNameCombo.add((String) i.next()); - } - - if (refNameCombo.getItemCount() > 0) - { - String refText = generator.getRefName(); - refNameCombo.setText(refText != null ? refText : UNSPECIFIED); - } - } - - public void modifyText(ModifyEvent e) - { - generator.setName(componentNameField.getText()); - } - - public abstract List getRefNames(); - public abstract String getRefNameLabelText(); - public abstract String getDefaultName(); - public abstract ContentGeneratorOptionsPage createContentGeneratorOptionsPage(String protocol); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11BrowseComponentDialog.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11BrowseComponentDialog.java deleted file mode 100644 index b83e517fa..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11BrowseComponentDialog.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.dialogs; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.ScopedComponentSearchListDialog; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLBindingSearchListProvider; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLComponentDescriptionProvider; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLInterfaceSearchListProvider; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLMessageSearchListProvider; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11BrowseComponentDialog implements IComponentDialog { - private QualifiedName qualifiedName; - private ComponentSpecification selection; - private W11Description description; - - public W11BrowseComponentDialog(QualifiedName qualifiedName, IFile iFile, W11Description description) { - this.qualifiedName = qualifiedName; - this.description = description; - } - - public void setInitialSelection(ComponentSpecification componentSpecification) { - // TODO Auto-generated method stub - - } - - public ComponentSpecification getSelectedComponent() { - return selection; - } - - public int createAndOpen() { - Definition definition = (Definition) description.getTarget(); - - Shell shell = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell(); - int returnValue = Window.CANCEL; - ComponentSearchListDialog dialog = null; - if (qualifiedName == IWSDLSearchConstants.BINDING_META_NAME) - { - WSDLComponentDescriptionProvider descriptionProvider = new WSDLComponentDescriptionProvider(); - final WSDLBindingSearchListProvider searchListProvider = new WSDLBindingSearchListProvider(definition); - ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration(); - configuration.setFilterLabelText(Messages.getString("_UI_LABEL_NAME_FILTER")); - configuration.setDescriptionProvider(descriptionProvider); - configuration.setSearchListProvider(searchListProvider); - - String dialogTitle = Messages.getString("_UI_TITLE_SPECIFY_BINDING"); //$NON-NLS-1$ - dialog = new ScopedComponentSearchListDialog(shell, dialogTitle, configuration); - - IFile file = getFile(); - if (file != null) { - ((ScopedComponentSearchListDialog) dialog).setCurrentResource(file); - } - } - else if (qualifiedName == IWSDLSearchConstants.PORT_TYPE_META_NAME) - { - WSDLComponentDescriptionProvider descriptionProvider = new WSDLComponentDescriptionProvider(); - final WSDLInterfaceSearchListProvider searchListProvider = new WSDLInterfaceSearchListProvider(definition); - - ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration(); - configuration.setFilterLabelText(Messages.getString("_UI_LABEL_NAME_FILTER")); - configuration.setDescriptionProvider(descriptionProvider); - configuration.setSearchListProvider(searchListProvider); - //configuration.setNewComponentHandler(new NewTypeButtonHandler()); - - String dialogTitle = Messages.getString("_UI_TITLE_SPECIFY_PORTTYPE"); //$NON-NLS-1$ - dialog = new ScopedComponentSearchListDialog(shell, dialogTitle, configuration); - - IFile file = getFile(); - if (file != null) { - ((ScopedComponentSearchListDialog) dialog).setCurrentResource(file); - } - } - else if (qualifiedName == IWSDLSearchConstants.MESSAGE_META_NAME) - { - WSDLComponentDescriptionProvider descriptionProvider = new WSDLComponentDescriptionProvider(); - final WSDLMessageSearchListProvider searchListProvider = new WSDLMessageSearchListProvider(definition); - - ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration(); - configuration.setFilterLabelText(Messages.getString("_UI_LABEL_NAME_FILTER")); - configuration.setDescriptionProvider(descriptionProvider); - configuration.setSearchListProvider(searchListProvider); - //configuration.setNewComponentHandler(new NewTypeButtonHandler()); - - String dialogTitle = Messages.getString("_UI_TITLE_SPECIFY_MESSAGE"); //$NON-NLS-1$ - dialog = new ScopedComponentSearchListDialog(shell, dialogTitle, configuration); - - IFile file = getFile(); - if (file != null) { - ((ScopedComponentSearchListDialog) dialog).setCurrentResource(file); - } - } - - if (dialog != null) - { - dialog.setBlockOnOpen(true); - dialog.create(); - returnValue = dialog.open(); - if (returnValue == Window.OK) - { - selection = dialog.getSelectedComponent(); - } - } - return returnValue; - } - - private IFile getFile() { - IFile file = null; - IEditorInput input = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput) { - file = ((IFileEditorInput) input).getFile(); - } - - return file; - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11NewComponentDialog.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11NewComponentDialog.java deleted file mode 100644 index 844895ee0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/dialogs/W11NewComponentDialog.java +++ /dev/null @@ -1,127 +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.dialogs; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddInterfaceCommand; -import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLAdapterFactoryHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; -import org.eclipse.wst.xsd.ui.internal.dialogs.NewComponentDialog; - -public class W11NewComponentDialog implements IComponentDialog { - protected NewComponentDialog dialog; - protected QualifiedName qualifiedName; - protected IFile iFile; - protected W11Description description; - protected IASDObject newObject; - - public W11NewComponentDialog(QualifiedName qualifiedName, IFile iFile, W11Description description) { - this.qualifiedName = qualifiedName; - this.iFile = iFile; - this.description = description; - - Shell shell = Display.getCurrent().getActiveShell(); - if (qualifiedName == IWSDLSearchConstants.BINDING_META_NAME) { - String dialogTitle = Messages.getString("_UI_LABEL_NEW_BINDING"); //$NON-NLS-1$ - String baseName = NameUtil.buildUniqueBindingName(getDefinition(), "NewBinding"); //$NON-NLS-1$ - dialog = new NewComponentDialog(shell, dialogTitle, baseName); - } - else if (qualifiedName == IWSDLSearchConstants.PORT_TYPE_META_NAME) { - String dialogTitle = Messages.getString("_UI_LABEL_NEW_PORTTYPE"); //$NON-NLS-1$ - String baseName = NameUtil.buildUniquePortTypeName(getDefinition(), "NewPortType"); //$NON-NLS-1$ - dialog = new NewComponentDialog(shell, dialogTitle, baseName); - } - else if (qualifiedName == IWSDLSearchConstants.MESSAGE_META_NAME) { - String dialogTitle = Messages.getString("_UI_LABEL_NEW_MESSAGE"); //$NON-NLS-1$ - String baseName = NameUtil.buildUniqueMessageName(getDefinition(), "NewMessage"); //$NON-NLS-1$ - dialog = new NewComponentDialog(shell, dialogTitle, baseName); - } - - } - - private Definition getDefinition() { - return (Definition) description.getTarget(); - } - - public void setInitialSelection(ComponentSpecification componentSpecification) { - } - - public ComponentSpecification getSelectedComponent() { - String qualifier = getDefinition().getPrefix(getDefinition().getTargetNamespace()); - String name = dialog.getName(); - ComponentSpecification spec = new ComponentSpecification(qualifier, name, iFile); - spec.setObject(newObject); - return spec; - } - - public int createAndOpen() { - int rValue = dialog.createAndOpen(); - - if (rValue == Window.OK) { - // Create the new Object - if (qualifiedName == IWSDLSearchConstants.BINDING_META_NAME) { - W11AddBindingCommand command = (W11AddBindingCommand) description.getAddBindingCommand(); - command.setNewBindingName(dialog.getName()); - execute(command); - - Object newWSDLObject = command.getNewBinding(); - newObject = (IASDObject) WSDLAdapterFactoryHelper.getInstance().adapt((Notifier) newWSDLObject); - } - else if (qualifiedName == IWSDLSearchConstants.PORT_TYPE_META_NAME) { - W11AddInterfaceCommand command = (W11AddInterfaceCommand) description.getAddInterfaceCommand(); - command.setNewPortTypeName(dialog.getName()); - execute(command); - - Object newWSDLObject = command.getNewPortType(); - newObject = (IASDObject) WSDLAdapterFactoryHelper.getInstance().adapt((Notifier) newWSDLObject); - } - else if (qualifiedName == IWSDLSearchConstants.MESSAGE_META_NAME) { - W11AddMessageCommand command = (W11AddMessageCommand) description.getAddMessageCommand(); - command.setNewMessageName(dialog.getName()); - execute(command); - - Object newWSDLObject = command.getNewMessage(); - newObject = (IASDObject) WSDLAdapterFactoryHelper.getInstance().adapt((Notifier) newWSDLObject); - } - } - - return rValue; - } - - private void execute(Command command) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(CommandStack.class) != null) { - CommandStack stack = (CommandStack) page.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - else { - command.execute(); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11BindingReferenceEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11BindingReferenceEditManager.java deleted file mode 100644 index 16e72ee33..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11BindingReferenceEditManager.java +++ /dev/null @@ -1,110 +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.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11BrowseComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11NewComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLSetComponentHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11BindingReferenceEditManager implements ComponentReferenceEditManager { - protected W11Description description; - protected IFile iFile; - - public W11BindingReferenceEditManager(W11Description description, IFile iFile) { - this.description = description; - this.iFile = iFile; - } - - public IComponentDialog getBrowseDialog() { - return new W11BrowseComponentDialog(IWSDLSearchConstants.BINDING_META_NAME, iFile, description); - } - - public IComponentDialog getNewDialog() { - return new W11NewComponentDialog(IWSDLSearchConstants.BINDING_META_NAME, iFile, description); - } - - private Definition getDefinition() { - return (Definition) description.getTarget(); - } - - public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent) { - W11EndPoint w11EndPoint = (W11EndPoint) referencingObject; - Object bindingObject = referencedComponent.getObject(); - if (bindingObject == null) { - // Need to figure out the IBinding based on the information contained in the ComponentSpecification - - } - - if (bindingObject instanceof ComponentSpecification) { - Port port = (Port) w11EndPoint.getTarget(); - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(iFile, getDefinition()); - helper.setWSDLComponent(port, "binding", (ComponentSpecification) bindingObject); //$NON-NLS-1$ - } - else if (bindingObject instanceof IBinding){ - IBinding binding = (IBinding) bindingObject; - Command command = w11EndPoint.getSetBindingCommand(binding); - CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - } - - public IComponentDescriptionProvider getComponentDescriptionProvider() { - return null; - } - - public ComponentSpecification[] getQuickPicks() { - List specList = new ArrayList(); - - Iterator bindings = description.getBindings().iterator(); - while (bindings.hasNext()) { - IBinding binding = (IBinding) bindings.next(); - String qualifier = ""; //$NON-NLS-1$ - String name = binding.getName(); - IFile file = null; - - ComponentSpecification spec = new ComponentSpecification(qualifier, name, file); - spec.setObject(binding); - specList.add(spec); - } - - ComponentSpecification[] specArray = new ComponentSpecification[specList.size()]; - specList.toArray(specArray); - - return specArray; - } - - public ComponentSpecification[] getHistory() { - ComponentSpecification[] history = new ComponentSpecification[0]; - return history; - } - - public void addToHistory(ComponentSpecification component) { - - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11InterfaceReferenceEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11InterfaceReferenceEditManager.java deleted file mode 100644 index d4efef365..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11InterfaceReferenceEditManager.java +++ /dev/null @@ -1,112 +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.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CommandStack; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11BrowseComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11NewComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLSetComponentHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11InterfaceReferenceEditManager implements ComponentReferenceEditManager { - protected W11Description description; - protected IFile iFile; - - public W11InterfaceReferenceEditManager(W11Description description, IFile iFile) { - this.description = description; - this.iFile = iFile; - } - - public IComponentDialog getBrowseDialog() { - return new W11BrowseComponentDialog(IWSDLSearchConstants.PORT_TYPE_META_NAME, iFile, description); - } - - public IComponentDialog getNewDialog() { - return new W11NewComponentDialog(IWSDLSearchConstants.PORT_TYPE_META_NAME, iFile, description); - } - - private Definition getDefinition() { - return (Definition) description.getTarget(); - } - - public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent) { - W11Binding w11Binding = (W11Binding) referencingObject; - Object interfaceObject = referencedComponent.getObject(); - if (interfaceObject == null) { - // Need to figure out the IInterface based on the information contained in the ComponentSpecification - - } - - if (interfaceObject instanceof ComponentSpecification) { - Binding binding = (Binding) w11Binding.getTarget(); - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(iFile, getDefinition()); - helper.setWSDLComponent(binding, "type", (ComponentSpecification) interfaceObject); //$NON-NLS-1$ - } - else if (interfaceObject instanceof IInterface){ - IInterface interfaze = (IInterface) interfaceObject; - Command command = w11Binding.getSetInterfaceCommand(interfaze); - CommandStack stack = (CommandStack) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getAdapter(CommandStack.class); - stack.execute(command); - } - } - - public IComponentDescriptionProvider getComponentDescriptionProvider() { - - return null; - } - - public ComponentSpecification[] getQuickPicks() { - List specList = new ArrayList(); - - Iterator interfaces = description.getInterfaces().iterator(); - while (interfaces.hasNext()) { - IInterface interfaze = (IInterface) interfaces.next(); - String qualifier = ""; //$NON-NLS-1$ - String name = interfaze.getName(); - IFile file = null; - - ComponentSpecification spec = new ComponentSpecification(qualifier, name, file); - spec.setObject(interfaze); - specList.add(spec); - } - - ComponentSpecification[] specArray = new ComponentSpecification[specList.size()]; - specList.toArray(specArray); - - return specArray; - } - - public ComponentSpecification[] getHistory() { - ComponentSpecification[] history = new ComponentSpecification[0]; - return history; - } - - public void addToHistory(ComponentSpecification component) { - - - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11MessageReferenceEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11MessageReferenceEditManager.java deleted file mode 100644 index f1c4877e8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/W11MessageReferenceEditManager.java +++ /dev/null @@ -1,128 +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.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Message; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessage; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11BrowseComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.dialogs.W11NewComponentDialog; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLSetComponentHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11MessageReferenceEditManager implements ComponentReferenceEditManager { - protected W11Description description; - protected IFile iFile; - - public W11MessageReferenceEditManager(W11Description description, IFile iFile) { - this.description = description; - this.iFile = iFile; - } - - public IComponentDialog getBrowseDialog() { - return new W11BrowseComponentDialog(IWSDLSearchConstants.MESSAGE_META_NAME, iFile, description); - } - - public IComponentDialog getNewDialog() { - return new W11NewComponentDialog(IWSDLSearchConstants.MESSAGE_META_NAME, iFile, description); - } - - private Definition getDefinition() { - return (Definition) description.getTarget(); - } - - public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent) { - W11MessageReference w11MessageRef = (W11MessageReference) referencingObject; - Object messageObject = referencedComponent.getObject(); - if (messageObject == null) { - // Need to figure out the IMessage based on the information contained in the ComponentSpecification - - } - - if (messageObject instanceof ComponentSpecification) { - MessageReference messageRef= (MessageReference) w11MessageRef.getTarget(); - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(iFile, getDefinition()); - helper.setWSDLComponent(messageRef, "message", (ComponentSpecification) messageObject); //$NON-NLS-1$ - } - else if (messageObject instanceof W11Message){ - // Below is a little complex.... The alternative was to have IMessage contain a - // getSetMessageCommand() which would handle all of this but does a getSetMessageCommand() - // make sense at the generic level..... - W11Message iMessage = (W11Message) messageObject; - ComponentSpecification specObject = new ComponentSpecification(); - specObject.setName(iMessage.getName()); - specObject.setMetaName(IWSDLSearchConstants.MESSAGE_META_NAME); - specObject.setQualifier(description.getTargetNamespace()); - - String location = ((Definition) description.getTarget()).getLocation(); - String platformResource = "platform:/resource"; //$NON-NLS-1$ - if (location != null && location.startsWith(platformResource)) - { - Path path = new Path(location.substring(platformResource.length())); - specObject.setFile(ResourcesPlugin.getWorkspace().getRoot().getFile(path)); - } - - MessageReference messageRef= (MessageReference) w11MessageRef.getTarget(); - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(iFile, getDefinition()); - helper.setWSDLComponent(messageRef, "message", (ComponentSpecification) specObject); //$NON-NLS-1$ - } - } - - public IComponentDescriptionProvider getComponentDescriptionProvider() { - - return null; - } - - public ComponentSpecification[] getQuickPicks() { - List specList = new ArrayList(); - - Iterator messages = description.getMessages().iterator(); - while (messages.hasNext()) { - IMessage message = (IMessage) messages.next(); - String qualifier = ""; //$NON-NLS-1$ - String name = message.getName(); - IFile file = null; - - ComponentSpecification spec = new ComponentSpecification(qualifier, name, file); - spec.setObject(message); - specList.add(spec); - } - - ComponentSpecification[] specArray = new ComponentSpecification[specList.size()]; - specList.toArray(specArray); - - return specArray; - } - - public ComponentSpecification[] getHistory() { - - return null; - } - - public void addToHistory(ComponentSpecification component) { - - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBaseSearchListProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBaseSearchListProvider.java deleted file mode 100644 index ca043c694..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBaseSearchListProvider.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentSearchListProvider; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.internal.impl.ImportImpl; - -public abstract class WSDLBaseSearchListProvider implements IComponentSearchListProvider { - protected void createWSDLComponentObjects(IComponentList list, List inputComponents, QualifiedName metaName) { - Iterator it = inputComponents.iterator(); - while (it.hasNext()) { - WSDLElement wsdlElement = (WSDLElement) it.next(); - String name = wsdlElement.getElement().getAttribute("name"); //$NON-NLS-1$ - String qualifier = wsdlElement.getEnclosingDefinition().getTargetNamespace(); - - ComponentSpecification componentSpec = new ComponentSpecification(); - componentSpec.setMetaName(metaName); - componentSpec.setName(name); - componentSpec.setQualifier(qualifier); - - String location = wsdlElement.getEnclosingDefinition().getLocation(); - String platformResource = "platform:/resource"; //$NON-NLS-1$ - if (location != null && location.startsWith(platformResource)) { - Path path = new Path(location.substring(platformResource.length())); - IFile result = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - if (result != null) { - componentSpec.setFile(result); - } - } - - list.add(componentSpec); - } - } - - protected List getWSDLFileImports(List wsdlImports) { - List list = new ArrayList(); - Iterator it = wsdlImports.iterator(); - while (it.hasNext()) { - ImportImpl importItem = (ImportImpl) it.next(); - importItem.importDefinitionOrSchema(); // Load if necessary - if (importItem.getESchema() == null) { - list.add(importItem); - } - } - - return list; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBindingSearchListProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBindingSearchListProvider.java deleted file mode 100644 index 70499f994..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLBindingSearchListProvider.java +++ /dev/null @@ -1,52 +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.edit; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; - -public class WSDLBindingSearchListProvider extends WSDLBaseSearchListProvider { - private Definition definition; - - public WSDLBindingSearchListProvider(Definition definition) { - this.definition = definition; - } - - public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) { - // Grab explictly defined components - createWSDLComponentObjects(list, definition.getEBindings(), IWSDLSearchConstants.BINDING_META_NAME); - - // Grab directly imported components - Iterator importsIt = getWSDLFileImports(definition.getEImports()).iterator(); - while (importsIt.hasNext()) { - Import importItem = (Import) importsIt.next(); - Definition importDefinition = importItem.getEDefinition(); - List importedComponents = importDefinition.getEBindings(); - - createWSDLComponentObjects(list, importedComponents, IWSDLSearchConstants.BINDING_META_NAME); - } - - if (scope != null) { - WSDLComponentFinder finder = new WSDLComponentFinder(IWSDLSearchConstants.BINDING_META_NAME); - Iterator it = finder.getWorkbenchResourceComponents(scope).iterator(); - while (it.hasNext()) { - list.add(it.next()); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentDescriptionProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentDescriptionProvider.java deleted file mode 100644 index eb6424aa4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentDescriptionProvider.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.edit; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.common.core.search.SearchMatch; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentDescriptionProvider; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; - -public class WSDLComponentDescriptionProvider extends LabelProvider implements IComponentDescriptionProvider { - private static final Image BINDING_IMAGE = WSDLEditorPlugin.getInstance().getImage("icons/binding_obj.gif"); //$NON-NLS-1$ - private static final Image PORTTYPE_IMAGE = WSDLEditorPlugin.getInstance().getImage("icons/porttype_obj.gif"); //$NON-NLS-1$ - private static final Image MESSAGE_IMAGE = WSDLEditorPlugin.getInstance().getImage("icons/message_obj.gif"); //$NON-NLS-1$ - - public boolean isApplicable(Object component) { - return true; - } - - public String getQualifier(Object component) { - String result = null; - if (component instanceof ComponentSpecification) - { - result = ((ComponentSpecification)component).getQualifier(); - } - else if (component instanceof WSDLElement) - { - result = ((WSDLElement) component).getEnclosingDefinition().getTargetNamespace(); - } - else if (component instanceof SearchMatch) - { - QualifiedName qualifiedName = getQualifiedNameForSearchMatch((SearchMatch)component); - if (qualifiedName != null) - { - result = qualifiedName.getNamespace(); - } - } - return result; - } - - public String getName(Object component) { - String result = null; - if (component instanceof ComponentSpecification) - { - result = ((ComponentSpecification)component).getName(); - } - else if (component instanceof WSDLElement) - { - result = ((WSDLElement)component).getElement().getAttribute("name"); //$NON-NLS-1$ - } - else if (component instanceof SearchMatch) - { - QualifiedName qualifiedName = getQualifiedNameForSearchMatch((SearchMatch)component); - if (qualifiedName != null) - { - result = qualifiedName.getLocalName(); - } - } - return result; - } - - public Image getFileIcon(Object component) { - return WSDLEditorPlugin.getInstance().getImage("icons/wsdl_file_obj.gif"); //$NON-NLS-1$ - } - - public IFile getFile(Object component) { - IFile result = null; - if (component instanceof ComponentSpecification) - { - result = ((ComponentSpecification)component).getFile(); - } - else if (component instanceof SearchMatch) - { - result = ((SearchMatch)component).getFile(); - } - else if (component instanceof WSDLElement) - { - WSDLElement concreteComponent = (WSDLElement) component; - Definition definition = concreteComponent.getEnclosingDefinition(); - if (definition != null) - { - // TODO (cs) revisit and test more - // - String location = definition.getLocation(); - String platformResource = "platform:/resource"; //$NON-NLS-1$ - if (location != null && location.startsWith(platformResource)) - { - Path path = new Path(location.substring(platformResource.length())); - result = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - } - } - } - return result; - } - - public ILabelProvider getLabelProvider() { - return this; - } - - public String getText(Object element) { - String result = ""; //$NON-NLS-1$ - String name = getName(element); - if (name != null) { - result += name; - } - return result; - } - - public Image getImage(Object component) - { - Image result = null; - if (component instanceof ComponentSpecification) - { - QualifiedName qualifiedName = ((ComponentSpecification) component).getMetaName(); - if ( qualifiedName != null ){ - if ( qualifiedName.equals(IWSDLSearchConstants.BINDING_META_NAME)) - result = BINDING_IMAGE; - else if ( qualifiedName.equals(IWSDLSearchConstants.PORT_TYPE_META_NAME)) - result = PORTTYPE_IMAGE; - else if ( qualifiedName.equals(IWSDLSearchConstants.MESSAGE_META_NAME)) - result = MESSAGE_IMAGE; - - } - } - else if (component instanceof SearchMatch) - { - SearchMatch searchMatch = (SearchMatch)component; - QualifiedName qualifiedName = (QualifiedName)searchMatch.map.get("metaName"); //$NON-NLS-1$ - if ( qualifiedName != null ){ - if ( qualifiedName.equals(IWSDLSearchConstants.BINDING_META_NAME)) - result = BINDING_IMAGE; - else if ( qualifiedName.equals(IWSDLSearchConstants.PORT_TYPE_META_NAME)) - result = PORTTYPE_IMAGE; - else if ( qualifiedName.equals(IWSDLSearchConstants.MESSAGE_META_NAME)) - result = MESSAGE_IMAGE; - - } - } - else if (component instanceof Binding) - result = BINDING_IMAGE; - else if (component instanceof PortType) - result = PORTTYPE_IMAGE; - else if (component instanceof Message) - result = MESSAGE_IMAGE; - - return result; - } - - private QualifiedName getQualifiedNameForSearchMatch(SearchMatch match) { - QualifiedName qualifiedName = null; - Object o = match.map.get("name"); //$NON-NLS-1$ - if (o != null && o instanceof QualifiedName) - { - qualifiedName = (QualifiedName)o; - } - return qualifiedName; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentFinder.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentFinder.java deleted file mode 100644 index 9acb310fc..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLComponentFinder.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.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.wst.common.core.search.SearchEngine; -import org.eclipse.wst.common.core.search.SearchMatch; -import org.eclipse.wst.common.core.search.pattern.QualifiedName; -import org.eclipse.wst.common.core.search.pattern.SearchPattern; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.core.search.util.CollectingSearchRequestor; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.xml.core.internal.search.XMLComponentDeclarationPattern; - -public class WSDLComponentFinder { - QualifiedName metaName; - public WSDLComponentFinder(QualifiedName metaName) { - this.metaName = metaName; - } - - - protected void findComponents(SearchEngine searchEngine, List list, SearchScope searchScope) - { - try { - CollectingSearchRequestor requestor = new CollectingSearchRequestor(); - - XMLComponentDeclarationPattern pattern = new XMLComponentDeclarationPattern(new QualifiedName("*", "*"), metaName, SearchPattern.R_PATTERN_MATCH); //$NON-NLS-1$ //$NON-NLS-2$ - - // TODO (cs) rethink the commented out code below. Is there some reason for narrowing to list of search particpants? - // It seems the only benefit may be to filter our xsd component declarations that aren't defined - // in stand alone wsdl documents. Perhaps it's best to do this with an additional property arg on the - // declaration pattern or perhaps simply doing some 'post' filtering. - // - //String participantId = metaName.getNamespace().equals(WSDLConstants.WSDL_NAMESPACE_URI) ? - // "org.eclipse.wst.wsdl.search.WSDLSearchParticipant" : - // "org.eclipse.wst.xsd.search.XSDSearchParticipant"; - //SearchParticipant particpant = SearchPlugin.getDefault().getSearchParticipant(participantId); - //SearchParticipant[] participants = { particpant }; - - // TODO (cs) I'm betting we'll need to provide some hook here to allow extenders to configure - // the search options. Currently we just pass in null. - searchEngine.search(pattern, requestor, searchScope, null, new NullProgressMonitor()); - - for (Iterator i = requestor.getResults().iterator(); i.hasNext(); ) - { - SearchMatch match = (SearchMatch)i.next(); - ComponentSpecification spec = new ComponentSpecification(); - spec.setMetaName(metaName); - spec.setFile(match.getFile()); - - Object o = match.map.get("name"); //$NON-NLS-1$ - if (o != null && o instanceof QualifiedName) - { - QualifiedName qualifiedName = (QualifiedName)o; - if (qualifiedName.getLocalName() != null) - { - spec.setName(qualifiedName.getLocalName()); - spec.setQualifier(qualifiedName.getNamespace()); - list.add(spec); - } - } - } - } catch (CoreException e) { - e.printStackTrace(); - //status.add(e.getStatus()); - } - } - - public List getWorkbenchResourceComponents(SearchScope scope) { - - List list = new ArrayList(); - SearchEngine searchEngine = new SearchEngine(); - findComponents(searchEngine, list, scope); - return list; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLInterfaceSearchListProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLInterfaceSearchListProvider.java deleted file mode 100644 index 1412c0a6c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLInterfaceSearchListProvider.java +++ /dev/null @@ -1,52 +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.edit; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; - -public class WSDLInterfaceSearchListProvider extends WSDLBaseSearchListProvider { - private Definition definition; - - public WSDLInterfaceSearchListProvider(Definition definition) { - this.definition = definition; - } - - public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) { - // Grab explictly defined components - createWSDLComponentObjects(list, definition.getEPortTypes(), IWSDLSearchConstants.PORT_TYPE_META_NAME); - - // Grab directly imported components - Iterator importsIt = getWSDLFileImports(definition.getEImports()).iterator(); - while (importsIt.hasNext()) { - Import importItem = (Import) importsIt.next(); - Definition importDefinition = importItem.getEDefinition(); - List importedComponents = importDefinition.getEPortTypes(); - - createWSDLComponentObjects(list, importedComponents, IWSDLSearchConstants.PORT_TYPE_META_NAME); - } - - if (scope != null) { - WSDLComponentFinder finder = new WSDLComponentFinder(IWSDLSearchConstants.PORT_TYPE_META_NAME); - Iterator it = finder.getWorkbenchResourceComponents(scope).iterator(); - while (it.hasNext()) { - list.add(it.next()); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLMessageSearchListProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLMessageSearchListProvider.java deleted file mode 100644 index 0fa28554e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLMessageSearchListProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.edit; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.core.search.scope.SearchScope; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.ui.internal.search.IWSDLSearchConstants; - -public class WSDLMessageSearchListProvider extends WSDLBaseSearchListProvider { - private Definition definition; - - public WSDLMessageSearchListProvider(Definition definition) { - this.definition = definition; - } - public void populateComponentList(IComponentList list, SearchScope scope, IProgressMonitor pm) { - // Grab explictly defined components - createWSDLComponentObjects(list, definition.getEMessages(), IWSDLSearchConstants.MESSAGE_META_NAME); - - // Grab directly imported components - Iterator importsIt = getWSDLFileImports(definition.getEImports()).iterator(); - while (importsIt.hasNext()) { - Import importItem = (Import) importsIt.next(); - Definition importDefinition = importItem.getEDefinition(); - List importedComponents = importDefinition.getEMessages(); - - createWSDLComponentObjects(list, importedComponents, IWSDLSearchConstants.MESSAGE_META_NAME); - } - - if (scope != null) { - WSDLComponentFinder finder = new WSDLComponentFinder(IWSDLSearchConstants.MESSAGE_META_NAME); - Iterator it = finder.getWorkbenchResourceComponents(scope).iterator(); - while (it.hasNext()) { - list.add(it.next()); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDElementReferenceEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDElementReferenceEditManager.java deleted file mode 100644 index 272880b33..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDElementReferenceEditManager.java +++ /dev/null @@ -1,122 +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.edit; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.ui.internal.search.dialogs.IComponentList; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDElementDeclarationCommand; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLSetComponentHelper; -import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants; -import org.eclipse.xsd.XSDSchema; - -public class WSDLXSDElementReferenceEditManager extends XSDElementReferenceEditManager { - public WSDLXSDElementReferenceEditManager(IFile currentFile, XSDSchema[] schemas) { - super(currentFile, schemas); - } - - public WSDLXSDElementReferenceEditManager(IFile currentFile, XSDSchema[] schemas, IDescription description) { - super(currentFile, null); - if (schemas == null || schemas.length == 0) { - setSchemas(getInlineSchemas(description)); - } - } - - public void modifyComponentReference(Object referencingObject, ComponentSpecification component) { - if (referencingObject instanceof Adapter) { - Adapter adapter = (Adapter) referencingObject; - referencingObject = adapter.getTarget(); - } - - if (referencingObject instanceof Part) { - Part part = (Part) referencingObject; - IFile file = null; - if (ASDEditorPlugin.getActiveEditor().getEditorInput() instanceof IFileEditorInput) { - file = ((IFileEditorInput) ASDEditorPlugin.getActiveEditor().getEditorInput()).getFile(); - } - - if (component.isNew()) { - if (component.getMetaName() == IXSDSearchConstants.ELEMENT_META_NAME) { - AddXSDElementDeclarationCommand command = new AddXSDElementDeclarationCommand(part.getEnclosingDefinition(), component.getName()); - command.run(); - String tns = command.getXSDElement().getTargetNamespace(); - component.setQualifier(tns); - } - } - - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(file, part.getEnclosingDefinition()); - helper.setXSDElementComponent(part, component); - } - } - - public ComponentSpecification[] getQuickPicks() { -// ElementComponentList list = new ElementComponentList(); -// -// if (ASDEditorPlugin.getActiveEditor().getEditorInput() instanceof IFileEditorInput) { -// IFile file = ((IFileEditorInput) ASDEditorPlugin.getActiveEditor().getEditorInput()).getFile(); -// XSDElementsSearchListProvider provider = new XSDElementsSearchListProvider(file, schemas); -// provider.populateComponentList(list, null, null); -// } -// -// ComponentSpecification specs[] = new ComponentSpecification[list.size()]; -// for (int index = 0; index < list.size(); index++) { -// specs[index] = (ComponentSpecification) list.get(index); -// } - - return new ComponentSpecification[0]; - } - - public void setSchemas(XSDSchema[] schemas) { - this.schemas = schemas; - } - - private XSDSchema[] getInlineSchemas(IDescription description) { - List types = description.getTypes(); - XSDSchema[] schemas = new XSDSchema[types.size()]; - for (int index = 0; index < types.size(); index++) { - W11Type type = (W11Type) types.get(index); - schemas[index] = (XSDSchema) type.getTarget(); - } - - return schemas; - } - - private class ElementComponentList implements IComponentList { - private List list = new ArrayList(); - - public void add(Object object) { - list.add(object); - } - - public Iterator iterator() { - return list.iterator(); - } - - public int size() { - return list.size(); - } - - public Object get(int index) { - return list.get(index); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDTypeReferenceEditManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDTypeReferenceEditManager.java deleted file mode 100644 index 32e5fdd05..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/edit/WSDLXSDTypeReferenceEditManager.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.edit; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Type; -import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDTypeDefinitionCommand; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLSetComponentHelper; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.search.IXSDSearchConstants; -import org.eclipse.xsd.XSDAttributeUse; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; - -public class WSDLXSDTypeReferenceEditManager extends XSDTypeReferenceEditManager { - - public WSDLXSDTypeReferenceEditManager(IFile currentFile, XSDSchema[] schemas) { - super(currentFile, schemas); - } - - public WSDLXSDTypeReferenceEditManager(IFile currentFile, XSDSchema[] schemas, IDescription description) { - super(currentFile, null); - if (schemas == null || schemas.length == 0) { - setSchemas(getInlineSchemas(description)); - } - } - - public void modifyComponentReference(Object referencingObject, ComponentSpecification component) { - if (referencingObject instanceof Adapter) { - Adapter adapter = (Adapter) referencingObject; - referencingObject = adapter.getTarget(); - } - - if (referencingObject instanceof Part) { - Part part = (Part) referencingObject; - IFile file = null; - if (ASDEditorPlugin.getActiveEditor().getEditorInput() instanceof IFileEditorInput) { - file = ((IFileEditorInput) ASDEditorPlugin.getActiveEditor().getEditorInput()).getFile(); - } - - if (component.isNew()) { - AddXSDTypeDefinitionCommand command = new AddXSDTypeDefinitionCommand(part.getEnclosingDefinition(), component.getName()); - if (component.getMetaName() == IXSDSearchConstants.COMPLEX_TYPE_META_NAME) { - command.isComplexType(true); - } - else { - command.isComplexType(false); - } - command.run(); - String tns = command.getXSDElement().getTargetNamespace(); - component.setQualifier(tns); - } - - WSDLSetComponentHelper helper = new WSDLSetComponentHelper(file, part.getEnclosingDefinition()); - helper.setXSDTypeComponent(part, component); - } - else if (referencingObject instanceof XSDElementDeclaration) { - super.modifyComponentReference(referencingObject, component); - } - else if (referencingObject instanceof XSDAttributeUse) { - - } - } - - public void setSchemas(XSDSchema[] schemas) { - this.schemas = schemas; - } - - private XSDSchema[] getInlineSchemas(IDescription description) { - List types = description.getTypes(); - XSDSchema[] schemas = new XSDSchema[types.size()]; - for (int index = 0; index < types.size(); index++) { - W11Type type = (W11Type) types.get(index); - schemas[index] = (XSDSchema) type.getTarget(); - } - - return schemas; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibilityItemTreeProviderRegistry.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibilityItemTreeProviderRegistry.java deleted file mode 100644 index 29d180f79..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibilityItemTreeProviderRegistry.java +++ /dev/null @@ -1,33 +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.extensions; - -import org.eclipse.jface.viewers.ILabelProvider; - -/** - * This class reads the plugin manifests and registers each extensibility item tree provider - */ -public class ExtensibilityItemTreeProviderRegistry extends NSKeyedExtensionRegistry -{ - protected static final String LABEL_PROVIDER_PROPERTY = "labelProviderClass"; //$NON-NLS-1$ - protected static final String CONTENT_PROVIDER_PROPERTY = "contentProviderClass"; //$NON-NLS-1$ - protected static final String[] ATT_NAMES = { "labelProviderClass", "contentProviderClass" }; //$NON-NLS-1$ //$NON-NLS-2$ - - public ILabelProvider getLabelProvider(String namespace) - { - return (ILabelProvider) getProperty(namespace, LABEL_PROVIDER_PROPERTY); - } - - public ITreeChildProvider getContentProvider(String namespace) - { - return (ITreeChildProvider) getProperty(namespace, CONTENT_PROVIDER_PROPERTY); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibleTypeSystemProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibleTypeSystemProvider.java deleted file mode 100644 index 9d4cbdfeb..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ExtensibleTypeSystemProvider.java +++ /dev/null @@ -1,85 +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.extensions; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.util.XSDTypeSystemProvider; -import org.eclipse.xsd.XSDSchema; - -public class ExtensibleTypeSystemProvider implements ITypeSystemProvider -{ - protected WSDLEditorExtension[] extensions; - protected ITypeSystemProvider[] typeSystemProviders; - - protected final static Object[] EMPTY_ARRAY = {}; - - public ExtensibleTypeSystemProvider() - { - typeSystemProviders = new ITypeSystemProvider[1]; - typeSystemProviders[0] = new XSDTypeSystemProvider(); - } - - public List getAvailableTypeNames(Definition definition, int typeNameCategory) - { - List list = new ArrayList(); - for (int i = 0; i < typeSystemProviders.length; i++) - { - list.addAll(typeSystemProviders[i].getAvailableTypeNames(definition, typeNameCategory)); - } - return list; - } - - public List getAvailableTypes(Definition definition, XSDSchema schema, int typeNameCategory) - { - List list = new ArrayList(); - for (int i = 0; i < typeSystemProviders.length; i++) - { - list.addAll(typeSystemProviders[i].getAvailableTypes(definition, schema, typeNameCategory)); - } - return list; - } - - public List getAvailableElementNames(Definition definition) - { - List list = new ArrayList(); - for (int i = 0; i < typeSystemProviders.length; i++) - { - list.addAll(typeSystemProviders[i].getAvailableElementNames(definition)); - } - return list; - } - - public int getCategoryForTypeName(Definition definition, String typeName) - { - int result = UNKNOWN_TYPE; - for (int i = 0; i < typeSystemProviders.length; i++) - { - result = typeSystemProviders[i].getCategoryForTypeName(definition, typeName); - if (result != UNKNOWN_TYPE) - { - break; - } - } - return result; - } - - public List getPrefixedNames(Definition definition, String namespace, String localName) { - List list = new ArrayList(); - for (int i = 0; i < typeSystemProviders.length; i++) - { - list.addAll(typeSystemProviders[i].getPrefixedNames(definition, namespace, localName)); - } - return list; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeAssociationProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeAssociationProvider.java deleted file mode 100644 index 23f0ae011..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeAssociationProvider.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.extensions; - -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public interface INodeAssociationProvider -{ - public Object getModelObject(Object parentModelObject, Element[] elementChain, int start, int[] end); - public Node getNode(Object modelObject); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeReconciler.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeReconciler.java deleted file mode 100644 index 63b2547a3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/INodeReconciler.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.extensions; - -import org.w3c.dom.Element; - - -public interface INodeReconciler -{ - public void notifyChanged(Object modelObject, Element element, int eventType, Object feature, Object oldValue, Object newValue, int index); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITreeChildProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITreeChildProvider.java deleted file mode 100644 index 8ebf532b3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITreeChildProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.extensions; - -/** - * This class allows extension writers to provide specialize tree content behaviour. - * It is intended to behave similar to the org.eclipse.jface.viewers.ITreeContentProvider. - * The major difference is that this class is simplified so that only one method is involved. - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ -public interface ITreeChildProvider -{ - public Object[] getChildren(Object object); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITypeSystemProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITypeSystemProvider.java deleted file mode 100644 index ba148204a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/ITypeSystemProvider.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.extensions; - -import java.util.List; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.xsd.XSDSchema; - -public interface ITypeSystemProvider -{ - public static final int UNKNOWN_TYPE = 0x0; - public static final int BUILT_IN_TYPE = 0x1; - public static final int USER_DEFINED_SIMPLE_TYPE = 0x2; - public static final int USER_DEFINED_COMPLEX_TYPE = 0x4; - - public List getAvailableTypeNames(Definition definition, int typeNameCategory); - public List getAvailableElementNames(Definition definition); - public List getAvailableTypes(Definition definition, XSDSchema schema, int typeNameCategory); - public int getCategoryForTypeName(Definition definition, String typeName); - public List getPrefixedNames(Definition definition, String namespace, String localName); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/NSKeyedExtensionRegistry.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/NSKeyedExtensionRegistry.java deleted file mode 100644 index d0db78dad..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/NSKeyedExtensionRegistry.java +++ /dev/null @@ -1,142 +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.extensions; - -import java.util.HashMap; - -import org.osgi.framework.Bundle; - -public class NSKeyedExtensionRegistry -{ - protected HashMap map = new HashMap(); - private static final String PLUGIN_LOADING_ERROR = "PLUGIN_LOADING_ERROR"; //$NON-NLS-1$ - - public NSKeyedExtensionRegistry() - { - } - - public void put(String namespaceURI, String className, Bundle bundle) - { - ExtensionInfo info = (ExtensionInfo) map.get(namespaceURI); - if (info == null) - { - info = new SinglePropertyExtensionInfo(className, bundle); - map.put(namespaceURI, info); - } - } - - public void put(String namespaceURI, HashMap propertyToClassNameMap, Bundle bundle) - { - ExtensionInfo info = (ExtensionInfo) map.get(namespaceURI); - if (info == null) - { - info = new MultiPropertyExtensionInfo(propertyToClassNameMap, bundle); - map.put(namespaceURI, info); - } - } - - /** - * - * @deprecated - */ - public Object get(String namespaceURI) - { - ExtensionInfo info = (ExtensionInfo) map.get(namespaceURI); - return info != null ? info.getObject("") : null; //$NON-NLS-1$ - } - - public Object getProperty(String namespaceURI, String property) - { - ExtensionInfo info = (ExtensionInfo) map.get(namespaceURI); - return info != null ? info.getObject(property) : null; - } - - private abstract class ExtensionInfo - { - protected Bundle bundle; - - public ExtensionInfo(Bundle bundle) - { - this.bundle = bundle; - } - - public abstract Object getObject(String property); - } - - private class SinglePropertyExtensionInfo extends ExtensionInfo - { - protected String className; - protected Object object; - protected boolean error; - - public SinglePropertyExtensionInfo(String className, Bundle bundle) - { - super(bundle); - this.className = className; - } - - public Object getObject(String property) - { - if (object == null) - { - try - { - Class theClass = bundle.loadClass(className); - object = theClass.newInstance(); - } - catch (Exception e) - { - object = PLUGIN_LOADING_ERROR; - e.printStackTrace(); - } - } - return object != PLUGIN_LOADING_ERROR ? object : null; - } - } - - private class MultiPropertyExtensionInfo extends ExtensionInfo - { - protected HashMap propertyToClassNameTable; - protected HashMap propertyToObjectTable = new HashMap(); - - public MultiPropertyExtensionInfo(HashMap propertToClassNameTable, Bundle bundle) - { - super(bundle); - this.propertyToClassNameTable = propertToClassNameTable; - } - - public Object getObject(String property) - { - Object result = null; - String className = (String) propertyToClassNameTable.get(property); - if (className != null) - { - result = propertyToObjectTable.get(property); - if (result == null) - { - try - { - Class theClass = bundle.loadClass(className); - result = theClass.newInstance(); - propertyToObjectTable.put(property, result); - } - catch (Exception e) - { - propertyToObjectTable.put(property, PLUGIN_LOADING_ERROR); - result = PLUGIN_LOADING_ERROR; - e.printStackTrace(); - } - } - } - return result != PLUGIN_LOADING_ERROR ? result : null; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorConfiguration.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorConfiguration.java deleted file mode 100644 index 666d34037..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorConfiguration.java +++ /dev/null @@ -1,185 +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.extensions; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.gef.EditPartFactory; -import org.eclipse.wst.wsdl.ui.internal.actions.IWSDLToolbarAction; - -public class WSDLEditorConfiguration { - public static final String WSDLEDITORCONFIGURATIONEXTENSIONID = "org.eclipse.wst.wsdl.ui.WSDLEditorExtensionConfiguration"; //$NON-NLS-1$ - public static final String CLASSNAME = "class"; //$NON-NLS-1$ - public static final String ADAPTERFACTORY = "adapterFactory"; //$NON-NLS-1$ - public static final String TOOLBARACTION = "toolbarAction"; //$NON-NLS-1$ - public static final String FIGUREFACTORY = "figureFactory"; //$NON-NLS-1$ - public static final String EDITPARTFACTORY = "editPartFactory"; //$NON-NLS-1$ - - List definedExtensionsList = null; - - public WSDLEditorConfiguration() - { - - } - - public AdapterFactory getAdapterFactory() - { - if (definedExtensionsList == null) - { - readWSDLConfigurationRegistry(); - } - if (!definedExtensionsList.isEmpty()) - { - return ((WSDLEditorExtensionProperties) definedExtensionsList.get(0)).getAdapterFactory(); - } - return null; - } - - public EditPartFactory getEditPartFactory() - { - if (definedExtensionsList == null) - { - readWSDLConfigurationRegistry(); - } - if (!definedExtensionsList.isEmpty()) - { - return ((WSDLEditorExtensionProperties) definedExtensionsList.get(0)).getEditPartFactory(); - } - return null; - } - -// public IExtendedFigureFactory getFigureFactory() -// { -// if (definedExtensionsList == null) -// { -// readWSDLConfigurationRegistry(); -// } -// if (!definedExtensionsList.isEmpty()) -// { -// return ((WSDLEditorExtensionProperties) definedExtensionsList.get(0)).getFigureFactory(); -// } -// return null; -// } - - public List getToolbarActions() - { - if (definedExtensionsList == null) - { - readWSDLConfigurationRegistry(); - } - if (!definedExtensionsList.isEmpty()) - { - return ((WSDLEditorExtensionProperties) definedExtensionsList.get(0)).getActionList(); - } - return Collections.EMPTY_LIST; - } - - protected Object loadClass(IConfigurationElement element, String classString) - { - String pluginId = element.getDeclaringExtension().getContributor().getName(); - - try - { - Class theClass = Platform.getBundle(pluginId).loadClass(classString); - Object instance = theClass.newInstance(); - - return instance; - } - catch (Exception e) - { - - } - return null; - } - - public void readWSDLConfigurationRegistry() - { - IConfigurationElement[] wsdlEditorExtensionList = Platform.getExtensionRegistry().getConfigurationElementsFor(WSDLEDITORCONFIGURATIONEXTENSIONID); - - boolean definedExtensionsExist = (wsdlEditorExtensionList != null && wsdlEditorExtensionList.length > 0); - - definedExtensionsList = new ArrayList(); - - if (definedExtensionsExist) - { - for (int i = 0; i < wsdlEditorExtensionList.length; i++) - { - WSDLEditorExtensionProperties properties = new WSDLEditorExtensionProperties(); - definedExtensionsList.add(properties); - - IConfigurationElement element = wsdlEditorExtensionList[i]; - String adapterFactoryClass = element.getAttribute(ADAPTERFACTORY); - if (adapterFactoryClass != null) - { - Object object = loadClass(element, adapterFactoryClass); - if (object instanceof AdapterFactory) - { - properties.setAdapterFactory((AdapterFactory) object); - } - } - -// String figureFactoryClass = element.getAttribute(FIGUREFACTORY); -// if (figureFactoryClass != null) -// { -// Object object = loadClass(element, figureFactoryClass); -// IExtendedFigureFactory figureFactory = null; -// if (object instanceof IExtendedFigureFactory) -// { -// figureFactory = (IExtendedFigureFactory) object; -// properties.setFigureFactoryList(figureFactory); -// } -// } - - String editPartFactoryClass = element.getAttribute(EDITPARTFACTORY); - if (editPartFactoryClass != null) - { - Object object = loadClass(element, editPartFactoryClass); - EditPartFactory editPartFactory = null; - if (object instanceof EditPartFactory) - { - editPartFactory = (EditPartFactory) object; - properties.setEditPartFactoryList(editPartFactory); - } - } - - IConfigurationElement[] toolbarActions = element.getChildren(TOOLBARACTION); - List actionList = new ArrayList(); - if (toolbarActions != null) - { - for (int j = 0; j < toolbarActions.length; j++) - { - IConfigurationElement actionElement = toolbarActions[j]; - String actionClass = actionElement.getAttribute(CLASSNAME); - IWSDLToolbarAction action = null; - if (actionClass != null) - { - Object object = loadClass(actionElement, actionClass); - if (object instanceof IWSDLToolbarAction) - { - action = (IWSDLToolbarAction) object; - actionList.add(action); - } - } - } - } - properties.setActionList(actionList); - - - - } - } - } - } diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtension.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtension.java deleted file mode 100644 index 40bc944ef..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtension.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.extensions; - -import org.eclipse.ui.IEditorPart; - -public interface WSDLEditorExtension -{ - public static final int OUTLINE_TREE_CONTENT_PROVIDER = 1; // req'd for model based ext - public static final int OUTLINE_LABEL_PROVIDER = 2; // req'd for model based ext - - public static final int MENU_ACTION_CONTRIBUTOR = 3; // node - public static final int DETAILS_VIEWER_PROVIDER = 4; // node - - public static final int EDIT_PART_FACTORY = 5; // req'd for model based ext - public static final int TYPE_SYSTEM_PROVIDER = 6; // req'd for type system ext - public static final int NODE_RECONCILER = 7; // req'd for model based ext - public static final int NODE_ASSOCIATION_PROVIDER = 8; // req'd for model based ext - public static final int MODEL_QUERY_CONTRIBUTOR = 9; // req'd for model based ext - - public static final int PROPERTY_SOURCE_PROVIDER = 10; // req'd for model based ext - public static final int PROPERTY_SECTION_DESCRIPTOR_PROVIDER = 11; // req'd for model based ext - public static final int XSD_DELETE_ACTION = 12; - - boolean isExtensionTypeSupported(int type); - boolean isApplicable(Object modelObject); - Object createExtensionObject(int type, IEditorPart editor); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtensionProperties.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtensionProperties.java deleted file mode 100644 index 9d8459a83..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLEditorExtensionProperties.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.extensions; - -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.gef.EditPartFactory; - -public class WSDLEditorExtensionProperties -{ - AdapterFactory adapterFactory; -// IExtendedFigureFactory figureFactory; - EditPartFactory editPartFactory; - List actionList; - - public WSDLEditorExtensionProperties() - { - - } - - public void setActionList(List actionList) - { - this.actionList = actionList; - } - - public void setAdapterFactory(AdapterFactory adapterFactory) - { - this.adapterFactory = adapterFactory; - } - - public void setEditPartFactoryList(EditPartFactory editPartFactory) - { - this.editPartFactory = editPartFactory; - } - -// public void setFigureFactoryList(IExtendedFigureFactory figureFactory) -// { -// this.figureFactory = figureFactory; -// } - - public List getActionList() - { - return actionList; - } - - public AdapterFactory getAdapterFactory() - { - return adapterFactory; - } - - public EditPartFactory getEditPartFactory() - { - return editPartFactory; - } - -// public IExtendedFigureFactory getFigureFactory() -// { -// return figureFactory; -// } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLNodeAssociationProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLNodeAssociationProvider.java deleted file mode 100644 index d567e8bb9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/extensions/WSDLNodeAssociationProvider.java +++ /dev/null @@ -1,80 +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.extensions; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.xsd.impl.XSDComponentImpl; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class WSDLNodeAssociationProvider implements INodeAssociationProvider -{ - public Object getModelObject(Object parentModelObject, Element[] elementChain, int start, int[] end) - { - Object currentObject = parentModelObject; - for (int i = start; i < elementChain.length; i++) - { - Object o = getModelObjectHelper(currentObject, elementChain[i]); - if (o == null) - { - end[0] = i; - break; - } - else - { - currentObject = o; - } - } - return currentObject != parentModelObject ? currentObject : null; - } - - public Node getNode(Object modelObject) - { - if (modelObject instanceof WSDLElement) - return ((WSDLElementImpl)modelObject).getElement(); - else - return null; - } - - protected Object getModelObjectHelper(Object parentObject, Element elementNode) - { - Object result = null; - Collection childComponentList = ((WSDLElementImpl) parentObject).getWSDLContents(); - for (Iterator i = childComponentList.iterator(); i.hasNext();) - { - Object o = i.next(); - Element element = null; - - if (o != null) - { - if (o instanceof WSDLElementImpl) - { - element = ((WSDLElementImpl)o).getElement(); - } - else if (o instanceof XSDComponentImpl) - { - element = ((XSDComponentImpl)o).getElement(); - } - } - - if (element == elementNode) - { - result = o; - break; - } - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/ExtensiblityElementFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/ExtensiblityElementFilter.java deleted file mode 100644 index 81314773d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/ExtensiblityElementFilter.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.filter; - -import org.w3c.dom.Element; - -public interface ExtensiblityElementFilter -{ - public boolean isValidContext(Element parentElement, String localName); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/HttpExtensiblityElementFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/HttpExtensiblityElementFilter.java deleted file mode 100644 index 25142df9b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/HttpExtensiblityElementFilter.java +++ /dev/null @@ -1,52 +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.filter; - -import org.w3c.dom.Element; - - -public class HttpExtensiblityElementFilter implements ExtensiblityElementFilter -{ - public HttpExtensiblityElementFilter() - { - } - - public boolean isValidContext(Element parentElement, String localName) - { - boolean result = false; - - String parentElementName = parentElement.getLocalName(); - if (parentElementName.equals("binding")) //$NON-NLS-1$ - { - result = localName.equals("binding"); //$NON-NLS-1$ - } - else if (parentElementName.equals("operation")) //$NON-NLS-1$ - { - result = localName.equals("operation"); //$NON-NLS-1$ - } - else if (parentElementName.equals("input") || //$NON-NLS-1$ - parentElementName.equals("output")) //$NON-NLS-1$ - { - result = localName.equals("body") || //$NON-NLS-1$ - localName.equals("header"); //$NON-NLS-1$ - } - else if (parentElementName.equals("fault")) //$NON-NLS-1$ - { - result = localName.equals("fault"); //$NON-NLS-1$ - } - else if (parentElementName.equals("port")) //$NON-NLS-1$ - { - result = localName.equals("address"); //$NON-NLS-1$ - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/MimeExtensiblityElementFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/MimeExtensiblityElementFilter.java deleted file mode 100644 index 389e01123..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/MimeExtensiblityElementFilter.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.filter; - -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.w3c.dom.Element; - - -public class MimeExtensiblityElementFilter implements ExtensiblityElementFilter -{ - private static final String MIME_NAMESPACE_URI="http://schemas.xmlsoap.org/wsdl/mime/"; //$NON-NLS-1$ - public MimeExtensiblityElementFilter() - { - } - - public boolean isValidContext(Element parentElement, String localName) - { - boolean result = false; - - String parentElementName = parentElement.getLocalName(); - String parentElementNamespace = parentElement.getNamespaceURI(); - - if (WSDLConstants.WSDL_NAMESPACE_URI.equals(parentElementNamespace)) - { - if (parentElementName.equals("input") || parentElementName.equals("output")) //$NON-NLS-1$ //$NON-NLS-2$ - { - result = localName.equals("content") || //$NON-NLS-1$ - localName.equals("multipartRelated") || //$NON-NLS-1$ - localName.equals("mimeXml"); //$NON-NLS-1$ - } - } - else if (MIME_NAMESPACE_URI.equals(parentElementNamespace)) - { - result = true; - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/SoapExtensiblityElementFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/SoapExtensiblityElementFilter.java deleted file mode 100644 index 3500d0808..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/SoapExtensiblityElementFilter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.filter; - -import org.w3c.dom.Element; - -public class SoapExtensiblityElementFilter implements ExtensiblityElementFilter -{ - public SoapExtensiblityElementFilter() - { - } - - public boolean isValidContext(Element parentElement, String localName) - { - boolean result = false; - - String parentElementName = parentElement.getLocalName(); - if (parentElementName.equals("binding")) //$NON-NLS-1$ - { - result = localName.equals("binding"); //$NON-NLS-1$ - } - else if (parentElementName.equals("operation")) //$NON-NLS-1$ - { - result = localName.equals("operation"); //$NON-NLS-1$ - } - else if (parentElementName.equals("input") || //$NON-NLS-1$ - parentElementName.equals("output")) //$NON-NLS-1$ - { - result = localName.equals("body") || //$NON-NLS-1$ - localName.equals("header"); //$NON-NLS-1$ - } - else if (parentElementName.equals("fault")) //$NON-NLS-1$ - { - result = localName.equals("fault"); //$NON-NLS-1$ - } - else if (parentElementName.equals("port")) //$NON-NLS-1$ - { - result = localName.equals("address"); //$NON-NLS-1$ - } - - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/XSDExtensiblityElementFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/XSDExtensiblityElementFilter.java deleted file mode 100644 index acdab76b3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/filter/XSDExtensiblityElementFilter.java +++ /dev/null @@ -1,31 +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.filter; - -import org.w3c.dom.Element; - -public class XSDExtensiblityElementFilter implements ExtensiblityElementFilter -{ - public XSDExtensiblityElementFilter() - { - } - - public boolean isValidContext(Element parentElement, String localName) - { - boolean result = false; - String parentElementName = parentElement.getLocalName(); - if (parentElementName.equals("types")) //$NON-NLS-1$ - { - result = localName.equals("schema"); //$NON-NLS-1$ - } - return result; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/back.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/back.gif Binary files differdeleted file mode 100644 index 24d1a279e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/back.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/binding_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/binding_obj.gif Binary files differdeleted file mode 100644 index 896e2f055..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/binding_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/bindingheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/bindingheader_obj.gif Binary files differdeleted file mode 100644 index 1ffe54e33..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/bindingheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/browsebutton.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/browsebutton.gif Binary files differdeleted file mode 100644 index e2402f88f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/browsebutton.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/complextype_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/complextype_obj.gif Binary files differdeleted file mode 100644 index 007f8522a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/complextype_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/delete_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/delete_obj.gif Binary files differdeleted file mode 100644 index b6922ac11..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/delete_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/element_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/element_obj.gif Binary files differdeleted file mode 100644 index dd45f08fb..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/element_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/error_co.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/error_co.gif Binary files differdeleted file mode 100644 index 119dcccd5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/error_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fault_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fault_obj.gif Binary files differdeleted file mode 100644 index f228117f2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fault_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/file_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/file_obj.gif Binary files differdeleted file mode 100644 index efa7a3801..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/file_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fldr_el.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fldr_el.gif Binary files differdeleted file mode 100644 index 801c13388..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/fldr_el.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/forward.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/forward.gif Binary files differdeleted file mode 100644 index eab699e38..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/forward.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/hidebinding.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/hidebinding.gif Binary files differdeleted file mode 100644 index c846cd8d8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/hidebinding.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpaddress_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpaddress_obj.gif Binary files differdeleted file mode 100644 index fb20c389d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpaddress_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpbinding_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpbinding_obj.gif Binary files differdeleted file mode 100644 index 4428ef395..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpbinding_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpoperation_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpoperation_obj.gif Binary files differdeleted file mode 100644 index 1c404181d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpoperation_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlencoded_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlencoded_obj.gif Binary files differdeleted file mode 100644 index ed5050f22..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlencoded_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlreplacement_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlreplacement_obj.gif Binary files differdeleted file mode 100644 index 273587ea9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/httpurlreplacement_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/import_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/import_obj.gif Binary files differdeleted file mode 100644 index b7275aa56..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/import_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/importheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/importheader_obj.gif Binary files differdeleted file mode 100644 index 6000cb80f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/importheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/input_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/input_obj.gif Binary files differdeleted file mode 100644 index fe6b34989..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/input_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/message_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/message_obj.gif Binary files differdeleted file mode 100644 index 2dce48373..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/message_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/messageheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/messageheader_obj.gif Binary files differdeleted file mode 100644 index 02a711cee..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/messageheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespace_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespace_obj.gif Binary files differdeleted file mode 100644 index 7e3f274d0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespace_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespacedecl_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespacedecl_obj.gif Binary files differdeleted file mode 100644 index 2b79d2749..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/namespacedecl_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/new_wsdl_wiz.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/new_wsdl_wiz.gif Binary files differdeleted file mode 100644 index d1087b9b1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/new_wsdl_wiz.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operation_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operation_obj.gif Binary files differdeleted file mode 100644 index 5818a3088..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operation_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operationbinding_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operationbinding_obj.gif Binary files differdeleted file mode 100644 index ae386c636..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/operationbinding_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_no.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_no.gif Binary files differdeleted file mode 100644 index f6b9f8a59..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_no.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_obj.gif Binary files differdeleted file mode 100644 index bd0918ce1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_yes.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_yes.gif Binary files differdeleted file mode 100644 index 9cacb96dc..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/output_yes.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/page_banner.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/page_banner.gif Binary files differdeleted file mode 100644 index aebc0b2a3..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/page_banner.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/part_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/part_obj.gif Binary files differdeleted file mode 100644 index 5219dfa87..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/part_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/port_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/port_obj.gif Binary files differdeleted file mode 100644 index 379498b0a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/port_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttype_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttype_obj.gif Binary files differdeleted file mode 100644 index 21325ca77..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttype_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttypeheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttypeheader_obj.gif Binary files differdeleted file mode 100644 index 9afcc01e1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/porttypeheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtcmplxpltyp_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtcmplxpltyp_obj.gif Binary files differdeleted file mode 100644 index db866437f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtcmplxpltyp_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtelemt_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtelemt_obj.gif Binary files differdeleted file mode 100644 index 782d108fe..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtelemt_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtsmpltyp_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtsmpltyp_obj.gif Binary files differdeleted file mode 100644 index 8ffc7c57b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/prtsmpltyp_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/service_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/service_obj.gif Binary files differdeleted file mode 100644 index 5216b3f2d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/service_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/serviceheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/serviceheader_obj.gif Binary files differdeleted file mode 100644 index 8b4814cb8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/serviceheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/simpletype_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/simpletype_obj.gif Binary files differdeleted file mode 100644 index e45dbb1d8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/simpletype_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soap_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soap_obj.gif Binary files differdeleted file mode 100644 index fd426ed2d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soap_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapaddress_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapaddress_obj.gif Binary files differdeleted file mode 100644 index 4880ba795..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapaddress_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapatt_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapatt_obj.gif Binary files differdeleted file mode 100644 index d0b366181..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapatt_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbinding_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbinding_obj.gif Binary files differdeleted file mode 100644 index 115f6bf2b..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbinding_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbody_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbody_obj.gif Binary files differdeleted file mode 100644 index b2d01aad0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapbody_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapfault_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapfault_obj.gif Binary files differdeleted file mode 100644 index 856b1f7d4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapfault_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheader_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheader_obj.gif Binary files differdeleted file mode 100644 index f72ea3b20..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheader_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheaderfault_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheaderfault_obj.gif Binary files differdeleted file mode 100644 index 2f0e1906f..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapheaderfault_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapoperation_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapoperation_obj.gif Binary files differdeleted file mode 100644 index bcc191469..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/soapoperation_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/types_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/types_obj.gif Binary files differdeleted file mode 100644 index d1f6f889d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/types_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/validate.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/validate.gif Binary files differdeleted file mode 100644 index 2b347ac45..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/validate.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/wsdl_file_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/wsdl_file_obj.gif Binary files differdeleted file mode 100644 index 75b1f92b4..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/wsdl_file_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_file_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_file_obj.gif Binary files differdeleted file mode 100644 index 13dcfceaf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_file_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_obj.gif b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_obj.gif Binary files differdeleted file mode 100644 index 13dcfceaf..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/icons/xsd_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/HTTPLabelProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/HTTPLabelProvider.java deleted file mode 100644 index fb8defd1d..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/HTTPLabelProvider.java +++ /dev/null @@ -1,52 +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.label.providers; - -import java.util.HashMap; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.w3c.dom.Node; - - -public class HTTPLabelProvider extends LabelProvider -{ - protected final static String ADDRESS = "address"; //$NON-NLS-1$ - protected final static String BINDING = "binding"; //$NON-NLS-1$ - protected final static String OPERATION = "operation"; //$NON-NLS-1$ - protected final static String URL_ENCODED = "urlEncoded"; //$NON-NLS-1$ - protected final static String URL_REPLACEMENT = "urlReplacement"; //$NON-NLS-1$ - - protected HashMap map = new HashMap(); - - public HTTPLabelProvider() - { - map.put(ADDRESS, "icons/httpaddress_obj.gif"); //$NON-NLS-1$ - map.put(BINDING, "icons/httpbinding_obj.gif"); //$NON-NLS-1$ - map.put(OPERATION, "icons/httpoperation_obj.gif"); //$NON-NLS-1$ - map.put(URL_ENCODED, "icons/httpurlencoded_obj.gif"); //$NON-NLS-1$ - map.put(URL_REPLACEMENT, "icons/httpurlreplacement_obj.gif"); //$NON-NLS-1$ - } - - public Image getImage(Object object) - { - Node node = (Node)object; - String imageName = (String)map.get(node.getLocalName()); - return imageName != null ? WSDLEditorPlugin.getInstance().getImage(imageName) : null; - } - - public String getText(Object object) - { - Node node = (Node)object; - return node.getNodeName(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/SOAPLabelProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/SOAPLabelProvider.java deleted file mode 100644 index dd60eef0e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/label/providers/SOAPLabelProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.label.providers; - -import java.util.HashMap; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.w3c.dom.Node; - - -public class SOAPLabelProvider extends LabelProvider -{ - protected final static String ADDRESS = "address"; //$NON-NLS-1$ - protected final static String BODY = "body"; //$NON-NLS-1$ - protected final static String BINDING = "binding"; //$NON-NLS-1$ - protected final static String FAULT = "fault"; //$NON-NLS-1$ - protected final static String HEADER = "header"; //$NON-NLS-1$ - protected final static String HEADER_FAULT = "headerfault"; //$NON-NLS-1$ - protected final static String OPERATION = "operation"; //$NON-NLS-1$ - - protected HashMap map = new HashMap(); - - public SOAPLabelProvider() - { - map.put(ADDRESS, "icons/soapaddress_obj.gif"); //$NON-NLS-1$ - map.put(BINDING, "icons/soapbinding_obj.gif"); //$NON-NLS-1$ - map.put(BODY, "icons/soapbody_obj.gif"); //$NON-NLS-1$ - map.put(FAULT, "icons/soapfault_obj.gif"); //$NON-NLS-1$ - map.put(HEADER, "icons/soapheader_obj.gif"); //$NON-NLS-1$ - map.put(HEADER_FAULT, "icons/soapheaderfault_obj.gif"); //$NON-NLS-1$ - map.put(OPERATION, "icons/soapoperation_obj.gif"); //$NON-NLS-1$ - } - - public Image getImage(Object object) - { - Node node = (Node)object; - String imageName = (String)map.get(node.getLocalName()); - return imageName != null ? WSDLEditorPlugin.getInstance().getImage(imageName) : null; - } - - public String getText(Object object) - { - Node node = (Node)object; - return node.getNodeName(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties deleted file mode 100644 index eaef35881..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/messages.properties +++ /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 -############################################################################### -_UI_DEPENDENCIES_CHANGED=Dependencies Changed -_UI_DEPENDENCIES_CHANGED_REFRESH=One or more dependencies have changed. Do you want to refresh the editor to reflect these changes? -_UI_EDIT_NAMESPACES_DIALOG_TITLE=Edit Namespaces -_UI_PREF_PAGE_CREATING_FILES=Creating files -_UI_REMEMBER_MY_DECISION_LABEL=Remember my decision -_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE=Default Target Namespace: -_UI_REGEN_BINDINGS_ON_SAVE_QUESTIONMARK=Regenerate Bindings On Save? -_UI_LABEL_WARNING_DUPLICATE_NAME_EXISTS=Warning: duplicate name already exists -_UI_LABEL_NAMESPACE_URIS_TO_BE_INCLUDED=Namespace URIs to be included -_UI_PREF_PAGE_AUTO_REGENERATE_BINDING=Regenerate Binding on save -_UI_PREF_PAGE_PROMPT_REGEN_BINDING_ON_SAVE=Prompt Regenerate Binding on save -_UI_EDIT_NAMESPACES=Edit Namespaces... -_UI_ACTION_ADD_IMPORT=Add Import -_UI_ACTION_ADD_BINDING=Add Binding -_UI_ACTION_ADD_PART=Add Part -_UI_ACTION_EXISTING_MESSAGE=Existing Message... -_UI_ACTION_EXISTING_ELEMENT=Existing Element... -_UI_ERROR_NAMESPACE_INVALID=The target namespace is invalid -_UI_ERROR_FILE_ALREADY_EXISTS=File already exists: {0} -_UI_DESCRIPTION_NEW_WSDL_FILE=Specify the attributes for the new WSDL file. -_UI_REGEN_BINDINDS_ON_SAVE=Regenerate Bindings On Save -_UI_RADIO_DOCUMENT_LITERAL=document literal -_UI_TITLE_SPECIFY_PORTTYPE=Specify Port Type -_UI_LABEL_BINDING_PROTOCOL=Protocol: -_UI_LABEL_INLINE_SCHEMA_OF=Inline Schema of -_UI_LABEL_TARGET_NAMESPACE=Target namespace: -_UI_LABEL_PREFIX_WITH_COLON=Prefix: -_UI_LABEL_CREATE_WSDL_SKELETON=Create WSDL Skeleton -_UI_LABEL_CREATE_NEW_WSDL_FILE=Create a new WSDL File -_UI_LABEL_SOAP_BINDING_OPTIONS=SOAP Binding Options -_UI_LABEL_HTTP_BINDING_OPTIONS=HTTP Binding Options -_UI_LABEL_ADD_EXTENSION_ELEMENT=Add Extension Element -_UI_SPECIFY_BINDING_DETAILS_LABEL=Specify the details of the binding that will be created -_UI_SPECIFY_PORT_DETAILS_TO_BE_CREATED=Specify the details of the port that will be created -_UI_LABEL_NEW_BINDING=New Binding -_UI_LABEL_NEW_PORTTYPE=New PortType -_UI_LABEL_REFERENCE_KIND=Reference Kind -_UI_LABEL_NEW_MESSAGE=New Message -_UI_RADIO_RPC_ENCODED=rpc encoded -_UI_RADIO_RPC_LITERAL=rpc literal -_UI_ACTION_EXISTING_TYPE=Existing Type... -_UI_SPECIFY_PORT_DETAILS=Specify Port Details -_UI_TITLE_SPECIFY_BINDING=Specify Binding -_UI_TITLE_SPECIFY_BINDING_DETAILS=Specify Binding Details -_UI_ERROR_FILE_MUST_END_WITH_WSDL=Error: File must end with wsdl -_UI_TITLE_SPECIFY_MESSAGE=Specify Message -_UI_TITLE_NEW_WSDL_FILE=New WSDL File -_UI_NAME_INVALID_CHAR_END=') -_UI_ACTION_RENAME=Rename -_UI_FOLDER_TYPES=Types -_UI_CANCEL_LABEL=Cancel -_UI_ACTION_NEW_TYPE=New Type... -_UI_ACTION_SET_TYPE=Set Type -_UI_FOLDER_IMPORTS=Imports -_UI_FOLDER_SERVICES=Services -_UI_FOLDER_BINDINGS=Bindings -_UI_FOLDER_PORTTYPES=Interfaces -_UI_FOLDER_MESSAGES=Messages -_UI_ACTION_NEW_MESSAGE=New Message... -_UI_ACTION_NEW_ELEMENT=New Element... -_UI_ACTION_SET_ELEMENT=Set Element -_UI_ACTION_SET_MESSAGE=Set Message -_UI_ACTION_SET_BINDING=Set Binding -_UI_CHECKBOX_OVERWRITE=Overwrite existing binding information -_UI_ACTION_SET_PORTTYPE=Set PortType -_UI_ACTION_ADD=Add -_UI_UNSPECIFIED=(unspecified) -_UI_LABEL_NAME=Name -_UI_LABEL_TYPE=Type -_UI_BUTTON_NEW=New... -_UI_LABEL_ELEMENT=Element -_UI_BUTTON_BROWSE=Browse... -_UI_BINDING_WIZARD=Binding Wizard -_UI_BINDING=Binding -_UI_LABEL_MESSAGE=Message -_UI_LABEL_REMOVE=Remove -_UI_TITLE_SELECT=Select -_UI_TITLE_OPTIONS=Options -_UI_YES_LABEL=Yes -_UI_PORT_TYPE=Port Type -_UI_PORT_WIZARD=Port Wizard -_UI_NO_LABEL=No -_UI_ADD=Add... -_UI_HELP=Help -_UI_LABEL_NAME_FILTER=Name (? = character, * = any string): -_WARN_NAME_MUST_CONTAIN_AT_LEAST_ONE_CHAR=IWAX1415W Name field must contain at least one character -_WARN_NAME_HAS_SPACE=IWAX1402W Name field cannot contain a space -_WARN_NAME_INVALID_FIRST=IWAX1403W First character in name field must be one of the following ('_', ':', 'letter') -_WARN_NAME_INVALID_CHAR=IWAX1404W Name field contains invalid character ('
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ExtensionsSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ExtensionsSection.java deleted file mode 100644 index bf47483ce..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ExtensionsSection.java +++ /dev/null @@ -1,209 +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.properties.sections; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.gef.commands.Command; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.wst.wsdl.ExtensibilityElement; -import org.eclipse.wst.wsdl.ExtensibleElement; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.commands.AddExtensionElementCommand; -import org.eclipse.wst.wsdl.ui.internal.filter.ExtensiblityElementFilter; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddExtensionCommand; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.AbstractExtensionsSection; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.AddExtensionsComponentDialog; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.DOMExtensionTreeContentProvider; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.DOMExtensionTreeLabelProvider; -import org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.ExtensionsSchemasRegistry; -import org.eclipse.xsd.XSDAttributeDeclaration; -import org.eclipse.xsd.XSDElementDeclaration; -import org.w3c.dom.Element; - -public class W11ExtensionsSection extends AbstractExtensionsSection -{ - public W11ExtensionsSection() - { - super(); - setExtensionTreeLabelProvider(new WSDLExtensionTreeLabelProvider()); - setExtensionTreeContentProvider(new WSDLExtensionTreeContentProvider()); - } - - protected AddExtensionCommand getAddExtensionCommand(Object o) - { - AddExtensionCommand addExtensionCommand = null; - if (input instanceof ExtensibleElement) - { - if (o instanceof XSDElementDeclaration) - { - XSDElementDeclaration element = (XSDElementDeclaration) o; - addExtensionCommand = new AddExtensionElementCommand(Messages.getString("_UI_LABEL_ADD_EXTENSION_ELEMENT"), (ExtensibleElement)input, element); //$NON-NLS-1$ - } - else if (o instanceof XSDAttributeDeclaration) - { - // TODO (cs) need to implement this - } - } - return addExtensionCommand; - } - - protected Command getRemoveExtensionCommand(Object o) - { - // TODO Auto-generated method stub - return null; - } - - // TODO (cs) the AbstractExtensionsSection is polluted with XSD specic stuff - // need to clean that up!! - // TODO (cs) we should avoid referencing WSDL model objects ... go thru facade instead - public void setInput(IWorkbenchPart part, ISelection selection) - { - super.setInput(part, selection); - if (input instanceof Adapter) - { - input = ((Adapter)input).getTarget(); - } - if (input instanceof ExtensibleElement) - { - isReadOnly = false; - //addButton.setEnabled(true); - //removeButton.setEnabled(true); - } - else - { - isReadOnly = true; - //addButton.setEnabled(false); - //removeButton.setEnabled(false); - } - } - - protected AddExtensionsComponentDialog createAddExtensionsComponentDialog() - { - // IDEA (cs) we need a way to do all of this via the adapter - // so that we don't have any direct dependency on the WSDL1.1 model - // of course at the moment we call this class the W11ExtensionSections - // so that's not a problem. In the future though we'll want to reuse this - // class for WSDL 2.0. - // - if (input instanceof Adapter) - { - input = ((Adapter)input).getTarget(); - } - if (input instanceof ExtensibleElement) - { - ExtensibleElement extensibleElement = (ExtensibleElement)input; - AddExtensionsComponentDialog dialog = new AddExtensionsComponentDialog(composite.getShell(), getExtensionsSchemasRegistry()); - dialog.addElementsTableFilter(new AddExtensionsComponentDialogFilter(extensibleElement.getElement())); - return dialog; - } - return null; - } - - protected ExtensionsSchemasRegistry getExtensionsSchemasRegistry() - { - return WSDLEditorPlugin.getInstance().getExtensionsSchemasRegistry(); - } - - static class WSDLExtensionTreeContentProvider extends DOMExtensionTreeContentProvider - { - public java.lang.Object[] getElements(java.lang.Object inputElement) - { - if (inputElement instanceof Adapter) - { - inputElement = ((Adapter)inputElement).getTarget(); - } - if (inputElement instanceof ExtensibleElement) - { - List domElementList = new ArrayList(); - ExtensibleElement extensibleElement = (ExtensibleElement) inputElement; - for (Iterator i = extensibleElement.getExtensibilityElements().iterator(); i.hasNext(); ) - { - ExtensibilityElement element = (ExtensibilityElement)i.next(); - // add the DOM element - domElementList.add(element.getElement()); - } - return domElementList.toArray(); - } - return Collections.EMPTY_LIST.toArray(); - } - } - - static class WSDLExtensionTreeLabelProvider extends DOMExtensionTreeLabelProvider - { - public Image getImage(Object object) - { - if (object instanceof Element) - { - Element element = (Element)object; - ExtensionsSchemasRegistry registry = WSDLEditorPlugin.getInstance().getExtensionsSchemasRegistry(); - ILabelProvider provider = registry.getLabelProvider(element); - if (provider != null) - { - return provider.getImage(element); - } - } - return super.getImage(object); - } - - public String Text(Object object) - { - if (object instanceof Element) - { - Element element = (Element)object; - ExtensionsSchemasRegistry registry = WSDLEditorPlugin.getInstance().getExtensionsSchemasRegistry(); - ILabelProvider provider = registry.getLabelProvider(element); - if (provider != null) - { - return provider.getText(element); - } - } - return super.getText(object); - } - } - /** - * This filter is to be used by the dialog invoked when addButton is pressed - */ - private class AddExtensionsComponentDialogFilter extends ViewerFilter - { - private Element hostElement; - - public AddExtensionsComponentDialogFilter(Element hostElement) - { - this.hostElement = hostElement; - } - - public boolean select(Viewer viewer, Object parentElement, Object element) - { - if (element instanceof XSDElementDeclaration) - { - String namespace = ((XSDElementDeclaration) element).getTargetNamespace(); - String name = ((XSDElementDeclaration) element).getName(); - ExtensiblityElementFilter filter = (ExtensiblityElementFilter) WSDLEditorPlugin.getInstance().getExtensiblityElementFilterRegistry().getProperty(namespace, ""); - if (filter != null) - { - return filter.isValidContext(hostElement, name); - } - return true; - } - return true; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSection.java deleted file mode 100644 index 64e4545d6..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSection.java +++ /dev/null @@ -1,216 +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.properties.sections; - -import org.eclipse.jface.window.Window; -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.MessageReference; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -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.properties.sections.NameSection; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog; - -public class W11MessageReferenceSection 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 ComponentReferenceEditManager refManager; - - 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_MESSAGE") + ":"); //$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); - - data = new FormData(); - data.left = new FormAttachment(0, 100); -// data.right = new FormAttachment(button, 0); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE); - combo.setLayoutData(data); - } - - /* - * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh() - */ - public void refresh() { - super.refresh(); - if (nameText.isFocusControl()) { - return; - } - setListenerEnabled(false); - String refName = ""; //$NON-NLS-1$ - - combo.removeAll(); - combo.add(BROWSE_STRING); - combo.add(NEW_STRING); - - MessageReference messageRef = (MessageReference) ((W11MessageReference) getModel()).getTarget(); - if (messageRef != null && messageRef.getEMessage() != null) { - refName = messageRef.getEMessage().getQName().getLocalPart(); - } - - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - if (editManager != null) { - ComponentSpecification[] specs = editManager.getQuickPicks(); - for (int index = 0; index < specs.length; index++) { - combo.add((String) specs[index].getName()); - } - } - - String[] items = combo.getItems(); - int index; - for (index = 0; index < items.length; index++) { - if (items[index].equals(refName)) { - break; - } - } - - if (index < items.length) { - // Found a match - combo.select(index); - } - else { - combo.setText(refName); - } - - setControlForegroundColor(combo); - setListenerEnabled(true); - - -// MessageReference messageRef = (MessageReference) ((W11MessageReference) getModel()).getTarget(); -// Iterator it = messageRef.getEnclosingDefinition().getEMessages().iterator(); -// while (it.hasNext()) { -// Message message = (Message) it.next(); -// combo.add(message.getQName().getLocalPart()); -// } - } - - protected ComponentReferenceEditManager getComponentReferenceEditManager() { - if (refManager != null) { - return refManager; - } - - refManager = ReferenceEditManagerHelper.getMessageReferenceEditManager((IASDObject) getModel()); - - return refManager; - } - - - public boolean shouldUseExtraSpace() - { - return false; - } - - public void doHandleEvent(Event event) - { - super.doHandleEvent(event); - if (event.widget == combo) { - String value = ""; //$NON-NLS-1$ - if (combo.getSelectionIndex() != -1) { - value = combo.getItem(combo.getSelectionIndex()); - } - - ComponentSpecification spec = null; - int continueApply = Window.OK; - IMessageReference messageRef = (IMessageReference) this.getModel(); - - if (value.equals(NEW_STRING)) { - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - IComponentDialog dialog = editManager.getNewDialog(); - continueApply = dialog.createAndOpen(); - spec = dialog.getSelectedComponent(); - } - else if (value.equals(BROWSE_STRING)) { - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - IComponentDialog dialog = editManager.getBrowseDialog(); - continueApply = dialog.createAndOpen(); - spec = dialog.getSelectedComponent(); - } - else { - spec = getComponentSpecificationForValue((String)value); - } - - if (continueApply == Window.OK) { - ComponentReferenceEditManager editManager = getComponentReferenceEditManager(); - if (spec != null) { - editManager.modifyComponentReference(messageRef, spec); - } - } - - - } - } - - 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-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSectionFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSectionFilter.java deleted file mode 100644 index 7ac556c1a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11MessageReferenceSectionFilter.java +++ /dev/null @@ -1,28 +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.properties.sections; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessageReference; - -public class W11MessageReferenceSectionFilter implements IFilter { - // rmah: we should consider other ways of 'extending' this capability - // rather than simply checking a variable.... - public static boolean showW11MessageReferenceSection = true; - - public boolean select(Object toTest) { - if (toTest instanceof IMessageReference && showW11MessageReferenceSection) { - return true; - } - - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSection.java deleted file mode 100644 index 108333635..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSection.java +++ /dev/null @@ -1,207 +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.properties.sections; - -import org.eclipse.gef.commands.Command; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Event; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.properties.sections.ParameterSection; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; - -public class W11ParameterSection extends ParameterSection { - protected Button typeRadio; - protected Button elementRadio; - protected ComponentReferenceEditManager refManager; - - public void createControlArea() { - super.createControlArea(); - FormData data; - - typeRadio = getWidgetFactory().createButton(composite, Messages.getString("_UI_LABEL_TYPE"), SWT.RADIO); //$NON-NLS-1$ - elementRadio = getWidgetFactory().createButton(composite, Messages.getString("_UI_LABEL_ELEMENT"), SWT.RADIO); //$NON-NLS-1$ - CLabel referenceKindLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_UI_LABEL_REFERENCE_KIND") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - - typeRadio.addSelectionListener(this); - elementRadio.addSelectionListener(this); - - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(typeRadio, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(typeRadio, 0, SWT.CENTER); - referenceKindLabel.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 100); - data.right = new FormAttachment(elementRadio, -ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE); - typeRadio.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(0, 160); - data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE); - data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE); - elementRadio.setLayoutData(data); - } - - public void doWidgetSelected(SelectionEvent e) { - W11ParameterForPart parameter = (W11ParameterForPart) this.getModel(); - Part part = (Part) parameter.getTarget(); - - if (e.widget == typeRadio && typeRadio.getSelection()) { - comboLabel.setText(Messages.getString("_UI_LABEL_TYPE") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - ComponentReferenceUtil.setComponentReference(part, true, null); - super.refreshCombo(); - } - else if (e.widget == elementRadio && elementRadio.getSelection()) { - comboLabel.setText(Messages.getString("_UI_LABEL_ELEMENT") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - ComponentReferenceUtil.setComponentReference(part, false, null); - refreshElementCombo(); - } - } - - public void doHandleEvent(Event event) { - if (event.widget == combo) { - if (elementRadio.getSelection()) { - // Handle Element selection - String value = combo.getItem(combo.getSelectionIndex()); - - W11ParameterForPart parameter = (W11ParameterForPart) this.getModel(); - - if (value.equals(NEW_STRING)) { - Command command = parameter.getSetElementCommand(IParameter.SET_NEW_ACTION_ID); - command.execute(); - } - else if (value.equals(BROWSE_STRING)) { - Command command = parameter.getSetElementCommand(IParameter.SELECT_EXISTING_ACTION_ID); - command.execute(); - } - else { - ComponentReferenceEditManager editManager = getElementComponentReferenceEditManager(); - ComponentSpecification spec = getComponentSpecificationForValue((String)value); - if (spec != null) { - editManager.modifyComponentReference(parameter, spec); - } - } - } - } - - super.doHandleEvent(event); - } - - protected void refreshElementCombo() { - - // Refresh with Elements - IParameter param = null; - Object model = getModel(); - setListenerEnabled(false); - - if (model instanceof IParameter) { - param = (IParameter) model; - } - - String name = ""; //$NON-NLS-1$ - String elementName = "ParameterSection.java"; //$NON-NLS-1$ - if (param != null) { - name = param.getName(); - elementName = param.getComponentName(); - } - - nameText.setText(name); - - // Populate the Combo - combo.removeAll(); - combo.add(BROWSE_STRING); - combo.add(NEW_STRING); - - ComponentReferenceEditManager editManager = getElementComponentReferenceEditManager(); - if (editManager != null) { - ComponentSpecification[] specs = editManager.getQuickPicks(); - for (int index = 0; index < specs.length; index++) { - combo.add((String) specs[index].getName()); - } - } - - // Display the element in the Combo - String[] items = combo.getItems(); - int index; - for (index = 0; index < items.length; index++) { - if (items[index].equals(elementName)) { - break; - } - } - - if (index < items.length) { - // Found a match - combo.select(index); - } - else { - combo.setText(elementName); - } - - setListenerEnabled(true); - - } - - public void refresh() { - Object model = getModel(); - if (model instanceof W11ParameterForPart) { - W11ParameterForPart param = (W11ParameterForPart) model; - Part part = (Part) param.getTarget(); - if (part.getTypeDefinition() != null) { - typeRadio.setSelection(true); - elementRadio.setSelection(false); - comboLabel.setText(Messages.getString("_UI_LABEL_TYPE") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - handleTypeScenario = true; - } - else if (part.getElementDeclaration() != null) { - typeRadio.setSelection(false); - elementRadio.setSelection(true); - comboLabel.setText(Messages.getString("_UI_LABEL_ELEMENT") + ":"); //$NON-NLS-1$ //$NON-NLS-2$ - handleTypeScenario = false; - refreshElementCombo(); - } - else { - // Neither a Type or Element - typeRadio.setSelection(false); - elementRadio.setSelection(true); - } - } - - setControlForegroundColor(elementRadio); - setControlForegroundColor(typeRadio); - - super.refresh(); - } - - protected ComponentReferenceEditManager getElementComponentReferenceEditManager() { - if (refManager != null) { - return refManager; - } - - refManager = ReferenceEditManagerHelper.getXSDElementReferenceEditManager((IASDObject) getModel()); - - return refManager; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSectionFilter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSectionFilter.java deleted file mode 100644 index 0c237f632..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/properties/sections/W11ParameterSectionFilter.java +++ /dev/null @@ -1,28 +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.properties.sections; - -import org.eclipse.jface.viewers.IFilter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; - -public class W11ParameterSectionFilter implements IFilter { - // rmah: we should consider other ways of 'extending' this capability - // rather than simply checking a variable.... - public static boolean showW11ParameterSection = true; - - public boolean select(Object toTest) { - if (toTest instanceof IParameter && showW11ParameterSection) { - return true; - } - - return false; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/reconciler/DelegatingSourceValidatorForWSDL.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/reconciler/DelegatingSourceValidatorForWSDL.java deleted file mode 100644 index 89dddc24a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/reconciler/DelegatingSourceValidatorForWSDL.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.reconciler; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.resources.IFile; -import org.eclipse.wst.validation.internal.ConfigurationManager; -import org.eclipse.wst.validation.internal.ProjectConfiguration; -import org.eclipse.wst.validation.internal.ValidationRegistryReader; -import org.eclipse.wst.validation.internal.ValidatorMetaData; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; -import org.eclipse.wst.xml.ui.internal.Logger; -import org.eclipse.wst.xml.ui.internal.validation.DelegatingSourceValidator; - -/** - * This performs the as-you-type validation - * @author Mark Hutchinson - * - */ -public class DelegatingSourceValidatorForWSDL extends DelegatingSourceValidator -{ - - final private static String VALIDATOR_CLASS = "org.eclipse.wst.wsdl.validation.internal.eclipse.WSDLDelegatingValidator"; //$NON-NLS-1$ - - public DelegatingSourceValidatorForWSDL() - { - super(); - } - - protected IValidator getDelegateValidator() - { - try - { - ValidationRegistryReader registry = ValidationRegistryReader.getReader(); - return registry.getValidator(VALIDATOR_CLASS); - } - catch (Exception e) - { // - } - return null; - } - - protected boolean isDelegateValidatorEnabled(IFile file) { - boolean enabled = true; - try { - ProjectConfiguration configuration = ConfigurationManager.getManager().getProjectConfiguration(file.getProject()); - ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(VALIDATOR_CLASS); - if (configuration.isBuildEnabled(vmd) || configuration.isManualEnabled(vmd)) - enabled = true; - else - enabled = false; - } - catch (InvocationTargetException e) { - Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - } - return enabled; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlink.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlink.java deleted file mode 100644 index 51ba272d8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlink.java +++ /dev/null @@ -1,117 +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.text; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; - -/** - * WSDLHyperlink knows how to open links from wsdl files. - * - * @see WSDLHyperlinkDetector - */ -public class WSDLHyperlink implements IHyperlink -{ - private IRegion fRegion; - private String fResource; - private String fSpec; - - public WSDLHyperlink(IRegion region, String resource, String spec) - { - fRegion = region; - fResource = resource; - fSpec = spec; - } - - public IRegion getHyperlinkRegion() - { - return fRegion; - } - - public String getTypeLabel() - { - return null; - } - - public String getHyperlinkText() - { - return null; - } - - public void open() - { - /* - * ISSUE: There are cleaner ways to find the right file based on a URI - * string and cleaner ways to find which editor to open for the file. See - * other IHyperlink and IHyperlinkDetector implementors for examples. - */ - String pattern = "platform:/resource"; //$NON-NLS-1$ - if (fResource != null && fResource.startsWith(pattern)) - { - Path path = new Path(fResource.substring(pattern.length())); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - - IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - - IEditorPart editorPart = workbenchPage.getActiveEditor(); - - // When using the cursor or the mouse to move around in the text - // editor, the location history is not updated, so we make sure we keep - // a reference to where we are. If we use other navigation means, like the - // outline view, this call will not add a new location history entry, as - // it is the same as the last location set through the outline driven - // navigation. - - boolean sameEditor = editorPart.getEditorInput() instanceof IFileEditorInput && ((IFileEditorInput) editorPart.getEditorInput()).getFile().equals(file); - - workbenchPage.getNavigationHistory().markLocation(editorPart); - - if (!sameEditor) - { - try - { - // The target is in a different file, so open the target's enclosing - // resource in it's own editor. Let the workbench decide what editor - // to open based on the file's content type. - - editorPart = IDE.openEditor(workbenchPage, file, true); - } - catch (PartInitException e) - { -// Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e); - return; - } - } - - // Attempt to retrieve the target editor's selection manager and try to - // change the selection to the thing (schema component, wsdl element, etc) - // pointed to by fSpec. - - ISelectionProvider selectionProvider = (ISelectionProvider) editorPart.getAdapter(ISelectionProvider.class); - - if (selectionProvider != null) - { - selectionProvider.setSelection(new StructuredSelection(fSpec)); - } - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlinkDetector.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlinkDetector.java deleted file mode 100644 index 9d6f78b43..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLHyperlinkDetector.java +++ /dev/null @@ -1,104 +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.text; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.hyperlink.IHyperlink; -import org.eclipse.wst.sse.core.StructuredModelManager; -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.util.OpenOnSelectionHelper; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xsd.ui.internal.editor.BaseHyperlinkDetector; -/** - * Detects hyperlinks for WSDL files. Used by the WSDL text editor to provide a - * "Go to declaration" functionality similar with the one provided by the Java - * editor. - */ -public class WSDLHyperlinkDetector extends BaseHyperlinkDetector -{ - /* - * (non-Javadoc) - */ - protected IHyperlink createHyperlink(IDocument document, IDOMNode node, IRegion region) - { - // Here we're trying to find the target component's resource and spec. - - Definition definition = getDefinition(document); - OpenOnSelectionHelper helper = new OpenOnSelectionHelper(definition); - String[] targetData = helper.computeSpecification(node); - - if (targetData != null) - { - String resource = targetData[0]; - String spec = targetData[1]; - return new WSDLHyperlink(region, resource, spec); - } - - return null; - } - - /** - * Gets the definition from document - * - * @param document - * @return Definition - */ - private Definition getDefinition(IDocument document) - { - Definition definition = null; - IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document); - if (model != null) - { - try - { - if (model instanceof IDOMModel) - { - IDOMDocument domDoc = ((IDOMModel) model).getDocument(); - if (domDoc != null) - { - WSDLModelAdapter modelAdapter = (WSDLModelAdapter) domDoc.getAdapterFor(WSDLModelAdapter.class); - // ISSUE: if adapter does not already exist for domDoc getAdapterFor - // will create one. So why is this null check/creation needed? - if (modelAdapter == null) - { - modelAdapter = new WSDLModelAdapter(); - domDoc.addAdapter(modelAdapter); - modelAdapter.createDefinition(domDoc.getDocumentElement(), domDoc); - } - definition = modelAdapter.getDefinition(); - } - } - } - finally - { - model.releaseFromRead(); - } - } - return definition; - } - - /* - * (non-Javadoc) - */ - protected boolean isLinkableAttribute(String name) - { - boolean isLinkable = name.equals(WSDLConstants.BINDING_ATTRIBUTE) || - name.equals(WSDLConstants.ELEMENT_ATTRIBUTE) || - name.equals(WSDLConstants.TYPE_ATTRIBUTE) || - name.equals(WSDLConstants.MESSAGE_ATTRIBUTE); - return isLinkable; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelAdapter.java deleted file mode 100644 index 482c69a9a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelAdapter.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.text; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.WSDLFactory; -import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl; -import org.eclipse.wst.wsdl.internal.util.WSDLResourceFactoryImpl; -import org.eclipse.wst.wsdl.ui.internal.extensions.ExtensibleTypeSystemProvider; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xsd.ui.internal.util.XSDSchemaLocationResolverAdapterFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class WSDLModelAdapter implements INodeAdapter -{ - protected ResourceSet resourceSet; - protected Definition definition; - - public Definition getDefinition() - { - return definition; - } - - public void setDefinition(Definition definition) - { - this.definition = definition; - } - - public boolean isAdapterForType(Object type) - { - return type == WSDLModelAdapter.class; - } - - public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) - { - } - - public Definition createDefinition(Element element, Document document) - { - try - { - IDOMNode domNode = (IDOMNode)element; - String baseLocation = "blankWSDL.wsdl"; //$NON-NLS-1$ - if (domNode != null) { - baseLocation = domNode.getModel().getBaseLocation(); - } - else if (document instanceof IDOMNode){ - IDOMModel domModel = ((IDOMNode) document).getModel(); - baseLocation = domModel.getBaseLocation(); - } - - resourceSet = new ResourceSetImpl(); - resourceSet.getAdapterFactories().add(new WSDLModelLocatorAdapterFactory()); - resourceSet.getAdapterFactories().add(new XSDSchemaLocationResolverAdapterFactory()); - - // TODO.. .revist the best approach to obtain a URI from the SSE model - // - URI uri = null; - if (baseLocation.startsWith("/")) //$NON-NLS-1$ - { - uri = URI.createPlatformResourceURI(baseLocation); - } - else - { - uri = URI.createFileURI(baseLocation); - } - - definition = WSDLFactory.eINSTANCE.createDefinition(); - definition.setDocumentBaseURI(uri.toString()); - definition.setDocument(document); - definition.setElement(element); - - WSDLResourceFactoryImpl resourceFactory = new WSDLResourceFactoryImpl(); - Resource resource = resourceFactory.createResource(uri); - resourceSet.getResources().add(resource); - resource.getContents().add(definition); - resource.setModified(false); - ((DefinitionImpl)definition).reconcileReferences(true); - - // attach an adapter to keep the WSDL model and DOM in sync - // - new WSDLModelReconcileAdapter(document, definition); - - // TODO... CS : revisit this line - // currently this is used to associate a 'type' system with the definition - // I suspect that this could be made a whole lot more simple - // - WSDLEditorUtil.getInstance().setTypeSystemProvider(definition, new ExtensibleTypeSystemProvider()); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - return definition; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelLocatorAdapterFactory.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelLocatorAdapterFactory.java deleted file mode 100644 index 0de7a94d5..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelLocatorAdapterFactory.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.text; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin; -import org.eclipse.wst.wsdl.internal.util.WSDLModelLocator; - -public class WSDLModelLocatorAdapterFactory extends AdapterFactoryImpl -{ - protected CustomWSDLModelLocator customWSDLModelLocator = new CustomWSDLModelLocator(); - - class CustomWSDLModelLocator extends AdapterImpl implements WSDLModelLocator - { - public String resolveURI(String baseLocation, String namespace, String location) - { - return URIResolverPlugin.createResolver().resolve(baseLocation, namespace, location); - } - - public boolean isAdatperForType(Object type) - { - return type == WSDLModelLocator.class; - } - } - - public boolean isFactoryForType(Object type) - { - return type == WSDLModelLocator.class; - } - - public Adapter adaptNew(Notifier target, Object type) - { - return customWSDLModelLocator; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelQueryExtension.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelQueryExtension.java deleted file mode 100644 index 7639b901a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelQueryExtension.java +++ /dev/null @@ -1,208 +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.text; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.filter.ExtensiblityElementFilter; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xsd.ui.internal.text.XSDModelQueryExtension; -import org.eclipse.wst.xsd.ui.internal.util.TypesHelper; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDSchema; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class WSDLModelQueryExtension extends XSDModelQueryExtension -{ - public WSDLModelQueryExtension() - { - } - - protected boolean isParentElementMessageReference(String parentElementName) - { - return parentElementName.equals("input") || parentElementName.equals("output") || parentElementName.equals("fault"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - protected boolean isMessageReference(String elementName) - { - return elementName.equals("body") || elementName.equals("header") || elementName.equals("fault") || elementName.equals("urlReplacement") || elementName.equals("urlEncoded"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ - } - - - public boolean isApplicableChildElement(Node parentNode, String namespace, String name) - { - boolean result = true; - if (parentNode.getNodeType() == Node.ELEMENT_NODE) - { - Element element = (Element) parentNode; - String parentElementNamespaceURI = parentNode.getNamespaceURI(); - String parentElementName = parentNode.getLocalName(); - // only filter children for 'non-schema' elements - // - if (!WSDLConstants.XSD_NAMESPACE_URI.equals(parentElementNamespaceURI)) - { - if (parentElementName != null && name != null) - { - if (namespace != null) - { - // the following namespace are one that always should be filtered out - // for now this is hardcoded - // - if (namespace.equals("http://schemas.xmlsoap.org/soap/encoding/")) //$NON-NLS-1$ - { - // exclude soap-enc elements - // - result = false; - } - else if (namespace.equals(WSDLConstants.XSD_NAMESPACE_URI)) - { - // eclipse all schema elements, except for 'schema' withing wsdl types elements - result = parentElementName.equals("types") && name.equals("schema"); //$NON-NLS-1$ //$NON-NLS-2$ - } - else - { - // TODO.. we should investigate removing the ExtensiblityElementFilter extension point - // shouldn't this be a ModelQueryExtension defined on the extension languages? - // - ExtensiblityElementFilter filter = (ExtensiblityElementFilter) WSDLEditorPlugin.getInstance().getExtensiblityElementFilterRegistry().getProperty(namespace, ""); //$NON-NLS-1$ - if (filter != null) - { - result = filter.isValidContext(element, name); - } - } - } - } - } - } - return result; - } - - public String[] getAttributeValues(Element element, String namespace, String name) - { - if (WSDLConstants.WSDL_NAMESPACE_URI.equals(namespace)) - { - List list = new ArrayList(); - ComponentReferenceUtil util = new ComponentReferenceUtil(lookupOrCreateDefinition(element)); - String currentElementName = element.getLocalName(); - if (checkName(name, "message")) //$NON-NLS-1$ - { - list.addAll(util.getMessageNames()); - } - else if (checkName(name, "binding")) //$NON-NLS-1$ - { - list.addAll(util.getBindingNames()); - } - else if (checkName(name, "type")) //$NON-NLS-1$ - { - if (checkName(currentElementName, "binding")) //$NON-NLS-1$ - { - list.addAll(util.getPortTypeNames()); - } - else if (checkName(currentElementName, "part")) //$NON-NLS-1$ - { - list.addAll(util.getComponentNameList(true)); - } - } - else if (checkName(name, "element")) //$NON-NLS-1$ - { - if (checkName(currentElementName, "part")) //$NON-NLS-1$ - { - list.addAll(util.getComponentNameList(false)); - } - } - String[] result = new String[list.size()]; - list.toArray(result); - return result; - } - else - { - return super.getAttributeValues(element, namespace, name); - } - } - - - protected XSDSchema lookupOrCreateSchemaForElement(Element element) - { - XSDSchema schema = null; - Definition definition = lookupOrCreateDefinition(element); - Object o = WSDLEditorUtil.getInstance().findModelObjectForElement(definition, element); - if (o instanceof XSDConcreteComponent) - { - schema = ((XSDConcreteComponent) o).getSchema(); - } - return schema; - } - - - protected Definition lookupOrCreateDefinition(Element element) - { - Definition definition = null; - Document document = element.getOwnerDocument(); - if (document instanceof INodeNotifier) - { - INodeNotifier notifier = (INodeNotifier) document; - WSDLModelAdapter adapter = (WSDLModelAdapter) notifier.getAdapterFor(WSDLModelAdapter.class); - if (adapter == null) - { - adapter = new WSDLModelAdapter(); - notifier.addAdapter(adapter); - adapter.createDefinition(document.getDocumentElement(), document); - } - definition = adapter.getDefinition(); - } - return definition; - } - - - protected TypesHelper getTypesHelper(final Element element) - { - XSDSchema schema = lookupOrCreateSchemaForElement(element); - return new TypesHelper(schema) - { - // TODO... it seems as though the model is not correctly - // mainting the list of prefixes for a given namespace - // must be a bug! - // - protected List getPrefixesForNamespace(String namespace) - { - List list = super.getPrefixesForNamespace(namespace); - Definition definition = lookupOrCreateDefinition(element); - if (definition != null) - { - Map map = definition.getNamespaces(); - for (Iterator i = map.keySet().iterator(); i.hasNext();) - { - String prefix = (String) i.next(); - String ns = (String) map.get(prefix); - if (ns != null && ns.equals(namespace)) - { - if (!list.contains(prefix)) - { - list.add(prefix); - } - } - } - } - return list; - } - }; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelReconcileAdapter.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelReconcileAdapter.java deleted file mode 100644 index e4ff70071..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/text/WSDLModelReconcileAdapter.java +++ /dev/null @@ -1,172 +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.text; - -import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter; -import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.wst.wsdl.internal.impl.XSDSchemaExtensibilityElementImpl; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.xsd.impl.XSDSchemaImpl; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -class WSDLModelReconcileAdapter extends DocumentAdapter -{ - protected Definition definition; - - public WSDLModelReconcileAdapter(Document document, Definition definition) - { - super(document); - this.definition = definition; - } - - - public void notifyChanged(INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index) - { - if (eventType == INodeNotifier.ADD) - { - if (newValue instanceof Element) - { - adapt((Element)newValue); - - // See Bug 5366 - // We need to sync up the Model and the DOM - Element newDocumentElement = (Element)newValue; - String wsdlPrefix = newDocumentElement.getPrefix(); - if (wsdlPrefix == null) wsdlPrefix = ""; //$NON-NLS-1$ - String ns = definition != null ? definition.getNamespace(wsdlPrefix) : ""; //$NON-NLS-1$ - if (ns != null && ns.equals(WSDLConstants.WSDL_NAMESPACE_URI) - && newDocumentElement.getLocalName().equals(WSDLConstants.DEFINITION_ELEMENT_TAG)) // && - // !isValidDefinition) - { -// System.out.println("****** Setting new definition"); - definition.setElement(newDocumentElement); - } - } - } - - switch (eventType) - { - // we make the assumption that reconciling will only be triggered by one of these notifications - // (ADD and REMOVE notifications are omitted) - // - case INodeNotifier.CHANGE: - case INodeNotifier.STRUCTURE_CHANGED: - case INodeNotifier.CONTENT_CHANGED: - { - if (notifier instanceof Element) - { - reconcileModelObjectForElement((Element)notifier, eventType, feature, oldValue, newValue, index); - } - else if (notifier instanceof Document) - { - Document document = (Document)notifier; - Element definitionElement = null; - - for (Node node = document.getFirstChild(); node != null; node = node.getNextSibling()) - { - if (node.getNodeType() == Node.ELEMENT_NODE) - { - Element element = (Element)node; - if (WSDLEditorUtil.getInstance().getWSDLType(element) == WSDLConstants.DEFINITION) - { - definitionElement = element; - break; - } - } - } - - // TODO... revisit definition.removeAllContent() and who should call this? - // - if (definitionElement != null) - { -// isValidDefinition = true; -// System.out.println("VALID DEFINITION ELEMENT"); - WSDLModelAdapter modelAdapter = (WSDLModelAdapter) notifier.getAdapterFor(WSDLModelAdapter.class); - if (modelAdapter != null) { - definition = modelAdapter.getDefinition(); - if (definition == null) definition = modelAdapter.createDefinition(definitionElement, document); - } - ((DefinitionImpl)definition).elementChanged(definitionElement); - } - else - { -// System.out.println("INVALID DEFINITION ELEMENT"); -// isValidDefinition = false; - ((DefinitionImpl)definition).removeAll(); - } - } - break; - } - } - } - - protected void reconcileModelObjectForElement(Element element, int eventType, Object feature, Object oldValue, Object newValue, int index) - { - Object modelObject = WSDLEditorUtil.getInstance().findModelObjectForElement(definition, element); - if (modelObject != null) - { - if (modelObject instanceof XSDSchemaExtensibilityElementImpl) - { - XSDSchemaExtensibilityElementImpl ee = (XSDSchemaExtensibilityElementImpl)modelObject; - ((XSDSchemaImpl)ee.getSchema()).elementChanged(element); - ee.elementChanged(element); - } - else if (modelObject instanceof WSDLElementImpl) - { - ((WSDLElementImpl)modelObject).elementChanged(element); - } - } - } -} - - -abstract class DocumentAdapter implements INodeAdapter -{ - Document document; - - public DocumentAdapter(Document document) - { - this.document = document; - ((INodeNotifier)document).addAdapter(this); - if (document.getDocumentElement() != null) adapt(document.getDocumentElement()); - } - - public void adapt(Element element) - { - if (((INodeNotifier)element).getExistingAdapter(this) == null) - { - ((INodeNotifier)element).addAdapter(this); - - for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) - { - if (child.getNodeType() == Node.ELEMENT_NODE) - { - adapt((Element)child); - } - } - } - } - - public boolean isAdapterForType(Object type) - { - return type == this; - } - - abstract public void notifyChanged - (INodeNotifier notifier, int eventType, Object feature, Object oldValue, Object newValue, int index); -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ComponentReferenceUtil.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ComponentReferenceUtil.java deleted file mode 100644 index 409e675e0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ComponentReferenceUtil.java +++ /dev/null @@ -1,957 +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.util; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IFile; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingFault; -import org.eclipse.wst.wsdl.BindingInput; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.BindingOutput; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.internal.impl.ImportImpl; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.wst.wsdl.ui.internal.extensions.ITypeSystemProvider; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -public class ComponentReferenceUtil -{ - protected Definition rootDefinition; - - public ComponentReferenceUtil(Definition rootDefinition) - { - this.rootDefinition = rootDefinition; - } - - protected static boolean isEqual(String a, String b) - { - boolean result = false; - if (a != null) - { - result = a.equals(b) || (a.length() == 0 && b == null); - } - else - { - result = (b == null || b.length() == 0); - } - return result; - } - - protected static boolean isEqualInputName(Operation operation, BindingOperation bindingOperation) - { - boolean result = false; - Input operationInput = operation.getEInput(); - BindingInput bindingOperationInput = bindingOperation.getEBindingInput(); - - if (operationInput != null && bindingOperationInput != null) - { - result = isEqual(operationInput.getName(), bindingOperationInput.getName()); - } - else if (operationInput == null && bindingOperationInput == null) - { - result = true; - } - return result; - } - - protected static boolean isEqualOutputName(Operation operation, BindingOperation bindingOperation) - { - boolean result = false; - Output operationOutput = operation.getEOutput(); - BindingOutput bindingOperationOutput = bindingOperation.getEBindingOutput(); - - if (operationOutput != null && bindingOperationOutput != null) - { - result = isEqual(operationOutput.getName(), bindingOperationOutput.getName()); - } - else if (operationOutput == null && bindingOperationOutput == null) - { - result = true; - } - return result; - } - - protected static boolean isMatchingBinding(Operation operation, BindingOperation bindingOperation) - { - return isEqual(operation.getName(), bindingOperation.getName()) && isEqualInputName(operation, bindingOperation) && isEqualOutputName(operation, bindingOperation); - } - - public List getPortsForPortType(PortType portType) - { - List list = new ArrayList(); - for (Iterator i = getServices().iterator(); i.hasNext();) - { - Service service = (Service) i.next(); - for (Iterator j = service.getEPorts().iterator(); j.hasNext();) - { - Port port = (Port) j.next(); - Binding binding = port.getEBinding(); - if (binding != null && binding.getEPortType() == portType) - { - list.add(port); - } - } - } - return list; - } - - public List getPortsForBinding(Binding binding) - { - List list = new ArrayList(); - for (Iterator i = getServices().iterator(); i.hasNext();) - { - Service service = (Service) i.next(); - for (Iterator j = service.getEPorts().iterator(); j.hasNext();) - { - Port port = (Port) j.next(); - if (port.getEBinding() == binding) - { - list.add(port); - } - } - } - return list; - } - - public List getBindingOperations(Operation operation) - { - List list = new ArrayList(); - String operationName = operation.getName(); - - if (operationName != null) - { - PortType portType = getEnclosingPortType(operation); - for (Iterator i = getBindings(portType).iterator(); i.hasNext();) - { - Binding binding = (Binding) i.next(); - BindingOperation bindingOperation = getBindingOperation(operation, binding); - if (bindingOperation != null) - { - list.add(bindingOperation); - } - } - } - return list; - } - - public BindingOperation getBindingOperation(Operation operation, Binding binding) - { - BindingOperation result = null; - for (Iterator j = binding.getBindingOperations().iterator(); j.hasNext();) - { - BindingOperation bindingOperation = (BindingOperation) j.next(); - if (isMatchingBinding(operation, bindingOperation)) - { - result = bindingOperation; - break; - } - } - return result; - } - - public BindingInput getBindingInput(Input input, Binding binding) - { - BindingOperation bindingOperation = getBindingOperation((Operation) input.eContainer(), binding); - return bindingOperation != null ? bindingOperation.getEBindingInput() : null; - } - - public BindingOutput getBindingOutput(Output output, Binding binding) - { - BindingOperation bindingOperation = getBindingOperation((Operation) output.eContainer(), binding); - return bindingOperation != null ? bindingOperation.getEBindingOutput() : null; - } - - public BindingFault getBindingFault(Fault fault, Binding binding) - { - BindingFault result = null; - String faultName = fault.getName(); - if (faultName != null) - { - BindingOperation bindingOperation = getBindingOperation((Operation) fault.eContainer(), binding); - if (bindingOperation != null) - { - result = (BindingFault) bindingOperation.getBindingFault(faultName); - } - } - return result; - } - - public EObject getBindingObject(EObject interfaceObject, Binding binding) - { - EObject result = null; - if (interfaceObject instanceof Input) - { - result = getBindingInput((Input) interfaceObject, binding); - } - else if (interfaceObject instanceof Output) - { - result = getBindingOutput((Output) interfaceObject, binding); - } - else if (interfaceObject instanceof Fault) - { - result = getBindingFault((Fault) interfaceObject, binding); - } - else if (interfaceObject instanceof Operation) - { - result = getBindingOperation((Operation) interfaceObject, binding); - } - else if (interfaceObject instanceof PortType) - { - result = binding; - } - return result; - } - - public List getBindingInputs(Input input) - { - List list = new ArrayList(); - List operations = getBindingOperations((Operation) input.eContainer()); - for (Iterator i = operations.iterator(); i.hasNext();) - { - BindingOperation bindingOperation = (BindingOperation) i.next(); - if (bindingOperation.getBindingInput() != null) - { - list.add(bindingOperation.getBindingInput()); - } - } - return list; - } - - public List getBindingOutputs(Output output) - { - List list = new ArrayList(); - Operation operation = (Operation) output.eContainer(); - if (operation != null) - { - List operations = getBindingOperations(operation); - for (Iterator i = operations.iterator(); i.hasNext();) - { - BindingOperation bindingOperation = (BindingOperation) i.next(); - if (bindingOperation.getBindingOutput() != null) - { - list.add(bindingOperation.getBindingOutput()); - } - } - } - return list; - } - - public List getBindingFaults(Fault fault) - { - List list = new ArrayList(); - String faultName = fault.getName(); - if (faultName != null) - { - Operation operation = (Operation) fault.eContainer(); - if (operation != null) - { - List operations = getBindingOperations(operation); - for (Iterator i = operations.iterator(); i.hasNext();) - { - BindingOperation bindingOperation = (BindingOperation) i.next(); - BindingFault bindingFault = (BindingFault) bindingOperation.getBindingFault(faultName); - if (bindingFault != null) - { - list.add(bindingFault); - } - } - } - } - return list; - } - - protected PortType getEnclosingPortType(Operation operation) - { - return (PortType) operation.eContainer(); - } - - public List getBindings(Operation operation) - { - return getBindings(getEnclosingPortType(operation)); - } - - public List getBindings(PortType portType) - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - for (Iterator j = definition.getBindings().values().iterator(); j.hasNext();) - { - Binding binding = (Binding) j.next(); - if (portType == null || binding.getPortType() == portType) - { - list.add(binding); - } - } - } - return list; - } - - public List getBindingsWithoutOperation(PortType portType, String operationName) - { - List result = new ArrayList(); - if (operationName != null) - { - List bindings = getBindings(portType); - for (Iterator i = bindings.iterator(); i.hasNext();) - { - Binding binding = (Binding) i.next(); - boolean hasName = false; - for (Iterator j = binding.getBindingOperations().iterator(); j.hasNext();) - { - BindingOperation bindingOperation = (BindingOperation) j.next(); - if (operationName.equals(bindingOperation.getName())) - { - hasName = true; - break; - } - } - if (!hasName) - { - result.add(binding); - } - } - } - return result; - } - - public List getBindings() - { - return getBindings((PortType) null); - } - - public List getBindingNames() - { - List list = new ArrayList(); - for (Iterator i = getBindings().iterator(); i.hasNext();) - { - Binding binding = (Binding) i.next(); - list.addAll(getPrefixedNames(binding.getQName())); - } - return list; - } - - public List getPortTypeNames() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - for (Iterator j = definition.getPortTypes().values().iterator(); j.hasNext();) - { - PortType portType = (PortType) j.next(); - list.addAll(getPrefixedNames(portType.getQName())); - } - } - return list; - } - - public List getServices() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - list.addAll(definition.getEServices()); - } - return list; - } - - public List getPortTypes() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - list.addAll(definition.getEPortTypes()); - } - return list; - } - - public List getMessages() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - list.addAll(definition.getEMessages()); - } - return list; - } - - public List getTypes() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - if (definition.getETypes() != null) - { - list.add(definition.getETypes()); - } - } - return list; - } - - public List getMessageNames() - { - List list = new ArrayList(); - for (Iterator i = getDefinitions().iterator(); i.hasNext();) - { - Definition definition = (Definition) i.next(); - for (Iterator j = definition.getMessages().values().iterator(); j.hasNext();) - { - Message message = (Message) j.next(); - list.addAll(getPrefixedNames(message.getQName())); - } - } - return list; - } - - public List getDefinitions() - { - List list = new ArrayList(); - addDefinition(rootDefinition, list); - return list; - } - - /** - * @deprecated -- we should always use getPrefixedNames - */ - public String getPrefixedName(QName qname) - { - String name = null; - if (qname != null) - { - String prefix = rootDefinition.getPrefix(qname.getNamespaceURI()); - if (prefix != null) - { - name = prefix + ":" + qname.getLocalPart(); //$NON-NLS-1$ - } - } - return name; - } - - public List getPrefixedNames(QName qname) - { - List list = new ArrayList(); - if (qname != null) - { - Map map = rootDefinition.getNamespaces(); - for (Iterator i = map.keySet().iterator(); i.hasNext();) - { - String prefix = (String) i.next(); - String namespace = (String) map.get(prefix); - if (namespace != null && namespace.equals(qname.getNamespaceURI())) - { - String name = prefix.length() > 0 ? prefix + ":" + qname.getLocalPart() : //$NON-NLS-1$ - qname.getLocalPart(); - list.add(name); - } - } - } - return list; - } - - protected void addDefinition(Definition definition, List list) - { - if (definition != null) - { - list.add(definition); - for (Iterator i = definition.getEImports().iterator(); i.hasNext();) - { - ImportImpl theImport = (ImportImpl) i.next(); - if (theImport.getLocationURI() != null && !theImport.getLocationURI().endsWith("xsd")) //$NON-NLS-1$ - { - theImport.importDefinitionOrSchema(); - Definition importedDefinition = (Definition) theImport.getEDefinition(); - if (importedDefinition != null && !list.contains(importedDefinition)) - { - addDefinition(importedDefinition, list); - } - } - } - } - } - - public static String getPortTypeReference(Binding binding) - { - String result = null; - Element element = WSDLEditorUtil.getInstance().getElementForObject(binding); - if (element != null) - { - result = element.getAttribute("type"); //$NON-NLS-1$ - } - return result; - } - - public static void setPortTypeReference(Binding binding, String portType) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(binding); - if (element != null) - { - element.setAttribute("type", portType); //$NON-NLS-1$ - } - } - - public static String getBindingReference(Port port) - { - String result = null; - Element element = WSDLEditorUtil.getInstance().getElementForObject(port); - if (element != null) - { - result = element.getAttribute("binding"); //$NON-NLS-1$ - } - return result; - } - - public static String getName(Binding binding) - { - String result = null; - Element element = WSDLEditorUtil.getInstance().getElementForObject(binding); - if (element != null) - { - result = element.getAttribute("name"); //$NON-NLS-1$ - } - return result; - } - - public static QName getPortTypeReferenceQName(Binding binding) - { - QName result = null; - Definition definition = binding.getEnclosingDefinition(); - String prefixedName = getPortTypeReference(binding); - if (prefixedName != null) - { - result = WSDLEditorUtil.createQName(definition, prefixedName); - } - return result; - } - - public static QName getBindingReferenceQName(Port port) - { - QName result = null; - Definition definition = port.getEnclosingDefinition(); - String prefixedName = getBindingReference(port); - if (prefixedName != null) - { - result = WSDLEditorUtil.createQName(definition, prefixedName); - } - return result; - } - - public static String getMessageReference(Input input) - { - return getMessageReferenceHelper(input); - } - - public static String getMessageReference(Output output) - { - return getMessageReferenceHelper(output); - } - - public static String getMessageReference(Fault fault) - { - return getMessageReferenceHelper(fault); - } - - public static QName getMessageReferenceQName(Input input) - { - return getMessageReferenceQNameHelper(input); - } - - public static QName getMessageReferenceQName(Output output) - { - return getMessageReferenceQNameHelper(output); - } - - public static QName getMessageReferenceQName(Fault fault) - { - return getMessageReferenceQNameHelper(fault); - } - - protected static String getMessageReferenceHelper(WSDLElement o) - { - String result = null; - Element element = WSDLEditorUtil.getInstance().getElementForObject(o); - if (element != null) - { - result = element.getAttribute("message"); //$NON-NLS-1$ - } - return result; - } - - public static QName getMessageReferenceQNameHelper(WSDLElement o) - { - QName result = null; - Definition definition = o.getEnclosingDefinition(); - String prefixedName = getMessageReferenceHelper(o); - if (prefixedName != null) - { - result = WSDLEditorUtil.createQName(definition, prefixedName); - } - return result; - } - - public static void updatePortTypeReferences(Definition definition) - { - for (Iterator i = definition.getBindings().values().iterator(); i.hasNext();) - { - Binding binding = (Binding) i.next(); - QName qname = ComponentReferenceUtil.getPortTypeReferenceQName(binding); - - PortType portType = (qname != null) ? (PortType) definition.getPortType(qname) : null; - - if (binding.getPortType() != portType) - { - binding.setPortType(portType); - } - } - } - - public static void updateBindingReferences(Definition definition) - { - for (Iterator i = definition.getServices().values().iterator(); i.hasNext();) - { - Service service = (Service) i.next(); - for (Iterator j = service.getEPorts().iterator(); j.hasNext();) - { - Port port = (Port) j.next(); - QName qname = ComponentReferenceUtil.getBindingReferenceQName(port); - - Binding binding = (qname != null) ? (Binding) definition.getBinding(qname) : null; - - if (port.getBinding() != binding) - { - port.setBinding(binding); - } - } - } - } - - public static void updateMessageReferences(Definition definition) - { - // for each port type - // - for (Iterator i = definition.getPortTypes().values().iterator(); i.hasNext();) - { - PortType portType = (PortType) i.next(); - - // for each operation - // - for (Iterator j = portType.getEOperations().iterator(); j.hasNext();) - { - Operation operation = (Operation) j.next(); - - // handle Input - // - Input input = (Input) operation.getInput(); - if (input != null) - { - QName qname = ComponentReferenceUtil.getMessageReferenceQName(input); - Message message = (qname != null) ? (Message) definition.getMessage(qname) : null; - if (input.getMessage() != message) - { - input.setMessage(message); - } - } - - // handle Output - // - Output output = (Output) operation.getOutput(); - if (output != null) - { - QName qname = ComponentReferenceUtil.getMessageReferenceQName(output); - Message message = (qname != null) ? (Message) definition.getMessage(qname) : null; - if (output.getMessage() != message) - { - output.setMessage(message); - } - } - - // handle Faults - // - for (Iterator k = operation.getEFaults().iterator(); k.hasNext();) - { - Fault fault = (Fault) k.next(); - - QName qname = ComponentReferenceUtil.getMessageReferenceQName(fault); - Message message = (qname != null) ? (Message) definition.getMessage(qname) : null; - if (fault.getMessage() != message) - { - fault.setMessage(message); - } - } - } - } - } - - public static void updateSchemaReferences(Definition definition) - { - for (Iterator i = definition.getEMessages().iterator(); i.hasNext();) - { - Message message = (Message) i.next(); - for (Iterator j = message.getEParts().iterator(); j.hasNext();) - { - Part part = (Part) j.next(); - Element element = WSDLEditorUtil.getInstance().getElementForObject(part); - if (element != null) - { - ((WSDLElementImpl)part).elementChanged(element); - } - } - } - } - - public static Operation getOperation(PortType portType, BindingOperation bindingOperation) - { - Operation result = null; - for (Iterator i = portType.getEOperations().iterator(); i.hasNext();) - { - Operation operation = (Operation) i.next(); - if (isMatchingBinding(operation, bindingOperation)) - { - result = operation; - break; - } - } - return result; - } - - public static void updateOperationReference(BindingOperation bindingOperation) - { - Operation operation = computeOperation(bindingOperation); - if (operation != bindingOperation.getOperation()) - { - bindingOperation.setOperation(operation); - } - } - - public List getComponentNameList(boolean isType) - { - List result = Collections.EMPTY_LIST; - ITypeSystemProvider typeSystemProvider = WSDLEditorUtil.getInstance().getTypeSystemProvider(rootDefinition); - if (typeSystemProvider != null) - { - result = isType ? typeSystemProvider.getAvailableTypeNames(rootDefinition, 0) : typeSystemProvider.getAvailableElementNames(rootDefinition); - } - return result; - } - - public static List getComponentNameList(Part part, boolean isType) - { - List result = Collections.EMPTY_LIST; - Definition definition = part.getEnclosingDefinition(); - ITypeSystemProvider typeSystemProvider = WSDLEditorUtil.getInstance().getTypeSystemProvider(definition); - if (typeSystemProvider != null) - { - result = isType ? typeSystemProvider.getAvailableTypeNames(definition, 0) : typeSystemProvider.getAvailableElementNames(definition); - } - return result; - } - - public static boolean isType(Part part) - { - //Element element = WSDLEditorUtil.getInstance().getElementForObject(part); - Element element = part.getElement(); - return !element.hasAttribute("element"); //$NON-NLS-1$ - } - - public static String getPartComponentReference(Part part) - { - //Element element = WSDLEditorUtil.getInstance().getElementForObject(part); - Element element = part.getElement(); - String result = null; - if (element.hasAttribute("type")) //$NON-NLS-1$ - { - result = element.getAttribute("type"); //$NON-NLS-1$ - } - else if (element.hasAttribute("element")) //$NON-NLS-1$ - { - result = element.getAttribute("element"); //$NON-NLS-1$ - } - return result; - } - - public static void setComponentReference(Part part, boolean isType, String componentName) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(part); - String newAttribute = isType ? "type" : "element"; //$NON-NLS-1$ //$NON-NLS-2$ - String oldAttribute = isType ? "element" : "type"; //$NON-NLS-1$ //$NON-NLS-2$ - element.removeAttribute(oldAttribute); - - String value = componentName != null ? componentName : element.getAttribute(newAttribute); - - if (value == null) - { - if (isType) - { - String xsdPrefix = part.getEnclosingDefinition().getPrefix(WSDLConstants.XSD_NAMESPACE_URI); - value = "string"; //$NON-NLS-1$ - if (xsdPrefix != null && xsdPrefix.length() > 0) - { - value = xsdPrefix + ":" + value; //$NON-NLS-1$ - } - } - else - { - List list = getComponentNameList(part, isType); - value = list.size() > 0 ? (String) list.get(0) : "some-element-name"; //$NON-NLS-1$ - } - } - element.setAttribute(newAttribute, value); - } - - public static Operation computeOperation(BindingOperation bindingOperation) - { - Operation result = null; - Binding binding = (Binding) bindingOperation.eContainer(); - PortType portType = (PortType) binding.getPortType(); - if (portType != null) - { - result = getOperation(portType, bindingOperation); - } - return result; - } - - public static Input computeInput(BindingInput bindingInput) - { - Operation operation = computeOperation((BindingOperation) bindingInput.eContainer()); - return operation != null ? operation.getEInput() : null; - } - - public static Output computeOutput(BindingOutput bindingOutput) - { - Operation operation = computeOperation((BindingOperation) bindingOutput.eContainer()); - return operation != null ? operation.getEOutput() : null; - } - - public static Fault computeFault(BindingFault bindingFault) - { - Fault result = null; - Operation operation = computeOperation((BindingOperation) bindingFault.eContainer()); - if (operation != null) - { - for (Iterator i = operation.getEFaults().iterator(); i.hasNext();) - { - Fault fault = (Fault) i.next(); - String faultName = fault.getName(); - if (faultName != null && faultName.equals(bindingFault.getName())) - { - result = fault; - break; - } - } - } - return result; - } - - public static String getPartReferenceValue(Part part) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(part); - String value = null; - if (element != null) - { - if (element.hasAttribute("type")) //$NON-NLS-1$ - { - value = element.getAttribute("type"); //$NON-NLS-1$ - } - else if (element.hasAttribute("element")) //$NON-NLS-1$ - { - value = element.getAttribute("element"); //$NON-NLS-1$ - } - } - return value != null ? value : ""; //$NON-NLS-1$ - } - - public Operation getBindingOperation(Element bindingOperationContent) - { - Operation operation = null; - Node parent = bindingOperationContent.getParentNode(); - if (parent instanceof Element) - { - Object object = WSDLEditorUtil.getInstance().findModelObjectForElement(rootDefinition, (Element) parent); - if (object instanceof BindingOperation) - { - operation = ComponentReferenceUtil.computeOperation((BindingOperation) object); - } - } - return operation; - } - - public Message getBindingOperationInputMessage(Element bindingOperationContent) - { - Message message = null; - Operation operation = getBindingOperation(bindingOperationContent); - if (operation != null) - { - Input input = operation.getEInput(); - if (input != null) - { - message = input.getEMessage(); - } - } - return message; - } - - public Message getBindingOperationOutputMessage(Element bindingOperationContent) - { - Message message = null; - Operation operation = getBindingOperation(bindingOperationContent); - if (operation != null) - { - Output output = operation.getEOutput(); - if (output != null) - { - message = output.getEMessage(); - } - } - return message; - } - - public static String computeRelativeURI(IFile referencedLocation, IFile baseLocation, boolean enableIEStyleReferences) - { - // TODO... we need some extension to allow IE folks to plugin logic to create an 'IE' style path - // TODO... consider using URI class in EMF - return URIHelper.getRelativeURI(referencedLocation.getLocation(), baseLocation.getLocation()); - } - - public static String computeRelativeURI(String referencedLocation, String baseLocation, boolean enableIEStyleReferences) - { - // TODO... we need some extension to allow IE folks to plugin logic to create an 'IE' style path - // TODO... consider using URI class in EMF - return URIHelper.getRelativeURI(referencedLocation, baseLocation); - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/CreateWSDLElementHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/CreateWSDLElementHelper.java deleted file mode 100644 index 9dae33588..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/CreateWSDLElementHelper.java +++ /dev/null @@ -1,351 +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.util; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.internal.impl.MessageReferenceImpl; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.wst.wsdl.ui.internal.commands.AddBindingCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddFaultCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddInputCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddMessageCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOperationCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddOutputCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddPartCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddPortCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddPortTypeCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddServiceCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDElementDeclarationCommand; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.eclipse.wst.xml.core.internal.provisional.format.FormatProcessorXML; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; -import org.w3c.dom.Element; - -public class CreateWSDLElementHelper { - // Constants used for getting Part information - public static final String PART_INFO_ELEMENT_DECLARATION = "ELEMENT_DECLARATION"; //$NON-NLS-1$ - public static final String PART_INFO_TYPE_DEFINITION = "TYPE_DEFINITION"; //$NON-NLS-1$ - - // The following variables should be set if a name other than the computed name is to be used. - public static String serviceName = null; - public static String portName = null; - public static String bindingName = null; - public static String portTypeName = null; - public static String operationName = null; - public static String inputName = null; - public static String outputName = null; - public static String faultName = null; - public static String messageName = null; - public static String partName = null; - - public static String PART_TYPE_OR_DEFINITION = PART_INFO_TYPE_DEFINITION; - public static boolean CREATE_DOWN_TO_PART = true; - -/* - * The following methods creates the 'specified' (by calling a certain method) WSDLElement - * and it's 'children' all the way to the PortType level. - */ - public static Service createService(Definition definition) { - if (serviceName == null || serviceName.trim().equals("")) //$NON-NLS-1$ - serviceName = NameUtil.buildUniqueServiceName(definition); - - CreateWSDLElementHelper.portTypeName = serviceName; - - AddServiceCommand addService = new AddServiceCommand(definition, serviceName, false); - addService.run(); - Service service = (Service) addService.getWSDLElement(); - CreateWSDLElementHelper.createPort(service); - - return service; - } - - public static Port createPort(Service service) { - if (portName == null || portName.trim().equals("")) //$NON-NLS-1$ - portName = NameUtil.buildUniquePortName(service, null); - - AddPortCommand addPort = new AddPortCommand(service, portName); - addPort.run(); - Port port = (Port) addPort.getWSDLElement(); - Binding binding = CreateWSDLElementHelper.createBinding(port.getEnclosingDefinition(), port); - - port.setBinding(binding); - - return port; - } - - public static Binding createBinding(Definition definition, Port port) { - bindingName = port.getName(); - if (bindingName == null || bindingName.trim().equals("")) //$NON-NLS-1$ - bindingName = NameUtil.buildUniqueBindingName(definition, null); - - AddBindingCommand addBinding = new AddBindingCommand(definition, bindingName); - addBinding.run(); - Binding binding = (Binding) addBinding.getWSDLElement(); - PortType portType = CreateWSDLElementHelper.createPortType(binding.getEnclosingDefinition()); - - binding.setPortType(portType); - - return binding; - } - - public static PortType createPortType(Definition definition) { - if (portTypeName == null || portTypeName.trim().equals("")) //$NON-NLS-1$ - portTypeName = NameUtil.buildUniquePortTypeName(definition, "PortType"); //$NON-NLS-1$ - - AddPortTypeCommand addPortTypeCommand = new AddPortTypeCommand(definition, portTypeName); - addPortTypeCommand.run(); - PortType portType = (PortType) addPortTypeCommand.getWSDLElement(); - - if (CREATE_DOWN_TO_PART) { - CreateWSDLElementHelper.createOperation(portType); - } - - return portType; - } - - -/* - * The following methods creates the 'specified' (by calling a certain method) WSDLElement - * and it's 'children' all the way to the Part level. - */ - public static Operation createOperation(PortType portType) { - if (operationName == null || operationName.trim().equals("")) //$NON-NLS-1$ - operationName = NameUtil.buildUniqueOperationName(portType); - - AddOperationCommand action = new AddOperationCommand(portType, operationName); - action.run(); - Operation operation = (Operation) action.getWSDLElement(); - CreateWSDLElementHelper.createOutput(portType, operation); - CreateWSDLElementHelper.createInput(portType, operation, null); - -// ((PortTypeImpl) portType).updateElement(false); - return operation; - } - - public static Input createInput(PortType portType, Operation operation, String inputName) { - if (inputName == null || inputName.trim().equals("")) //$NON-NLS-1$ - inputName = NameUtil.buildUniqueInputName(portType, operation.getName(), ""); //$NON-NLS-1$ - - AddInputCommand action = new AddInputCommand(operation, inputName); - action.run(); - Input input = (Input) action.getWSDLElement(); - Message mess = CreateWSDLElementHelper.createMessage(input); - input.setMessage(mess); - - return input; - } - - public static Output createOutput(PortType portType, Operation operation) { - if (outputName == null || outputName.trim().equals("")) //$NON-NLS-1$ - outputName = NameUtil.buildUniqueOutputName(portType, operation.getName(), ""); //$NON-NLS-1$ - - AddOutputCommand action = new AddOutputCommand(operation, outputName); - action.run(); - Output output = (Output) action.getWSDLElement(); - Message mess = CreateWSDLElementHelper.createMessage(output); - output.setMessage(mess); - - return output; - } - - public static Fault createFault(Operation operation) { - if (faultName == null || faultName.trim().equals("")) //$NON-NLS-1$ - faultName = NameUtil.buildUniqueFaultName(operation); - - AddFaultCommand action = new AddFaultCommand(operation, faultName); - action.run(); - Fault fault = (Fault) action.getWSDLElement(); - Message mess = CreateWSDLElementHelper.createMessage(fault); - fault.setMessage(mess); - - return fault; - } - - public static Message createMessage(MessageReference iof) { - if (messageName == null || messageName.trim().equals("")) //$NON-NLS-1$ - messageName = NameUtil.buildUniqueMessageName(iof.getEnclosingDefinition(), iof); -// messageName = NameUtil.buildMessageName(iof.getName()); - - Definition def = iof.getEnclosingDefinition(); - AddMessageCommand action = new AddMessageCommand(def, messageName); - action.run(); - Message message = (Message) action.getWSDLElement(); - CreateWSDLElementHelper.createPart(message); - Element parentNode = message.getElement(); - if (parentNode instanceof IDOMNode) - { - // format selected node - FormatProcessorXML formatProcessorXML = new FormatProcessorXML(); - formatProcessorXML.formatNode((IDOMNode)parentNode); - } - - messageName = null; - return message; - } - - public static Part createPart(Message message) { - Definition def = message.getEnclosingDefinition(); - String name = NameUtil.buildUniquePartName(message, message.getQName().getLocalPart()); - AddPartCommand action = null; - - if (PART_TYPE_OR_DEFINITION == PART_INFO_TYPE_DEFINITION) { - action = new AddPartCommand(message, name, WSDLConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string", true); //$NON-NLS-1$ - } - else if (PART_TYPE_OR_DEFINITION == PART_INFO_ELEMENT_DECLARATION) { - //action = new AddPartCommand(message, name, WSDLConstants.SCHEMA_FOR_SCHEMA_URI_2001, "string", true); - String elementName = getNewNameHelper(name, def, false); - AddXSDElementDeclarationCommand elementAction = new AddXSDElementDeclarationCommand(def, elementName); - elementAction.run(); - action = new AddPartCommand(message, name, def.getTargetNamespace(), elementName, false); - } - - action.run(); - - return (Part) action.getWSDLElement(); - } - - /* - * Used to determine a name for an Element - */ - private static String getNewNameHelper(String base, Definition def, boolean isType) - { - String name = base; - int count = 0; - - // Ugly.... Redo this... - // Get a list of Elements... - List elementList = null; - if (def.getETypes() != null) { - List xsdsList = def.getETypes().getEExtensibilityElements(); - if (xsdsList != null) { - Iterator xsdsIterator = xsdsList.iterator(); - XSDSchemaExtensibilityElement xsdElement = (XSDSchemaExtensibilityElement) xsdsIterator.next(); - XSDSchema schema = xsdElement.getSchema(); - if (schema != null) { - elementList = schema.getElementDeclarations(); - } - } - } - - if (elementList != null) { - int index = 0; - while (index < elementList.size()) { - XSDElementDeclaration elementDeclaration = (XSDElementDeclaration) elementList.get(index); - - if (name.equals(elementDeclaration.getName())) { - count++; - name = name + count; - index = 0; - } - else { - index++; - } - } - } - - return name; - } - - /* - * Return the type of Part this WSDLElement should have (Element vs Type). To determine this, we filter up to the 'parent' PortType - * and go down to the first Part we encounter and check the type it has. If this fails, default to Type. - */ - public static String getPartInfo(WSDLElement element) { - String partInfo = null; - - if (element instanceof PortType) { - partInfo = getPartInfo((PortType) element); - } - else if (element instanceof Operation) { - partInfo = getPartInfo(((WSDLElementImpl) element).getContainer()); - } - else if (element instanceof MessageReferenceImpl) { - partInfo = getPartInfo(((WSDLElementImpl) element).getContainer()); - } - - if (partInfo == null) { - partInfo = CreateWSDLElementHelper.PART_INFO_TYPE_DEFINITION; - } - - return partInfo; - } - - private static String getPartInfo(PortType portType) { - String partInfo = null; - - if (portType.getOperations() != null) { - Iterator operationIt = portType.getOperations().iterator(); - while (operationIt.hasNext()) { - Operation op = (Operation) operationIt.next(); - - if (op.getEInput() != null) { - partInfo = getMessageRefPartInfo((MessageReferenceImpl) op.getEInput()); - } - - if (partInfo == null && op.getEOutput() != null) { - partInfo = getMessageRefPartInfo((MessageReferenceImpl) op.getEOutput()); - } - - if (op.getEFaults() != null) { - Iterator faultIt = op.getEFaults().iterator(); - while (partInfo == null && faultIt.hasNext()) { - Fault fault = (Fault) faultIt.next(); - partInfo = getMessageRefPartInfo((MessageReferenceImpl) fault); - } - } - - if (partInfo != null) - break; - } - } - - return partInfo; - } - - private static String getMessageRefPartInfo(MessageReferenceImpl iof) { - String partInfo = null; - - if (iof.getEMessage() != null && iof.getEMessage().getEParts() != null) { - Iterator partIt = iof.getEMessage().getEParts().iterator(); - - while (partInfo == null && partIt.hasNext()) { - Part part = (Part) partIt.next(); - - if (part.getTypeDefinition() != null) { - partInfo = CreateWSDLElementHelper.PART_INFO_TYPE_DEFINITION; - } - else if (part.getElementDeclaration() != null) { - partInfo = CreateWSDLElementHelper.PART_INFO_ELEMENT_DECLARATION; - } - } - } - - return partInfo; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NameUtil.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NameUtil.java deleted file mode 100644 index b4131578a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NameUtil.java +++ /dev/null @@ -1,576 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDSchema; - -public class NameUtil -{ - /** - * Return a name which is not used by any other fault in the operation. - * @return String - */ - public static String buildUniqueFaultName(Operation operation) - { - return buildUniqueFaultName(operation, "NewFault"); //$NON-NLS-1$ - } - - public static String buildUniqueFaultName(Operation operation, String baseName) { - if (baseName == null) - baseName = "NewFault"; //$NON-NLS-1$ - - List names = getUsedFaultNames(operation); - - // Now search the list until we find an unused name - return getUniqueNameHelper(baseName, names); - } - - /** - * Return a name which is not used by any other input in the portType. Returned name will be of the form: - * <operationName> + <ending> [+ unique Integer] - * @return String - */ - public static String buildUniqueInputName(PortType portType, String operationName, String ending) - { - String name = null; - String candidate = operationName + ending; - - int i = 0; - - // loop until we find a unique name (the name will consist of the operationName + ending + an integer) - while (name == null) - { - boolean unique = true; - - // determine if this combination is unique within the current porttype - for (Iterator it = portType.getEOperations().iterator(); it.hasNext() && unique;) - { - Operation current = (Operation) it.next(); - // TODO : port check - // old if(current.isSetEInput() && current.getEInput().isSetName()) { - if (current.getEInput() != null && current.getEInput().getName() != null) - { - if (current.getEInput().getName().equals(candidate)) - unique = false; - } - } - if (unique) - name = candidate; - else - candidate = operationName + ending + i; - i++; - } - return name; - } - - /** - * Return a name which is not used by any other message in the definition. - * @return String - */ - public static String buildUniqueMessageName(Definition definition, String baseName) - { - if (baseName == null) - { - baseName = "NewMessage"; //$NON-NLS-1$ - } - - List names = getUsedMessageNames(definition); - - // Now search the list until we find an unused name - return getUniqueNameHelper(baseName, names); - } - - /** - * Return a name which is not used by any other operation in the port type. - * @return String - */ - public static String buildUniqueOperationName(PortType portType) - { - return buildUniqueOperationName(portType, "NewOperation"); //$NON-NLS-1$ - } - - public static String buildUniqueOperationName(PortType portType, String baseName) - { - if (baseName == null) { - baseName = "NewOperation"; //$NON-NLS-1$ - } - - List names = getUsedOperationNames(portType); - - // Now search the list until we find an unused name - return getUniqueNameHelper(baseName, names); - } - - /** - * Return a name which is not used by any other output in the portType. Returned name will be of the form: - * <operationName> + <ending> [+ unique Integer] - * @return String - */ - public static String buildUniqueOutputName(PortType portType, String operationName, String ending) - { - String name = null; - String candidate = operationName + ending; - - int i = 0; - - // loop until we find a unique name (the name will consist of the operationName + ending + an integer) - while (name == null) - { - boolean unique = true; - - // determine if this combination is unique within the current porttype - for (Iterator it = portType.getEOperations().iterator(); it.hasNext() && unique;) - { - Operation current = (Operation) it.next(); - // TODO: port check - // old if(current.isSetEOutput() && current.getEOutput().isSetName()) { - if (current.getEOutput() != null && current.getEOutput().getName() != null) - { - if (current.getEOutput().getName().equals(candidate)) - unique = false; - } - } - if (unique) - name = candidate; - else - candidate = operationName + ending + i; - i++; - } - return name; - } - - /** - * Return a name which is not used by any other part in the message. - * @return String - */ - public static String buildUniquePartName(Message message) - { - List names = getUsedPartNames(message); - - // Now search the list until we find an unused name - return getUniqueNameHelper("NewPart", names); //$NON-NLS-1$ - } - - public static String buildUniquePartName(Message message, String baseName) - { - if (baseName == null) - { - baseName = "NewPart"; //$NON-NLS-1$ - } - - List names = getUsedPartNames(message); - - // Now search the list until we find an unused name - return getUniqueNameHelper(baseName, names); - } - - /** - * Return a name which is not used by any other port type in the definition. - * @return String - */ - public static String buildUniquePortTypeName(Definition definition, String baseName) - { - if (baseName == null) - { - baseName = "NewPortType"; //$NON-NLS-1$ - } - - List names = getUsedPortTypeNames(definition); - - // Now search the list until we find an unused name - return getUniqueNameHelper(baseName, names); - } - - public static String getUniqueNameHelper(String baseName, List names) - { - int i = 0; - - String name = baseName; - while (true) - { - if (!names.contains(name)) - { - break; - } - i++; - name = baseName + i; - } - - return name; - } - - /** - * Return a name which is not used by any other service in the definition. - * @return String - */ - public static String buildUniqueServiceName(Definition definition) - { - List names = getUsedServiceNames(definition); - - // Now search the list until we find an unused name - return getUniqueNameHelper("NewService", names); //$NON-NLS-1$ - } - - /** - * Return a name which is not used by any other binding in the definition. - * @return String - */ - public static String buildUniqueBindingName(Definition definition, String baseName) - { - if (baseName == null) - { - baseName = "NewBinding"; //$NON-NLS-1$ - } - - List names = getUsedBindingNames(definition); - - return getUniqueNameHelper(baseName, names); - } - - public static String buildUniquePrefix(Definition definition, String basePrefix) - { - String prefix = basePrefix; - for (int i = 1; definition.getNamespace(prefix) != null; i++) - { - prefix = basePrefix + i; - } - return prefix; - } - - public static String buildUniquePortName(Service service, String baseName) - { - if (baseName == null) - { - baseName = "NewPort"; //$NON-NLS-1$ - } - - List names = getUsedPortNames(service); - - return getUniqueNameHelper(baseName, names); - } - - public static String buildUniqueMessageName(Definition definition, MessageReference messRef) - { - String name = null; - if (messRef instanceof Input) - { - name = createOperationName(messRef, "Request"); //$NON-NLS-1$ - } - else if (messRef instanceof Output) - { - name = createOperationName(messRef, "Response"); //$NON-NLS-1$ - } - else if (messRef instanceof Fault) - { - String faultName = ((Fault) messRef).getName(); - if (faultName == null || faultName.length() == 0) - { - faultName = "Fault"; //$NON-NLS-1$ - } - name = createOperationName(messRef, faultName); - } - - return NameUtil.buildUniqueMessageName(definition, name); - } - - - public static List getUsedFaultNames(Operation operation) { - ArrayList names = new ArrayList(); - for (Iterator i = operation.getEFaults().iterator(); i.hasNext();) - { - Fault fault = (Fault) i.next(); - names.add(fault.getName()); - } - - return names; - } - - public static List getUsedOperationNames(PortType portType) { - ArrayList names = new ArrayList(); - for (Iterator i = portType.getEOperations().iterator(); i.hasNext();) - { - Operation op = (Operation) i.next(); - names.add(op.getName()); - } - - return names; - } - - public static List getUsedPartNames(Message message) { - ArrayList names = new ArrayList(); - for (Iterator i = message.getEParts().iterator(); i.hasNext();) - { - Part part = (Part) i.next(); - names.add(part.getName()); - } - return names; - } - - public static List getUsedPortTypeNames(Definition definition) { - ArrayList names = new ArrayList(); - for (Iterator i = definition.getEPortTypes().iterator(); i.hasNext();) - { - PortType portType = (PortType) i.next(); - // TODO: port check - // if (portType.isSetQName()) - if (portType.getQName() != null) - { - names.add(portType.getQName().getLocalPart()); - } - } - - return names; - - } - public static List getUsedServiceNames(Definition definition) { - // First build a list of names already used - ArrayList names = new ArrayList(); - for (Iterator i = definition.getEServices().iterator(); i.hasNext();) - { - Service service = (Service) i.next(); - // TODO: port check - // if(service.isSetQName()) - if (service.getQName() != null) - names.add(service.getQName().getLocalPart()); - } - - return names; - } - - public static List getUsedMessageNames(Definition definition) { - ArrayList names = new ArrayList(); - for (Iterator i = definition.getEMessages().iterator(); i.hasNext();) - { - Message msg = (Message) i.next(); - // TODO: port check - if (msg.getQName() != null) - // if(msg.isSetQName()) - names.add(msg.getQName().getLocalPart()); - } - - return names; - } - - public static List getUsedBindingNames(Definition definition) { - ArrayList names = new ArrayList(); - for (Iterator i = definition.getEBindings().iterator(); i.hasNext();) - { - Binding binding = (Binding) i.next(); - // TODO: port check - // if (binding.isSetQName()) - if (binding.getQName() != null) - { - names.add(binding.getQName().getLocalPart()); - } - } - - return names; - } - - public static List getUsedPortNames(Service service) { - // First build a list of names already used - ArrayList names = new ArrayList(); - for (Iterator i = service.getEPorts().iterator(); i.hasNext();) - { - Port port = (Port) i.next(); - - if (port.getName() != null) - { - names.add(port.getName()); - } - } - - return names; - } - - private static String createOperationName(Object object, String suffix) - { - String result = null; - if (object instanceof EObject) - { - EObject parent = ((EObject)object).eContainer(); - if (parent instanceof Operation) - { - result = ((Operation)parent).getName(); - } - } - if (result != null) - { - result += suffix; - } - return result; - } - -public static String getMessageName(MessageReference messageRef) { - String messageName = "NewMessage"; //$NON-NLS-1$ - List messageNames = new ArrayList(); - Operation operation = (Operation) messageRef.getContainer(); - Iterator messageIt = operation.getEnclosingDefinition().getEMessages().iterator(); - while (messageIt.hasNext()) { - messageNames.add(((Message) messageIt.next()).getQName().getLocalPart()); - } - - String requestResponseString = getRequestOrResponse(messageRef) + "Msg"; //$NON-NLS-1$ - messageName = getUniqueNameHelper(operation.getName() + requestResponseString, messageNames); - - return messageName; -} - -public static String getPartName(MessageReference messageRef) { - String partName = "NewPart"; //$NON-NLS-1$ - Message message = messageRef.getEMessage(); - - Operation operation = (Operation) messageRef.getContainer(); - String operationName = operation.getName(); - String appendString = ""; //$NON-NLS-1$ - if (messageRef instanceof Input) { - appendString = "Parameters"; //$NON-NLS-1$ - } - else if (messageRef instanceof Output) { - appendString = "Result"; //$NON-NLS-1$ - } - else if (messageRef instanceof Fault) { - appendString = "Fault"; //$NON-NLS-1$ - } - partName = operationName + appendString; - - List usedPartNames = new ArrayList(); - if (message != null) { - Iterator partIt = message.getEParts().iterator(); - while (partIt.hasNext()) { - usedPartNames.add(((Part) partIt.next()).getName()); - } - } - - partName = getUniqueNameHelper(partName, usedPartNames); - - return partName; -} - -public static String getOperationName(PortType portType) { - String operationName = "NewOperation"; //$NON-NLS-1$ - Iterator operationIt = portType.getEOperations().iterator(); - List usedNames = new ArrayList(); - while (operationIt.hasNext()) { - usedNames.add(((Operation) operationIt.next()).getName()); - } - - operationName = getUniqueNameHelper("NewOperation", usedNames); //$NON-NLS-1$ - - return operationName; -} - -public static String getRequestOrResponse(MessageReference messageRef) { - if (messageRef instanceof Input) - { - return "Request"; //$NON-NLS-1$ - } - else if (messageRef instanceof Output) - { - return "Response"; //$NON-NLS-1$ - } - else if (messageRef instanceof Fault) - { - return "_Fault"; //$NON-NLS-1$ - } - - return ""; //$NON-NLS-1$ -} - -public static String getFaultName(Operation operation) { - String faultName = "fault"; //$NON-NLS-1$ - List nameList = new ArrayList(); - Iterator faultIt = operation.getEFaults().iterator(); - while (faultIt.hasNext()) { - nameList.add(((Fault) faultIt.next()).getName()); - } - - faultName = getUniqueNameHelper(faultName, nameList); - - return faultName; -} - -public static String getXSDElementName(String baseName, Object parent) { - String elementName = ""; //$NON-NLS-1$ - - if (parent instanceof XSDSchema) { - elementName = getUniqueNameHelper(baseName, getUsedElementNames((XSDSchema) parent)); - } - else if (parent instanceof XSDModelGroup) { - List existingNames = new ArrayList(); - XSDModelGroup modelGroup = (XSDModelGroup) parent; - Iterator modelGroupIt = modelGroup.getContents().iterator(); - while (modelGroupIt.hasNext()) { - Object item = modelGroupIt.next(); - if (item instanceof XSDParticle) { - XSDParticle existingParticle = (XSDParticle) item; - if (existingParticle.getContent() instanceof XSDElementDeclaration) { - existingNames.add(((XSDElementDeclaration) existingParticle.getContent()).getName()); - } - } - } - - elementName = getUniqueNameHelper(baseName, existingNames); - } - - return elementName; -} - -public static String getXSDComplexTypeName(String baseName, XSDSchema schema) { - String typeName = ""; //$NON-NLS-1$ - List existingNames = new ArrayList(); - - Iterator it = schema.getTypeDefinitions().iterator(); - while (it.hasNext()) { - Object item = it.next(); - if (item instanceof XSDComplexTypeDefinition) { - existingNames.add(((XSDComplexTypeDefinition) item).getName()); - } - } - - typeName = getUniqueNameHelper(baseName, existingNames); - return typeName; -} - -private static List getUsedElementNames(XSDSchema xsdSchema) { - List usedNames = new ArrayList(); - Iterator schemaIt = xsdSchema.getContents().iterator(); - while (schemaIt.hasNext()) { - Object item = schemaIt.next(); - if (item instanceof XSDElementDeclaration) { - usedNames.add(((XSDElementDeclaration) item).getName()); - } - } - - return usedNames; -} -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NodeAssociationManager.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NodeAssociationManager.java deleted file mode 100644 index 37bec3b8e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/NodeAssociationManager.java +++ /dev/null @@ -1,126 +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.util; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.wsdl.ui.internal.extensions.INodeAssociationProvider; -import org.eclipse.wst.wsdl.ui.internal.extensions.WSDLNodeAssociationProvider; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class NodeAssociationManager -{ - protected INodeAssociationProvider provider; - - public NodeAssociationManager() - { - provider = new WSDLNodeAssociationProvider(); - } - - protected INodeAssociationProvider getAppicableProvider(Object object) - { - return provider; - } - - - public Object getModelObjectForNode(Object rootObject, Element targetNode) - { - int currentIndex = 0; - - Element[] elementChain = getParentElementChain((Element)targetNode); - - INodeAssociationProvider p = getAppicableProvider(rootObject); - if (p != null) - { - Node rootObjectNode = p.getNode(rootObject); - - while (currentIndex < elementChain.length) - { - Element e = elementChain[currentIndex]; - if (e == rootObjectNode) - { - currentIndex++; - break; - } - currentIndex++; - } - } - - Object currentObject = rootObject; - int end[] = new int[1]; - - while (currentIndex < elementChain.length) - { - p = getAppicableProvider(currentObject); - if (p != null) - { - end[0] = elementChain.length; - currentObject = p.getModelObject(currentObject, elementChain, currentIndex, end); - - if (currentObject == null) - { - // failure - break; - } - else - { - currentIndex = Math.max(end[0], currentIndex + 1); - } - } - else - { - break; - } - } - - return (currentIndex == elementChain.length) ? currentObject : null; - } - - - public Node getNode(Object modelObject) - { - Node result = null; - if (modelObject instanceof Node) - { - result = (Node)modelObject; - } - else - { - INodeAssociationProvider p = getAppicableProvider(modelObject); - if (p != null) - { - result = p.getNode(modelObject); - } - } - return result; - } - - protected Element[] getParentElementChain(Element element) - { - List list = new ArrayList(); - while (element != null) - { - list.add(0, element); - Node node = element.getParentNode(); - element = (node != null && node.getNodeType() == Node.ELEMENT_NODE) ? (Element)node : null; - } - - int listSize = list.size(); - Element[] result = new Element[listSize]; - for (int i = 0; i < listSize; i++) - { - result[i] = (Element)list.get(i); - } - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/OpenOnSelectionHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/OpenOnSelectionHelper.java deleted file mode 100644 index 1f87ba75c..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/OpenOnSelectionHelper.java +++ /dev/null @@ -1,307 +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.util; - -import java.lang.reflect.Method; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.internal.impl.ImportImpl; -import org.eclipse.wst.wsdl.internal.util.WSDLSwitch; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - - -public class OpenOnSelectionHelper extends WSDLSwitch -{ - Definition definition; - Attr attr = null; - Element element = null; - - public OpenOnSelectionHelper(Definition definition) - { - this.definition = definition; - } - - public void openEditor(EObject eObject) - { - String[] array = computeSpecification(eObject); - if (array != null) - { - openEditor(array[0], array[1]); - } - } - - public void openEditor(Node node) - { - String[] array = computeSpecification(node); - if (array != null) - { - openEditor(array[0], array[1]); - } - } - - protected void openEditor(String resource, String spec) - { - String pattern = "platform:/resource"; //$NON-NLS-1$ - if (resource != null && resource.startsWith(pattern)) - { - try - { - Path path = new Path(resource.substring(pattern.length())); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); - - IWorkbenchPage workbenchPage = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage(); - IEditorPart editorPart = workbenchPage.getActiveEditor(); - - if (editorPart.getEditorInput() instanceof IFileEditorInput && - ((IFileEditorInput)editorPart.getEditorInput()).getFile().equals(file)) - { - workbenchPage.getNavigationHistory().markLocation(editorPart); - } - else - { - try - { - if (resource.endsWith("xsd")) //$NON-NLS-1$ - { - editorPart = workbenchPage.openEditor(new FileEditorInput(file), WSDLEditorPlugin.XSD_EDITOR_ID); - } - else - { - // Since we are already in the wsdleditor - editorPart = workbenchPage.openEditor(new FileEditorInput(file), editorPart.getEditorSite().getId()); - } - } - catch (PartInitException initEx) - { - } - } - - Class theClass = editorPart.getClass(); - Class[] methodArgs = { String.class }; - Method method = theClass.getMethod("openOnSelection", methodArgs); //$NON-NLS-1$ - Object args[] = { spec }; - method.invoke(editorPart, args); - workbenchPage.getNavigationHistory().markLocation(editorPart); - } - catch (Exception e) - { - } - } - } - - public String[] computeSpecification(EObject eObject) - { - String[] result = null; - Object referencedObject = doSwitch(eObject); - if (referencedObject instanceof EObject) - { - EObject referencedEObject = (EObject)referencedObject; - if (referencedEObject != eObject || - referencedEObject.eResource() != definition.eResource()) - { - - Resource resource = referencedEObject.eResource(); - if (resource != null) - { - result = new String[2]; - result[0] = resource.getURI().toString(); - result[1] = resource.getURIFragment(referencedEObject); - } - } - } - return result; - } - - public String[] computeSpecification(Node node) - { - String[] result = null; - switch (node.getNodeType()) - { - case Node.ELEMENT_NODE : - { - element = (Element)node; - break; - } - case Node.ATTRIBUTE_NODE : - { - attr = (Attr)node; - element = attr.getOwnerElement(); - break; - } - case Node.TEXT_NODE : - { - Node parent = node.getParentNode(); - element = (parent instanceof Element) ? (Element)parent : null; - break; - } - } - if (element != null) - { - Object object = WSDLEditorUtil.getInstance().findModelObjectForElement(definition, element); - if (object instanceof EObject) - { - result = computeSpecification((EObject)object); - } - } - return result; - } - - public Object caseBinding(Binding binding) - { - Object result = binding; - if (isMatchingAttribute(WSDLConstants.TYPE_ATTRIBUTE)) - { - result = binding.getEPortType(); - } - return result; - } - - public Object caseDefinition(Definition definition) - { - return definition; - } - - public Object casePart(Part part) - { - Object result = part; - if (attr != null) - { - if (isMatchingAttribute(WSDLConstants.TYPE_ATTRIBUTE)) - { - result = part.getTypeDefinition(); - } - else if (isMatchingAttribute(WSDLConstants.ELEMENT_ATTRIBUTE)) - { - result = part.getElementDeclaration(); - } - } - else if (part.getEnclosingDefinition() == definition) - { - result = part.getTypeDefinition() != null ? (Object)part.getTypeDefinition() : (Object)part.getElementDeclaration(); - } - return result; - } - - public Object casePort(Port port) - { - Object result = port; - if (isMatchingAttribute(WSDLConstants.BINDING_ATTRIBUTE)) - { - result = port.getEBinding(); - - } - return result; - } - - public Object caseFault(Fault fault) - { - Object result = fault; - if (isMatchingAttribute(WSDLConstants.MESSAGE_ATTRIBUTE)) - { - result = fault.getMessage(); - } - return result; - } - - public Object caseInput(Input input) - { - Object result = input; - if (isMatchingAttribute(WSDLConstants.MESSAGE_ATTRIBUTE)) - { - result = input.getMessage(); - } - return result; - } - - public Object caseOutput(Output output) - { - Object result = output; - - if (isMatchingAttribute(WSDLConstants.MESSAGE_ATTRIBUTE)) - { - result = output.getMessage(); - } - return result; - } - - public Object caseImport(Import theImport) - { - Object result = null; - - // For now, look at the file extension. When bugzilla 118293 is fixed, look at - // the Import's eDefinition and eSchema instead. - Path importPath = new Path(theImport.getLocationURI()); - String extension = importPath.getFileExtension(); - if (extension.equalsIgnoreCase("xsd")) { //$NON-NLS-1$ - if (theImport.getESchema() == null) { - ((ImportImpl)theImport).importDefinitionOrSchema(); - } - - result = theImport.getESchema(); - } - else if (extension.equalsIgnoreCase("wsdl")) { //$NON-NLS-1$ - if (theImport.getEDefinition() == null) { - ((ImportImpl)theImport).importDefinitionOrSchema(); - } - - result = theImport.getEDefinition(); - } - - -// if (theImport.getESchema() != null) { -// result = theImport.getESchema(); -// } -// else if (theImport.getEDefinition() != null) { -// result = theImport.getEDefinition(); -// } -// else { -// // Need to resolve imports because the model doesn't automatically -// // do it for us -// ((ImportImpl)theImport).importDefinitionOrSchema(); -// result = theImport.getESchema(); -// } - - return result; - } - - public Object caseWSDLElement(WSDLElement wsdlElement) - { - return wsdlElement; - } - - private boolean isMatchingAttribute(String value) - { - return attr != null && value.equals(attr.getName()); - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ReferenceEditManagerHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ReferenceEditManagerHelper.java deleted file mode 100644 index 63120cfcc..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ReferenceEditManagerHelper.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.util; - -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Binding; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11MessageReference; -import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11ParameterForPart; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.edit.W11BindingReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.W11InterfaceReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.W11MessageReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDElementReferenceEditManager; -import org.eclipse.wst.wsdl.ui.internal.edit.WSDLXSDTypeReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.editor.XSDElementReferenceEditManager; -import org.eclipse.wst.xsd.ui.internal.editor.XSDTypeReferenceEditManager; - -public class ReferenceEditManagerHelper { - - - public static ComponentReferenceEditManager getBindingReferenceEditManager(IASDObject asdObject) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(W11InterfaceReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(W11BindingReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput && asdObject instanceof W11EndPoint) { - WSDLElement element = (WSDLElement) ((W11EndPoint) asdObject).getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new W11BindingReferenceEditManager((W11Description) description, ((IFileEditorInput) input).getFile()); - } - } - - return null; - } - - public static ComponentReferenceEditManager getInterfaceReferenceEditManager(IASDObject asdObject) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(W11InterfaceReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(W11InterfaceReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput && asdObject instanceof W11Binding) { - WSDLElement element = (WSDLElement) ((W11Binding) asdObject ).getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new W11InterfaceReferenceEditManager((W11Description) description, ((IFileEditorInput) input).getFile()); - } - } - - return null; - } - - public static ComponentReferenceEditManager getMessageReferenceEditManager(IASDObject asdObject) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(W11MessageReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(W11MessageReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput && asdObject instanceof W11MessageReference) { - WSDLElement element = (WSDLElement) ((W11MessageReference) asdObject).getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new W11MessageReferenceEditManager((W11Description) description, ((IFileEditorInput) input).getFile()); - } - } - - return null; - } - - public static ComponentReferenceEditManager getXSDElementReferenceEditManager(IASDObject asdObject) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(XSDElementReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(XSDElementReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput && asdObject instanceof W11ParameterForPart) { - WSDLElement element = (WSDLElement) ((W11ParameterForPart) asdObject).getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new WSDLXSDElementReferenceEditManager(((IFileEditorInput) input).getFile(), null, description); - } - } - - return null; - } - - public static ComponentReferenceEditManager getXSDTypeReferenceEditManager(IASDObject asdObject) { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page.getActiveEditor().getAdapter(XSDTypeReferenceEditManager.class) != null) { - return (ComponentReferenceEditManager) page.getActiveEditor().getAdapter(XSDTypeReferenceEditManager.class); - } - else { - IEditorInput input = page.getActiveEditor().getEditorInput(); - if (input instanceof IFileEditorInput && asdObject instanceof IParameter && asdObject instanceof WSDLBaseAdapter) { - WSDLElement element = (WSDLElement) ((WSDLBaseAdapter) asdObject).getTarget(); - IDescription description = (IDescription) WSDLAdapterFactoryHelper.getInstance().adapt(element.getEnclosingDefinition()); - return new WSDLXSDTypeReferenceEditManager(((IFileEditorInput) input).getFile(), null, description); - } - } - - return null; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ValidateHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ValidateHelper.java deleted file mode 100644 index 25d9a633a..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/ValidateHelper.java +++ /dev/null @@ -1,405 +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.util; - -import org.eclipse.wst.common.ui.internal.UIPlugin; -import org.eclipse.wst.wsdl.ui.internal.Messages; - -public class ValidateHelper -{ - // XML Lang can have many different valid formats - // 1) xx ie. en, fr, de - // 2) xx-xx ie. en-US, en-FR - // 3) I-xx ie. I-en - // 4) X-xx ie. X-en - public static String checkXMLLang(String lang) - { - if (lang.length() == 0) - return null; - - if (lang.length() == 1) - { - char ch0 = lang.charAt(0); - if ((ch0 >= 'a' && ch0 <= 'z') || (ch0 >= 'A' && ch0 <= 'Z')) - return UIPlugin.getResourceString("_WARN_LANG_TOO_SHORT"); - else - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch0 + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - } - - int offset; - - char ch0 = lang.charAt(0); - if (lang.charAt(1) == '-') - { - if (ch0 == 'i' || ch0 == 'I' || ch0 == 'x' || ch0 == 'X') - offset = 1; - else - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch0 + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - } - else - { - char ch1 = lang.charAt(1); - if ((ch0 >= 'a' && ch0 <= 'z') || (ch0 >= 'A' && ch0 <= 'Z')) - if ((ch1 >= 'a' && ch1 <= 'z') || (ch1 >= 'A' && ch1 <= 'Z')) - offset = 2; - else - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch1 + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - else - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch0 + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - } - - if (lang.length() > offset) - { - char ch = lang.charAt(offset++); - if (ch != '-') - return UIPlugin.getResourceString("_WARN_HYPHEN_NEEDED") + Integer.toString(offset-1); - else - { - while (true) - { - if (ch == '-') - { - if (lang.length() == offset) - return UIPlugin.getResourceString("_WARN_HYPHEN_ENDING"); - - ch = lang.charAt(offset++); - if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z')) - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - - if (lang.length() == offset) - return null; - } - else if ((ch < 'a' || ch > 'z') && (ch < 'A' || ch > 'Z')) - return UIPlugin.getResourceString("_WARN_NAME_INVALID_CHAR") + ch + - UIPlugin.getResourceString("_UI_NAME_INVALID_CHAR_END"); - else if (lang.length() == offset) - return null; - ch = lang.charAt(offset++); - } - } - } - - return null; - } - - /** - * Check to see if the min value is correct. - * A minimum value must be non-negative and < maxValue - */ - public static String isValidMinValue(String minValue, String maxValue) - { - int min; - - if (minValue == null || minValue.equals("")) //$NON-NLS-1$ - { - // Nothing to check - return null; - } - - try - { - min = Integer.parseInt(minValue); - } - catch (NumberFormatException ex) - { - return UIPlugin.getResourceString("_ERROR_MIN_NOT_POSITIVE"); - } - - if (min < 0) - { - return UIPlugin.getResourceString("_ERROR_MIN_NOT_POSITIVE"); - } - - try - { - int max = Integer.parseInt(maxValue); - if (min > max) - { - return UIPlugin.getResourceString("_ERROR_MIN_VALUE"); - } - } - catch (NumberFormatException ex) - { - // Max is not accurate. Don't compare it. - } - return null; - } - - /** - * Check to see if the max value is correct. - * A maximum value must be non-negative and > minValue - * - * It can also be set the string "unbounded" - */ - public static String isValidMaxValue(String maxValue, String minValue) - { - int max; - - if (maxValue == null || maxValue.equals("")) //$NON-NLS-1$ - { - // Nothing to check - return null; - } - - if (maxValue.equals("unbounded")) //$NON-NLS-1$ - { - return null; - } - - try - { - max = Integer.parseInt(maxValue); - } - catch (NumberFormatException ex) - { - return UIPlugin.getResourceString("_ERROR_MAX_NOT_POSITIVE"); - } - - if (max < 0) - { - return UIPlugin.getResourceString("_ERROR_MAX_NOT_POSITIVE"); - } - - try - { - int min = Integer.parseInt(minValue); - if (max < min) - { - return UIPlugin.getResourceString("_ERROR_MAX_VALUE"); - } - } - catch (NumberFormatException ex) - { - // Min is not accurate. Don't compare it. - } - return null; - } - - /** - * Validate the name conforms to the XML spec - */ - public static String checkXMLName(String name, boolean allowEntityRef) - { - int length = name.length(); - char character; - - if (length == 0) - { - return Messages.getString("_WARN_NAME_MUST_CONTAIN_AT_LEAST_ONE_CHAR"); //$NON-NLS-1$ - } - - if (name.indexOf(" ") >= 0) //$NON-NLS-1$ - { - return(Messages.getString("_WARN_NAME_HAS_SPACE")); //$NON-NLS-1$ - } - - int index = 0; - if (length > 0 && - name.charAt(0) == '%') - { - if (allowEntityRef) - { - // skip over the first character - index++; - } // end of if () - else - { - return Messages.getString("_WARN_NAME_INVALID_FIRST"); //$NON-NLS-1$ - } // end of else - } - - for(; index < length; index++) - { - character = name.charAt(index); - - if(index == 0) - { - if( !isXMLNameStart(character) ) - { - return Messages.getString("_WARN_NAME_INVALID_FIRST"); //$NON-NLS-1$ - } - } - else - { - if(!isXMLNameChar(character)) - { - if ((index == length - 1) && //check if the last character is a ';' - allowEntityRef && - character == ';') - { - // we're still ok then - continue; - } // end of if () - else - { - return Messages.getString("_WARN_NAME_INVALID_CHAR") + character + //$NON-NLS-1$ - Messages.getString("_UI_NAME_INVALID_CHAR_END"); //$NON-NLS-1$ - } // end of else - } - } - } - return null; - } - - /** - * Validate the name conforms to the XML spec - */ - public static String checkXMLName(String name) - { - return checkXMLName(name, false); - } - - /** - * isXMLNameStart - **/ - private static boolean isXMLNameStart(char ch) - { - return (ch == '_' || ch == ':' || Character.isLetter(ch) ); - } - - /** - * isXMLNameChar - **/ - private static boolean isXMLNameChar(char ch) - { - return (Character.isLetterOrDigit(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':'); - } - - /** - * isXMLPrefixStart - **/ -// private static boolean isXMLPrefixStart(char ch) -// { -// return (ch == '_' || Character.isLetter(ch) ); -// } - - /** - * isXMLPrefixChar - **/ - private static boolean isXMLPrefixChar(char ch) - { - return (Character.isLetterOrDigit(ch) || ch == '.' || ch == '-' || ch == '_'); - } - - /** - * parseElementText - */ - public static String parseElementText(String text) - { - if (text.indexOf('<') != -1 || text.indexOf('>') != -1) - { - return UIPlugin.getResourceString("_WARN_ELEMENT_INVALID_CHAR"); - } - return null; - } - - /** - * parseAttributeValue - */ - public static String parseAttributeValue(String value) - { - if (value.indexOf('"') != -1 || value.indexOf('<') != -1 || value.indexOf('>') != -1) - { - return UIPlugin.getResourceString("_WARN_ATTRIBUTE_INVALID_CHAR"); - - } - return null; - } - - /** - * parseADATASection - */ - public static String parseCDATASection(String section) - { - if (section.indexOf("]]>") != -1) //$NON-NLS-1$ - { - return UIPlugin.getResourceString("_WARN_CDATA_INVALID_STRING"); - - } - return null; - } - - /** - * parseProcessiingInstruction - */ - public static String parseProcessingInstructionData(String data) - { - if (data.indexOf("?>") != -1) //$NON-NLS-1$ - { - return UIPlugin.getResourceString("_WARN_PROCESSING_INVALID_STRING"); - - } - return null; - } - - /** - * parseProcessingInstructionTarget - */ - public static String parseProcessingInstructionTarget(String target) - { - if (target.length() == 3 && (target.indexOf("XML") != -1 || target.indexOf("XMl") != -1 || target.indexOf("XmL") != -1 || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - target.indexOf("xML") != -1 || target.indexOf("Xml") != -1 || target.indexOf("xMl") != -1 || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - target.indexOf("xmL") != -1 || target.indexOf("xml") != -1)) //$NON-NLS-1$ //$NON-NLS-2$ - { - return UIPlugin.getResourceString("_WARN_PROCESSING_TARGET_INVALID_STRING"); - - } - return checkXMLName(target); - } - - /** - * parsComment - */ - public static String parseComment(String comment) - { - if (comment.indexOf("--") != -1) //$NON-NLS-1$ - { - return UIPlugin.getResourceString("_WARN_COMMENT_INVALID_STRING"); - } - return null; - } - - /** - * Validate the prefix conforms to the XML spec - */ - public static String checkXMLPrefix(String prefix) - { - int length = prefix.length(); - if (length == 0) - { - return null; - } - char character; - - if (prefix.indexOf(" ") >= 0) //$NON-NLS-1$ - { - return(UIPlugin.getResourceString("_WARN_PREFIX_HAS_SPACE")); - } - - for(int index = 0; index < length; index++) - { - character = prefix.charAt(index); - - if(!isXMLPrefixChar(character)) - { - return UIPlugin.getString("_WARN_PREFIX_INVALID_CHAR", String.valueOf(character)); - } - } - return null; - } - -} - diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/W11OpenExternalEditorHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/W11OpenExternalEditorHelper.java deleted file mode 100644 index c8f344525..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/W11OpenExternalEditorHelper.java +++ /dev/null @@ -1,171 +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.util; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter; -import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter; -import org.eclipse.wst.wsdl.ui.internal.asd.util.IOpenExternalEditorHelper; -import org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor; -import org.eclipse.wst.xsd.ui.internal.editor.XSDFileEditorInput; -import org.eclipse.xsd.XSDConcreteComponent; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.util.XSDConstants; - -public class W11OpenExternalEditorHelper implements IOpenExternalEditorHelper { - private Object object; - private IFile wsdlFile; - - public W11OpenExternalEditorHelper(IFile wsdlFile) - { - this.wsdlFile = wsdlFile; - } - - public void setModel(Object object) { - this.object = object; - } - - public void openExternalEditor() { - if (object instanceof WSDLBaseAdapter) { - Object notifier = ((WSDLBaseAdapter) object).getTarget(); - Object openOnModel = getModelToOpenOn(notifier); - - if (openOnModel != null) { - openXSDEditor((XSDConcreteComponent) openOnModel); - } - } - } - - protected XSDSchema getSchema(XSDConcreteComponent xsdComponent) { - XSDSchema schema = xsdComponent.getSchema(); - if (schema == null) { - Object notifier = ((WSDLBaseAdapter) object).getTarget(); - if (notifier instanceof XSDConcreteComponent) { - schema = ((XSDConcreteComponent) notifier).getSchema(); - } - } - - return schema; - } - - protected void openXSDEditor(XSDConcreteComponent xsdComponent) { - XSDSchema schema = getSchema(xsdComponent); - if (schema != null) { - String schemaLocation = URIHelper.removePlatformResourceProtocol(schema.getSchemaLocation()); - IPath schemaPath = new Path(schemaLocation); - IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(schemaPath); - if (file != null && file.exists()) { - IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (workbenchWindow != null) { - IWorkbenchPage page = workbenchWindow.getActivePage(); - try { - XSDFileEditorInput editorInput = new XSDFileEditorInput(file, schema); - - IEditorPart editorPart = null; - - if (isInlineSchema(file)) { - editorInput.setEditorName(Messages.getString("_UI_LABEL_INLINE_SCHEMA_OF") + file.getName()); //$NON-NLS-1$ - IEditorReference [] refs = page.getEditorReferences(); - int length = refs.length; - for (int i = 0; i < length; i++) - { - IEditorInput input = refs[i].getEditorInput(); - if (input instanceof XSDFileEditorInput) - { - IFile aFile = ((XSDFileEditorInput)input).getFile(); - if (aFile.getFullPath().equals(file.getFullPath())) - { - if (((XSDFileEditorInput)input).getSchema() == schema) - { - editorPart = refs[i].getEditor(true); - page.activate(refs[i].getPart(true)); - break; - } - } - } - } - - if (editorPart == null) - { - editorPart = page.openEditor(editorInput, "org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor", true, 0); //$NON-NLS-1$ - } - } - else { - editorPart = page.openEditor(editorInput, "org.eclipse.wst.xsd.ui.internal.editor.InternalXSDMultiPageEditor", true); //$NON-NLS-1$ - } - - if (editorPart instanceof InternalXSDMultiPageEditor) - { - InternalXSDMultiPageEditor xsdEditor = (InternalXSDMultiPageEditor)editorPart; - xsdEditor.openOnGlobalReference(xsdComponent); - } - } - catch (PartInitException pie) { -// Logger.log(Logger.WARNING_DEBUG, pie.getMessage(), pie); - } - } - } - } - } - - public boolean linkApplicable() { - boolean applicable = true; - - if (object instanceof IParameter) { - IParameter param = (IParameter) object; - String prefix = param.getComponentNameQualifier(); - if (prefix != null && prefix.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) { - applicable = false; - } - } - - return applicable; - } - - protected Object getModelToOpenOn(Object object) { - if (object instanceof XSDElementDeclaration) { - return ((XSDElementDeclaration) object).getTypeDefinition(); - } - else if (object instanceof Part) { - Object elementOrType = ((Part) object).getElementDeclaration(); - if (elementOrType == null) { - elementOrType = ((Part) object).getTypeDefinition(); - } - - return elementOrType; - } - - return null; - } - - /** - * @param file - * @return - */ - protected boolean isInlineSchema(IFile file) { - // Should there be a better test for this? The IFiles are different so we can't use file == wsdlFile. - return file.getFullPath().equals(wsdlFile.getFullPath()); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLAdapterFactoryHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLAdapterFactoryHelper.java deleted file mode 100644 index 7874c27aa..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLAdapterFactoryHelper.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.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLAdapterFactory; - -public class WSDLAdapterFactoryHelper { - private static WSDLAdapterFactoryHelper instance; - - private AdapterFactory adapterFactory; - - public static WSDLAdapterFactoryHelper getInstance() { - if (instance == null) { - instance = new WSDLAdapterFactoryHelper(); - } - - return instance; - } - - public Adapter adapt(Notifier target) { - AdapterFactory factory = getWSDLAdapterFactory(); - return factory.adapt(target, factory); - } - - public AdapterFactory getWSDLAdapterFactory() { - if (adapterFactory == null) { - adapterFactory = new WSDLAdapterFactory(); - } - return adapterFactory; - } - - public void setWSDLAdapterFactory(AdapterFactory factory) { - adapterFactory = factory; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLEditorUtil.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLEditorUtil.java deleted file mode 100644 index 6d96fc060..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLEditorUtil.java +++ /dev/null @@ -1,223 +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.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ExtensibleElement; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.ui.internal.extensions.ExtensibleTypeSystemProvider; -import org.eclipse.wst.wsdl.ui.internal.extensions.ITypeSystemProvider; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class WSDLEditorUtil extends WSDLConstants -{ - protected static WSDLEditorUtil instance; - protected NodeAssociationManager nodeAssociationManager = new NodeAssociationManager(); - - protected HashMap elementNameToTypeMap = new HashMap(); - - public static final int ELEMENT = 14; - public static final int TYPE = 15; - - public static WSDLEditorUtil getInstance() - { - if (instance == null) - { - instance = new WSDLEditorUtil(); - } - return instance; - } - - public WSDLEditorUtil() - { - elementNameToTypeMap.put(BINDING_ELEMENT_TAG, new Integer(BINDING)); - elementNameToTypeMap.put(DEFINITION_ELEMENT_TAG, new Integer(DEFINITION)); - elementNameToTypeMap.put(DOCUMENTATION_ELEMENT_TAG, new Integer(DOCUMENTATION)); - elementNameToTypeMap.put(FAULT_ELEMENT_TAG, new Integer(FAULT)); - elementNameToTypeMap.put(IMPORT_ELEMENT_TAG, new Integer(IMPORT)); - elementNameToTypeMap.put(INPUT_ELEMENT_TAG, new Integer(INPUT)); - elementNameToTypeMap.put(MESSAGE_ELEMENT_TAG, new Integer(MESSAGE)); - elementNameToTypeMap.put(OPERATION_ELEMENT_TAG, new Integer(OPERATION)); - elementNameToTypeMap.put(OUTPUT_ELEMENT_TAG, new Integer(OUTPUT)); - elementNameToTypeMap.put(PART_ELEMENT_TAG, new Integer(PART)); - elementNameToTypeMap.put(PORT_ELEMENT_TAG, new Integer(PORT)); - elementNameToTypeMap.put(PORT_TYPE_ELEMENT_TAG, new Integer(PORT_TYPE)); - elementNameToTypeMap.put(SERVICE_ELEMENT_TAG, new Integer(SERVICE)); - elementNameToTypeMap.put(TYPES_ELEMENT_TAG, new Integer(TYPES)); - } - - public int getWSDLType(Element element) - { - int result = -1; - - Integer integer = (Integer)elementNameToTypeMap.get(element.getLocalName()); - if (integer != null) - { - result = integer.intValue(); - } - return result; - } - - protected List getParentElementChain(Element element) - { - List list = new ArrayList(); - while (element != null) - { - list.add(0, element); - Node node = element.getParentNode(); - element = (node != null && node.getNodeType() == Node.ELEMENT_NODE) ? (Element)node : null; - } - return list; - } - - public Object findModelObjectForElement(Definition definition, Element targetElement) - { - Object o = nodeAssociationManager.getModelObjectForNode(definition, targetElement); - return o; - } - - public Element getElementForObject(Object o) - { - return ((org.eclipse.wst.wsdl.WSDLElement)o).getElement(); - } - - public Node getNodeForObject(Object o) - { - return nodeAssociationManager.getNode(o); - } - - // Provide a mapping between Definitions and ITypeSystemProviders - private Hashtable typeSystemProviders = new Hashtable(); - private ITypeSystemProvider typeSystemProvider; - - public ITypeSystemProvider getTypeSystemProvider(Definition definition) - { - if (typeSystemProvider == null) { - typeSystemProvider = new ExtensibleTypeSystemProvider(); - } - return typeSystemProvider; - } - - public void setTypeSystemProvider(Definition definition, ITypeSystemProvider typeSystemProvider) - { - // typeSystemProviders.put(definition,typeSystemProvider); - } - - public static QName createQName(Definition definition, String prefixedName) - { - QName qname = null; - if (prefixedName != null) - { - int index = prefixedName.indexOf(":"); //$NON-NLS-1$ - String prefix = (index == -1) ? null : prefixedName.substring(0, index); - if (prefix != null) - { - String namespace = definition.getNamespace(prefix); - if (namespace != null) - { - String localPart = prefixedName.substring(index + 1); - qname = new QName(namespace, localPart); - } - } - } - return qname; - } - - public List getExtensibilityElementNodes(ExtensibleElement extensibleElement) - { - // For Types, I need to get all the schemas - if (extensibleElement instanceof Types) - { - Types xsdEE = (Types)extensibleElement; - return xsdEE.getSchemas(); - } - /* - List childList = new ArrayList(); - - Element parentElement = getElementForObject(extensibleElement); - if (parentElement != null) - { - - NodeList nodeList = parentElement.getChildNodes(); - int nodeListLength = nodeList.getLength(); - for (int i = 0; i < nodeListLength; i++) - { - childList.add(nodeList.item(i)); - } - HashMap extensibleElementTable = new HashMap(); - for (Iterator i = extensibleElement.getEExtensibilityElements().iterator(); i.hasNext();) - { - ExtensibilityElement extensibilityElement = (ExtensibilityElement)i.next(); - if (extensibilityElement != null) - { - Element element = getElementForObject(extensibilityElement); - if (element != null) - { - extensibleElementTable.put(element, element); - } - } - } - - for (Iterator i = childList.iterator(); i.hasNext();) - { - Object o = i.next(); - if (extensibleElementTable.get(o) == null) - { - i.remove(); - } - } - } - return childList; - */ - return extensibleElement.getEExtensibilityElements(); - } - - /* - * Returns a list of 'children' of the given object model (WSDLElement). - */ - public static List getModelGraphViewChildren(Object object) { - List childList = new ArrayList(); - - if (object instanceof PortType) { - PortType portType = (PortType) object; - childList.addAll(portType.getOperations()); - } - else if (object instanceof Operation) { - Operation operation = (Operation) object; - - if (operation.getEInput() != null) { - childList.add(operation.getEInput()); - } - if (operation.getEOutput() != null) { - childList.add(operation.getEOutput()); - } - childList.addAll(operation.getFaults().values()); - } - else if (object instanceof MessageReference) { - MessageReference messageReference = (MessageReference) object; - childList.add(messageReference.getEMessage()); - } - - return childList; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLResourceUtil.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLResourceUtil.java deleted file mode 100644 index 108c16337..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLResourceUtil.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsdl.ui.internal.util; - -import java.util.Iterator; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.internal.impl.WSDLElementImpl; -import org.eclipse.wst.wsdl.internal.util.WSDLModelLocator; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaDirective; -import org.w3c.dom.Element; - - -public class WSDLResourceUtil -{ - public static void reloadDirectives(Definition definition) - { - Resource rootResource = definition.eResource(); - ResourceSet resourceSet = rootResource.getResourceSet(); - - for (Iterator i = resourceSet.getResources().iterator(); i.hasNext();) - { - Resource resource = (Resource) i.next(); - if (resource != rootResource) - { - // TODO... consider unloading the resources - // resource.unload(); - i.remove(); - } - } - ReloadDirectiveVisitor visitor = new ReloadDirectiveVisitor(); - visitor.visitDefinition(definition); - } - - static class ReloadDirectiveVisitor - { - - public void visitImport(Import theImport) - { - // force the import to reload - Element element = WSDLEditorUtil.getInstance().getElementForObject(theImport); - if (element != null) - { - ((WSDLElementImpl)theImport).elementChanged(element); - } - } - - public void visitXSDSchemaDirective(XSDSchemaDirective directive) - { - // force the schema directive to reload - Element element = directive.getElement(); - if (element != null) - { - directive.elementAttributesChanged(element); - } - } - - public void visitDefinition(Definition definition) - { - if (definition != null) - { - for (Iterator i = definition.getEImports().iterator(); i.hasNext();) - { - visitImport((Import) i.next()); - } - Types types = definition.getETypes(); - if (types != null) - { - - for (Iterator i = types.getEExtensibilityElements().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaExtensibilityElement) - { - XSDSchemaExtensibilityElement e = (XSDSchemaExtensibilityElement) o; - if (e.getSchema() != null) - { - visitSchema(e.getSchema()); - } - } - } - } - } - } - - public void visitSchema(XSDSchema schema) - { - for (Iterator i = schema.getContents().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaDirective) - { - visitXSDSchemaDirective((XSDSchemaDirective) o); - } - } - } - } - - - public static class InternalURIResolver implements WSDLModelLocator - { - //IdResolver idResolver = new IdResolverImpl(null, true); - org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver resolver = URIResolverPlugin.createResolver(); - - InternalURIResolver() - { - } - - public String resolveURI(String baseLocation, String namespace, String location) - { - String resolvedLocation = resolver.resolve(baseLocation, namespace, location); - - // here's an ugly hack... Platform.resolve() returns Windows files with the pattern "file:D:/hello.xsd" - // but EMF's URI class expects a pattern like this "file:///D:/hello.xsd" - // - if (resolvedLocation != null) - { - String fileProtocol = "file:"; //$NON-NLS-1$ - if (resolvedLocation.startsWith(fileProtocol) && !resolvedLocation.startsWith(fileProtocol + "/")) //$NON-NLS-1$ - { - resolvedLocation = resolvedLocation.substring(fileProtocol.length()); - } - resolvedLocation = URIHelper.addImpliedFileProtocol(resolvedLocation); - } - // end ugly hack - return resolvedLocation; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLSetComponentHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLSetComponentHelper.java deleted file mode 100644 index 9609702ae..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/WSDLSetComponentHelper.java +++ /dev/null @@ -1,244 +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.util; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.internal.impl.ImportImpl; -import org.eclipse.wst.wsdl.ui.internal.actions.AddElementDeclarationAction; -import org.eclipse.wst.wsdl.ui.internal.actions.AddImportAction; -import org.eclipse.wst.wsdl.ui.internal.actions.AddWSISchemaImportAction; -import org.eclipse.wst.wsdl.util.WSDLConstants; -import org.eclipse.xsd.XSDImport; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaContent; - -public class WSDLSetComponentHelper { - private Definition definition; - private IFile currentIFile; - - public WSDLSetComponentHelper(IFile iFile, Definition definition) { - currentIFile = iFile; - this.definition = definition; - } - - public void setWSDLComponent(WSDLElement inputElement, String property, ComponentSpecification spec) { - addImportIfNecessary(spec); - String componentObject = getPrefixedComponentName(spec); - - org.w3c.dom.Element wsdlElement = inputElement.getElement(); - - wsdlElement.setAttribute(property, componentObject); //$NON-NLS-1$ - } - - public void setXSDTypeComponent(Part part, ComponentSpecification spec) { - if (spec.getName() != null && spec.getQualifier() != null) { - addImportIfNecessary(spec); - } - String componentObject = getPrefixedComponentName(spec); - - ComponentReferenceUtil.setComponentReference((Part) part, true, componentObject); - } - - public void setXSDElementComponent(Part part, ComponentSpecification spec) { - addImportIfNecessary(spec); - String componentObject = getPrefixedComponentName(spec); - - ComponentReferenceUtil.setComponentReference((Part) part, false, componentObject); - } - - /* - * Return the prefixed component name described by the given - * ComponentSpecification object. - */ - public String getPrefixedComponentName(ComponentSpecification spec) { - String name = (String) spec.getName(); - List prefixes = getPrefixes(definition, spec.getQualifier()); - if (prefixes.size() > 0) { - name = prefixes.get(0) + ":" + name; //$NON-NLS-1$ - } - - return name; - } - - private List getPrefixes(Definition definition, String namespace) { - List list = new ArrayList(); - Map map = definition.getNamespaces(); - for (Iterator i = map.keySet().iterator(); i.hasNext();) { - String prefix = (String) i.next(); - String theNamespace = (String) map.get(prefix); - if (theNamespace != null && theNamespace.equals(namespace)) { - list.add(prefix); - } - } - return list; - } - - - private void addImportIfNecessary(ComponentSpecification spec) { - boolean foundMatch = false; - - // Check itself - Path currentFileLocation = new Path(currentIFile.getLocation().toString()); - if (spec.getFile() == null || currentFileLocation.equals(spec.getFile().getLocation())) { - // if the ComponentSpecification's getFile() returns null, forget about adding necessary imports - foundMatch = true; - } - - // Check regular Imports - if (!foundMatch) { - Iterator importsIt = definition.getEImports().iterator(); - - while (importsIt.hasNext()) { - String importLocation = ""; //$NON-NLS-1$ - ImportImpl importItem = (ImportImpl) importsIt.next(); - importItem.importDefinitionOrSchema(); - - if (importItem.getESchema() != null) { - XSDSchema schema = importItem.getESchema(); - importLocation = getNormalizedLocation(schema.getSchemaLocation()); - } - else { - Definition importDefinition = importItem.getEDefinition(); - importLocation = getNormalizedLocation(importDefinition.getLocation()); - } - - if (importLocation.equals(spec.getFile().getLocation().toOSString())) { - foundMatch = true; - break; - } - } - } - - // Check inline Schemas - if (!foundMatch) { - List imports = new ArrayList(); - - if (definition.getETypes() != null) { - Iterator it = definition.getETypes().getEExtensibilityElements().iterator(); - while (it.hasNext()) { - XSDSchemaExtensibilityElement eeElement = (XSDSchemaExtensibilityElement) it.next(); - XSDSchema schema = eeElement.getSchema(); - if (schema.getTargetNamespace() == null || schema.getTargetNamespace().equals("")) { //$NON-NLS-1$ - Iterator contents = schema.getContents().iterator(); - while (contents.hasNext()) { - XSDSchemaContent content = (XSDSchemaContent) contents.next(); - if (content instanceof XSDImport) { - imports.add(content); - } - } - } - } - } - - Iterator importIt = imports.iterator(); - while (importIt.hasNext()) { - XSDImport importItem = (XSDImport) importIt.next(); - XSDSchema resolvedSchema = importItem.getResolvedSchema(); - String resolvedString = resolvedSchema.getSchemaLocation(); - String importLocation = getNormalizedLocation(resolvedString); - - if (importLocation.equals(spec.getFile().getLocation().toOSString())) { - foundMatch = true; - break; - } - } - } - - if (!foundMatch) { - boolean wsiStyleImport = isXSDSchemaFile(spec); - if (wsiStyleImport) { - AddElementDeclarationAction action = new AddElementDeclarationAction(definition, spec.getQualifier(), "xsd"); //$NON-NLS-1$ - action.run(); - - String location = URIHelper.getRelativeURI(spec.getFile().getLocation(), currentIFile.getLocation()); - AddWSISchemaImportAction addImport = new AddWSISchemaImportAction(definition, spec.getQualifier(), location); - addImport.run(); - } - else { - String newSelectedFileLoc = spec.getFile().getLocation().toOSString(); - String currentFileLoc = getNormalizedLocation(definition.getLocation()); - String relativeLoc = ComponentReferenceUtil.computeRelativeURI(newSelectedFileLoc, currentFileLoc, true); - - org.w3c.dom.Element definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition); - String prefix = definition.getPrefix(WSDLConstants.WSDL_NAMESPACE_URI); - String namespace = spec.getQualifier(); - - AddImportAction addImportAction = new AddImportAction(null, definition, definitionElement, prefix, namespace, relativeLoc); - addImportAction.run(); - - String uniquePrefix = getUniquePrefix(definition, prefix); - definitionElement.setAttribute("xmlns:" + uniquePrefix, namespace); //$NON-NLS-1$ - } - } - } - /* - * Try to determine if the passed in ComponentSpecification refers to - * an XSD or WSDL file. If it's an XSD, return true. - */ - private boolean isXSDSchemaFile(ComponentSpecification spec) { - String fileLocation = spec.getFile().getLocation().toOSString(); - int periodIndex = fileLocation.lastIndexOf("."); //$NON-NLS-1$ - - if (periodIndex > 0) { - String extension = fileLocation.substring(periodIndex + 1); - if (extension.equalsIgnoreCase("xsd")) { //$NON-NLS-1$ - return true; - } - } - - return false; - } - - 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; - } - - private String getNormalizedLocation(String location) { - try { - URL url = new URL(location); - URL resolvedURL = Platform.resolve(url); - location = resolvedURL.getPath(); - } - catch (Exception e) { - e.printStackTrace(); - } - - return location; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDComponentHelper.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDComponentHelper.java deleted file mode 100644 index f0bd78477..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDComponentHelper.java +++ /dev/null @@ -1,280 +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.util; - -import java.util.Iterator; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDElementDeclarationCommand; -import org.eclipse.wst.wsdl.ui.internal.commands.AddXSDSchemaCommand; -import org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDElementCommand; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDComponent; -import org.eclipse.xsd.XSDCompositor; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDFactory; -import org.eclipse.xsd.XSDModelGroup; -import org.eclipse.xsd.XSDParticle; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; - -/** - * Input createInput(Operation operation, String style) --- create default message/part/etc. - * Object createInputParameter(Operation operation, Input input, Style style) -- - * - * Command getCreateInputParameterCommand(Operation operation, Input input, Style style) - * - * Message/part/Element - * Message/part/Element/sequence/Element - * (x) Message/part - */ -public class XSDComponentHelper { - /* - * Create an XSDElement with type anonymous. Set the given part to reference the newly created - * XSDElement. - */ - public static XSDElementDeclaration createAnonymousXSDElementDefinition(String baseName, Part part) { - XSDElementDeclaration anonElement = createXSDElementDeclarationCommand(part.getEnclosingDefinition(), baseName, part); - XSDComplexTypeDefinition newAnon = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition(); - XSDParticle newXSDParticle = XSDFactory.eINSTANCE.createXSDParticle(); - XSDModelGroup newXSDModelGroup = XSDFactory.eINSTANCE.createXSDModelGroup(); - newXSDModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL); - - anonElement.setAnonymousTypeDefinition(newAnon); - newXSDParticle.setContent(newXSDModelGroup); - newAnon.setContent(newXSDParticle); - - return anonElement; - } - - public static XSDElementDeclaration createXSDElementDeclarationCommand(Definition definition, String baseName, Object context) { - XSDElementDeclaration xsdElement = null; - - if (context instanceof Part) { - AddXSDElementDeclarationCommand command = new AddXSDElementDeclarationCommand(definition, ""); //$NON-NLS-1$ - - // Find a unique name - XSDSchema xsdSchema = command.getSchema(); - String name = NameUtil.getXSDElementName(baseName, xsdSchema); - command.run(name); - // The 'workaround' below is causing me to hang..... The latest WTP is needed. -// xsdElement = xsdSchema.resolveElementDeclaration(name); - xsdElement = command.getXSDElement(); - } - else if (context instanceof XSDModelGroup) { - XSDModelGroup modelGroup = (XSDModelGroup) context; - XSDParticle newParticle = XSDFactory.eINSTANCE.createXSDParticle(); - String name = NameUtil.getXSDElementName(baseName, modelGroup); - - AddXSDElementCommand command = new AddXSDElementCommand("Add XML Schema Element", modelGroup); - command.execute(); - xsdElement = (XSDElementDeclaration) command.getAddedComponent(); - xsdElement.setName(name); - xsdElement.setTypeDefinition(getXSDStringType(modelGroup)); - - newParticle.setContent(xsdElement); - modelGroup.getContents().add(newParticle); - } - else { - AddXSDElementCommand command = new AddXSDElementCommand(); - command.execute(); - xsdElement = (XSDElementDeclaration) command.getAddedComponent(); - xsdElement.setName(baseName); - } - - return xsdElement; - } - - public static void addXSDElementToModelGroup(XSDElementDeclaration parent, XSDElementDeclaration child) { - if (parent.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition) { - XSDComplexTypeDefinition anonType = (XSDComplexTypeDefinition) parent.getAnonymousTypeDefinition(); - if (anonType.getContent() instanceof XSDParticle) { - XSDParticle particle = (XSDParticle) anonType.getContent(); - if (particle.getContent() instanceof XSDModelGroup) { - // Create XSDParticle - XSDModelGroup modelGroup = (XSDModelGroup) particle.getContent(); - addXSDElementToModelGroup(modelGroup, child); - } - else { - // Create XSDModelGroup -- XSDParticle - addXSDElementToModelGroup(particle, child); - } - } - else { - // Create XSDParticle --> XSDModelGroup --> XSDParticle - XSDParticle newParticle = XSDFactory.eINSTANCE.createXSDParticle(); - anonType.setContent(newParticle); - addXSDElementToModelGroup(newParticle, child); - } - } - else { - // Create Anonymous Type --> XSDParticle --> XSDModelGroup --> XSDParticle - XSDComplexTypeDefinition newAnonType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition(); - parent.setAnonymousTypeDefinition(newAnonType); - - XSDParticle newParticle = XSDFactory.eINSTANCE.createXSDParticle(); - newAnonType.setContent(newParticle); - addXSDElementToModelGroup(newParticle, child); - } - } - - public static void addXSDElementToModelGroup(XSDParticle particle, XSDElementDeclaration child) { - XSDModelGroup newXSDModelGroup = XSDFactory.eINSTANCE.createXSDModelGroup(); - newXSDModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL); - particle.setContent(newXSDModelGroup); - addXSDElementToModelGroup(newXSDModelGroup, child); - } - - public static void addXSDElementToModelGroup(XSDModelGroup modelGroup, XSDElementDeclaration child) { - // Create XSDParticle - XSDParticle newParticle = XSDFactory.eINSTANCE.createXSDParticle(); - newParticle.setContent(child); - modelGroup.getContents().add(newParticle); - } - - /* - * Return it's XSDModelGroup. If one does not exist, create one - */ - public static XSDModelGroup getXSDModelGroup(XSDElementDeclaration xsdElement, Definition definition) { - XSDModelGroup modelGroup = null; - XSDComplexTypeDefinition anonType = null; - - if (xsdElement.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition) { - anonType = (XSDComplexTypeDefinition) xsdElement.getAnonymousTypeDefinition(); - } - else { - // Create Anonymous Type - anonType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition(); - anonType.setName("NewComplexTypeName"); //$NON-NLS-1$ - getXSDSchema(definition).getContents().add(anonType); - xsdElement.setAnonymousTypeDefinition(anonType); - } - - if (anonType != null) { - modelGroup = getXSDModelGroup(anonType); - } - - return modelGroup; - } - - /* - * Return it's XSDModelGroup. If one does not exist, create one - */ - public static XSDModelGroup getXSDModelGroup(XSDComplexTypeDefinition xsdComplexType) { - XSDModelGroup modelGroup = null; - XSDParticle particle = null; - // Check for XSDParticle - if (xsdComplexType.getContent() instanceof XSDParticle) { - particle = (XSDParticle) xsdComplexType.getContent(); - } - else { - particle = XSDFactory.eINSTANCE.createXSDParticle(); - modelGroup = XSDFactory.eINSTANCE.createXSDModelGroup(); - modelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL); - particle.setContent(modelGroup); - xsdComplexType.setContent(particle); - } - - // Check for XSDModelGroup - if (particle.getContent() instanceof XSDModelGroup) { - modelGroup = (XSDModelGroup) particle.getContent(); - } - else { - modelGroup = XSDFactory.eINSTANCE.createXSDModelGroup(); - modelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL); - particle.setContent(modelGroup); - } - - return modelGroup; - } - - /* - * - */ - public static XSDComplexTypeDefinition createXSDComplexTypeDefiniion(String complexTypeName, Part part) { - XSDComplexTypeDefinition newComplexType = XSDFactory.eINSTANCE.createXSDComplexTypeDefinition(); - XSDParticle newXSDParticle = XSDFactory.eINSTANCE.createXSDParticle(); - XSDModelGroup newXSDModelGroup = XSDFactory.eINSTANCE.createXSDModelGroup(); - newXSDModelGroup.setCompositor(XSDCompositor.SEQUENCE_LITERAL); - - newComplexType.setName(complexTypeName); - newComplexType.setContent(newXSDParticle); - newXSDParticle.setContent(newXSDModelGroup); - getXSDSchema(part.getEnclosingDefinition()).getContents().add(newComplexType); - - return newComplexType; - } - - public static void addXSDElementToModelGroup(XSDComplexTypeDefinition parent, XSDElementDeclaration child) { - if (parent.getContent() instanceof XSDParticle) { - XSDParticle particle = (XSDParticle) parent.getContent(); - if (particle.getContent() instanceof XSDModelGroup) { - // Create XSDParticle - XSDModelGroup modelGroup = (XSDModelGroup) particle.getContent(); - addXSDElementToModelGroup(modelGroup, child); - } - else { - // Create XSDModelGroup -- XSDParticle - addXSDElementToModelGroup(particle, child); - } - } - else { - // Create XSDParticle --> XSDModelGroup --> XSDParticle - XSDParticle newParticle = XSDFactory.eINSTANCE.createXSDParticle(); - parent.setContent(newParticle); - addXSDElementToModelGroup(newParticle, child); - } - } - - /* - * Return the inline XSDSchema associated with this WSDL. - * Look for the inline XSDSchema with the same namespace as the WSDL. - * If this inline XSDSchema does not exists, create it. - */ - public static XSDSchema getXSDSchema(Definition definition) { - XSDSchema schema = null; - String wsdlTargetNamespace = definition.getTargetNamespace(); - - Types types = (Types) definition.getTypes(); - if (types != null) { - - Iterator eeIt = types.getExtensibilityElements().iterator(); - while (eeIt.hasNext()) { - Object eeElement = eeIt.next(); - if (eeElement instanceof XSDSchemaExtensibilityElement) { - XSDSchemaExtensibilityElement ee = (XSDSchemaExtensibilityElement) eeElement; - if (ee.getSchema().getTargetNamespace().equals(wsdlTargetNamespace)) { - schema = ee.getSchema(); - break; - } - } - } - } - - if (schema == null) { - // We need to create the schema - AddXSDSchemaCommand command = new AddXSDSchemaCommand(definition); - command.run(); - XSDSchemaExtensibilityElement eeElement = (XSDSchemaExtensibilityElement) command.getWSDLElement(); - schema = eeElement.getSchema(); - } - - return schema; - } - - private static XSDSimpleTypeDefinition getXSDStringType(XSDComponent component) { - XSDSchema schema = component.getSchema(); - return schema.getSchemaForSchema().resolveSimpleTypeDefinition("string"); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDTypeSystemProvider.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDTypeSystemProvider.java deleted file mode 100644 index bf913c9cd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/util/XSDTypeSystemProvider.java +++ /dev/null @@ -1,212 +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.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Import; -import org.eclipse.wst.wsdl.Types; -import org.eclipse.wst.wsdl.XSDSchemaExtensibilityElement; -import org.eclipse.wst.wsdl.ui.internal.extensions.ITypeSystemProvider; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDNamedComponent; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaContent; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.impl.XSDImportImpl; - -public class XSDTypeSystemProvider implements ITypeSystemProvider -{ - public List getPrefixes(Definition definition, String namespace) - { - List list = new ArrayList(); - Map map = definition.getNamespaces(); - for (Iterator i = map.keySet().iterator(); i.hasNext();) - { - String prefix = (String) i.next(); - String theNamespace = (String) map.get(prefix); - if (theNamespace != null && theNamespace.equals(namespace)) - { - list.add(prefix); - } - } - return list; - } - - public List getPrefixedNames(Definition definition, String namespace, String localName) - { - List list = new ArrayList(); - for (Iterator i = getPrefixes(definition, namespace).iterator(); i.hasNext();) - { - String prefix = (String) i.next(); - String name = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; //$NON-NLS-1$ - list.add(name); - } - return list; - } - - protected void addNamedComponents(Definition definition, List list, List namedComponents) - { - for (Iterator i = namedComponents.iterator(); i.hasNext();) - { - XSDNamedComponent component = (XSDNamedComponent) i.next(); - list.addAll(getPrefixedNames(definition, component.getTargetNamespace(), component.getName())); - } - } - - public void initWSIStyleImports(XSDSchema xsdSchema) - { - if (xsdSchema.getTargetNamespace() == null) - { - for (Iterator i = xsdSchema.getContents().iterator(); i.hasNext();) - { - XSDSchemaContent content = (XSDSchemaContent) i.next(); - if (content instanceof XSDImportImpl) - { - XSDImportImpl xsdImport = (XSDImportImpl) content; - XSDSchema schema = (XSDSchema)xsdImport.getResolvedSchema(); - if (schema == null) - { - schema = xsdImport.importSchema(); - } - } - } - } - } - - public List getAvailableTypeNames(Definition definition, int typeNameCategory) - { - List list = new ArrayList(); - - if (typeNameCategory == ITypeSystemProvider.BUILT_IN_TYPE) { - list = getBuiltInTypeNamesList(definition); - } - else { - Types types = definition.getETypes(); - if (types != null) - { - for (Iterator i = types.getEExtensibilityElements().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaExtensibilityElement) - { - XSDSchema schema = ((XSDSchemaExtensibilityElement) o).getSchema(); - if (schema != null) - { - initWSIStyleImports(schema); - addNamedComponents(definition, list, schema.getTypeDefinitions()); - } - } - } - } - - for (Iterator i = definition.getEImports().iterator(); i.hasNext();) - { - Import theImport = (Import) i.next(); - XSDSchema schema = theImport.getESchema(); - if (schema != null) - { - addNamedComponents(definition, list, schema.getTypeDefinitions()); - } - } - list.addAll(getBuiltInTypeNamesList(definition)); - } - - return list; - } - - public List getAvailableTypes(Definition definition, XSDSchema schema, int typeNameCategory) - { - List keepTypes = new ArrayList(); - Iterator typeIterator = schema.getTypeDefinitions().iterator(); - // Filter out unwanted Types - if (typeNameCategory == ITypeSystemProvider.USER_DEFINED_COMPLEX_TYPE) { - while (typeIterator.hasNext()) { - Object type = typeIterator.next(); - if (type instanceof XSDComplexTypeDefinition) { - keepTypes.add(type); - } - } - } - else if (typeNameCategory == ITypeSystemProvider.USER_DEFINED_SIMPLE_TYPE) { - while (typeIterator.hasNext()) { - Object type = typeIterator.next(); - if (type instanceof XSDSimpleTypeDefinition) { - keepTypes.add(type); - } - } - } - - //addNamedComponents(definition, list, keepTypes); - //return list; - return keepTypes; - } - - public java.util.List getBuiltInTypeNamesList(Definition definition) - { - List items = new ArrayList(); -// if (definition != null) -// { -// List prefixes = getPrefixes(definition, WSDLConstants.XSD_NAMESPACE_URI); -// for (Iterator i = prefixes.iterator(); i.hasNext();) -// { -// String prefix = (String) i.next(); -// for (int j = 0; j < XSDDOMHelper.dataType.length; j++) -// { -// String localName = XSDDOMHelper.dataType[j][0]; -// String name = (prefix != null && prefix.length() > 0) ? prefix + ":" + localName : localName; -// items.add(name); -// } -// } -// } - return items; - } - public List getAvailableElementNames(Definition definition) - { - List list = new ArrayList(); - Types types = definition.getETypes(); - if (types != null) - { - for (Iterator i = types.getEExtensibilityElements().iterator(); i.hasNext();) - { - Object o = i.next(); - if (o instanceof XSDSchemaExtensibilityElement) - { - XSDSchema schema = ((XSDSchemaExtensibilityElement) o).getSchema(); - if (schema != null) - { - initWSIStyleImports(schema); - addNamedComponents(definition, list, schema.getElementDeclarations()); - } - } - } - } - - for (Iterator i = definition.getEImports().iterator(); i.hasNext();) - { - Import theImport = (Import) i.next(); - XSDSchema schema = theImport.getESchema(); - if (schema != null) - { - addNamedComponents(definition, list, schema.getElementDeclarations()); - } - } - return list; - } - public int getCategoryForTypeName(Definition definition, String typeName) - { - return 0; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BaseRenamer.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BaseRenamer.java deleted file mode 100644 index a99eb5fb0..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BaseRenamer.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.visitor; - -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.WSDLElement; - -public abstract class BaseRenamer extends WSDLVisitor -{ - protected String newName; - protected WSDLElement globalComponent; - - public BaseRenamer(WSDLElement globalComponent, String newName) - { - super(globalComponent.getEnclosingDefinition()); - this.globalComponent = globalComponent; - this.newName = newName; - } - - public String getNewQName() - { - String qName = null; - if (newName != null) - { - Definition definition = globalComponent.getEnclosingDefinition(); - qName = definition.getPrefix(definition.getTargetNamespace()); - qName += ":" + newName; //$NON-NLS-1$ - } - else - { - qName = newName; - } - - return qName; - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BindingRenamer.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BindingRenamer.java deleted file mode 100644 index 3d1485a15..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/BindingRenamer.java +++ /dev/null @@ -1,42 +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.visitor; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - -public class BindingRenamer extends BaseRenamer -{ - /** - * Constructor for BindingRenamer. - * @param globalComponent - * @param newName - */ - public BindingRenamer(WSDLElement globalComponent, String newName) - { - super(globalComponent, newName); - } - - public void visitPort(Port port) - { - super.visitPort(port); - Binding binding = port.getEBinding(); - if (globalComponent.equals(binding)) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(port); - element.setAttribute("binding", getNewQName()); //$NON-NLS-1$ - } - } - -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/MessageRenamer.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/MessageRenamer.java deleted file mode 100644 index a85b95fe9..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/MessageRenamer.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.visitor; - -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - -public class MessageRenamer extends BaseRenamer -{ - /** - * Constructor for MessageRenamer. - * @param globalComponent - * @param newName - */ - public MessageRenamer(WSDLElement globalComponent, String newName) - { - super(globalComponent, newName); - } - - public void visitInput(Input input) - { - super.visitInput(input); - Message message = input.getEMessage(); - if (globalComponent.equals(message)) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(input); - element.setAttribute("message", getNewQName()); //$NON-NLS-1$ - } - } - - public void visitOutput(Output output) - { - super.visitOutput(output); - if (globalComponent.equals(output)) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(output); - element.setAttribute("message", getNewQName()); //$NON-NLS-1$ - } - } - - public void visitFault(Fault fault) - { - super.visitFault(fault); - if (globalComponent.equals(fault)) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(fault); - element.setAttribute("message", getNewQName()); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/PortTypeRenamer.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/PortTypeRenamer.java deleted file mode 100644 index 8959c831e..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/PortTypeRenamer.java +++ /dev/null @@ -1,42 +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.visitor; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.WSDLElement; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - -public class PortTypeRenamer extends BaseRenamer -{ - /** - * Constructor for PortTypeRenamer. - * @param globalComponent - * @param newName - */ - public PortTypeRenamer(WSDLElement globalComponent, String newName) - { - super(globalComponent, newName); - } - - public void visitBinding(Binding binding) - { - super.visitBinding(binding); - PortType portType = binding.getEPortType(); - - if (globalComponent.equals(portType)) - { - Element element = WSDLEditorUtil.getInstance().getElementForObject(binding); - element.setAttribute("type", getNewQName()); //$NON-NLS-1$ - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitor.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitor.java deleted file mode 100644 index f86827490..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitor.java +++ /dev/null @@ -1,197 +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.visitor; - -import java.util.Iterator; - -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.Fault; -import org.eclipse.wst.wsdl.Input; -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.Operation; -import org.eclipse.wst.wsdl.Output; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.PortType; -import org.eclipse.wst.wsdl.Service; - -public class WSDLVisitor -{ - protected Definition definition; - - - public WSDLVisitor(Definition definition) - { - this.definition = definition; - } - - - public void visitDefinition() - { - visitBindings(); - visitMessages(); - visitPortTypes(); - visitServices(); - } - - public void visitBindings() - { - for (Iterator iterator = definition.getEBindings().iterator(); iterator.hasNext(); ) - { - Binding binding = (Binding)iterator.next(); - visitBinding(binding); - } - } - - public void visitMessages() - { - for (Iterator iterator = definition.getEMessages().iterator(); iterator.hasNext(); ) - { - Message message = (Message)iterator.next(); - visitMessage(message); - } - } - - public void visitPortTypes() - { - for (Iterator iterator = definition.getEPortTypes().iterator(); iterator.hasNext(); ) - { - PortType portType = (PortType)iterator.next(); - visitPortType(portType); - } - } - - public void visitServices() - { - for (Iterator iterator = definition.getEServices().iterator(); iterator.hasNext(); ) - { - Service service = (Service)iterator.next(); - visitService(service); - } - } - - public void visitBinding(Binding binding) - { - PortType portType = binding.getEPortType(); - if (portType != null) - { - visitPortType(portType); - } - - for (Iterator iterator = binding.getEBindingOperations().iterator(); iterator.hasNext(); ) - { - BindingOperation bindingOperation = (BindingOperation)iterator.next(); - visitBindingOperation(bindingOperation); - } - } - - public void visitPortType(PortType portType) - { - for (Iterator iterator = portType.getEOperations().iterator(); iterator.hasNext(); ) - { - Operation operation = (Operation)iterator.next(); - visitOperation(operation); - } - } - - public void visitBindingOperation(BindingOperation bindingOperation) - { -// BindingInput bindingInput = bindingOperation.getEBindingInput(); -// BindingOutput bindingOutput = bindingOperation.getEBindingOutput(); - } - - public void visitOperation(Operation operation) - { - Input input = operation.getEInput(); - Output output = operation.getEOutput(); - - if (input != null) - { - visitInput(input); - } - if (output != null) - { - visitOutput(output); - } - - for (Iterator iterator = operation.getEFaults().iterator(); iterator.hasNext(); ) - { - Fault fault = (Fault)iterator.next(); - if (fault != null) - { - visitFault(fault); - } - } - - } - - public void visitPart(Part part) - { -// XSDTypeDefinition type = part.getTypeDefinition(); - } - - public void visitMessage(Message message) - { - for (Iterator iterator = message.getEParts().iterator(); iterator.hasNext(); ) - { - Part part = (Part)iterator.next(); - visitPart(part); - } - } - - public void visitInput(Input input) - { - Message message = input.getEMessage(); - if (message != null) - { - visitMessage(message); - } - } - - public void visitOutput(Output output) - { - Message message = output.getEMessage(); - if (message != null) - { - visitMessage(message); - } - } - - public void visitFault(Fault fault) - { - Message message = fault.getEMessage(); - if (message != null) - { - visitMessage(message); - } - } - - public void visitPort(Port port) - { - Binding binding = port.getEBinding(); - if (binding != null) - { - visitBinding(binding); - } - } - - public void visitService(Service service) - { - for (Iterator iterator = service.getEPorts().iterator(); iterator.hasNext(); ) - { - Port port = (Port)iterator.next(); - visitPort(port); - } - - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitorForParameters.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitorForParameters.java deleted file mode 100644 index 9498e61ae..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/visitor/WSDLVisitorForParameters.java +++ /dev/null @@ -1,96 +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.visitor; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.wsdl.Message; -import org.eclipse.wst.wsdl.MessageReference; -import org.eclipse.wst.wsdl.Part; -import org.eclipse.wst.wsdl.ui.internal.adapters.visitor.W11XSDVisitorForFields; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; - -public class WSDLVisitorForParameters -{ - public List concreteComponents = new ArrayList(); - public List thingsToListenTo = new ArrayList(); - - public void visitMessageReference(MessageReference messageReference) - { - if (messageReference.getEMessage() != null) - { - visitMessage(messageReference.getEMessage()); - } - } - - public void visitMessage(Message message) - { - // for now we assume that the first part is the only one that - // should be used to deduce the parameters - // TODO (cs) we need to revist this, multiple parts need to be considered - // - if (message != null) { - thingsToListenTo.add(message); - List parts = message.getEParts(); - if (parts.size() > 0) { - visitPart((Part) parts.get(0)); - } - } - } - - void visitPart(Part part) - { - thingsToListenTo.add(part); - if (part.getElementDeclaration() != null) - { - visitXSDElementDeclaration(part.getElementDeclaration()); - } - else if (part.getTypeDefinition() instanceof XSDComplexTypeDefinition) - { - visitXSDComplextTypeDefinition((XSDComplexTypeDefinition) part.getTypeDefinition()); - } - else - // if (part.getTypeDefinition() instanceof XSDSimpleTypeDefinition) - { - concreteComponents.add(part); - } - } - - void visitXSDElementDeclaration(XSDElementDeclaration ed) - { - XSDTypeDefinition td = ed.getTypeDefinition(); - if (td instanceof XSDSimpleTypeDefinition) - { - concreteComponents.add(ed); - } - else if (td instanceof XSDComplexTypeDefinition) - { - thingsToListenTo.add(ed); - visitXSDComplextTypeDefinition((XSDComplexTypeDefinition) td); - } - } - - void visitXSDComplextTypeDefinition(XSDComplexTypeDefinition td) - { - // TODO (cs) revisit to see if it makes sense for the WSDL editor to redisplay - // the 'Fields' (in XSD editor lingo) as paramters - // perhaps the WSDL Editor should simply reuse the XSD Editor's - // ComplexType edit part when displaying these sections? - W11XSDVisitorForFields fieldVisitor = new W11XSDVisitorForFields(); - fieldVisitor.visitComplexTypeDefinition(td); - concreteComponents.addAll(fieldVisitor.getConcreteComponentList()); - thingsToListenTo.addAll(fieldVisitor.getThingsWeNeedToListenTo()); - } - }
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/BindingWizard.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/BindingWizard.java deleted file mode 100644 index 015519dec..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/BindingWizard.java +++ /dev/null @@ -1,299 +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.wizards; - -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.internal.generator.BindingGenerator; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.dialogs.ProtocolComponentControl; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class BindingWizard extends Wizard -{ - protected BindingGenerator bindingGenerator; - protected BindingWizardOptionsPage specifyBindingPage; - - protected Document document; - protected int kind; - - public static final int KIND_NEW_BINDING = 1; - public static final int KIND_REGENERATE_BINDING = 2; - - protected Definition definition; - - /* - * Constructor used when are creating a brand new Binding - */ - public BindingWizard(Definition definition) - { - this(definition, null, KIND_NEW_BINDING); - } - - /* - * Constructor used when are creating a brand new Binding - */ - public BindingWizard(Definition definition, Document document) - { - this(definition, null, KIND_NEW_BINDING); - this.document = document; - } - - /* - * Constructor used when there is an existing Binding we wish to modify/regenerate - */ - public BindingWizard(Definition definition, Binding binding, int kind) - { - super(); - this.definition = definition; - this.kind = kind; - bindingGenerator = new BindingGenerator(definition, binding); - - setWindowTitle(Messages.getString("_UI_BINDING_WIZARD")); //$NON-NLS-1$ - //setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(WSDLEditorPlugin.class, "icons/NewXML.gif")); - } - - public void setBindingName(String bindingName) - { -// QName qname = new QName(definition.getTargetNamespace(), bindingName); - bindingGenerator.setName(bindingName); -/* - // Binding binding = (Binding) definition.getBinding(qname); - if (binding != null) - { - List eeList = binding.getEExtensibilityElements(); - if (eeList.size() > 0) - { - ExtensibilityElement ee = (ExtensibilityElement) eeList.get(0); - Element element = WSDLEditorUtil.getInstance().getElementForObject(ee); - String namespace = element.getNamespaceURI(); - if (namespace != null) - { - ContentGeneratorExtension extension = WSDLEditorPlugin.getInstance().getContentGeneratorExtensionRegistry().getExtensionForNamespace(namespace); - - if (extension != null) - { - bindingGenerator.setProtocol(extension.getName()); - } - } - } - } - */ - } - - public void setPortTypeName(String portTypeName) - { - bindingGenerator.setRefName(portTypeName); - } - - public BindingGenerator getBindingGenerator() - { - return bindingGenerator; - } - - /** - * Return true if wizard setup is successful, false otherwise - */ - public boolean setup() - { - return true; - } - - public void addPages() - { - specifyBindingPage = new BindingWizardOptionsPage(); - addPage(specifyBindingPage); - } - - public boolean performFinish() - { - boolean recordingStarted = false; - if (definition.getElement() == null || (document != null && document.getChildNodes().getLength() == 0)) { - recordingStarted = true; - beginRecording(); - - // Create the Definitions element with proper namespace - Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences(); - String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET); - if (charSet == null || charSet.trim().equals("")) //$NON-NLS-1$ - { - charSet = "UTF-8"; //$NON-NLS-1$ - } - document.appendChild(document.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"" + charSet + "\"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - Element root = document.createElement("wsdl:definitions"); //$NON-NLS-1$ - document.appendChild(root); - - // Add various namespace attributes here. - root.setAttribute("xmlns:soap", "http://schemas.xmlsoap.org/wsdl/soap/"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("xmlns:tns", getDefaultNamespace(definition)); //$NON-NLS-1$ - root.setAttribute("xmlns:wsdl", "http://schemas.xmlsoap.org/wsdl/"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$ - root.setAttribute("name", getFileName(definition)); //$NON-NLS-1$ - root.setAttribute("targetNamespace", getDefaultNamespace(definition)); //$NON-NLS-1$ - - definition.setElement(root); - } - - // Generate/re-generate the Binding - try - { - Binding binding = bindingGenerator.generateBinding(); - - if (binding != null) - { - IEditorPart editorPart = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - ISelectionProvider selectionProvider = (ISelectionProvider) editorPart.getAdapter(ISelectionProvider.class); - if (selectionProvider != null) - { - selectionProvider.setSelection(new StructuredSelection(binding)); - } - } - } - catch (Exception e) - { - } - finally { - if (recordingStarted) - endRecording(); - } - - return true; - } - - private String getDefaultNamespace(Definition definition) - { - String namespace = WSDLEditorPlugin.getInstance().getPreferenceStore().getString(Messages.getString("_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE")); //$NON-NLS-1$ - if (!namespace.endsWith("/")) { //$NON-NLS-1$ - namespace = namespace.concat("/"); //$NON-NLS-1$ - } - - namespace += getFileName(definition) + "/"; //$NON-NLS-1$ - - return namespace; - } - - private String getFileName(Definition definition) { - String fileLocation = definition.getLocation(); - IPath filePath = new Path(fileLocation); - return filePath.removeFileExtension().lastSegment().toString(); - } - - private void beginRecording() { - Node node = document; - if (node instanceof IDOMNode) - { - ((IDOMNode)node).getModel().beginRecording(this, Messages.getString("_UI_ACTION_ADD_BINDING")); //$NON-NLS-1$ - } - } - - private void endRecording() { - Node node = document; - if (node instanceof IDOMNode) - { - ((IDOMNode)node).getModel().endRecording(this); - } - } - - class BindingWizardOptionsPage extends WizardPage - { - protected ProtocolComponentControl protocolComponentControl; - - public BindingWizardOptionsPage() - { - super("SpecifyBindingPage"); //$NON-NLS-1$ - setTitle(Messages.getString("_UI_TITLE_SPECIFY_BINDING_DETAILS")); //$NON-NLS-1$ - setDescription(Messages.getString("_UI_SPECIFY_BINDING_DETAILS_LABEL")); //$NON-NLS-1$ - } - - protected BindingGenerator getBindingGenerator() - { - return ((BindingWizard) getWizard()).getBindingGenerator(); - } - - public void createControl(Composite parent) - { - ProtocolComponentControl protocolComponentControl = new BindingProtocolComponentControl(parent, bindingGenerator, true); - protocolComponentControl.initFields(); - setControl(protocolComponentControl); - } - } - - public static class BindingProtocolComponentControl extends ProtocolComponentControl - { - public BindingProtocolComponentControl(Composite parent, BindingGenerator generator) - { - this(parent, generator, true); - } - - public BindingProtocolComponentControl(Composite parent, BindingGenerator generator, boolean showOverwriteButton) - { - super(parent, generator, showOverwriteButton); - - if (generator.getName() != null) - { - componentNameField.setEditable(false); - } - } - - public String getRefNameLabelText() - { - return Messages.getString("_UI_PORT_TYPE"); //$NON-NLS-1$ - } - - public List getRefNames() - { - return new ComponentReferenceUtil(generator.getDefinition()).getPortTypeNames(); - } - - public String getDefaultName() - { - String bindingName = generator.getName(); - return bindingName != null ? bindingName : NameUtil.buildUniqueBindingName(generator.getDefinition(), null); - } - - public ContentGeneratorOptionsPage createContentGeneratorOptionsPage(String protocol) - { - ContentGeneratorOptionsPage optionsPage = null; - String protocolSelection = protocolCombo.getItem(protocolCombo.getSelectionIndex()); - if (protocolSelection.equals("SOAP")) { //$NON-NLS-1$ - optionsPage = new SoapBindingOptionsPage(); - } - else if (protocolSelection.equals("HTTP")) { //$NON-NLS-1$ - optionsPage = new HttpBindingOptionsPage(); - } -// ContentGeneratorExtension extension = WSDLEditorPlugin.getInstance().getContentGeneratorExtensionRegistry().getContentGeneratorExtension(protocol); -// if (extension != null) -// { -// optionsPage = extension.createBindingContentGeneratorOptionsPage(); -// } - return optionsPage; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/ContentGeneratorOptionsPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/ContentGeneratorOptionsPage.java deleted file mode 100644 index 9a16e1a23..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/ContentGeneratorOptionsPage.java +++ /dev/null @@ -1,26 +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.wizards; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.wsdl.internal.generator.BaseGenerator; - -public interface ContentGeneratorOptionsPage -{ - public void init(BaseGenerator baseGenerator); - public Composite createControl(Composite parent); - public Composite getControl(); - - // TODO can this go into init? - // - public void setOptionsOnGenerator(); - public boolean isOverwriteApplicable(); -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/HttpBindingOptionsPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/HttpBindingOptionsPage.java deleted file mode 100644 index 13cb02d29..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/HttpBindingOptionsPage.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.wizards; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ExtensibilityElement; -import org.eclipse.wst.wsdl.binding.http.internal.generator.HTTPContentGenerator; -import org.eclipse.wst.wsdl.internal.generator.BaseGenerator; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - - -public class HttpBindingOptionsPage implements ContentGeneratorOptionsPage, SelectionListener -{ - protected Button getButton; - protected Button postButton; - protected Composite control; - protected BaseGenerator generator; - protected HTTPContentGenerator httpGenerator; - - public HttpBindingOptionsPage() - { - } - - public void init(BaseGenerator generator) - { - this.generator = generator; - if (generator.getContentGenerator() instanceof HTTPContentGenerator) { - httpGenerator = (HTTPContentGenerator) generator.getContentGenerator(); - } - } - - public Composite createControl(Composite parent) - { - control = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - control.setLayout(layout); - - Label separator = new Label(control, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= true; - - separator.setLayoutData(gd); - - Label optionsHeading = new Label(control, SWT.NONE); - optionsHeading.setText(Messages.getString("_UI_LABEL_HTTP_BINDING_OPTIONS")); //$NON-NLS-1$ - - getButton = new Button(control, SWT.RADIO); - getButton.setText("HTTP GET"); //$NON-NLS-1$ - getButton.setSelection(true); - - postButton = new Button(control, SWT.RADIO); - postButton.setText("HTTP POST"); //$NON-NLS-1$ - - if (generator.getName() != null) - { - Definition definition = generator.getDefinition(); - QName qname = new QName(definition.getTargetNamespace(), generator.getName()); - Binding binding = (Binding) definition.getBinding(qname); - if (binding != null) - { - List eeList = binding.getEExtensibilityElements(); - if (eeList.size() > 0) - { - ExtensibilityElement ee = (ExtensibilityElement) eeList.get(0); - Element element = WSDLEditorUtil.getInstance().getElementForObject(ee); - String verb = element.getAttribute("verb"); //$NON-NLS-1$ - if ("POST".equals(verb)) //$NON-NLS-1$ - { - getButton.setSelection(false); - postButton.setSelection(true); - } - } - } - } - - postButton.addSelectionListener(this); - getButton.addSelectionListener(this); - computeOptions(); - - return control; - } - - public Composite getControl() { - return control; - } - - public boolean isOverwriteApplicable() - { - return true; - } - - public void widgetSelected(SelectionEvent event) - { - computeOptions(); - } - - protected void computeOptions() - { - if (generator.getContentGenerator() instanceof HTTPContentGenerator) { - HTTPContentGenerator httpGenerator = (HTTPContentGenerator) generator.getContentGenerator(); - - if (postButton.getSelection()) { - httpGenerator.setVerb(HTTPContentGenerator.VERB_POST); - } - else if (getButton.getSelection()) { - httpGenerator.setVerb(HTTPContentGenerator.VERB_GET); - } - } - } - - public void setOptionsOnGenerator() { - computeOptions(); - } - - public void widgetDefaultSelected(SelectionEvent event) - { - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NamespaceTable.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NamespaceTable.java deleted file mode 100644 index b9f5c6ac8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NamespaceTable.java +++ /dev/null @@ -1,702 +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.wizards; - -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.CheckboxCellEditor; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ICellModifier; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.wst.common.ui.internal.viewers.NavigableTableViewer; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo; -import org.eclipse.wst.xml.ui.internal.dialogs.EditNamespaceInfoDialog; -import org.eclipse.wst.xml.ui.internal.dialogs.UpdateListener; -import org.eclipse.wst.xml.ui.internal.util.XMLCommonResources; - -public class NamespaceTable extends Composite -{ - protected static final String NAMESPACE_URI = XMLCommonResources.getInstance().getString("_UI_LABEL_NAMESPACE_NAME"); - protected static final String PREFIX = XMLCommonResources.getInstance().getString("_UI_LABEL_PREFIX"); - protected static final String INCLUDE = Messages.getString("_UI_TITLE_SELECT"); //$NON-NLS-1$ - - protected List namespaceInfoList = new Vector(); - protected List checkedList = new Vector(); - protected NamespaceNavigableTableViewer tableViewer; - protected Button addButton; - - protected NamespaceInfoTableLabelProvider provider; - protected UpdateListener updateListener; - protected IPath resourceLocation; - protected int visibleRows = -1; - protected boolean dummyRowsRemoved = false; - Table table; - - public NamespaceTable(Composite parent) - { - this(parent, -1, -1, -1); - } - - public NamespaceTable(Composite parent, int visibleRows) - { - this(parent, -1, -1, visibleRows); - } - - public NamespaceTable(Composite parent, int widthHint, int heightHint) - { - this(parent, widthHint, heightHint, -1); - } - - public NamespaceTable(Composite parent, int widthHint, int heightHint, int visibleRows) - { - super(parent, SWT.NONE); - setLayout(createGridLayout()); - GridData fillGD= new GridData(); - fillGD.horizontalAlignment= GridData.FILL; - fillGD.grabExcessHorizontalSpace= true; - fillGD.verticalAlignment= GridData.FILL; - fillGD.grabExcessVerticalSpace= true; - - setLayoutData(fillGD); - - Group namespaceInfoGroup = new Group(this, SWT.NONE); - namespaceInfoGroup.setText(Messages.getString("_UI_LABEL_NAMESPACE_URIS_TO_BE_INCLUDED")); //$NON-NLS-1$ - namespaceInfoGroup.setLayout(new GridLayout()); - GridData gd = fillGD; - if (widthHint != -1) - { - gd.widthHint = widthHint; - } - if (heightHint != -1) - { - gd.heightHint = heightHint; - } - namespaceInfoGroup.setLayoutData(gd); - //WorkbenchHelp.setHelp(namespaceInfoGroup, new ControlContextComputer(namespaceInfoGroup, XMLBuilderContextIds.XMLC_NAMESPACE_GROUP)); - - String[] titleArray = {INCLUDE, PREFIX, NAMESPACE_URI}; - - table = new Table(namespaceInfoGroup, SWT.FULL_SELECTION); - table.setHeaderVisible(true); - - table.setLayoutData(fillGD); - table.setLinesVisible(true); - table.addMouseListener(new MouseAdapter() - { - public void mouseDown(MouseEvent e) - { - TableItem item = table.getItem(new Point(e.x, e.y)); - if (item != null) - { - Object obj = item.getData(); - if (obj != null) - { - TableElement holder = (TableElement)obj; - TableColumn col = table.getColumn(0); - if (e.x < col.getWidth()) // if the point falls within the Select column then perform check/uncheck - { - String currentState = holder.getChecked(); - if (currentState.equals("true")) //$NON-NLS-1$ - { - holder.setChecked("false"); //$NON-NLS-1$ - checkedList.set(holder.getIndex(), "false"); //$NON-NLS-1$ - } - else if (currentState.equals("false")) //$NON-NLS-1$ - { - holder.setChecked("true"); //$NON-NLS-1$ - checkedList.set(holder.getIndex(), "true"); //$NON-NLS-1$ - } - tableViewer.refresh(); - if (updateListener != null) - { - updateListener.updateOccured(this, namespaceInfoList); - } - } - } - } - } - }); - - tableViewer = new NamespaceNavigableTableViewer(table); - provider = new NamespaceInfoTableLabelProvider(); - tableViewer.setContentProvider(provider); - tableViewer.setLabelProvider(provider); - tableViewer.setColumnProperties(titleArray); - tableViewer.setCellModifier(new NamespaceInfoCellModifier()); - - - int[] widthArray = {10, 20, 50}; - TableLayout layout = new TableLayout(); - - for (int i = 0; i < titleArray.length; i++) - { - TableColumn column = new TableColumn(table, i); - column.setText(titleArray[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(widthArray[i], true)); - } - this.visibleRows = visibleRows; - for (int i = 0; i < visibleRows; i++) - { - TableItem item = new TableItem(table, SWT.NONE); - item.setText("#######"); //$NON-NLS-1$ - } - table.setLayout(layout); - - CellEditor[] cellEditors = new CellEditor[titleArray.length]; - cellEditors[0] = new NamespaceInfoCheckboxCellEditor(table); - cellEditors[1] = new TextCellEditor(table); - tableViewer.setCellEditors(cellEditors); - -// createButtons(namespaceInfoGroup); - - initialize(); - } - - public void setUpdateListener(UpdateListener updateListener) - { - this.updateListener = updateListener; - } - - public void setNamespaceInfoList(List namespaceInfoList) - { - this.namespaceInfoList = namespaceInfoList; - update(); - } - - public List getNamespaceInfoList() - { - return namespaceInfoList; - } - - public List getNamespaceCheckedList() - { - return checkedList; - } - - public String getWSDLPrefix() - { - return ((NamespaceInfo)(namespaceInfoList.get(0))).prefix; - } - - public void setResourceLocation(IPath resourceLocation) - { - this.resourceLocation = resourceLocation; - } - - public GridLayout createGridLayout() - { - GridLayout gridLayout = new GridLayout(); - gridLayout.marginWidth = 0; - gridLayout.horizontalSpacing = 0; - return gridLayout; - } - - protected void initialize() - { - // better way to do this.... - NamespaceInfo info1 = new NamespaceInfo(); - info1.prefix = "wsdl"; //$NON-NLS-1$ - info1.uri = "http://schemas.xmlsoap.org/wsdl/"; //$NON-NLS-1$ - namespaceInfoList.add(info1); - checkedList.add("true"); //$NON-NLS-1$ - NamespaceInfo info2 = new NamespaceInfo(); - info2.prefix = "soap"; //$NON-NLS-1$ - info2.uri = "http://schemas.xmlsoap.org/wsdl/soap/"; //$NON-NLS-1$ - namespaceInfoList.add(info2); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info3 = new NamespaceInfo(); - info3.prefix = "http"; //$NON-NLS-1$ - info3.uri = "http://schemas.xmlsoap.org/wsdl/http/"; //$NON-NLS-1$ - namespaceInfoList.add(info3); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info4 = new NamespaceInfo(); - info4.prefix = "mime"; //$NON-NLS-1$ - info4.uri = "http://schemas.xmlsoap.org/wsdl/mime/"; //$NON-NLS-1$ - namespaceInfoList.add(info4); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info5 = new NamespaceInfo(); - info5.prefix = "soapenc"; //$NON-NLS-1$ - info5.uri = "http://schemas.xmlsoap.org/soap/encoding/"; //$NON-NLS-1$ - namespaceInfoList.add(info5); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info6 = new NamespaceInfo(); - info6.prefix = "soapenv"; //$NON-NLS-1$ - info6.uri = "http://schemas.xmlsoap.org/soap/envelope/"; //$NON-NLS-1$ - namespaceInfoList.add(info6); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info7 = new NamespaceInfo(); - info7.prefix = "xsi"; //$NON-NLS-1$ - info7.uri = "http://www.w3.org/2001/XMLSchema-instance"; //$NON-NLS-1$ - namespaceInfoList.add(info7); - checkedList.add("false"); //$NON-NLS-1$ - NamespaceInfo info8 = new NamespaceInfo(); - info8.prefix = "xsd"; //$NON-NLS-1$ - info8.uri = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$ - namespaceInfoList.add(info8); - checkedList.add("true"); //$NON-NLS-1$ - update(); - } - - protected void createButtons(Composite parent) - { - Composite composite = new Composite(parent, SWT.NONE); - GridData hFillGD = new GridData(); - hFillGD.horizontalAlignment= GridData.FILL; - hFillGD.grabExcessHorizontalSpace= true; - - composite.setLayoutData(hFillGD); - GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - gridLayout.marginHeight = 0; - gridLayout.marginWidth = 0; - composite.setLayout(gridLayout); - - GridData gd = new GridData(); - gd.horizontalAlignment = GridData.FILL; - gd.grabExcessHorizontalSpace= true; - - Button hiddenButton = new Button(composite, SWT.NONE); - hiddenButton.setLayoutData(gd); - hiddenButton.setVisible(false); - hiddenButton.setEnabled(false); - - SelectionListener selectionListener = new SelectionAdapter() - { - public void widgetSelected(SelectionEvent e) - { - if (e.widget == addButton) - { - performNew(); - } - } - }; - - // create a composite to hold the three buttons - Composite buttonComposite = new Composite(composite, SWT.NONE); - - buttonComposite.setLayoutData(hFillGD); - GridLayout buttonGridLayout = new GridLayout(); - buttonGridLayout.numColumns = 1; - buttonGridLayout.makeColumnsEqualWidth = true; - buttonComposite.setLayout(buttonGridLayout); - - // add the New button - // - gd = new GridData(); - gd.horizontalAlignment = GridData.FILL; - gd.grabExcessHorizontalSpace = true; - - addButton = new Button(buttonComposite, SWT.NONE); - addButton.setText(Messages.getString("_UI_ACTION_ADD")); //$NON-NLS-1$ - addButton.setLayoutData(gd);//ViewUtility.createHorizontalFill()); - addButton.addSelectionListener(selectionListener); - } - - public void performNew() - { - NamespaceInfo info = new NamespaceInfo(); - EditNamespaceInfoDialog dialog = invokeDialog(XMLCommonResources.getInstance().getString("_UI_LABEL_NEW_NAMESPACE_INFORMATION"), info); - if (dialog.getReturnCode() == Dialog.OK) - { - namespaceInfoList.add(info); - checkedList.add("true"); //$NON-NLS-1$ - performDelayedUpdate(); - } - } - - protected EditNamespaceInfoDialog invokeDialog(String title, NamespaceInfo info) - { - Shell shell = XMLCommonResources.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell(); - EditNamespaceInfoDialog dialog = new EditNamespaceInfoDialog(shell, info); - dialog.create(); - dialog.getShell().setText(title); - dialog.setBlockOnOpen(true); - dialog.setResourceLocation(resourceLocation); - dialog.open(); - return dialog; - } - - protected void performDelayedUpdate() - { - Runnable delayedUpdate = new Runnable() - { - public void run() - { - update(); - } - }; - Display.getCurrent().asyncExec(delayedUpdate); - - if (updateListener != null) - { - updateListener.updateOccured(this, namespaceInfoList); - } - } - - protected NamespaceInfo getTargetNamespaceInfo() - { - return (namespaceInfoList != null && namespaceInfoList.size() > 0) ? - (NamespaceInfo)namespaceInfoList.get(0) : - null; - } - - - public void update() - { - updateHelper(namespaceInfoList); - } - - public void updateHelper(List namespaceInfoList) - { - if (visibleRows != -1 && !dummyRowsRemoved) - { -// dummyRowsRemoved = true; -// tableViewer.getTable().removeAll(); - } - ISelection selection = tableViewer.getSelection(); - tableViewer.setInput(namespaceInfoList); - if (selection.isEmpty()) - { - if (namespaceInfoList.size() > 0) - { - tableViewer.setSelection(new StructuredSelection(namespaceInfoList.get(0))); - } - } - else - { - tableViewer.setSelection(selection); - } - } - - protected class NamespaceInfoCheckboxCellEditor extends CheckboxCellEditor implements MouseListener - { - public NamespaceInfoCheckboxCellEditor(Composite parent) - { - super(parent); - } - - protected void doSetValue(Object value) - { - } - - public void activate() - { - super.activate(); - deactivate(); - Display.getCurrent().getFocusControl().redraw(); - } - - public void mouseDown(MouseEvent e) - { - if (tableViewer.getTable().getItem(new Point(e.x, e.y)) != null) - { - } - } - public void mouseDoubleClick(MouseEvent e) {} - public void mouseUp(MouseEvent e) {} - - - } - - - protected class NamespaceInfoCellModifier implements ICellModifier - { - public NamespaceInfoCellModifier() - { - - } - - public boolean canModify(Object element, String property) - { - if (property.equals(INCLUDE)) - { - return true; - } - else if (property.equals(PREFIX)) - { - return true; - } - return false; - } - - public Object getValue(Object element, String property) - { - int column = 0; - if (property.equals(INCLUDE)) - { - column = 0; - } - else if (property.equals(PREFIX)) - { - column = 1; - } - else if (property.equals(NAMESPACE_URI)) - { - column = 2; - } - - if (element instanceof TableElement) - { - return provider.getColumnText(element, column); - } - else - { - return null; - } - } - - public void modify(Object element, String property, Object value) - { - TableItem item = (TableItem)element; - if (item != null) - { - Object obj = item.getData(); - if (obj != null) - { - TableElement holder = (TableElement)obj; - NamespaceInfo info = holder.getNamespaceInfo(); - if (property.equals(INCLUDE)) - { - if (value instanceof Boolean) - { - if (((Boolean)value).booleanValue()) - { - holder.setChecked("true"); //$NON-NLS-1$ - checkedList.set(holder.getIndex(), "true"); //$NON-NLS-1$ - } - else - { - holder.setChecked("false"); //$NON-NLS-1$ - checkedList.set(holder.getIndex(), "false"); //$NON-NLS-1$ - } - } - } - else if (property.equals(PREFIX)) - { - info.prefix = ((String)value).trim(); - } - - Runnable delayedUpdate = new Runnable() - { - public void run() - { - tableViewer.refresh(); - } - }; - Display.getCurrent().asyncExec(delayedUpdate); - if (updateListener != null) - { - updateListener.updateOccured(this, namespaceInfoList); - } - -// performDelayedUpdate(); - } - } - } - } - - protected class TableElement - { - NamespaceInfo info; - int index; - String checked = "true"; //$NON-NLS-1$ - - TableElement(NamespaceInfo info, int index) - { - this.info = info; - this.index = index; - } - - public NamespaceInfo getNamespaceInfo() - { - return info; - } - - public int getIndex() - { - return index; - } - - public String getChecked() - { - return checked; - } - - public void setChecked(String checked) - { - this.checked = checked; - } - } - - /** - * NamespaceInfoTableLabelProvider - */ - protected class NamespaceInfoTableLabelProvider implements ITableLabelProvider, IStructuredContentProvider - { - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) - { - } - - public boolean isLabelProperty(Object element, String property) - { - return false; - } - - public boolean isDeleted(Object element) - { - return false; - } - - public Object[] getElements(Object inputElement) - { - Vector v = new Vector(); - for (int i = 0; i < namespaceInfoList.size(); i++) - { - NamespaceInfo info = (NamespaceInfo)namespaceInfoList.get(i); - TableElement holder = new TableElement(info, i); - holder.setChecked((String)checkedList.get(i)); - v.add(holder); - } - return v.toArray(); - } - - public String getColumnText(Object object, int column) - { - TableElement holder = (TableElement)object; - NamespaceInfo info = holder.getNamespaceInfo(); - String result = null; - switch (column) - { - case 1: { result = info.prefix; break; } - case 2: { result = info.uri; break; } - } - result = result != null ? result.trim() : ""; //$NON-NLS-1$ - if (result.equals("")) //$NON-NLS-1$ - { - switch (column) - { - case 2: - { - result = XMLCommonResources.getInstance().getString("_UI_NO_NAMESPACE_NAME"); - break; - } - } - } - return result; - } - -// private String getDefaultPrefix() -// { -// String defaultPrefix = "p"; -// if (namespaceInfoList == null) -// return defaultPrefix; -// -// Vector v = new Vector(); -// for (int i=0; i<namespaceInfoList.size(); i++) -// { -// NamespaceInfo nsinfo = (NamespaceInfo)namespaceInfoList.get(i); -// if (nsinfo.prefix != null) -// v.addElement(nsinfo.prefix); -// } -// -// if (v.contains(defaultPrefix)) -// { -// String s = defaultPrefix; -// for (int j=0; v.contains(s); j++) -// { -// s = defaultPrefix + Integer.toString(j); -// } -// return s; -// } -// else -// return defaultPrefix; -// } - - public Image getColumnImage(Object object, int columnIndex) - { - if (columnIndex == 0) // Output Column - { - if (object instanceof TableElement) - { - TableElement holder = (TableElement) object; - String result = holder.getChecked(); - if (result.equals("true")) //$NON-NLS-1$ - { - return WSDLEditorPlugin.getInstance().getImage("icons/output_yes.gif"); //$NON-NLS-1$ - } - else - { - return WSDLEditorPlugin.getInstance().getImage("icons/output_no.gif"); //$NON-NLS-1$ - } - } - } - return null; - } - - public boolean isLabelProperty(Object object, Object property) - { - return false; - } - - public void addListener(ILabelProviderListener listener) - { - } - - public void removeListener(ILabelProviderListener listener) - { - } - - public void dispose() - { - } - } - - class NamespaceNavigableTableViewer extends NavigableTableViewer - { - public NamespaceNavigableTableViewer(Table parent) - { - super(parent); - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NewWSDLWizard.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NewWSDLWizard.java deleted file mode 100644 index 409cecba2..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/NewWSDLWizard.java +++ /dev/null @@ -1,409 +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.wizards; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import javax.xml.namespace.QName; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Preferences; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.wst.common.ui.internal.UIPlugin; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.Port; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.binding.http.internal.generator.HTTPContentGenerator; -import org.eclipse.wst.wsdl.binding.http.internal.util.HTTPConstants; -import org.eclipse.wst.wsdl.binding.soap.internal.generator.SOAPContentGenerator; -import org.eclipse.wst.wsdl.binding.soap.internal.util.SOAPConstants; -import org.eclipse.wst.wsdl.internal.generator.BindingGenerator; -import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl; -import org.eclipse.wst.wsdl.internal.impl.WSDLFactoryImpl; -import org.eclipse.wst.wsdl.ui.internal.InternalWSDLMultiPageEditor; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.CreateWSDLElementHelper; -import org.eclipse.wst.wsdl.util.WSDLResourceImpl; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType; -import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument; -import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration; -import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNode; -import org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList; -import org.eclipse.wst.xml.core.internal.contentmodel.internal.util.DOMValidator; -import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery; -import org.eclipse.wst.xml.core.internal.contentmodel.util.CMVisitor; -import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo; -import org.w3c.dom.Element; - -public class NewWSDLWizard extends Wizard implements INewWizard { - private WSDLNewFilePage newFilePage; - private WSDLNewFileOptionsPage optionsPage; - private IStructuredSelection selection; - - /** - * Constructor for NewWSDLWizard. - */ - public NewWSDLWizard() { - super(); - } - - /** - * @see org.eclipse.jface.wizard.IWizard#performFinish() - */ - public boolean performFinish() { - IFile file = newFilePage.createNewFile(); - - Preferences preference = XMLCorePlugin.getDefault().getPluginPreferences(); - String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET); - if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$ - charSet = "UTF-8"; //$NON-NLS-1$ - } - - String wsdlPrefix = "wsdl"; //$NON-NLS-1$ - Vector namespaces = optionsPage.getNamespaceInfo(); - - String prefix = optionsPage.getPrefix(); - String definitionName = optionsPage.getDefinitionName(); - - URI uri2 = URI.createPlatformResourceURI(file.getFullPath().toOSString()); - ResourceSet resourceSet = new ResourceSetImpl(); - WSDLResourceImpl resource = (WSDLResourceImpl) resourceSet.createResource(URI.createURI("*.wsdl")); //$NON-NLS-1$ - resource.setURI(uri2); - - WSDLFactoryImpl factory = new WSDLFactoryImpl(); - DefinitionImpl definition = (DefinitionImpl) factory.createDefinition(); - resource.getContents().add(definition); - - definition.setTargetNamespace(optionsPage.getTargetNamespace()); - definition.setLocation(file.getLocation().toString()); - definition.setEncoding(charSet); - definition.setQName(new QName(wsdlPrefix, definitionName)); - definition.addNamespace(prefix, optionsPage.getTargetNamespace()); - - for (int i = 0; i < namespaces.size(); i++) { - NamespaceInfo info = (NamespaceInfo) namespaces.get(i); - - if (info.prefix.length() > 0) { - definition.addNamespace(info.prefix, info.uri); - } - else { - definition.addNamespace(null, info.uri); - } - } - // TODO : cs... why do we need this? these calls are evil! - definition.updateElement(true); - try { - if (optionsPage.getCreateSkeletonBoolean()) { - if (optionsPage.isSoapDocLiteralProtocol()) { - CreateWSDLElementHelper.PART_TYPE_OR_DEFINITION = CreateWSDLElementHelper.PART_INFO_ELEMENT_DECLARATION; - } - else { - CreateWSDLElementHelper.PART_TYPE_OR_DEFINITION = CreateWSDLElementHelper.PART_INFO_TYPE_DEFINITION; - } - - CreateWSDLElementHelper.serviceName = definitionName; - CreateWSDLElementHelper.portName = definitionName + optionsPage.getProtocol(); - Service service = CreateWSDLElementHelper.createService(definition); - - - // Generate Binding - Iterator bindingIt = definition.getEBindings().iterator(); - Binding binding = null; - if (bindingIt.hasNext()) { - binding = (Binding) bindingIt.next(); - } - BindingGenerator bindingGenerator = new BindingGenerator(definition, binding, SOAPConstants.SOAP_NAMESPACE_URI); - Port port = (Port) service.getEPorts().iterator().next(); - bindingGenerator.setName(ComponentReferenceUtil.getName(port.getEBinding())); - bindingGenerator.setRefName(ComponentReferenceUtil.getPortTypeReference(port.getEBinding())); - bindingGenerator.setOverwrite(true); - - if (optionsPage.getProtocol().equals("SOAP")) { //$NON-NLS-1$ - String namespace = SOAPConstants.SOAP_NAMESPACE_URI; - bindingGenerator.setContentGenerator(BindingGenerator.getContentGenerator(namespace)); - - SOAPContentGenerator soapGen = (SOAPContentGenerator) bindingGenerator.getContentGenerator(); - Boolean booleanValue = (Boolean) optionsPage.getProtocolOptions()[0]; - Boolean booleanValue2 = (Boolean) optionsPage.getProtocolOptions()[2]; - if (booleanValue.booleanValue()) { - // Document Literal - soapGen.setStyle(SOAPContentGenerator.STYLE_DOCUMENT); - soapGen.setUse(SOAPContentGenerator.USE_LITERAL); - } - else if (booleanValue2.booleanValue()){ - // RPC Literal - soapGen.setStyle(SOAPContentGenerator.STYLE_RPC); - soapGen.setUse(SOAPContentGenerator.USE_LITERAL); - } - else { - // RPC Encoded - soapGen.setStyle(SOAPContentGenerator.STYLE_RPC); - soapGen.setUse(SOAPContentGenerator.USE_ENCODED); - } - } - else if (optionsPage.getProtocol().equals("HTTP")) { //$NON-NLS-1$ - String namespace = HTTPConstants.HTTP_NAMESPACE_URI; - bindingGenerator.setContentGenerator(BindingGenerator.getContentGenerator(namespace)); - - Boolean booleanValue = (Boolean) optionsPage.getProtocolOptions()[0]; - if (booleanValue.booleanValue()) { - // Post - ((HTTPContentGenerator) bindingGenerator.getContentGenerator()).setVerb(HTTPContentGenerator.VERB_POST); - } - else { - // Get - ((HTTPContentGenerator) bindingGenerator.getContentGenerator()).setVerb(HTTPContentGenerator.VERB_GET); - } - } - - bindingGenerator.generateBinding(); - bindingGenerator.generatePortContent(); - } - resource.save(null); - } - catch (Exception e) { - System.out.println("\nCould not write new WSDL file in WSDL Wizard: " + e); //$NON-NLS-1$ - } - - /* - * if (file != null) { final ISelection selection = new - * StructuredSelection(file); if (selection != null) { IWorkbench - * workbench = UIPlugin.getDefault().getWorkbench(); final - * IWorkbenchWindow workbenchWindow = - * workbench.getActiveWorkbenchWindow(); final IWorkbenchPart - * focusPart = workbenchWindow.getActivePage().getActivePart(); if - * (focusPart instanceof ISetSelectionTarget) { - * Display.getCurrent().asyncExec (new Runnable() { public void run() { - * ((ISetSelectionTarget)focusPart).selectReveal(selection); } }); } } } - */ - openEditor(file); - - return true; - } - - /** - * @see org.eclipse.ui.IWorkbenchWizard#init(IWorkbench, - * IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - - // Need new icon - this.setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(InternalWSDLMultiPageEditor.class, "icons/new_wsdl_wiz.gif")); //$NON-NLS-1$ - this.setWindowTitle(Messages.getString("_UI_TITLE_NEW_WSDL_FILE")); //$NON-NLS-1$ - } - - public void addPages() { - newFilePage = new WSDLNewFilePage(selection); - optionsPage = new WSDLNewFileOptionsPage(Messages.getString("_UI_TITLE_OPTIONS"), Messages.getString("_UI_TITLE_OPTIONS"), null); //$NON-NLS-1$ //$NON-NLS-2$ - addPage(newFilePage); - addPage(optionsPage); - } - - public IPath getNewFilePath() { - String fileName = newFilePage.getFileName(); - return fileName != null ? new Path(fileName) : null; - } - - public boolean canFinish() { - if (newFilePage.isPageComplete() && optionsPage.isPageComplete()) { - return true; - } - return false; - } - - static public void openEditor(final IFile iFile) { - if (iFile != null) { - IWorkbench workbench = UIPlugin.getDefault().getWorkbench(); - final IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - - Display.getDefault().asyncExec(new Runnable() { - public void run() { - try { - String editorId = null; - IEditorDescriptor editor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(iFile.getLocation().toOSString(), iFile.getContentDescription().getContentType()); - if (editor != null) { - editorId = editor.getId(); - } - workbenchWindow.getActivePage().openEditor(new FileEditorInput(iFile), editorId); - } - catch (PartInitException ex) { - // B2BGUIPlugin.getPlugin().getMsgLogger().write("Exception - // encountered when attempting to open file: " + iFile - // + "\n\n" + ex); - } - catch (CoreException ex) { - } - } - }); - } - } - - public class AvailableContentCMVisitor extends CMVisitor { - public static final int INCLUDE_ATTRIBUTES = ModelQuery.INCLUDE_ATTRIBUTES; - public static final int INCLUDE_CHILD_NODES = ModelQuery.INCLUDE_CHILD_NODES; - public static final int INCLUDE_SEQUENCE_GROUPS = ModelQuery.INCLUDE_SEQUENCE_GROUPS; - - public Hashtable childNodeTable = new Hashtable(); - public Hashtable attributeTable = new Hashtable(); - public Element rootElement; - public CMElementDeclaration rootElementDeclaration; - public boolean isRootVisited; - protected boolean includeSequenceGroups; - public DOMValidator validator; - - public AvailableContentCMVisitor(Element rootElement, CMElementDeclaration rootElementDeclaration) { - this.rootElement = rootElement; - this.rootElementDeclaration = rootElementDeclaration; - validator = new DOMValidator(); - } - - protected String getKey(CMNode cmNode) { - String key = cmNode.getNodeName(); - CMDocument cmDocument = (CMDocument) cmNode.getProperty("CMDocument"); //$NON-NLS-1$ - if (cmDocument != null) { - String namespaceURI = (String) cmDocument.getProperty("http://org.eclipse.wst/cm/properties/targetNamespaceURI"); //$NON-NLS-1$ - if (namespaceURI != null) { - key = "[" + namespaceURI + "]" + key; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return key; - } - - public List computeAvailableContent(int includeOptions) { - Vector v = new Vector(); - - int contentType = rootElementDeclaration.getContentType(); - includeSequenceGroups = ((includeOptions & INCLUDE_SEQUENCE_GROUPS) != 0); - visitCMNode(rootElementDeclaration); - - if ((includeOptions & INCLUDE_ATTRIBUTES) != 0) { - v.addAll(attributeTable.values()); - CMAttributeDeclaration nillableAttribute = (CMAttributeDeclaration) rootElementDeclaration.getProperty("http://org.eclipse.wst/cm/properties/nillable"); //$NON-NLS-1$ - if (nillableAttribute != null) { - v.add(nillableAttribute); - } - } - - if ((includeOptions & INCLUDE_CHILD_NODES) != 0) { - if (contentType == CMElementDeclaration.MIXED || contentType == CMElementDeclaration.ELEMENT) { - v.addAll(childNodeTable.values()); - } - else if (contentType == CMElementDeclaration.ANY) { - CMDocument cmDocument = (CMDocument) rootElementDeclaration.getProperty("CMDocument"); //$NON-NLS-1$ - if (cmDocument != null) { - CMNamedNodeMap elements = cmDocument.getElements(); - for (Iterator i = elements.iterator(); i.hasNext();) { - v.add((CMElementDeclaration) i.next()); - } - } - } - - if (contentType == CMElementDeclaration.MIXED || contentType == CMElementDeclaration.PCDATA || contentType == CMElementDeclaration.ANY) { - CMDataType dataType = rootElementDeclaration.getDataType(); - if (dataType != null) { - v.add(dataType); - } - } - } - return v; - } - - /* - * public void visitCMAnyElement(CMAnyElement anyElement) { String uri = - * anyElement.getNamespaceURI(); List list = - * getCMDocumentList(rootElement, rootElementDeclaration, uri); for - * (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - * CMDocument cmdocument = (CMDocument)iterator.next(); if (cmdocument != - * null) { CMNamedNodeMap map = cmdocument.getElements(); int size = - * map.getLength(); for (int i = 0; i < size; i++) { CMNode ed = - * map.item(i); - * - * childNodeTable.put(getKey(ed), ed); } } } } - */ - public void visitCMAttributeDeclaration(CMAttributeDeclaration ad) { - super.visitCMAttributeDeclaration(ad); - attributeTable.put(ad.getNodeName(), ad); - } - - public void visitCMElementDeclaration(CMElementDeclaration ed) { - if (ed == rootElementDeclaration && !isRootVisited) { - isRootVisited = true; - super.visitCMElementDeclaration(ed); - } - else { - if (!Boolean.TRUE.equals(ed.getProperty("Abstract"))) { //$NON-NLS-1$ - childNodeTable.put(getKey(ed), ed); - } - - CMNodeList substitutionGroup = (CMNodeList) ed.getProperty("SubstitutionGroup"); //$NON-NLS-1$ - if (substitutionGroup != null) { - handleSubstitutionGroup(substitutionGroup); - } - } - } - - protected void handleSubstitutionGroup(CMNodeList substitutionGroup) { - int substitutionGroupLength = substitutionGroup.getLength(); - if (substitutionGroupLength > 1) { - for (int i = 0; i < substitutionGroupLength; i++) { - CMNode ed = substitutionGroup.item(i); - if (!Boolean.TRUE.equals(ed.getProperty("Abstract"))) { //$NON-NLS-1$ - childNodeTable.put(getKey(ed), ed); - } - } - } - } - - public void visitCMGroup(CMGroup group) { - if (includeSequenceGroups) { - if (group.getOperator() == CMGroup.SEQUENCE && group.getChildNodes().getLength() > 1 && includesRequiredContent(group)) { - childNodeTable.put(group, group); - } - } - super.visitCMGroup(group); - } - - public boolean includesRequiredContent(CMGroup group) { - List list = getValidator().createContentSpecificationList(group); - return list.size() > 1; - } - - public DOMValidator getValidator() { - return validator; - } - } // ///////////////////////// here -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/PortWizard.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/PortWizard.java deleted file mode 100644 index d7d0e80b1..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/PortWizard.java +++ /dev/null @@ -1,158 +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.wizards; - -import java.util.List; - -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorPart; -import org.eclipse.wst.wsdl.Service; -import org.eclipse.wst.wsdl.internal.generator.PortGenerator; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.dialogs.ProtocolComponentControl; -import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil; -import org.eclipse.wst.wsdl.ui.internal.util.NameUtil; - -public class PortWizard extends Wizard -{ - protected final static int STYLE_NEW_BINDING = 1; - protected final static int STYLE_EXISTING_BINDING = 1 << 1; - protected final static int STYLE_DEFAULT = STYLE_NEW_BINDING | STYLE_EXISTING_BINDING; - - protected PortGenerator portGenerator; - protected PortWizardOptionsPage specifyBindingPage; - protected int style; - - /** - * Constructor for PortWizard. - */ - public PortWizard(Service service) - { - this(service, 0); - } - - public PortWizard(Service service, int style) - { - super(); - portGenerator = new PortGenerator(service); - setWindowTitle(Messages.getString("_UI_PORT_WIZARD")); //$NON-NLS-1$ - //setDefaultPageImageDescriptor(ImageDescriptor.createFromFile(WSDLEditorPlugin.class, "icons/NewXML.gif")); - } - - /** - * Return true if wizard setup is successful, false otherwise - */ - public boolean setup() - { - return true; - } - - public void addPages() - { - specifyBindingPage = new PortWizardOptionsPage(style); - addPage(specifyBindingPage); - } - - public boolean performFinish() - { - Object object = portGenerator.generatePort(); - - try - { - if (object != null) - { - IEditorPart editorPart = WSDLEditorPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - ISelectionProvider selectionProvider = (ISelectionProvider) editorPart.getAdapter(ISelectionProvider.class); - if (selectionProvider != null) - { - selectionProvider.setSelection(new StructuredSelection(object)); - } - } - } - catch (Exception e) - { - } - return true; - } - - class PortWizardOptionsPage extends WizardPage - { - - protected ProtocolComponentControl protocolComponentControl; - - public PortWizardOptionsPage(int style) - { - super("SpecifyPortPage"); //$NON-NLS-1$ - setTitle(Messages.getString("_UI_SPECIFY_PORT_DETAILS")); //$NON-NLS-1$ - setDescription(Messages.getString("_UI_SPECIFY_PORT_DETAILS_TO_BE_CREATED")); //$NON-NLS-1$ - } - - public PortGenerator getGenerator() - { - return portGenerator; - } - - public void createControl(Composite parent) - { - ProtocolComponentControl protocolComponentControl = new PortProtocolComponentControl(parent, portGenerator); - protocolComponentControl.initFields(); - setControl(protocolComponentControl); - } - } - - class PortProtocolComponentControl extends ProtocolComponentControl - { - - public PortProtocolComponentControl(Composite parent, PortGenerator generator) - { - super(parent, generator, false); - } - - public String getRefNameLabelText() - { - return Messages.getString("_UI_BINDING"); //$NON-NLS-1$ - } - - public List getRefNames() - { - return new ComponentReferenceUtil(portGenerator.getDefinition()).getBindingNames(); - } - - public String getDefaultName() - { - Service service = portGenerator.getService(); - return NameUtil.buildUniquePortName(service, null); - } - - public ContentGeneratorOptionsPage createContentGeneratorOptionsPage(String protocol) - { - ContentGeneratorOptionsPage optionsPage = null; - String protocolSelection = protocolCombo.getItem(protocolCombo.getSelectionIndex()); - if (protocolSelection.equals("SOAP")) { //$NON-NLS-1$ - optionsPage = new SoapBindingOptionsPage(); - } - else if (protocolSelection.equals("HTTP")) { //$NON-NLS-1$ - optionsPage = new SoapBindingOptionsPage(); - } -// ContentGeneratorExtension extension = WSDLEditorPlugin.getInstance().getContentGeneratorExtensionRegistry().getContentGeneratorExtension(protocol); -// if (extension != null) -// { -// optionsPage = extension.createPortContentGeneratorOptionsPage(); -// } - return optionsPage; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/SoapBindingOptionsPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/SoapBindingOptionsPage.java deleted file mode 100644 index d36c7fc31..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/SoapBindingOptionsPage.java +++ /dev/null @@ -1,189 +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.wizards; - -import java.util.List; - -import javax.xml.namespace.QName; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.wsdl.Binding; -import org.eclipse.wst.wsdl.BindingFault; -import org.eclipse.wst.wsdl.BindingOperation; -import org.eclipse.wst.wsdl.Definition; -import org.eclipse.wst.wsdl.ExtensibilityElement; -import org.eclipse.wst.wsdl.binding.soap.internal.generator.SOAPContentGenerator; -import org.eclipse.wst.wsdl.internal.generator.BaseGenerator; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil; -import org.w3c.dom.Element; - - -public class SoapBindingOptionsPage implements ContentGeneratorOptionsPage, SelectionListener -{ - protected Button docLiteral; - protected Button rpcLiteral; - protected Button rpcEncoded; - protected Composite control; - protected BaseGenerator generator; - - public SoapBindingOptionsPage() - { - } - - public void init(BaseGenerator generator) - { - this.generator = generator; - } - - public Composite createControl(Composite parent) - { - control = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - control.setLayout(layout); - - Label separator = new Label(control, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData gd= new GridData(); - gd.horizontalAlignment= GridData.FILL; - gd.grabExcessHorizontalSpace= true; - separator.setLayoutData(gd); - - Label optionsHeading = new Label(control, SWT.NONE); - optionsHeading.setText(Messages.getString("_UI_LABEL_SOAP_BINDING_OPTIONS")); //$NON-NLS-1$ - - docLiteral = new Button(control, SWT.RADIO); - docLiteral.setText(Messages.getString("_UI_RADIO_DOCUMENT_LITERAL")); //$NON-NLS-1$ - docLiteral.setSelection(true); - - rpcLiteral = new Button(control, SWT.RADIO); - rpcLiteral.setText(Messages.getString("_UI_RADIO_RPC_LITERAL")); //$NON-NLS-1$ - - rpcEncoded = new Button(control, SWT.RADIO); - rpcEncoded.setText(Messages.getString("_UI_RADIO_RPC_ENCODED")); //$NON-NLS-1$ - - if (generator.getName() != null) - { - Definition definition = generator.getDefinition(); - QName qname = new QName(definition.getTargetNamespace(), generator.getName()); - Binding binding = (Binding) definition.getBinding(qname); - - if (binding != null) - { - List eeList = binding.getEExtensibilityElements(); - if (eeList.size() > 0) - { - ExtensibilityElement ee = (ExtensibilityElement) eeList.get(0); - - Element element = WSDLEditorUtil.getInstance().getElementForObject(ee); - String style = element.getAttribute("style"); //$NON-NLS-1$ - - if ("rpc".equals(style)) //$NON-NLS-1$ - { - // Try to determine if it's RPC Literal or RPC Encoded - String use = "encoded"; //$NON-NLS-1$ - List operations = binding.getEBindingOperations(); - if (operations.size() > 0) { - element = null; - BindingOperation operation = (BindingOperation) operations.get(0); - if (operation.getEBindingInput() != null && operation.getEBindingInput().getEExtensibilityElements().size() > 0) { - Object object = operation.getEBindingInput().getEExtensibilityElements().get(0); - element = WSDLEditorUtil.getInstance().getElementForObject(object); - } - else if (operation.getEBindingOutput() != null && operation.getEBindingOutput().getEExtensibilityElements().size() > 0) { - Object object = operation.getEBindingOutput().getEExtensibilityElements().get(0); - element = WSDLEditorUtil.getInstance().getElementForObject(object); - } - else if (operation.getEBindingFaults().size() > 0) { - BindingFault fault = (BindingFault) operation.getEBindingFaults().get(0); - List faultEE = fault.getExtensibilityElements(); - - if (faultEE.size() > 0) { - element = WSDLEditorUtil.getInstance().getElementForObject(faultEE.get(0)); - } - } - - if (element != null) { - use = element.getAttribute("use"); //$NON-NLS-1$ - } - } - - if (use != null && "literal".equals(use)) { //$NON-NLS-1$ - docLiteral.setSelection(false); - rpcLiteral.setSelection(true); - rpcEncoded.setSelection(false); - } - else { - docLiteral.setSelection(false); - rpcLiteral.setSelection(false); - rpcEncoded.setSelection(true); - } - } - } - } - } - - docLiteral.addSelectionListener(this); - rpcLiteral.addSelectionListener(this); - rpcEncoded.addSelectionListener(this); - computeOptions(); - - return control; - } - - public Composite getControl() { - return control; - } - - public boolean isOverwriteApplicable() - { - return true; - } - - public void widgetSelected(SelectionEvent event) - { - computeOptions(); - } - - protected void computeOptions() - { - if (generator.getContentGenerator() instanceof SOAPContentGenerator) { - SOAPContentGenerator soapGenerator = (SOAPContentGenerator) generator.getContentGenerator(); - if (docLiteral.getSelection()) { - soapGenerator.setStyle(SOAPContentGenerator.STYLE_DOCUMENT); - soapGenerator.setUse(SOAPContentGenerator.USE_LITERAL); - } - else if (rpcLiteral.getSelection()) { - soapGenerator.setStyle(SOAPContentGenerator.STYLE_RPC); - soapGenerator.setUse(SOAPContentGenerator.USE_LITERAL); - } - else if (rpcEncoded.getSelection()) { - soapGenerator.setStyle(SOAPContentGenerator.STYLE_RPC); - soapGenerator.setUse(SOAPContentGenerator.USE_ENCODED); - } - } - } - - public void setOptionsOnGenerator() { - computeOptions(); - } - - public void widgetDefaultSelected(SelectionEvent event) - { - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFileOptionsPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFileOptionsPage.java deleted file mode 100644 index c217064a8..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFileOptionsPage.java +++ /dev/null @@ -1,611 +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.wizards; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Vector; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.help.WorkbenchHelp; -import org.eclipse.ui.part.PageBook; -import org.eclipse.wst.wsdl.ui.internal.Messages; -import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin; -import org.eclipse.wst.wsdl.ui.internal.util.ValidateHelper; -import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo; -import org.eclipse.wst.xml.ui.internal.dialogs.UpdateListener; - -public class WSDLNewFileOptionsPage extends WizardPage implements ModifyListener, UpdateListener, SelectionListener -{ - protected Text targetNamespaceText; - protected Text prefixText; - protected boolean updatePortOpFieldBoolean = true; - - protected PageBook protocolPageBook; - protected Combo protocolCombo; - protected Composite soapPage; - protected Composite httpPage; - protected Button docLitRadio; - protected Button rpcLitRadio; - protected Button rpcEncRadio; - protected Button httpGetRadio; - protected Button httpPostRadio; - -// private BindingGenerator generator; - - /** - * Constructor for WSDLNewFileOptionsPage. - * @param pageName - */ - public WSDLNewFileOptionsPage(String pageName) - { - super(pageName); - } - /** - * Constructor for WSDLNewFileOptionsPage. - * @param pageName - * @param title - * @param titleImage - */ - public WSDLNewFileOptionsPage(String pageName, String title, ImageDescriptor titleImage) - { - super(pageName, title, titleImage); - setDescription(Messages.getString("_UI_DESCRIPTION_NEW_WSDL_FILE")); //$NON-NLS-1$ - } - /** - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) - { - Composite base = new Composite(parent, SWT.NONE); - WorkbenchHelp.setHelp(base, Messages.getString("_UI_HELP")); //$NON-NLS-1$ - base.setLayout(new GridLayout()); - - // Group wsdlGroup = ViewUtility.createGroup(base, 2, "WSDL", false); - Composite wsdlGroup = new Composite(base, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - wsdlGroup.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - wsdlGroup.setLayoutData(data); - - GridData gd = (GridData)wsdlGroup.getLayoutData(); - gd.grabExcessHorizontalSpace = true; - - Label targetNamespace = new Label(wsdlGroup, SWT.LEFT); - targetNamespace.setText(Messages.getString("_UI_LABEL_TARGET_NAMESPACE")); //$NON-NLS-1$ - GridData nsData = new GridData(); - nsData.horizontalAlignment = GridData.FILL; - targetNamespace.setLayoutData(nsData); - - targetNamespaceText = new Text(wsdlGroup, SWT.SINGLE | SWT.BORDER); - GridData textData = new GridData(); - textData.horizontalAlignment = GridData.FILL; - textData.grabExcessHorizontalSpace = true; - textData.widthHint = 10; - targetNamespaceText.setLayoutData(textData); - - targetNamespaceText.addModifyListener(this); - - Label prefix = new Label(wsdlGroup, SWT.LEFT); - prefix.setText(Messages.getString("_UI_LABEL_PREFIX_WITH_COLON")); //$NON-NLS-1$\ - - GridData prefixData = new GridData(); - prefixData.horizontalAlignment = GridData.FILL; - prefix.setLayoutData(prefixData); - - prefixText = new Text(wsdlGroup, SWT.SINGLE | SWT.BORDER); - GridData prefixTextData = new GridData(); - prefixTextData.horizontalAlignment = GridData.FILL; - prefixTextData.grabExcessHorizontalSpace = true; - prefixTextData.widthHint = 10; - prefixText.setLayoutData(prefixTextData); - - prefixText.addModifyListener(this); - - // XMLCatalog xmlCatalog = XMLCatalogRegistry.getInstance().lookupOrCreateXMLCatalog("default"); - // SelectXMLCatalogIdPanel catalog = new SelectXMLCatalogIdPanel(base, xmlCatalog); - -// Determine if the user wishes to create a skeleton WSDL. If yes, present the user with input fields. - createSkeletonCheckBox = new Button(base, SWT.CHECK); - createSkeletonCheckBox.setText(Messages.getString("_UI_LABEL_CREATE_WSDL_SKELETON")); //$NON-NLS-1$ - createSkeletonCheckBox.setSelection(true); - - wsdlSkeletonGroup = new Composite(base, SWT.NONE); - GridLayout layout2 = new GridLayout(); - layout2.numColumns = 2; - wsdlSkeletonGroup.setLayout(layout2); - - GridData data2 = new GridData(); - data2.verticalAlignment = GridData.FILL; - data2.horizontalAlignment = GridData.FILL; - wsdlSkeletonGroup.setLayoutData(data2); - - createLabel(wsdlSkeletonGroup, Messages.getString("_UI_LABEL_BINDING_PROTOCOL")); //$NON-NLS-1$ - protocolCombo = new Combo(wsdlSkeletonGroup, SWT.READ_ONLY); - GridData dataC = new GridData(); - dataC.horizontalAlignment = GridData.FILL; - dataC.grabExcessHorizontalSpace = true; - protocolCombo.setLayoutData(dataC); - protocolCombo.add(SOAP_PROTOCOL); - protocolCombo.add(HTTP_PROTOCOL); - protocolCombo.select(0); - protocolCombo.addModifyListener(this); - - sepLabel = new Label(base, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData sepData = new GridData(); - sepData.horizontalAlignment = GridData.FILL; - sepData.grabExcessHorizontalSpace = true; - sepLabel.setLayoutData(sepData); - - - // Create PageBook and pages/controls for the PageBook - protocolPageBook = new PageBook(base, SWT.NONE); - - ///////////////////////// Soap Page - soapPage = new Composite(protocolPageBook, SWT.NONE); - GridLayout pbLayout = new GridLayout(); - soapPage.setLayout(pbLayout); - - GridData pbData = new GridData(); - pbData.verticalAlignment = GridData.FILL; - pbData.horizontalAlignment = GridData.FILL; - soapPage.setLayoutData(pbData); - - createLabel(soapPage, Messages.getString("_UI_LABEL_SOAP_BINDING_OPTIONS")); //$NON-NLS-1$ - docLitRadio = new Button(soapPage, SWT.RADIO); - rpcLitRadio = new Button(soapPage, SWT.RADIO); - rpcEncRadio = new Button(soapPage, SWT.RADIO); - docLitRadio.setText(SOAP_DOCUMENT_LITERAL); - rpcLitRadio.setText(SOAP_RPC_LITERAL); - rpcEncRadio.setText(SOAP_RPC_ENCODED); - docLitRadio.setSelection(true); - - ///////////////////////// Http Page - httpPage = new Composite(protocolPageBook, SWT.NONE); - pbLayout = new GridLayout(); - httpPage.setLayout(pbLayout); - - pbData = new GridData(); - pbData.verticalAlignment = GridData.FILL; - pbData.horizontalAlignment = GridData.FILL; - httpPage.setLayoutData(pbData); - - createLabel(httpPage, Messages.getString("_UI_LABEL_HTTP_BINDING_OPTIONS")); // Already Externalized //$NON-NLS-1$ - httpGetRadio = new Button(httpPage, SWT.RADIO); - httpPostRadio = new Button(httpPage, SWT.RADIO); - httpGetRadio.setText(HTTP_GET); - httpPostRadio.setText(HTTP_POST); - httpGetRadio.setSelection(true); - - wsdlSkeletonGroup.setVisible(true); - sepLabel.setVisible(true); - protocolPageBook.showPage(soapPage); - protocolPageBook.setVisible(true); - - ////////////////////////// Add Selection Listeners - createSkeletonCheckBox.addSelectionListener(this); - -// BindingProtocolComponentControl component = new BindingProtocolComponentControl(base, generator, false); -// component.initFields(); - - setControl(base); - } - - private NewWSDLWizard getNewWSDLWizard() - { - return (NewWSDLWizard)getWizard(); - } - - private String computeDefaultDefinitionName() - { - String name = "DefaultName"; //$NON-NLS-1$ - IPath path = getNewWSDLWizard().getNewFilePath(); - if (path != null) - { - name = path.removeFileExtension().lastSegment().toString(); - } - return name; - } - - private String computeDefaultNamespaceName() - { - String namespace = WSDLEditorPlugin.getInstance().getPreferenceStore().getString(Messages.getString("_UI_PREF_PAGE_DEFAULT_TARGET_NAMESPACE")); //$NON-NLS-1$ - if (!namespace.endsWith("/")) { //$NON-NLS-1$ - namespace = namespace.concat("/"); //$NON-NLS-1$ - } - - IPath path = getNewWSDLWizard().getNewFilePath(); - if (path != null) - { - namespace += path.removeFileExtension().toString() + "/"; //$NON-NLS-1$ - } - return namespace; - } - - public void setVisible(boolean visible) - { - super.setVisible(visible); - - if (visible) - { - // prime the fields - targetNamespaceText.setText(computeDefaultNamespaceName()); - prefixText.setText("tns"); //$NON-NLS-1$ - } - } - - public String getTargetNamespace() - { - return targetNamespaceText.getText(); - } - - public String getPrefix() - { - return prefixText.getText().trim(); - } - - public String getDefinitionName() - { - return computeDefaultDefinitionName(); - } - - public void modifyText(ModifyEvent e) - { - if (e.widget == targetNamespaceText) - { - startDelayedEvent(e); - } - else if (e.widget == prefixText) - { - setPageComplete(isPageComplete()); - } - else if (e.widget == protocolCombo) { - // Update what page/control we show in the PageBook - if (protocolCombo.getText().equals("SOAP")) { //$NON-NLS-1$ - protocolPageBook.showPage(soapPage); - } - else if (protocolCombo.getText().equals("HTTP")) { //$NON-NLS-1$ - protocolPageBook.showPage(httpPage); - } - } - } - - public void updateOccured(Object arg1, Object arg2) - { - setPageComplete(isPageComplete()); - } - - public boolean isPageComplete() - { - boolean ready = true; - - setErrorMessage(null); - - // so that the page doesn't immediately show up with an error - if (targetNamespaceText.getText().trim().equals("")) //$NON-NLS-1$ - { - if (ready) - { - setErrorMessage(null); - } - return false; - } - - if (!validateTargetNamespace(targetNamespaceText.getText())) - { - ready = false; - } - - return ready; - } - - protected boolean validatePrefix(String prefix) - { - String errorMessage = ValidateHelper.checkXMLPrefix(prefix); - - if (errorMessage == null || errorMessage.length() == 0) - { - return true; - } - return false; - } - - protected boolean validateXMLName(String xmlName) - { - String errorMessage = ValidateHelper.checkXMLName(xmlName); - - if (errorMessage == null || errorMessage.length() == 0) - { - return true; - } - setErrorMessage(errorMessage); - return false; - } - - protected boolean validateTargetNamespace(String ns) - { - boolean test = true; - try - { - new URI(ns); -// URI testURI = new URI(ns); - // if (!testURI.isGenericURI()) - // { - // setErrorMessage(WSDLEditorPlugin.getInstance().getWSDLString("_UI_ERROR_NAMESPACE_INVALID")); //$NON-NLS-1$ - // test = false; - // } - } - catch (URISyntaxException e) - { - // String errorMessage = ValidateHelper.checkXMLName(ns); - // if (errorMessage == null || errorMessage.length() == 0) - // { - // test = true; - // } - // else - // { - setErrorMessage(Messages.getString("_UI_ERROR_NAMESPACE_INVALID")); //$NON-NLS-1$ - test = false; - // } - } - - return test; - } - - /* - private boolean arePrefixesUniqueAndValid() - { - java.util.List infoList = namespaceInfo.getNamespaceInfoList(); - java.util.List checkedList = namespaceInfo.getNamespaceCheckedList(); - - Vector prefixList = new Vector(); - boolean test = true; - boolean isOneBlank = false; - - String currentPrefix = prefixText.getText().trim(); - if (currentPrefix.length() == 0) - { - isOneBlank = true; - } - else - { - if (validatePrefix(currentPrefix)) - { - prefixList.add(currentPrefix); - } - else - { - setErrorMessage(WSDLEditorPlugin.getWSDLString("_UI_ERROR_PREFIX_IS_INVALID", currentPrefix)); //$NON-NLS-1$ - return false; - } - } - - for (int i = 0; i < infoList.size(); i++) - { - NamespaceInfo info = (NamespaceInfo)infoList.get(i); - if (((String)checkedList.get(i)).equals("true")) //$NON-NLS-1$ - { - String aPrefix = info.prefix.trim(); - if (aPrefix.length() > 0) - { - if (!prefixList.contains(aPrefix)) - { - if (validatePrefix(aPrefix)) - { - prefixList.add(aPrefix); - } - else - { - setErrorMessage(WSDLEditorPlugin.getWSDLString("_UI_ERROR_PREFIX_IS_INVALID", info.prefix)); //$NON-NLS-1$ - test = false; - break; - } - } - else - { - setErrorMessage(WSDLEditorPlugin.getWSDLString("_UI_ERROR_PREFIX_IS_A_DUPLICATE", info.prefix)); //$NON-NLS-1$ - test = false; - break; - } - } - else - { - if (!isOneBlank) - { - isOneBlank = true; - } - else - { - setErrorMessage(WSDLEditorPlugin.getWSDLString("_UI_ERROR_MORE_THAN_ONE_PREFIX_IS_BLANK")); //$NON-NLS-1$ - test = false; - break; - } - } - } - } - return test; - } - */ - - protected DelayedEvent delayedTask; - protected void startDelayedEvent(ModifyEvent e) - { - if (delayedTask == null || delayedTask.getEvent() == null) - { - delayedTask = new DelayedEvent(); - delayedTask.setEvent(e); - Display.getDefault().timerExec(500, delayedTask); - } - else - { - ModifyEvent delayedEvent = delayedTask.getEvent(); - - if (e.widget == delayedEvent.widget) - { - // 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 ModifyEvent event; - - /* - * @see Runnable#run() - */ - public void run() - { - if (event != null) - { - setPageComplete(isPageComplete()); - event = null; - } - } - - public ModifyEvent getEvent() - { - return event; - } - - public void setEvent(ModifyEvent event) - { - this.event = event; - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == createSkeletonCheckBox) { - if (createSkeletonCheckBox.getSelection()) { - wsdlSkeletonGroup.setVisible(true); - sepLabel.setVisible(true); - protocolPageBook.setVisible(true); - } - else { - wsdlSkeletonGroup.setVisible(false); - sepLabel.setVisible(false); - protocolPageBook.setVisible(false); - } - } - } - - private static final String SOAP_PROTOCOL = "SOAP"; //$NON-NLS-1$ - private static final String HTTP_PROTOCOL = "HTTP"; //$NON-NLS-1$ - private static final String SOAP_RPC_ENCODED = Messages.getString("_UI_RADIO_RPC_ENCODED"); //$NON-NLS-1$ - private static final String SOAP_RPC_LITERAL = Messages.getString("_UI_RADIO_RPC_LITERAL"); //$NON-NLS-1$ - private static final String SOAP_DOCUMENT_LITERAL = Messages.getString("_UI_RADIO_DOCUMENT_LITERAL"); //$NON-NLS-1$ - private static final String HTTP_POST = "HTTP POST"; //$NON-NLS-1$ - private static final String HTTP_GET = "HTTP GET"; //$NON-NLS-1$ - - Composite wsdlSkeletonGroup; - Button createSkeletonCheckBox; - - Label sepLabel; - - private Label createLabel(Composite comp, String labelString) { - Label label = new Label(comp, SWT.LEFT); - label.setText(labelString); - GridData nsData = new GridData(); - nsData.horizontalAlignment = GridData.FILL; - label.setLayoutData(nsData); - - return label; - } - - public Vector getNamespaceInfo() { - Vector namespaces = new Vector(); - - // Add Default Namespaces - NamespaceInfo info1 = new NamespaceInfo(); - info1.prefix = "wsdl"; //$NON-NLS-1$ - info1.uri = "http://schemas.xmlsoap.org/wsdl/"; //$NON-NLS-1$ - namespaces.addElement(info1); - - NamespaceInfo info8 = new NamespaceInfo(); - info8.prefix = "xsd"; //$NON-NLS-1$ - info8.uri = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$ - namespaces.addElement(info8); - - return namespaces; - } - - public boolean getCreateSkeletonBoolean() { - return createSkeletonCheckBox.getSelection(); - } - - public String getProtocol() { - return protocolCombo.getText(); - } - - public Object[] getProtocolOptions() { - Object bool[] = new Boolean[3]; - if (protocolCombo.getText().equals(SOAP_PROTOCOL)) { - if (docLitRadio.getSelection()) { - bool[0] = new Boolean(true); - } - else { - bool[0] = new Boolean(false); - } - - if (rpcLitRadio.getSelection()) { - bool[2] = new Boolean(true); - } - else { - bool[2] = new Boolean(false); - } - } - else if (protocolCombo.getText().equals(HTTP_PROTOCOL)){ - if (httpGetRadio.getSelection()) { - bool[0] = new Boolean(false); - } - else { - bool[0] = new Boolean(true); - } - } - - return bool; - } - - public boolean isSoapDocLiteralProtocol() { - if (getProtocol().equals(SOAP_PROTOCOL) && docLitRadio.getSelection()) { - return true; - } - else { - return false; - } - } -} diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFilePage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFilePage.java deleted file mode 100644 index 4a5251abd..000000000 --- a/bundles/org.eclipse.wst.wsdl.ui/src-asd-wsdl11/org/eclipse/wst/wsdl/ui/internal/wizards/WSDLNewFilePage.java +++ /dev/null @@ -1,132 +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.wizards; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.wst.wsdl.ui.internal.Messages; - -public class WSDLNewFilePage extends WizardNewFileCreationPage -{ - public WSDLNewFilePage(IStructuredSelection selection) - { - super(Messages.getString("_UI_TITLE_NEW_WSDL_FILE"), selection); //$NON-NLS-1$ - setTitle(Messages.getString("_UI_TITLE_NEW_WSDL_FILE")); //$NON-NLS-1$ - setDescription(Messages.getString("_UI_LABEL_CREATE_NEW_WSDL_FILE")); //$NON-NLS-1$ - } - - public void createControl(Composite parent) - { - // inherit default container and name specification widgets - super.createControl(parent); - this.setFileName(computeDefaultFileName()); - - setPageComplete(validatePage()); - } - - protected boolean validatePage() - { - Path newName = new Path(getFileName()); - String fullFileName = getFileName(); - String extension = newName.getFileExtension(); - if (extension == null || !extension.equalsIgnoreCase("wsdl")) //$NON-NLS-1$ - { - setErrorMessage(Messages.getString("_UI_ERROR_FILE_MUST_END_WITH_WSDL")); //$NON-NLS-1$ - return false; - } - else - { - setErrorMessage(null); - } - - // check for file should be case insensitive - String sameName = existsFileAnyCase(fullFileName); - if (sameName != null) - { -// String qualifiedFileName = getContainerFullPath().toString() + '/' + fullFileName; - setErrorMessage(Messages.getString("_UI_ERROR_FILE_ALREADY_EXISTS", sameName)); //$NON-NLS-1$ - return false; - } - - - return super.validatePage(); - } - - public String defaultName = "NewWSDLFile"; //$NON-NLS-1$ - public String defaultFileExtension = ".wsdl"; //$NON-NLS-1$ - public String[] filterExtensions = { "*.wsdl"}; //$NON-NLS-1$ - - - protected String computeDefaultFileName() - { - int count = 0; - String fileName = defaultName + defaultFileExtension; - IPath containerFullPath = getContainerFullPath(); - if (containerFullPath != null) - { - while (true) - { - IPath path = containerFullPath.append(fileName); - // if (WorkbenchUtility.getWorkspace().getRoot().exists(path)) - if (ResourcesPlugin.getWorkspace().getRoot().exists(path)) - { - count++; - fileName = defaultName + count + defaultFileExtension; - } - else - { - break; - } - } - } - return fileName; - } - - // returns true if file of specified name exists in any case for selected container - protected String existsFileAnyCase(String fileName) - { - if ( (getContainerFullPath() != null) && (getContainerFullPath().isEmpty() == false) - && (fileName.compareTo("") != 0)) //$NON-NLS-1$ - { - //look through all resources at the specified container - compare in upper case - IResource parent = ResourcesPlugin.getWorkspace().getRoot().findMember(getContainerFullPath()); - if (parent instanceof IContainer) - { - IContainer container = (IContainer) parent; - try - { - IResource[] members = container.members(); - String enteredFileUpper = fileName.toUpperCase(); - for (int i=0; i<members.length; i++) - { - String resourceUpperName = members[i].getName().toUpperCase(); - if (resourceUpperName.equals(enteredFileUpper)) - { - return members[i].getName(); - } - } - } - catch (CoreException e) - { - } - } - } - return null; - } - -} |