131945 - Creating PartnerLinkType, Property and PropertyAlias
diff --git a/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
index 499c2bf..2fd10e7 100644
--- a/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
@@ -25,7 +25,11 @@
org.wsdl4j,
org.eclipse.bpel.common.ui,
org.eclipse.bpel.common.model,
- org.eclipse.bpel.model
+ org.eclipse.bpel.model,
+ org.eclipse.wst.wsdl.ui,
+ org.eclipse.wst.xsd.ui,
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.common.ui
Eclipse-LazyStart: true
Export-Package: org.eclipse.bpel.ui,
org.eclipse.bpel.ui.actions,
diff --git a/plugins/org.eclipse.bpel.ui/plugin.xml b/plugins/org.eclipse.bpel.ui/plugin.xml
index eec624c..fecd48c 100644
--- a/plugins/org.eclipse.bpel.ui/plugin.xml
+++ b/plugins/org.eclipse.bpel.ui/plugin.xml
@@ -4,8 +4,8 @@
<extension-point id="hoverHelpers" name="%HOVERHELP_HELPER_NAME"/>
<extension-point id="expressionEditors" name="%EXPRESSION_LANGUAGE_EDITORS_NAME"/>
- <extension-point id="actions" name="Actions" schema="schema/actions.exsd"/>
- <extension-point id="modelListener" name="Model Listener" schema="schema/modelListener.exsd"/>
+ <extension-point id="actions" name="Actions" schema="schemas/actions.exsd"/>
+ <extension-point id="modelListener" name="Model Listener" schema="schemas/modelListener.exsd"/>
<extension
@@ -196,7 +196,7 @@
class="org.eclipse.bpel.ui.properties.ActionImplementationSection"
tab="org.eclipse.bpel.ui.tabs.details"
id="org.eclipse.bpel.ui.sections.ActionImplementationSection">
- <input type="org.eclipse.bpel.Empty"/>
+ <input type="org.eclipse.bpel.model.Empty"/>
</propertySection>
<propertySection
tab="org.eclipse.bpel.ui.tabs.description"
@@ -607,5 +607,51 @@
class="org.eclipse.bpel.ui.uiextensionmodel.UiextensionmodelPackage">
</package>
</extension>
+
+ <extension
+ point="org.eclipse.wst.xml.core.catalogContributions">
+ <catalogContribution id="default">
+ <public
+ publicId="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
+ uri="platform:/plugin/org.eclipse.bpel.ui/schemas/wsbpel_plinkType.xsd">
+ </public>
+ </catalogContribution>
+ <catalogContribution id="default">
+ <public
+ publicId="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ uri="platform:/plugin/org.eclipse.bpel.ui/schemas/wsbpel_msgprop.xsd">
+ </public>
+ </catalogContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.wsdl.ui.internalEditorExtensions">
+ <internalEditorExtension
+ class="org.eclipse.bpel.ui.wsdl.extensions.BPELWSDLEditorExtension" />
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.wsdl.ui.extensibilityItemTreeProviders">
+ <extensibilityItemTreeProvider
+ labelProviderClass="org.eclipse.bpel.ui.wsdl.extensions.BPELWSDLEditorExtension"
+ namespace="http://schemas.xmlsoap.org/ws/2004/03/business-process/"/>
+ <extensibilityItemTreeProvider
+ labelProviderClass="org.eclipse.bpel.ui.wsdl.extensions.BPELWSDLEditorExtension"
+ namespace="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.wsdl.ui.propertyDescriptorProvider">
+ <propertyDescriptorProvider
+ namespace="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ class="org.eclipse.bpel.ui.wsdl.extensions.properties.BPELBusinessProcessPropertyDescriptorProvider"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.wst.wsdl.ui.propertyDescriptorProvider">
+ <propertyDescriptorProvider
+ namespace="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
+ class="org.eclipse.bpel.ui.wsdl.extensions.properties.BPELPartnerLinkPropertyDescriptorProvider"/>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.bpel.ui/schema/actions.exsd b/plugins/org.eclipse.bpel.ui/schemas/actions.exsd
similarity index 100%
rename from plugins/org.eclipse.bpel.ui/schema/actions.exsd
rename to plugins/org.eclipse.bpel.ui/schemas/actions.exsd
diff --git a/plugins/org.eclipse.bpel.ui/schema/modelListener.exsd b/plugins/org.eclipse.bpel.ui/schemas/modelListener.exsd
similarity index 100%
rename from plugins/org.eclipse.bpel.ui/schema/modelListener.exsd
rename to plugins/org.eclipse.bpel.ui/schemas/modelListener.exsd
diff --git a/plugins/org.eclipse.bpel.ui/schemas/wsbpel_msgprop.xsd b/plugins/org.eclipse.bpel.ui/schemas/wsbpel_msgprop.xsd
new file mode 100644
index 0000000..1b9e56c
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/schemas/wsbpel_msgprop.xsd
@@ -0,0 +1,85 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+2005-08-30: YIU-OSS: Alex Yiu: This XSD becomes merged into wsbpel_main.xsd, as a result of Issue 192. This XSD becomes obsolete.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ targetNamespace="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
+ elementFormDefault="qualified">
+
+ <annotation>
+ <documentation>
+ Message Properties Schema
+ 2004-03-24: YIU-OSS: Alex Yiu: Extracted from wsbpel-specification-draft.doc (Rev 1.22 - Modified on 24 March, 2004)
+ 2004-03-24: YIU-OSS: Alex Yiu: Updated targetNamespace with "2004/03"
+ 2004-03-24: YIU-OSS: Alex Yiu: Adding minOccurs="0" to query element; fix the syntax typo in "propertyAlias" definition (e.g remove complexContent)
+ 2004-04-07: YIU-OSS: Alex Yiu: removed unnecessary wsbp xmlns
+ 2005-07-25: YIU-OSS: Alex Yiu: Apply Issue 196 by adding anyAttribute to query
+ 2005-08-30: YIU-OSS: Alex Yiu: This XSD becomes merged into wsbpel_main.xsd, as a result of Issue 192. This XSD becomes obsolete.
+
+ </documentation>
+ </annotation>
+
+ <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd" />
+ <element name="documentation" id="documentation">
+ <complexType mixed="true">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any processContents="lax"/>
+ </sequence>
+ <attribute name="source" type="anyURI"/>
+ <attribute ref="xml:lang"/>
+ </complexType>
+ </element>
+ <complexType name="tExtensibleElements">
+ <annotation>
+ <documentation>
+ This type is extended by other component types
+ to allow elements and attributes from
+ other namespaces to be added.
+ </documentation>
+ </annotation>
+ <sequence>
+ <element ref="tns:documentation" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+ <element name="property">
+ <complexType>
+ <complexContent>
+ <extension base="tns:tExtensibleElements">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName"/>
+ <attribute name="element" type="QName"/>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+ <complexType name="tQuery" mixed="true">
+ <sequence>
+ <any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+ </sequence>
+ <attribute name="queryLanguage" type="anyURI"/>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+ <element name="propertyAlias">
+ <complexType>
+ <complexContent>
+ <extension base="tns:tExtensibleElements">
+ <sequence>
+ <element name="query" minOccurs="0" type="tns:tQuery" />
+ </sequence>
+ <attribute name="propertyName" type="QName" use="required"/>
+ <attribute name="messageType" type="QName"/>
+ <attribute name="part" type="NCName"/>
+ <attribute name="type" type="QName"/>
+ <attribute name="element" type="QName"/>
+ </extension>
+ </complexContent>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/plugins/org.eclipse.bpel.ui/schemas/wsbpel_plinkType.xsd b/plugins/org.eclipse.bpel.ui/schemas/wsbpel_plinkType.xsd
new file mode 100644
index 0000000..349a725
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/schemas/wsbpel_plinkType.xsd
@@ -0,0 +1,64 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
+ targetNamespace="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
+ elementFormDefault="qualified">
+
+ <annotation>
+ <documentation>
+ Partner Link Type Schema
+ 2004-03-24: YIU-OSS: Alex Yiu: Extracted from wsbpel-specification-draft.doc (Rev 1.22 - Modified on 24 March, 2004)
+ 2004-03-24: YIU-OSS: Alex Yiu: Updated targetNamespace with "2004/03"
+ 2004-10-21: YIU-OSS: Alex Yiu: Applied Issue 129
+ 2005-08-30: Rev 1.4: YIU-OSS: Alex Yiu: Applied Issue 192
+ </documentation>
+ </annotation>
+
+ <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd" />
+ <element name="documentation" id="documentation">
+ <complexType mixed="true">
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <any processContents="lax"/>
+ </sequence>
+ <attribute name="source" type="anyURI"/>
+ <attribute ref="xml:lang"/>
+ </complexType>
+ </element>
+ <complexType name="tExtensibleElements">
+ <annotation>
+ <documentation>
+ This type is extended by other component types
+ to allow elements and attributes from
+ other namespaces to be added.
+ </documentation>
+ </annotation>
+ <sequence>
+ <element ref="tns:documentation" minOccurs="0" maxOccurs="unbounded" />
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##other" processContents="lax"/>
+ </complexType>
+
+
+ <element name="partnerLinkType" type="tns:tPartnerLinkType"/>
+
+ <complexType name="tPartnerLinkType">
+ <complexContent>
+ <extension base="tns:tExtensibleElements">
+ <sequence>
+ <element name="role" type="tns:tRole" minOccurs="1" maxOccurs="2"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <complexType name="tRole">
+ <complexContent>
+ <extension base="tns:tExtensibleElements">
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="portType" type="QName" use="required" />
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
index 1ad939b..eb15aff 100644
--- a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
@@ -488,6 +488,18 @@
public static String DateTimeSelector_Month_10;
public static String DateTimeSelector_Month_11;
public static String DateTimeSelector_Month_12;
+
+ public static String BPELPropertyAliasQuerySection_Query_Language;
+ public static String BPELPropertyAliasQuerySection_Query;
+
+ public static String BPELPartnerLinkRolesSection_Add;
+ public static String BPELPartnerLinkRolesSection_Remove;
+ public static String BPELPartnerLinkRolesSection_Roles;
+
+ public static String BPELPartnerLinkRolesSection_Role_Name;
+ public static String BPELPartnerLinkRolesSection_Role_PortType;
+
+ public static String BPELWSDLComponentSelectionDialog;
public static String ShowPropertiesViewAction_actionText;
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
index 11785f3..bfd54ce 100644
--- a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
@@ -480,3 +480,14 @@
DateTimeSelector_Month_12=Dec
ShowPropertiesViewAction_actionText=Show in Properties
+
+BPELPropertyAliasQuerySection_Query_Language=&Query language\:
+BPELPropertyAliasQuerySection_Query=&Query\:
+
+BPELPartnerLinkRolesSection_Add=&Add
+BPELPartnerLinkRolesSection_Remove=&Remove
+BPELPartnerLinkRolesSection_Roles=&Roles\:
+BPELPartnerLinkRolesSection_Role_Name=Name
+BPELPartnerLinkRolesSection_Role_PortType=Port Type
+
+BPELWSDLComponentSelectionDialog=Select WSDL Component
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkRolesSection.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkRolesSection.java
new file mode 100644
index 0000000..e204a87
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkRolesSection.java
@@ -0,0 +1,276 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import org.eclipse.bpel.common.ui.details.IDetailsAreaConstants;
+import org.eclipse.bpel.common.ui.flatui.FlatFormAttachment;
+import org.eclipse.bpel.common.ui.flatui.FlatFormData;
+import org.eclipse.bpel.common.ui.flatui.FlatFormLayout;
+import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
+import org.eclipse.bpel.model.partnerlinktype.Role;
+import org.eclipse.bpel.model.partnerlinktype.util.PartnerlinktypeConstants;
+import org.eclipse.bpel.ui.Messages;
+import org.eclipse.bpel.ui.details.providers.AbstractContentProvider;
+import org.eclipse.bpel.ui.details.providers.ColumnTableProvider;
+import org.eclipse.bpel.ui.properties.BPELPropertySection;
+import org.eclipse.bpel.ui.util.BPELUtil;
+import org.eclipse.bpel.ui.util.TableCursor;
+import org.eclipse.bpel.ui.wsdl.extensions.properties.WSDLComponentSelectionDialogPropertyDescriptor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.common.ui.properties.internal.provisional.AbstractPropertySection;
+import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+import org.eclipse.wst.wsdl.ui.internal.actions.AddElementAction;
+import org.eclipse.wst.wsdl.ui.internal.actions.DeleteAction;
+import org.eclipse.wst.wsdl.util.WSDLConstants;
+import org.w3c.dom.Element;
+
+public class BPELPartnerLinkRolesSection extends AbstractPropertySection {
+
+ protected PartnerLinkType plink;
+
+ protected Table rolesTable;
+ protected TableViewer rolesViewer;
+ protected ColumnTableProvider tableProvider;
+ protected TableCursor tableCursor = null;
+
+ protected Button addButton;
+ protected Button removeButton;
+
+ protected WSDLEditor editor;
+
+ public void aboutToBeHidden() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void aboutToBeShown() {
+ refresh();
+ }
+
+ public class PortTypeColumn extends ColumnTableProvider.Column implements ILabelProvider, ICellModifier {
+ public String getHeaderText() { return Messages.BPELPartnerLinkRolesSection_Role_PortType; }
+ public String getProperty() { return PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE; } //$NON-NLS-1$
+ public int getInitialWeight() { return 10; }
+
+ public CellEditor createCellEditor(Composite parent) {
+ return WSDLComponentSelectionDialogPropertyDescriptor.createCellEditor(parent, editor, WSDLConstants.PORT_TYPE, null);
+ }
+
+ public String getText(Object element) {
+ if (((Role)element).getElement().hasAttribute(PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE))
+ return ((Role)element).getElement().getAttribute(PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE);
+ else
+ return "";
+ }
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ public Object getValue(Object element, String property) {
+ return ((Role)element).getElement().getAttribute(PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE);
+ }
+ public void modify(Object element, String property, Object value) {
+ ((Role)element).getElement().setAttribute(PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE, (String)value);
+ refresh();
+ }
+ }
+
+ public class NameColumn extends ColumnTableProvider.Column implements ILabelProvider, ICellModifier {
+ public String getHeaderText() { return Messages.BPELPartnerLinkRolesSection_Role_Name; }
+ public String getProperty() { return PartnerlinktypeConstants.NAME_ATTRIBUTE; } //$NON-NLS-1$
+ public int getInitialWeight() { return 10; }
+
+ public CellEditor createCellEditor(Composite parent) {
+ CellEditor result = new TextCellEditor();
+ result.create(parent);
+ return result;
+ }
+ public String getText(Object element) {
+ return ((Role)element).getName();
+ }
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ public Object getValue(Object element, String property) {
+ return ((Role)element).getName();
+ }
+ public void modify(Object element, String property, Object value) {
+ ((Role)element).setName((String)value);
+ refresh();
+ }
+ }
+
+
+ public void createControls(Composite parent, TabbedPropertySheetPage page) {
+ FlatFormData data;
+ Composite composite = page.getWidgetFactory().createFlatFormComposite(parent);
+ FlatFormLayout formLayout = new FlatFormLayout();
+ formLayout.marginWidth = formLayout.marginHeight = 0;
+ composite.setLayout(formLayout);
+
+ addButton = page.getWidgetFactory().createButton(composite, Messages.BPELPartnerLinkRolesSection_Add, SWT.PUSH);
+ removeButton = page.getWidgetFactory().createButton(composite, Messages.BPELPartnerLinkRolesSection_Remove, SWT.PUSH);
+ Label rolesLabel = page.getWidgetFactory().createLabel(composite, Messages.BPELPartnerLinkRolesSection_Roles);
+ rolesTable = page.getWidgetFactory().createTable(composite, SWT.FULL_SELECTION | SWT.V_SCROLL);
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, 0);
+ data.top = new FlatFormAttachment(0, 0);
+ rolesLabel.setLayoutData(data);
+
+ data = new FlatFormData();
+ data.width = BPELUtil.calculateButtonWidth(addButton, BPELPropertySection.STANDARD_BUTTON_WIDTH);
+ data.right = new FlatFormAttachment(removeButton, -IDetailsAreaConstants.HSPACE);
+ data.top = new FlatFormAttachment(0, 0);
+ addButton.setLayoutData(data);
+
+ data = new FlatFormData();
+ data.width = BPELUtil.calculateButtonWidth(removeButton, BPELPropertySection.STANDARD_BUTTON_WIDTH);
+ data.right = new FlatFormAttachment(100, 0);
+ data.top = new FlatFormAttachment(0, 0);
+ removeButton.setLayoutData(data);
+ removeButton.setEnabled(false);
+
+ addButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ Action action = new AddElementAction("Add role",getPartnerLinkType().getElement(),getPartnerLinkType().getElement().getPrefix(),PartnerlinktypeConstants.ROLE_ELEMENT_TAG){
+
+ protected void addAttributes(Element newElement) {
+ newElement.setAttribute(PartnerlinktypeConstants.NAME_ATTRIBUTE, "NCName");
+ }
+
+ };
+ action.run();
+ updateButtonEnablement();
+ if (tableCursor != null)
+ tableCursor.refresh();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); }
+ });
+ Listener removeListener = new Listener() {
+ public void handleEvent(Event e) {
+ if (e.type == SWT.KeyUp && e.character != SWT.DEL) return;
+ int selectionIndex = rolesTable.getSelectionIndex();
+ IStructuredSelection sel = (IStructuredSelection)rolesViewer.getSelection();
+ Action action = new DeleteAction(((IStructuredSelection)sel).getFirstElement(),null);
+ action.run();
+ // selects the element at the deleted element position
+ int items = rolesTable.getItemCount();
+ if (items > 0) {
+ selectionIndex = (selectionIndex < items) ? selectionIndex : 0;
+ rolesTable.setSelection(selectionIndex);
+ }
+ if (tableCursor != null)
+ tableCursor.refresh();
+ updateButtonEnablement();
+ }
+ };
+ rolesTable.addListener(SWT.KeyUp, removeListener);
+
+ removeButton.addListener(SWT.Selection, removeListener);
+ removeButton.addListener(SWT.DefaultSelection, removeListener);
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, 0);
+ data.right = new FlatFormAttachment(100, 0);
+ data.top = new FlatFormAttachment(addButton, IDetailsAreaConstants.VSPACE);
+ data.bottom = new FlatFormAttachment(100, 0);
+ rolesTable.setLayoutData(data);
+
+ rolesTable.setLinesVisible(true);
+ rolesTable.setHeaderVisible(true);
+
+ tableProvider = new ColumnTableProvider();
+ tableProvider.add(new NameColumn());
+ tableProvider.add(new PortTypeColumn());
+
+ rolesTable.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ removeButton.setEnabled(!rolesViewer.getSelection().isEmpty());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); }
+ });
+
+ rolesViewer = new TableViewer(rolesTable);
+ tableProvider.createTableLayout(rolesTable);
+ rolesViewer.setLabelProvider(tableProvider);
+ rolesViewer.setCellModifier(tableProvider);
+ rolesViewer.setContentProvider(new AbstractContentProvider(){
+
+ public Object[] getElements(Object inputElement) {
+ // TODO Auto-generated method stub
+ return ((PartnerLinkType)inputElement).getRole().toArray();
+ }
+
+ });
+ // TODO: should this have a sorter?
+ rolesViewer.setColumnProperties(tableProvider.getColumnProperties());
+ rolesViewer.addSelectionChangedListener(new ISelectionChangedListener(){
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateButtonEnablement();
+ }
+ });
+
+ tableCursor = BPELUtil.createTableCursor(rolesTable, rolesViewer);
+ }
+
+ protected void updateButtonEnablement(){
+ boolean hasSelection = !rolesViewer.getSelection().isEmpty();
+ removeButton.setEnabled(hasSelection && getPartnerLinkType().getRole().size() == 2);
+ addButton.setEnabled(getPartnerLinkType().getRole().size() < 2);
+ }
+
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void refresh(){
+ rolesViewer.refresh();
+ }
+
+ public int getMinimumHeight() {
+ // TODO Auto-generated method stub
+ return SWT.DEFAULT;
+ }
+
+ public void setInput(IWorkbenchPart arg0, ISelection selection) {
+ Assert.isTrue(selection instanceof IStructuredSelection);
+ plink = (PartnerLinkType)((IStructuredSelection)selection).getFirstElement();
+ editor = (WSDLEditor)arg0;
+ rolesViewer.setCellEditors(tableProvider.createCellEditors(rolesTable));
+ rolesViewer.setInput(plink);
+ updateButtonEnablement();
+ }
+
+ public PartnerLinkType getPartnerLinkType() {
+ return plink;
+ }
+
+ public boolean shouldUseExtraSpace() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkTypeSectionDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkTypeSectionDescriptor.java
new file mode 100644
index 0000000..c80c269
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPartnerLinkTypeSectionDescriptor.java
@@ -0,0 +1,50 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.common.ui.properties.internal.provisional.ISection;
+import org.eclipse.wst.wsdl.ui.internal.properties.section.AbstractSectionDescriptor;
+
+public class BPELPartnerLinkTypeSectionDescriptor extends AbstractSectionDescriptor{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean appliesTo(IWorkbenchPart part, ISelection selection)
+ {
+ if (selection instanceof StructuredSelection)
+ {
+ StructuredSelection structuredSelection = (StructuredSelection)selection;
+ return structuredSelection.getFirstElement() instanceof PartnerLinkType;
+ }
+ return false;
+ }
+
+
+ public String getId() {
+ // TODO Auto-generated method stub
+ return "org.eclipse.bpel.ui.section.other.partnerLinkType";
+ }
+
+ public List getInputTypes() {
+ List list = new ArrayList();
+ list.add(PartnerLinkType.class);
+ return list;
+ }
+
+ public ISection getSectionClass() {
+ // TODO Auto-generated method stub
+ return new BPELPartnerLinkRolesSection();
+ }
+
+ public String getTargetTab() {
+ // TODO Auto-generated method stub
+ return "org.eclipse.wst.xmlwebservices.other";
+ }
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasQuerySection.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasQuerySection.java
new file mode 100644
index 0000000..404e809
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasQuerySection.java
@@ -0,0 +1,346 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.bpel.common.ui.details.IDetailsAreaConstants;
+import org.eclipse.bpel.common.ui.details.viewers.CComboViewer;
+import org.eclipse.bpel.common.ui.flatui.FlatFormAttachment;
+import org.eclipse.bpel.common.ui.flatui.FlatFormData;
+import org.eclipse.bpel.common.ui.flatui.FlatFormLayout;
+import org.eclipse.bpel.model.messageproperties.MessagepropertiesFactory;
+import org.eclipse.bpel.model.messageproperties.PropertyAlias;
+import org.eclipse.bpel.model.messageproperties.Query;
+import org.eclipse.bpel.ui.Messages;
+import org.eclipse.bpel.ui.details.providers.ExpressionEditorDescriptorContentProvider;
+import org.eclipse.bpel.ui.details.providers.ExpressionEditorDescriptorLabelProvider;
+import org.eclipse.bpel.ui.details.providers.ModelTreeLabelProvider;
+import org.eclipse.bpel.ui.details.providers.ModelViewerSorter;
+import org.eclipse.bpel.ui.details.tree.ITreeNode;
+import org.eclipse.bpel.ui.extensions.BPELUIRegistry;
+import org.eclipse.bpel.ui.extensions.ExpressionEditorDescriptor;
+import org.eclipse.bpel.ui.properties.BPELPropertySection;
+import org.eclipse.bpel.ui.util.BPELUtil;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.common.ui.properties.internal.provisional.ISection;
+import org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetPage;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+
+public class BPELPropertyAliasQuerySection implements ISection,
+ ISelectionChangedListener {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (((IStructuredSelection) queryLanguageViewer.getSelection())
+ .getFirstElement() instanceof ExpressionEditorDescriptor) {
+ editorAreaComposite.setVisible(true);
+ ExpressionEditorDescriptor desc = (ExpressionEditorDescriptor) ((IStructuredSelection) queryLanguageViewer
+ .getSelection()).getFirstElement();
+ if (palias.getQuery() == null) {
+ Query newQuery = MessagepropertiesFactory.eINSTANCE
+ .createQuery();
+ newQuery.setQueryLanguage(desc.getExpressionLanguage());
+ palias.setQuery(newQuery);
+ } else {
+ palias.getQuery()
+ .setQueryLanguage(desc.getExpressionLanguage());
+ }
+
+ } else if (NO_QUERY.equals(((IStructuredSelection) queryLanguageViewer
+ .getSelection()).getFirstElement())) {
+ palias.setQuery(null);
+ editorAreaComposite.setVisible(false);
+ query.setText("");
+ referenceViewer.setSelection(StructuredSelection.EMPTY, false);
+ referenceViewer.collapseAll();
+ }
+ }
+
+ public void refresh() {
+ }
+
+ protected PropertyAlias palias;
+
+ protected CCombo queryLanguageCCombo;
+
+ protected CComboViewer queryLanguageViewer;
+
+ protected TreeViewer referenceViewer;
+
+ protected Text query;
+
+ protected Composite editorAreaComposite, parentComposite;
+
+ protected TabbedPropertySheetPage page;
+
+ // Pseudo-model object to represent no expression at all (in which case no
+ // editor
+ // is used).
+ protected static final Object NO_QUERY = new Object();
+
+ public void aboutToBeHidden() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void aboutToBeShown() {
+ refresh();
+ }
+
+ public void createControls(Composite parent, TabbedPropertySheetPage page) {
+ FlatFormData data;
+ this.page = page;
+ parentComposite = page.getWidgetFactory().createFlatFormComposite(
+ parent);
+ FlatFormLayout layout = new FlatFormLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ parentComposite.setLayout(layout);
+
+ Label queryLanguageLabel = page.getWidgetFactory().createLabel(
+ parentComposite, Messages.BPELPropertyAliasQuerySection_Query_Language);
+ queryLanguageCCombo = page.getWidgetFactory().createCCombo(
+ parentComposite, SWT.FLAT);
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, BPELUtil.calculateLabelWidth(
+ queryLanguageLabel,
+ BPELPropertySection.STANDARD_LABEL_WIDTH_LRG));
+ data.right = new FlatFormAttachment(100, 0);
+ data.top = new FlatFormAttachment(0, 0);
+ queryLanguageCCombo.setLayoutData(data);
+
+ // Query language combo layout
+ queryLanguageViewer = new CComboViewer(queryLanguageCCombo);
+
+ queryLanguageViewer
+ .setLabelProvider(new ExpressionEditorDescriptorLabelProvider() {
+
+ public String getText(Object element) {
+ if (NO_QUERY.equals(element))
+ return "No query";
+ return super.getText(element);
+ }
+
+ });
+ queryLanguageViewer
+ .setContentProvider(new ExpressionEditorDescriptorContentProvider() {
+
+ public Object[] getElements(Object inputElement) {
+ Object[] elements = super.getElements(inputElement);
+ List newElements = new ArrayList(elements.length + 1);
+ newElements.add(NO_QUERY);
+ for (int i = 0; i < elements.length; i++) {
+ newElements.add(elements[i]);
+ }
+ return newElements.toArray();
+ }
+
+ });
+ queryLanguageViewer.setSorter(ModelViewerSorter.getInstance());
+ queryLanguageViewer.addSelectionChangedListener(this);
+ queryLanguageViewer.setInput(new Object());
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, 0);
+ data.right = new FlatFormAttachment(queryLanguageCCombo,
+ -IDetailsAreaConstants.HSPACE);
+ data.top = new FlatFormAttachment(queryLanguageCCombo, 0, SWT.CENTER);
+ queryLanguageLabel.setLayoutData(data);
+
+ editorAreaComposite = page.getWidgetFactory().createFlatFormComposite(
+ parentComposite);
+ layout = new FlatFormLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ editorAreaComposite.setLayout(layout);
+
+ data = new FlatFormData();
+ data.top = new FlatFormAttachment(queryLanguageCCombo,
+ IDetailsAreaConstants.VSPACE);
+ data.left = new FlatFormAttachment(0, 0);
+ data.right = new FlatFormAttachment(100, 0);
+ data.bottom = new FlatFormAttachment(100, 0);
+ editorAreaComposite.setLayoutData(data);
+
+ Label queryLabel = page.getWidgetFactory().createLabel(
+ editorAreaComposite,
+ Messages.BPELPropertyAliasQuerySection_Query);
+ query = page.getWidgetFactory().createText(editorAreaComposite, "",
+ SWT.READ_ONLY);
+ Tree referenceTree = page.getWidgetFactory().createTree(
+ editorAreaComposite, SWT.BORDER);
+ BPELQueryTreeContentProvider referenceContentProvider = new BPELQueryTreeContentProvider(
+ true);
+ referenceViewer = new TreeViewer(referenceTree);
+ referenceViewer.setContentProvider(referenceContentProvider);
+ referenceViewer.setLabelProvider(new ModelTreeLabelProvider());
+ referenceViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateQueryFieldFromTreeSelection();
+ }
+ });
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, BPELUtil.calculateLabelWidth(
+ queryLabel, BPELPropertySection.STANDARD_LABEL_WIDTH_LRG));
+ data.right = new FlatFormAttachment(100, -IDetailsAreaConstants.HSPACE);
+ data.bottom = new FlatFormAttachment(100, 0);
+ data.top = new FlatFormAttachment(100, -query.getLineHeight()
+ - IDetailsAreaConstants.VSPACE);
+ query.setLayoutData(data);
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, BPELUtil.calculateLabelWidth(
+ queryLabel, BPELPropertySection.STANDARD_LABEL_WIDTH_LRG));
+ data.right = new FlatFormAttachment(100, 0);
+ data.top = new FlatFormAttachment(queryLanguageCCombo,
+ IDetailsAreaConstants.VSPACE, SWT.BOTTOM);
+ data.bottom = new FlatFormAttachment(query,
+ -IDetailsAreaConstants.VSPACE, SWT.TOP);
+ referenceTree.setLayoutData(data);
+
+ data = new FlatFormData();
+ data.left = new FlatFormAttachment(0, 0);
+ data.right = new FlatFormAttachment(referenceTree,
+ -IDetailsAreaConstants.HSPACE);
+ data.top = new FlatFormAttachment(referenceTree, 0, SWT.CENTER);
+ queryLabel.setLayoutData(data);
+ }
+
+ protected void updateQueryFieldFromTreeSelection() {
+ IStructuredSelection sel = (IStructuredSelection) referenceViewer
+ .getSelection();
+ if (palias.getQuery() != null && sel.getFirstElement() != null) {
+ Object[] path = ((BPELQueryTreeContentProvider) referenceViewer
+ .getContentProvider()).getPathToRoot(sel.getFirstElement());
+ String queryText = ""; //$NON-NLS-1$
+ for (int i = 0; i < path.length - 1; i++) {
+ Object modelObject = BPELUtil
+ .resolveXSDObject(((ITreeNode) path[i])
+ .getModelObject());
+ if (modelObject instanceof XSDElementDeclaration
+ || modelObject instanceof XSDAttributeDeclaration) {
+ String nameSegment = ((XSDNamedComponent) modelObject)
+ .getName();
+ if (nameSegment != null) {
+ if (!queryText.equals("")) { //$NON-NLS-1$
+ queryText = nameSegment + "/" + queryText; //$NON-NLS-1$
+ } else {
+ queryText = nameSegment;
+ }
+ }
+ }
+ }
+ if (queryText.length() > 0) {
+ queryText = "/" + queryText; //$NON-NLS-1$
+ Query newQuery = MessagepropertiesFactory.eINSTANCE
+ .createQuery();
+ newQuery.setQueryLanguage(palias.getQuery().getQueryLanguage());
+ newQuery.setValue(queryText);
+ palias.setQuery(newQuery);
+ } else {
+ Query newQuery = MessagepropertiesFactory.eINSTANCE
+ .createQuery();
+ newQuery.setQueryLanguage(palias.getQuery().getQueryLanguage());
+ palias.setQuery(newQuery);
+ }
+ query.setText(queryText);
+ }
+
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getMinimumHeight() {
+ // TODO Auto-generated method stub
+ return SWT.DEFAULT;
+ }
+
+ public void setInput(IWorkbenchPart arg0, ISelection selection) {
+ Assert.isTrue(selection instanceof IStructuredSelection);
+ palias = (PropertyAlias) ((IStructuredSelection) selection)
+ .getFirstElement();
+ if (palias != null) {
+ referenceViewer.setInput(palias);
+ Object model = NO_QUERY;
+ if (palias.getQuery() != null) {
+ String language = palias.getQuery().getQueryLanguage();
+ if (language != null) {
+ ExpressionEditorDescriptor descriptor = BPELUIRegistry
+ .getInstance().getExpressionEditorDescriptor(
+ language);
+ if (descriptor != null) {
+ model = descriptor;
+ }
+ }
+ editorAreaComposite.setVisible(true);
+ String queryText = palias.getQuery().getValue();
+
+ if (queryText != null && queryText.length() > 0){
+ Object[] items = ((BPELQueryTreeContentProvider) referenceViewer
+ .getContentProvider()).getElements(palias);
+ ITreeNode node = (ITreeNode)items[0];
+
+ StringTokenizer tokenizer = new StringTokenizer(queryText,"/");
+
+ while (tokenizer.hasMoreTokens()){
+ String token = tokenizer.nextToken();
+
+ Object[] children = ((BPELQueryTreeContentProvider) referenceViewer
+ .getContentProvider()).getChildren(node);
+
+ for (int i = 0 ; i < children.length; i++) {
+ Object originalMatch = ((ITreeNode) children[i]).getModelObject();
+ Object match = BPELUtil.resolveXSDObject(originalMatch);
+ if (match instanceof XSDElementDeclaration || match instanceof XSDAttributeDeclaration) {
+ if (token.equals(((XSDNamedComponent) match).getName())) {
+ node = (ITreeNode) children[i];
+ break;
+ }
+ }
+ }
+ }
+ referenceViewer.expandToLevel(node, 0);
+ referenceViewer.setSelection(new StructuredSelection(node),
+ true);
+ }
+ } else {
+ editorAreaComposite.setVisible(false);
+ referenceViewer.setSelection(StructuredSelection.EMPTY, false);
+ referenceViewer.collapseAll();
+ }
+
+ queryLanguageViewer.removeSelectionChangedListener(this);
+ queryLanguageViewer.setSelection(new StructuredSelection(model));
+ queryLanguageViewer.addSelectionChangedListener(this);
+
+
+ }
+
+
+ }
+
+ public boolean shouldUseExtraSpace() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasSectionDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasSectionDescriptor.java
new file mode 100644
index 0000000..8e1e3c4
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELPropertyAliasSectionDescriptor.java
@@ -0,0 +1,49 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.model.messageproperties.PropertyAlias;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.wst.common.ui.properties.internal.provisional.ISection;
+import org.eclipse.wst.wsdl.ui.internal.properties.section.AbstractSectionDescriptor;
+
+public class BPELPropertyAliasSectionDescriptor extends AbstractSectionDescriptor{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ public boolean appliesTo(IWorkbenchPart part, ISelection selection)
+ {
+ if (selection instanceof StructuredSelection)
+ {
+ StructuredSelection structuredSelection = (StructuredSelection)selection;
+ return structuredSelection.getFirstElement() instanceof PropertyAlias;
+ }
+ return false;
+ }
+
+ public String getId() {
+ // TODO Auto-generated method stub
+ return "org.eclipse.bpel.ui.section.other.propertyAlias";
+ }
+
+ public List getInputTypes() {
+ List list = new ArrayList();
+ list.add(PropertyAlias.class);
+ return list;
+ }
+
+ public ISection getSectionClass() {
+ // TODO Auto-generated method stub
+ return new BPELPropertyAliasQuerySection();
+ }
+
+ public String getTargetTab() {
+ // TODO Auto-generated method stub
+ return "org.eclipse.wst.xmlwebservices.other";
+ }
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELQueryTreeContentProvider.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELQueryTreeContentProvider.java
new file mode 100644
index 0000000..eb2ca5e
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELQueryTreeContentProvider.java
@@ -0,0 +1,44 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import java.util.Iterator;
+
+import org.eclipse.bpel.model.messageproperties.PropertyAlias;
+import org.eclipse.bpel.ui.details.providers.ModelTreeContentProvider;
+import org.eclipse.bpel.ui.details.tree.PartTreeNode;
+import org.eclipse.bpel.ui.details.tree.XSDElementDeclarationTreeNode;
+import org.eclipse.bpel.ui.details.tree.XSDTypeDefinitionTreeNode;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.Part;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+public class BPELQueryTreeContentProvider extends ModelTreeContentProvider{
+
+ public BPELQueryTreeContentProvider(boolean isCondensed) {
+ super(isCondensed);
+ // TODO Auto-generated constructor stub
+ }
+
+ public Object[] primGetElements(Object inputElement) {
+
+ if (inputElement instanceof PropertyAlias){
+ PropertyAlias palias = (PropertyAlias)inputElement;
+ if (palias.getMessageType() != null ) {
+ Message msg = (Message)palias.getMessageType();
+ Iterator partsIterator = msg.getEParts().iterator();
+ while (partsIterator.hasNext()) {
+ Part part = (Part)partsIterator.next();
+ if (part.getName().equals(palias.getPart())) {
+ return new Object[]{ new PartTreeNode(part, isCondensed, true)};
+ }
+ }
+ } else if (palias.getType() != null) {
+ return new Object[]{new XSDTypeDefinitionTreeNode((XSDTypeDefinition)palias.getType(), isCondensed)};
+ } else if (palias.getXSDElement() != null) {
+ return new Object[]{ new XSDElementDeclarationTreeNode((XSDElementDeclaration)palias.getXSDElement(), isCondensed)};
+ }
+ }
+ throw new IllegalStateException();
+ }
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLComponentSelectionProvider.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLComponentSelectionProvider.java
new file mode 100644
index 0000000..83bcad6
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLComponentSelectionProvider.java
@@ -0,0 +1,56 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.wst.wsdl.ui.internal.dialogs.types.WSDLComponentSelectionProvider;
+import org.eclipse.wst.xsd.ui.internal.dialogs.types.common.IComponentList;
+
+public class BPELWSDLComponentSelectionProvider extends WSDLComponentSelectionProvider{
+
+ public static int PROPERTY = 1809;
+
+ private int kind;
+
+ public BPELWSDLComponentSelectionProvider(IFile file, Definition definition, int kind, List validExt) {
+ super(file, definition, kind, validExt);
+ this.kind = kind;
+ }
+
+ public BPELWSDLComponentSelectionProvider(IFile file, Definition definition, int kind) {
+ super(file, definition, kind);
+ this.kind = kind;
+ }
+
+ public void getComponents(IComponentList list, boolean quick) {
+ if (PROPERTY == kind){
+
+ } else {
+ super.getComponents(list, quick);
+ }
+ }
+
+ public ILabelProvider getLabelProvider() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getListTitle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getNameFieldTitle() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getType(Object component) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLEditorExtension.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLEditorExtension.java
new file mode 100644
index 0000000..577f9ab
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/BPELWSDLEditorExtension.java
@@ -0,0 +1,48 @@
+package org.eclipse.bpel.ui.wsdl.extensions;
+
+import org.eclipse.bpel.ui.BPELUIPlugin;
+import org.eclipse.bpel.ui.IBPELUIConstants;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptor;
+import org.eclipse.wst.common.ui.properties.internal.provisional.ISectionDescriptorProvider;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+import org.eclipse.wst.wsdl.ui.internal.extension.WSDLEditorExtension;
+import org.w3c.dom.Node;
+
+public class BPELWSDLEditorExtension extends LabelProvider implements WSDLEditorExtension {
+
+ public Object createExtensionObject(int type, final WSDLEditor wsdlEditor) {
+ if (type == PROPERTY_SECTION_DESCRIPTOR_PROVIDER){
+ return new ISectionDescriptorProvider(){
+
+ public ISectionDescriptor[] getSectionDescriptors() {
+ // TODO Auto-generated method stub
+ return new ISectionDescriptor[]{new BPELPartnerLinkTypeSectionDescriptor(),new BPELPropertyAliasSectionDescriptor()};
+
+ }
+
+ };
+ }
+ return null;
+ }
+
+ public boolean isApplicable(Object modelObject) {
+ return true;
+ }
+
+ public boolean isExtensionTypeSupported(int type) {
+ return type == PROPERTY_SECTION_DESCRIPTOR_PROVIDER;
+ }
+
+ public Image getImage(Object element) {
+ // TODO Auto-generated method stub
+ return BPELUIPlugin.getPlugin().getImageDescriptor(IBPELUIConstants.ICON_PROCESS_16).createImage();
+ }
+
+ public String getText(Object element) {
+ // TODO Auto-generated method stub
+ return ((Node)element).getNodeName();
+ }
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELBusinessProcessPropertyDescriptorProvider.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELBusinessProcessPropertyDescriptorProvider.java
new file mode 100644
index 0000000..21d1bcb
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELBusinessProcessPropertyDescriptorProvider.java
@@ -0,0 +1,33 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import org.eclipse.bpel.model.messageproperties.util.MessagepropertiesConstants;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+import org.eclipse.wst.wsdl.ui.internal.properties.section.IPropertyDescriptorProvider;
+import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil;
+import org.eclipse.wst.wsdl.util.WSDLConstants;
+import org.w3c.dom.Element;
+
+public class BPELBusinessProcessPropertyDescriptorProvider implements IPropertyDescriptorProvider{
+
+ public IPropertyDescriptor getPropertyDescriptor(final IEditorPart editor, Element ownerElement, String attributeNamespace, String attributeName) {
+ if (MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE.equals(attributeName)) {
+ return new WSDLComponentSelectionDialogPropertyDescriptor(MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE,MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE,(WSDLEditor)editor,WSDLConstants.MESSAGE, ownerElement);
+ } else if (MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE.equals(attributeName)) {
+ return new WSDLComponentSelectionDialogPropertyDescriptor(MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,(WSDLEditor)editor,WSDLEditorUtil.ELEMENT, ownerElement);
+ } else if (MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE.equals(attributeName)) {
+ return new WSDLComponentSelectionDialogPropertyDescriptor(MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,(WSDLEditor)editor,WSDLEditorUtil.TYPE, ownerElement);
+ } else if (MessagepropertiesConstants.PROPERTY_ALIAS_PROPERTY_NAME_ATTRIBUTE.equals(attributeName)) {
+ return new BPELPropertyAliasPropertyNamePropertyDescriptor(MessagepropertiesConstants.PROPERTY_ALIAS_PROPERTY_NAME_ATTRIBUTE,MessagepropertiesConstants.PROPERTY_ALIAS_PROPERTY_NAME_ATTRIBUTE, (WSDLEditor)editor);
+ } else if (MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE.equals(attributeName) && ownerElement.hasAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE)) {
+ return new BPELPropertyAliasPartPropertyDescriptor(MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,ownerElement.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE),(WSDLEditor)editor);
+ } else if (MessagepropertiesConstants.QUERY_QUERYLANGUAGE_ATTRIBUTE.equals(attributeName)) {
+ return new BPELQueryLanguagePropertyDescriptor(MessagepropertiesConstants.QUERY_QUERYLANGUAGE_ATTRIBUTE,MessagepropertiesConstants.QUERY_QUERYLANGUAGE_ATTRIBUTE);
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPartnerLinkPropertyDescriptorProvider.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPartnerLinkPropertyDescriptorProvider.java
new file mode 100644
index 0000000..9945eef
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPartnerLinkPropertyDescriptorProvider.java
@@ -0,0 +1,22 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import org.eclipse.bpel.model.partnerlinktype.util.PartnerlinktypeConstants;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+import org.eclipse.wst.wsdl.ui.internal.properties.section.IPropertyDescriptorProvider;
+import org.eclipse.wst.wsdl.util.WSDLConstants;
+import org.w3c.dom.Element;
+
+public class BPELPartnerLinkPropertyDescriptorProvider implements IPropertyDescriptorProvider{
+
+ public IPropertyDescriptor getPropertyDescriptor(final IEditorPart editor, Element ownerElement, String attributeNamespace, String attributeName) {
+ if (PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE.equals(attributeName)) {
+ return new WSDLComponentSelectionDialogPropertyDescriptor(PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE,PartnerlinktypeConstants.PORT_TYPE_ATTRIBUTE,(WSDLEditor)editor,WSDLConstants.PORT_TYPE, ownerElement);
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPartPropertyDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPartPropertyDescriptor.java
new file mode 100644
index 0000000..b7b0287
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPartPropertyDescriptor.java
@@ -0,0 +1,85 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+
+public class BPELPropertyAliasPartPropertyDescriptor extends PropertyDescriptor {
+ WSDLEditor editor;
+ String message;
+ List parts = new ArrayList();
+
+ public BPELPropertyAliasPartPropertyDescriptor(Object id, String displayName, String message,WSDLEditor editor) {
+ super(id, displayName);
+ this.editor = editor;
+ this.message = message;
+ }
+
+ public CellEditor createPropertyEditor(Composite parent) {
+ QName messageQName = createQName(((WSDLEditor)editor).getDefinition(), message);
+ Message newMessage = (messageQName != null) ? (Message) ((WSDLEditor)editor).getDefinition().getMessage(messageQName) : null;
+ parts.addAll(newMessage.getParts().keySet());
+ CellEditor editor = new ComboBoxCellEditor(parent, (String[])parts.toArray(new String[]{}),SWT.READ_ONLY){
+
+ protected Object doGetValue() {
+ Integer i = (Integer)super.doGetValue();
+ return parts.get(i.intValue());
+ }
+
+ protected void doSetValue(Object value) {
+ if (parts.contains(value)) {
+ super.doSetValue(new Integer(parts.indexOf(value)));
+ } else {
+ super.doSetValue(new Integer(0));
+ }
+ }
+
+ };
+ if (getValidator() != null)
+ editor.setValidator(getValidator());
+ return editor;
+ }
+
+ public ILabelProvider getLabelProvider() {
+ return new LabelProvider(){
+
+ public String getText(Object element) {
+ // TODO Auto-generated method stub
+ return (String)parts.get(((Integer)element).intValue());
+ }
+
+ };
+ }
+
+// Some subclasses use this method
+ protected QName createQName(Definition definition, String prefixedName)
+ {
+ QName qname = null;
+ if (prefixedName != null)
+ {
+ int index = prefixedName.indexOf(":");
+ String prefix = (index == -1) ? "" : prefixedName.substring(0, index);
+ String namespace = definition.getNamespace(prefix);
+ if (namespace != null)
+ {
+ String localPart = prefixedName.substring(index + 1);
+ qname = new QName(namespace, localPart);
+ }
+ }
+ return qname;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPropertyNamePropertyDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPropertyNamePropertyDescriptor.java
new file mode 100644
index 0000000..a9a7f56
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELPropertyAliasPropertyNamePropertyDescriptor.java
@@ -0,0 +1,98 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.bpel.model.messageproperties.Property;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+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.WSDLEditor;
+
+public class BPELPropertyAliasPropertyNamePropertyDescriptor extends PropertyDescriptor{
+
+
+ WSDLEditor editor;
+ List properties = new ArrayList();
+
+ public BPELPropertyAliasPropertyNamePropertyDescriptor(Object id, String displayName, WSDLEditor editor) {
+ super(id, displayName);
+ this.editor = editor;
+ }
+
+ public CellEditor createPropertyEditor(Composite parent) {
+ Definition d = ((WSDLEditor)editor).getDefinition();
+ createPropertyObjects(properties,d.getExtensibilityElements(),null);
+
+ Iterator importsIt = getWSDLFileImports(d.getEImports()).iterator();
+ while (importsIt.hasNext()) {
+ Import importItem = (Import) importsIt.next();
+ Definition importDefinition = importItem.getEDefinition();
+ createPropertyObjects(properties, importDefinition.getExtensibilityElements(),d.getPrefix(importItem.getNamespaceURI()));
+ }
+ CellEditor editor = new ComboBoxCellEditor(parent, (String[])properties.toArray(new String[]{}),SWT.READ_ONLY){
+
+ protected Object doGetValue() {
+ Integer i = (Integer)super.doGetValue();
+ return properties.get(i.intValue());
+ }
+
+ protected void doSetValue(Object value) {
+ if (properties.contains(value)) {
+ super.doSetValue(new Integer(properties.indexOf(value)));
+ } else {
+ super.doSetValue(new Integer(0));
+ }
+ }
+
+ };
+ if (getValidator() != null)
+ editor.setValidator(getValidator());
+ return editor;
+ }
+
+ public ILabelProvider getLabelProvider() {
+ return new LabelProvider(){
+
+ public String getText(Object element) {
+ // TODO Auto-generated method stub
+ return (String)properties.get(((Integer)element).intValue());
+ }
+
+ };
+ }
+
+ private void createPropertyObjects(List components, List extensibilityElements, String prefix){
+ Iterator i = extensibilityElements.iterator();
+ while (i.hasNext()) {
+ Object ee = i.next();
+ if (ee instanceof Property){
+ components.add(prefix != null ? prefix+":"+((Property)ee).getName() : ((Property)ee).getName());
+ }
+ }
+ }
+
+ private 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/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELQueryLanguagePropertyDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELQueryLanguagePropertyDescriptor.java
new file mode 100644
index 0000000..99a54db
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/BPELQueryLanguagePropertyDescriptor.java
@@ -0,0 +1,52 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.ui.extensions.BPELUIRegistry;
+import org.eclipse.bpel.ui.extensions.ExpressionEditorDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class BPELQueryLanguagePropertyDescriptor extends PropertyDescriptor {
+ List languages = new ArrayList();
+ List uris = new ArrayList();
+
+ public BPELQueryLanguagePropertyDescriptor(Object id, String displayName) {
+ super(id, displayName);
+ ExpressionEditorDescriptor[] descriptors = BPELUIRegistry.getInstance().getExpressionEditorDescriptors();
+ for (int i = 0 ; i < descriptors.length; i++){
+ languages.add(descriptors[i].getLabel());
+ uris.add(descriptors[i].getExpressionLanguage());
+ }
+ }
+
+ public CellEditor createPropertyEditor(Composite parent) {
+
+
+ CellEditor editor = new ComboBoxCellEditor(parent, (String[])languages.toArray(new String[]{}),SWT.READ_ONLY){
+
+ protected Object doGetValue() {
+ Integer i = (Integer)super.doGetValue();
+ return uris.get(i.intValue());
+ }
+
+ protected void doSetValue(Object value) {
+ if (uris.contains(value)) {
+ super.doSetValue(new Integer(uris.indexOf(value)));
+ } else {
+ super.doSetValue(new Integer(0));
+ }
+ }
+
+ };
+ if (getValidator() != null)
+ editor.setValidator(getValidator());
+ return editor;
+ }
+
+
+}
diff --git a/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/WSDLComponentSelectionDialogPropertyDescriptor.java b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/WSDLComponentSelectionDialogPropertyDescriptor.java
new file mode 100644
index 0000000..2f35aca
--- /dev/null
+++ b/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wsdl/extensions/properties/WSDLComponentSelectionDialogPropertyDescriptor.java
@@ -0,0 +1,124 @@
+package org.eclipse.bpel.ui.wsdl.extensions.properties;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.bpel.ui.Messages;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.wst.wsdl.ui.internal.WSDLEditor;
+import org.eclipse.wst.wsdl.ui.internal.dialogs.types.WSDLComponentSelectionDialog;
+import org.eclipse.wst.wsdl.ui.internal.dialogs.types.WSDLComponentSelectionProvider;
+import org.eclipse.wst.wsdl.ui.internal.util.WSDLEditorUtil;
+import org.eclipse.wst.wsdl.util.WSDLConstants;
+import org.w3c.dom.Element;
+
+public class WSDLComponentSelectionDialogPropertyDescriptor extends PropertyDescriptor {
+
+ private int kind;
+ private WSDLEditor editor;
+ private Element element;
+ public WSDLComponentSelectionDialogPropertyDescriptor(Object id, String displayName, WSDLEditor editor, int kind, Element element) {
+ super(id, displayName);
+ this.kind = kind;
+ this.editor = editor;
+ this.element = element;
+ }
+
+ public static CellEditor createCellEditor (Composite parent, final WSDLEditor editor, final int kind, final Element element) {
+ CellEditor celleditor = new DialogCellEditor(parent){
+
+ protected Object openDialogBox(Control cellEditorWindow) {
+ WSDLComponentSelectionProvider provider = new WSDLComponentSelectionProvider(((IFileEditorInput) editor.getEditorPart().getEditorInput()).getFile(), editor.getDefinition(), kind);
+ WSDLComponentSelectionDialog dialog = new WSDLComponentSelectionDialog(cellEditorWindow.getShell(), Messages.BPELWSDLComponentSelectionDialog, provider){
+
+ protected TreeViewer createTreeViewer(Composite comp, String title) {
+ final TreeViewer viewer = super.createTreeViewer(comp, title);
+ viewer.addDoubleClickListener(new IDoubleClickListener(){
+
+ public void doubleClick(DoubleClickEvent event) {
+ // TODO Auto-generated method stub
+ if (viewer.getSelection() instanceof IStructuredSelection && !((IStructuredSelection)viewer.getSelection()).isEmpty())
+ okPressed();
+ }
+
+ });
+ return viewer;
+ }
+
+ };
+ provider.setDialog(dialog);
+ dialog.setBlockOnOpen(true);
+ dialog.create();
+
+ if (dialog.open() == Window.OK){
+ Display.getCurrent().asyncExec(new Runnable(){
+
+ public void run() {
+ if (element == null)
+ return;
+ if (kind == WSDLConstants.MESSAGE){
+ element.removeAttribute("element");
+ element.removeAttribute("type");
+ } else if (kind == WSDLEditorUtil.ELEMENT) {
+ element.removeAttribute("messageType");
+ element.removeAttribute("part");
+ element.removeAttribute("type");
+ } else if (kind == WSDLEditorUtil.TYPE) {
+ element.removeAttribute("messageType");
+ element.removeAttribute("part");
+ element.removeAttribute("element");
+ }
+ }
+
+ });
+
+
+ String name = (String) dialog.getSelection().getAttributeInfo("name");
+ List prefixes = getPrefixes(editor.getDefinition(), dialog.getSelection().getTargetNamespace());
+ if (prefixes.size() > 0) {
+ name = prefixes.get(0) + ":" + name;
+ }
+ return name;
+ }
+ return doGetValue();
+ }
+
+ };
+ return celleditor;
+ }
+
+ public CellEditor createPropertyEditor(Composite parent) {
+ CellEditor celleditor = createCellEditor(parent,editor,kind, element);
+ if (getValidator() != null)
+ celleditor.setValidator(getValidator());
+ return celleditor;
+
+ }
+
+ private static 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;
+ }
+}