Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties')
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java438
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java48
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java216
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java154
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java248
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java323
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java243
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java259
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java261
-rw-r--r--bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java138
10 files changed, 0 insertions, 2328 deletions
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java
deleted file mode 100644
index 25a776f86..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDAbstractSection.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.FileStoreEditorInput;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.views.properties.tabbed.ISection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.DesignViewGraphicsConstants;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObjectListener;
-
-public class ASDAbstractSection implements ISection, IASDObjectListener, Listener, SelectionListener
-{
- private TabbedPropertySheetWidgetFactory factory;
- private Object elementModel;
- protected boolean isReadOnly = false;
- protected Composite composite;
- protected int rightMarginSpace;
- protected int tableMinimumWidth = 50;
- protected CustomListener customListener = new CustomListener();
-
- protected List listeners = new ArrayList();
-
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage)
- {
- createControls(parent, tabbedPropertySheetPage.getWidgetFactory());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory aFactory)
- {
- this.factory = aFactory;
- GC gc = new GC(parent);
- Point extent = gc.textExtent(" ... "); //$NON-NLS-1$
- rightMarginSpace = extent.x;
- gc.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#setInput(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- public void setInput(IWorkbenchPart part, ISelection selection)
- {
- Assert.isTrue(selection instanceof IStructuredSelection);
- Object input = ((IStructuredSelection)selection).getFirstElement();
- elementModel = input;
- attachListener(elementModel);
-
- if (input instanceof IASDObject) {
- isReadOnly = ((IASDObject) input).isReadOnly();
- }
-
- IEditorPart owningEditor = null;
- if (part!=null) {
- if (part instanceof IEditorPart) {
- owningEditor = (IEditorPart)part;
- } else {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench != null) {
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- owningEditor = page.getActiveEditor();
- }
- }
- }
- }
- }
- if (owningEditor != null) {
- IEditorInput editorInput = owningEditor.getEditorInput();
- if (!(editorInput instanceof IFileEditorInput || editorInput instanceof FileStoreEditorInput)) {
- isReadOnly = true;
- }
- }
- refresh();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeShown()
- */
- public void aboutToBeShown()
- {
- refresh();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#aboutToBeHidden()
- */
- public void aboutToBeHidden()
- {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#dispose()
- */
- public void dispose()
- {
- unattachAllListeners();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#getMinimumHeight()
- */
- public int getMinimumHeight()
- {
- return SWT.DEFAULT;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#shouldUseExtraSpace()
- */
- public boolean shouldUseExtraSpace()
- {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISection#refresh()
- */
- public void refresh()
- {
- if (!composite.isDisposed())
- {
- if (isReadOnly)
- {
- composite.setEnabled(false);
- }
- else
- {
- composite.setEnabled(true);
- }
- }
- }
-
- /**
- * Get the widget factory.
- * @return the widget factory.
- */
- public TabbedPropertySheetWidgetFactory getWidgetFactory() {
- return factory;
- }
-
- public void propertyChanged(Object object, String property)
- {
- refresh();
- }
-
-
- public void doWidgetDefaultSelected(SelectionEvent e)
- {}
-
- public void doWidgetSelected(SelectionEvent e)
- {}
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e)
- {
- if (isListenerEnabled() && !isInDoHandle)
- {
- isInDoHandle = true;
- doWidgetDefaultSelected(e);
- isInDoHandle = false;
- }
-
- }
-
- /**
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e)
- {
- if (isListenerEnabled() && !isInDoHandle)
- {
- isInDoHandle = true;
- doWidgetSelected(e);
- isInDoHandle = false;
- }
-
- }
-
- boolean listenerEnabled = true;
- /**
- * Get the value of listenerEnabled.
- * @return value of listenerEnabled.
- */
- public boolean isListenerEnabled()
- {
- return listenerEnabled;
- }
-
- public void applyTextListeners(Control control)
- {
- control.addListener(SWT.FocusOut, customListener);
- control.addListener(SWT.KeyDown, customListener);
- }
-
- public void removeListeners(Control control)
- {
- control.removeListener(SWT.FocusOut, customListener);
- control.removeListener(SWT.KeyDown, customListener);
- }
-
- /**
- * Set the value of listenerEnabled.
- * @param v Value to assign to listenerEnabled.
- */
- public void setListenerEnabled(boolean v)
- {
- this.listenerEnabled = v;
- }
-
- public void handleEvent(Event event)
- {
- if (isListenerEnabled() && !isInDoHandle)
- {
- isInDoHandle = true;
-// startDelayedEvent(event);
- doHandleEvent(event);
- isInDoHandle = false;
- } // end of if ()
- }
-
- public void doHandleEvent(Event event)
- {
-
- }
-
- protected DelayedEvent delayedTask;
-
- protected void startDelayedEvent(Event e)
- {
- if (delayedTask == null ||
- delayedTask.getEvent() == null)
- {
- delayedTask = new DelayedEvent();
- delayedTask.setEvent(e);
- Display.getDefault().timerExec(500,delayedTask);
- }
- else
- {
- Event delayedEvent = delayedTask.getEvent();
-
- if (e.widget == delayedEvent.widget &&
- e.type == delayedEvent.type)
- {
- // same event, just different data, delay new event
- delayedTask.setEvent(null);
- }
- delayedTask = new DelayedEvent();
- delayedTask.setEvent(e);
- Display.getDefault().timerExec(500,delayedTask);
- }
- }
-
- class DelayedEvent implements Runnable
- {
- protected Event event;
-
- /*
- * @see Runnable#run()
- */
- public void run()
- {
- if (event != null)
- {
- isInDoHandle = true;
- doHandleEvent(event);
- isInDoHandle = false;
- event = null;
- }
- }
-
- /**
- * Gets the event.
- * @return Returns a Event
- */
- public Event getEvent()
- {
- return event;
- }
-
- /**
- * Sets the event.
- * @param event The event to set
- */
- public void setEvent(Event event)
- {
- this.event = event;
- }
-
- }
-
- class CustomListener implements Listener
- {
- boolean isHandlingEvent = false;
- public void handleEvent(Event event)
- {
- if (isListenerEnabled() && !isReadOnly)
- {
- switch (event.type)
- {
- case SWT.KeyDown :
- {
- if (event.character == SWT.CR)
- {
- if (!isHandlingEvent)
- {
- isHandlingEvent = true;
- doHandleEvent(event);
- isHandlingEvent = false;
- }
- }
- break;
- }
- case SWT.FocusOut :
- {
- if (!isHandlingEvent)
- {
- isHandlingEvent = true;
- doHandleEvent(event);
- isHandlingEvent = false;
- }
- break;
- }
- }
- }
- }
- }
-
- protected boolean isInDoHandle;
- /**
- * Get the value of isInDoHandle.
- * @return value of isInDoHandle.
- */
- public boolean isInDoHandle()
- {
- return isInDoHandle;
- }
-
- static protected IStatusLineManager getStatusLineManager(IEditorPart editorPart)
- {
- IStatusLineManager result = null;
- try
- {
- EditorActionBarContributor contributor = (EditorActionBarContributor)editorPart.getEditorSite().getActionBarContributor();
- result = contributor.getActionBars().getStatusLineManager();
- }
- catch (Exception e)
- {
- }
- return result;
- }
-
- public Object getModel() {
- return elementModel;
- }
-
- protected void attachListener(Object object) {
- if (object instanceof IASDObject && !listeners.contains(object)) {
- ((IASDObject) object).registerListener(this);
- listeners.add(object);
- }
- }
-
- protected void unattachAllListeners() {
- Iterator it = listeners.iterator();
- while (it.hasNext()) {
- Object item = it.next();
- ((IASDObject) item).unregisterListener(this);
- }
- }
-
- protected void setControlForegroundColor(Control control) {
- if (control != null) {
- if (isReadOnly) {
- control.setForeground(DesignViewGraphicsConstants.readOnlyLabelColor);
- }
- else {
- control.setForeground(DesignViewGraphicsConstants.labelColor);
- }
- }
- }
-
- protected void executeCommand(Command command) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-
- if (page.getActiveEditor() != null && page.getActiveEditor().getAdapter(CommandStack.class) != null) {
- CommandStack stack = (CommandStack) page.getActiveEditor().getAdapter(CommandStack.class);
- stack.execute(command);
- }
- else {
- command.execute();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java
deleted file mode 100644
index d1f65d62b..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ASDTabbedPropertySheetPage.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-public class ASDTabbedPropertySheetPage extends TabbedPropertySheetPage implements ISelectionChangedListener//, IElementListener
-{
- /**
- * @param tabbedPropertySheetPageContributor
- */
- public ASDTabbedPropertySheetPage(ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor)
- {
- super(tabbedPropertySheetPageContributor);
-// tabContributor = tabbedPropertySheetPageContributor;
- }
-
- public void createControl(Composite parent) {
- super.createControl(parent);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- if (!event.getSelection().isEmpty()) {
- selectionChanged(getSite().getWorkbenchWindow().getActivePage().getActivePart(), event.getSelection());
- //super.selectionChanged(getSite().getWorkbenchWindow().getActivePage().getActivePart(), event.getSelection());
- }
- }
-
- public void dispose() {
- super.dispose();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java
deleted file mode 100644
index 4a77b8a0f..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/BindingSection.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CommandStack;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.wsdl.ui.internal.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingInterfaceAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewInterfaceAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface;
-import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-
-public class BindingSection extends ReferenceSection implements SelectionListener {
- protected ComponentReferenceEditManager refManager;
- private CLabel protocolValue;
-// private CLabel optionsValue;
- private Button regenBindingButton;
-
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) {
- super.createControls(parent, factory);
- comboLabel.setText(org.eclipse.wst.wsdl.ui.internal.asd.Messages._UI_LABEL_PORTTYPE + ":"); //$NON-NLS-1$ //$NON-NLS-2$
-
- CLabel protocolLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BINDING_PROTOCOL);
- protocolValue= getWidgetFactory().createCLabel(composite, ""); //$NON-NLS-1$
-
- // Layout protocolLabel
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(protocolValue, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(protocolValue, 0, SWT.CENTER);
- protocolLabel.setLayoutData(data);
-
- // Layout protocolValue
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(combo, 0);
-// data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE);
- protocolValue.setLayoutData(data);
-
- /*
- CLabel optionsLabel = getWidgetFactory().createCLabel(composite, Messages.getString("_UI_TITLE_OPTIONS") + ":");
- optionsValue = getWidgetFactory().createCLabel(composite, "");
-
- // Layout optionsLabel
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(optionsValue, 0, SWT.CENTER);
- optionsLabel.setLayoutData(data);
-
- // Layout optionsValue
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(protocolValue, -ITabbedPropertyConstants.VSPACE);
-// data.top = new FormAttachment(protocolValue, +ITabbedPropertyConstants.VSPACE);
- optionsValue.setLayoutData(data);
-
- String buttonLabel = org.eclipse.wst.wsdl.ui.internal.asd.Messages.getString("_UI_GENERATE_BINDING_CONTENT");
- regenBindingButton = getWidgetFactory().createButton(composite, buttonLabel, SWT.PUSH);
-
- // Layout button
- data = new FormData();
- data.left = new FormAttachment(0, 0);
-// data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(optionsLabel, 0);
- regenBindingButton.setLayoutData(data);
- */
-
- String buttonLabel = org.eclipse.wst.wsdl.ui.internal.asd.Messages._UI_GENERATE_BINDING_CONTENT;
- regenBindingButton = getWidgetFactory().createButton(composite, buttonLabel, SWT.PUSH);
-
- // Layout button
- data = new FormData();
- data.left = new FormAttachment(0, 0);
-// data.right = new FormAttachment(optionsValue, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(protocolLabel, 0);
- regenBindingButton.setLayoutData(data);
-
- regenBindingButton.addSelectionListener(this);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(protocolValue, ASDEditorCSHelpIds.PROPERTIES_BINDING_PROTOCOL_TEXT);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(regenBindingButton, ASDEditorCSHelpIds.PROPERTIES_BINDING_GEN_BINDING_BUTTON);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_BINDING_PORTTYPE_COMBO);
- }
-
- public void refresh() {
- super.refresh();
- IBinding binding = getIBinding();
- String protocol = binding.getProtocol();
- if (protocol == null || protocol.equals("")) { //$NON-NLS-1$
- protocol = "----"; //$NON-NLS-1$
- }
- protocolValue.setText(protocol);
-
-// optionsValue.setText("");
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager() {
- if (refManager != null) {
- return refManager;
- }
-
- refManager = ReferenceEditManagerHelper.getInterfaceReferenceEditManager((IASDObject) getModel());
-
- return refManager;
- }
-
- protected List getComboItems() {
- ComponentReferenceEditManager manager = getComponentReferenceEditManager();
-
- List items = new ArrayList();
- items.add(BROWSE_STRING);
- items.add(NEW_STRING);
-
- if (manager != null) {
- ComponentSpecification[] comboItems = manager.getQuickPicks();
- for (int index = 0; index < comboItems.length; index++)
- {
- items.add(comboItems[index]);
- }
- }
- return items;
- }
-
- protected Object getCurrentComboItem() {
- IBinding binding = getIBinding();
- return binding.getInterface();
- }
-
- protected String getComboItemName(Object item) {
- String name = ""; //$NON-NLS-1$
- if (item instanceof ComponentSpecification) {
- name = ((ComponentSpecification) item).getName();
- }
- else if (item instanceof IInterface) {
- name = ((IInterface) item).getName();
- }
- else if (item instanceof String) {
- name = (String) item;
- }
-
- return name;
- }
-
- protected void performComboSelection(Object item) {
- ComponentSpecification spec = null;
-
- if (item instanceof ComponentSpecification) {
- spec = (ComponentSpecification) item;
- ComponentReferenceEditManager manager = getComponentReferenceEditManager();
- manager.modifyComponentReference((IBinding) getModel(), spec);
- }
- else if (item instanceof String) {
- if (item.equals(BROWSE_STRING)) {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- ASDSetExistingInterfaceAction action = new ASDSetExistingInterfaceAction(part);
- action.setIBinding((IBinding) getModel());
- action.run();
- }
- else if (item.equals(NEW_STRING)) {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- ASDSetNewInterfaceAction action = new ASDSetNewInterfaceAction(part);
- action.setIBinding((IBinding) getModel());
- action.run();
- }
- }
-
- refresh();
- }
-
- private IBinding getIBinding() {
- return (IBinding) getModel();
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (e.widget == regenBindingButton) {
- Command command = getIBinding().getGenerateBindingCommand();
- CommandStack stack = (CommandStack) ASDEditorPlugin.getActiveEditor().getAdapter(CommandStack.class);
- stack.execute(command);
- }
- }
-
- public void doWidgetSelected(SelectionEvent e) {
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java
deleted file mode 100644
index a762c92fc..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/DocumentationSection.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.wsdl.WSDLElement;
-import org.eclipse.wst.wsdl.ui.internal.actions.AddElementAction;
-import org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-public class DocumentationSection extends ASDAbstractSection {
- Text docText;
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- docText = getWidgetFactory().createText(composite, "", SWT.MULTI | SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL); //$NON-NLS-1$
- docText.addListener(SWT.KeyDown, this);
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- docText.setLayoutData(data);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(docText, ASDEditorCSHelpIds.PROPERTIES_DOCUMENTATION_TAB);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- /*
- * TODO: the doHandleEvent() and refresh() methods both use WSDL11 specific
- * knowledge. This class (DocumentationSection) should be generic. In Post 1.5,
- * we need to add documentation support methods to our facade so we don't need
- * to know WSDL specific implementation.......
- */
- public void refresh()
- {
- super.refresh();
- if (docText.isFocusControl())
- {
- return;
- }
- setListenerEnabled(false);
- docText.setText(""); //$NON-NLS-1$
- if (getModel() != null && getElement() != null)
- {
- Element docNode = getElement().getDocumentationElement();
- if (docNode != null)
- {
- Node textNode = docNode.getFirstChild();
- if (textNode != null)
- {
- String docValue = textNode.getNodeValue();
- if (docValue != null)
- {
- docText.setText(docValue);
- }
- }
- }
- }
- setListenerEnabled(true);
- }
-
- /*
- * TODO: the doHandleEvent() and refresh() methods both use WSDL11 specific
- * knowledge. This class (DocumentationSection) should be generic. In Post 1.5,
- * we need to add documentation support methods to our facade so we don't need
- * to know WSDL specific implementation.......
- */
- public void doHandleEvent(Event event)
- {
- if (event.widget == docText)
- {
- String value = docText.getText();
- if (getModel() != null && getElement() != null)
- {
- Element docNode = getElement().getDocumentationElement();
- if (docNode != null)
- {
- Node textNode = docNode.getFirstChild();
- if (textNode != null)
- {
- textNode.setNodeValue(value);
- }
- else
- {
- if (value.length() > 0)
- {
- Document document = docNode.getOwnerDocument();
- org.w3c.dom.Text newTextNode = document.createTextNode(value);
- docNode.appendChild(newTextNode);
- }
- }
- }
- else
- {
- Element element = getElement().getElement();
- AddElementAction action = new AddElementAction(element, element.getPrefix(), "documentation", element.getFirstChild()); //$NON-NLS-1$
- action.run();
- Element newDocumentation = action.getNewElement();
-
- Document document = newDocumentation.getOwnerDocument();
- org.w3c.dom.Text newTextNode = document.createTextNode(value);
- newDocumentation.appendChild(newTextNode);
- getElement().setDocumentationElement(newDocumentation);
- }
- }
- }
- }
-
- private WSDLElement getElement() {
- WSDLElement element = null;
- Object model = getModel();
-
- if (model instanceof AbstractModelCollection) {
- model = ((AbstractModelCollection) model).getModel();
- }
-
- // TODO: Should we be handling the XML Schema case here as well?
- if (model instanceof WSDLBaseAdapter) {
- Object target = ((WSDLBaseAdapter) model).getTarget();
- if (target instanceof WSDLElement) {
- element = (WSDLElement) target;
- }
- }
-
- return element;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java
deleted file mode 100644
index 4b915600a..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/EndPointSection.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11EndPoint;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetExistingBindingAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDSetNewBindingAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IEndPoint;
-import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-
-public class EndPointSection extends ReferenceSection {
- protected Text addressText;
- protected CCombo protocolCombo;
-
- protected List bindingsInCombo = new ArrayList();
-
- protected ComponentReferenceEditManager refManager;
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- FormData data;
-
- // Address row
- CLabel addressLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_ADDRESS + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- addressText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
-
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(addressText, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(addressText, 0, SWT.CENTER);
- addressLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(combo, +ITabbedPropertyConstants.VSPACE);
- addressText.setLayoutData(data);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(addressText, ASDEditorCSHelpIds.PROPERTIES_PORT_ADDRESS_TEXT);
-
- // Protocol Row
- CLabel protocolLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_BINDING_PROTOCOL + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- protocolCombo = getWidgetFactory().createCCombo(composite); //$NON-NLS-1$
-
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(protocolCombo, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(protocolCombo, 0, SWT.CENTER);
- protocolLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(addressText, +ITabbedPropertyConstants.VSPACE);
- protocolCombo.setLayoutData(data);
- protocolCombo.addListener(SWT.Modify, this);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(protocolCombo, ASDEditorCSHelpIds.PROPERTIES_PORT_PROTOCOL_TEXT);
-
- comboLabel.setText(Messages._UI_LABEL_BINDING + ":"); //$NON-NLS-1$ //$NON-NLS-2$
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PORT_BINDING_COMBO);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh() {
- removeListeners(addressText);
- protocolCombo.removeListener(SWT.Modify, this);
-
- super.refresh();
-
- IEndPoint endPoint = (IEndPoint) getModel();
- if (endPoint.getAddress() != null) {
- if (!endPoint.getAddress().equals(addressText.getText())) {
- addressText.setText(endPoint.getAddress());
- }
- }
-
- protocolCombo.removeAll();
- if (endPoint instanceof W11EndPoint) {
- String protocolValue = ((W11EndPoint) endPoint).getProtocol();
- List protocols = ((W11EndPoint) getModel()).getApplicableProtocol();
- Iterator it = protocols.iterator();
- while (it.hasNext()) {
- protocolCombo.add((String) it.next());
- }
-
- protocolCombo.setText(protocolValue);
- }
-
- setControlForegroundColor(addressText);
- setControlForegroundColor(protocolCombo);
- applyTextListeners(addressText);
- protocolCombo.addListener(SWT.Modify, this);
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager() {
- if (refManager != null) {
- return refManager;
- }
-
- refManager = ReferenceEditManagerHelper.getBindingReferenceEditManager((IASDObject) getModel());
-
- return refManager;
- }
-
- protected List getComboItems() {
- ComponentReferenceEditManager manager = getComponentReferenceEditManager();
-
- List items = new ArrayList();
- items.add(BROWSE_STRING);
- items.add(NEW_STRING);
-
- if (manager != null) {
- ComponentSpecification[] comboItems = manager.getQuickPicks();
- for (int index = 0; index < comboItems.length; index++) {
- items.add(comboItems[index]);
- }
- }
- return items;
- }
-
- protected Object getCurrentComboItem() {
- IEndPoint endPoint = (IEndPoint) getModel();
- return endPoint.getBinding();
- }
-
- protected String getComboItemName(Object item) {
- String name = ""; //$NON-NLS-1$
- if (item instanceof ComponentSpecification) {
- name = ((ComponentSpecification) item).getName();
- }
- else if (item instanceof IBinding) {
- name = ((IBinding) item).getName();
- }
- else if (item instanceof String) {
- name = (String) item;
- }
-
- return name;
- }
-
- protected void performComboSelection(Object item) {
- ComponentSpecification spec = null;
-
- if (item instanceof ComponentSpecification) {
- spec = (ComponentSpecification) item;
- ComponentReferenceEditManager manager = getComponentReferenceEditManager();
- manager.modifyComponentReference((IEndPoint) getModel(), spec);
- }
- else if (item instanceof String) {
- if (item.equals(BROWSE_STRING)) {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- ASDSetExistingBindingAction action = new ASDSetExistingBindingAction(part);
- action.setIEndPoint((IEndPoint) getModel());
- action.run();
- }
- else if (item.equals(NEW_STRING)) {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- ASDSetNewBindingAction action = new ASDSetNewBindingAction(part);
- action.setIEndPoint((IEndPoint) getModel());
- action.run();
- }
- }
-
- refresh();
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doHandleEvent(Event event)
- {
- if (event.widget == addressText && !addressText.isDisposed()) {
- String newAddress = addressText.getText();
- if (newAddress == null) {
- newAddress = ""; //$NON-NLS-1$
- }
-
- String oldAddress = getOldAddress();
- if (oldAddress.equals(newAddress))
- return;
-
- IEndPoint endPoint = (IEndPoint) getModel();
- Command command = endPoint.getSetAddressCommand(newAddress);
- executeCommand(command);
- }
- else if (event.widget == protocolCombo && !protocolCombo.isDisposed()) {
- String newProtocol = protocolCombo.getText();
- if (newProtocol != null && getModel() instanceof W11EndPoint) {
- W11EndPoint endPoint = (W11EndPoint) getModel();
- endPoint.setProtocol(newProtocol);
- }
- }
- else {
- super.doHandleEvent(event);
- }
- }
-
- private String getOldAddress() {
- String value = null;
- if (getModel() instanceof W11EndPoint) {
- value = ((W11EndPoint) getModel()).getAddress();
- }
-
- if (value == null) {
- value = ""; //$NON-NLS-1$
- }
- return value;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java
deleted file mode 100644
index b168d54af..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ImportSection.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.dialogs.SelectSingleFileDialog;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.Import;
-import org.eclipse.wst.wsdl.internal.impl.ImportImpl;
-import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Import;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IImport;
-import org.eclipse.wst.wsdl.ui.internal.util.ComponentReferenceUtil;
-import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil;
-import org.eclipse.emf.common.util.URI;
-import org.w3c.dom.Element;
-
-public class ImportSection extends ASDAbstractSection
-{
- protected Text namespaceText, prefixText, locationText;
- private String oldPrefixValue;
- Button button;
- // TODO: Remove: IEditorPart editorPart
- IEditorPart editorPart;
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- FormData data;
-
- namespaceText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- namespaceText.setEditable(false);
-// namespaceText.addListener(SWT.Modify, this);
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(0, 0);
- namespaceText.setLayoutData(data);
-
- CLabel namespaceLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_NAMESPACE); //$NON-NLS-1$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(namespaceText, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(namespaceText, 0, SWT.CENTER);
- namespaceLabel.setLayoutData(data);
-
- prefixText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
-// prefixText.setEditable(false);
- applyTextListeners(prefixText);
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(namespaceText, +ITabbedPropertyConstants.VSPACE);
- prefixText.setLayoutData(data);
-
- CLabel prefixLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_PREFIX); //$NON-NLS-1$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(prefixText, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(prefixText, 0, SWT.CENTER);
- prefixLabel.setLayoutData(data);
-
- locationText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- locationText.setEditable(false);
-// locationText.addListener(SWT.Modify, this);
-
- CLabel locationLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_LOCATION); //$NON-NLS-1$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(locationText, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(locationText, 0, SWT.CENTER);
- locationLabel.setLayoutData(data);
-
- button = getWidgetFactory().createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
- button.setImage(WSDLEditorPlugin.getInstance().getImage("icons/browsebutton.gif")); //$NON-NLS-1$
-
- button.addSelectionListener(this);
- data = new FormData();
- data.left = new FormAttachment(100, -rightMarginSpace + 2);
- data.right = new FormAttachment(100,0);
- data.top = new FormAttachment(locationText, 0, SWT.CENTER);
- button.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(button, 0);
- data.top = new FormAttachment(prefixText, +ITabbedPropertyConstants.VSPACE);
- locationText.setLayoutData(data);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- setListenerEnabled(false);
- Object obj = getModel();
- boolean refreshPrefixText = true;
- boolean refreshLocationText = true;
- boolean refreshNamespaceText = true;
- if (prefixText.isFocusControl())
- {
- refreshPrefixText = false;
- }
- if (locationText.isFocusControl())
- {
- refreshLocationText = false;
- }
- if (namespaceText.isFocusControl())
- {
- refreshNamespaceText = false;
- }
-
- if (refreshPrefixText)
- {
- prefixText.setText(""); //$NON-NLS-1$
- }
- if (refreshLocationText)
- {
- locationText.setText(""); //$NON-NLS-1$
- }
- if (refreshNamespaceText)
- {
- namespaceText.setText(""); //$NON-NLS-1$
- }
- if (obj instanceof IImport)
- {
- IImport theImport = (IImport) obj;
- if (refreshLocationText)
- {
- String locationValue = theImport.getLocation();
- locationText.setText(locationValue != null ? locationValue : ""); //$NON-NLS-1$
- }
-
- String namespaceValue = theImport.getNamespace();
- if (refreshNamespaceText)
- {
- namespaceText.setText(namespaceValue != null ? namespaceValue : ""); //$NON-NLS-1$
- }
-
- if (refreshPrefixText)
- {
- String prefix = theImport.getNamespacePrefix();
- prefixText.setText(prefix != null ? prefix : ""); //$NON-NLS-1$
- }
- }
- oldPrefixValue = prefixText.getText();
- setListenerEnabled(true);
- }
-
- public void doHandleEvent(Event event) {
- // TODO: We have some WSDL11 Impl specific knowledge below... We should try to remove this...
- if (event.widget == prefixText && locationText.getText().length() > 0 && namespaceText.getText().length() > 0 && getModel() instanceof W11Import) {
- if (oldPrefixValue.equals(prefixText.getText()))
- return;
-
- W11Import w11Import = (W11Import) getModel();
- Import importObj = (Import) w11Import.getTarget();
-// org.w3c.dom.Element importElement = WSDLEditorUtil.getInstance().getElementForObject(importObj);
- Map namespacesMap = importObj.getEnclosingDefinition().getNamespaces();
-
- if (namespacesMap.containsKey(prefixText.getText())) {
- // We should add error messages.........
- // setErrorMessage(XSDEditorPlugin.getXSDString("_ERROR_LABEL_PREFIX_EXISTS"));
- }
- else {
- Element definitionElement = importObj.getEnclosingDefinition().getElement();
- definitionElement.removeAttribute("xmlns:"+oldPrefixValue); //$NON-NLS-1$
- definitionElement.setAttribute("xmlns:" + prefixText.getText(), namespaceText.getText()); //$NON-NLS-1$
-
-// clearErrorMessage();
- oldPrefixValue = prefixText.getText();
- }
- }
- }
-
- public void widgetSelected(SelectionEvent e)
- {
- // TODO: We have some WSDL11 Impl specific knowledge below... We should try to remove this...
- if (e.widget == button && getModel() instanceof W11Import)
- {
- W11Import w11Import = (W11Import) getModel();
-
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
-
- SelectSingleFileDialog dialog = new SelectSingleFileDialog(WSDLEditorPlugin.getShell(), null, true);
-
- IFile currentWSDLFile = null;
- IEditorInput editorInput = editor.getEditorInput();
- String [] filters = { "xsd", "wsdl" }; //$NON-NLS-1$ //$NON-NLS-2$
-
- if (editorInput instanceof IFileEditorInput)
- {
- currentWSDLFile = ((IFileEditorInput)editorInput).getFile();
- IFile [] excludedFiles = { currentWSDLFile };
- dialog.addFilterExtensions(filters, excludedFiles);
- }
- else
- {
- IFile [] excludedFiles = { };
- dialog.addFilterExtensions(filters, excludedFiles);
- }
-
- dialog.create();
- dialog.getShell().setText(org.eclipse.wst.wsdl.ui.internal.Messages._UI_TITLE_SELECT); //$NON-NLS-1$
- dialog.setTitle(org.eclipse.wst.wsdl.ui.internal.Messages._UI_TITLE_SELECT_FILE); //$NON-NLS-1$
- dialog.setMessage(org.eclipse.wst.wsdl.ui.internal.Messages._UI_DESCRIPTION_SELECT_WSDL_OR_XSD); //$NON-NLS-1$
- int rc = dialog.open();
- if (rc == IDialogConstants.OK_ID)
- {
- IFile selectedFile = dialog.getFile();
-
- //if (selectedFile.getLocation().toOSString().equals(currentWSDLFile.getLocation().toOSString()))
- //{
- // System.out.println("SAME FILE:" + currentWSDLFile.getLocation());
- //}
-
- String location = ComponentReferenceUtil.computeRelativeURI(selectedFile, currentWSDLFile, true);
-
- Import importObj = (Import) w11Import.getTarget();
-// org.w3c.dom.Element importElement = WSDLEditorUtil.getInstance().getElementForObject(importObj);
- Definition definition = importObj.getEnclosingDefinition();
- org.w3c.dom.Element definitionElement = WSDLEditorUtil.getInstance().getElementForObject(definition);
-
- String importTargetNamespace = ""; //$NON-NLS-1$
- String prefix = prefixText.getText();
- String uniquePrefix = ""; //$NON-NLS-1$
-
- URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString());
-
- // note that the getTargetNamespaceURIForSchema works for both schema and wsdl files
- // I should change the name of this convenience method
- importTargetNamespace = WSDLEditorUtil.getTargetNamespaceURIForSchema(uri.toString());
-
- if (prefix.trim().equals("")) //$NON-NLS-1$
- {
- uniquePrefix = getUniquePrefix(definition, uri.fileExtension());
- }
- else
- {
- uniquePrefix = prefix;
- }
-
-
- if (importTargetNamespace == null ||
- (importTargetNamespace != null && importTargetNamespace.trim().length() == 0))
- {
- return; // what to do with no namespace docs?
- }
-
- importObj.setLocationURI(location);
- importObj.setNamespaceURI(importTargetNamespace);
- ((ImportImpl) importObj).importDefinitionOrSchema();
-
- definitionElement.setAttribute("xmlns:" + uniquePrefix, importTargetNamespace); //$NON-NLS-1$
-
- namespaceText.setText(importTargetNamespace);
- locationText.setText(location);
- prefixText.setText(uniquePrefix);
- }
- refresh();
- }
- }
-
- private String getUniquePrefix(Definition definition, String initPrefix)
- {
- String uniquePrefix;
- Map map = definition.getNamespaces();
-
- if (definition.getNamespace(initPrefix) == null)
- {
- uniquePrefix = initPrefix;
- }
- else // if used, then try to create a unique one
- {
- String tempPrefix = initPrefix;
- int i = 1;
- while(map.containsKey(tempPrefix + i))
- {
- i++;
- }
- uniquePrefix = tempPrefix + i;
- }
- return uniquePrefix;
- }
-
- // TODO: Remove metod setEditorPart() below
- public void setEditorPart(IEditorPart editorPart)
- {
- this.editorPart = editorPart;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java
deleted file mode 100644
index ffaa41fe8..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NameSection.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.events.IHyperlinkListener;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.ui.internal.ISelectionMapper;
-import org.eclipse.wst.wsdl.ui.internal.WSDLEditorPlugin;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IBinding;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IInterface;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IMessage;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject;
-import org.eclipse.wst.wsdl.ui.internal.refactor.actions.RenameComponentAction;
-
-public class NameSection extends ASDAbstractSection implements IHyperlinkListener {
- CLabel nameLabel;
- protected Text nameText;
- /**
- * Clicking on it invokes the refactor->rename action.
- */
- protected ImageHyperlink renameHyperlink;
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
-
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- FormData data;
-
- nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace);
- data.top = new FormAttachment(0, 0);
- nameText.setLayoutData(data);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText, ASDEditorCSHelpIds.PROPERTIES_NAME_TEXT);
-
- nameLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_NAME + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(nameText, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(nameText, 0, SWT.CENTER);
- nameLabel.setLayoutData(data);
- applyTextListeners(nameText);
- }
-
- private void showRefactorButton() {
- if (isReadOnly) {
- return;
- }
-
- if (renameHyperlink == null) {
- renameHyperlink = getWidgetFactory().createImageHyperlink(composite, SWT.NONE);
-
- renameHyperlink.setImage(WSDLEditorPlugin.getInstance().getImage("icons/quickassist.gif")); //$NON-NLS-1$
- renameHyperlink.setToolTipText(Messages._UI_TOOLTIP_RENAME_REFACTOR);
- renameHyperlink.addHyperlinkListener(this);
- }
-
- FormData data = new FormData();
- data.right = new FormAttachment(100, -rightMarginSpace);
- data.top = new FormAttachment(0, 0);
- renameHyperlink.setLayoutData(data);
-
- data = (FormData) nameText.getLayoutData();
- FormAttachment right = data.right;
- right.control = renameHyperlink;
- right.offset = -ITabbedPropertyConstants.HSPACE;
- right.alignment = SWT.LEFT;
- data.top = new FormAttachment(renameHyperlink, 0, SWT.CENTER);
- renameHyperlink.setVisible(true);
- }
-
- private void hideRefactorButton() {
- if (isReadOnly) {
- return;
- }
-
- if (renameHyperlink == null) {
- return;
- }
- FormData data = (FormData) nameText.getLayoutData();
- FormAttachment right = data.right;
- right.control = null;
- right.numerator = 100;
- right.offset = -rightMarginSpace;
- data.top = new FormAttachment(0, 0);
- renameHyperlink.setVisible(false);
- }
-
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh() {
- super.refresh();
- if (nameText.isDisposed() || nameText.isFocusControl()) {
- return;
- }
-
- setListenerEnabled(false);
- String name = null;
- if (getModel() instanceof INamedObject) {
- name = ((INamedObject) getModel()).getName();
- }
- else if (getModel() instanceof EditPart) {
- Object model = ((EditPart) getModel()).getModel();
- name = ((INamedObject) model).getName();
- }
-
- if (name == null) {
- name = ""; //$NON-NLS-1$
- }
-
- nameText.setText(name);
- setControlForegroundColor(nameText);
-
- if (canRefactor()) {
- showRefactorButton();
- }
- else {
- hideRefactorButton();
- }
- setListenerEnabled(true);
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doHandleEvent(Event event)
- {
- if (event.widget == nameText && !nameText.isDisposed()) {
- String newValue = nameText.getText();
- Object model = getModel();
- INamedObject namedObject = null;
-
- if (model instanceof INamedObject) {
- namedObject = (INamedObject) model;
- }
-
- if (namedObject != null) {
- if ( !newValue.equals( namedObject.getName() ) ){
- Command command = namedObject.getSetNameCommand(newValue);
- executeCommand(command);
- }
- }
- }
- }
-
- private void invokeRenameRefactoring() {
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- Definition definition = (Definition)editor.getAdapter(Definition.class);
- ISelection selection = editor.getSite().getSelectionProvider().getSelection();
- ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
- selection = mapper != null ? mapper.mapSelection(selection) : selection;
- RenameComponentAction action = new RenameComponentAction(selection, definition);
- action.update(selection);
- action.run();
- }
-
- private Object getRealModel() {
- Object realModel = getModel();
-
- if (realModel instanceof EditPart) {
- realModel = ((EditPart) getModel()).getModel();
- }
-
- return realModel;
- }
-
- /**
- * Determines if the model object's name can be refactored.
- * @return true if the model object can be refactored, false otherwise.
- */
- private boolean canRefactor() {
- Object model = getRealModel();
-
- boolean canRefactor = model instanceof IMessage ||
- model instanceof IBinding ||
- model instanceof IInterface;
- return canRefactor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkActivated(HyperlinkEvent e)
- {
- invokeRenameRefactoring();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkEntered(HyperlinkEvent e)
- {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent)
- */
- public void linkExited(HyperlinkEvent e)
- {
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java
deleted file mode 100644
index b83cd8266..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/NamespaceSection.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.wsdl.ui.internal.adapters.basic.W11Description;
-import org.eclipse.wst.wsdl.ui.internal.adapters.commands.W11EditNamespacesCommand;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.actions.ASDEditNamespacesAction;
-import org.eclipse.wst.wsdl.ui.internal.asd.design.editparts.model.AbstractModelCollection;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IDescription;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.INamedObject;
-import org.eclipse.wst.wsdl.ui.internal.asd.outline.ICategoryAdapter;
-import org.eclipse.wst.xml.ui.internal.nsedit.CommonEditNamespacesTargetFieldDialog;
-import org.eclipse.wst.xml.ui.internal.nsedit.CommonNamespaceInfoTable;
-
-public class NamespaceSection extends ASDAbstractSection {
- protected String targetNamespace;
- protected List namespaceInfoList;
- protected CommonEditNamespacesTargetFieldDialog editWSDLNamespacesControl;
- protected Button button;
-
- Text nameText;
- Text prefixText;
- Text targetNamespaceText;
- protected CommonNamespaceInfoTable tableViewer;
- private boolean handlingEvent;
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- composite = getWidgetFactory().createFlatFormComposite(parent);
-
- String nameString = Messages._UI_LABEL_NAME + ":"; //$NON-NLS-1$ //$NON-NLS-2$
- String prefixString = Messages._UI_LABEL_PREFIX + ":"; //$NON-NLS-1$ //$NON-NLS-2$
- String namespaceString = Messages._UI_LABEL_TARGET_NAMESPACE; //$NON-NLS-1$
- GC gc = new GC(parent);
- int xoffset = Math.max(115, gc.textExtent(nameString).x + 20); // adds 20 due to borders
- xoffset = Math.max(xoffset, gc.textExtent(prefixString).x + 20); // adds 20 due to borders
- xoffset = Math.max(xoffset, gc.textExtent(namespaceString).x + 20); // adds 20 due to borders
- gc.dispose();
-
- // name
- CLabel nameLabel = getWidgetFactory().createCLabel(composite, nameString); //$NON-NLS-1$
- nameText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(nameText, ASDEditorCSHelpIds.PROPERTIES_NAME_TEXT);
-
- // prefix
- CLabel prefixLabel = getWidgetFactory().createCLabel(composite, prefixString); //$NON-NLS-1$
- prefixText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(prefixText, ASDEditorCSHelpIds.PROPERTIES_DEF_PREFIX_TEXT);
-
- // targetnamespace
- CLabel targetNamespaceLabel = getWidgetFactory().createCLabel(composite, namespaceString); //$NON-NLS-1$
- targetNamespaceText = getWidgetFactory().createText(composite, ""); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(targetNamespaceText, ASDEditorCSHelpIds.PROPERTIES_DEF_TNS_TEXT);
-
- // Advanced button
- button = getWidgetFactory().createButton(composite, Messages._UI_SECTION_ADVANCED_ATTRIBUTES + "...", SWT.PUSH); //$NON-NLS-1$ //$NON-NLS-2$
-
-
- ///////////////////// Labels
- // name layout
- FormData dataNameLabel = new FormData();
- dataNameLabel.top = new FormAttachment(nameText, 0, SWT.CENTER);
- nameLabel.setLayoutData(dataNameLabel);
-
- // prefix layout
- FormData dataPrefixLabel = new FormData();
- dataPrefixLabel.left = new FormAttachment(0, 0);
- dataPrefixLabel.top = new FormAttachment(prefixText, 0, SWT.CENTER);
- prefixLabel.setLayoutData(dataPrefixLabel);
-
- // targetNamespaceLabel layout
- FormData datatnsLabel = new FormData();
- datatnsLabel.left = new FormAttachment(0, 0);
- datatnsLabel.right = new FormAttachment(targetNamespaceText, 0);
- datatnsLabel.top = new FormAttachment(targetNamespaceText, 0, SWT.CENTER);
- targetNamespaceLabel.setLayoutData(datatnsLabel);
-
-
- ///////////////////// Text Fields
- // name text field
- FormData dataNameText = new FormData();
- dataNameText.left = new FormAttachment(0, xoffset);
- dataNameText.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- dataNameText.top = new FormAttachment(0, 0);
- nameText.setLayoutData(dataNameText);
- applyTextListeners(nameText);
-
- // prefix text field
- FormData dataPrefixText = new FormData();
- dataPrefixText.left = new FormAttachment(0, xoffset);
- dataPrefixText.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- dataPrefixText.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE);
- prefixText.setLayoutData(dataPrefixText);
- applyTextListeners(prefixText);
-
- // targetnamespace text field
- FormData data = new FormData();
- data.left = new FormAttachment(0, xoffset);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(prefixText, +ITabbedPropertyConstants.VSPACE);
- targetNamespaceText.setLayoutData(data);
- applyTextListeners(targetNamespaceText);
-
- // Advanced button layout
- FormData dataButton = new FormData();
-// dataButton.left = new FormAttachment(100, -rightMarginSpace + 2);
- dataButton.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- dataButton.top = new FormAttachment(targetNamespaceText, +ITabbedPropertyConstants.VSPACE);
-// dataButton.top = new FormAttachment(targetNamespaceText, 0, SWT.CENTER);
- button.setLayoutData(dataButton);
- button.addSelectionListener(this);
- }
-
- public void doHandleEvent(Event event)
- {
- handlingEvent = true;
- Object obj = getDescription();
- if (obj instanceof IDescription) {
- IDescription description = (IDescription) obj;
-
- if (event.widget == nameText) {
- String newName = nameText.getText();
- if (!newName.equals(description.getName())) {
- Command command = description.getSetNameCommand(newName);
- executeCommand(command);
- }
- }
- else if (event.widget == prefixText || event.widget == targetNamespaceText) {
- String newTargetNS = targetNamespaceText.getText();
- String newPrefix = prefixText.getText();
-
- boolean targetNSdiff = !newTargetNS.equals(description.getTargetNamespace());
- boolean prefixDiff = !newPrefix.equals(description.getTargetNamespacePrefix());
- if (targetNSdiff || prefixDiff ) {
- // TODO: The code below is not generic. We need to revisit this to ensure it is
- // generic. IDescription needs a getNamespacesInfo() and getEditNamespacesCommand()...
- W11EditNamespacesCommand command =
- (W11EditNamespacesCommand) ((W11Description) description).getEditNamespacesCommand();
- if (targetNSdiff)
- command.setTargetNamespace(newTargetNS);
- if (prefixDiff)
- command.setTargetNamespacePrefix(newPrefix);
- executeCommand(command);
- }
- }
- }
-
- handlingEvent = false;
- }
-
- protected Object getDescription() {
- Object model = getModel();
- if (model instanceof AbstractModelCollection) {
- model = ((AbstractModelCollection) model).getModel();
- if (model instanceof IDescription) {
- return (IDescription) model;
- }
- }
- else if (model instanceof ICategoryAdapter) {
- return ((ICategoryAdapter) model).getOwnerDescription();
- }
-
- return model;
- }
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh()
- {
- super.refresh();
-
- // Set nameText
- if (nameText == null || nameText.isFocusControl()) {
- return;
- }
- setListenerEnabled(false);
- nameText.setText(""); //$NON-NLS-1$
- if (getDescription() instanceof INamedObject) {
- nameText.setText(((INamedObject) getDescription()).getName());
- }
- setListenerEnabled(true);
-
-
- // Set targetNamespaceText and prefixText
- if (targetNamespaceText == null || targetNamespaceText.isFocusControl() || handlingEvent)
- {
- return;
- }
- setListenerEnabled(false);
- Object obj = getDescription();
- if (obj instanceof IDescription)
- {
- IDescription description = (IDescription) obj;
- String targetNS = description.getTargetNamespace();
- String newPrefix = description.getTargetNamespacePrefix();
- prefixText.setText(newPrefix != null ? newPrefix : ""); //$NON-NLS-1$
-
- // set targetnamespace field and prefix field
- if (targetNS != null)
- {
- targetNamespaceText.setText(targetNS);
- }
- else
- {
- targetNamespaceText.setText(""); //$NON-NLS-1$
- }
- if (newPrefix != null)
- {
- prefixText.setText(newPrefix);
- }
- }
- setListenerEnabled(true);
- }
-
-
- public void widgetSelected(SelectionEvent e)
- {
- if (e.widget == button) {
- Object obj = getDescription();
- if (obj instanceof IDescription) {
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- ASDEditNamespacesAction action = new ASDEditNamespacesAction(part, (IDescription) obj);
- action.run();
- refresh();
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java
deleted file mode 100644
index be88d73b4..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ParameterSection.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification;
-import org.eclipse.wst.wsdl.ui.internal.asd.ASDEditorCSHelpIds;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IASDObject;
-import org.eclipse.wst.wsdl.ui.internal.asd.facade.IParameter;
-import org.eclipse.wst.wsdl.ui.internal.util.ReferenceEditManagerHelper;
-import org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager;
-
-public class ParameterSection extends NameSection {
- protected static String NEW_STRING = Messages._UI_BUTTON_NEW; //$NON-NLS-1$
- protected static String BROWSE_STRING = Messages._UI_BUTTON_BROWSE; //$NON-NLS-1$
- protected CLabel comboLabel;
- protected CCombo combo;
- protected boolean handleTypeScenario = true;
- protected ComponentReferenceEditManager parameterRefManager;
-
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- createControlArea();
- }
-
- public void createControlArea()
- {
- FormData data;
-
- combo = getWidgetFactory().createCCombo(composite);
- combo.setBackground(composite.getBackground());
- combo.addListener(SWT.Modify, this);
- combo.addSelectionListener(this);
-
- comboLabel = getWidgetFactory().createCLabel(composite, Messages._UI_LABEL_TYPE + ":"); //$NON-NLS-1$ //$NON-NLS-2$
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(combo, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(combo, 0, SWT.CENTER);
- comboLabel.setLayoutData(data);
-
-// Button button = getWidgetFactory().createButton(composite, "", SWT.PUSH); //$NON-NLS-1$
-// button.setImage(InterfaceUIPlugin.getDefault().getImage("icons/obj16/browsebutton.gif")); //$NON-NLS-1$
-//
-// button.addSelectionListener(this);
-// data = new FormData();
-// data.left = new FormAttachment(100, -rightMarginSpace + 2);
-// data.right = new FormAttachment(100, 0);
-// data.top = new FormAttachment(typeCombo, 0, SWT.CENTER);
-// button.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, 100);
-// data.right = new FormAttachment(button, 0);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE);
- combo.setLayoutData(data);
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh() {
- super.refresh();
- if (nameText.isFocusControl()) {
- return;
- }
-
- setListenerEnabled(false);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PART_ELEMENT_COMBO);
-
- if (handleTypeScenario) {
- refreshCombo();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, ASDEditorCSHelpIds.PROPERTIES_PART_TYPE_COMBO);
- }
-
- setControlForegroundColor(combo);
-
- setListenerEnabled(true);
- }
-
- protected void refreshCombo() {
- IParameter param = null;
- Object model = getModel();
- setListenerEnabled(false);
-
- if (model instanceof IParameter) {
- param = (IParameter) model;
- }
-
- String name = ""; //$NON-NLS-1$
- String typeName = ""; //$NON-NLS-1$
- if (param != null) {
- name = param.getName();
- typeName = param.getComponentName();
- }
-
- if (!nameText.isFocusControl()) {
- nameText.setText(name);
- }
-
- // Populate the type Combo
- combo.removeAll();
- combo.add(BROWSE_STRING);
- combo.add(NEW_STRING);
-
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null) {
- ComponentSpecification[] specs = editManager.getQuickPicks();
- for (int index = 0; index < specs.length; index++) {
- combo.add((String) specs[index].getName());
- }
-
- specs = editManager.getHistory();
- for (int index = 0; index < specs.length; index++) {
- combo.add((String) specs[index].getName());
- }
- }
-
- // Display the type in the Combo
- String[] items = combo.getItems();
- int index;
- for (index = 0; index < items.length; index++) {
- if (items[index].equals(typeName)) {
- break;
- }
- }
-
- if (index < items.length) {
- // Found a match
- combo.select(index);
- }
- else {
- combo.setText(typeName);
- }
-
- setListenerEnabled(true);
- }
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void handleEvent(Event event)
- {
- if (event.widget == combo) {
- if (isListenerEnabled() && !isInDoHandle)
- {
- isInDoHandle = true;
- startDelayedEvent(event);
- isInDoHandle = false;
- }
- }
- else {
- super.handleEvent(event);
- }
- }
-
- public void doHandleEvent(Event event)
- {
- super.doHandleEvent(event);
- if (event.widget == combo && handleTypeScenario) {
- handleComboSelection();
- refresh();
- }
- }
-
- protected void handleComboSelection() {
- String value = combo.getItem(combo.getSelectionIndex());
-
- IParameter parameter = (IParameter) this.getModel();
-
- if (value.equals(NEW_STRING)) {
- Command command = parameter.getSetTypeCommand(IParameter.SET_NEW_ACTION_ID);
- command.execute();
- }
- else if (value.equals(BROWSE_STRING)) {
- Command command = parameter.getSetTypeCommand(IParameter.SELECT_EXISTING_ACTION_ID);
- command.execute();
- }
- else {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- ComponentSpecification spec = getComponentSpecificationForValue((String)value);
- if (spec != null) {
- editManager.modifyComponentReference(parameter, spec);
- }
- }
- }
-
- protected ComponentReferenceEditManager getComponentReferenceEditManager() {
- if (parameterRefManager != null) {
- return parameterRefManager;
- }
- if (getModel() instanceof IASDObject)
- {
- parameterRefManager = ReferenceEditManagerHelper.getXSDTypeReferenceEditManager((IASDObject) getModel());
- }
- else
- {
- System.out.println("model" + getModel()); //$NON-NLS-1$
- }
- return parameterRefManager;
- }
-
- // TODO: rmah: This code should live in a common place..... This code is also used in other UI scenarios when
- // a similar combo box is used. For example in Direct Edit...(TypeReferenceDirectEditManager) Also used in the XSDEditor...
- protected ComponentSpecification getComponentSpecificationForValue(String value)
- {
- ComponentReferenceEditManager editManager = getComponentReferenceEditManager();
- if (editManager != null)
- {
- ComponentSpecification[] quickPicks = editManager.getQuickPicks();
- if (quickPicks != null)
- {
- for (int i=0; i < quickPicks.length; i++)
- {
- ComponentSpecification componentSpecification = quickPicks[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- ComponentSpecification[] history = editManager.getHistory();
- if (history != null)
- {
- for (int i=0; i < history.length; i++)
- {
- ComponentSpecification componentSpecification = history[i];
- if (value.equals(componentSpecification.getName()))
- {
- return componentSpecification;
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java b/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java
deleted file mode 100644
index 1722ddf52..000000000
--- a/bundles/org.eclipse.wst.wsdl.ui/src-asd/org/eclipse/wst/wsdl/ui/internal/asd/properties/sections/ReferenceSection.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsdl.ui.internal.asd.properties.sections;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-import org.eclipse.wst.wsdl.ui.internal.asd.Messages;
-
-public abstract class ReferenceSection extends NameSection {
- public static String BROWSE_STRING = Messages._UI_BUTTON_BROWSE; //$NON-NLS-1$
- public static String NEW_STRING = Messages._UI_BUTTON_NEW; //$NON-NLS-1$
- protected CCombo combo;
- protected CLabel comboLabel;
-
- protected List itemsInCombo = new ArrayList();
-
- /**
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
- */
- public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory)
- {
- super.createControls(parent, factory);
- FormData data;
-
- // Create Combo row of widgets
- comboLabel = getWidgetFactory().createCLabel(composite, "Reference"); //$NON-NLS-1$
- combo = getWidgetFactory().createCCombo(composite);
- combo.setBackground(composite.getBackground());
-
- // Layout Combo Label
- data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(combo, -ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(combo, 0, SWT.CENTER);
- comboLabel.setLayoutData(data);
-
- // Layout Combo
- data = new FormData();
- data.left = new FormAttachment(0, 100);
- data.right = new FormAttachment(100, -rightMarginSpace - ITabbedPropertyConstants.HSPACE);
- data.top = new FormAttachment(nameText, +ITabbedPropertyConstants.VSPACE);
- combo.setLayoutData(data);
-
- combo.addListener(SWT.Modify, this);
- }
-
- public void handleEvent(Event event)
- {
- if (event.widget == combo) {
- if (isListenerEnabled() && !isInDoHandle)
- {
- isInDoHandle = true;
- startDelayedEvent(event);
- isInDoHandle = false;
- }
- }
- else {
- super.handleEvent(event);
- }
- }
-
- /*
- * @see org.eclipse.wst.common.ui.properties.internal.provisional.view.ITabbedPropertySection#refresh()
- */
- public void refresh() {
- combo.removeListener(SWT.Modify, this);
-
- super.refresh();
-
- List comboItems = getComboItems();
- if (comboItems.size() > 0) {
- combo.removeAll();
- itemsInCombo.clear();
-
- // We need to populate this combo with the available references
- // TODO: rmah: We should include the prefix as well
- String currentComboItemName = getComboItemName(getCurrentComboItem());
- int currentBindingIndex = -1;
-
- List items = getComboItems();
- for (int index = 0; index < items.size(); index++) {
- Object item = items.get(index);
- String itemName = getComboItemName(item);
- combo.add(itemName);
- itemsInCombo.add(item);
-
- if (itemName.equals(currentComboItemName)) {
- currentBindingIndex = index;
- }
- }
-
- if (currentBindingIndex != -1) {
- combo.select(currentBindingIndex);
- }
- }
-
- setControlForegroundColor(combo);
- combo.addListener(SWT.Modify, this);
- }
-
- protected abstract List getComboItems();
- protected abstract Object getCurrentComboItem();
- protected abstract String getComboItemName(Object item);
- protected abstract void performComboSelection(Object item);
-
- public boolean shouldUseExtraSpace()
- {
- return false;
- }
-
- public void doHandleEvent(Event event)
- {
- super.doHandleEvent(event);
- if (event.widget == combo && !combo.isDisposed()) {
- int selectionIndex = combo.getSelectionIndex();
- performComboSelection(itemsInCombo.get(selectionIndex));
- refresh();
- }
- }
-}

Back to the top