Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracuccuru2011-07-07 10:09:44 +0000
committeracuccuru2011-07-07 10:09:44 +0000
commitd3f33ee90c18512031fe8d8c5adc7ddbe3ab92ed (patch)
treedcfcd7362fadc2bff112643d80742c92f312262f /extraplugins
parente13902371af40c4e4934a82a7b7b8005145ef658 (diff)
downloadorg.eclipse.papyrus-d3f33ee90c18512031fe8d8c5adc7ddbe3ab92ed.tar.gz
org.eclipse.papyrus-d3f33ee90c18512031fe8d8c5adc7ddbe3ab92ed.tar.xz
org.eclipse.papyrus-d3f33ee90c18512031fe8d8c5adc7ddbe3ab92ed.zip
Merged bug corrections applied on the branch
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/.settings/net.sf.jautodoc.prefs2
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/AlfJavaValidator.java7
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultConstructorFacade.java16
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultDestructorFacade.java34
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacade.java15
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/TypeUtils.java33
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/.settings/net.sf.jautodoc.prefs2
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/META-INF/MANIFEST.MF7
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/plugin.xml9
-rw-r--r--extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext/src/org/eclipse/papyrus/operation/editor/xtext/scoping/OperationEditorScopingTool.java117
10 files changed, 205 insertions, 37 deletions
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/.settings/net.sf.jautodoc.prefs b/extraplugins/alf/org.eclipse.papyrus.alf/.settings/net.sf.jautodoc.prefs
index 5d537a77455..b6e01223ea6 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/.settings/net.sf.jautodoc.prefs
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/.settings/net.sf.jautodoc.prefs
@@ -1,4 +1,4 @@
-#Tue Apr 26 16:03:15 CEST 2011
+#Thu Jul 07 11:00:19 CEST 2011
add_header=true
eclipse.preferences.version=1
header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * CEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/
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 8c0e950546a..275666b43d4 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
@@ -124,7 +124,8 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
for (PackageImport pImport : contextClassifier.getModel().getPackageImports()) {
Package p = pImport.getImportedPackage() ;
if (p.getQualifiedName().equals("Alf")) {
- alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
+ //alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
+ alfStandardLibrary = (Package)p ;
}
}
//}
@@ -1091,6 +1092,10 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp()!=null) ||
(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp()!=null) ||
(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null)) {
+ if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion() != null) {
+ if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSequenceConstructionCompletion().getAccessCompletion() != null)
+ return ;
+ }
error("The left part of the assignment must resolve to an assignable property, parameter or local variable",
AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
// NOTE: this an approximation. Cf. => rule 1.d It resolves to an association end TODO: Not supported yet
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultConstructorFacade.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultConstructorFacade.java
index 23eedcddfe2..ee922d80f70 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultConstructorFacade.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultConstructorFacade.java
@@ -49,15 +49,15 @@ public class DefaultConstructorFacade extends SignatureFacade {
@Override
public String getLabel() {
- String errorMessage = classToBeConstructed != null ? classToBeConstructed.getName() : datatypeToBeConstructed.getName() ;
- errorMessage += "(" ;
+ String label = classToBeConstructed != null ? classToBeConstructed.getName() : datatypeToBeConstructed.getName() ;
+ label += "(" ;
boolean first = true ;
for (TypeExpression t : parameters) {
- if (first) first = false ; else errorMessage += ", " ;
- errorMessage += t.getLabel() ;
+ if (first) first = false ; else label += ", " ;
+ label += t.getLabel() ;
}
- errorMessage += ") : " + this.getReturnType().getLabel() ;
- return errorMessage ;
+ label += ") : " + this.getReturnType().getLabel() ;
+ return label ;
}
@Override
@@ -65,4 +65,8 @@ public class DefaultConstructorFacade extends SignatureFacade {
return true;
}
+ @Override
+ public boolean isADestructor(){
+ return false ;
+ }
}
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultDestructorFacade.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultDestructorFacade.java
new file mode 100644
index 00000000000..b9be485e640
--- /dev/null
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/DefaultDestructorFacade.java
@@ -0,0 +1,34 @@
+package org.eclipse.papyrus.alf.validation.typing;
+
+public class DefaultDestructorFacade extends SignatureFacade {
+
+ public DefaultDestructorFacade() {
+ super() ;
+ }
+
+ @Override
+ public String getName() {
+ return "destroy";
+ }
+
+ @Override
+ public boolean hasReturnType() {
+ return true;
+ }
+
+ @Override
+ public String getLabel() {
+ return "destroy()" ;
+ }
+
+ @Override
+ public boolean isAConstructor() {
+ return false;
+ }
+
+ @Override
+ public boolean isADestructor(){
+ return true ;
+ }
+
+}
diff --git a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacade.java b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacade.java
index 7afbf649819..b358010078b 100644
--- a/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacade.java
+++ b/extraplugins/alf/org.eclipse.papyrus.alf/src/org/eclipse/papyrus/alf/validation/typing/SignatureFacade.java
@@ -31,6 +31,10 @@ public class SignatureFacade {
private TypeExpression returnType = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._undefined, 0, 0, false, false) ;
private EObject actualSignatureObject = null ;
+ public SignatureFacade() {
+
+ }
+
public SignatureFacade(EObject o) {
if (o instanceof Operation) {
Operation operation = (Operation)o ;
@@ -210,4 +214,15 @@ public class SignatureFacade {
return false ;
return signature.getAppliedStereotype("Standard::Create") != null ;
}
+
+ public boolean isADestructor() {
+ Element signature = null ;
+ if (actualSignatureObject instanceof Operation || actualSignatureObject instanceof Behavior)
+ signature = (Element)actualSignatureObject ;
+ else if (actualSignatureObject instanceof ElementImport)
+ signature = (Element)((ElementImport)actualSignatureObject).getImportedElement() ;
+ if (signature == null)
+ return false ;
+ return signature.getAppliedStereotype("Standard::Destroy") != null ;
+ }
}
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 62e0d495f5b..210ad958bf3 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
@@ -69,6 +69,7 @@ import org.eclipse.papyrus.alf.validation.AlfJavaValidator;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.PrimitiveType;
public class TypeUtils {
@@ -808,7 +809,7 @@ public class TypeUtils {
ErrorTypeFacade error = TypeFacadeFactory.eInstance.createErrorTypeFacade(
errorMessage,
exp,
- AlfPackage.eINSTANCE.getOperationCallExpression_OperationName()) ;
+ AlfPackage.eINSTANCE.getNameExpression_Id()) ;
return TypeExpressionFactory.eInstance.createTypeExpression(error) ;
}
else {
@@ -864,7 +865,8 @@ public class TypeUtils {
}
else {
// need to change the multiplicity of typeOfPrefix
- typeOfPrefix.setMultiplicity(MultiplicityFacadeFactory.eInstance.createMultiplicityFacade(0, 1, false, false)) ;
+ //typeOfPrefix.setMultiplicity(MultiplicityFacadeFactory.eInstance.createMultiplicityFacade(0, 1, false, false)) ;
+ typeOfPrefix.setMultiplicity(MultiplicityFacadeFactory.eInstance.createMultiplicityFacade(1, 1, false, false)) ; // TODO: 1..1 is temporary
}
}
}
@@ -929,7 +931,6 @@ public class TypeUtils {
return getTypeOfSequenceExpansionExpression((SequenceExpansionExpression) exp, typeOfPrefix) ;
}
else if (exp instanceof SequenceOperationExpression) {
- // TODO
String errorMessage = "Sequence operation expressions are not supported in this version of the Alf editor" ;
ErrorTypeFacade unsupportedCase =
TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containtFeature) ;
@@ -940,6 +941,10 @@ public class TypeUtils {
}
}
+ public TypeExpression getTypeOfSequenceOperationExpression(SequenceOperationExpression exp, TypeExpression typeOfPrefix) {
+ return typeOfPrefix ; // TODO
+ }
+
public TypeExpression getTypeOfSequenceReductionExpression(SequenceReductionExpression exp, TypeExpression typeOfPrefix) {
int upperBoundOfPrefix = typeOfPrefix.getMultiplicityFacade().getUpperBound() ;
// first check if the prefix is a collection
@@ -1309,11 +1314,11 @@ public class TypeUtils {
public TypeExpression getTypeOfOperationCallExpression(OperationCallExpression exp, TypeExpression typeOfPrefix) {
Classifier type = typeOfPrefix.getTypeFacade().extractActualType(typeOfPrefix.getTypeFacade()) ;
EObject source = exp.eContainer() ;
- EStructuralFeature containtFeature = exp.eContainingFeature() ;
+ EStructuralFeature containingFeature = exp.eContainingFeature() ;
if (type == null) {
String errorMessage = "Type of prefix is \"any\". Could not validate suffix." ;
ErrorTypeFacade error =
- TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containtFeature) ;
+ TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containingFeature) ;
return TypeExpressionFactory.eInstance.createTypeExpression(error) ;
}
List<TypeExpression> arguments = new ArrayList<TypeExpression>() ;
@@ -1326,9 +1331,21 @@ public class TypeUtils {
List<EObject> matchingOperations = AlfScopeProvider.scopingTool.getVisibleOperationsOrBehaviors(type).resolveByName(exp.getOperationName()) ;
TypeExpression typeOfSuffix ;
if (matchingOperations.size() == 0) {
- String errorMessage = "Could not resolve operation " + exp.getOperationName() + " for classifier " + type.getName() ;
- ErrorTypeFacade error =
- TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containtFeature) ;
+ String errorMessage = "" ;
+ ErrorTypeFacade error = null ;
+ if (exp.getOperationName().equals("destroy")) {// This is the case of the default destructor
+ if (typeOfPrefix.getType().extractActualType(typeOfPrefix.getType()) instanceof PrimitiveType)
+ errorMessage += "Primitive types do not have destructors." ;
+ else if (arguments.size() > 0)
+ errorMessage += "Default destructor has not parameters" ;
+ if (! errorMessage.isEmpty()) {
+ error = TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containingFeature) ;
+ return TypeExpressionFactory.eInstance.createTypeExpression(error) ;
+ }
+ return TypeExpressionFactory.eInstance.createTypeExpression(_undefined) ;
+ }
+ errorMessage = "Could not resolve operation " + exp.getOperationName() + " for classifier " + type.getName() ;
+ error = TypeFacadeFactory.eInstance.createErrorTypeFacade(errorMessage, source, containingFeature) ;
return TypeExpressionFactory.eInstance.createTypeExpression(error) ;
}
else if (matchingOperations.size() > 1) {
diff --git a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/.settings/net.sf.jautodoc.prefs b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/.settings/net.sf.jautodoc.prefs
index 06c5cbf6c7b..86c405767e1 100644
--- a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/.settings/net.sf.jautodoc.prefs
+++ b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/.settings/net.sf.jautodoc.prefs
@@ -1,4 +1,4 @@
-#Tue Apr 26 16:04:19 CEST 2011
+#Thu Jul 07 10:59:07 CEST 2011
add_header=true
eclipse.preferences.version=1
header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * \r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * CEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/
diff --git a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/META-INF/MANIFEST.MF b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/META-INF/MANIFEST.MF
index 3a1023e21e2..30247ae307b 100644
--- a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/META-INF/MANIFEST.MF
@@ -21,9 +21,12 @@ Require-Bundle: org.eclipse.papyrus.operation.editor.xtext;visibility:=reexport,
org.eclipse.papyrus.properties.runtime;bundle-version="0.8.0",
org.eclipse.xtext.gmf.glue;bundle-version="0.8.0",
org.eclipse.papyrus.alf;bundle-version="0.8.0",
- org.eclipse.papyrus.alf.ui;bundle-version="0.8.0"
+ org.eclipse.papyrus.alf.ui;bundle-version="0.8.0",
+ org.eclipse.papyrus.diagram.common;bundle-version="0.8.0",
+ org.eclipse.papyrus.profile;bundle-version="0.8.0"
Import-Package: org.apache.log4j,
org.apache.commons.logging
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Activator: org.eclipse.papyrus.operation.editor.xtext.ui.internal.OperationActivator
-Export-Package: org.eclipse.papyrus.operation.editor.xtext.ui.contentassist.antlr
+Export-Package: org.eclipse.papyrus.operation.editor.xtext.ui.contentassist.antlr,
+ org.eclipse.papyrus.operation.editor.xtext.ui.internal
diff --git a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/plugin.xml b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/plugin.xml
index 9c8028a7d37..af19817f366 100644
--- a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/plugin.xml
+++ b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext.ui/plugin.xml
@@ -190,13 +190,4 @@
</popupeditor>
</DirectEditor>
</extension>
- <extension
- point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
- <DirectEditor
- contributor="CEA LIST"
- language="ALF"
- objectToEdit="org.eclipse.uml2.uml.Operation">
- </DirectEditor>
- </extension>
-
</plugin>
diff --git a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext/src/org/eclipse/papyrus/operation/editor/xtext/scoping/OperationEditorScopingTool.java b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext/src/org/eclipse/papyrus/operation/editor/xtext/scoping/OperationEditorScopingTool.java
index 042b30b420a..22bbeec199d 100644
--- a/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext/src/org/eclipse/papyrus/operation/editor/xtext/scoping/OperationEditorScopingTool.java
+++ b/extraplugins/alf/org.eclipse.papyrus.operation.editor.xtext/src/org/eclipse/papyrus/operation/editor/xtext/scoping/OperationEditorScopingTool.java
@@ -14,7 +14,9 @@
package org.eclipse.papyrus.operation.editor.xtext.scoping;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.alf.alf.AcceptBlock;
@@ -69,6 +71,68 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
private AlfPartialScope classifierScope ;
private AlfPartialScope packageScope ;
+ private static List<EObject> removeDuplicateClassifiers(List<EObject> list) {
+ List<EObject> intermediateFilteredList = new ArrayList<EObject>() ;
+
+ HashMap<String, Classifier> classifiers = new HashMap<String, Classifier>() ;
+ HashMap<String, Classifier> elementImports = new HashMap<String, Classifier>() ;
+ for (EObject o : list) {
+ if (o instanceof Classifier) {
+ Classifier c = (Classifier) o ;
+ if (classifiers.get(c.getQualifiedName()) == null) {
+ classifiers.put(c.getQualifiedName(), c) ;
+ intermediateFilteredList.add(c) ;
+ }
+ // else => nothing to be done, this is a duplicate
+ }
+ else if (o instanceof ElementImport) {
+ ElementImport e = (ElementImport)o ;
+ Classifier c = (Classifier)e.getImportedElement() ;
+ if (elementImports.get(e.getAlias()) == null) {
+ elementImports.put(e.getAlias(), c) ;
+ intermediateFilteredList.add(e) ;
+ }
+ else {// need to check if element import aliases the same thing.
+ Classifier alreadyInTheList = elementImports.get(e.getAlias()) ;
+ if (! alreadyInTheList.getQualifiedName().equals(c.getQualifiedName())) {
+ // The model is ill-formed, and there's no need to filter
+ intermediateFilteredList.add(e) ;
+ }
+ // else => nothing to be done, this is a duplicate
+ }
+ }
+ }
+
+ // needs to make a second pass on the filtered list, to remove cases where aliases and names are the same, and represent the same element
+ List<EObject> filteredList = new ArrayList<EObject>() ;
+ for (int i = 0 ; i < intermediateFilteredList.size() ; i++) {
+ String classifierName = (intermediateFilteredList.get(i) instanceof Classifier) ?
+ ((Classifier)intermediateFilteredList.get(i)).getName() :
+ ((ElementImport)intermediateFilteredList.get(i)).getAlias() ;
+ String classifierQualifiedName = (intermediateFilteredList.get(i) instanceof Classifier) ?
+ ((Classifier)intermediateFilteredList.get(i)).getQualifiedName() :
+ ((Classifier)((ElementImport)intermediateFilteredList.get(i)).getImportedElement()).getQualifiedName() ;
+ boolean duplicateFound = false ;
+ for (int j = i + 1 ; j < intermediateFilteredList.size() && !duplicateFound ; j++) {
+ String cddDuplicateClassifierName = (intermediateFilteredList.get(j) instanceof Classifier) ?
+ ((Classifier)intermediateFilteredList.get(j)).getName() :
+ ((ElementImport)intermediateFilteredList.get(j)).getAlias() ;
+ if (cddDuplicateClassifierName.equals(classifierName)) {
+ String cddDuplicateClassifierQualifiedName = (intermediateFilteredList.get(j) instanceof Classifier) ?
+ ((Classifier)intermediateFilteredList.get(j)).getQualifiedName() :
+ ((Classifier)((ElementImport)intermediateFilteredList.get(j)).getImportedElement()).getQualifiedName() ;
+ if (cddDuplicateClassifierQualifiedName.equals(classifierQualifiedName)) {
+ duplicateFound = true ;
+ }
+ }
+ }
+ if (!duplicateFound)
+ filteredList.add(intermediateFilteredList.get(i)) ;
+ }
+
+ return filteredList ;
+ }
+
@Override
public AlfPartialScope getVisibleVariablesOrParametersOrProperties(EObject context) {
AlfPartialScope.IGetNameStrategy nameStrategy = new OperationEditorScopingStrategies().new VariableOrParameterOrPropertyStrategies().new NameStrategy() ;
@@ -606,7 +670,9 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
potentialContextPackage = (Package)eImport.getImportedElement() ;
}
if (potentialContextPackage != null) {
- nestedScopes.add(processPublicallyImportedClassifiers(potentialContextPackage)) ;
+ List<EObject> importedClassifiers = processPublicallyImportedClassifiers(potentialContextPackage) ;
+ importedClassifiers = removeDuplicateClassifiers(importedClassifiers) ;
+ nestedScopes.add(importedClassifiers) ;
return nestedScopes ;
}
@@ -632,7 +698,18 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
nestedList.add(e) ;
}
}
+ nestedList = removeDuplicateClassifiers(nestedList) ;
nestedScopes.add(nestedList) ;
+
+ // Then process the implicit import of alf library
+ nestedList = new ArrayList<EObject>() ;
+ if (AlfJavaValidator.getAlfStandardLibrary() != null) {
+ List<EObject> importedClassifiers = processPublicallyImportedClassifiers(AlfJavaValidator.getAlfStandardLibrary()) ;
+ importedClassifiers = removeDuplicateClassifiers(importedClassifiers) ;
+ nestedList.addAll(importedClassifiers) ;
+ nestedScopes.add(nestedList) ;
+ }
+
return nestedScopes ;
}
@@ -640,17 +717,23 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
List<EObject> importedClassifiers = new ArrayList<EObject>() ;
for (NamedElement n : p.getOwnedMembers()) {
if (n instanceof Classifier)
- if (((Classifier)n).getVisibility() != VisibilityKind.PRIVATE_LITERAL)
- importedClassifiers.add(n) ;
+ if (((Classifier)n).getVisibility() != VisibilityKind.PRIVATE_LITERAL) {
+
+ importedClassifiers.add(n) ;
+ }
}
for (ElementImport eImport : p.getElementImports()) {
if (eImport.getVisibility()!= VisibilityKind.PRIVATE_LITERAL) {
PackageableElement element = eImport.getImportedElement() ;
if (element instanceof Classifier) {
- if (eImport.getAlias() != null)
- importedClassifiers.add(eImport) ;
- else
- importedClassifiers.add(element) ;
+
+ if (eImport.getAlias() != null) {
+ importedClassifiers.add(eImport) ;
+ }
+ else {
+ importedClassifiers.add(element) ;
+ }
+
}
}
}
@@ -701,9 +784,10 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
nestedList.addAll(processPublicallyImportedPackages(contextClassifier)) ;
nestedScopes.add(nestedList) ;
- // Then process the implicit import of alf::library
+ // Then process the implicit import of alf library
nestedList = new ArrayList<EObject>() ;
if (AlfJavaValidator.getAlfStandardLibrary() != null) {
+ nestedList.add(AlfJavaValidator.getAlfStandardLibrary()) ;
nestedList.addAll(processPublicallyImportedPackages(AlfJavaValidator.getAlfStandardLibrary())) ;
nestedScopes.add(nestedList) ;
}
@@ -803,16 +887,31 @@ public class OperationEditorScopingTool extends AbstractScopingTool{
nestedList.add(e) ;
}
}
+ nestedList = removeDuplicateClassifiers(nestedList) ;
nestedScopes.add(nestedList) ;
+
+ // Then process the implicit import of alf library
+ nestedList = new ArrayList<EObject>() ;
+ if (AlfJavaValidator.getAlfStandardLibrary() != null) {
+ List<EObject> importedClassifiers = processPublicallyImportedBehaviors(AlfJavaValidator.getAlfStandardLibrary()) ;
+ importedClassifiers = removeDuplicateClassifiers(importedClassifiers) ;
+ nestedList.addAll(importedClassifiers) ;
+ nestedScopes.add(nestedList) ;
+ }
+
return nestedScopes ;
}
private List<EObject> processPublicallyImportedBehaviors (Package p){
List<EObject> importedBehaviors = new ArrayList<EObject>() ;
for (NamedElement n : p.getOwnedMembers()) {
- if (n instanceof Behavior)
+ if (n instanceof Behavior) {
if (((Behavior)n).getVisibility() != VisibilityKind.PRIVATE_LITERAL)
importedBehaviors.add(n) ;
+ }
+ else if (n instanceof Package) {
+ importedBehaviors.addAll(processPublicallyImportedBehaviors((Package)n)) ;
+ }
}
for (ElementImport eImport : p.getElementImports()) {
if (eImport.getVisibility()!= VisibilityKind.PRIVATE_LITERAL) {

Back to the top