Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-11-23 10:52:23 +0000
committercletavernie2012-11-23 10:52:23 +0000
commit6424abf6e7e922c90a56eec84fd3f9b2de9dfae5 (patch)
tree8d3239a03710422cba8493b4dbe9ee2bb9aeda71 /plugins/uml
parentc7ed19562dfcf443385c0213765c98ffc841409f (diff)
downloadorg.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.gz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.tar.xz
org.eclipse.papyrus-6424abf6e7e922c90a56eec84fd3f9b2de9dfae5.zip
391945: [Refactoring] Part 2: Refactoring on Kepler (0.10)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391945
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java1798
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java5
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java86
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java32
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java2
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml129
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java64
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java2
-rw-r--r--plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java20
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java13
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java97
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java3
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java13
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java8
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java23
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java33
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java31
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java34
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java73
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java9
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java15
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java18
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java27
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java67
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF1
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gifbin115 -> 0 bytes
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java4
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java55
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java2
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java19
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java9
53 files changed, 1408 insertions, 1412 deletions
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
index 9760cd9fd88..8c89ac18f9e 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.xtext,
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.emf.transaction;bundle-version="1.4.0",
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
- org.eclipse.jface;bundle-version="3.8.0"
+ org.eclipse.jface;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.alf,
org.eclipse.papyrus.uml.alf.alf,
org.eclipse.papyrus.uml.alf.alf.impl,
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
index 1cfb34f661d..bad809bac63 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/src/org/eclipse/papyrus/uml/alf/validation/AlfJavaValidator.java
@@ -29,10 +29,12 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.alf.alf.AcceptBlock;
import org.eclipse.papyrus.uml.alf.alf.AcceptStatement;
import org.eclipse.papyrus.uml.alf.alf.AlfPackage;
@@ -88,25 +90,28 @@ import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.PackageImport;
import org.eclipse.xtext.validation.Check;
import org.eclipse.xtext.validation.EValidatorRegistrar;
-
+
public class AlfJavaValidator extends AbstractAlfJavaValidator {
-
- private static Element contextElement ;
- private static Classifier contextClassifier ;
- private static Namespace model ;
-
- private static Package alfStandardLibrary ; // TODO: include the library as part of the plug-in
- public static PredefinedBehaviorsAndTypesUtils predefinedBehaviorsAndTypes ;
-
+
+ private static Element contextElement;
+
+ private static Classifier contextClassifier;
+
+ private static Namespace model;
+
+ private static Package alfStandardLibrary; // TODO: include the library as part of the plug-in
+
+ public static PredefinedBehaviorsAndTypesUtils predefinedBehaviorsAndTypes;
+
public static Package getAlfStandardLibrary() {
- return alfStandardLibrary;
+ return alfStandardLibrary;
}
public static boolean validate() {
- return true ;
+ return true;
}
-
+
public static Namespace getModel() {
return model;
}
@@ -114,71 +119,62 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
public static void setModel(Namespace model) {
AlfJavaValidator.model = model;
}
-
+
public static void setContextElement(Element _contextElement) {
- contextElement = _contextElement ;
+ contextElement = _contextElement;
}
-
+
public static Element getContextElement() {
- return contextElement ;
+ return contextElement;
}
-
+
public static Classifier getContextClassifier() {
- return contextClassifier ;
+ return contextClassifier;
}
-
+
public static void setContextClassifier(Classifier contextClassifier) {
- AlfJavaValidator.contextClassifier = contextClassifier ;
- alfStandardLibrary = null ;
+ AlfJavaValidator.contextClassifier = contextClassifier;
+ alfStandardLibrary = null;
//if (alfStandardLibrary == null) {
- for (PackageImport pImport : contextClassifier.getModel().getPackageImports()) {
- Package p = pImport.getImportedPackage() ;
- if (p.getQualifiedName().equals("Alf")) {
- //alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
- alfStandardLibrary = (Package)p ;
- }
+ for(PackageImport pImport : contextClassifier.getModel().getPackageImports()) {
+ Package p = pImport.getImportedPackage();
+ if(p.getQualifiedName().equals("Alf")) {
+ //alfStandardLibrary = (Package)p.getOwnedMembers().get(0) ;
+ alfStandardLibrary = p;
}
- //}
- if (alfStandardLibrary != null) {
- predefinedBehaviorsAndTypes = new PredefinedBehaviorsAndTypesUtils() ;
- predefinedBehaviorsAndTypes.init(alfStandardLibrary) ;
}
- else {
-
- String question = "The context model " +
- contextClassifier.getModel().getName() +
- " does not import the standard Alf library. This import is required for static validation of Alf expressions and statements. \n\n Do you want to generate this import?" ;
- boolean doGenerateImport = MessageDialog.openQuestion(
- new Shell(),
- "Alf editor",
- question);
- if (doGenerateImport) {
- RegisteredLibrary[] libraries = RegisteredLibrary.getRegisteredLibraries() ;
- RegisteredLibrary alfLibrary = null ;
- for (RegisteredLibrary l : libraries) {
- if (l.getName().equals("AlfLibrary"))
- alfLibrary = l ;
+ //}
+ if(alfStandardLibrary != null) {
+ predefinedBehaviorsAndTypes = new PredefinedBehaviorsAndTypesUtils();
+ predefinedBehaviorsAndTypes.init(alfStandardLibrary);
+ } else {
+
+ String question = "The context model " + contextClassifier.getModel().getName() + " does not import the standard Alf library. This import is required for static validation of Alf expressions and statements. \n\n Do you want to generate this import?";
+ boolean doGenerateImport = MessageDialog.openQuestion(new Shell(), "Alf editor", question);
+ if(doGenerateImport) {
+ RegisteredLibrary[] libraries = RegisteredLibrary.getRegisteredLibraries();
+ RegisteredLibrary alfLibrary = null;
+ for(RegisteredLibrary l : libraries) {
+ if(l.getName().equals("AlfLibrary")) {
+ alfLibrary = l;
+ }
}
- if (alfLibrary != null) {
+ if(alfLibrary != null) {
// Creates and executes the update command
UpdateImportCommand updateCommand = new UpdateImportCommand(contextClassifier.getModel(), alfLibrary);
try {
OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- setContextClassifier(contextClassifier) ;
+ setContextClassifier(contextClassifier);
} catch (ExecutionException e) {
System.err.println(e);
}
- }
- else {
- MessageDialog.openError(
- new Shell(),
- "Alf editor",
- "Could not find standard Alf library") ;
+ } else {
+ MessageDialog.openError(new Shell(), "Alf editor", "Could not find standard Alf library");
}
}
}
}
-
+
/**
* @author CEA LIST
*
@@ -187,7 +183,8 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
protected static class UpdateImportCommand extends AbstractTransactionalCommand {
private Model model;
- private RegisteredLibrary library ;
+
+ private RegisteredLibrary library;
/*
* (non-Javadoc)
@@ -199,1227 +196,1184 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
URI libraryUri = library.uri;
- ResourceSet resourceSet = Util.getResourceSet(contextClassifier) ;
- Resource libraryResource = resourceSet.getResource(libraryUri, true) ;
- Package libraryObject = (Package)libraryResource.getContents().get(0) ;
- model.createPackageImport(libraryObject) ;
+ ResourceSet resourceSet = Util.getResourceSet(contextClassifier);
+ Resource libraryResource = resourceSet.getResource(libraryUri, true);
+ Package libraryObject = (Package)libraryResource.getContents().get(0);
+ model.createPackageImport(libraryObject);
return CommandResult.newOKCommandResult(model);
}
public UpdateImportCommand(Model model, RegisteredLibrary library) {
- super(EditorUtils.getTransactionalEditingDomain(), "Model Update", getWorkspaceFiles(model));
- this.model = model ;
- this.library = library ;
+ super(getTransactionalEditingDomain(model), "Model Update", getWorkspaceFiles(model));
+ this.model = model;
+ this.library = library;
//this.operation = operation;
}
+
+ private static TransactionalEditingDomain getTransactionalEditingDomain(Model model) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(model);
+ } catch (ServiceException ex) {
+ ex.printStackTrace(System.err);
+ return null;
+ }
+ }
}
-
+
@Override
public void register(EValidatorRegistrar registrar) {
// alf validator is not registered for a specific language
- super.register(registrar) ;
+ super.register(registrar);
}
-
+
/**
* @param tupleElement
*
- * Checks the following rule:
- * 1. the expression associated with the tuple must not encapsulate any error
+ * Checks the following rule:
+ * 1. the expression associated with the tuple must not encapsulate any error
*/
@Check
public void checkTupleElement(TupleElement tupleElement) {
- TypeExpression exp = new TypeUtils().getTypeOfExpression(tupleElement.getArgument()) ;
- if (exp.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)exp.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
+ TypeExpression exp = new TypeUtils().getTypeOfExpression(tupleElement.getArgument());
+ if(exp.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)exp.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
}
}
-
+
/**
- * @param statement LocalNameDeclarationStatement
- *
- * Checks the following rules:
- * 1. the local variable name must be available
- * 2. the type must be resolved
- * 3. the init expression must be type/multiplicity compatible with the variable type
+ * @param statement
+ * LocalNameDeclarationStatement
+ *
+ * Checks the following rules:
+ * 1. the local variable name must be available
+ * 2. the type must be resolved
+ * 3. the init expression must be type/multiplicity compatible with the variable type
*/
@Check
public void checkLocalNameDeclarationStatement(LocalNameDeclarationStatement statement) {
// 1. checks that the local variable name is available
- if (statement.getVarName() != null) {
- AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- List<EObject> resolved = variablesScope.resolveByName(statement.getVarName()) ;
- if (! resolved.isEmpty()) {// name is already used
+ if(statement.getVarName() != null) {
+ AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ List<EObject> resolved = variablesScope.resolveByName(statement.getVarName());
+ if(!resolved.isEmpty()) {// name is already used
// needs to determine if the scoping level where it is used is conflicting (i.e., it is in the first scoping level)
- if (variablesScope.getScopingLevel(resolved.get(0)) == 0 && resolved.get(0) != statement) {
+ if(variablesScope.getScopingLevel(resolved.get(0)) == 0 && resolved.get(0) != statement) {
// There is a name conflict
- error("Local name " + statement.getVarName() + " is not available" , AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName()) ;
+ error("Local name " + statement.getVarName() + " is not available", AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName());
}
}
}
-
+
// 2. checks that type can be resolved, and that potentially required template bindings are specified
- TypeFacade variableType = null ;
- if (statement.getType() != null) {
- variableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getType()) ;
- if (variableType instanceof ErrorTypeFacade) { // Type could not be resolved
- ErrorTypeFacade error = (ErrorTypeFacade)variableType ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- variableType = null ;
- }
- else if (variableType.isATemplate()){
- if (statement.getType().getBinding() == null) {
- String errorMessage = variableType.getLabel() + " is a template. All its parameters shall be bound." ;
- error(errorMessage, statement, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Type(), INSIGNIFICANT_INDEX) ;
+ TypeFacade variableType = null;
+ if(statement.getType() != null) {
+ variableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getType());
+ if(variableType instanceof ErrorTypeFacade) { // Type could not be resolved
+ ErrorTypeFacade error = (ErrorTypeFacade)variableType;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ variableType = null;
+ } else if(variableType.isATemplate()) {
+ if(statement.getType().getBinding() == null) {
+ String errorMessage = variableType.getLabel() + " is a template. All its parameters shall be bound.";
+ error(errorMessage, statement, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Type(), INSIGNIFICANT_INDEX);
}
}
}
-
+
// 3. checks the init expression
- if (statement.getInit() != null) {
- TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(statement.getInit()) ;
+ if(statement.getInit() != null) {
+ TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(statement.getInit());
// first checks that init expression is valid
- if (typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
+ if(typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
// Type expression is valid
// In the case where type has been validated at step 2., checks if the type of init expression is compatible with variable type
- if (variableType != null) {
- int lowerBound = statement.isMultiplicityIndicator() ? 0 : 1 ;
- int upperBound = statement.isMultiplicityIndicator() ? -1 : 1 ;
- boolean isUnique = statement.isMultiplicityIndicator() ? false : true ;
- boolean isOrdered = statement.isMultiplicityIndicator() ? true : false ;
- TypeExpression expectedType = TypeExpressionFactory.eInstance.createTypeExpression(variableType, lowerBound, upperBound, isUnique, isOrdered) ;
- if (expectedType.isCompatibleWithMe(typeOfInit) == 0) {
- error("Found an expression of type " + typeOfInit.getLabel() + ". Expecting an expression of type " + expectedType.getLabel(), AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Init()) ;
+ if(variableType != null) {
+ int lowerBound = statement.isMultiplicityIndicator() ? 0 : 1;
+ int upperBound = statement.isMultiplicityIndicator() ? -1 : 1;
+ boolean isUnique = statement.isMultiplicityIndicator() ? false : true;
+ boolean isOrdered = statement.isMultiplicityIndicator() ? true : false;
+ TypeExpression expectedType = TypeExpressionFactory.eInstance.createTypeExpression(variableType, lowerBound, upperBound, isUnique, isOrdered);
+ if(expectedType.isCompatibleWithMe(typeOfInit) == 0) {
+ error("Found an expression of type " + typeOfInit.getLabel() + ". Expecting an expression of type " + expectedType.getLabel(), AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_Init());
}
}
}
}
}
-
+
/**
- * @param statement IfStatement
+ * @param statement
+ * IfStatement
*
- * Checks the following rule:
- * 1. The condition associated with each clause must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with each clause must be a boolean expression
*/
@Check
public void checkIfStatement(IfStatement statement) {
- for (ConcurrentClauses concurrentClause : statement.getSequentialClausses().getConccurentClauses()) {
- for (NonFinalClause nonFinalClause : concurrentClause.getNonFinalClause()) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(nonFinalClause.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, nonFinalClause, AlfPackage.eINSTANCE.getNonFinalClause_Condition(), INSIGNIFICANT_INDEX) ;
+ for(ConcurrentClauses concurrentClause : statement.getSequentialClausses().getConccurentClauses()) {
+ for(NonFinalClause nonFinalClause : concurrentClause.getNonFinalClause()) {
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(nonFinalClause.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, nonFinalClause, AlfPackage.eINSTANCE.getNonFinalClause_Condition(), INSIGNIFICANT_INDEX);
}
}
}
}
}
-
+
/**
- * @param statement WhileStatement
+ * @param statement
+ * WhileStatement
*
- * Checks the following rule:
- * 1. The condition associated with the while must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with the while must be a boolean expression
*/
@Check
public void checkWhileStatement(WhileStatement statement) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getWhileStatement_Condition()) ;
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getWhileStatement_Condition());
}
}
}
-
+
/**
- * @param statement DoStatement
+ * @param statement
+ * DoStatement
*
- * Checks the following rule:
- * 1. The condition associated with the DoStatement must be a boolean expression
+ * Checks the following rule:
+ * 1. The condition associated with the DoStatement must be a boolean expression
*/
@Check
public void checkDoStatement(DoStatement statement) {
- TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition()) ;
- if (typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
- String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getDoStatement_Condition()) ;
+ TypeExpression typeOfCondition = new TypeUtils().getTypeOfExpression(statement.getCondition());
+ if(typeOfCondition.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfCondition.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._boolean).isCompatibleWithMe(typeOfCondition) == 0) {
+ String errorMessage = "Expecting an expression of type Boolean. Found an expression of type " + typeOfCondition.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getDoStatement_Condition());
}
}
}
-
+
/**
- * @param statement ForStatement
+ * @param statement
+ * ForStatement
*
- * Checks the following rule:
- * 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
- * 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
- * 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
- * 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
- * 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other constraints in the spec)
- * 4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
- * 4.a. type must be resolved
- * 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
+ * Checks the following rule:
+ * 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
+ * 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
+ * 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
+ * 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
+ * 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other
+ * constraints in the spec)
+ * 4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
+ * 4.a. type must be resolved
+ * 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
*/
@Check
public void checkForStatement(ForStatement statement) {
// 1. Loop variable names must not be available (i.e., not used in the scope of the statement)
- AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- Map<String, Integer> declaredVariables = new HashMap<String, Integer>() ;
- for (LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
- Integer variableDefinitionCounter = declaredVariables.get(loopVariable.getName()) ;
- if (variableDefinitionCounter == null) {
- declaredVariables.put(loopVariable.getName(), new Integer(1)) ;
- }
- else {
- declaredVariables.put(loopVariable.getName(), variableDefinitionCounter.intValue() + 1) ;
+ AlfPartialScope variablesScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ Map<String, Integer> declaredVariables = new HashMap<String, Integer>();
+ for(LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
+ Integer variableDefinitionCounter = declaredVariables.get(loopVariable.getName());
+ if(variableDefinitionCounter == null) {
+ declaredVariables.put(loopVariable.getName(), new Integer(1));
+ } else {
+ declaredVariables.put(loopVariable.getName(), variableDefinitionCounter.intValue() + 1);
}
- List<EObject> visibleVariables = variablesScope.resolveByName(loopVariable.getName()) ;
- if (! visibleVariables.isEmpty()) { // potentially conflicting name
- if (variablesScope.getScopingLevel(visibleVariables.get(0)) == 0) {
+ List<EObject> visibleVariables = variablesScope.resolveByName(loopVariable.getName());
+ if(!visibleVariables.isEmpty()) { // potentially conflicting name
+ if(variablesScope.getScopingLevel(visibleVariables.get(0)) == 0) {
// There is actually a conflict
- error("Local name " + loopVariable.getName() + " is not available" ,
- loopVariable,
- AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName(),
- statement.getControl().getLoopVariableDefinition().indexOf(loopVariable)) ;
+ error("Local name " + loopVariable.getName() + " is not available", loopVariable, AlfPackage.eINSTANCE.getLocalNameDeclarationStatement_VarName(), statement.getControl().getLoopVariableDefinition().indexOf(loopVariable));
}
}
}
-
+
// 2. Loop variable names must not duplicate (i.e., two loop variables for this statement must not have the same name)
- boolean duplicationFound = false ;
- for (Integer i : declaredVariables.values()) {
- if (i.intValue() > 1)
- duplicationFound = true ;
+ boolean duplicationFound = false;
+ for(Integer i : declaredVariables.values()) {
+ if(i.intValue() > 1) {
+ duplicationFound = true;
+ }
}
- if (duplicationFound) {
- error("Duplicate loop variable definitions" , AlfPackage.eINSTANCE.getForStatement_Control()) ;
+ if(duplicationFound) {
+ error("Duplicate loop variable definitions", AlfPackage.eINSTANCE.getForStatement_Control());
}
-
- for (LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
+
+ for(LoopVariableDefinition loopVariable : statement.getControl().getLoopVariableDefinition()) {
// 3. if the loop variable definition uses the syntax option with keyword "in", following rules must be checked:
// 3.a. if only expression1 is specified, the upper bound of expression 1 must be greater than 1
- if (loopVariable.getExpression1() != null && loopVariable.getExpression2() == null) {
- TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1()) ;
- if (typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- int upperBound = typeOfExpression1.getMultiplicity().getUpperBound() ;
- if (! (upperBound > 1 || upperBound == -1)) {
- String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected." ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX) ;
+ if(loopVariable.getExpression1() != null && loopVariable.getExpression2() == null) {
+ TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1());
+ if(typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ int upperBound = typeOfExpression1.getMultiplicity().getUpperBound();
+ if(!(upperBound > 1 || upperBound == -1)) {
+ String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected.";
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX);
}
}
}
// 3.b. if both expression1 and expression2 are specified, they must be type compatible and represent number values (TODO: check other constraints in the spec)
- else if (loopVariable.getExpression1() != null && loopVariable.getExpression2() != null) {
- TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1()) ;
- boolean errorInExpressions = false ;
- if (typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ else if(loopVariable.getExpression1() != null && loopVariable.getExpression2() != null) {
+ TypeExpression typeOfExpression1 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression1());
+ boolean errorInExpressions = false;
+ if(typeOfExpression1.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression1.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
- TypeExpression typeOfExpression2 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression2()) ;
- if (typeOfExpression2.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression2.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfExpression2 = new TypeUtils().getTypeOfExpression(loopVariable.getExpression2());
+ if(typeOfExpression2.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfExpression2.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
- if (! errorInExpressions) { // both Expression must be type compatible and resolve to a scalar number value
- TypeFacade typeFacadeOfExpression1 = typeOfExpression1.getTypeFacade() ;
- int upperBoundExpression1 = typeOfExpression1.getMultiplicityFacade().getUpperBound() ;
- String errorMessageForExpression1 = "" ;
- if (!isANumberType(typeFacadeOfExpression1)) {
- if (upperBoundExpression1 > 1 || upperBoundExpression1 == -1)
- errorMessageForExpression1 += "A scalar number value is expected" ;
- else
- errorMessageForExpression1 += "A number value is expected" ;
- }
- else {
- if (upperBoundExpression1 > 1 || upperBoundExpression1 == -1)
- errorMessageForExpression1 += "A scalar value is expected" ;
- }
- if (!(errorMessageForExpression1.length() == 0)) {
- error(errorMessageForExpression1, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX) ;
+ if(!errorInExpressions) { // both Expression must be type compatible and resolve to a scalar number value
+ TypeFacade typeFacadeOfExpression1 = typeOfExpression1.getTypeFacade();
+ int upperBoundExpression1 = typeOfExpression1.getMultiplicityFacade().getUpperBound();
+ String errorMessageForExpression1 = "";
+ if(!isANumberType(typeFacadeOfExpression1)) {
+ if(upperBoundExpression1 > 1 || upperBoundExpression1 == -1) {
+ errorMessageForExpression1 += "A scalar number value is expected";
+ } else {
+ errorMessageForExpression1 += "A number value is expected";
+ }
+ } else {
+ if(upperBoundExpression1 > 1 || upperBoundExpression1 == -1) {
+ errorMessageForExpression1 += "A scalar value is expected";
+ }
}
- TypeFacade typeFacadeOfExpression2 = typeOfExpression2.getTypeFacade() ;
- int upperBoundExpression2 = typeOfExpression2.getMultiplicityFacade().getUpperBound() ;
- String errorMessageForExpression2 = "" ;
- if (!isANumberType(typeFacadeOfExpression2)) {
- if (upperBoundExpression2 > 1 || upperBoundExpression2 == -1)
- errorMessageForExpression2 += "A scalar number value is expected" ;
- else
- errorMessageForExpression2 += "A number value is expected" ;
+ if(!(errorMessageForExpression1.length() == 0)) {
+ error(errorMessageForExpression1, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression1(), INSIGNIFICANT_INDEX);
}
- else {
- if (upperBoundExpression2 > 1 || upperBoundExpression2 == -1)
- errorMessageForExpression2 += "A scalar value is expected" ;
+ TypeFacade typeFacadeOfExpression2 = typeOfExpression2.getTypeFacade();
+ int upperBoundExpression2 = typeOfExpression2.getMultiplicityFacade().getUpperBound();
+ String errorMessageForExpression2 = "";
+ if(!isANumberType(typeFacadeOfExpression2)) {
+ if(upperBoundExpression2 > 1 || upperBoundExpression2 == -1) {
+ errorMessageForExpression2 += "A scalar number value is expected";
+ } else {
+ errorMessageForExpression2 += "A number value is expected";
+ }
+ } else {
+ if(upperBoundExpression2 > 1 || upperBoundExpression2 == -1) {
+ errorMessageForExpression2 += "A scalar value is expected";
+ }
}
- if (!(errorMessageForExpression2.length() == 0)) {
- error(errorMessageForExpression2, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression2(), INSIGNIFICANT_INDEX) ;
+ if(!(errorMessageForExpression2.length() == 0)) {
+ error(errorMessageForExpression2, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression2(), INSIGNIFICANT_INDEX);
}
}
}
//4. if the loop variable definition uses the syntax option with keyword ":", following rules must be checked:
- else if (loopVariable.getType() != null) {
- // 4.a. type must be resolved
- TypeFacade typeOfVariable = TypeFacadeFactory.eInstance.createVoidFacade(loopVariable.getType()) ;
- if (typeOfVariable instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfVariable ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else { // 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
- TypeExpression typeOfDomain = new TypeUtils().getTypeOfExpression(loopVariable.getExpression()) ;
- if (typeOfDomain.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfDomain.getTypeFacade() ;
- error (error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- int upperBound = typeOfDomain.getMultiplicity().getUpperBound() ;
- if (! (upperBound > 1 || upperBound == -1)) {
- String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected." ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression(), INSIGNIFICANT_INDEX) ;
+ else if(loopVariable.getType() != null) {
+ // 4.a. type must be resolved
+ TypeFacade typeOfVariable = TypeFacadeFactory.eInstance.createVoidFacade(loopVariable.getType());
+ if(typeOfVariable instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfVariable;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else { // 4.b. the domain value "expression" must be type-compatible with the variable and must be a collection
+ TypeExpression typeOfDomain = new TypeUtils().getTypeOfExpression(loopVariable.getExpression());
+ if(typeOfDomain.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfDomain.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ int upperBound = typeOfDomain.getMultiplicity().getUpperBound();
+ if(!(upperBound > 1 || upperBound == -1)) {
+ String errorMessage = "Invalid upper bound multiplicity (" + upperBound + "). A collection is expected.";
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Expression(), INSIGNIFICANT_INDEX);
}
- if (typeOfVariable.isCompatibleWithMe(typeOfDomain.getTypeFacade()) == 0) {
- String errorMessage = "Cannot convert from " + typeOfDomain.getTypeFacade().getLabel() + " to " + typeOfVariable.getLabel() ;
- error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Type(), INSIGNIFICANT_INDEX) ;
+ if(typeOfVariable.isCompatibleWithMe(typeOfDomain.getTypeFacade()) == 0) {
+ String errorMessage = "Cannot convert from " + typeOfDomain.getTypeFacade().getLabel() + " to " + typeOfVariable.getLabel();
+ error(errorMessage, loopVariable, AlfPackage.eINSTANCE.getLoopVariableDefinition_Type(), INSIGNIFICANT_INDEX);
}
}
}
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. That a return value is actually expected from the context of the ALF specification
- * 2. If a return value is expected, the returned value must be type/multiplicity compatible
- * 3. There must be no statement in the containing statement sequence after the return statement.
+ * Checks the following rule:
+ * 1. That a return value is actually expected from the context of the ALF specification
+ * 2. If a return value is expected, the returned value must be type/multiplicity compatible
+ * 3. There must be no statement in the containing statement sequence after the return statement.
*/
@Check
public void checkReturnStatement(ReturnStatement statement) {
// 1. Checks that a return value is actually expected from the context of the ALF specification
- boolean returnStatementExpected = AlfScopeProvider.scopingTool.isAReturnStatementExpected(statement) ;
- if (returnStatementExpected == false) {
- String errorMessage = "No return statement expected" ;
- error (errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression()) ;
- }
- else {
+ boolean returnStatementExpected = AlfScopeProvider.scopingTool.isAReturnStatementExpected(statement);
+ if(returnStatementExpected == false) {
+ String errorMessage = "No return statement expected";
+ error(errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression());
+ } else {
// 2. If a return value is expected, the returned value must be type/multiplicity compatible
- TypeExpression expectedReturnType = AlfScopeProvider.scopingTool.getExpectedReturnType(statement) ;
- TypeExpression actualReturnType = new TypeUtils().getTypeOfExpression(statement.getExpression()) ;
- if (actualReturnType.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)actualReturnType.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- if (expectedReturnType.isCompatibleWithMe(actualReturnType) == 0) {
- String errorMessage = "An expression of type " + expectedReturnType.getLabel() + " is expected. Found an expression of type " + actualReturnType.getLabel() ;
- error (errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression()) ;
+ TypeExpression expectedReturnType = AlfScopeProvider.scopingTool.getExpectedReturnType(statement);
+ TypeExpression actualReturnType = new TypeUtils().getTypeOfExpression(statement.getExpression());
+ if(actualReturnType.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)actualReturnType.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ if(expectedReturnType.isCompatibleWithMe(actualReturnType) == 0) {
+ String errorMessage = "An expression of type " + expectedReturnType.getLabel() + " is expected. Found an expression of type " + actualReturnType.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getReturnStatement_Expression());
}
}
}
// 3. There must be no statement (in the containing statement sequence) after the return statement.
- EObject cddStatementSequence = statement.eContainer() ;
- DocumentedStatement contextDocumentedStatement = null ;
- while (cddStatementSequence != null &&
- ! ((cddStatementSequence instanceof StatementSequence) || (cddStatementSequence instanceof NonEmptyStatementSequence))) {
- if (contextDocumentedStatement == null && cddStatementSequence instanceof DocumentedStatement)
- contextDocumentedStatement = (DocumentedStatement)cddStatementSequence ;
- cddStatementSequence = cddStatementSequence.eContainer() ;
+ EObject cddStatementSequence = statement.eContainer();
+ DocumentedStatement contextDocumentedStatement = null;
+ while(cddStatementSequence != null && !((cddStatementSequence instanceof StatementSequence) || (cddStatementSequence instanceof NonEmptyStatementSequence))) {
+ if(contextDocumentedStatement == null && cddStatementSequence instanceof DocumentedStatement) {
+ contextDocumentedStatement = (DocumentedStatement)cddStatementSequence;
+ }
+ cddStatementSequence = cddStatementSequence.eContainer();
}
- if (cddStatementSequence != null && contextDocumentedStatement != null) {
- int statementIndex = 0 ;
- int numberOfStatements = 0 ;
- if (cddStatementSequence instanceof StatementSequence) {
- statementIndex = ((StatementSequence)cddStatementSequence).getStatements().indexOf(contextDocumentedStatement) ;
- numberOfStatements = ((StatementSequence)cddStatementSequence).getStatements().size() ;
+ if(cddStatementSequence != null && contextDocumentedStatement != null) {
+ int statementIndex = 0;
+ int numberOfStatements = 0;
+ if(cddStatementSequence instanceof StatementSequence) {
+ statementIndex = ((StatementSequence)cddStatementSequence).getStatements().indexOf(contextDocumentedStatement);
+ numberOfStatements = ((StatementSequence)cddStatementSequence).getStatements().size();
+ } else {
+ statementIndex = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().indexOf(contextDocumentedStatement);
+ numberOfStatements = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().size();
}
- else {
- statementIndex = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().indexOf(contextDocumentedStatement) ;
- numberOfStatements = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().size() ;
- }
- String errorMessage = "The statement cannot be reached" ;
- for (int i = statementIndex + 1 ; i < numberOfStatements ; i++) {
- DocumentedStatement current = null ;
- if (cddStatementSequence instanceof StatementSequence)
- current = ((StatementSequence)cddStatementSequence).getStatements().get(i) ;
- else
- current = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().get(i) ;
- error(errorMessage, current, AlfPackage.eINSTANCE.getDocumentedStatement_Statement(), INSIGNIFICANT_INDEX) ;
+ String errorMessage = "The statement cannot be reached";
+ for(int i = statementIndex + 1; i < numberOfStatements; i++) {
+ DocumentedStatement current = null;
+ if(cddStatementSequence instanceof StatementSequence) {
+ current = ((StatementSequence)cddStatementSequence).getStatements().get(i);
+ } else {
+ current = ((NonEmptyStatementSequence)cddStatementSequence).getStatement().get(i);
+ }
+ error(errorMessage, current, AlfPackage.eINSTANCE.getDocumentedStatement_Statement(), INSIGNIFICANT_INDEX);
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. Checks that the context classifier is active
- * 2. Each AcceptClause.name (if specified) must be available.
- * 3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
- * 4. Each Signal must be used only once
+ * Checks the following rules:
+ * 1. Checks that the context classifier is active
+ * 2. Each AcceptClause.name (if specified) must be available.
+ * 3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
+ * 4. Each Signal must be used only once
*/
@Check
public void checkAcceptStatement(AcceptStatement statement) {
//1. Checks that the context classifier is active
- if (! (contextClassifier instanceof Class) || !((Class)contextClassifier).isActive()) {
- error("The context classifier must be an active class", AlfPackage.eINSTANCE.getAcceptStatement_Clause()) ;
+ if(!(contextClassifier instanceof Class) || !((Class)contextClassifier).isActive()) {
+ error("The context classifier must be an active class", AlfPackage.eINSTANCE.getAcceptStatement_Clause());
}
-
+
//2. Each AcceptClause.name (if specified) must be available.
- AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- if (statement.getClause().getName() != null ) {
- List<EObject> visibleElements = vppScope.resolveByName(statement.getClause().getName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + statement.getClause().getName() + " is not available" ;
- error(errorMessage, statement.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX) ;
+ AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ if(statement.getClause().getName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(statement.getClause().getName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + statement.getClause().getName() + " is not available";
+ error(errorMessage, statement.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX);
}
}
- if (statement.getCompoundAccept() != null) {
- for (AcceptBlock block : statement.getCompoundAccept().getAcceptBlock()) {
- if (block.getClause() != null && block.getClause().getName() != null) {
- List<EObject> visibleElements = vppScope.resolveByName(block.getClause().getName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + block.getClause().getName() + " is not available" ;
- error(errorMessage, block.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX) ;
+ if(statement.getCompoundAccept() != null) {
+ for(AcceptBlock block : statement.getCompoundAccept().getAcceptBlock()) {
+ if(block.getClause() != null && block.getClause().getName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(block.getClause().getName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + block.getClause().getName() + " is not available";
+ error(errorMessage, block.getClause(), AlfPackage.eINSTANCE.getAcceptClause_Name(), INSIGNIFICANT_INDEX);
}
}
}
}
-
+
//3. There must be a Reception for each Signal identified in each AcceptClause.qualifiedNameList
- AlfPartialScope signalReceptionScope = AlfScopeProvider.scopingTool.getVisibleSignalReceptions(statement) ;
- List<TypeFacade> signalReceptionTypeFacade = new ArrayList<TypeFacade>() ;
- for (List<EObject> l : signalReceptionScope.getScopeDetails()) {
- for (EObject m : l) {
- signalReceptionTypeFacade.add(TypeFacadeFactory.eInstance.createTypeFacade(m)) ;
+ AlfPartialScope signalReceptionScope = AlfScopeProvider.scopingTool.getVisibleSignalReceptions(statement);
+ List<TypeFacade> signalReceptionTypeFacade = new ArrayList<TypeFacade>();
+ for(List<EObject> l : signalReceptionScope.getScopeDetails()) {
+ for(EObject m : l) {
+ signalReceptionTypeFacade.add(TypeFacadeFactory.eInstance.createTypeFacade(m));
}
}
- Map<Classifier, List<QualifiedNameWithBinding>> allReferencedSignals= new HashMap<Classifier, List<QualifiedNameWithBinding>>() ;
- if (statement.getClause().getQualifiedNameList() != null) {
- QualifiedNameList list = statement.getClause().getQualifiedNameList() ;
- int index = 0 ;
- for (QualifiedNameWithBinding qualifiedName : list.getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(qualifiedName) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- Classifier actualReferencedClassifier = type.extractActualType() ;
- List<QualifiedNameWithBinding> existingReferences = allReferencedSignals.get(actualReferencedClassifier) ;
- if (existingReferences == null) {
- existingReferences = new ArrayList<QualifiedNameWithBinding>() ;
-
+ Map<Classifier, List<QualifiedNameWithBinding>> allReferencedSignals = new HashMap<Classifier, List<QualifiedNameWithBinding>>();
+ if(statement.getClause().getQualifiedNameList() != null) {
+ QualifiedNameList list = statement.getClause().getQualifiedNameList();
+ int index = 0;
+ for(QualifiedNameWithBinding qualifiedName : list.getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(qualifiedName);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ Classifier actualReferencedClassifier = type.extractActualType();
+ List<QualifiedNameWithBinding> existingReferences = allReferencedSignals.get(actualReferencedClassifier);
+ if(existingReferences == null) {
+ existingReferences = new ArrayList<QualifiedNameWithBinding>();
+
}
- existingReferences.add(qualifiedName) ;
- allReferencedSignals.put(actualReferencedClassifier, existingReferences) ;
- boolean found = false ;
- Iterator<TypeFacade> i = signalReceptionTypeFacade.iterator() ;
- while (i.hasNext() && !found) {
- TypeFacade current = i.next() ;
- if (current.isCompatibleWithMe(type)!=0)
- found = true ;
+ existingReferences.add(qualifiedName);
+ allReferencedSignals.put(actualReferencedClassifier, existingReferences);
+ boolean found = false;
+ Iterator<TypeFacade> i = signalReceptionTypeFacade.iterator();
+ while(i.hasNext() && !found) {
+ TypeFacade current = i.next();
+ if(current.isCompatibleWithMe(type) != 0) {
+ found = true;
+ }
}
- if (!found) {
- String errorMessage = "The context classifier does not define any reception for " + type.getLabel() ;
- error(errorMessage, list, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index) ;
+ if(!found) {
+ String errorMessage = "The context classifier does not define any reception for " + type.getLabel();
+ error(errorMessage, list, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
}
}
- index ++ ;
+ index++;
}
}
-
+
//4. Each Signal must be used only once
- for (Classifier key : allReferencedSignals.keySet()) {
- List<QualifiedNameWithBinding> referencesToKey = allReferencedSignals.get(key) ;
- if (referencesToKey.size()>1) {
- for (QualifiedNameWithBinding qualifiedName : referencesToKey) {
- String errorMessage = "No signal may be named in more than one accept clause" ;
- QualifiedNameList containingList = (QualifiedNameList)qualifiedName.eContainer() ;
- int index = containingList.getQualifiedName().indexOf(qualifiedName) ;
- error(errorMessage, containingList, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index - 1 ) ;
+ for(Classifier key : allReferencedSignals.keySet()) {
+ List<QualifiedNameWithBinding> referencesToKey = allReferencedSignals.get(key);
+ if(referencesToKey.size() > 1) {
+ for(QualifiedNameWithBinding qualifiedName : referencesToKey) {
+ String errorMessage = "No signal may be named in more than one accept clause";
+ QualifiedNameList containingList = (QualifiedNameList)qualifiedName.eContainer();
+ int index = containingList.getQualifiedName().indexOf(qualifiedName);
+ error(errorMessage, containingList, AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index - 1);
}
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. The static type of the target expression must be a Class
- * and it must evaluate to a single object
- * 2. All qualified names in from or to lists must resolve to classes
- * 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
- * 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
- *
+ * Checks the following rules:
+ * 1. The static type of the target expression must be a Class
+ * and it must evaluate to a single object
+ * 2. All qualified names in from or to lists must resolve to classes
+ * 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
+ * 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
+ *
*/
@Check
public void checkClassifyStatement(ClassifyStatement statement) {
// 1. The static type of the target expression must be a Class...
- Classifier actualStaticType = null ;
- TypeExpression staticType = new TypeUtils().getTypeOfExpression(statement.getExpression()) ;
- boolean errorFound = false ;
- if (staticType.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)staticType.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
+ Classifier actualStaticType = null;
+ TypeExpression staticType = new TypeUtils().getTypeOfExpression(statement.getExpression());
+ boolean errorFound = false;
+ if(staticType.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)staticType.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ actualStaticType = staticType.getTypeFacade().extractActualType();
}
- else {
- actualStaticType = staticType.getTypeFacade().extractActualType() ;
- }
- if (actualStaticType == null || !(actualStaticType instanceof Class)) {
- String errorMessage = "The type of the target expression must be a class" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression()) ;
- errorFound = true ;
- }
- else {
+ if(actualStaticType == null || !(actualStaticType instanceof Class)) {
+ String errorMessage = "The type of the target expression must be a class";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression());
+ errorFound = true;
+ } else {
//... and it must evaluate to a single object
- int upperBound = staticType.getMultiplicityFacade().getUpperBound() ;
- if (upperBound > 1 || upperBound == -1) {
- String errorMessage = "The target expression must evaluate to a single object" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression()) ;
- errorFound = true ;
+ int upperBound = staticType.getMultiplicityFacade().getUpperBound();
+ if(upperBound > 1 || upperBound == -1) {
+ String errorMessage = "The target expression must evaluate to a single object";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Expression());
+ errorFound = true;
}
}
-
+
// 2. All qualified names in from or to lists must resolve to classes
- ClassificationClause classificationClause = statement.getClause() ;
- List<Class> fromClasses = new ArrayList<Class>() ;
- List<Class> toClasses = new ArrayList<Class>() ;
- if (classificationClause == null)
- return ;
- boolean isAReclassifyFromAll = false ;
- if (classificationClause.getClassifyFromClause() == null &&
- classificationClause.getClassifyToClause() == null &&
- classificationClause.getReclassyAllClause() == null)
- return ;
- if (classificationClause.getReclassyAllClause() != null)
+ ClassificationClause classificationClause = statement.getClause();
+ List<Class> fromClasses = new ArrayList<Class>();
+ List<Class> toClasses = new ArrayList<Class>();
+ if(classificationClause == null) {
+ return;
+ }
+ boolean isAReclassifyFromAll = false;
+ if(classificationClause.getClassifyFromClause() == null && classificationClause.getClassifyToClause() == null && classificationClause.getReclassyAllClause() == null) {
+ return;
+ }
+ if(classificationClause.getReclassyAllClause() != null) {
// nothing to do with the from list
- isAReclassifyFromAll = true ;
- if (classificationClause.getClassifyFromClause() != null) {
- ClassificationFromClause fromClause = classificationClause.getClassifyFromClause() ;
- for (QualifiedNameWithBinding name : fromClause.getQualifiedNameList().getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
- }
- else {
- Classifier actualType = type.extractActualType(type) ;
- if (actualType == null || !(actualType instanceof Class)) {
- String errorMessage = "All types in the 'from' list must be Classes" ;
- int index = fromClause.getQualifiedNameList().getQualifiedName().indexOf(name) ;
- error(errorMessage,
- fromClause.getQualifiedNameList(),
- AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(),
- index) ;
- }
- else {
- fromClasses.add((Class)actualType) ;
+ isAReclassifyFromAll = true;
+ }
+ if(classificationClause.getClassifyFromClause() != null) {
+ ClassificationFromClause fromClause = classificationClause.getClassifyFromClause();
+ for(QualifiedNameWithBinding name : fromClause.getQualifiedNameList().getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ Classifier actualType = type.extractActualType(type);
+ if(actualType == null || !(actualType instanceof Class)) {
+ String errorMessage = "All types in the 'from' list must be Classes";
+ int index = fromClause.getQualifiedNameList().getQualifiedName().indexOf(name);
+ error(errorMessage, fromClause.getQualifiedNameList(), AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
+ } else {
+ fromClasses.add((Class)actualType);
}
}
}
}
- if (classificationClause.getClassifyToClause() != null) {
- ClassificationToClause toClause = classificationClause.getClassifyToClause() ;
- for (QualifiedNameWithBinding name : toClause.getQualifiedNameList().getQualifiedName()) {
- TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name) ;
- if (type instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)type ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorFound = true ;
- }
- else {
- Classifier actualType = type.extractActualType(type) ;
- if (actualType == null || !(actualType instanceof Class)) {
- String errorMessage = "All types in the 'from' list must be Classes" ;
- int index = toClause.getQualifiedNameList().getQualifiedName().indexOf(name) ;
- error(errorMessage,
- toClause.getQualifiedNameList(),
- AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(),
- index) ;
- }
- else {
- toClasses.add((Class)actualType) ;
+ if(classificationClause.getClassifyToClause() != null) {
+ ClassificationToClause toClause = classificationClause.getClassifyToClause();
+ for(QualifiedNameWithBinding name : toClause.getQualifiedNameList().getQualifiedName()) {
+ TypeFacade type = TypeFacadeFactory.eInstance.createVoidFacade(name);
+ if(type instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)type;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorFound = true;
+ } else {
+ Classifier actualType = type.extractActualType(type);
+ if(actualType == null || !(actualType instanceof Class)) {
+ String errorMessage = "All types in the 'from' list must be Classes";
+ int index = toClause.getQualifiedNameList().getQualifiedName().indexOf(name);
+ error(errorMessage, toClause.getQualifiedNameList(), AlfPackage.eINSTANCE.getQualifiedNameList_QualifiedName(), index);
+ } else {
+ toClasses.add((Class)actualType);
}
}
}
}
-
-
+
+
// 3. All the classes in the from and to lists must be subclasses of the static type of the target expression
- if (errorFound)
- return ; // not necessary to check the remaining
- List<Classifier> fromGenerals = new ArrayList<Classifier>() ;
- List<Classifier> toGenerals = new ArrayList<Classifier>() ;
- if (actualStaticType != null && !errorFound) {
- String errorMessage = "All classes in the 'from' list must be subclasses of the target expression type" ;
- int index = 0 ;
- for (Class c : fromClasses) {
- if (! c.allParents().contains(actualStaticType)) {
- error(errorMessage,
- classificationClause.getClassifyFromClause(),
- AlfPackage.eINSTANCE.getClassificationFromClause_QualifiedNameList(),
- index) ;
- errorFound = true ;
+ if(errorFound) {
+ return; // not necessary to check the remaining
+ }
+ List<Classifier> fromGenerals = new ArrayList<Classifier>();
+ List<Classifier> toGenerals = new ArrayList<Classifier>();
+ if(actualStaticType != null && !errorFound) {
+ String errorMessage = "All classes in the 'from' list must be subclasses of the target expression type";
+ int index = 0;
+ for(Class c : fromClasses) {
+ if(!c.allParents().contains(actualStaticType)) {
+ error(errorMessage, classificationClause.getClassifyFromClause(), AlfPackage.eINSTANCE.getClassificationFromClause_QualifiedNameList(), index);
+ errorFound = true;
}
- fromGenerals.addAll(c.allParents()) ;
- index++ ;
+ fromGenerals.addAll(c.allParents());
+ index++;
}
- errorMessage = "All classes in the 'to' list must be subclasses of the target expression type" ;
- index = 0 ;
- for (Class c : toClasses) {
- if (! c.allParents().contains(actualStaticType)) {
- error(errorMessage,
- classificationClause.getClassifyToClause(),
- AlfPackage.eINSTANCE.getClassificationToClause_QualifiedNameList(),
- index) ;
- errorFound = true ;
+ errorMessage = "All classes in the 'to' list must be subclasses of the target expression type";
+ index = 0;
+ for(Class c : toClasses) {
+ if(!c.allParents().contains(actualStaticType)) {
+ error(errorMessage, classificationClause.getClassifyToClause(), AlfPackage.eINSTANCE.getClassificationToClause_QualifiedNameList(), index);
+ errorFound = true;
}
- index++ ;
- toGenerals.addAll(c.allParents()) ;
+ index++;
+ toGenerals.addAll(c.allParents());
}
}
-
+
// 4. None of them may have a common superclass of the static type of the target expression (i.e., disjoint subclasses)
- if (errorFound)
- return ; // not necessary to go further
- fromGenerals.retainAll(toGenerals) ;
- for (Classifier c : fromGenerals) {
- if (c.allParents().contains(actualStaticType)) {
- String errorMessage = "Superclasses of classes in 'to' and 'from' lists must be disjoint subclasses of the target expression type" ;
- error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Clause()) ;
- return ;
+ if(errorFound) {
+ return; // not necessary to go further
+ }
+ fromGenerals.retainAll(toGenerals);
+ for(Classifier c : fromGenerals) {
+ if(c.allParents().contains(actualStaticType)) {
+ String errorMessage = "Superclasses of classes in 'to' and 'from' lists must be disjoint subclasses of the target expression type";
+ error(errorMessage, AlfPackage.eINSTANCE.getClassifyStatement_Clause());
+ return;
}
}
-
+
}
-
+
/**
* @param statement
- * Checks the following rules:
- * 1. The statement must respect construction rules of:
- * 1.a Invocation, or
- * 1.b Variable declaration, or
- * 1.c Assignment expression
- * 2. According to the construction rule, delegate to the appropriate check method
+ * Checks the following rules:
+ * 1. The statement must respect construction rules of:
+ * 1.a Invocation, or
+ * 1.b Variable declaration, or
+ * 1.c Assignment expression
+ * 2. According to the construction rule, delegate to the appropriate check method
*/
@Check
public void checkInvocationOrAssignmentOrDeclarationStatement(InvocationOrAssignementOrDeclarationStatement statement) {
//1. The statement must respect construction rules of:
// 1.b Variable declaration
- if (statement.getVariableDeclarationCompletion() != null) {
- checkVariableDeclarationStatement(statement) ;
+ if(statement.getVariableDeclarationCompletion() != null) {
+ checkVariableDeclarationStatement(statement);
}
// 1.c Assignment expression
- else if (statement.getAssignmentCompletion() != null) {
- checkAssignmentExpression(statement) ;
+ else if(statement.getAssignmentCompletion() != null) {
+ checkAssignmentExpression(statement);
}
// 1.a Invocation or prefix or suffix
else {
- checkInvocationOrPrefixOrSuffixStatement(statement) ;
+ checkInvocationOrPrefixOrSuffixStatement(statement);
}
}
-
+
/**
* @param statement
- * Checks the following rules:
- * 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
- * 2. if it is an invocation:
- * 2.a The name must resolve to a Behavior or an Operation
- * 2.b Arguments must be type compatibles with the parameters of referenced behavior or operation
- * 3. if it is a prefixOp:
- * 3.a the name must resolve to an assignable property, parameter or local variable
- * 3.b the operator must be available for the type of the nameExpression
- * 4. if it is a postfixOp:
- * 4.a the name must resolve to an assignable property, parameter or local variable
- * 4.b the operator must be available for the type of the nameExpression
+ * Checks the following rules:
+ * 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
+ * 2. if it is an invocation:
+ * 2.a The name must resolve to a Behavior or an Operation
+ * 2.b Arguments must be type compatibles with the parameters of referenced behavior or operation
+ * 3. if it is a prefixOp:
+ * 3.a the name must resolve to an assignable property, parameter or local variable
+ * 3.b the operator must be available for the type of the nameExpression
+ * 4. if it is a postfixOp:
+ * 4.a the name must resolve to an assignable property, parameter or local variable
+ * 4.b the operator must be available for the type of the nameExpression
*/
private void checkInvocationOrPrefixOrSuffixStatement(InvocationOrAssignementOrDeclarationStatement statement) {
// 1. typePart_OR_assignedPart_OR_invocationPart must have an invocation completion, or a postfixOp, or a prefixOp
- boolean isAnInvocation = statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null ;
- boolean isAPrefixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() != null ;
- boolean isAPostfixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() != null ;
- boolean hasASuffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() != null ;
- int resolvedKindOfExpression = 0 ;
- resolvedKindOfExpression += isAnInvocation ? 1 : 0 ;
- resolvedKindOfExpression += isAPrefixExpression ? 1 : 0 ;
- resolvedKindOfExpression += isAPostfixExpression ? 1 : 0 ;
- resolvedKindOfExpression += hasASuffix ? 1 : 0 ;
- if ((resolvedKindOfExpression > 1 && !hasASuffix) || resolvedKindOfExpression==0) {
- String errorMessage = "An invocation expression, OR a prefix expression, OR a postfix expression is expected." ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ boolean isAnInvocation = statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null;
+ boolean isAPrefixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() != null;
+ boolean isAPostfixExpression = statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() != null;
+ boolean hasASuffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() != null;
+ int resolvedKindOfExpression = 0;
+ resolvedKindOfExpression += isAnInvocation ? 1 : 0;
+ resolvedKindOfExpression += isAPrefixExpression ? 1 : 0;
+ resolvedKindOfExpression += isAPostfixExpression ? 1 : 0;
+ resolvedKindOfExpression += hasASuffix ? 1 : 0;
+ if((resolvedKindOfExpression > 1 && !hasASuffix) || resolvedKindOfExpression == 0) {
+ String errorMessage = "An invocation expression, OR a prefix expression, OR a postfix expression is expected.";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
-
+
//2. if it is an invocation:
- if (isAnInvocation || hasASuffix) {
+ if(isAnInvocation || hasASuffix) {
// 2.a The name must resolve to a Variable, a Parameter, a Property, a Behavior or an Operation (TODO: can also be an association)
- NameExpression varOrParamOrPropOrOpOrBehav = statement.getTypePart_OR_assignedPart_OR_invocationPart() ;
- TypeExpression typeOfPrefix = new TypeUtils().getTypeOfNameExpression(varOrParamOrPropOrOpOrBehav) ;
- if (typeOfPrefix.getTypeFacade() != null && typeOfPrefix.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfPrefix.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ NameExpression varOrParamOrPropOrOpOrBehav = statement.getTypePart_OR_assignedPart_OR_invocationPart();
+ TypeExpression typeOfPrefix = new TypeUtils().getTypeOfNameExpression(varOrParamOrPropOrOpOrBehav);
+ if(typeOfPrefix.getTypeFacade() != null && typeOfPrefix.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfPrefix.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
- if (hasASuffix) {
+ if(hasASuffix) {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An invocation is expected",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An invocation is expected", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
}
//}
}
-
+
// 3. if it is a prefixOp: or // 4. if it is a postfixOp:
- else if (isAPrefixExpression || isAPostfixExpression) {
- TypeExpression typeOfAssignedElement = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (typeOfAssignedElement.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignedElement.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ else if(isAPrefixExpression || isAPostfixExpression) {
+ TypeExpression typeOfAssignedElement = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(typeOfAssignedElement.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignedElement.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
//1. The assigned part must be assignable, i.e.:
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null
- && 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().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 ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null && 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().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;
}
//1.a It must resolve to a property, or
//1.b It must resolve to a local variable, or
//1.c It must resolve to an out or inout parameter
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
- 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.length() == 0)) {
- error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
+ 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.length() == 0)) {
+ error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
- }
- else {// a suffix is specified
- // The last suffix must be a property call expression
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ } else {// a suffix is specified
+ // The last suffix must be a property call expression
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (! (lastSuffix instanceof PropertyCallExpression)) {
- error("The assigned part must resolve to an assignable property, parameter or local variable",
- AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ error("The assigned part must resolve to an assignable property, parameter or local variable", AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
+ return;
}
}
-
- TypeExpression integerExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._integer) ;
- TypeExpression naturalExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._natural) ;
- TypeExpression unlimitedExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._unlimited) ;
- String operator = isAPrefixExpression ? statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() : statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp() ;
- EStructuralFeature feature = isAPrefixExpression ? AlfPackage.eINSTANCE.getNameExpression_PrefixOp() : AlfPackage.eINSTANCE.getNameExpression_PostfixOp() ;
- if (! (integerExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0 ||
- naturalExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0 ||
- unlimitedExpression.isCompatibleWithMe(typeOfAssignedElement)!= 0)) {
- error("Operator " + operator + " does not apply to " + typeOfAssignedElement.getLabel() ,
- statement.getTypePart_OR_assignedPart_OR_invocationPart(),
- feature,
- INSIGNIFICANT_INDEX) ;
+
+ TypeExpression integerExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._integer);
+ TypeExpression naturalExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._natural);
+ TypeExpression unlimitedExpression = TypeExpressionFactory.eInstance.createTypeExpression(TypeUtils._unlimited);
+ String operator = isAPrefixExpression ? statement.getTypePart_OR_assignedPart_OR_invocationPart().getPrefixOp() : statement.getTypePart_OR_assignedPart_OR_invocationPart().getPostfixOp();
+ EStructuralFeature feature = isAPrefixExpression ? AlfPackage.eINSTANCE.getNameExpression_PrefixOp() : AlfPackage.eINSTANCE.getNameExpression_PostfixOp();
+ if(!(integerExpression.isCompatibleWithMe(typeOfAssignedElement) != 0 || naturalExpression.isCompatibleWithMe(typeOfAssignedElement) != 0 || unlimitedExpression.isCompatibleWithMe(typeOfAssignedElement) != 0)) {
+ error("Operator " + operator + " does not apply to " + typeOfAssignedElement.getLabel(), statement.getTypePart_OR_assignedPart_OR_invocationPart(), feature, INSIGNIFICANT_INDEX);
}
}
}
-
-
+
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
- * 2. the variable name must be available
- * 3. initValue must respect the following sub-rules:
- * 3.a the type of the expression must be compatible with the type of the variable
- * 3.b the assignment operator must be '='
+ * Checks the following rule:
+ * 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
+ * 2. the variable name must be available
+ * 3. initValue must respect the following sub-rules:
+ * 3.a the type of the expression must be compatible with the type of the variable
+ * 3.b the assignment operator must be '='
*/
private void checkVariableDeclarationStatement(InvocationOrAssignementOrDeclarationStatement statement) {
// 1. typePart_OR_assignedPart_OR_invocationPart must resolve to a type
- VoidFacade actualVariableType = null ;
- TypeFacade cddVariableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (cddVariableType instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)cddVariableType ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- }
- else {
- actualVariableType = (VoidFacade)cddVariableType ;
+ VoidFacade actualVariableType = null;
+ TypeFacade cddVariableType = TypeFacadeFactory.eInstance.createVoidFacade(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(cddVariableType instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)cddVariableType;
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ } else {
+ actualVariableType = (VoidFacade)cddVariableType;
}
- VariableDeclarationCompletion declaration = statement.getVariableDeclarationCompletion() ;
- TypeExpression variableTypeExpression = null ;
- if (actualVariableType != null) {
- if (declaration.isMultiplicityIndicator())
- variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 0, -1, false, true) ;
- else
- variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 1, 1, true, false) ;
+ VariableDeclarationCompletion declaration = statement.getVariableDeclarationCompletion();
+ TypeExpression variableTypeExpression = null;
+ if(actualVariableType != null) {
+ if(declaration.isMultiplicityIndicator()) {
+ variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 0, -1, false, true);
+ } else {
+ variableTypeExpression = TypeExpressionFactory.eInstance.createTypeExpression(actualVariableType, 1, 1, true, false);
+ }
}
-
+
// 2. the variable name must be available
- AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement) ;
- if (declaration.getVariableName() != null ) {
- List<EObject> visibleElements = vppScope.resolveByName(declaration.getVariableName()) ;
- if (! visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
- String errorMessage = "Local name " + declaration.getVariableName() + " is not available" ;
- error(errorMessage, declaration, AlfPackage.eINSTANCE.getVariableDeclarationCompletion_VariableName(), INSIGNIFICANT_INDEX) ;
+ AlfPartialScope vppScope = AlfScopeProvider.scopingTool.getVisibleVariablesOrParametersOrProperties(statement);
+ if(declaration.getVariableName() != null) {
+ List<EObject> visibleElements = vppScope.resolveByName(declaration.getVariableName());
+ if(!visibleElements.isEmpty() && vppScope.getScopingLevel(visibleElements.get(0)) == 0) {
+ String errorMessage = "Local name " + declaration.getVariableName() + " is not available";
+ error(errorMessage, declaration, AlfPackage.eINSTANCE.getVariableDeclarationCompletion_VariableName(), INSIGNIFICANT_INDEX);
}
}
-
+
//3. initValue must respect the following sub-rules:
- if (declaration.getInitValue() != null && declaration.getInitValue().getRightHandSide() != null) {
- TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(declaration.getInitValue().getRightHandSide()) ;
- if (typeOfInit == null) {
- String errorMessage = "Init value is missing" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_VariableDeclarationCompletion()) ;
- return ;
+ if(declaration.getInitValue() != null && declaration.getInitValue().getRightHandSide() != null) {
+ TypeExpression typeOfInit = new TypeUtils().getTypeOfSequenceElement(declaration.getInitValue().getRightHandSide());
+ if(typeOfInit == null) {
+ String errorMessage = "Init value is missing";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_VariableDeclarationCompletion());
+ return;
}
- if (typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ if(typeOfInit.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInit.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
- if (variableTypeExpression != null) {
+ if(variableTypeExpression != null) {
// 3.a the type of the expression must be compatible with the type of the variable
- if (variableTypeExpression.isCompatibleWithMe(typeOfInit) == 0) {
- String errorMessage = "Expecting an expression of type " + variableTypeExpression.getLabel() +
- ". Found an expression of type " + typeOfInit.getLabel() + "." ;
- error(errorMessage,
- declaration.getInitValue(),
- AlfPackage.eINSTANCE.getAssignmentCompletion_RightHandSide(),
- INSIGNIFICANT_INDEX) ;
+ if(variableTypeExpression.isCompatibleWithMe(typeOfInit) == 0) {
+ String errorMessage = "Expecting an expression of type " + variableTypeExpression.getLabel() + ". Found an expression of type " + typeOfInit.getLabel() + ".";
+ error(errorMessage, declaration.getInitValue(), AlfPackage.eINSTANCE.getAssignmentCompletion_RightHandSide(), INSIGNIFICANT_INDEX);
}
// 3.b the assignment operator must be '='
- else if (declaration.getInitValue().getOp() != AssignmentOperator.ASSIGN) {
- String errorMessage = "Expecting assignment operator '='" ;
- error(errorMessage,
- declaration.getInitValue(),
- AlfPackage.eINSTANCE.getAssignmentCompletion_Op(),
- INSIGNIFICANT_INDEX) ;
+ else if(declaration.getInitValue().getOp() != AssignmentOperator.ASSIGN) {
+ String errorMessage = "Expecting assignment operator '='";
+ error(errorMessage, declaration.getInitValue(), AlfPackage.eINSTANCE.getAssignmentCompletion_Op(), INSIGNIFICANT_INDEX);
}
}
}
}
-
-
+
+
/**
*
* @param statement
*
- * Checks the following rules:
- * 1. The left part must be assignable, i.e.:
- * 1.a It must resolve to a property, or
- * 1.b It must resolve to a local variable, or
- * 1.c It must resolve to an out or inout parameter
- * 1.d It resolves to an association end TODO: Not supported yet
- * 2. If the assignment operator is "=", the right part must be type compatible with the left part
- * 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ * Checks the following rules:
+ * 1. The left part must be assignable, i.e.:
+ * 1.a It must resolve to a property, or
+ * 1.b It must resolve to a local variable, or
+ * 1.c It must resolve to an out or inout parameter
+ * 1.d It resolves to an association end TODO: Not supported yet
+ * 2. If the assignment operator is "=", the right part must be type compatible with the left part
+ * 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
*/
private void checkAssignmentExpression(InvocationOrAssignementOrDeclarationStatement statement) {
- boolean errorInExpressions = false ;
+ boolean errorInExpressions = false;
// first infer type of the left part
- TypeExpression typeOfLeft = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart()) ;
- if (typeOfLeft.getTypeFacade() == null || typeOfLeft.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfLeft.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfLeft = new TypeUtils().getTypeOfNameExpression(statement.getTypePart_OR_assignedPart_OR_invocationPart());
+ if(typeOfLeft.getTypeFacade() == null || typeOfLeft.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfLeft.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
// then infer type of the right part
- TypeExpression typeOfRight = null ;
- if (statement.getAssignmentCompletion().getRightHandSide() != null) {
- typeOfRight = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide()) ;
- if (typeOfRight == null || typeOfRight.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfRight.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- errorInExpressions = true ;
+ TypeExpression typeOfRight = null;
+ if(statement.getAssignmentCompletion().getRightHandSide() != null) {
+ typeOfRight = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide());
+ if(typeOfRight == null || typeOfRight.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfRight.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ errorInExpressions = true;
}
}
- if (errorInExpressions) // not necessary to validate further
- return ;
-
+ if(errorInExpressions) {
+ return;
+ }
+
//1. The left part must be assignable, i.e.:
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null ||
- (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null
- && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) ||
- (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 ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getPath() != null || (statement.getTypePart_OR_assignedPart_OR_invocationPart().getInvocationCompletion() != null && statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) || (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()) ;
+ 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
- return ;
+ return;
}
//1.a It must resolve to a property, or
//1.b It must resolve to a local variable, or
//1.c It must resolve to an out or inout parameter
- if (statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
- 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.length() == 0)) {
- error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart()) ;
+ if(statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() == null) {
+ 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.length() == 0)) {
+ error(potentialAssignmentError, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_TypePart_OR_assignedPart_OR_invocationPart());
}
- }
- else {// a suffix is specified
- // The last suffix must be a property call expression
- SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ } else {// a suffix is specified
+ // The last suffix must be a property call expression
+ SuffixExpression suffix = statement.getTypePart_OR_assignedPart_OR_invocationPart().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (! (lastSuffix instanceof PropertyCallExpression)) {
- 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()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ 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());
+ return;
}
}
-
+
// 2. If the assignment operator is "=", the right part must be type compatible with the left part
- if (statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
- if (typeOfRight.getTypeFacade() == TypeUtils._undefined) {
- String errorMessage = "Right part is untyped" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
- }
- else if (typeOfLeft.isCompatibleWithMe(typeOfRight) == 0) {
- String errorMessage = "Cannot assign " + typeOfRight.getLabel() + " to " + typeOfLeft.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ if(statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
+ if(typeOfRight.getTypeFacade() == TypeUtils._undefined) {
+ String errorMessage = "Right part is untyped";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
+ } else if(typeOfLeft.isCompatibleWithMe(typeOfRight) == 0) {
+ String errorMessage = "Cannot assign " + typeOfRight.getLabel() + " to " + typeOfLeft.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
}
- }
- else { // 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp()) ;
- List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp) ;
- List<TypeExpression> arguments = new ArrayList<TypeExpression>() ;
- arguments.add(typeOfLeft) ;
- arguments.add(typeOfRight) ;
- List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates) ;
- if (matchingSignatures.isEmpty()) {
- String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (" ;
- boolean first = true ;
- for (TypeExpression argType : arguments) {
- if (!first)
- errorMessage += ", " ;
- else
- first = false ;
- errorMessage += argType.getLabel() ;
+ } else { // 3. If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp());
+ List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp);
+ List<TypeExpression> arguments = new ArrayList<TypeExpression>();
+ arguments.add(typeOfLeft);
+ arguments.add(typeOfRight);
+ List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates);
+ if(matchingSignatures.isEmpty()) {
+ String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (";
+ boolean first = true;
+ for(TypeExpression argType : arguments) {
+ if(!first) {
+ errorMessage += ", ";
+ } else {
+ first = false;
+ }
+ errorMessage += argType.getLabel();
}
- errorMessage += ")" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ errorMessage += ")";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. The associated SuperInvocationExpression must be valid
+ * Checks the following rule:
+ * 1. The associated SuperInvocationExpression must be valid
*/
@Check
public void checkSuperInvocationStatement(SuperInvocationStatement statement) {
- TypeExpression typeOfSuperInvocationExp = new TypeUtils().getTypeOfSuperInvocationExpression(statement.get_super()) ;
- if (typeOfSuperInvocationExp.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfSuperInvocationExp.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ TypeExpression typeOfSuperInvocationExp = new TypeUtils().getTypeOfSuperInvocationExpression(statement.get_super());
+ if(typeOfSuperInvocationExp.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfSuperInvocationExp.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
}
-
+
/**
* @param statement
*
- * Checks the following rules:
- * 1. The associated ThisExpression must be valid
- * 2. If an assignment is specified:
- * 2.a The left part must resolve to a property call expression
- * 2.b If the assignment operator is "=", the right part must be type compatible with the left part
- * 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- * 3. If no assignment is specified, the suffix must resolve to an invocation
+ * Checks the following rules:
+ * 1. The associated ThisExpression must be valid
+ * 2. If an assignment is specified:
+ * 2.a The left part must resolve to a property call expression
+ * 2.b If the assignment operator is "=", the right part must be type compatible with the left part
+ * 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ * 3. If no assignment is specified, the suffix must resolve to an invocation
*/
@Check
public void checkThisInvocationStatement(ThisInvocationStatement statement) {
// 1. The associated ThisExpression must be valid
- TypeExpression typeOfThisExpression = new TypeUtils().getTypeOfThisExpression(statement.get_this()) ;
- if (typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfThisExpression.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
+ TypeExpression typeOfThisExpression = new TypeUtils().getTypeOfThisExpression(statement.get_this());
+ if(typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfThisExpression.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
// return ;
}
-
+
// 2. If an assignment is specified
- if (statement.getAssignmentCompletion() != null ) {
+ if(statement.getAssignmentCompletion() != null) {
// 2.a The left part must resolve to a property call expression
- if (statement.get_this().getSuffix() == null) {
- error("A Property call expression is missing",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
+ if(statement.get_this().getSuffix() == null) {
+ error("A Property call expression is missing", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
//return ;
- }
- else {
+ } else {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_this().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_this().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (!(lastSuffix instanceof PropertyCallExpression)) {
- error("The expression should resolve to a Property",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(!(lastSuffix instanceof PropertyCallExpression)) {
+ error("The expression should resolve to a Property", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
//return ;
}
}
-
- TypeExpression typeOfAssignment = null ;
-
- if (statement.getAssignmentCompletion().getRightHandSide() == null)
- return ;
- else {
- typeOfAssignment = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide()) ;
- if (typeOfAssignment.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignment.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+
+ TypeExpression typeOfAssignment = null;
+
+ if(statement.getAssignmentCompletion().getRightHandSide() == null) {
+ return;
+ } else {
+ typeOfAssignment = new TypeUtils().getTypeOfSequenceElement(statement.getAssignmentCompletion().getRightHandSide());
+ if(typeOfAssignment.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfAssignment.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
+ }
+ if(typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ return;
}
- if (typeOfThisExpression.getTypeFacade() instanceof ErrorTypeFacade)
- return ;
}
-
+
// 2.b If the assignment operator is "=", the right part must be type compatible with the left part
- if (statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
- if (typeOfAssignment.getTypeFacade() == TypeUtils._undefined) {
- String errorMessage = "Right part is untyped" ;
- error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion()) ;
+ if(statement.getAssignmentCompletion().getOp() == AssignmentOperator.ASSIGN) {
+ if(typeOfAssignment.getTypeFacade() == TypeUtils._undefined) {
+ String errorMessage = "Right part is untyped";
+ error(errorMessage, AlfPackage.eINSTANCE.getInvocationOrAssignementOrDeclarationStatement_AssignmentCompletion());
+ } else if(typeOfThisExpression.isCompatibleWithMe(typeOfAssignment) == 0) {
+ String errorMessage = "Cannot assign " + typeOfAssignment.getLabel() + " to " + typeOfThisExpression.getLabel();
+ error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion());
}
- else if (typeOfThisExpression.isCompatibleWithMe(typeOfAssignment) == 0) {
- String errorMessage = "Cannot assign " + typeOfAssignment.getLabel() + " to " + typeOfThisExpression.getLabel() ;
- error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion()) ;
- }
- }
- else { // 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
- String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp()) ;
- List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp) ;
- List<TypeExpression> arguments = new ArrayList<TypeExpression>() ;
- arguments.add(typeOfThisExpression) ;
- arguments.add(typeOfAssignment) ;
- List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates) ;
- if (matchingSignatures.isEmpty()) {
- String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (" ;
- boolean first = true ;
- for (TypeExpression argType : arguments) {
- if (!first)
- errorMessage += ", " ;
- else
- first = false ;
- errorMessage += argType.getLabel() ;
+ } else { // 2.c If the assignment operator is not "=" (e.g. +=, -=, etc.), there must be a matching signature for this operator
+ String assignmentOp = assignmentOpToString(statement.getAssignmentCompletion().getOp());
+ List<SignatureFacade> candidates = AlfJavaValidator.predefinedBehaviorsAndTypes.getSignatures(assignmentOp);
+ List<TypeExpression> arguments = new ArrayList<TypeExpression>();
+ arguments.add(typeOfThisExpression);
+ arguments.add(typeOfAssignment);
+ List<SignatureFacade> matchingSignatures = SignatureFacade.findNearestSignature(arguments, candidates);
+ if(matchingSignatures.isEmpty()) {
+ String errorMessage = "Operator " + assignmentOp + " does not apply to arguments (";
+ boolean first = true;
+ for(TypeExpression argType : arguments) {
+ if(!first) {
+ errorMessage += ", ";
+ } else {
+ first = false;
+ }
+ errorMessage += argType.getLabel();
}
- errorMessage += ")" ;
- error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion()) ;
+ errorMessage += ")";
+ error(errorMessage, AlfPackage.eINSTANCE.getThisInvocationStatement_AssignmentCompletion());
}
}
- }
- else { // 3. If no assignment is specified, the suffix must resolve to an invocation
- if (statement.get_this().getSuffix() == null) {
- error("An invocation expression is expected",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
- return ;
- }
- else {
+ } else { // 3. If no assignment is specified, the suffix must resolve to an invocation
+ if(statement.get_this().getSuffix() == null) {
+ error("An invocation expression is expected", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
+ return;
+ } else {
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_this().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_this().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An assignment is expected",
- AlfPackage.eINSTANCE.getThisInvocationStatement__this()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An assignment is expected", AlfPackage.eINSTANCE.getThisInvocationStatement__this());
+ return;
}
}
}
}
-
+
/**
* @param statement
*
- * Checks the following rule:
- * 1. The InstanceCreationExpression must be valid
- * 2. If a suffix is specified, it must resolve to an invocation
+ * Checks the following rule:
+ * 1. The InstanceCreationExpression must be valid
+ * 2. If a suffix is specified, it must resolve to an invocation
*/
@Check
public void checkInstanceCreationInvocationStatement(InstanceCreationInvocationStatement statement) {
// 1. The InstanceCreationExpression must be valid
- TypeExpression typeOfInstanceCreationExpression = new TypeUtils().getTypeOfInstanceCreationExpression(statement.get_new()) ;
- if (typeOfInstanceCreationExpression.getTypeFacade() instanceof ErrorTypeFacade) {
- ErrorTypeFacade error = (ErrorTypeFacade)typeOfInstanceCreationExpression.getTypeFacade() ;
- error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX) ;
- return ;
+ TypeExpression typeOfInstanceCreationExpression = new TypeUtils().getTypeOfInstanceCreationExpression(statement.get_new());
+ if(typeOfInstanceCreationExpression.getTypeFacade() instanceof ErrorTypeFacade) {
+ ErrorTypeFacade error = (ErrorTypeFacade)typeOfInstanceCreationExpression.getTypeFacade();
+ error(error.getLabel(), error.getErrorSource(), error.getStructuralFeature(), INSIGNIFICANT_INDEX);
+ return;
}
-
+
// 2. If a suffix is specified, it must resolve to an invocation
// The last suffix must be an invocation
- SuffixExpression suffix = statement.get_new().getSuffix() ;
- SuffixExpression lastSuffix = suffix ;
- boolean suffixHasASuffix = false ;
+ SuffixExpression suffix = statement.get_new().getSuffix();
+ SuffixExpression lastSuffix = suffix;
+ boolean suffixHasASuffix = false;
do {
- suffixHasASuffix = false ;
- for (Iterator<EObject> content = suffix.eContents().iterator() ; content.hasNext() && !suffixHasASuffix ; ) {
- EObject cddSuffix = content.next() ;
- if (cddSuffix instanceof SuffixExpression) {
- lastSuffix = (SuffixExpression)cddSuffix ;
- suffixHasASuffix = true ;
+ suffixHasASuffix = false;
+ for(Iterator<EObject> content = suffix.eContents().iterator(); content.hasNext() && !suffixHasASuffix;) {
+ EObject cddSuffix = content.next();
+ if(cddSuffix instanceof SuffixExpression) {
+ lastSuffix = (SuffixExpression)cddSuffix;
+ suffixHasASuffix = true;
}
}
- if (suffixHasASuffix)
- suffix = lastSuffix ;
- } while (suffixHasASuffix) ;
- if (lastSuffix instanceof PropertyCallExpression) {
- error("An invocation is expected",
- AlfPackage.eINSTANCE.getInstanceCreationInvocationStatement__new()) ;
- return ;
+ if(suffixHasASuffix) {
+ suffix = lastSuffix;
+ }
+ } while(suffixHasASuffix);
+ if(lastSuffix instanceof PropertyCallExpression) {
+ error("An invocation is expected", AlfPackage.eINSTANCE.getInstanceCreationInvocationStatement__new());
+ return;
}
}
-
+
private String assignmentOpToString(AssignmentOperator operator) {
- switch (operator) {
+ switch(operator) {
case ANDASSIGN:
- return "&" ;
+ return "&";
case DIVASSIGN:
- return "/" ;
+ return "/";
case LSHIFTASSIGN:
- return "<<" ;
+ return "<<";
case MINUSASSIGN:
- return "-" ;
+ return "-";
case MODASSIGN:
- return "%" ;
+ return "%";
case MULTASSIGN:
- return "*" ;
+ return "*";
case ORASSIGN:
- return "|" ;
+ return "|";
case PLUSASSIGN:
- return "+" ;
+ return "+";
case RSHIFTASSIGN:
- return ">>" ;
+ return ">>";
case URSHIFTASSIGN:
- return ">>>" ;
+ return ">>>";
case XORASSIGN:
- return "^" ;
+ return "^";
case ASSIGN:
- return "=" ;
+ return "=";
}
- return "" ; // not reachable
+ return ""; // not reachable
}
-
+
private boolean isANumberType(TypeFacade typeFacade) {
- return TypeUtils._integer.isCompatibleWithMe(typeFacade) == 3 ||
- TypeUtils._natural.isCompatibleWithMe(typeFacade) == 3 ||
- TypeUtils._unlimited.isCompatibleWithMe(typeFacade) == 3 ;
+ return TypeUtils._integer.isCompatibleWithMe(typeFacade) == 3 || TypeUtils._natural.isCompatibleWithMe(typeFacade) == 3 || TypeUtils._unlimited.isCompatibleWithMe(typeFacade) == 3;
}
-
+
@Check
public void checkTemplateBindingInNameExpression(UnqualifiedName expression) {
- if (expression.getTemplateBinding() != null) {
- String errorMessage = "Template bindings are not supported in name expressions." ; // TODO
- warning(errorMessage, AlfPackage.eINSTANCE.getUnqualifiedName_TemplateBinding()) ;
+ if(expression.getTemplateBinding() != null) {
+ String errorMessage = "Template bindings are not supported in name expressions."; // TODO
+ warning(errorMessage, AlfPackage.eINSTANCE.getUnqualifiedName_TemplateBinding());
}
}
-
+
@Check
public void checkTemplateBindingInQualifiedNameWithBinding(QualifiedNameWithBinding expression) {
//if (expression.getBinding() != null) {
@@ -1427,4 +1381,4 @@ public class AlfJavaValidator extends AbstractAlfJavaValidator {
// warning(errorMessage, AlfPackage.eINSTANCE.getQualifiedNameWithBinding_Binding()) ;
//}
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
index 1512ee93d7b..e907d717353 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/schema/aspectToolProvider.exsd
@@ -89,7 +89,7 @@
This is the class that implements the provider.
</documentation>
<appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.uml.diagram.paletteconfiguration.service.IAspectActionProvider"/>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.uml.diagram.common.service.palette.IAspectActionProvider"/>
</appInfo>
</annotation>
</attribute>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
index ab0abafaf42..c3a6f30ecc2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/handlers/GraphicalCommandHandler.java
@@ -130,7 +130,7 @@ public abstract class GraphicalCommandHandler extends AbstractHandler {
* @return the editing domain (can be null)
*/
protected TransactionalEditingDomain getEditingDomain() {
- ServiceUtilsForActionHandlers serviceUtils = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers serviceUtils = ServiceUtilsForActionHandlers.getInstance();
TransactionalEditingDomain editingDomain = null;
try {
editingDomain = serviceUtils.getTransactionalEditingDomain();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
index 9bd01a2c2fa..fae86a714fa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/DiagramDecorationAdapter.java
@@ -13,6 +13,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.providers;
+import java.util.List;
+
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Locator;
@@ -20,7 +22,6 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.handles.HandleBounds;
@@ -47,9 +48,9 @@ public class DiagramDecorationAdapter {
/** The decoration. */
- protected EList<IDecoration> decorations;
+ protected List<IDecoration> decorations;
- protected EList<IPapyrusDecoration> pDecorations;
+ protected List<IPapyrusDecoration> pDecorations;
/** The decoration image. */
protected Image decorationImage;
@@ -132,7 +133,7 @@ public class DiagramDecorationAdapter {
* the is volatile
* @return the set of JFace decorations
*/
- public EList<IDecoration> setDecorations(EList<IPapyrusDecoration> pDecorations, int percentageFromSource, int margin, boolean isVolatile) {
+ public List<IDecoration> setDecorations(List<IPapyrusDecoration> pDecorations, int percentageFromSource, int margin, boolean isVolatile) {
final int distBetweenIconsPercent = 20;
final int percentageMin = 10;
@@ -321,10 +322,7 @@ public class DiagramDecorationAdapter {
}
public void relocate(IFigure target) {
- Rectangle bounds =
- reference instanceof HandleBounds
- ? new PrecisionRectangle(((HandleBounds)reference).getHandleBounds())
- : new PrecisionRectangle(reference.getBounds());
+ Rectangle bounds = reference instanceof HandleBounds ? new PrecisionRectangle(((HandleBounds)reference).getHandleBounds()) : new PrecisionRectangle(reference.getBounds());
reference.translateToAbsolute(bounds);
target.translateToRelative(bounds);
@@ -337,8 +335,7 @@ public class DiagramDecorationAdapter {
if(decorationX > pTL.x) {
// only set position, if it is inside the figure, i.e. bigger than left margin
pDecoration.setX(decorationX);
- }
- else {
+ } else {
pDecoration.setX(pTL.x);
}
target.setLocation(pDecoration);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
index 1c9b0020c6b..6fffc9ccdfc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/providers/ValidationDecoratorProvider.java
@@ -18,11 +18,11 @@ package org.eclipse.papyrus.uml.diagram.common.providers;
import static org.eclipse.papyrus.uml.diagram.common.Activator.log;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.EditPart;
@@ -172,7 +172,7 @@ public abstract class ValidationDecoratorProvider extends AbstractProvider imple
// add decoration
if(editPart instanceof org.eclipse.gef.GraphicalEditPart) {
if(view.getElement() != null) {
- EList<IPapyrusDecoration> decorations = decorationService.getDecorations(view.getElement(), false);
+ List<IPapyrusDecoration> decorations = decorationService.getDecorations(view.getElement(), false);
if((decorations != null) && (decorations.size() > 0)) {
if(view instanceof Edge) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
index 16974a0e1e9..33a36f69640 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/AspectUnspecifiedTypeConnectionTool.java
@@ -52,6 +52,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
@@ -284,7 +285,7 @@ public class AspectUnspecifiedTypeConnectionTool extends UnspecifiedTypeConnecti
listener = new NotificationListener() {
public void notifyChanged(Notification notification) {
- Connector newValue = (Connector)notification.getNewValue();
+ Edge newValue = (Edge)notification.getNewValue();
EditPart editPart = (EditPart)getCurrentViewer().getEditPartRegistry().get(newValue);
for(IAspectAction action : postActions) {
action.run(editPart);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
index 5eaf1fe94e9..57c1d88e654 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/META-INF/MANIFEST.MF
@@ -46,7 +46,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
index cf877615b7a..569946a242f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/META-INF/MANIFEST.MF
@@ -58,7 +58,8 @@ Require-Bundle: org.eclipse.emf.ecore,
org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
index 4d134dd0690..abe1686f99c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/CreateEMFTreeDiagramHandler.java
@@ -13,13 +13,14 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.emftree;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.diagram.common.handler.CreateDiagramHandler;
public class CreateEMFTreeDiagramHandler extends CreateDiagramHandler {
@Override
- protected void addNewDiagram() {
- addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null);
+ protected void addNewDiagram(ServicesRegistry registry) {
+ addNewDiagram("Emf Tree", EmfTreeDiagramEditorFactory.EMF_DIAGRAM_TYPE, null, registry);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
index c25947a78b5..e78ca24bcbe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.emftree/src/org/eclipse/papyrus/uml/diagram/emftree/UMLEditor.java
@@ -161,7 +161,6 @@ public class UMLEditor extends org.eclipse.uml2.uml.editor.presentation.UMLEdito
@Override
public void init(IEditorSite site, IEditorInput editorInput) {
- System.out.println(this.getClass().getSimpleName() + ".init()");
super.init(site, editorInput);
setPartName("emf tree");
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
index 28e2db65643..56348e0d539 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/META-INF/MANIFEST.MF
@@ -17,7 +17,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0",
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
index 11b197c3f92..be7050ae4fb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/plugin.xml
@@ -8,7 +8,7 @@
contentProvider="org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramContentProvider"
icon="icon/diagrams.gif"
id="org.eclipse.papyrus.views.modelexplorer.DiagramNavigatorContent"
- labelProvider="org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramLabelProvider"
+ labelProvider="org.eclipse.jface.viewers.LabelProvider"
name="Diagram Model Contents"
priority="lower">
<triggerPoints>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
index 249e06a42a1..1d94500b840 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/handler/DiagramViewHandler.java
@@ -16,11 +16,14 @@ package org.eclipse.papyrus.uml.diagram.modelexplorer.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
import org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramContentProvider;
-import org.eclipse.papyrus.uml.diagram.modelexplorer.provider.DiagramLabelProvider;
-import org.eclipse.papyrus.views.modelexplorer.DecoratingLabelProviderWTooltips;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ToolItem;
@@ -55,13 +58,20 @@ public class DiagramViewHandler extends AbstractHandler {
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
+ ILabelProvider labelProvider;
+ try {
+ labelProvider = ServiceUtilsForHandlers.getInstance().getService(LabelProviderService.class, event).getLabelProvider();
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ labelProvider = new LabelProvider();
+ }
+
if(((ToolItem)((Event)event.getTrigger()).widget).getSelection()) {
getCommonNavigator().getCommonViewer().setContentProvider(new DiagramContentProvider());
- getCommonNavigator().getCommonViewer().setLabelProvider(new DiagramLabelProvider());
} else {
getCommonNavigator().getCommonViewer().setContentProvider(new MoDiscoContentProvider());
- getCommonNavigator().getCommonViewer().setLabelProvider(new DecoratingLabelProviderWTooltips(new MoDiscoLabelProvider()));
}
+ getCommonNavigator().getCommonViewer().setLabelProvider(labelProvider);
getCommonNavigator().getCommonViewer().refresh();
return null;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
index c0e64978f55..869cf98acbc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramContentProvider.java
@@ -22,7 +22,6 @@ import org.eclipse.papyrus.infra.core.resource.ModelUtils;
import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.DiSashModelMngr;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
/**
@@ -31,6 +30,7 @@ import org.eclipse.papyrus.uml.diagram.modelexplorer.Activator;
*
*/
//TODO : This ContentProvider should extend SemanticUMLContentProvider
+@Deprecated
public class DiagramContentProvider extends MoDiscoContentProvider {
@Override
@@ -82,8 +82,9 @@ public class DiagramContentProvider extends MoDiscoContentProvider {
result.add((EObject)pageMngr.allPages().get(i));
}
}
+
EObject[] eObject = new EObject[result.size()];
- return NotationUtils.getNotationModel().getResource().getContents().toArray(eObject);
+ return result.toArray(eObject);
} catch (Exception e) {
Activator.log.error(e);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java
deleted file mode 100644
index 37a150ef984..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.modelexplorer/src/org/eclipse/papyrus/uml/diagram/modelexplorer/provider/DiagramLabelProvider.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.modelexplorer.provider;
-
-
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider;
-import org.eclipse.uml2.uml.NamedElement;
-
-/**
- * the label provider that inherits of modisco label provider
- *
- */
-public class DiagramLabelProvider extends MoDiscoLabelProvider {
-
- /** icon registry */
- private IPageIconsRegistry editorRegistry=null;
-
- /**
-
- /**
- * Get the EditorRegistry used to create editor instances. This default
- * implementation return the singleton eINSTANCE. This method can be
- * subclassed to return another registry.
- *
- * @return the singleton eINSTANCE of editor registry
- * @throws ServiceException
- */
- @Override
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- * @throws ServiceException
- */
- @Override
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
- } catch (ServiceException e) {
- // Not found, return an empty one which return null for each
- // request.
- return new PageIconsRegistry();
- }
- }
- /**
- * {@inheritDoc}
- */
- @Override
- public String getText(Object element) {
- String text = super.getText(element);
- if(element instanceof Diagram) {
- Diagram diagram = (Diagram)element;
- if(diagram.getElement() instanceof NamedElement){
- text = text +" [" +((NamedElement)diagram.getElement()).getQualifiedName()+"]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return text;
- }
-
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
index 406abd20198..2ac1131b6d1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.navigation/src/org/eclipse/papyrus/uml/diagram/navigation/UMLNavigationHelper.java
@@ -23,29 +23,33 @@ import org.eclipse.uml2.uml.UMLPackage;
public class UMLNavigationHelper {
public static final String BEHAVIORAL_NAVIGATION = "Behavioral";
+
public static final String STRUCTURAL_NAVIGATION = "Structural";
@SuppressWarnings("serial")
- private static HashMap<EStructuralFeature, String> featureNavigationTypeMap = new HashMap<EStructuralFeature, String >() {{
- put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__CLASSIFIER_BEHAVIOR, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.CALL_BEHAVIOR_ACTION__BEHAVIOR, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.BEHAVIORAL_FEATURE__METHOD, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__ENTRY, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__DO_ACTIVITY, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.STATE__EXIT, BEHAVIORAL_NAVIGATION);
- put(UMLPackage.Literals.TRANSITION__EFFECT, BEHAVIORAL_NAVIGATION);
-
- put(UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, STRUCTURAL_NAVIGATION);
- put(UMLPackage.Literals.ELEMENT__OWNED_ELEMENT, STRUCTURAL_NAVIGATION);
- put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__OWNED_BEHAVIOR, STRUCTURAL_NAVIGATION);
- }};
+ private static HashMap<EStructuralFeature, String> featureNavigationTypeMap = new HashMap<EStructuralFeature, String>() {
+
+ {
+ put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__CLASSIFIER_BEHAVIOR, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.CALL_BEHAVIOR_ACTION__BEHAVIOR, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.BEHAVIORAL_FEATURE__METHOD, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__ENTRY, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__DO_ACTIVITY, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.STATE__EXIT, BEHAVIORAL_NAVIGATION);
+ put(UMLPackage.Literals.TRANSITION__EFFECT, BEHAVIORAL_NAVIGATION);
+
+ put(UMLPackage.Literals.PACKAGE__PACKAGED_ELEMENT, STRUCTURAL_NAVIGATION);
+ put(UMLPackage.Literals.ELEMENT__OWNED_ELEMENT, STRUCTURAL_NAVIGATION);
+ put(UMLPackage.Literals.BEHAVIORED_CLASSIFIER__OWNED_BEHAVIOR, STRUCTURAL_NAVIGATION);
+ }
+ };
public static String getNavigationType(NavigableElement navElement) {
return getNavigationTypeFromFeature(navElement.getFeature());
}
public static String getNavigationTypeFromFeature(EStructuralFeature feature) {
- if (feature == null) {
+ if(feature == null) {
// no feature specified, report structural
// because it is the root element
return STRUCTURAL_NAVIGATION;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
index 17f9ccd06d7..fb7f3c08c00 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/prop/seq.ctx
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ASCII"?>
<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" name="SequenceNotation">
- <tabs label="Appearance" id="appearance" category="org.eclipse.papyrus" priority="10">
+ <tabs label="Appearance" id="appearance" category="org.eclipse.papyrus" priority="75">
<sections name="CombinedFragmentTitle" sectionFile="ui/CombinedFragmentTitle.xwt">
<widget href="ui/CombinedFragmentTitle.xwt#/"/>
</sections>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
index 452b9acc460..4ca16a4d41f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/META-INF/MANIFEST.MF
@@ -61,7 +61,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
org.eclipse.papyrus.infra.extendedtypes;bundle-version="0.10.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0"
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Eclipse-LazyStart: true
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
index 8edf4f75977..9fc380c0405 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/handler/ChangeShapeHandler.java
@@ -66,7 +66,7 @@ public abstract class ChangeShapeHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final GraphicalEditPart editPart = getSelectedGraphicalEditpart();
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers util = ServiceUtilsForActionHandlers.getInstance();
try {
transactionalEditingDomain = util.getTransactionalEditingDomain();
} catch (Exception e) {
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
index 427a2f6421f..141f5ab11fd 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/plugin.xml
@@ -10,8 +10,14 @@
<modelqueryset file="resource/PapyrusBrowserQuery.querySet"/>
</extension>
<extension point="org.eclipse.ui.navigator.navigatorContent">
- <navigatorContent activeByDefault="true" contentProvider="org.eclipse.papyrus.uml.modelexplorer.UMLContentProvider" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif" id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent"
- labelProvider="org.eclipse.papyrus.views.modelexplorer.MoDiscoLabelProvider" name="UML Model Contents" priority="lower">
+ <navigatorContent
+ activeByDefault="true"
+ contentProvider="org.eclipse.papyrus.uml.tools.providers.UMLContentProvider"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"
+ id="org.eclipse.papyrus.views.modelexplorer.UMLnavigatorContent"
+ labelProvider="org.eclipse.jface.viewers.LabelProvider"
+ name="UML Model Contents"
+ priority="lower">
<triggerPoints>
<or>
<instanceof value="org.eclipse.emf.ecore.EObject">
@@ -122,7 +128,7 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.ArtifactHandler" description="Create a new Artifact" id="org.eclipse.papyrus.uml.modelexplorer.ArtifactCreateCommand" name="Create a new Artifact">
</command>
- <!-- Creation command for AssociationBase -->
+ <!-- Creation command for AssociationBase -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.AssociationBaseHandler" description="Create a new AssociationBase" id="org.eclipse.papyrus.uml.modelexplorer.AssociationBaseCreateCommand" name="Create a new AssociationBase">
</command>
@@ -290,8 +296,8 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestroyObjectActionHandler" description="Create a new DestroyObjectAction" id="org.eclipse.papyrus.uml.modelexplorer.DestroyObjectActionCreateCommand" name="Create a new DestroyObjectAction">
</command>
- <!-- Creation command for DestructionOccurrenceSpecification -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestructionOccurrenceSpecificationHandler" description="Create a new DestructionOccurrenceSpecification" id="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" name="Create a new DestructionOccurrenceSpecification">
+ <!-- Creation command for DestructionOccurrenceSpecification -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.DestructionOccurrenceSpecificationHandler" description="Create a new DestructionOccurrenceSpecification" id="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" name="Create a new DestructionOccurrenceSpecification">
</command>
<!-- Creation command for Device -->
@@ -386,10 +392,10 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GateHandler" description="Create a new Gate" id="org.eclipse.papyrus.uml.modelexplorer.GateCreateCommand" name="Create a new Gate">
</command>
- <!-- Creation command for GeneralOrdering -->
+ <!-- Creation command for GeneralOrdering -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GeneralOrderingHandler" description="Create a new GeneralOrdering" id="org.eclipse.papyrus.uml.modelexplorer.GeneralOrderingCreateCommand" name="Create a new GeneralOrdering">
- </command>
-
+ </command>
+
<!-- Creation command for Generalization -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.GeneralizationHandler" description="Create a new Generalization" id="org.eclipse.papyrus.uml.modelexplorer.GeneralizationCreateCommand" name="Create a new Generalization">
</command>
@@ -498,10 +504,10 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralNullHandler" description="Create a new LiteralNull" id="org.eclipse.papyrus.uml.modelexplorer.LiteralNullCreateCommand" name="Create a new LiteralNull">
</command>
- <!-- Creation command for LiteralReal -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralRealHandler" description="Create a new LiteralReal" id="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" name="Create a new LiteralReal">
- </command>
-
+ <!-- Creation command for LiteralReal -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralRealHandler" description="Create a new LiteralReal" id="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" name="Create a new LiteralReal">
+ </command>
+
<!-- Creation command for LiteralString -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.LiteralStringHandler" description="Create a new LiteralString" id="org.eclipse.papyrus.uml.modelexplorer.LiteralStringCreateCommand" name="Create a new LiteralString">
</command>
@@ -842,25 +848,25 @@
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.VariableHandler" description="Create a new Variable" id="org.eclipse.papyrus.uml.modelexplorer.VariableCreateCommand" name="Create a new Variable">
</command>
- <!-- Creation command for Association -->
+ <!-- Creation command for Association -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.AssociationHandler" description="Create a new Association" id="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" name="Create a new Association">
- </command>
-
- <!-- Creation command for Trace -->
+ </command>
+
+ <!-- Creation command for Trace -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.TraceHandler" description="Create a new Trace" id="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" name="Create a new Trace">
- </command>
-
- <!-- Creation command for Refine -->
- <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.RefineHandler" description="Create a new Refine" id="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" name="Create a new Refine">
- </command>
-
+ </command>
+
+ <!-- Creation command for Refine -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.uml.modelexplorer.handler.RefineHandler" description="Create a new Refine" id="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" name="Create a new Refine">
+ </command>
+
</extension>
<!-- UI Menu declaration for creation commands -->
<extension point="org.eclipse.ui.menus">
- <menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.createchild" allPopups="false">
+ <menuContribution allPopups="false" locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.createchild">
<!-- Creation menu action for Abstraction -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.AbstractionCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Abstraction" style="push" tooltip="Create a new Abstraction">
@@ -932,7 +938,7 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for AssociationBase -->
+ <!-- Creation menu action for AssociationBase -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationBaseCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new AssociationBase" style="push" tooltip="Create a new AssociationBase">
<visibleWhen checkEnabled="true"/>
</command>
@@ -1142,8 +1148,8 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for DestructionOccurrenceSpecification -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DestructionOccurrenceSpecification.gif" label="Create a new DestructionOccurrenceSpecification" style="push" tooltip="Create a new DestructionOccurrenceSpecification">
+ <!-- Creation menu action for DestructionOccurrenceSpecification -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.DestructionOccurrenceSpecificationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DestructionOccurrenceSpecification.gif" label="Create a new DestructionOccurrenceSpecification" style="push" tooltip="Create a new DestructionOccurrenceSpecification">
<visibleWhen checkEnabled="true"/>
</command>
@@ -1262,11 +1268,11 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for GeneralOrdering -->
+ <!-- Creation menu action for GeneralOrdering -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.GeneralOrderingCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/GeneralOrdering.gif" label="Create a new GeneralOrdering" style="push" tooltip="Create a new GeneralOrdering">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<!-- Creation menu action for Generalization -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.GeneralizationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif" label="Create a new Generalization" style="push" tooltip="Create a new Generalization">
<visibleWhen checkEnabled="true"/>
@@ -1402,11 +1408,11 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for LiteralReal -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralReal.gif" label="Create a new LiteralReal" style="push" tooltip="Create a new LiteralReal">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <!-- Creation menu action for LiteralReal -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralRealCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralReal.gif" label="Create a new LiteralReal" style="push" tooltip="Create a new LiteralReal">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<!-- Creation menu action for LiteralString -->
<command commandId="org.eclipse.papyrus.uml.modelexplorer.LiteralStringCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/LiteralString.gif" label="Create a new LiteralString" style="push" tooltip="Create a new LiteralString">
<visibleWhen checkEnabled="true"/>
@@ -1832,31 +1838,28 @@
<visibleWhen checkEnabled="true"/>
</command>
- <!-- Creation menu action for Association -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new Association" style="push" tooltip="Create a new Association">
- <visibleWhen checkEnabled="true"/>
- </command>
-
- <!-- Creation menu action for Trace -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Trace" style="push" tooltip="Create a new Trace">
- <visibleWhen checkEnabled="true"/>
- </command>
-
- <!-- Creation menu action for Refine -->
- <command commandId="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Refine" style="push" tooltip="Create a new Refine">
- <visibleWhen checkEnabled="true"/>
- </command>
-
+ <!-- Creation menu action for Association -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.AssociationCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif" label="Create a new Association" style="push" tooltip="Create a new Association">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
+ <!-- Creation menu action for Trace -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.TraceCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Trace" style="push" tooltip="Create a new Trace">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
+ <!-- Creation menu action for Refine -->
+ <command commandId="org.eclipse.papyrus.uml.modelexplorer.RefineCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Refine" style="push" tooltip="Create a new Refine">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
</menuContribution>
</extension>
-<!-- This declaration is added in order command (DeleteCommandHandler) status to be
- verified (isVisible and isEnabled) before any attempt to execute the command,
- and to mask the command in case it is not supported or executable.
- -->
-<extension point="org.eclipse.ui.startup">
- <startup class="org.eclipse.papyrus.views.modelexplorer.Activator"/>
-</extension>
+<!-- This declaration is added in order command (DeleteCommandHandler) status to be
+ verified (isVisible and isEnabled) before any attempt to execute the command,
+ and to mask the command in case it is not supported or executable.
+ -->
<extension point="org.eclipse.core.runtime.adapters">
<factory adaptableType="org.eclipse.emf.facet.infra.browser.uicore.internal.model.ModelElementItem" class="org.eclipse.papyrus.uml.modelexplorer.factory.ModelElementItemFactory">
<adapter type="org.eclipse.uml2.uml.NamedElement">
@@ -1869,12 +1872,12 @@
</facetset>
</extension>
<extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization file="resource/UMLFacetDefaultBrowserCustomization.uiCustom" loadByDefault="true"/>
+ <browserCustomization file="resource/NotationCustomization.uiCustom" loadByDefault="true">
+ </browserCustomization>
<browserCustomization
- file="resource/UMLFacetDefaultBrowserCustomization.uiCustom"
- loadByDefault="true"/>
- <browserCustomization
- file="resource/NotationCustomization.uiCustom"
- loadByDefault="true">
+ file="resource/UMLReadOnly.uiCustom"
+ loadByDefault="false">
</browserCustomization>
- </extension>
+ </extension>
</plugin>
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
deleted file mode 100644
index 353609e50bb..00000000000
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/UMLContentProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.modelexplorer;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.papyrus.uml.tools.model.UmlUtils;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * this is a specific content provider used to not display UML stereotype applications
- *
- * @deprecated Use {@link org.eclipse.papyrus.uml.tools.providers.UMLContentProvider} instead
- */
-@Deprecated
-public class UMLContentProvider extends MoDiscoContentProvider {
-
-
- /**
- * Return the initial values from the input.
- * Input should be of type {@link UmlModel}.
- *
- * @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelContentProvider#getRootElements(java.lang.Object)
- *
- * @param inputElement
- * @return
- */
- @Override
- protected EObject[] getRootElements(ModelSet modelSet) {
- UmlModel umlModel = (UmlUtils.getUmlModel(modelSet));
-
- if(umlModel == null)
- return null;
-
- EList<EObject> contents = umlModel.getResource().getContents();
- ArrayList<EObject> result = new ArrayList<EObject>();
- Iterator<EObject> iterator = contents.iterator();
- while(iterator.hasNext()) {
- EObject eObject = iterator.next();
- //functionality that comes from UML2 plugins
- if(UMLUtil.getStereotype(eObject) == null) {
- result.add(eObject);
- }
- }
- return result.toArray(new EObject[result.size()]);
- }
-}
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
index f0a12e7044e..22eed69833a 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/handler/AbstractCommandHandler.java
@@ -219,7 +219,7 @@ public abstract class AbstractCommandHandler extends AbstractHandler {
try {
- ServiceUtilsForActionHandlers util = new ServiceUtilsForActionHandlers();
+ ServiceUtilsForActionHandlers util = ServiceUtilsForActionHandlers.getInstance();
creationcommand = getCommand();
util.getTransactionalEditingDomain().getCommandStack().execute(creationcommand);
diff --git a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
index 6b9502549e8..296d5eb3eb5 100644
--- a/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
+++ b/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer/src/org/eclipse/papyrus/uml/modelexplorer/queries/GetDiagramIcon.java
@@ -16,7 +16,6 @@ import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionExcep
import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
/**
@@ -28,6 +27,6 @@ import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuer
public class GetDiagramIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<Diagram, String> {
public String evaluate(final Diagram context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
index 20cd8a3bcb4..65761a13689 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF
@@ -9,7 +9,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.infra.services.resourceloading.preferences;bundle-version="0.10.0",
org.eclipse.emf.validation.ocl;bundle-version="1.4.0",
org.eclipse.emf.validation.ui;bundle-version="1.3.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
index 3c76b04620a..23bb0622076 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/Activator.java
@@ -1,6 +1,7 @@
package org.eclipse.papyrus.uml.controlmode.profile;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.osgi.framework.BundleContext;
/**
@@ -14,6 +15,8 @@ public class Activator extends Plugin {
// The shared instance
private static Activator plugin;
+ public static LogHelper log;
+
/**
* The constructor
*/
@@ -29,6 +32,7 @@ public class Activator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
+ log = new LogHelper(this);
}
/*
diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
index 2ddf8f6bb69..007bf0d7501 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/src/org/eclipse/papyrus/uml/controlmode/profile/validation/ProfileApplicationDuplicationChecker.java
@@ -15,7 +15,6 @@ package org.eclipse.papyrus.uml.controlmode.profile.validation;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -34,7 +33,8 @@ import org.eclipse.emf.validation.EMFEventType;
import org.eclipse.emf.validation.IValidationContext;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.services.resourceloading.preferences.StrategyChooser;
import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder;
import org.eclipse.papyrus.uml.controlmode.profile.Activator;
@@ -100,6 +100,7 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
* validation context
* @return validation status
*/
+ @Override
public IStatus validate(IValidationContext ctx) {
try {
if(ctx.equals(lastValidatedContext)) {
@@ -240,9 +241,17 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
boolean readOnlyPackages = false;
StringBuffer readOnlyPackagesList = new StringBuffer();
//Check if controlled package is loaded
- for(Iterator<Package> iterator = controlledPackages.iterator(); iterator.hasNext();) {
- Package pack = iterator.next();
- EditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ EditingDomain domain = null;
+ for(Package pack : controlledPackages) {
+ if(domain == null) {
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(pack);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return false;
+ }
+ }
+
if(pack.eIsProxy()) {
EObject loadedObject = domain.getResourceSet().getEObject(((InternalEObject)pack).eProxyURI(), true);
if(loadedObject != null) {
@@ -271,6 +280,7 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain
}
}
}
+
//Report error if the controlled package is read-only
if(readOnlyPackages) {
String msg = NLS.bind(Messages.error_readonly, readOnlyPackagesList.toString());
diff --git a/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java b/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
index 8445fb0b0f4..50621e600a2 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.perspective/src/org/eclipse/papyrus/uml/perspective/PapyrusPerspective.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.uml.perspective;
import org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard;
import org.eclipse.papyrus.uml.diagram.wizards.NewPapyrusProjectWizard;
+import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
@@ -26,6 +27,8 @@ public class PapyrusPerspective implements IPerspectiveFactory {
/** constant for the definition of papyrus model explorer **/
protected static final String ID_MODELEXPLORER = "org.eclipse.papyrus.views.modelexplorer.modelexplorer";
+ public static final String ID_BOTTOM_FOLDER = "org.eclipse.papyrus.perspective.folder.bottom";
+
/**
*
* this method create the layout attached to this perspective
@@ -55,6 +58,8 @@ public class PapyrusPerspective implements IPerspectiveFactory {
layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
layout.addShowViewShortcut(ID_MODELEXPLORER);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView"); //Error log. //A constant doesn't seem to exist for this ID
layout.addActionSet("org.eclipse.debug.ui.launchActionSet");
@@ -84,8 +89,12 @@ public class PapyrusPerspective implements IPerspectiveFactory {
// place outline under the model explorer
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.BOTTOM, 0.5f, ID_MODELEXPLORER);
- // place properties under the editor
- layout.addView(IPageLayout.ID_PROP_SHEET, IPageLayout.BOTTOM, (float)0.70, editorArea);
+ // place properties and problem views under the editor
+ IFolderLayout bottomFolder = layout.createFolder(ID_BOTTOM_FOLDER, IPageLayout.BOTTOM, 0.70f, editorArea);
+
+ bottomFolder.addView(IPageLayout.ID_PROP_SHEET);
+ bottomFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+
// bottom.addView("org.eclipse.pde.runtime.LogView");
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
index ed71036b92f..4880e7d7c3c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/providers/AppliedStereotypePropertyFilteredLabelProvider.java
@@ -14,7 +14,7 @@ package org.eclipse.papyrus.uml.profile.providers;
import java.util.Iterator;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
public class AppliedStereotypePropertyFilteredLabelProvider extends AppliedStereotypePropertyLabelProvider implements IFilteredLabelProvider {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
index 487bce355e2..49aefe756c4 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.profile/src/org/eclipse/papyrus/uml/profile/tree/objects/AppliedStereotypePropertyTreeObject.java
@@ -23,7 +23,9 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.utils.Util;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Element;
@@ -58,7 +60,7 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
public Stereotype getParentStereotype() {
- return ((AppliedStereotypeTreeObject) getParent()).getStereotype();
+ return ((AppliedStereotypeTreeObject)getParent()).getStereotype();
}
/**
@@ -72,13 +74,13 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
/**
* Reinitialize the children from model, useful to reflect model changes in
- * the value tree.
+ * the value tree.
*/
- public void reInitChilds () {
- children.clear ();
- createChildren ();
+ public void reInitChilds() {
+ children.clear();
+ createChildren();
}
-
+
/**
* Creates the children.
*/
@@ -90,30 +92,29 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
return;
}
- if (value instanceof EList) {
+ if(value instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> values = (EList<Object>) value;
+ EList<Object> values = (EList<Object>)value;
Iterator<Object> it = values.iterator();
while(it.hasNext()) {
final Object currentValue = it.next();
ValueTreeObject vTO = createValueTreeObject(currentValue);
addChild(vTO);
}
- }
- else {
+ } else {
ValueTreeObject vTO = createValueTreeObject(value);
addChild(vTO);
}
}
/**
- * Returns the value of the stereotype attribute
+ * Returns the value of the stereotype attribute
*
* @return the value
*/
public Object getValue() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
- StereotypedElementTreeObject rTO = (StereotypedElementTreeObject) sTO.getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
+ StereotypedElementTreeObject rTO = (StereotypedElementTreeObject)sTO.getParent();
Stereotype st = sTO.getStereotype();
Element elt = rTO.getElement();
@@ -121,8 +122,8 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
public Element getElement() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
- StereotypedElementTreeObject rTO = (StereotypedElementTreeObject) sTO.getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
+ StereotypedElementTreeObject rTO = (StereotypedElementTreeObject)sTO.getParent();
return rTO.getElement();
}
@@ -134,9 +135,9 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
public EObject getStereotypeApplication() {
return getElement().getStereotypeApplication(getStereotype());
}
-
+
public Stereotype getStereotype() {
- AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject) getParent();
+ AppliedStereotypeTreeObject sTO = (AppliedStereotypeTreeObject)getParent();
return sTO.getStereotype();
}
@@ -180,26 +181,28 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
return vTO;
}
-
+
/**
* This function is used prior to updating the model. It will add the new value to the
* list of existing values, in case of a multi-valued property. editMe methods should call
* this method before calling update.
- * @param newValue a new value for the property (must not be a list itself)
+ *
+ * @param newValue
+ * a new value for the property (must not be a list itself)
* @return a new list which the existing stereotype value and the newValue in case of
- * a multi-value property or the newValue, if not multi-valued
+ * a multi-value property or the newValue, if not multi-valued
*/
- public Object appendMV (Object newValue) {
-
- Stereotype stereotype = ((AppliedStereotypeTreeObject) getParent()).getStereotype();
- Element element = ((StereotypedElementTreeObject) getParent().getParent()).getElement();
+ public Object appendMV(Object newValue) {
+
+ Stereotype stereotype = ((AppliedStereotypeTreeObject)getParent()).getStereotype();
+ Element element = ((StereotypedElementTreeObject)getParent().getParent()).getElement();
- if (property.isMultivalued ()) {
+ if(property.isMultivalued()) {
// add to existing contents
Object existingValue = element.getValue(stereotype, property.getName());
- if (existingValue instanceof EList) {
+ if(existingValue instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> existingValueList = (EList<Object>) existingValue;
+ EList<Object> existingValueList = (EList<Object>)existingValue;
EList<Object> valueList = new BasicEList<Object>();
valueList.addAll(existingValueList);
valueList.add(newValue);
@@ -208,26 +211,29 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
}
return newValue;
}
-
+
/**
* Remove elements from the list of proposed stereotype values that have already
- * selected - except the currently selected element.
- * @param proposalList the list of possible stereotype values
- * @param oldValue the currently selected value
+ * selected - except the currently selected element.
+ *
+ * @param proposalList
+ * the list of possible stereotype values
+ * @param oldValue
+ * the currently selected value
*/
- protected <T extends Object> void removeSelected (List<T> proposalList, T oldValue) {
- if (property.isMultivalued()) {
+ protected <T extends Object> void removeSelected(List<T> proposalList, T oldValue) {
+ if(property.isMultivalued()) {
@SuppressWarnings("unchecked")
- EList<EObject> values = (EList<EObject>) getValue();
- if (values != null) {
+ EList<EObject> values = (EList<EObject>)getValue();
+ if(values != null) {
proposalList.removeAll(values);
}
- if (oldValue != null) {
- proposalList.add (oldValue);
+ if(oldValue != null) {
+ proposalList.add(oldValue);
}
}
}
-
+
/**
* Update value by means of a command that is executed within the Papyrus
* editing domain.
@@ -238,7 +244,14 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
public void updateValue(final Object newValue) {
// use domain to update the value
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(property);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
RecordingCommand command = new RecordingCommand(domain, "Edit Stereotype Property Value") {
/**
@@ -246,8 +259,8 @@ public class AppliedStereotypePropertyTreeObject extends ParentTreeObject {
*/
@Override
protected void doExecute() {
- Stereotype stereotype = ((AppliedStereotypeTreeObject) getParent()).getStereotype();
- Element element = ((StereotypedElementTreeObject) getParent().getParent()).getElement();
+ Stereotype stereotype = ((AppliedStereotypeTreeObject)getParent()).getStereotype();
+ Element element = ((StereotypedElementTreeObject)getParent().getParent()).getElement();
Property property = getProperty();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
index b4e8e1e9427..0816cfb5ce8 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/META-INF/MANIFEST.MF
@@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.10.0",
org.eclipse.gef;bundle-version="3.7.1",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.properties.tabbedproperties.comments,
org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysection
Bundle-Vendor: %providerName
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
index ba1fc31c8db..c7248c68e8e 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/directeditor/HTMLCommentEditorDialogConfiguration.java
@@ -103,6 +103,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @{inheritDoc
*/
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK and Cancel buttons by default
// remove the OK button as default button, so Carriage Return key pressed does not close the dialog
@@ -123,7 +124,7 @@ public class HTMLCommentEditorDialogConfiguration extends DefaultDirectEditorCon
/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*
- *@param parent
+ * @param parent
* the parent composite to contain the dialog area
* @return the dialog area control
*/
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
index 3ddfaae6cb3..cfa166b103c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/CommentedElementPropertySection.java
@@ -63,7 +63,9 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
import org.eclipse.papyrus.uml.diagram.common.parser.HTMLCleaner;
@@ -185,7 +187,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// creates the rich text editor content
richText = CommentRichTextFormToolkit.createFocusAwareRichTextEditor(getWidgetFactory(), mainComposite, "", comment, //$NON-NLS-1$
- SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
+ SWT.NONE, EditorUtils.getMultiDiagramEditor().getEditorSite());
data = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
data.heightHint = 240;
richText.setLayoutData(data);
@@ -350,7 +352,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
// this is the real element, not a ghost one. display it in the list
if(!isProxy) {
- if(comment.getAnnotatedElements().contains((Element)inputElement)) {
+ if(comment.getAnnotatedElements().contains(inputElement)) {
annotatedElements.add(comment);
}
}
@@ -394,6 +396,7 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
/**
* {@inheritDoc}
*/
+ @Override
public String getText(Object element) {
if(element instanceof Comment) {
String body = ((Comment)element).getBody();
@@ -476,7 +479,14 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
final Element element = getElement();
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -542,7 +552,13 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
}
// add a comment to this element
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
@@ -680,7 +696,15 @@ public class CommentedElementPropertySection extends AbstractPropertySection imp
IAdaptable sourceAdapter = (IAdaptable)((List)request.getNewObject()).get(0);
IAdaptable targetAdapter = new SemanticAdapter(null, selectionEditPart.getModel());
- CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(EditorUtils.getTransactionalEditingDomain(), selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
+ CreateCommentLinkTransactionnalCommand linkVisualIDCommand = new CreateCommentLinkTransactionnalCommand(domain, selectionEditPart.getViewer(), sourceAdapter, targetAdapter);
CompositeCommand compoundCommand = new CompositeCommand("Display Comment with link");
compoundCommand.compose(new CommandProxy(createCommand));
compoundCommand.compose(linkVisualIDCommand);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
index 21ec160cd60..2f2cc57e139 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.tabbedproperties.comments/src/org/eclipse/papyrus/uml/properties/tabbedproperties/comments/propertysection/FocusAwareCommentRichText.java
@@ -13,7 +13,8 @@ package org.eclipse.papyrus.uml.properties.tabbedproperties.comments.propertysec
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.properties.tabbedproperties.comments.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -40,6 +41,7 @@ public class FocusAwareCommentRichText extends CommentRichText {
/**
* Adds listeners to manage the activation and focus events.
*/
+ @Override
protected void addListeners() {
editorControl = getControlSite(editor);
@@ -80,7 +82,14 @@ public class FocusAwareCommentRichText extends CommentRichText {
return;
}
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(getComment());
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+
// open transaction to save the comment body
// retrieve editing domain
if(domain != null) {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
index 0da4c022584..69012b17005 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppearanceForAppliedStereotypeComposite.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
@@ -310,7 +311,12 @@ public class AppearanceForAppliedStereotypeComposite extends org.eclipse.papyrus
}
public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(element);
+ } catch (Exception ex){
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
index 4b191db4943..f94c0271d15 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypeCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -117,6 +118,7 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
* @return the selected
* @deprecated
*/
+ @Deprecated
@Override
public Element getSelected() {
return getElement();
@@ -144,8 +146,8 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
return;
}
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -154,15 +156,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ RecordingCommand command = AppliedStereotypeHelper.getAddAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -180,8 +182,11 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
if(diagramElement == null) {
return;
}
+
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+
try {
- getDomain().runExclusive(new Runnable() {
+ domain.runExclusive(new Runnable() {
public void run() {
@@ -189,15 +194,15 @@ public class AppliedStereotypeCompositeWithView extends org.eclipse.papyrus.uml.
public void run() {
String presentationKind = AppliedStereotypeHelper.getAppliedStereotypePresentationKind(diagramElement);
- RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(getDomain(), diagramElement, st.getQualifiedName(), presentationKind);
+ RecordingCommand command = AppliedStereotypeHelper.getRemoveAppliedStereotypeCommand(domain, diagramElement, st.getQualifiedName(), presentationKind);
- getDomain().getCommandStack().execute(command);
+ domain.getCommandStack().execute(command);
}
});
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
index d103b330db5..9ad99de8679 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositeforview/AppliedStereotypePropertyCompositeWithView.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositeforview;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.swt.SWT;
@@ -61,32 +62,33 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
protected void touchModel() {
// CommandSupport.exec ("update stereotype", /* command)
- if (currentView == null) {
+ if(currentView == null) {
return;
}
-
+
try {
- getDomain().runExclusive(new Runnable() {
-
+ final TransactionalEditingDomain domain = getEditingDomain(currentView);
+ domain.runExclusive(new Runnable() {
+
public void run() {
- Display.getCurrent().asyncExec( new Runnable() {
+ Display.getCurrent().asyncExec(new Runnable() {
public void run() {
String localization = AppliedStereotypeHelper.getAppliedStereotypesPropertiesLocalization(currentView);
- RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(getDomain(), currentView, localization);
+ RecordingCommand command = AppliedStereotypeHelper.getSetAppliedStereotypePropertiesLocalizationCommand(domain, currentView, localization);
+
+ domain.getCommandStack().execute(command);
- getDomain().getCommandStack().execute(command);
-
}
});
-
+
}
});
} catch (Exception e) {
- e.printStackTrace ();
+ e.printStackTrace();
}
}
@@ -97,7 +99,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void addButtonPressed() {
super.addButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -107,7 +109,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void removeButtonPressed() {
super.removeButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -117,7 +119,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void upButtonPressed() {
super.upButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -127,7 +129,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
public void downButtonPressed() {
super.downButtonPressed();
touchModel();
- stereotypeComposite.refreshTreeViewer ();
+ stereotypeComposite.refreshTreeViewer();
}
/**
@@ -136,7 +138,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
@Override
protected void createPropTree() {
super.createPropTree();
- getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener (treeViewer, stereotypeComposite, this));
+ getTree().addListener(SWT.MouseDoubleClick, new StereotypePropertiesDoubleClickListener(treeViewer, stereotypeComposite, this));
}
/**
@@ -152,6 +154,7 @@ public class AppliedStereotypePropertyCompositeWithView extends org.eclipse.papy
/**
*
*/
+ @Override
public void disposeListeners() {
super.disposeListeners();
stereotypeComposite.disposeListeners();
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
index 143a89865ad..b1036c6691c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedProfileCompositeOnModel.java
@@ -36,7 +36,8 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.ImageManager;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ProfileTreeSelectionDialog;
@@ -91,8 +92,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
private CLabel appliedLabel;
- private TransactionalEditingDomain domain;
-
/**
* the factory to create elements
*/
@@ -154,14 +153,16 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void applyProfile(final Package thepackage, final Profile profile, final boolean withSubProfiles) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -425,8 +426,13 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -549,10 +555,6 @@ public class AppliedProfileCompositeOnModel extends Composite {
}
}
- public void setDomain(TransactionalEditingDomain domain) {
- this.domain = domain;
- }
-
/**
* Sets the selection.
*
@@ -573,14 +575,15 @@ public class AppliedProfileCompositeOnModel extends Composite {
*/
protected void unApplyProfile(final Package thepackage, final Profile profile) {
try {
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(thepackage);
+ domain.runExclusive(new Runnable() {
public void run() {
-
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(domain) {
+
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
index 989dd6ba598..6408aa9c467 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/AppliedStereotypeCompositeOnModel.java
@@ -26,7 +26,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Activator;
import org.eclipse.papyrus.uml.profile.preference.ProfilePreferenceConstants;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
@@ -59,8 +60,13 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @return the domain
*/
- public TransactionalEditingDomain getDomain() {
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(Element context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/** The panel that display applied stereotypes. */
@@ -272,8 +278,8 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*
* @param propertyView
*/
- public void refreshTreeViewer () {
- treeViewer.refresh ();
+ public void refreshTreeViewer() {
+ treeViewer.refresh();
}
/**
@@ -428,15 +434,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void applyStereotype(final Element elt, final Stereotype st) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -466,15 +472,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
protected void unapplyStereotype(final Element elt, final Stereotype st) {
// bugfix: a selected element is not necessary a diagram element (ex: selection in the outline)
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(elt);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
@@ -504,15 +510,15 @@ public class AppliedStereotypeCompositeOnModel extends DecoratedTreeComposite im
*/
public void reorderStereotypeApplications(final Element element, final EList stereotypes) {
try {
-
- getDomain().runExclusive(new Runnable() {
+ final TransactionalEditingDomain domain = getEditingDomain(element);
+ domain.runExclusive(new Runnable() {
public void run() {
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
- getDomain().getCommandStack().execute(new RecordingCommand(getDomain()) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
protected void doExecute() {
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
index 37ca929d9b6..22737da2527 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/compositesformodel/PropertyComposite.java
@@ -18,8 +18,10 @@ package org.eclipse.papyrus.uml.properties.profile.ui.compositesformodel;
import java.util.ArrayList;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.uml.profile.Message;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementContentProvider;
import org.eclipse.papyrus.uml.profile.tree.ProfileElementLabelProvider;
@@ -27,6 +29,7 @@ import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypePropertyTre
import org.eclipse.papyrus.uml.profile.tree.objects.AppliedStereotypeTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.StereotypedElementTreeObject;
import org.eclipse.papyrus.uml.profile.tree.objects.ValueTreeObject;
+import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;
@@ -41,9 +44,13 @@ import org.eclipse.uml2.uml.Stereotype;
*/
public class PropertyComposite extends DecoratedTreeComposite {
- public TransactionalEditingDomain getDomain() {
- // used by heir AppliedStereotypePropertyCompositeWithView
- return EditorUtils.getTransactionalEditingDomain();
+ public TransactionalEditingDomain getEditingDomain(EModelElement context) {
+ try {
+ return ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(context);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
}
/**
@@ -56,7 +63,7 @@ public class PropertyComposite extends DecoratedTreeComposite {
super(parent, SWT.NONE, "Property values", false);
}
-
+
/*
* (non-Javadoc)
*
@@ -131,12 +138,12 @@ public class PropertyComposite extends DecoratedTreeComposite {
}
- public void itemDClicked () {
+ public void itemDClicked() {
AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
// re-initialize value tree objects (model is already updated, value in tree object is not)
pTO.reInitChilds();
}
-
+
/**
* Action triggered when the add button is pressed.
*/
@@ -160,10 +167,10 @@ public class PropertyComposite extends DecoratedTreeComposite {
// if lower multiplicity is equal to upper multiplicity : cannot add
if(lower == upper && pTO.getValue() != null) {
- if (pTO.getValue() instanceof EList) {
+ if(pTO.getValue() instanceof EList) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) pTO.getValue ();
- if (currentValues.size() >= upper) {
+ EList<Object> currentValues = (EList<Object>)pTO.getValue();
+ if(currentValues.size() >= upper) {
Message.warning("Multiplicity of this property is " + property.getLower() + ".." + property.getUpper() + "\n" + "Impossible to add a new value.");
return;
}
@@ -176,29 +183,28 @@ public class PropertyComposite extends DecoratedTreeComposite {
// Retrieve current value
ArrayList<Object> currentPropertyValues = new ArrayList<Object>();
Object currentValue = pTO.getValue();
- if (currentValue != null) {
-
+ if(currentValue != null) {
+
if(upper == 1) {
currentPropertyValues.add(currentValue);
} else { // if (upper != 1) {
-
+
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentValue;
+ EList<Object> currentValues = (EList<Object>)currentValue;
for(int i = 0; i < currentValues.size(); i++) {
currentPropertyValues.add(currentValues.get(i));
}
}
}
- if (property.isMultivalued() || (currentPropertyValues.size() < upper)) {
- ValueTreeObject.createInstance(pTO, null).editMe ();
- }
- else {
+ if(property.isMultivalued() || (currentPropertyValues.size() < upper)) {
+ ValueTreeObject.createInstance(pTO, null).editMe();
+ } else {
Message.warning("Upper multiplicity of " + property.getName() + " is " + property.getUpper());
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
/**
@@ -213,9 +219,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
TreeItem[] items = getTree().getSelection();
for(int i = 0; i < nbrOfSelection; i++) {
- ValueTreeObject vTO = (ValueTreeObject) items[i].getData();
- AppliedStereotypePropertyTreeObject pTO =
- (AppliedStereotypePropertyTreeObject) treeViewer.getInput();
+ ValueTreeObject vTO = (ValueTreeObject)items[i].getData();
+ AppliedStereotypePropertyTreeObject pTO = (AppliedStereotypePropertyTreeObject)treeViewer.getInput();
Property property = pTO.getProperty();
int lower = property.getLower();
@@ -230,25 +235,25 @@ public class PropertyComposite extends DecoratedTreeComposite {
Object currentVal = pTO.getValue();
ArrayList<Object> tempValues = new ArrayList<Object>();
- if (upper != 1) {
+ if(upper != 1) {
@SuppressWarnings("unchecked")
- EList<Object> currentValues = (EList<Object>) currentVal;
- tempValues.addAll (currentValues);
-
- if (tempValues.size() > lower) {
+ EList<Object> currentValues = (EList<Object>)currentVal;
+ tempValues.addAll(currentValues);
+
+ if(tempValues.size() > lower) {
tempValues.remove(vTO.getValue());
}
}
-
+
if(property.isMultivalued()) {
// setPropertiesValue(selectedElt, stereotype, property, tempValues);
- pTO.updateValue (tempValues);
+ pTO.updateValue(tempValues);
} else {
- pTO.updateValue (null);
+ pTO.updateValue(null);
}
// Update value tree objects
- pTO.reInitChilds ();
+ pTO.reInitChilds();
}
}
@@ -315,8 +320,8 @@ public class PropertyComposite extends DecoratedTreeComposite {
*/
public void setInput(AppliedStereotypePropertyTreeObject element) {
treeViewer.setInput(element);
- if (element != null) {
- element.reInitChilds ();
+ if(element != null) {
+ element.reInitChilds();
}
refresh();
}
@@ -339,4 +344,4 @@ public class PropertyComposite extends DecoratedTreeComposite {
public void editItem(TreeItem item) {
// do nothing
}
-} \ No newline at end of file
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
index 7cfb418a0e6..1e7c488c883 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedProfileSection.java
@@ -21,7 +21,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.properties.profile.ui.compositeforview.AppliedProfileCompositeWithView;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
@@ -62,6 +61,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void refresh() {
appliedProfileComposite.refresh();
}
@@ -70,6 +70,7 @@ public class AppliedProfileSection extends AbstractPropertySection {
*
* {@inheritDoc}
*/
+ @Override
public void setInput(IWorkbenchPart part, ISelection selection) {
super.setInput(part, selection);
if(selection instanceof IStructuredSelection) {
@@ -86,8 +87,6 @@ public class AppliedProfileSection extends AbstractPropertySection {
appliedProfileComposite.setSelection(selection);
}
}
-
- appliedProfileComposite.setDomain(EditorUtils.getTransactionalEditingDomain());
}
}
@@ -113,9 +112,11 @@ public class AppliedProfileSection extends AbstractPropertySection {
/**
*
*/
+ @Override
public void dispose() {
super.dispose();
- if(appliedProfileComposite != null)
+ if(appliedProfileComposite != null) {
appliedProfileComposite.disposeListeners();
+ }
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
index c73fee5ce42..3464717550c 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypeKindAppearanceSection.java
@@ -14,6 +14,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -21,8 +22,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.papyrus.uml.tools.utils.ElementUtil;
@@ -266,14 +265,13 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
@@ -418,6 +416,7 @@ public class AppliedStereotypeKindAppearanceSection extends AbstractPropertySect
/**
* {@inheritDoc}
*/
+ @Override
public void dispose() {
if(comboStereotypeAppearance != null && !comboStereotypeAppearance.isDisposed()) {
comboStereotypeAppearance.removeSelectionListener(comboStereotypeAppearanceListener);
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
index d4c6bf43a3f..5e89a1702bc 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/profile/ui/section/AppliedStereotypePropertiesPlaceSection.java
@@ -1,5 +1,6 @@
package org.eclipse.papyrus.uml.properties.profile.ui.section;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
@@ -10,8 +11,6 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.uml.appearance.helper.AppliedStereotypeHelper;
import org.eclipse.papyrus.uml.appearance.helper.UMLVisualInformationPapyrusConstant;
import org.eclipse.swt.SWT;
@@ -132,12 +131,14 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
*
* {@inheritDoc}
*/
+ @Override
public void dispose() {
super.dispose();
diagramElement.eAdapters().remove(this);
- if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed())
+ if(comboStereotypePropertiesPlace != null && !comboStereotypePropertiesPlace.isDisposed()) {
comboStereotypePropertiesPlace.removeSelectionListener(comboStereotypePropertiesPlaceListener);
+ }
}
/**
@@ -175,14 +176,13 @@ public class AppliedStereotypePropertiesPlaceSection extends AbstractPropertySec
if(part instanceof ContentOutline) {
IContributedContentsView contributedView = ((IContributedContentsView)((ContentOutline)part).getAdapter(IContributedContentsView.class));
if(contributedView != null) {
- part = (IWorkbenchPart)contributedView.getContributingPart();
+ part = contributedView.getContributingPart();
}
}
- if(part instanceof IMultiDiagramEditor) {
- IMultiDiagramEditor editor = (IMultiDiagramEditor)part;
- domain = EditorUtils.getTransactionalEditingDomain();
- } else
- domain = null;
+
+ if(part instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)((IAdaptable)part).getAdapter(TransactionalEditingDomain.class);
+ }
}
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
index b6e15f1c61c..5f5c0b99ddd 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeImageEditor.java
@@ -20,7 +20,8 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.uml.properties.Activator;
import org.eclipse.papyrus.uml.properties.modelelement.UMLModelElement;
@@ -132,8 +133,16 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
if(getElement() instanceof Image) {
final File imgFile = new File(iconSelected);
+ Image image = (Image)getElement();
+
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
- TransactionalEditingDomain domain = EditorUtils.getTransactionalEditingDomain();
AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Set Image content", null) {
/**
@@ -159,9 +168,15 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
protected void removeAction() {
// Erase image content
if(getElement() instanceof Image) {
-
- TransactionalEditingDomain dom = EditorUtils.getTransactionalEditingDomain();
- AbstractTransactionalCommand operation = new AbstractTransactionalCommand(dom, "Remove Image content", null) {
+ Image image = (Image)getElement();
+ TransactionalEditingDomain domain;
+ try {
+ domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(image);
+ } catch (ServiceException ex) {
+ Activator.log.error(ex);
+ return;
+ }
+ AbstractTransactionalCommand operation = new AbstractTransactionalCommand(domain, "Remove Image content", null) {
/**
* {@inheritDoc}
@@ -177,7 +192,7 @@ public class StereotypeImageEditor extends AbstractPropertyEditor implements Sel
}
};
- dom.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(operation));
refresh();
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
index 1844704e90a..e60159f8b48 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/META-INF/MANIFEST.MF
@@ -17,7 +17,9 @@ Require-Bundle: org.eclipse.papyrus.uml.textedit.common.xtext;bundle-version="0.
org.antlr.runtime,
org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
org.apache.log4j;bundle-version="1.2.15",
- org.eclipse.uml2.uml
+ org.eclipse.uml2.uml,
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
index 61fb426abe3..da78ce6a0f0 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
@@ -6,6 +6,7 @@ package org.eclipse.papyrus.uml.textedit.common.xtext.ui.contentassist;
import java.util.ArrayList;
import java.util.List;
+import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.util.EList;
@@ -15,7 +16,11 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.utils.DisplayUtils;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
+import org.eclipse.papyrus.uml.textedit.common.xtext.ui.internal.UmlCommonActivator;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.MultiplicityRule;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.QualifiedName;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
@@ -38,7 +43,7 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
/** the label provider */
- protected ILabelProvider labelProvider = DisplayUtils.getLabelProvider();
+ protected ILabelProvider labelProvider;
/** the edited model */
private Namespace model = null;
@@ -81,7 +86,7 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
/**
*
- * This method initializes the fields {@link #model} {@link #contextElement} thanks to the current selection
+ * This method initializes the fields {@link #model} {@link #contextElement} {@link #labelProvider} thanks to the current selection
*
*/
protected void initModel() {
@@ -104,6 +109,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
}
}
}
+
+ try {
+ labelProvider = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, model).getLabelProvider();
+ } catch (ServiceException ex) {
+ Logger.getLogger(UmlCommonActivator.class).error(ex);
+ labelProvider = new LabelProvider();
+ }
+
Assert.isNotNull(contextElement, "I can't find the edited element"); //$NON-NLS-1$
Assert.isNotNull(this.model, "I can't find the model owning the edited element"); //$NON-NLS-1$
}
@@ -355,14 +368,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')'; //$NON-NLS-1$ //$NON-NLS-2$
ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset(), // Offset
- context.getSelectedText().length(), // Replacement length
- completionString.length(), // cursorPosition
- labelProvider.getImage(namedElement), // image
- " " + displayString, // displayString //$NON-NLS-1$
- null, // contextInformation
- additionalProposalInfo // additionalProposalInfo
- );
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement), // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ additionalProposalInfo // additionalProposalInfo
+ );
return completionProposal;
}
@@ -380,14 +393,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
protected ICompletionProposal createCompletionProposal(String completionString, String displayString, ContentAssistContext context) {
ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset(), // Offset
- context.getSelectedText().length(), // Replacement length
- completionString.length(), // cursorPosition
- null, // image
- " " + displayString, // displayString //$NON-NLS-1$
- null, // contextInformation
- null // additionalProposalInfo
- );
+ context.getOffset(), // Offset
+ context.getSelectedText().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ null, // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ null // additionalProposalInfo
+ );
return completionProposal;
}
@@ -409,14 +422,14 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
String additionalProposalInfo = "" + namedElement.getQualifiedName() + "\n" + '(' + namedElement.eClass().getName() + ')'; //$NON-NLS-1$ //$NON-NLS-2$
ICompletionProposal completionProposal = new CompletionProposal(completionString, // String to be inserted
- context.getOffset() - context.getPrefix().length(), // Offset
- context.getPrefix().length(), // Replacement length
- completionString.length(), // cursorPosition
- labelProvider.getImage(namedElement), // image
- " " + displayString, // displayString //$NON-NLS-1$
- null, // contextInformation
- additionalProposalInfo // additionalProposalInfo
- );
+ context.getOffset() - context.getPrefix().length(), // Offset
+ context.getPrefix().length(), // Replacement length
+ completionString.length(), // cursorPosition
+ labelProvider.getImage(namedElement), // image
+ " " + displayString, // displayString //$NON-NLS-1$
+ null, // contextInformation
+ additionalProposalInfo // additionalProposalInfo
+ );
return completionProposal;
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
index a1b22b35e25..3bc28801dfa 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/META-INF/MANIFEST.MF
@@ -18,7 +18,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.services.validation;bundle-version="0.10.0",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0"
Export-Package: org.eclipse.papyrus.uml.tools,
org.eclipse.papyrus.uml.tools.commands,
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif
deleted file mode 100644
index a2017d01c82..00000000000
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/icons/none_comp_vis.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
index ebebb793dfc..6f24f4c45bf 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/ProfileApplicationObservableList.java
@@ -57,7 +57,7 @@ public class ProfileApplicationObservableList extends WritableList implements IC
* The editing domain on which the commands are executed
*/
public ProfileApplicationObservableList(Package umlSource, EditingDomain domain) {
- super(new LinkedList<Object>(umlSource.getAllAppliedProfiles()), Profile.class);
+ super(new LinkedList<Object>(umlSource.getAppliedProfiles()), Profile.class);
this.umlSource = umlSource;
this.domain = domain;
commands = new LinkedList<Command>();
@@ -188,7 +188,7 @@ public class ProfileApplicationObservableList extends WritableList implements IC
private void refreshCacheList() {
wrappedList.clear();
- wrappedList.addAll(umlSource.getAllAppliedProfiles());
+ wrappedList.addAll(umlSource.getAppliedProfiles());
fireListChange(null);
}
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
index 49c5b757abf..c50adafd18f 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLContentProvider.java
@@ -17,15 +17,20 @@ import java.util.Collections;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.infra.emf.providers.EMFEnumeratorContentProvider;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
+import org.eclipse.papyrus.uml.tools.Activator;
import org.eclipse.papyrus.uml.tools.util.UMLProviderHelper;
import org.eclipse.papyrus.uml.tools.utils.ProfileUtil;
import org.eclipse.uml2.uml.InstanceValue;
@@ -47,6 +52,44 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
protected ResourceSet root;
+ public UMLContentProvider() {
+ //Empty (@see #setInput())
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ IStructuredContentProvider semanticProvider = null;
+
+ if(newInput instanceof EObject) {
+ EObject eObject = (EObject)newInput;
+ semanticProvider = getSemanticProvider(eObject);
+ }
+
+ if(newInput instanceof Resource) {
+ semanticProvider = getSemanticProvider((Resource)newInput);
+ }
+
+ if(newInput instanceof ResourceSet) {
+ root = (ResourceSet)newInput;
+ semanticProvider = getSemanticProvider(root);
+ }
+
+ if(newInput instanceof ServicesRegistry) {
+ try {
+ root = ServiceUtils.getInstance().getModelSet((ServicesRegistry)newInput);
+ semanticProvider = getSemanticProvider(root);
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ if(semanticProvider != null) {
+ encapsulated = UMLProviderHelper.encapsulateProvider(semanticProvider, null, feature, root);
+ }
+
+ super.inputChanged(viewer, oldInput, newInput);
+ }
+
/**
* Constructor.
*
@@ -99,6 +142,18 @@ public class UMLContentProvider extends EncapsulatedContentProvider {
encapsulated = UMLProviderHelper.encapsulateProvider(semanticProvider, eObject, feature, root);
}
+ protected IStructuredContentProvider getSemanticProvider(ResourceSet root) {
+ return new SemanticUMLContentProvider(root);
+ }
+
+ protected IStructuredContentProvider getSemanticProvider(Resource root) {
+ return new SemanticUMLContentProvider(root.getContents().toArray(new EObject[0]));
+ }
+
+ protected IStructuredContentProvider getSemanticProvider(EObject root) {
+ return new SemanticUMLContentProvider(new EObject[]{ root });
+ }
+
/**
*
* @param source
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
index da13e453ce1..ad96345f04d 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLFilteredLabelProvider.java
@@ -16,7 +16,7 @@ import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.widgets.providers.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
import org.eclipse.uml2.uml.Element;
/**
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
index 74b8a978239..156013c2353 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/UMLLabelProvider.java
@@ -3,12 +3,6 @@ package org.eclipse.papyrus.uml.tools.providers;
import java.util.Iterator;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
-import org.eclipse.gmf.runtime.notation.BasicCompartment;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.uml.tools.Activator;
@@ -46,9 +40,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
/** icon for metaclass */
public static final String ICON_METACLASS = "/icons/Metaclass.gif";//$NON-NLS-1$
- /** icon for a compartment */
- public static final String ICON_COMPARTMENT = "/icons/none_comp_vis.gif"; //$NON-NLS-1$
-
/**
*
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
@@ -83,11 +74,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
return image == null ? super.getImage(element) : image;
}
- // if the element is a compartment
- if(element instanceof BasicCompartment || element instanceof DecorationNode) {
- return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(Activator.PLUGIN_ID, ICON_COMPARTMENT);
- }
-
return super.getImage(element);
}
@@ -264,11 +250,6 @@ public class UMLLabelProvider extends EMFLabelProvider implements ILabelProvider
// when the element is not a NamedElement, we return its Type name
String className = element.eClass().getName();
return className;
- } else if(element instanceof View) { // maybe it is a view of a compartment
- EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View)element);
- if(dummyEP instanceof ResizableCompartmentEditPart) {
- return ((ResizableCompartmentEditPart)dummyEP).getCompartmentName();
- }
}
return super.getText(element);
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
index e0bce2f435d..506b983cffb 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/util/UMLProviderHelper.java
@@ -17,10 +17,10 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
import org.eclipse.papyrus.uml.tools.providers.UMLContainmentBrowseStrategy;
@@ -42,7 +42,12 @@ public class UMLProviderHelper {
* @return
*/
public static EMFGraphicalContentProvider encapsulateProvider(IStructuredContentProvider provider, EObject editedEObject, EStructuralFeature feature, ResourceSet root) {
- String historyId = HistoryUtil.getHistoryID(editedEObject, feature);
+ String historyId;
+ if(editedEObject != null && feature != null) {
+ historyId = HistoryUtil.getHistoryID(editedEObject, feature);
+ } else {
+ historyId = "DefaultHistory";
+ }
IStructuredContentProvider contentProvider;

Back to the top