Author: bbrodt
Date: 2010-10-12 15:44:34 -0400 (Tue, 12 Oct 2010)
New Revision: 25761
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/DefinitionAdapter.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/PropertyAliasAdapter.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/MessageSelectorTypeDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDElementSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDTypeSelectorDialog.java
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyAliasImpl.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyImpl.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/QueryImpl.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/util/MessagepropertiesConstants.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIMessagePropertiesAdapterFactory.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIWSDLAdapterFactory.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditPropertyAliasDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/ListAndViewDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/CorrSetImplSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BrowseUtil.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/WSDLImportHelper.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/PropertyAlias.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/messages.properties
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Factory.java
Log:
https://jira.jboss.org/browse/JBIDE-7107
Complete rewrite of property and propertyAlias definition dialogs and enhancements/bug
fixes in their corresponding model objects
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyAliasImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyAliasImpl.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyAliasImpl.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -38,6 +38,8 @@
import org.eclipse.wst.wsdl.Part;
import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl;
import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
import org.eclipse.xsd.XSDTypeDefinition;
import org.w3c.dom.Element;
@@ -681,16 +683,20 @@
.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_PROPERTY_NAME_ATTRIBUTE));
// resolve the qname to a property
// TODO could this reference an imported property?
- for (Iterator i = definition.getExtensibilityElements()
- .iterator(); i.hasNext();) {
- ExtensibilityElement extensibilityElement = (ExtensibilityElement) i
- .next();
- if (extensibilityElement instanceof Property) {
- Property property = (Property) extensibilityElement;
- if (property.getQName().equals(qname)
- && property != getPropertyName()) {
- setPropertyName(property);
- break;
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // check for null QName
+ if (qname!=null) {
+ for (Iterator i = definition.getExtensibilityElements()
+ .iterator(); i.hasNext();) {
+ ExtensibilityElement extensibilityElement = (ExtensibilityElement) i
+ .next();
+ if (extensibilityElement instanceof Property) {
+ Property property = (Property) extensibilityElement;
+ if (property.getQName().equals(qname)
+ && property != getPropertyName()) {
+ setPropertyName(property);
+ break;
+ }
}
}
}
@@ -704,11 +710,11 @@
definition,
element
.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE));
- Message newMessage = (messageQName != null) ? (Message) definition
- .getMessage(messageQName)
- : null;
- if (newMessage != null && newMessage != getMessageType())
- setMessageType(newMessage);
+ if (messageQName!=null) {
+ Message newMessage = (Message) definition.getMessage(messageQName);
+ if (newMessage != null && newMessage != getMessageType())
+ setMessageType(newMessage);
+ }
}
} else {
setMessageType(null);
@@ -716,17 +722,31 @@
if (element != null
&& element
+ .hasAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE)) {
+ if (definition != null) {
+ String part =
element.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE);
+ if (part != null && part != getPart())
+ setPart(part);
+ }
+ } else {
+ setType(null);
+ }
+
+ if (element != null
+ && element
.hasAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE)) {
if (definition != null) {
QName typeQName = createQName(
definition,
element
.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE));
- XSDTypeDefinition newType = ((DefinitionImpl) definition)
- .resolveTypeDefinition(typeQName.getNamespaceURI(),
- typeQName.getLocalPart());
- if (newType != null && newType != getType())
- setType(newType);
+ if (typeQName!=null) {
+ XSDTypeDefinition newType = ((DefinitionImpl) definition)
+ .resolveTypeDefinition(typeQName.getNamespaceURI(),
+ typeQName.getLocalPart());
+ if (newType != null && newType != getType())
+ setType(newType);
+ }
}
} else {
setType(null);
@@ -740,13 +760,14 @@
definition,
element
.getAttribute(MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE));
- XSDElementDeclaration newElement = ((DefinitionImpl) definition)
- .resolveElementDeclaration(elementQName
- .getNamespaceURI(), elementQName.getLocalPart());
- if (newElement != null && newElement != getXSDElement()) {
- setXSDElement(newElement);
+ if (elementQName!=null) {
+ XSDElementDeclaration newElement = ((DefinitionImpl) definition)
+ .resolveElementDeclaration(elementQName
+ .getNamespaceURI(), elementQName.getLocalPart());
+ if (newElement != null && newElement != getXSDElement()) {
+ setXSDElement(newElement);
+ }
}
-
}
} else {
setXSDElement(null);
@@ -792,27 +813,102 @@
+ qname.getLocalPart());
}
+ // handle "messageType" and "part" addressing
if (eAttribute == null
|| eAttribute == MessagepropertiesPackage.eINSTANCE
.getPropertyAlias_MessageType()) {
Message message = (Message) getMessageType();
QName qname = (message == null) ? null : message.getQName();
- if (qname != null)
+ if (qname != null) {
niceSetAttributeURIValue(
theElement,
MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE,
qname.getNamespaceURI() + "#"
+ qname.getLocalPart());
+
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // make sure the "element" and "type" attributes get removed
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,
+ null);
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,
+ null);
+ }
}
if (eAttribute == null
|| eAttribute == MessagepropertiesPackage.eINSTANCE
- .getPropertyAlias_Part())
- niceSetAttribute(
- theElement,
- MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,
- getPart());
+ .getPropertyAlias_Part()) {
+
+ if (getPart()!=null) {
+ niceSetAttribute(
+ theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,
+ getPart());
+
+ // make sure the "element" and "type" attributes get removed
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,
+ null);
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,
+ null);
+ }
+ }
+
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // added type and element handling
+ // handle "type" addressing
+ if (eAttribute == null
+ || eAttribute == MessagepropertiesPackage.eINSTANCE
+ .getPropertyAlias_Type()) {
+ Object type = getType();
+ if (type instanceof XSDTypeDefinition) {
+ XSDTypeDefinition xsdType = (XSDTypeDefinition) type;
+ String uri = xsdType.getURI();
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,
+ uri);
+
+ // make sure the "element", "messageType" and "part"
attributes get removed
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,
+ null);
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE,
+ null);
+ niceSetAttribute(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,
+ null);
+ }
+ }
+
+ // handle "element" addressing
+ if (eAttribute == null
+ || eAttribute == MessagepropertiesPackage.eINSTANCE
+ .getPropertyAlias_XSDElement()) {
+ Object elem = getXSDElement();
+ if (elem instanceof XSDElementDeclaration) {
+ XSDElementDeclaration xsdElement = (XSDElementDeclaration) elem;
+ String uri = xsdElement.getURI();
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_XSD_ELEMENT_ATTRIBUTE,
+ uri);
+
+ // make sure the "type", "messageType" and "part"
attributes get removed
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_TYPE_ATTRIBUTE,
+ null);
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE,
+ null);
+ niceSetAttribute(theElement,
+ MessagepropertiesConstants.PROPERTY_ALIAS_PART_ATTRIBUTE,
+ null);
+ }
+ }
}
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyImpl.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/PropertyImpl.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -32,6 +32,7 @@
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl;
+import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDTypeDefinition;
import org.w3c.dom.Element;
@@ -353,10 +354,11 @@
@Override
public void reconcileReferences(boolean deep) {
+ Definition definition = getEnclosingDefinition();
+ Element element = getElement();
if (element != null
&& element
.hasAttribute(MessagepropertiesConstants.PROPERTY_TYPE_ATTRIBUTE)) {
- Definition definition = getEnclosingDefinition();
QName qname = createQName(
definition,
element
@@ -370,6 +372,24 @@
}
}
}
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // added element handling
+ if (element != null
+ && element
+ .hasAttribute(MessagepropertiesConstants.PROPERTY_XSD_ELEMENT_ATTRIBUTE)) {
+ QName qname = createQName(
+ definition,
+ element
+ .getAttribute(MessagepropertiesConstants.PROPERTY_XSD_ELEMENT_ATTRIBUTE));
+ if (qname != null) {
+ XSDElementDeclaration xsdElement = ((DefinitionImpl) definition)
+ .resolveElementDeclaration(qname.getNamespaceURI(), qname
+ .getLocalPart());
+ if (xsdElement != null && getType() != xsdElement) {
+ setType(xsdElement);
+ }
+ }
+ }
super.reconcileReferences(deep);
}
@@ -392,21 +412,40 @@
if (theElement != null) {
if (eAttribute == null
|| eAttribute == MessagepropertiesPackage.eINSTANCE
- .getProperty_Name())
+ .getProperty_Name()) {
niceSetAttribute(theElement,
MessagepropertiesConstants.PROPERTY_NAME_ATTRIBUTE,
getName());
+ }
+
if (eAttribute == null
|| eAttribute == MessagepropertiesPackage.eINSTANCE
.getProperty_Type()) {
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // this is unfortunate, but the Property model object only has a "type"
which serves both
+ // for "type" and "element" addressing - we just have to figure
out which is which from the
+ // stored object type before serializing to WSDL.
Object type = getType();
if (type instanceof XSDTypeDefinition) {
XSDTypeDefinition xsdType = (XSDTypeDefinition) type;
String uri = xsdType.getURI();
niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_XSD_ELEMENT_ATTRIBUTE,
+ null);
+ niceSetAttributeURIValue(theElement,
MessagepropertiesConstants.PROPERTY_TYPE_ATTRIBUTE,
uri);
}
+ else if (type instanceof XSDElementDeclaration) {
+ XSDElementDeclaration xsdElement = (XSDElementDeclaration) type;
+ String uri = xsdElement.getURI();
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_XSD_ELEMENT_ATTRIBUTE,
+ uri);
+ niceSetAttributeURIValue(theElement,
+ MessagepropertiesConstants.PROPERTY_TYPE_ATTRIBUTE,
+ null);
+ }
}
}
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/QueryImpl.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/QueryImpl.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/impl/QueryImpl.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -18,6 +18,7 @@
import javax.xml.namespace.QName;
+import org.eclipse.bpel.model.Expression;
import org.eclipse.bpel.model.messageproperties.MessagepropertiesPackage;
import org.eclipse.bpel.model.messageproperties.Query;
import org.eclipse.bpel.model.messageproperties.util.MessagepropertiesConstants;
@@ -39,6 +40,10 @@
/**
* <!-- begin-user-doc -->
* An implementation of the model object
'<em><b>Query</b></em>'.
+ * CAUTION: We want to reuse the XPath editor for query expression, but unfortunately it
requires that
+ * the model object implements the Expression interface (only used in the BPEL model
currently).
+ * I have added the Expression methods by hand. These have essentially the same
functionality as the Query
+ * interface, only the names are changed. See
https://jira.jboss.org/browse/JBIDE-7107
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
@@ -50,7 +55,7 @@
*
* @generated
*/
-public class QueryImpl extends ExtensibilityElementImpl implements Query {
+public class QueryImpl extends ExtensibilityElementImpl implements Query, Expression {
/**
* The default value of the '{@link #getQueryLanguage() <em>Query
Language</em>}' attribute.
* <!-- begin-user-doc -->
@@ -378,4 +383,44 @@
return elementType;
}
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // the Expression interface methods
+ public Object getBody() {
+ return getValue();
+ }
+
+ public void setBody(Object value) {
+ setValue(value.toString());
+ }
+
+ public String getExpressionLanguage() {
+ return getQueryLanguage();
+ }
+
+ public void setExpressionLanguage(String value) {
+ setQueryLanguage(value);
+ }
+
+ public void unsetExpressionLanguage() {
+ setQueryLanguage(null);
+ }
+
+ public boolean isSetExpressionLanguage() {
+ return getQueryLanguage()!=null;
+ }
+
+ public Boolean getOpaque() {
+ return null;
+ }
+
+ public void setOpaque(Boolean value) {
+ }
+
+ public void unsetOpaque() {
+ }
+
+ public boolean isSetOpaque() {
+ return false;
+ }
+
} //QueryImpl
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/util/MessagepropertiesConstants.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/util/MessagepropertiesConstants.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/messageproperties/util/MessagepropertiesConstants.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -53,6 +53,9 @@
public static final String PROPERTY_NAME_ATTRIBUTE = "name";
public static final String PROPERTY_TYPE_ATTRIBUTE = "type";
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // added to allow "element" addressing for <property> and
<propertyAlias>
+ public static final String PROPERTY_XSD_ELEMENT_ATTRIBUTE = "element";
public static final String PROPERTY_ALIAS_PROPERTY_NAME_ATTRIBUTE =
"propertyName";
public static final String PROPERTY_ALIAS_MESSAGE_TYPE_ATTRIBUTE =
"messageType";
public static final String PROPERTY_ALIAS_PART_ATTRIBUTE = "part";
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -1287,7 +1287,7 @@
@Override
public boolean isDirty() {
- return this.fTextEditor.isDirty();
+ return this.fTextEditor.isDirty() || this.editDomain.getCommandStack().isDirty();
}
@Override
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -315,7 +315,17 @@
public static String EditMessagePropertyDialog_3;
public static String EditMessagePropertyDialog_4;
public static String EditMessagePropertyDialog_9;
+
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ public static String EditMessagePropertyDialog_11;
+ public static String EditMessagePropertyDialog_12;
+ public static String EditMessagePropertyDialog_13;
+ public static String EditMessagePropertyDialog_15;
+ public static String EditMessagePropertyDialog_16;
+
public static String EditMessagePropertyDialog_Type_1;
+ public static String EditMessagePropertyDialog_Element_1;
+ public static String EditMessagePropertyDialog_Message_1;
public static String EditPropertyAliasDialog_10;
public static String EditPropertyAliasDialog_3;
public static String EditPropertyAliasDialog_4;
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIMessagePropertiesAdapterFactory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIMessagePropertiesAdapterFactory.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIMessagePropertiesAdapterFactory.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -57,6 +57,16 @@
public Adapter createPropertyAdapter() {
return provider.getAdapter( PropertyAdapter.class );
}
+
+ /**
+ * @see
org.eclipse.bpel.model.messageproperties.util.MessagepropertiesAdapterFactory#createPropertyAdapter()
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * This adds the INamespace adapter to PropertyAlias objects (required for the XPath
expression editor)
+ */
+ @Override
+ public Adapter createPropertyAliasAdapter() {
+ return provider.getAdapter( PropertyAliasAdapter.class );
+ }
/**
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIWSDLAdapterFactory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIWSDLAdapterFactory.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/BPELUIWSDLAdapterFactory.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -60,6 +60,16 @@
}
/**
+ * @see org.eclipse.wst.wsdl.internal.util.WSDLAdapterFactory#createDefinitionAdapter()
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * This adds the INamespace adapter to Definition objects (required for the XPath
expression editor)
+ */
+ @Override
+ public Adapter createDefinitionAdapter() {
+ return provider.getAdapter( DefinitionAdapter.class );
+ }
+
+ /**
* @see org.eclipse.wst.wsdl.internal.util.WSDLAdapterFactory#createMessageAdapter()
*/
@Override
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/DefinitionAdapter.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/DefinitionAdapter.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/DefinitionAdapter.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.eclipse.bpel.ui.adapters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.model.adapters.BasicEObjectaAdapter;
+import org.eclipse.bpel.model.adapters.INamespaceMap;
+import org.eclipse.wst.wsdl.Definition;
+
+/*
+ * This adds the INamespace adapter to Definition objects (required for the XPath
expression editor)
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
+public class DefinitionAdapter extends BasicEObjectaAdapter implements
INamespaceMap<String, String> {
+
+ /**
+ *
+ * @param key
+ * the namespace to get the reverse mapping for
+ * @return The reverse mapping of the Namespace to namespace prefixes.
+ * @see org.eclipse.bpel.model.adapters.INamespaceMap#getReverse(java.lang.Object)
+ */
+
+ public List<String> getReverse(String key) {
+ List<String> list = new ArrayList<String>(1);
+ list.add( ((Definition)getTarget()).getPrefix(key) );
+ return list;
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/PropertyAliasAdapter.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/PropertyAliasAdapter.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/adapters/PropertyAliasAdapter.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.eclipse.bpel.ui.adapters;
+
+import org.eclipse.bpel.model.adapters.BasicEObjectaAdapter;
+
+/*
+ * This adds the INamespace adapter to PropertyAlias objects (required for the XPath
expression editor)
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
+public class PropertyAliasAdapter extends BasicEObjectaAdapter {
+
+}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.bpel.ui.dialogs;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -17,6 +19,9 @@
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.commands.AddImportCommand;
import org.eclipse.bpel.ui.details.providers.ModelTreeLabelProvider;
+import org.eclipse.bpel.ui.details.tree.PartTreeNode;
+import org.eclipse.bpel.ui.details.tree.TreeNode;
+import org.eclipse.bpel.ui.details.tree.XSDElementDeclarationTreeNode;
import org.eclipse.bpel.ui.util.BPELUtil;
import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.core.resources.IFile;
@@ -34,6 +39,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -45,14 +51,22 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.dialogs.SelectionStatusDialog;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.Part;
+import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDNamedComponent;
import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
import org.eclipse.xsd.util.XSDConstants;
/**
* @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
* @date Jul 18, 2006
*
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * Enhanced to support element selection from the "lower" tree viewer
*/
public class BrowseSelectorDialog extends ListAndViewDialog {
@@ -72,6 +86,7 @@
protected IStructuredContentProvider resourceContentProvider = null;
protected ITreeContentProvider treeContentProvider = null;
+ protected Group checkButtonGroup;
protected Tree fTree;
protected TreeViewer fTreeViewer;
@@ -178,6 +193,28 @@
}
+ /**
+ * @see ListAndViewDialog#computeResult()
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * Added support for returning two results
+ */
+ @Override
+ protected void computeResult() {
+
+ List result = new ArrayList();
+ Object sel1[] = getSelectedElements();
+ TreeItem sel2[] = fTree.getSelection();
+ for (int i=0; i<sel1.length; ++i)
+ result.add(sel1[i]);
+ for (int i=0; i<sel2.length; ++i) {
+ Object data = sel2[i].getData();
+ if (data instanceof TreeNode)
+ data = ((TreeNode)data).getModelObject();
+ result.add(data);
+ }
+ setResult(result);
+ }
+
/**
* Ensure that the prefix mapping exists for the given namespace
* in the BPEL source.
@@ -416,21 +453,24 @@
}
protected void createBrowseFilterGroup(Composite parent) {
- Group group = new Group(parent,SWT.SHADOW_ETCHED_IN);
- group.setText( Messages.BrowseSelectorDialog_4 );
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // need to support enabling/disabling of this button group
+ // see BrowseUtils#browseForMessageType() for example
+ checkButtonGroup = new Group(parent,SWT.SHADOW_ETCHED_IN);
+ checkButtonGroup.setText( Messages.BrowseSelectorDialog_4 );
GridLayout layout = new GridLayout();
layout.makeColumnsEqualWidth = true;
layout.numColumns = 3;
- group.setLayout(layout);
+ checkButtonGroup.setLayout(layout);
GridData data = new GridData();
data.grabExcessVerticalSpace = false;
data.grabExcessHorizontalSpace = true;
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
- group.setLayoutData(data);
+ checkButtonGroup.setLayoutData(data);
- createBrowseFilterGroupButtons ( group );
+ createBrowseFilterGroupButtons ( checkButtonGroup );
}
@@ -446,6 +486,16 @@
protected Object createLowerView(Composite parent) {
// Tree viewer for variable structure ...
fTree = new Tree(parent, SWT.BORDER );
+ fTree.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent arg0) {
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // update "OK" button enablement
+ refresh();
+ }
+
+ });
fTreeViewer = new TreeViewer(fTree);
fTreeViewer.setContentProvider( treeContentProvider );
@@ -515,7 +565,9 @@
} else {
handleNonEmptyList();
}
- }
+ }
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ updateOkState();
}
/**
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -32,9 +32,11 @@
import org.eclipse.bpel.ui.util.WSDLImportHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -43,12 +45,15 @@
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
@@ -60,19 +65,30 @@
import org.eclipse.wst.wsdl.Message;
import org.eclipse.wst.wsdl.internal.impl.DefinitionImpl;
import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDTypeDefinition;
import org.eclipse.xsd.util.XSDConstants;
/**
* Dialog for creating or editing message properties.
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * This has been completely reworked to support Properties of both XSD Simple Types and
+ * XSD Elements (previous version only supported Simple Types).
*/
public class EditMessagePropertyDialog extends Dialog {
+ protected static final int BID_USE_TYPE = IDialogConstants.CLIENT_ID + 30;
+ protected static final int BID_USE_ELEMENT = IDialogConstants.CLIENT_ID + 31;
// True if a new property is being created (as opposed to an existing being edited)
protected boolean isNew;
+ // True if the given propery will be replaced
+ protected boolean isReplacement;
protected Property property;
protected Object propertyType;
+ protected XSDTypeDefinition xsdTypeDefinition;
+ protected XSDElementDeclaration xsdElementDeclaration;
protected IFile targetFile;
protected URI propertyTypeFileURI;
protected BPELEditor bpelEditor;
@@ -81,7 +97,12 @@
// widgets
protected Text propertyNameText;
- protected Label typeNameText;
+ protected Label typeOrElementNameLabel;
+ protected Label typeOrElementNameText;
+ private Button typeRadio;
+ private Button elementRadio;
+ private int typeOrElement;
+
protected Button browseTypeButton;
protected Button newAliasButton;
protected Button editAliasButton;
@@ -101,27 +122,41 @@
@Override
public String getProperty() { return "aliasMsgType"; } //$NON-NLS-1$
@Override
- public int getInitialWeight() { return 30; }
+ public int getInitialWeight() { return 50; }
ModelLabelProvider labelProvider = new ModelLabelProvider();
public String getText(Object element) {
- return labelProvider.getText(((PropertyAlias)element).getMessageType());
+ PropertyAlias alias = (PropertyAlias)element;
+ String part = alias.getPart();
+ Object message = ((PropertyAlias)element).getMessageType();
+ String s = "";
+ if (message!=null) {
+ s = labelProvider.getText(message) + (part==null? "" : ("."+part)
);
+ if (part!=null && alias.getQuery() != null) {
+ String query = alias.getQuery().getValue();
+ if (query != null && !"".equals(query)) { //$NON-NLS-1$
+ s += NLS.bind(Messages.EditMessagePropertyDialog_4, (new Object[] { query }));
+ }
+ }
+ }
+ return s;
}
}
- public class MessagePartColumn extends ColumnTableProvider.Column implements
ILabelProvider {
+ public class XSDElementColumn extends ColumnTableProvider.Column implements
ILabelProvider {
@Override
- public String getHeaderText() { return Messages.EditMessagePropertyDialog_2; }
+ public String getHeaderText() { return Messages.EditMessagePropertyDialog_15; }
@Override
- public String getProperty() { return "aliasMsgPart"; } //$NON-NLS-1$
+ public String getProperty() { return "aliasElement"; } //$NON-NLS-1$
@Override
- public int getInitialWeight() { return 70; }
+ public int getInitialWeight() { return 25; }
public String getText(Object element) {
PropertyAlias alias = (PropertyAlias)element;
- String s = (alias.getPart()==null?
Messages.EditMessagePropertyDialog_3:alias.getPart());
- if (alias.getQuery() != null) {
+ XSDNamedComponent xsdElem = (XSDNamedComponent)alias.getXSDElement();
+ String s = (xsdElem==null? "":xsdElem.getName());
+ if (xsdElem!=null && alias.getQuery() != null) {
String query = alias.getQuery().getValue();
if (query != null && !"".equals(query)) { //$NON-NLS-1$
s += NLS.bind(Messages.EditMessagePropertyDialog_4, (new Object[] { query }));
@@ -131,6 +166,28 @@
}
}
+ public class XSDTypeColumn extends ColumnTableProvider.Column implements ILabelProvider
{
+ @Override
+ public String getHeaderText() { return Messages.EditMessagePropertyDialog_16; }
+ @Override
+ public String getProperty() { return "aliasType"; } //$NON-NLS-1$
+ @Override
+ public int getInitialWeight() { return 25; }
+
+ public String getText(Object element) {
+ PropertyAlias alias = (PropertyAlias)element;
+ XSDNamedComponent xsdElem = (XSDNamedComponent)alias.getType();
+ String s = (xsdElem==null? "":xsdElem.getName());
+ if (xsdElem!=null && alias.getQuery() != null) {
+ String query = alias.getQuery().getValue();
+ if (query != null && !"".equals(query)) { //$NON-NLS-1$
+ s += NLS.bind(Messages.EditMessagePropertyDialog_4, (new Object[] { query }));
+ }
+ }
+ return s;
+ }
+ }
+
public EditMessagePropertyDialog(Shell parentShell, Property property, String
newPropertyName, BPELEditor bpelEditor, TabbedPropertySheetWidgetFactory wf) {
super(parentShell);
@@ -139,15 +196,29 @@
this.property = property;
this.wf = wf;
isNew = (property == null);
- if (isNew) {
+ isReplacement = (property!=null && property.eIsProxy());
+ if (isReplacement)
+ newPropertyName = property.getName();
+ if (isNew || isReplacement) {
targetFile = bpelEditor.getEditModelClient().getArtifactsResourceInfo().getFile();
this.property = MessagepropertiesFactory.eINSTANCE.createProperty();
this.property.setName(newPropertyName);
+ typeOrElement = BID_USE_TYPE;
} else {
Object type = property.getType();
if (type instanceof XSDTypeDefinition) {
this.propertyType = type;
+ this.xsdTypeDefinition = (XSDTypeDefinition)type;
+ typeOrElement = BID_USE_TYPE;
}
+ else if (type instanceof XSDElementDeclaration) {
+ this.propertyType = type;
+ this.xsdElementDeclaration = (XSDElementDeclaration)type;
+ typeOrElement = BID_USE_ELEMENT;
+ }
+ else {
+ typeOrElement = BID_USE_TYPE;
+ }
}
}
@@ -172,12 +243,6 @@
};
// create widgets
- Label topLabel = new Label(composite, SWT.NONE);
- if (isNew) {
- topLabel.setText(Messages.EditMessagePropertyDialog_9);
- } else {
- topLabel.setText(Messages.EditMessagePropertyDialog_10);
- }
Label propertyNameLabel = new Label(composite, SWT.NONE);
propertyNameLabel.setText(Messages.EditMessagePropertyDialog_14);
propertyNameText = new Text(composite, SWT.BORDER);
@@ -187,10 +252,24 @@
}
// TODO: if the property name changes we need to update the aliases as well
propertyNameText.addListener(SWT.Modify, enablementListener);
+ if (isReplacement)
+ propertyNameText.setEnabled(false);
+
+ String groupText = Messages.EditMessagePropertyDialog_10;
+ // Property must have either XSD Type or XSD Element: create radio button group
+ Group typeOrElementRadioGroup = new Group(composite,SWT.SHADOW_ETCHED_IN);
+ typeOrElementRadioGroup.setText(groupText);
+ layout = new GridLayout();
+ layout.makeColumnsEqualWidth = false;
+ layout.numColumns = 1;
+ typeOrElementRadioGroup.setLayout(layout);
+ typeRadio =
createRadioButton(typeOrElementRadioGroup,Messages.EditMessagePropertyDialog_11,
BID_USE_TYPE, typeOrElement == BID_USE_TYPE);
+ elementRadio =
createRadioButton(typeOrElementRadioGroup,Messages.EditMessagePropertyDialog_12,
BID_USE_ELEMENT, typeOrElement == BID_USE_ELEMENT);
+ typeRadio.addListener(SWT.Selection, enablementListener);
+ elementRadio.addListener(SWT.Selection, enablementListener);
- Label typeNameLabel = new Label(composite, SWT.NONE);
- typeNameLabel.setText(Messages.EditMessagePropertyDialog_Type_1);
- typeNameText = new Label(composite, SWT.NONE);
+ typeOrElementNameLabel = new Label(composite, SWT.NONE);
+ typeOrElementNameText = new Label(composite, SWT.NONE);
browseTypeButton = new Button(composite, SWT.PUSH);
browseTypeButton.setText(Messages.EditMessagePropertyDialog_18);
browseTypeButton.addListener(SWT.Selection, new Listener() {
@@ -240,7 +319,8 @@
aliasesTable.setHeaderVisible(true);
aliasesTableProvider = new ColumnTableProvider();
aliasesTableProvider.add(new MessageTypeColumn());
- aliasesTableProvider.add(new MessagePartColumn());
+ aliasesTableProvider.add(new XSDElementColumn());
+ aliasesTableProvider.add(new XSDTypeColumn());
aliasesTableViewer = new TableViewer(aliasesTable);
aliasesTableProvider.createTableLayout(aliasesTable);
aliasesTableViewer.setLabelProvider(aliasesTableProvider);
@@ -273,26 +353,31 @@
updateTypeFileText();
// layout widgets
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- data.widthHint =
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- topLabel.setLayoutData(data);
-
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ data.horizontalSpan = 1;
propertyNameLabel.setLayoutData(data);
- data = new GridData(GridData.FILL_HORIZONTAL);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
propertyNameText.setLayoutData(data);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+// data.widthHint =
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+// topLabel.setLayoutData(data);
+ typeOrElementRadioGroup.setLayoutData(data);
data = new GridData(GridData.FILL_HORIZONTAL);
+ typeRadio.setLayoutData(data);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ elementRadio.setLayoutData(data);
+
+ data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 3;
separator.setLayoutData(data);
-
+ data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ typeOrElementNameLabel.setLayoutData(data);
data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- typeNameLabel.setLayoutData(data);
- data = new GridData(GridData.FILL_HORIZONTAL);
- typeNameText.setLayoutData(data);
+ typeOrElementNameText.setLayoutData(data);
data = new GridData(GridData.HORIZONTAL_ALIGN_END);
browseTypeButton.setLayoutData(data);
@@ -315,15 +400,69 @@
data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 3;
data.verticalSpan = 3;
- data.heightHint = 70;
+ data.heightHint = 200;
+ data.widthHint = 500;
aliasesTable.setLayoutData(data);
PlatformUI.getWorkbench().getHelpSystem().setHelp(
- parent, IHelpContextIds.PROPERTY_DIALOG);
+ parent, IHelpContextIds.PROPERTY_DIALOG);
+ composite.pack();
+
return composite;
}
+
+ protected Button createRadioButton(Composite parent, String label, int id, boolean
checked) {
+
+ Button button = new Button(parent,SWT.RADIO);
+ button.setText(label);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData(new Integer(id));
+ button.setSelection( checked );
+
+ button.addSelectionListener (new SelectionAdapter() {
+ @Override
+ public void widgetSelected (SelectionEvent event) {
+ Button b = (Button) event.widget;
+ int val = ((Integer) b.getData()).intValue();
+
+ buttonPressed(val, b.getSelection(), true );
+ }
+ });
+
+ return button;
+
+ }
+ /**
+ * Handle the check button and radio button callbacks.
+ *
+ * @param id
+ * @param checked
+ * @param refresh unless this is set, no refresh is done.
+ */
+
+ protected void buttonPressed(int id, boolean checked, boolean bRefresh) {
+
+ switch (id) {
+
+ case BID_USE_ELEMENT:
+ case BID_USE_TYPE:
+ if (!checked)
+ return;
+ typeOrElement = id;
+ break;
+
+ default :
+ break;
+ }
+
+
+ if (bRefresh) {
+ updateTypeWidgets();
+ }
+ }
+
protected void updatePropertyAliasTable() {
aliasesFilter.setProperty(property);
//aliasesTableViewer.setInput(definition);
@@ -331,19 +470,17 @@
}
protected void updateTypeFileText() {
- if (property != null || propertyType != null) {
- Object type = this.propertyType;
- if (type == null) {
- type = property.getType();
- }
- if (type instanceof XSDTypeDefinition) {
- XSDTypeDefinition typeDefinition = (XSDTypeDefinition) type;
- typeNameText.setText(typeDefinition.getName());
- } else if (type instanceof XSDElementDeclaration) {
- XSDElementDeclaration element = (XSDElementDeclaration) type;
- typeNameText.setText(element.getName());
- }
+ if (propertyType instanceof XSDTypeDefinition) {
+ xsdTypeDefinition = (XSDTypeDefinition) propertyType;
+ typeOrElementNameText.setText(xsdTypeDefinition.getName());
+ } else if (propertyType instanceof XSDElementDeclaration) {
+ xsdElementDeclaration = (XSDElementDeclaration) propertyType;
+ typeOrElementNameText.setText(xsdElementDeclaration.getName());
}
+ else
+ {
+ typeOrElementNameText.setText("");
+ }
}
@Override
@@ -391,7 +528,7 @@
protected boolean propertyNameExists(String name) {
if (!isNew && name.equals(property.getName())) return false;
- return getExistingPropertyNames().contains(name);
+ return !isReplacement && getExistingPropertyNames().contains(name);
}
protected Set getExistingPropertyNames() {
@@ -408,10 +545,19 @@
protected void updateTypeWidgets() {
// update type from file
- Object type = (property == null) ? propertyType : property.getType();
- if (type instanceof XSDTypeDefinition) {
- updateTypeFileText();
+ if (typeOrElement == BID_USE_ELEMENT ) {
+ typeOrElementNameLabel.setText(Messages.EditMessagePropertyDialog_Element_1);
+ typeRadio.setSelection(false);
+ elementRadio.setSelection(true);
+ propertyType = xsdElementDeclaration;
}
+ else {
+ typeOrElementNameLabel.setText(Messages.EditMessagePropertyDialog_Type_1);
+ typeRadio.setSelection(true);
+ elementRadio.setSelection(false);
+ propertyType = xsdTypeDefinition;
+ }
+ updateTypeFileText();
}
/**
@@ -419,9 +565,23 @@
* Updates the property type according to the user choice.
*/
protected void browsePropertyType() {
- Object xsdType = BrowseUtil.browseForXSDTypeOrElement(bpelEditor.getProcess(),
getShell());
- if (xsdType != null) {
- propertyType = xsdType;
+ Object type = null;
+ Object result[] = null;
+ if (typeOrElement == BID_USE_TYPE)
+ result = BrowseUtil.browseForXSDType(bpelEditor.getProcess(), getShell());
+ else
+ result = BrowseUtil.browseForXSDElement(bpelEditor.getProcess(), getShell(),false);
+
+ if (result!=null && result.length>=1)
+ type = result[0];
+
+ if (type != null) {
+ propertyType = type;
+ if (typeOrElement == BID_USE_ELEMENT)
+ xsdElementDeclaration = (XSDElementDeclaration) type;
+ else
+ xsdTypeDefinition = (XSDTypeDefinition) type;
+
updateTypeFileText();
updateEnablement();
}
@@ -462,6 +622,20 @@
}
newAliasesList.clear();
}
+ else if (isReplacement) {
+ boolean found = false;
+ for (Object obj : definition.getEExtensibilityElements()) {
+ if (obj instanceof Property &&
((Property)obj).getName().equals(property.getName())) {
+ property = (Property)obj;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ definition.getEExtensibilityElements().add(property);
+ property.setEnclosingDefinition(definition);
+ }
+ }
property.setName(propertyNameText.getText());
property.setType(propertyType);
@@ -482,6 +656,9 @@
protected void createAlias() {
EditPropertyAliasDialog dialog = new EditPropertyAliasDialog(getShell(), property,
null, bpelEditor, wf);
if (dialog.open() == Window.OK) {
+ if (property.eResource()==null)
+ createProperty();
+
final PropertyAlias alias = dialog.getPropertyAlias();
if (alias != null) {
URI uri = getTargetFileURI();
@@ -495,14 +672,47 @@
newAliasesList.add(alias);
} else {
// add the alias now
+ if (isReplacement) {
+ alias.setPropertyName(property);
+ }
alias.setEnclosingDefinition(definition);
definition.getEExtensibilityElements().add(alias);
}
+ Object imported = null;
Object messageTypeObject = alias.getMessageType();
+ Object xsdElementObject = alias.getXSDElement();
+ Object typeObject = alias.getType();
if (messageTypeObject instanceof Message) {
- WSDLImportHelper.addImportAndNamespace(definition,
((Message)messageTypeObject).getEnclosingDefinition());
+ imported = ((Message)messageTypeObject).getEnclosingDefinition();
}
+ else if (xsdElementObject instanceof XSDElementDeclaration) {
+ EObject top = (XSDElementDeclaration)xsdElementObject;
+ while (top.eContainer() != null) {
+ top = top.eContainer();
+ if (top instanceof Definition) {
+ imported = top;
+ break;
+ }
+ }
+ }
+ else if (typeObject instanceof XSDTypeDefinition) {
+ EObject top = (XSDTypeDefinition)typeObject;
+ while (top.eContainer() != null) {
+ top = top.eContainer();
+ if (top instanceof Definition) {
+ imported = top;
+ break;
+ }
+ }
+ }
+ if (imported instanceof Definition) {
+ WSDLImportHelper.addImportAndNamespace(definition, (Definition)imported);
+ }
+ else if (imported instanceof XSDSchema) {
+ WSDLImportHelper.addImportAndNamespace(definition, (XSDSchema)imported,
+ bpelEditor.getEditModelClient().getPrimaryResourceInfo().getFile());
+ }
// This doesn't seem to introduce an updateElement automatically,
// so do it manually now, so that RolePortTypes (for example) who
// are affected by the new namespace will know about it.
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditPropertyAliasDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditPropertyAliasDialog.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditPropertyAliasDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -10,88 +10,193 @@
*******************************************************************************/
package org.eclipse.bpel.ui.dialogs;
-import java.util.Iterator;
-
import org.eclipse.bpel.model.messageproperties.MessagepropertiesFactory;
+import org.eclipse.bpel.model.messageproperties.MessagepropertiesPackage;
import org.eclipse.bpel.model.messageproperties.Property;
import org.eclipse.bpel.model.messageproperties.PropertyAlias;
import org.eclipse.bpel.model.messageproperties.Query;
import org.eclipse.bpel.ui.BPELEditor;
import org.eclipse.bpel.ui.IHelpContextIds;
import org.eclipse.bpel.ui.Messages;
-import org.eclipse.bpel.ui.details.providers.ModelTreeContentProvider;
-import org.eclipse.bpel.ui.details.providers.ModelTreeLabelProvider;
-import org.eclipse.bpel.ui.details.providers.PartTreeContentProvider;
-import org.eclipse.bpel.ui.details.tree.ITreeNode;
-import org.eclipse.bpel.ui.details.tree.PartTreeNode;
-import org.eclipse.bpel.ui.properties.DialogVariableTypeSelector;
-import org.eclipse.bpel.ui.properties.VariableTypeSelector;
+import org.eclipse.bpel.ui.expressions.IEditorConstants;
+import org.eclipse.bpel.ui.properties.ExpressionSection;
+import org.eclipse.bpel.ui.util.BrowseUtil;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gef.commands.Command;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
-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.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.Message;
-import org.eclipse.wst.wsdl.Part;import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.wst.wsdl.Part;
+import org.eclipse.xsd.XSDComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDParticle;
import org.eclipse.xsd.XSDTypeDefinition;
/**
* Dialog for creating or editing a property alias.
+ *
https://jira.jboss.org/browse/JBIDE-7107
+ * This has been completely reworked to support Properties of Message Types, XSD Simple
Types and
+ * XSD Elements (previous version only supported Message Types).
+ *
+ * This also incorporates the XPath Expression editor for use in editing the Query
expression.
*/
public class EditPropertyAliasDialog extends Dialog {
+ protected static final int BID_USE_TYPE = IDialogConstants.CLIENT_ID + 30;
+ protected static final int BID_USE_ELEMENT = IDialogConstants.CLIENT_ID + 31;
+ protected static final int BID_USE_MESSAGE = IDialogConstants.CLIENT_ID + 32;
+ // True if a new propertyAlias is being created (as opposed to an existing being
edited)
+ protected boolean isNew;
protected BPELEditor bpelEditor;
- protected Definition wsdlDefinition;
protected Property property;
protected PropertyAlias alias;
- protected DialogVariableTypeSelector variableTypeSelector;
- protected Tree messagePartTree;
- protected TreeViewer messagePartViewer;
- protected boolean createAlias;
+ protected EObject activeTypeElementOrMessage;
+ protected Query activeQuery;
+ protected XSDTypeDefinition xsdTypeDefinition;
+ protected Query xsdTypeQuery;
+
+ protected XSDElementDeclaration xsdElementDeclaration;
+ protected Query xsdElementQuery;
+
+ protected Message message;
+ protected String messagePart;
+ protected Query messageQuery;
+
+ protected Label typeElementOrMessageNameLabel;
+ protected Label typeElementOrMessageNameText;
+ private Button typeRadio;
+ private Button elementRadio;
+ private Button messageRadio;
+ private int typeElementOrMessage;
+
+ private QueryEditor queryEditor;
+
+ protected Button browseTypeButton;
+
protected TabbedPropertySheetWidgetFactory wf;
- protected class PropertyAliasDialogCallback implements VariableTypeSelector.Callback {
- public void selectRadioButton(int index) {}
- public void selectXSDType(XSDTypeDefinition xsdType) {}
- public void selectXSDElement(XSDElementDeclaration xsdElement) {}
- public void selectMessageType(Message message) {
- variableTypeSelector.setVariableType(message);
- messagePartViewer.setInput(message);
- updateWidgets();
+ public class QueryEditor extends ExpressionSection {
+
+ public void create(Composite parent)
+ {
+ createControls(parent, null);
}
+
+ public void setInput(EObject obj)
+ {
+ basicSetInput(obj);
+ }
+
+ public String getQuery()
+ {
+ if (getExpressionEditor()!=null)
+ return getExpressionEditor().getEditorContent();
+ return null;
+ }
+
+ public String getQueryLanguage()
+ {
+ Object elm = selectedExpressionLanguage();
+ if (elm == NO_EXPRESSION || elm == null )
+ return null;
+ return getExpressionLanguage(elm);
+ }
+
+ @Override
+ protected String getExpressionType() {
+ return IEditorConstants.ET_ANY;
+ }
+
+ @Override
+ public BPELEditor getBPELEditor() {
+ return bpelEditor;
+ }
+
+ @Override
+ public TabbedPropertySheetWidgetFactory getWidgetFactory() {
+ return wf;
+ }
+
+ @Override
+ protected EStructuralFeature getStructuralFeature () {
+ fStructuralFeature = MessagepropertiesPackage.eINSTANCE.getPropertyAlias_Query();
+ return fStructuralFeature;
+ }
+
+ @Override
+ protected void setStructuralFeature ( EStructuralFeature feature ) {
+ fStructuralFeature = feature;
+ }
+
+ @Override
+ protected EStructuralFeature getStructuralFeature ( EObject eObject ) {
+ if (eObject != null)
+ return MessagepropertiesPackage.eINSTANCE.getPropertyAlias_Query();
+ return null;
+ }
+
+ @Override
+ protected Command wrapInShowContextCommand(Command inner) {
+ EditPropertyAliasDialog.this.updateWidgets();
+ return null;
+ }
+
}
-
+
public EditPropertyAliasDialog(Shell parentShell, Property property, PropertyAlias
alias, BPELEditor bpelEditor, TabbedPropertySheetWidgetFactory wf) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
- this.createAlias = (alias == null);
+ this.isNew = (alias == null);
this.alias = alias;
this.property = property;
this.bpelEditor = bpelEditor;
this.wf = wf;
- if (alias != null && alias.getMessageType() != null) {
- Resource resource = ((EObject)alias.getMessageType()).eResource();
- wsdlDefinition = (Definition) resource.getContents().get(0);
+ if (isNew) {
+ typeElementOrMessage = BID_USE_MESSAGE;
+ this.alias = MessagepropertiesFactory.eINSTANCE.createPropertyAlias();
}
+ else {
+ if (alias.getMessageType() != null) {
+ typeElementOrMessage = BID_USE_MESSAGE;
+ message = (Message)alias.getMessageType();
+ messagePart = alias.getPart();
+ messageQuery = alias.getQuery();
+ }
+ else if (alias.getType() != null) {
+ typeElementOrMessage = BID_USE_TYPE;
+ xsdTypeDefinition = (XSDTypeDefinition)alias.getType();
+ xsdTypeQuery = alias.getQuery();
+ }
+ else if (alias.getXSDElement() != null) {
+ typeElementOrMessage = BID_USE_ELEMENT;
+ xsdElementDeclaration = (XSDElementDeclaration)alias.getXSDElement();
+ xsdElementQuery = alias.getQuery();
+ }
+ }
}
@Override
@@ -99,89 +204,333 @@
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = (GridLayout) composite.getLayout();
layout.makeColumnsEqualWidth = false;
- layout.numColumns = 2;
+ layout.numColumns = 3;
- // create widgets
- Label topLabel = new Label(composite, SWT.NONE);
- if (createAlias) {
- topLabel.setText(Messages.EditPropertyAliasDialog_3);
- } else {
- topLabel.setText(Messages.EditPropertyAliasDialog_4);
- }
- variableTypeSelector = new DialogVariableTypeSelector(composite, SWT.NONE, bpelEditor,
getShell(), new PropertyAliasDialogCallback(), wf);
- variableTypeSelector.setVariableType(null);
- Label partLabel = new Label(composite, SWT.NONE);
- partLabel.setText(Messages.EditPropertyAliasDialog_8);
- messagePartTree = new Tree(composite, SWT.BORDER);
- messagePartViewer = new TreeViewer(messagePartTree);
- messagePartViewer.setContentProvider(new PartTreeContentProvider(true));
- messagePartViewer.setLabelProvider(new ModelTreeLabelProvider());
- messagePartViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
+ Listener enablementListener = new Listener() {
+ public void handleEvent(Event e) {
updateEnablement();
}
+ };
+
+ // create widgets
+ String groupText = Messages.EditMessagePropertyDialog_10;
+ // PropertyAlias must have either XSD Type or XSD Element or (message type and part):
create radio button group
+ Group typeElementOrMessageRadioGroup = new Group(composite,SWT.SHADOW_ETCHED_IN);
+ typeElementOrMessageRadioGroup.setText(groupText);
+ layout = new GridLayout();
+ layout.makeColumnsEqualWidth = true;
+ layout.numColumns = 1;
+ typeElementOrMessageRadioGroup.setLayout(layout);
+ messageRadio =
createRadioButton(typeElementOrMessageRadioGroup,Messages.EditMessagePropertyDialog_13,
BID_USE_MESSAGE, typeElementOrMessage == BID_USE_MESSAGE);
+ typeRadio =
createRadioButton(typeElementOrMessageRadioGroup,Messages.EditMessagePropertyDialog_11,
BID_USE_TYPE, typeElementOrMessage == BID_USE_TYPE);
+ elementRadio =
createRadioButton(typeElementOrMessageRadioGroup,Messages.EditMessagePropertyDialog_12,
BID_USE_ELEMENT, typeElementOrMessage == BID_USE_ELEMENT);
+ messageRadio.addListener(SWT.Selection, enablementListener);
+ typeRadio.addListener(SWT.Selection, enablementListener);
+ elementRadio.addListener(SWT.Selection, enablementListener);
+
+ // type label and text
+ typeElementOrMessageNameLabel = new Label(composite, SWT.NONE);
+ typeElementOrMessageNameText = new Label(composite, SWT.NONE);
+ browseTypeButton = new Button(composite, SWT.PUSH);
+ browseTypeButton.setText(Messages.EditMessagePropertyDialog_18);
+ browseTypeButton.addListener(SWT.Selection, new Listener() {
+ public void handleEvent(Event event) {
+ browsePropertyType();
+ }
});
+
// layout widgets
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- data.widthHint =
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- topLabel.setLayoutData(data);
+ GridData data;
+ queryEditor = new QueryEditor();
+ Group queryGroup = new Group(composite,SWT.SHADOW_ETCHED_IN);
+ queryGroup.setText("Query");
+ layout = new GridLayout();
+ layout.makeColumnsEqualWidth = true;
+ layout.numColumns = 1;
+ queryGroup.setLayout(layout);
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+ queryGroup.setLayoutData(data);
+ queryEditor.create(queryGroup);
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 3;
+// data.widthHint =
convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
+// topLabel.setLayoutData(data);
+ typeElementOrMessageRadioGroup.setLayoutData(data);
data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- variableTypeSelector.setLayoutData(data);
+ messageRadio.setLayoutData(data);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ typeRadio.setLayoutData(data);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ elementRadio.setLayoutData(data);
data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- partLabel.setLayoutData(data);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.verticalSpan = 3;
- data.heightHint = 70;
- messagePartTree.setLayoutData(data);
+ typeElementOrMessageNameLabel.setLayoutData(data);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
+ typeElementOrMessageNameText.setLayoutData(data);
+ data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ browseTypeButton.setLayoutData(data);
+ // update widgets
updateWidgets();
PlatformUI.getWorkbench().getHelpSystem().setHelp(
parent, IHelpContextIds.PROPERTY_ALIAS_DIALOG);
+ composite.pack();
+
return composite;
}
+
+ protected Button createRadioButton(Composite parent, String label, int id, boolean
checked) {
+
+ Button button = new Button(parent,SWT.RADIO);
+ button.setText(label);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData(new Integer(id));
+ button.setSelection( checked );
+
+ button.addSelectionListener (new SelectionAdapter() {
+ @Override
+ public void widgetSelected (SelectionEvent event) {
+ Button b = (Button) event.widget;
+ int val = ((Integer) b.getData()).intValue();
+
+ buttonPressed(val, b.getSelection(), true );
+ }
+ });
+
+ return button;
+
+ }
+ /**
+ * Handle the check button and radio button callbacks.
+ *
+ * @param id
+ * @param checked
+ * @param refresh unless this is set, no refresh is done.
+ */
+
+ protected void buttonPressed(int id, boolean checked, boolean bRefresh) {
+
+ switch (id) {
+
+ case BID_USE_ELEMENT:
+ case BID_USE_TYPE:
+ case BID_USE_MESSAGE:
+ if (!checked)
+ return;
+ typeElementOrMessage = id;
+ break;
+
+ default :
+ break;
+ }
+
+
+ if (bRefresh) {
+ updateWidgets();
+ }
+ }
+
protected void updateWidgets() {
- if (wsdlDefinition != null) {
- Message message = (Message)alias.getMessageType();
- messagePartViewer.setInput(message);
- variableTypeSelector.setVariableType(message);
- String partName = alias.getPart();
- if (partName != null) {
- Part part = null;
- for (Iterator iter = message.getEParts().iterator(); iter.hasNext();) {
- Part temp = (Part) iter.next();
- if (partName.equals(temp.getName())) {
- part = temp;
- break;
- }
- }
- if (part != null) {
- PartTreeNode node = new PartTreeNode(part, false);
- messagePartViewer.setSelection(new StructuredSelection(node), true);
- }
+ String s = queryEditor.getQuery();
+ if (s!=null && activeQuery!=null) {
+ activeQuery.setValue(s);
+ activeQuery.setQueryLanguage(queryEditor.getQueryLanguage());
+ }
+
+ if (typeElementOrMessage == BID_USE_TYPE) {
+ typeRadio.setSelection(true);
+ elementRadio.setSelection(false);
+ messageRadio.setSelection(false);
+ activeTypeElementOrMessage = xsdTypeDefinition;
+ if (xsdTypeQuery == null) {
+ xsdTypeQuery = MessagepropertiesFactory.eINSTANCE.createQuery();
}
- } else {
- //variableTypeSelector.setVariableType(null);
+ activeQuery = xsdTypeQuery;
+ typeElementOrMessageNameLabel.setText(Messages.EditMessagePropertyDialog_Type_1);
+
+ alias.setMessageType(null);
+ alias.setPart(null);
+ alias.setType(xsdTypeDefinition);
+ alias.setXSDElement(null);
}
+ else if (typeElementOrMessage == BID_USE_ELEMENT) {
+ typeRadio.setSelection(false);
+ elementRadio.setSelection(true);
+ messageRadio.setSelection(false);
+ activeTypeElementOrMessage = xsdElementDeclaration;
+ if (xsdElementQuery == null) {
+ xsdElementQuery = MessagepropertiesFactory.eINSTANCE.createQuery();
+ }
+ activeQuery = xsdElementQuery;
+ typeElementOrMessageNameLabel.setText(Messages.EditMessagePropertyDialog_Element_1);
+
+ alias.setMessageType(null);
+ alias.setPart(null);
+ alias.setType(null);
+ alias.setXSDElement(xsdElementDeclaration);
+ }
+ else if (typeElementOrMessage == BID_USE_MESSAGE) {
+ typeRadio.setSelection(false);
+ elementRadio.setSelection(false);
+ messageRadio.setSelection(true);
+ activeTypeElementOrMessage = message;
+ if (messageQuery == null) {
+ messageQuery = MessagepropertiesFactory.eINSTANCE.createQuery();
+ }
+ activeQuery = messageQuery;
+ typeElementOrMessageNameLabel.setText(Messages.EditMessagePropertyDialog_Message_1);
+
+ alias.setMessageType(message);
+ alias.setPart(messagePart);
+ alias.setType(null);
+ alias.setXSDElement(null);
+ }
+ alias.setQuery(activeQuery);
+ queryEditor.setInput(alias);
+
+ updateTypeElementOrMessageName();
updateEnablement();
}
+
+ protected void updateTypeElementOrMessageName() {
+ if (activeTypeElementOrMessage instanceof XSDTypeDefinition) {
+ xsdTypeDefinition = (XSDTypeDefinition) activeTypeElementOrMessage;
+ xsdTypeQuery = activeQuery;
+ typeElementOrMessageNameText.setText(xsdTypeDefinition.getName());
+ } else if (activeTypeElementOrMessage instanceof XSDElementDeclaration) {
+ xsdElementDeclaration = (XSDElementDeclaration) activeTypeElementOrMessage;
+ xsdElementQuery = activeQuery;
+ typeElementOrMessageNameText.setText(xsdElementDeclaration.getName());
+ } else if (activeTypeElementOrMessage instanceof Message) {
+ message = (Message) activeTypeElementOrMessage;
+ String s = message.getQName().getLocalPart();
+ messageQuery = activeQuery;
+ if (messagePart!=null) {
+ s += "." + messagePart;
+ }
+ typeElementOrMessageNameText.setText(s);
+ }
+ else
+ {
+ typeElementOrMessageNameText.setText("");
+ }
+ }
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
- if (createAlias) {
+ if (isNew) {
newShell.setText(Messages.EditPropertyAliasDialog_9);
} else {
newShell.setText(Messages.EditPropertyAliasDialog_10);
}
}
+
+ /**
+ * Opens a dialog and let the user browse for an XSD type or element.
+ * Updates the property type according to the user choice.
+ */
+ protected void browsePropertyType() {
+
+ Object type = null;
+ Object part = null;
+ Object query = null;
+ Object result[] = null;
+ if (typeElementOrMessage == BID_USE_TYPE)
+ result = BrowseUtil.browseForXSDType(bpelEditor.getProcess(), getShell());
+ else if (typeElementOrMessage == BID_USE_ELEMENT)
+ result = BrowseUtil.browseForXSDElement(bpelEditor.getProcess(), getShell(), true);
+ else {
+ result = BrowseUtil.browseForMessageType(bpelEditor.getProcess(), getShell(), true);
+ }
+ if (result!=null) {
+ if (result.length>=1) {
+
+ type = result[0];
+ if (type instanceof Message) {
+ message = (Message) type;
+ if (result.length>=2) {
+ if (result[1] instanceof Part) {
+ part = result[1];
+ }
+ else if (result[1] instanceof XSDComponent) {
+ // The selected XSD component must be a child of the message part.
+ // Look for part and build query path to the component.
+ // TODO: move this search algorithm to ModelQuery class
+ for ( Part p : (EList<Part>)message.getEParts() ) {
+ XSDTypeDefinition def = p.getElementDeclaration().getTypeDefinition();
+ XSDComponent comp = (XSDComponent)result[1];
+ String s = "";
+ while ( comp.eContainer() instanceof XSDComponent ) {
+ comp = (XSDComponent)comp.eContainer();
+ if (def == comp) {
+ part = p.getName();
+ query = s;
+ break;
+ }
+ else
+ {
+ if (comp instanceof XSDParticle && ((XSDParticle)comp).getTerm()
instanceof XSDNamedComponent)
+ {
+ XSDNamedComponent nc = (XSDNamedComponent)((XSDParticle)comp).getTerm();
+ s = "/" + nc.getName() + s;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if (type instanceof XSDComponent) {
+ if (result.length>=2 && result[1] instanceof XSDComponent) {
+ XSDComponent comp = (XSDComponent)result[1];
+ query = "";
+ while ( comp.eContainer() instanceof XSDComponent ) {
+ comp = (XSDComponent)comp.eContainer();
+ if (comp instanceof XSDParticle && ((XSDParticle)comp).getTerm()
instanceof XSDNamedComponent)
+ {
+ XSDNamedComponent nc = (XSDNamedComponent)((XSDParticle)comp).getTerm();
+ query = "/" + nc.getName() + query;
+ }
+ }
+ }
+ }
+ }
+
+ activeTypeElementOrMessage = (EObject)type;
+ if (query!=null)
+ activeQuery.setValue(query.toString());
+ else
+ activeQuery.setValue("");
+
+ if (typeElementOrMessage == BID_USE_TYPE) {
+ xsdTypeDefinition = (XSDTypeDefinition) type;
+ xsdTypeQuery = activeQuery;
+ }
+ else if (typeElementOrMessage == BID_USE_ELEMENT) {
+ xsdElementDeclaration = (XSDElementDeclaration) type;
+ xsdElementQuery = activeQuery;
+ }
+ else {
+ message = (Message)type;
+ if (part!=null)
+ messagePart = part.toString();
+ messageQuery = activeQuery;
+ }
+
+ // hack: don't fetch query from XPath Expression Editor
+ // because it will overwrite the currently selected element
+ activeQuery = null;
+ updateWidgets();
+ }
+ }
/**
* @return Returns the alias.
@@ -192,46 +541,27 @@
@Override
protected void okPressed() {
- if (alias == null) {
- alias = MessagepropertiesFactory.eINSTANCE.createPropertyAlias();
+ alias.setPropertyName(property);
+ if (typeElementOrMessage == BID_USE_TYPE) {
+ alias.setType(xsdTypeDefinition);
+ if (xsdTypeQuery!=null && (xsdTypeQuery.getValue()==null ||
xsdTypeQuery.getValue().isEmpty()) )
+ xsdTypeQuery = null;
+ alias.setQuery(xsdTypeQuery);
}
- Message message = (Message)variableTypeSelector.getVariableType();
-
- ModelTreeContentProvider tcp =
(ModelTreeContentProvider)messagePartViewer.getContentProvider();
- String part = null;
- String query = ""; //$NON-NLS-1$
- ITreeNode result = (ITreeNode)((IStructuredSelection)
messagePartViewer.getSelection()).getFirstElement();
- while (result != null) {
- String qname = "";
- if (result.getModelObject() instanceof XSDElementDeclaration) {
- XSDElementDeclaration xsd = (XSDElementDeclaration)result.getModelObject();
- qname = xsd.getQName();
- }
- if (result instanceof PartTreeNode) {
- part = result.getLabel();
- break;
- }
- if (!query.equals("")) { //$NON-NLS-1$
- query = qname + "/" + query; //$NON-NLS-1$
- } else {
- query = qname;
- }
- result = (ITreeNode)tcp.getParent(result);
+ else if (typeElementOrMessage == BID_USE_ELEMENT) {
+ alias.setXSDElement(xsdElementDeclaration);
+ if (xsdElementQuery!=null && (xsdElementQuery.getValue()==null ||
xsdElementQuery.getValue().isEmpty()) )
+ xsdElementQuery = null;
+ alias.setQuery(xsdElementQuery);
}
- if (query.length() > 0)
- query = "/" + query; //$NON-NLS-1$
- else
- query = null;
-
- alias.setPropertyName(property);
- alias.setMessageType(message);
- alias.setPart(part);
- Query queryObject = alias.getQuery();
- if (queryObject == null) {
- queryObject = MessagepropertiesFactory.eINSTANCE.createQuery();
+ else {
+ alias.setMessageType(message);
+ alias.setPart(messagePart);
+ if (messageQuery!=null && (messageQuery.getValue()==null ||
messageQuery.getValue().isEmpty()) )
+ messageQuery = null;
+ alias.setQuery(messageQuery);
}
- queryObject.setValue(query);
- alias.setQuery(queryObject);
+
super.okPressed();
}
@@ -245,10 +575,10 @@
protected void updateEnablement() {
// update the OK button
boolean isOK = true;
- if (variableTypeSelector.getVariableType() == null
- || (messagePartViewer.getSelection() == null) ||
(messagePartViewer.getSelection().isEmpty())) {
- isOK = false;
- }
+// if (variableTypeSelector.getVariableType() == null
+// || (messagePartViewer.getSelection() == null) ||
(messagePartViewer.getSelection().isEmpty())) {
+// isOK = false;
+// }
Button okButton = getButton(IDialogConstants.OK_ID);
if (okButton != null) {
okButton.setEnabled(isOK);
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/ListAndViewDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/ListAndViewDialog.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/ListAndViewDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -191,6 +191,8 @@
@Override
protected void handleSelectionChanged() {
handleUpperSelectionChanged();
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ updateOkState();
}
private void handleUpperSelectionChanged() {
@@ -208,6 +210,8 @@
}
validateCurrentSelection();
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ updateOkState();
}
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/MessageSelectorTypeDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/MessageSelectorTypeDialog.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/MessageSelectorTypeDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.eclipse.bpel.ui.dialogs;
+
+import org.eclipse.bpel.ui.details.providers.XSDTypeOrElementContentProvider;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * New class added to support browsing for Message Types only.
+ * This dialog extends the general-purpose Type Selector but limits the selection
+ * to known Message Types only. This makes for a less confusing user experience.
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
+public class MessageSelectorTypeDialog extends TypeSelectorDialog {
+
+ public MessageSelectorTypeDialog(Shell parent, EObject eObj) {
+ super(parent, eObj);
+ FILTER_TYPES = 0;
+ showMessages = true;
+ }
+
+ public void setRequirePartSelection(boolean enabled)
+ {
+ this.requireLowerTreeSelection = enabled;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ // TODO Auto-generated method stub
+ Control ctl = super.createContents(parent);
+ checkButtonGroup.setEnabled(false);
+ for (Control c : checkButtonGroup.getChildren())
+ c.setEnabled(false);
+ return ctl;
+ }
+
+}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -30,6 +30,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.wst.wsdl.Message;
@@ -72,7 +73,7 @@
protected final static int BID_XSD_PRIMITIVES = IDialogConstants.CLIENT_ID + 104;
/* Whether messages ought to be shown */
- private boolean showMessages = true;
+ protected boolean showMessages = true;
protected XSDTypeOrElementContentProvider xsdTypeProvider = new
XSDTypeOrElementContentProvider();
@@ -87,9 +88,14 @@
/* Which types to filter ? */
- private int FILTER_TYPES = XSDTypeOrElementContentProvider.INLCUDE_ALL;
+ protected int FILTER_TYPES = XSDTypeOrElementContentProvider.INLCUDE_ALL;
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // set by caller if a selection from the lower tree (typically message parts or XSD
elements)
+ // are required before "OK" button can be enabled.
+ protected boolean requireLowerTreeSelection = true;
+
/**
* Create a brand new shiny Type Selector Dialog.
*
@@ -256,7 +262,27 @@
return list;
}
+ //
https://jira.jboss.org/browse/JBIDE-7107
@Override
+ protected void updateOkState() {
+ super.updateOkState();
+
+ boolean enabled = true;
+ computeResult();
+ Object obj = getFirstResult();
+ // We need to check whether namespace prefix has been already defined
+ if (obj instanceof Message) {
+ if (!checkNamespace((Message) obj)){
+ enabled = false;
+ }
+ }
+ if ( getResult().length!=2 && this.requireLowerTreeSelection )
+ enabled = false;
+
+ getOkButton().setEnabled(enabled);
+ }
+
+ @Override
protected void okPressed() {
computeResult();
Object obj = getFirstResult();
@@ -266,6 +292,8 @@
return;
}
}
+ if ( getResult().length!=2 && this.requireLowerTreeSelection )
+ return;
super.okPressed();
}
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDElementSelectorDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDElementSelectorDialog.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDElementSelectorDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.eclipse.bpel.ui.dialogs;
+
+import org.eclipse.bpel.ui.details.providers.XSDTypeOrElementContentProvider;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * New class added to support browsing for XSD Elements only.
+ * This dialog extends the general-purpose Type Selector but limits the selection
+ * to known XSD Elements only. This makes for a less confusing user experience.
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
+public class XSDElementSelectorDialog extends TypeSelectorDialog {
+
+ public XSDElementSelectorDialog(Shell parent, EObject eObj) {
+ super(parent, eObj);
+ FILTER_TYPES = XSDTypeOrElementContentProvider.INCLUDE_ELEMENT_DECLARATIONS;
+ showMessages = false;
+ }
+
+ public void setRequireElementSelection(boolean enabled)
+ {
+ this.requireLowerTreeSelection = enabled;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ // TODO Auto-generated method stub
+ Control ctl = super.createContents(parent);
+ checkButtonGroup.setEnabled(false);
+ for (Control c : checkButtonGroup.getChildren())
+ c.setEnabled(false);
+ return ctl;
+ }
+
+}
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDTypeSelectorDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDTypeSelectorDialog.java
(rev 0)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/XSDTypeSelectorDialog.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.eclipse.bpel.ui.dialogs;
+
+import org.eclipse.bpel.ui.details.providers.XSDTypeOrElementContentProvider;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * New class added to support browsing for XSD Simple Types only.
+ * This dialog extends the general-purpose Type Selector but limits the selection
+ * to known XSD Simple Types only. This makes for a less confusing user experience.
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
+public class XSDTypeSelectorDialog extends TypeSelectorDialog {
+
+ public XSDTypeSelectorDialog(Shell parent, EObject eObj) {
+ super(parent, eObj);
+ FILTER_TYPES = XSDTypeOrElementContentProvider.INCLUDE_TYPES;
+ showMessages = false;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ // TODO Auto-generated method stub
+ Control ctl = super.createContents(parent);
+ checkButtonGroup.setEnabled(false);
+ for (Control c : checkButtonGroup.getChildren())
+ c.setEnabled(false);
+ return ctl;
+ }
+
+}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2010-10-12
19:44:34 UTC (rev 25761)
@@ -199,10 +199,11 @@
DurationSelector_Months_1=Mont&hs
DurationSelector_Seconds_5=Se&conds
DurationSelector_Years_1=Ye&ars
-EditMessagePropertyDialog_10=Edit the existing Property.
+EditMessagePropertyDialog_9=Create Property
+EditMessagePropertyDialog_10=Defined As
EditMessagePropertyDialog_14=Na&me\:
EditMessagePropertyDialog_18=Bro&wse...
-EditMessagePropertyDialog_1=Message Type
+EditMessagePropertyDialog_1=Message Type && Part
EditMessagePropertyDialog_20=Aliases
EditMessagePropertyDialog_21=N&ew...
EditMessagePropertyDialog_22=E&dit...
@@ -212,11 +213,20 @@
EditMessagePropertyDialog_2=Part
EditMessagePropertyDialog_3=<none>
EditMessagePropertyDialog_4=\: {0}
-EditMessagePropertyDialog_9=Create a new Property.
+
+#
https://jira.jboss.org/browse/JBIDE-7107
+EditMessagePropertyDialog_11=Simple Type
+EditMessagePropertyDialog_12=Element
+EditMessagePropertyDialog_13=Message Type
+EditMessagePropertyDialog_15=Element
+EditMessagePropertyDialog_16=Simple Type
+
EditMessagePropertyDialog_Type_1=Type\:
+EditMessagePropertyDialog_Element_1=Element\:
+EditMessagePropertyDialog_Message_1=Message\:
EditPropertyAliasDialog_10=Edit Property Alias
-EditPropertyAliasDialog_3=Create a new property alias.
-EditPropertyAliasDialog_4=Edit the existing property alias.
+EditPropertyAliasDialog_3=Create Property Alias
+EditPropertyAliasDialog_4=Edit Property Alias
EditPropertyAliasDialog_8=&Part\:
EditPropertyAliasDialog_9=Create Property Alias
EndNodeAdapter_End_1=End
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/CorrSetImplSection.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/CorrSetImplSection.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/CorrSetImplSection.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -216,8 +216,18 @@
BPELEditor bpelEditor = getBPELEditor();
Shell shell = bpelEditor.getEditorSite().getShell();
EditMessagePropertyDialog dialog = new EditMessagePropertyDialog(shell, property,
null, bpelEditor, fWidgetFactory);
- if (dialog.open() == Window.OK) {
- if (property != null) {
+ int rtn = dialog.open();
+ if (rtn == Window.OK) {
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // this fixes a nasty bug caused by manual editing of the ProcessArtifacts.wsdl
+ if (property != null && dialog.getProperty()!=null) {
+ if (property.eIsProxy()) {
+ // the Propery is not resolved (it was probably removed from the WSDL)
+ // remove the old Property before adding the newly created one.
+ Command cmd = new RemovePropertyCommand((CorrelationSet)getInput(), property);
+ getCommandFramework().execute(wrapInShowContextCommand(cmd));
+ property = dialog.getProperty();
+ }
Command cmd = new AddPropertyCommand((CorrelationSet)getInput(), property);
getCommandFramework().execute(wrapInShowContextCommand(cmd));
propertyViewer.setSelection(new StructuredSelection(property));
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -609,7 +609,9 @@
DecoratedLabel label = new DecoratedLabel(composite,SWT.LEFT);
label.setText(Messages.VariableTypeSelector_Data_Type_2);
wf.adapt(label);
- dataTypeLabel = new StatusLabel2( label );
+ dataTypeLabel = new StatusLabel2( label );
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ dataTypeLabel.getLabel().setBackground(this.getBackground());
dataTypeNameText = createHyperlink(composite, "", SWT.NONE); //$NON-NLS-1$
dataTypeNameText.setToolTipText(Messages.VariableTypeSelector_3);
dataTypeNameText.addHyperlinkListener(new HyperlinkAdapter() {
@@ -642,7 +644,8 @@
data = new FlatFormData();
data.left = new FlatFormAttachment(0,IDetailsAreaConstants.HSPACE);
data.right = new FlatFormAttachment(dataTypeNameText, -IDetailsAreaConstants.HSPACE);
- // data.top = new FlatFormAttachment(dataTypeNameText, IDetailsAreaConstants.VSPACE,
SWT.TOP);
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ data.top = new FlatFormAttachment(dataTypeNameText, -IDetailsAreaConstants.VSPACE,
SWT.TOP);
data.bottom = new FlatFormAttachment(dataTypeNameText,0,SWT.BOTTOM);
dataTypeLabel.setLayoutData(data);
@@ -677,8 +680,11 @@
dataTypeTreeLabel.setLayoutData(data);
data = new FlatFormData();
- data.left = new FlatFormAttachment(0,
BPELUtil.calculateLabelWidth(dataTypeLabel.getLabel(), STANDARD_LABEL_WIDTH_SM));
- data.top = new FlatFormAttachment(dataTypeTreeLabel,0, SWT.TOP);
+ //
https://jira.jboss.org/browse/JBIDE-7107
+// data.left = new FlatFormAttachment(0,
BPELUtil.calculateLabelWidth(dataTypeLabel.getLabel(), STANDARD_LABEL_WIDTH_SM));
+// data.top = new FlatFormAttachment(dataTypeTreeLabel,0, SWT.TOP);
+ data.left = new FlatFormAttachment(dataTypeTreeLabel,0, SWT.LEFT);
+ data.top = new FlatFormAttachment(dataTypeTreeLabel,0, SWT.BOTTOM);
data.right = new FlatFormAttachment(100, -IDetailsAreaConstants.HSPACE) ;
data.bottom = new FlatFormAttachment(100, -IDetailsAreaConstants.HSPACE);
dataTypeTree.setLayoutData(data);
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BrowseUtil.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BrowseUtil.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BrowseUtil.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -10,8 +10,11 @@
*******************************************************************************/
package org.eclipse.bpel.ui.util;
+import org.eclipse.bpel.ui.dialogs.MessageSelectorTypeDialog;
import org.eclipse.bpel.ui.dialogs.PartnerLinkTypeSelectorDialog;
import org.eclipse.bpel.ui.dialogs.TypeSelectorDialog;
+import org.eclipse.bpel.ui.dialogs.XSDElementSelectorDialog;
+import org.eclipse.bpel.ui.dialogs.XSDTypeSelectorDialog;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.window.Window;
@@ -19,6 +22,15 @@
import org.eclipse.wst.wsdl.PortType;
+/*
+ * Added some new methods that browse for Message Types and XSD Simple Types and
Elements.
+ * These disable the type selection radio buttons and limit the display to only those
types
+ * that are relevant.
+ *
+ * @see
https://jira.jboss.org/browse/JBIDE-7107
+ * @author Bob Brodt
+ * @date Oct 12, 2010
+ */
public class BrowseUtil {
public static PortType browseForPortType(ResourceSet resourceSet, Shell parent) {
@@ -58,4 +70,45 @@
}
+ public static Object[] browseForXSDType(EObject eObject, Shell parent) {
+ TypeSelectorDialog dialog = new XSDTypeSelectorDialog (parent,eObject);
+ if (dialog.open() != Window.OK) {
+ return null;
+ }
+ Object obj[] = dialog.getResult();
+ if (obj != null && obj.length > 0) {
+ return obj;
+ }
+ return null;
+
+ }
+
+ public static Object[] browseForXSDElement(EObject eObject, Shell parent, boolean
requireElementSelection) {
+ XSDElementSelectorDialog dialog = new XSDElementSelectorDialog (parent,eObject);
+ dialog.setRequireElementSelection(requireElementSelection);
+ if (dialog.open() != Window.OK) {
+ return null;
+ }
+ Object obj[] = dialog.getResult();
+ if (obj != null && obj.length > 0) {
+ return obj;
+ }
+ return null;
+
+ }
+
+ public static Object[] browseForMessageType(EObject eObject, Shell parent, boolean
requirePartSelection) {
+ MessageSelectorTypeDialog dialog = new MessageSelectorTypeDialog (parent,eObject);
+ dialog.setRequirePartSelection(requirePartSelection);
+ if (dialog.open() != Window.OK) {
+ return null;
+ }
+ Object obj[] = dialog.getResult();
+ if (obj != null && obj.length > 0) {
+ return obj;
+ }
+ return null;
+
+ }
+
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/WSDLImportHelper.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/WSDLImportHelper.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/WSDLImportHelper.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -315,7 +315,11 @@
// importingDefinition.getImports().put(importedSchema.getTargetNamespace(),
// imports);
importingDefinition.addImport(_import);
- } else {
+ }
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // ignore an inconsequential error here
+ else if ( !importingUri.equals(importedUri) )
+ {
// TODO handle errors here?
throw new IllegalStateException();
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -29,7 +29,9 @@
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.wst.wsdl.WSDLElement;
+import org.eclipse.wst.wsdl.util.WSDLParser;
import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.util.XSDParser;
import org.w3c.dom.Element;
@@ -536,7 +538,42 @@
try {
return ((Number)elm.getUserData(key)).intValue();
} catch (Throwable t) {
- //
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // this was added as a result of
https://jira.jboss.org/browse/JBIDE-7116 since we
need to
+ // be able to report line information for various types of WSDL objects...
+ // if the requested item is line/column information, maybe it's in an imported
WSDL or XSD.
+ // We'll have to get this info from the WSDLParser or XSDParser. Luckily we
remembered to set
+ // the TRACK_LOCATION loader option for the WSDL Resource loader, right?
+ EObject eObj = (EObject) elm.getUserData("emf.model");
+ if (eObj instanceof XSDConcreteComponent) {
+ switch (what) {
+ case LOOKUP_NUMBER_LINE_NO :
+ def = XSDParser.getStartLine( ((XSDConcreteComponent)eObj).getElement() );
+ break;
+ case LOOKUP_NUMBER_COLUMN_NO :
+ def = XSDParser.getStartColumn( ((XSDConcreteComponent)eObj).getElement() );
+ break;
+ default:
+ return def;
+ }
+ }
+ else if (eObj instanceof WSDLElement) {
+ switch (what) {
+ case LOOKUP_NUMBER_LINE_NO :
+ def = WSDLParser.getStartLine( ((WSDLElement)eObj).getElement() );
+ break;
+ case LOOKUP_NUMBER_COLUMN_NO :
+ def = WSDLParser.getStartColumn( ((WSDLElement)eObj).getElement() );
+ break;
+ default:
+ return def;
+ }
+ }
+ else
+ return def;
+
+ // found it! Set this info in the adaptable Element for next time
+ elm.setUserData(key, new Integer(def), null);
}
return def;
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/PropertyAlias.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/PropertyAlias.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/PropertyAlias.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -100,8 +100,9 @@
* A <vprop:propertyAlias> element MUST use one of the three following
* combinations of attributes:
*
- * messageType and part,
- * type or element
+ * 1. both messageType and part
+ * 2. type
+ * 3. element
*/
@ARule(
@@ -127,7 +128,9 @@
// good
fDuplicateKey = nn + "/messageType/" + fMessageTypeName + "/" +
fMessagePartName + "/" + fPropertyName;
- } else if (isEmpty(fMessageTypeName) && isEmpty(fMessageTypeName) ) {
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // sheesh! fix a typo
+ } else if (isEmpty(fMessageTypeName) && isEmpty(fMessagePartName) ) {
if (isEmpty(fTypeName) && isNonEmpty(fElementName)) {
// good, element name
@@ -181,8 +184,9 @@
IProblem problem;
INode typeNode = null;
-
- if (isNonEmpty(fMessageTypeName) ) {
+
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ if (isNonEmpty(fMessageTypeName) && isNonEmpty(fMessagePartName)) {
// good
INode msgType = mModelQuery.lookup(mNode.rootNode(),
IModelQueryLookups.LOOKUP_NODE_MESSAGE_TYPE,fMessageTypeName);
@@ -205,15 +209,18 @@
problem.fill("BPELC_MSG__PART",
toString(mNode.nodeName()),
fMessagePartName,
- msgType
+ fMessageTypeName
);
}
}
+
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // reversed type and element...
+ // wow, Michal must have been tired when he was writing this ;)
+ } else if (isNonEmpty(fTypeName)) {
+ // good, type name
- } if (isNonEmpty(fElementName)) {
- // good, element name
-
typeNode = mModelQuery.lookup(mNode.rootNode(),
IModelQueryLookups.LOOKUP_NODE_XSD_TYPE, fTypeName);
@@ -227,8 +234,8 @@
);
}
- } else if (isNonEmpty(fTypeName) ) {
- // good, type name
+ } else if (isNonEmpty(fElementName) ) {
+ // good, element name
typeNode = mModelQuery.lookup(mNode.rootNode(),
IModelQueryLookups.LOOKUP_NODE_XSD_ELEMENT, fElementName);
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/messages.properties 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/vprop/messages.properties 2010-10-12
19:44:34 UTC (rev 25761)
@@ -0,0 +1,13 @@
+#
https://jira.jboss.org/browse/JBIDE-7107
+# This was missing!
+BPELC_PROPERTY__UNSET.summary = Missing "{1}" or "{2}" attribute for
this <{0}>
+BPELC_PROPERTY__UNSET = Either "{1}" or "{2}" attribute is required
on this <{0}>
+BPELC_PROPERTY__UNSET.fix = Provide a valid "{1}" or "{2}" attribute
for this <{0}>
+
+BPELC__DUPLICATE.summary = Duplicate <{0} name="{1}">
+BPELC__DUPLICATE = This <{0}> with name="{1}" was already defined
previously
+BPELC__DUPLICATE.fix = Change the "name" attribute of this <{0}> to
something other than "{1}"
+
+BPELC_MSG__PART.summary = Undefined message "{2}/{1}" for <{0}>
+BPELC_MSG__PART = This <{0}> uses undefined message part "{1}" in message
type "{2}"
+BPELC_MSG__PART.fix = Provide a valid message type and part attribute for this
<{0}>
\ No newline at end of file
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -61,35 +61,24 @@
for (EObject obj : unresolved) {
String location = "unkonwn";
- int startLine = 1, startCol = 1;
- Node node = null;
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // line/column gathering was moved to ModelQuery class
if (obj instanceof Import) {
location = ((Import)obj).getLocationURI();
- node = ((Import)obj).getElement();
- startLine = WSDLParser.getStartLine(node);
- startCol = WSDLParser.getStartColumn(node);
}
else if ( obj instanceof XSDImportImpl ) {
location = ((XSDImportImpl)obj).getSchemaLocation();
- node = ((XSDImportImpl)obj).getElement();
- startLine = XSDParser.getStartLine(node);
- startCol = XSDParser.getStartColumn(node);
}
else if ( obj instanceof XSDIncludeImpl ) {
location = ((XSDIncludeImpl)obj).getSchemaLocation();
- node = ((XSDIncludeImpl)obj).getElement();
- startLine = XSDParser.getStartLine(node);
- startCol = XSDParser.getStartColumn(node);
}
IProblem problem = createWarning(
(INode)mModelQuery.adapt(obj,INode.class,IModelQuery.ADAPT_HINT_NONE) );
problem.fill("BPELC_IMPORT__UNRESOVED", //$NON-NLS-1$
toString(mNode.nodeName()),
- location,
- definition.getLocation());
- problem.setAttribute(IProblem.LINE_NUMBER, startLine);
- problem.setAttribute(IProblem.COLUMN_NUMBER, startCol);
+ location, // location of the unresolved document being imported
+ definition.getLocation()); // location of document doing the importing
}
}
@@ -107,7 +96,6 @@
file.deleteMarkers(IBPELMarker.ID, false, IResource.DEPTH_INFINITE);
// System.out.println("deleted markers from "+file);
} catch (CoreException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Factory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Factory.java 2010-10-12
18:21:11 UTC (rev 25760)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Factory.java 2010-10-12
19:44:34 UTC (rev 25761)
@@ -47,7 +47,10 @@
String nsURI = qname.getNamespaceURI();
if (IConstants.XMLNS_XPATH_EXPRESSION_LANGUAGE.equals ( nsURI ) ||
- IConstants.XMLNS_XPATH_EXPRESSION_LANGUAGE_2.equals (nsURI ) )
+ IConstants.XMLNS_XPATH_EXPRESSION_LANGUAGE_2.equals (nsURI ) ||
+ //
https://jira.jboss.org/browse/JBIDE-7107
+ // oops - also create validator for Definitions
+ IConstants.XMLNS_WSDL.equals (nsURI ))
{
return createValidator( qname.getLocalPart() );
}