Author: bbrodt
Date: 2011-01-07 11:05:01 -0500 (Fri, 07 Jan 2011)
New Revision: 27984
Modified:
trunk/bpel/plugins/org.eclipse.bpel.common.ui/src/org/eclipse/bpel/common/ui/messages.properties
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/AddVariableCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/contentassist/ExpressionContentAssistProcessor.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/details/providers/OperationContentProvider.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/factories/BPELUIObjectFactory.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties
Log:
https://issues.jboss.org/browse/JBIDE-8048
Modified:
trunk/bpel/plugins/org.eclipse.bpel.common.ui/src/org/eclipse/bpel/common/ui/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.common.ui/src/org/eclipse/bpel/common/ui/messages.properties 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.common.ui/src/org/eclipse/bpel/common/ui/messages.properties 2011-01-07
16:05:01 UTC (rev 27984)
@@ -31,9 +31,7 @@
SynchronizationManager_refresh_title=File Changed
CompositeEditor_Cannot_disconnect_active_editor=Cannot disconnect active editor\: {0}
#
https://jira.jboss.org/browse/JBIDE-7520
-SynchronizationManager_refresh_message=The file {0} \n
- has been changed on the file system.\n
- Do you want to load the changes?
+SynchronizationManager_refresh_message=The file {0} has been changed on the file system.
Do you want to load the changes?
SynchronizationManager_saveButtonLabel=Save
CompositeEditorManager_5=Embedded editors must provide an id. Ignoring editor.
DatePicker_noDateSelected=None
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -211,6 +211,10 @@
reader.xml2Target((Target)element, changedElement);
} else if (element instanceof Targets){
reader.xml2Targets((Targets)element, changedElement);
+ } else if (element instanceof CompensationHandler){
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // this was left out inadevertently
+ reader.xml2CompensationHandler((CompensationHandler)element, changedElement);
} else {
System.err.println("Cannot reconcile: " + element.getClass());
// throw new NotImplementedException(element.getClass().toString());
@@ -683,8 +687,29 @@
return;
}
if (parseElement == null) {
- System.err.println("trying to replace attribute on null element:" +
element.getClass());
- return;
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // Hack to allow setting an implicit variable's attributes for OnEvent, Catch.
+ // These are not real Variable objects (i.e. they are not XML elements like
+ // real <variable>'s). To do this right, we really should define an
+ // ImplicitVariable model object instead of reusing Variable objects inside
+ // OnEvent and Catch...
+ EObject parent = element.eContainer();
+ if (parent instanceof OnEvent || parent instanceof Catch) {
+ // ignore attempts to set attributes on the parent that aren't in the model
+ for ( EStructuralFeature feature : parent.eClass().getEAllStructuralFeatures()) {
+ if ( feature.getName().equals(attributeName)) {
+ parseElement = ((ExtensibleElement)parent).getElement();
+ break;
+ }
+ }
+ }
+ if (parseElement == null) {
+ System.err.println("trying to replace attribute " + "\"" +
attributeName + "\"" +
+ " on null element " + element.getClass() + " contained in " +
+ (element.eContainer() == null ? null : element.eContainer().getClass())
+ );
+ return;
+ }
}
// This is a problem in eclipse3.6, if we use parseElement.getAttribute(attributeName)
and the attribute is not in the parseElement,
@@ -744,10 +769,6 @@
if (isLoading(element)) {
return;
}
- if (element.getElement() == null) {
- System.err.println("trying to replace attribute on null element: " +
element.getClass());
- return;
- }
replaceAttribute(element, attributeName, attributeValue == null ? null :
ElementFactory.getInstance().createName(element, attributeValue));
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/AddVariableCommand.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/AddVariableCommand.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/AddVariableCommand.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -10,11 +10,18 @@
*******************************************************************************/
package org.eclipse.bpel.ui.commands;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.model.BPELPackage;
+import org.eclipse.bpel.model.Import;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.Variables;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
/**
@@ -28,7 +35,11 @@
}
@Override
- protected EList<Variable> getList() {
- return ModelHelper.getVariables( target ).getChildren();
+ protected List<Variable> getList() {
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ Variables variables = ModelHelper.getVariables( target );
+ if (variables != null)
+ return variables.getChildren();
+ return new ArrayList<Variable>();
}
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/contentassist/ExpressionContentAssistProcessor.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/contentassist/ExpressionContentAssistProcessor.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/contentassist/ExpressionContentAssistProcessor.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -107,6 +107,7 @@
static final int PROPTYPE_VARIABLE = 1;
static final int PROPTYPE_FUNCTION = 2;
static final int PROPTYPE_OPERATOR = 4;
+ static final int PROPTYPE_ELEMENT = 8;
ProposalType(int type, String beginsWith) {
theType = type;
@@ -117,6 +118,7 @@
boolean isFunction() { return ((theType & PROPTYPE_FUNCTION) == PROPTYPE_FUNCTION);
}
boolean isOperator() { return ((theType & PROPTYPE_OPERATOR) == PROPTYPE_OPERATOR);
}
boolean isVariableAndFunction() { return ((theType & (PROPTYPE_VARIABLE |
PROPTYPE_FUNCTION)) == (PROPTYPE_VARIABLE | PROPTYPE_FUNCTION)); }
+ boolean isElement() { return ((theType & PROPTYPE_ELEMENT) == PROPTYPE_ELEMENT); }
}
// helper class for defining expression types within xpath expression... used by
XPathStack
@@ -134,6 +136,7 @@
static final int EXPRTYPE_NEW_EXPRESSION = 8;
static final int EXPRTYPE_FUNCTION_ARGUMENTS = 9;
static final int EXPRTYPE_FUNCTION_ARGUMENT_SEPARATOR = 10;
+ static final int EXPRTYPE_ELEMENT = 11;
static final int CLASS_NUMERIC = 100;
static final int CLASS_BOOLEAN = 101;
@@ -220,6 +223,9 @@
theTopOfStackExprType = ExpressionType.CLASS_NUMERIC;
}
}
+ else if (currChar == '/' ) {
+ return parseElement();
+ }
else {
theStatus = -1;
return false;
@@ -408,6 +414,71 @@
return proceed;
}
+ private boolean parseElement() throws BadLocationException {
+ theIndex++; // move past / token
+ String variable = DIVIDE;
+ char nextChar;
+ while (theIndex < theOffset) {
+ nextChar = theDocument.getChar(theIndex);
+ if (isLocationPathCharacter(nextChar)) {
+ variable = variable + nextChar;
+ }
+ else if (nextChar == '[') {
+ theCallStack.push(new ExpressionType(ExpressionType.EXPRTYPE_ELEMENT, variable));
+ theCallStack.push(new ExpressionType(ExpressionType.EXPRTYPE_NEW_EXPRESSION,
OPEN_BRACKET));
+ theIndex++;
+ boolean proceed = parseBooleanExpression();
+ if (proceed) {
+ nextChar = theDocument.getChar(theIndex);
+ if (nextChar == ']') {
+ try {
+ ExpressionType tempExpr = theCallStack.pop();
+ while (tempExpr.theType != ExpressionType.EXPRTYPE_NEW_EXPRESSION) {
+ // continue popping until we find a new expression type
+ tempExpr = theCallStack.pop();
+ }
+ if (tempExpr != null) {
+ if (tempExpr.theGrammar.compareTo(CLOSE_BRACKET) == 0) {
+ return true;
+ }
+ }
+ }
+ catch (EmptyStackException e) {
+ theStatus = -1;
+ return false;
+ }
+ }
+ else {
+ // in error ... maybe throw something here
+ theStatus = -1;
+ return false;
+ }
+ }
+ else {
+ return proceed;
+ }
+ }
+ else {
+ theCallStack.push(new ExpressionType(ExpressionType.EXPRTYPE_ELEMENT, variable));
+ theTopOfStackExprType = ExpressionType.EXPRTYPE_ELEMENT;
+ theIndex--;
+ return true;
+ }
+ theIndex++;
+ }
+
+ if (theIndex >= theOffset) {
+ theCallStack.push(new ExpressionType(ExpressionType.EXPRTYPE_ELEMENT, variable));
+ theStatus = 1;
+ return false;
+ //return new ProposalType(ProposalType.PROPTYPE_VARIABLE, variable);
+ }
+
+ // shouldn't get here
+ theStatus = -1;
+ return false;
+ }
+
// parse word found in numeric expression
private boolean parseWord() throws BadLocationException {
String word = EMPTY_STRING;
@@ -814,6 +885,9 @@
return (new ProposalType(0, EMPTY_STRING));
}
return new ProposalType(ProposalType.PROPTYPE_OPERATOR, EMPTY_STRING);
+
+ case ExpressionType.EXPRTYPE_ELEMENT:
+ return new ProposalType(ProposalType.PROPTYPE_ELEMENT, EMPTY_STRING);
default:
return (new ProposalType(0, EMPTY_STRING));
@@ -831,7 +905,13 @@
tempContext = startOfFunction(viewer, offset);
if (tempContext != null) {
return new ProposalType(ProposalType.PROPTYPE_FUNCTION, tempContext);
- }
+ }
+
+ tempContext = startOfElement(viewer, offset);
+ if (tempContext != null) {
+ return new ProposalType(ProposalType.PROPTYPE_ELEMENT, tempContext);
+ }
+
return new ProposalType(ProposalType.PROPTYPE_FUNCTION |
ProposalType.PROPTYPE_VARIABLE, EMPTY_STRING);
}
@@ -851,13 +931,13 @@
String varlinkStart = EMPTY_STRING;
if (propType.isVariableAndFunction()) {
- theToggle = (theToggle+1) % 4;
+ theToggle = (theToggle+1) % 5;
funcStart = propType.theBeginsWith;
varlinkStart = propType.theBeginsWith;
}
else if (propType.isVariable()) {
if (toggle)
- theToggle = (theToggle+1) % 4;
+ theToggle = (theToggle+1) % 5;
else
theToggle = 0;
funcStart = EMPTY_STRING;
@@ -865,7 +945,7 @@
}
else if (propType.isFunction()) {
if (toggle)
- theToggle = (theToggle+1) % 4;
+ theToggle = (theToggle+1) % 5;
else
theToggle = 1;
funcStart = propType.theBeginsWith;
@@ -873,13 +953,22 @@
}
else if (propType.isOperator()) {
if (toggle)
- theToggle = (theToggle+1) % 4;
+ theToggle = (theToggle+1) % 5;
else
theToggle = 2;
funcStart = EMPTY_STRING;
varlinkStart = EMPTY_STRING;
}
+ else if (propType.isElement()) {
+ if (toggle)
+ theToggle = (theToggle+1) % 5;
+ else
+ theToggle = 3;
+ funcStart = EMPTY_STRING;
+ varlinkStart = EMPTY_STRING;
+ }
+
switch (theToggle) {
case 0:
theContentAssistant.setStatusMessage(Messages.getString("ExpressionContentAssistProcessor.44"));
//$NON-NLS-1$
@@ -901,6 +990,9 @@
theContentAssistant.setStatusMessage(Messages.getString("ExpressionContentAssistProcessor.49"));
//$NON-NLS-1$
//return generateTemplateProposals(tempStart, offset);
return (fXpathTemplates.computeCompletionProposals(viewer, offset));
+
+ case 4:
+ return generateVariableProposals(varlinkStart, offset);
}
return null;
@@ -1315,5 +1407,306 @@
private boolean isClosingExpressionCharacter(char c) {
return (RESERVED_CLOSING_EXPR_CHARS.indexOf(c) > -1);
- }
+ }
+
+ // simple form of determining if message part or XSD Element is located at offset
+ String startOfElement(ITextViewer viewer, int offset) {
+ int startPosition = offset-1;
+ char currChar;
+ String context = EMPTY_STRING;
+ IDocument document = viewer.getDocument();
+
+ try {
+ while (startPosition >= 0) {
+ currChar = document.getChar(startPosition);
+
+ if (currChar == '/')
+ return context;
+
+ if (!(Character.isLetterOrDigit(currChar)
+ || currChar == '.' || currChar == '@' || currChar == '_'))
+ return null;
+
+ context = currChar + context;
+ startPosition--;
+ }
+ }
+ catch (Exception e) {
+ System.out.println(e.toString());
+ }
+ return null;
+ }
+
+ /**
+ * From model, determine list of XSD elements or message parts the user may want to
choose from.
+ */
+
+ ICompletionProposal[] generateElementProposals(String context, int offset) {
+ boolean seekChildren = false;
+
+ String context2;
+ if ((context.length() > 0) && (context.charAt(0) == '/'))
+ context2 = context.substring(1);
+ else
+ context2 = context;
+
+ int slash = context2.indexOf('/');
+ int dot = context2.indexOf('.');
+ int at = context2.indexOf('@');
+
+ if ((slash > -1) || (dot > -1) || (at > -1))
+ seekChildren = true;
+
+ Variable[] variables = BPELUtil.getVisibleVariables((EObject)theModel);
+ ArrayList<ICompletionProposal> results = new
ArrayList<ICompletionProposal>();
+ CompletionProposal prop = null;
+ String name;
+ Variable currVar = null;
+ XSDTypeDefinition currXsdType = null;
+ Message currMsg = null;
+ XSDElementDeclaration currXsdElem = null;
+
+ Image varImg = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_VARIABLE_16);
+ Image partImg = BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_PART_16);
+ Image elementImg =
BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_XSD_ELEMENT_DECLARATION_16);
+ Image attrImg =
BPELUIPlugin.INSTANCE.getImage(IBPELUIConstants.ICON_XSD_ATTRIBUTE_DECLARATION_16);
+ try
+ {
+ if (seekChildren) {
+ // walk down path
+ int index = 0;
+ int level = 0;
+ int token = -1;
+ char t = 0;
+ String levelName;
+
+ while (index < context2.length()) {
+ t = context2.charAt(index);
+ if ((t == '.') || (t == '/')) {
+ levelName = context2.substring(token+1, index);
+ /*
+ // check for namespace
+ int ns = levelName.indexOf(':');
+ if (ns > -1) {
+ levelNSPrefix = levelName.substring(0, ns);
+ levelName = levelName.substring(ns+1);
+ }
+ else
+ levelNSPrefix = null;
+ */
+
+ // find variable
+ if (level == 0) {
+ for (int i=0; i<variables.length; i++) {
+ if (levelName.compareTo(variables[i].getName()) == 0) {
+ currVar = variables[i];
+ currXsdType = currVar.getType();
+ currMsg = currVar.getMessageType();
+ currXsdElem = currVar.getXSDElement();
+
+ level++;
+ break;
+ }
+ }
+ if (currVar == null)
+ break;
+ }
+ // traverse down
+ else {
+ boolean childFound = false;
+ if (context2.charAt(token) == '.') {
+ if (currMsg != null) {
+ if (currMsg.getParts() != null) {
+ for(Object next : currMsg.getParts().values()) {
+ Part item = (Part) next ;
+ if (levelName.compareTo(item.getName()) == 0) {
+ currXsdType = item.getTypeDefinition();
+ currMsg = item.getEMessage();
+ currXsdElem = item.getElementDeclaration();
+ childFound = true;
+ break;
+ }
+ }
+ }
+ }
+ if (!childFound)
+ break;
+ }
+ // search for child objects
+ else if (context2.charAt(token) == '/') {
+ if (currXsdType == null) {
+ if (currXsdElem != null) {
+ currXsdType = currXsdElem.getTypeDefinition();
+ }
+ }
+ if (currXsdType instanceof XSDComplexTypeDefinition) {
+ XSDComplexTypeDefinition xsdcomplex = (XSDComplexTypeDefinition)currXsdType;
+
+ for(Object next : XSDUtils.getChildElements(xsdcomplex)) {
+ XSDElementDeclaration elem =
((XSDElementDeclaration)next).getResolvedElementDeclaration();
+ String elemName = elem.getName();
+ if (elem.getTargetNamespace() != null) {
+ String elemNSPrefix = getNamespacePrefix(currVar, elem.getTargetNamespace());
+ if (elemNSPrefix != null) {
+ elemName = elemNSPrefix + COLON + elemName;
+ }
+ }
+
+ if (levelName.compareTo(elemName) == 0) {
+ currXsdType = elem.getTypeDefinition();
+ currXsdElem = null;
+ currMsg = null;
+ //currXsdElem = elem.getResolvedElementDeclaration();
+ childFound = true;
+ break;
+ }
+ }
+ }
+ else if (currXsdType instanceof XSDSimpleTypeDefinition) {
+ XSDSimpleTypeDefinition xsdsimple = (XSDSimpleTypeDefinition)currXsdType;
+ //currXsdType = xsdsimple.getBaseType();
+ //XSDSimpleTypeDefinition tempsimple = xsdsimple.getBaseTypeDefinition();
+ //org.eclipse.xsd.XSDParticle temppart = xsdsimple.getComplexType();
+ //XSDSimpleTypeDefinition tempsimple2 = xsdsimple.getItemTypeDefinition();
+ String tempname = xsdsimple.getName();
+ if (levelName.compareTo(tempname) == 0) {
+ childFound = true;
+ }
+ }
+ if (!childFound)
+ break;
+ }
+ }
+ token = index;
+ }
+ else if (t == '@')
+ token = index;
+
+ index++;
+ }
+ // determine if last character is a special character if above is successful
+ if (index == context2.length()) {
+ // looking for parts, attributes or elements?
+ String beginsWith;
+ if ((index-1) == token)
+ beginsWith = EMPTY_STRING;
+ else
+ beginsWith = context2.substring(token+1);
+
+ if ((context2.charAt(token) == '/') || (context2.charAt(token) ==
'@')) {
+ if (currXsdType == null) {
+ if (currXsdElem != null) {
+ currXsdType = currXsdElem.getTypeDefinition();
+ }
+ }
+ if (currXsdType instanceof XSDComplexTypeDefinition) {
+ XSDComplexTypeDefinition xsdcomplex = (XSDComplexTypeDefinition)currXsdType;
+ @SuppressWarnings("rawtypes")
+ Iterator eaIter;
+ if (context2.charAt(token) == '/')
+ eaIter = XSDUtils.getXSDElementsAndAttributes(xsdcomplex).iterator();
+ else
+ eaIter = XSDUtils.getChildAttributes(xsdcomplex).iterator();
+ Image img = null;
+ String tempReplName = null;
+ String tempDispName = null;
+ String namespace = null;
+ String nsprefix = null;
+ while (eaIter.hasNext()) {
+ Object tempEA = eaIter.next();
+
+ if (tempEA instanceof XSDAttributeDeclaration) {
+ XSDAttributeDeclaration attr = (XSDAttributeDeclaration)tempEA;
+ tempReplName = AT + attr.getName();
+ tempDispName = attr.getName();
+ namespace = attr.getTargetNamespace();
+ if ((namespace != null) && (namespace.length() > 0)) {
+ nsprefix = getNamespacePrefix(currVar, namespace);
+ tempReplName = AT + nsprefix + COLON + attr.getName();
+ tempDispName = nsprefix + COLON + tempDispName;
+ }
+ img = attrImg;
+ }
+ else if (tempEA instanceof XSDElementDeclaration) {
+ XSDElementDeclaration elem =
((XSDElementDeclaration)tempEA).getResolvedElementDeclaration();
+ tempReplName = elem.getName();
+ tempDispName = tempReplName;
+ namespace = elem.getTargetNamespace();
+ if ((namespace != null) && (namespace.length() > 0)) {
+ nsprefix = getNamespacePrefix(currVar, namespace);
+ tempReplName = nsprefix + COLON + tempDispName;
+ tempDispName = tempReplName;
+ }
+ img = elementImg;
+ }
+ if (tempReplName != null) {
+ if ((beginsWith.length() == 0) || (tempDispName != null &&
tempDispName.startsWith(beginsWith))) {
+ int replOffset = offset-beginsWith.length();
+ int replLen = beginsWith.length();
+ if (context2.charAt(token) == '@') {
+ replOffset--;
+ replLen++;
+ }
+
+ prop = new CompletionProposal(tempReplName, replOffset, replLen,
+ tempReplName.length(), img, tempDispName + " " , //$NON-NLS-1$
+ null, null);
+ results.add(prop);
+ }
+ }
+ tempReplName = null;
+ tempDispName = null;
+ }
+ }
+// else if (currXsdType instanceof XSDSimpleTypeDefinition) {
+// XSDSimpleTypeDefinition simple = (XSDSimpleTypeDefinition)currXsdType;
+// // do nothing?
+// }
+ }
+ // search for parts
+ else if (context2.charAt(token) == '.') {
+ if (currMsg != null) {
+ if (currMsg.getParts() != null) {
+ for(Object next : currMsg.getParts().values() ) {
+ Part item = (Part) next;
+ if ((beginsWith.length() == 0) || (item.getName().startsWith(beginsWith))) {
+ prop = new CompletionProposal(item.getName(), offset-beginsWith.length(),
beginsWith.length(),
+ item.getName().length(), partImg, item.getName() + " " ,
//$NON-NLS-1$
+ null, null);
+ results.add(prop);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ //variables
+ else {
+ for (Variable v : variables) {
+ name = v.getName();
+ if (name.startsWith(context2)) {
+ prop = new CompletionProposal(DIVIDE + name, offset-context.length(),
context.length(),
+ name.length()+1, varImg, name + " " , //$NON-NLS-1$
+ null, null);
+ results.add(prop);
+ }
+ }
+ }
+ }
+ catch(IllegalArgumentException ex)
+ {
+ results.toArray(EMPTY_COMPLETION_PROPOSALS);
+ }
+
+ if (results.size() < 1) {
+ return new ICompletionProposal [] {
+ new CompletionProposal(EMPTY_STRING, offset, 0,
+ 0, null, Messages.getString("ExpressionContentAssistProcessor.31"),
//$NON-NLS-1$
+ null, null) };
+ }
+
+ return results.toArray(EMPTY_COMPLETION_PROPOSALS);
+ }
+
}
\ No newline at end of file
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/details/providers/OperationContentProvider.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/details/providers/OperationContentProvider.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/details/providers/OperationContentProvider.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -13,8 +13,11 @@
import java.util.List;
import org.eclipse.bpel.model.Invoke;
+import org.eclipse.bpel.model.OnEvent;
+import org.eclipse.bpel.model.PartnerLink;
import org.eclipse.bpel.model.Receive;
import org.eclipse.bpel.model.Reply;
+import org.eclipse.bpel.model.partnerlinktype.Role;
import org.eclipse.wst.wsdl.PortType;
/**
@@ -54,5 +57,19 @@
collectElements ( invoke.getPortType(), list );
return ;
}
+
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // for event handlers, the operation comes from partnerlink role
+ if (input instanceof OnEvent) {
+ OnEvent onEvent = (OnEvent) input;
+ PartnerLink partnerLink = onEvent.getPartnerLink();
+ if (partnerLink != null) {
+ Role myRole = partnerLink.getMyRole();
+ if (myRole != null) {
+ collectElements ( myRole.getPortType(), list );
+ }
+ }
+ return ;
+ }
}
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/factories/BPELUIObjectFactory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/factories/BPELUIObjectFactory.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/factories/BPELUIObjectFactory.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -276,7 +276,10 @@
Sequence sequence = BPELFactory.eINSTANCE.createSequence();
sequence.getActivities().add(
BPELFactory.eINSTANCE.createCompensate());
- sequence.getActivities().add(BPELFactory.eINSTANCE.createRethrow());
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // don't generate a rethrow for CompensationHandlers
+ if (result instanceof CatchAll || result instanceof Catch)
+ sequence.getActivities().add(BPELFactory.eINSTANCE.createRethrow());
if (result instanceof Catch) {
Catch _catch = (Catch) result;
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -1832,7 +1832,16 @@
private Variable findVariable ( EObject input, Message msg , PartnerLink pl ) {
- Variable list[] = ModelHelper.getVariablesOfType( input, msg );
+ Variable list[] = null;
+
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // this property section is also used by OnEvent
+ if (input instanceof OnEvent) {
+ OnEvent oe = (OnEvent)input;
+ list = new Variable[] { oe.getVariable() };
+ }
+ else
+ list = ModelHelper.getVariablesOfType( input, msg );
if ( list.length == 1 ) {
return list[0];
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -64,6 +64,8 @@
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
@@ -379,7 +381,21 @@
}
}
});
+
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // do the same thing when variable name widget loses focus
+ inputVariableText.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent arg0) {
+ }
+
+ public void focusLost(FocusEvent arg0) {
+ findAndSetOrCreateVariable(inputVariableText.getText(),
+ isInvoke() ? ModelHelper.OUTGOING
+ : ModelHelper.INCOMING);
+ }
+ });
+
data = new FlatFormData();
data.right = new FlatFormAttachment(100, 0);
data.top = new FlatFormAttachment(inputVariableText, +2, SWT.TOP);
@@ -417,6 +433,11 @@
FlatFormData data;
final Composite composite = this.outputVariableComposite =
createFlatFormComposite(parent);
+ if (isReceive()) {
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // don't even bother creating widgets we will never use
+ return composite;
+ }
data = new FlatFormData();
if (top == null) {
@@ -1019,7 +1040,9 @@
}
private boolean isReceive() {
- return getInput() instanceof Receive || getInput() instanceof OnMessage;
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // OnEvent is also a type of Receive
+ return getInput() instanceof Receive || getInput() instanceof OnMessage || getInput()
instanceof OnEvent;
}
/**
@@ -1078,6 +1101,11 @@
private void updateInputVariableWidgets() {
inputVariableComposite.setVisible(!isReply());
+ if (getInput() instanceof OnEvent) {
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // hide the proposal drop-down button - user must enter variable name
+ inputVariableButton.setVisible(false);
+ }
if (isReply())
return;
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -25,6 +25,7 @@
import org.eclipse.bpel.model.Query;
import org.eclipse.bpel.model.To;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.impl.VariableImpl;
import org.eclipse.bpel.model.messageproperties.Property;
import org.eclipse.bpel.model.util.BPELConstants;
import org.eclipse.bpel.model.util.BPELUtils;
@@ -59,6 +60,7 @@
import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDNamedComponent;
import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.impl.XSDTypeDefinitionImpl;
/**
* An AssignCategory presenting a tree from which the user can select any of: -
@@ -493,7 +495,7 @@
if (query == null)
return;
Variable var = side.getVariable();
- if (isInitializerExist(var, side))
+ if (needInitializer(var, side))
return;
if (MessageDialog
.openQuestion(
@@ -508,7 +510,7 @@
}
}
- private boolean isInitializerExist(Variable var, IVirtualCopyRuleSide side) {
+ private boolean needInitializer(Variable var, IVirtualCopyRuleSide side) {
Assign a = (Assign) ((To) side.getCopyRuleSide()).getContainer()
.getContainer();
EList<Copy> list = a.getCopy();
@@ -527,6 +529,50 @@
if (p.equals(side.getPart()))
return true;
}
+
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // check if initialization is possible: this is not possible if the
+ // variable is implicit (e.g. in a ForEach or OnEvent)
+ String rootElement = null;
+ String uriWSDL = null;
+
+ // Variable is defined using "messageType"
+ Message msg = var.getMessageType();
+ if (msg != null && !msg.eIsProxy()) {
+ //
https://jira.jboss.org/browse/JBIDE-6697
+ // from
eclipse.org/bpel rev 1.17 on 7/23/2010 3:13AM bugzilla 302943 by gqian: apply
the patch from bugzilla
+ if (side.getPart() != null) {
+ XSDElementDeclaration declaration = side.getPart().getElementDeclaration();
+ if (declaration != null) {
+ uriWSDL = declaration.getSchema().getSchemaLocation();
+ rootElement = declaration.getName();
+ }
+ }
+ }
+
+ // can we construct an initializer for this variable?
+ // Variable is defined using "type"
+ XSDTypeDefinitionImpl type = (XSDTypeDefinitionImpl)var.getType();
+ if (type != null && !type.eIsProxy()) {
+ QName qname = new QName(type.getTargetNamespace(), type.getName());
+ rootElement = qname.getLocalPart();
+ uriWSDL = type.eResource().getURI().toString();
+ }
+
+ // Variable is defined using "element"
+ XSDElementDeclaration element = var.getXSDElement();
+ if (element != null && !element.eIsProxy()) {
+ QName qname = new QName(element.getTargetNamespace(), element
+ .getName());
+ rootElement = qname.getLocalPart();
+ uriWSDL = element.eResource().getURI().toString();
+ }
+
+ // Incomplete variable definition
+ if (rootElement == null || uriWSDL == null) {
+ return true;
+ }
+
return false;
}
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 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariableTypeSelector.java 2011-01-07
16:05:01 UTC (rev 27984)
@@ -617,7 +617,10 @@
dataTypeNameText.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
- BPELUtil.openEditor(getVariableType(), bpelEditor);
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // don't bother trying to open editor if variable is not defined
+ if (getVariableType() != null)
+ BPELUtil.openEditor(getVariableType(), bpelEditor);
}
});
@@ -686,8 +689,10 @@
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);
+ //
https://issues.jboss.org/browse/JBIDE-8048
+ // make the message structure viewer a wee bit larger than just a single line
+ data.bottom = new FlatFormAttachment(dataTypeTreeLabel,150, SWT.BOTTOM); //new
FlatFormAttachment(100, -IDetailsAreaConstants.HSPACE);
+ dataTypeTree.setLayoutData(data);
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties 2011-01-07
16:02:36 UTC (rev 27983)
+++
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties 2011-01-07
16:05:01 UTC (rev 27984)
@@ -626,10 +626,10 @@
# {0} : node
# {1} : fault QName
BPELC_CATCH__STANDARD_FAULT.summary = Standard fault "{1}" cannot be \
- handled in <{0}> when existOnStandardFaults is set to yes.
+ handled in <{0}> when exitOnStandardFaults is set to yes.
BPELC_CATCH__STANDARD_FAULT = Standard fault "{1}" cannot be \
- handled in <{0}> when existOnStandardFaults is set to yes.
-BPELC_CATCH__STANDARD_FAULT.fix = Remove the handler or disable exit on standard faults.
+ handled in <{0}> when exitOnStandardFaults is set to yes.
+BPELC_CATCH__STANDARD_FAULT.fix = Remove the handler or set "Exit On Standard
Faults" to "No" for this process.
#
# BPELC_CATCH__EXIST
# {0}: node name