Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracuccuru2011-07-22 07:44:54 +0000
committeracuccuru2011-07-22 07:44:54 +0000
commit6940ce83c93f0c7740c9188f0cd3c9a87e9449ec (patch)
tree60fd0573d344b70e01f2af1bb519277bb11c1fd0 /extraplugins/alf
parent0c4c2c74dfeeef764ce324251a16b508dcfe9805 (diff)
downloadorg.eclipse.papyrus-6940ce83c93f0c7740c9188f0cd3c9a87e9449ec.tar.gz
org.eclipse.papyrus-6940ce83c93f0c7740c9188f0cd3c9a87e9449ec.tar.xz
org.eclipse.papyrus-6940ce83c93f0c7740c9188f0cd3c9a87e9449ec.zip
Merged with branch
Diffstat (limited to 'extraplugins/alf')
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/.classpath4
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java10
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/NamingUtils.java2
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/PredefinedBehaviorsAndTypesUtils.java41
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacadeFactory.java6
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeFacade.java2
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java14
7 files changed, 48 insertions, 31 deletions
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/.classpath b/extraplugins/alf/org.eclipse.papyrus.alf/.classpath
index 48aa7f6e91a..2f6f3f6d779 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/.classpath
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/.classpath
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java
index 7016fad014d..1046dedf39e 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java
@@ -445,7 +445,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
if (upperBoundExpression1 > 1 || upperBoundExpression1 == -1)
errorMessageForExpression1 += "A scalar value is expected" ;
}
- if (!errorMessageForExpression1.isEmpty()) {
+ if (!(errorMessageForExpression1.length() == 0)) {
error(errorMessageForExpression1, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX) ;
}
TypeFacade typeFacadeOfExpression2 = typeOfExpression2.getTypeFacade() ;
@@ -461,7 +461,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
if (upperBoundExpression2 > 1 || upperBoundExpression2 == -1)
errorMessageForExpression2 += "A scalar value is expected" ;
}
- if (!errorMessageForExpression2.isEmpty()) {
+ if (!(errorMessageForExpression2.length() == 0)) {
error(errorMessageForExpression2, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression2(), INSIGNIFICANT_INDEX) ;
}
}
@@ -916,7 +916,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
&& statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) ||
(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) ||
(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()==null) ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId().isEmpty())) {
+ (statement.getTypePart_OR_assignedPart_OR_invocationPart().getId().length() == 0)) {
error("The assigned part must resolve to an assignable property, parameter or local variable",
AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
return ;
@@ -928,7 +928,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0) ;
String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved) ;
- if (!potentialAssignmentError.isEmpty()) {
+ if (!(potentialAssignmentError.length() == 0)) {
error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
return ;
}
@@ -1108,7 +1108,7 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
AlfPartialScope varParamPropScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
EObject resolved = varParamPropScope.resolveByName(statement.getTypePart_OR_assignedPart_OR_invocationPart().getId()).get(0) ;
String potentialAssignmentError = AssignmentPolicy.eInstance.isAssignable(resolved) ;
- if (!potentialAssignmentError.isEmpty()) {
+ if (!(potentialAssignmentError.length() == 0)) {
error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
}
}
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/NamingUtils.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/NamingUtils.java
index 5aca4c5341f..f273545ce48 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/NamingUtils.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/NamingUtils.java
@@ -12,7 +12,7 @@ public class NamingUtils {
* @return true if the name is Java-compliant, false otherwise
*/
public static boolean isJavaCompliant(String name) {
- if (name.isEmpty())
+ if (name.length() == 0)
return false ;
int firstChar = 0 ;
char[] dst = new char[name.length()] ;
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/PredefinedBehaviorsAndTypesUtils.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/PredefinedBehaviorsAndTypesUtils.java
index 20141b7b1b3..0af6eddf173 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/PredefinedBehaviorsAndTypesUtils.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/PredefinedBehaviorsAndTypesUtils.java
@@ -37,6 +37,32 @@ public class PredefinedBehaviorsAndTypesUtils {
private List<Classifier> classifierInsertedAsElementImport = new ArrayList<Classifier>();
public void init(org.eclipse.uml2.uml.Package library) {
+ behaviorMap = new HashMap<String, List<SignatureFacade>>();
+ typeMap = new HashMap<String, TypeFacade>() ;
+ behaviorInsertedAsElementImport = new ArrayList<Behavior>() ;
+ classifierInsertedAsElementImport = new ArrayList<Classifier>() ;
+ localInit(library) ;
+ // initializes predefined type facades from TypeUtils
+ TypeUtils._bitString = typeMap.get("BitString") ;
+ TypeUtils._boolean = typeMap.get("Boolean") ;
+ TypeUtils._integer = typeMap.get("Integer") ;
+ TypeUtils._natural = typeMap.get("Natural") ;
+ TypeUtils._string = typeMap.get("String") ;
+ TypeUtils._undefined = new TypeFacade();
+ TypeUtils._unlimited = typeMap.get("UnlimitedNatural") ;
+ TypeUtils._nullExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._undefined) ;
+ TypeUtils._Collection = typeMap.get("Collection") ;
+ TypeUtils._Set = typeMap.get("Set");
+ TypeUtils._Bag = typeMap.get("Bag") ;
+ TypeUtils._Queue = typeMap.get("Queue") ;
+ TypeUtils._OrderedSet = typeMap.get("OrderedSet") ;
+ TypeUtils._List = typeMap.get("List") ;
+ TypeUtils._Deque = typeMap.get("Deque") ;
+ TypeUtils._Map = typeMap.get("Map") ;
+ TypeUtils._Entry = typeMap.get("Entry") ;
+ }
+
+ private void localInit(org.eclipse.uml2.uml.Package library) {
for (NamedElement n : library.getOwnedMembers()) {
if (n instanceof Behavior) {
insertSignatureFacade(new SignatureFacade((Behavior)n)) ;
@@ -45,7 +71,7 @@ public class PredefinedBehaviorsAndTypesUtils {
insertTypeFacade(TypeFacadeFactory.eInstance.createTypeFacade(n)) ;
}
else if (n instanceof org.eclipse.uml2.uml.Package) {
- init((org.eclipse.uml2.uml.Package)n) ;
+ localInit((org.eclipse.uml2.uml.Package)n) ;
}
}
for (ElementImport eImport : library.getElementImports()) {
@@ -58,21 +84,12 @@ public class PredefinedBehaviorsAndTypesUtils {
classifierInsertedAsElementImport.add((Classifier)eImport.getImportedElement()) ;
}
else if (eImport.getImportedElement() instanceof org.eclipse.uml2.uml.Package) {
- init((org.eclipse.uml2.uml.Package)eImport.getImportedElement()) ;
+ localInit((org.eclipse.uml2.uml.Package)eImport.getImportedElement()) ;
}
}
for (PackageImport pImport : library.getPackageImports()) {
- init(pImport.getImportedPackage()) ;
+ localInit(pImport.getImportedPackage()) ;
}
- // initializes predefined type facades from TypeUtils
- TypeUtils._bitString = typeMap.get("BitString") ;
- TypeUtils._boolean = typeMap.get("Boolean") ;
- TypeUtils._integer = typeMap.get("Integer") ;
- TypeUtils._natural = typeMap.get("Natural") ;
- TypeUtils._string = typeMap.get("String") ;
- TypeUtils._undefined = new TypeFacade();
- TypeUtils._unlimited = typeMap.get("UnlimitedNatural") ;
- TypeUtils._nullExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._undefined) ;
TypeUtils._Collection = typeMap.get("Collection") ;
TypeUtils._Set = typeMap.get("Set");
TypeUtils._Bag = typeMap.get("Bag") ;
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacadeFactory.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacadeFactory.java
index 0fb94825171..5aa86f9e548 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacadeFactory.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacadeFactory.java
@@ -130,7 +130,7 @@ public class SignatureFacadeFactory {
throw new Exception(errorMessage) ;
}
String potentialErrorMessage = constructor.isCompatibleWithMe(arguments, true) ;
- if (potentialErrorMessage.isEmpty())
+ if (potentialErrorMessage.length() == 0)
return constructor ;
else
throw new Exception(potentialErrorMessage) ;
@@ -140,7 +140,7 @@ public class SignatureFacadeFactory {
//must match arguments with visible properties of the data type
SignatureFacade defaultDataTypeConstructor = new DefaultConstructorFacade((DataType)referencedType) ;
String errorMessage = defaultDataTypeConstructor.isCompatibleWithMe(arguments, true) ;
- if (!errorMessage.isEmpty())
+ if (!(errorMessage.length() == 0))
throw new Exception(errorMessage) ;
else
return defaultDataTypeConstructor ;
@@ -269,7 +269,7 @@ public class SignatureFacadeFactory {
throw new Exception(errorMessage) ;
}
String potentialErrorMessage = constructor.isCompatibleWithMe(arguments, true) ;
- if (potentialErrorMessage.isEmpty())
+ if (potentialErrorMessage.length() == 0)
return constructor ;
else
throw new Exception(potentialErrorMessage) ;
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeFacade.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeFacade.java
index c735763326b..c21fe56259d 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeFacade.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeFacade.java
@@ -158,7 +158,7 @@ public class TypeFacade {
}
public String getLabel() {
- return "" + this.templateBindingFacade.getLabel() ;
+ return "" ; // TODO: uncomment when template bindings are supported + this.templateBindingFacade.getLabel() ;
}
}
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java
index d7507dfdc5a..430fc8b9fed 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java
@@ -592,7 +592,7 @@ public class TypeUtils {
return typeOfOperationCall ;
}
else if (exp.getOperationCallWithoutDot() != null) {
- if (exp.getClassName() == null || exp.getClassName().isEmpty()) {
+ if (exp.getClassName() == null || exp.getClassName().length() == 0) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
"Classifier name is missing",
exp,
@@ -832,7 +832,7 @@ public class TypeUtils {
else {
SignatureFacade operationOrBehaviorSignature = new SignatureFacade(visibleOperationOrBehaviors.get(0)) ;
String argumentsAreCompatible = operationOrBehaviorSignature.isCompatibleWithMe(arguments, true) ;
- if (! argumentsAreCompatible.isEmpty()) {
+ if (! (argumentsAreCompatible.length() == 0)) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
argumentsAreCompatible,
exp,
@@ -1351,7 +1351,7 @@ public class TypeUtils {
errorMessage += "Primitive types do not have destructors." ;
else if (arguments.size() > 0)
errorMessage += "Default destructor has not parameters" ;
- if (! errorMessage.isEmpty()) {
+ if (! (errorMessage.length() == 0)) {
error = TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containingFeature) ;
return TypeExpressionFactory.eInstance.createTypeExpression(error) ;
}
@@ -1394,7 +1394,7 @@ public class TypeUtils {
else {
SignatureFacade operationSignature = selectedSignatures.get(0) ;
String argumentsAreCompatible = operationSignature.isCompatibleWithMe(arguments, true) ;
- if (! argumentsAreCompatible.isEmpty()) {
+ if (! (argumentsAreCompatible.length() == 0)) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
argumentsAreCompatible,
exp,
@@ -1408,7 +1408,7 @@ public class TypeUtils {
typeOfSuffix = TypeExpressionFactory.eInstance.createTypeExpression(matchingOperations.get(0)) ;
SignatureFacade operationSignature = new SignatureFacade(matchingOperations.get(0)) ;
String argumentsAreCompatible = operationSignature.isCompatibleWithMe(arguments, true) ;
- if (! argumentsAreCompatible.isEmpty()) {
+ if (! (argumentsAreCompatible.length() == 0)) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
argumentsAreCompatible,
exp,
@@ -1474,7 +1474,7 @@ public class TypeUtils {
else {
SignatureFacade operationSignature = selectedSignatures.get(0) ;
String argumentsAreCompatible = operationSignature.isCompatibleWithMe(arguments, true) ;
- if (! argumentsAreCompatible.isEmpty()) {
+ if (! (argumentsAreCompatible.length() == 0)) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
argumentsAreCompatible,
exp,
@@ -1488,7 +1488,7 @@ public class TypeUtils {
typeOfSuffix = TypeExpressionFactory.eInstance.createTypeExpression(matchingOperations.get(0)) ;
SignatureFacade operationSignature = new SignatureFacade(matchingOperations.get(0)) ;
String argumentsAreCompatible = operationSignature.isCompatibleWithMe(arguments, true) ;
- if (! argumentsAreCompatible.isEmpty()) {
+ if (! (argumentsAreCompatible.length() == 0)) {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
argumentsAreCompatible,
exp,

Back to the top