Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-04-03 14:51:12 -0400
committerCamille Letavernier2014-04-03 14:51:12 -0400
commit5a318a8f77a5c2c8176f2497f3f1683a63bf156d (patch)
treefd48852fa90c2769d6af201a5c8723b16eae927c
parentfe3c331ceb1147c8ff572f49f0bdfa95396766b1 (diff)
downloadorg.eclipse.papyrus-5a318a8f77a5c2c8176f2497f3f1683a63bf156d.tar.gz
org.eclipse.papyrus-5a318a8f77a5c2c8176f2497f3f1683a63bf156d.tar.xz
org.eclipse.papyrus-5a318a8f77a5c2c8176f2497f3f1683a63bf156d.zip
[Releng - Marte] Migrate Marte grammars to the new XText Integration
framework
-rw-r--r--extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/META-INF/MANIFEST.MF4
-rw-r--r--extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/src/org/eclipse/papyrus/marte/vsl/ui/contentassist/VSLProposalProvider.java1437
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ui/contributions/ConstraintWithVSLPopupEditorConfiguration.java147
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/validation/SemanticValidator.java31
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java203
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java28
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java128
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/META-INF/MANIFEST.MF2
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/scoping/StereotypeApplicationWithVSLScopeProvider.java193
-rw-r--r--extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/validation/SemanticValidator.java31
13 files changed, 924 insertions, 1288 deletions
diff --git a/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/META-INF/MANIFEST.MF b/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/META-INF/MANIFEST.MF
index 2711d42416f..c261291ee54 100644
--- a/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/META-INF/MANIFEST.MF
@@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.papyrus.marte.vsl;bundle-version="1.0.0",
org.antlr.runtime,
org.eclipse.uml2.uml;bundle-version="3.1.0",
org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0",
- org.apache.log4j;bundle-version="1.2.15"
+ org.apache.log4j;bundle-version="1.2.15",
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.marte.vsl.ui.contentassist,
org.eclipse.papyrus.marte.vsl.ui.contentassist.antlr
Bundle-Vendor: %providerName
diff --git a/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/src/org/eclipse/papyrus/marte/vsl/ui/contentassist/VSLProposalProvider.java b/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/src/org/eclipse/papyrus/marte/vsl/ui/contentassist/VSLProposalProvider.java
index 2a497a9dfdd..87e3d3ef5b1 100644
--- a/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/src/org/eclipse/papyrus/marte/vsl/ui/contentassist/VSLProposalProvider.java
+++ b/extraplugins/marte/org.eclipse.papyrus.marte.vsl.ui/src/org/eclipse/papyrus/marte/vsl/ui/contentassist/VSLProposalProvider.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -21,7 +21,6 @@ import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
import org.eclipse.papyrus.marte.vsl.extensions.VSLContextUtil;
import org.eclipse.papyrus.marte.vsl.scoping.VSLScopeProvider;
import org.eclipse.papyrus.marte.vsl.scoping.visitors.ScopingVisitors;
@@ -45,6 +44,7 @@ import org.eclipse.papyrus.marte.vsl.vSL.VSLPackage;
import org.eclipse.papyrus.marte.vsl.vSL.ValueNamePair;
import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator;
import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator.VSLValidationResult;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.DurationObservation;
@@ -74,464 +74,398 @@ import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
public class VSLProposalProvider extends AbstractVSLProposalProvider {
@Override
- public void completeExpression_Exp(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void completeExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeExpression_Exp(model, assignment, context, acceptor);
}
@Override
- public void completeAndOrXorExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
-
- if (model instanceof AndOrXorExpression) {
- AndOrXorExpression exp = (AndOrXorExpression)model ;
- List<EqualityExpression> nestedExpressions = exp.getExp() ;
- if (nestedExpressions.size() >= 2) {
- VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkEqualityExpression(nestedExpressions.get(nestedExpressions.size()-2)) ;
- Classifier specifiedType = (Classifier)validationResult.inferedType() ;
- String operator = exp.getOp().get(nestedExpressions.size()-2) ;
- if (VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
- for (Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeAndOrXorExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+
+ if(model instanceof AndOrXorExpression) {
+ AndOrXorExpression exp = (AndOrXorExpression)model;
+ List<EqualityExpression> nestedExpressions = exp.getExp();
+ if(nestedExpressions.size() >= 2) {
+ VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkEqualityExpression(nestedExpressions.get(nestedExpressions.size() - 2));
+ Classifier specifiedType = (Classifier)validationResult.inferedType();
+ String operator = exp.getOp().get(nestedExpressions.size() - 2);
+ if(VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
+ for(Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
}
- }
- else
+ } else {
super.completeAndOrXorExpression_Exp(model, assignment, context, acceptor);
+ }
}
@Override
- public void completeAndOrXorExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeAndOrXorExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeAndOrXorExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeEqualityExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof EqualityExpression) {
- EqualityExpression exp = (EqualityExpression)model ;
- List<RelationalExpression> nestedExpressions = exp.getExp() ;
- if (nestedExpressions.size() >= 2) {
- VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkRelationalExpression(nestedExpressions.get(nestedExpressions.size()-2)) ;
- Classifier specifiedType = (Classifier)validationResult.inferedType() ;
- String operator = exp.getOp().get(nestedExpressions.size()-2) ;
- if (VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
- for (Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeEqualityExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof EqualityExpression) {
+ EqualityExpression exp = (EqualityExpression)model;
+ List<RelationalExpression> nestedExpressions = exp.getExp();
+ if(nestedExpressions.size() >= 2) {
+ VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkRelationalExpression(nestedExpressions.get(nestedExpressions.size() - 2));
+ Classifier specifiedType = (Classifier)validationResult.inferedType();
+ String operator = exp.getOp().get(nestedExpressions.size() - 2);
+ if(VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
+ for(Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
}
- }
- else
+ } else {
super.completeEqualityExpression_Exp(model, assignment, context, acceptor);
+ }
}
@Override
- public void completeEqualityExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeEqualityExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeEqualityExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeRelationalExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof RelationalExpression) {
- RelationalExpression exp = (RelationalExpression)model ;
- List<ConditionalExpression> nestedExpressions = exp.getExp() ;
- if (nestedExpressions.size() >= 2) {
- VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkConditionalExpression(nestedExpressions.get(nestedExpressions.size()-2)) ;
- Classifier specifiedType = (Classifier)validationResult.inferedType() ;
- String operator = exp.getOp().get(nestedExpressions.size()-2) ;
- if (VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
- for (Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeRelationalExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof RelationalExpression) {
+ RelationalExpression exp = (RelationalExpression)model;
+ List<ConditionalExpression> nestedExpressions = exp.getExp();
+ if(nestedExpressions.size() >= 2) {
+ VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkConditionalExpression(nestedExpressions.get(nestedExpressions.size() - 2));
+ Classifier specifiedType = (Classifier)validationResult.inferedType();
+ String operator = exp.getOp().get(nestedExpressions.size() - 2);
+ if(VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
+ for(Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
- }
- }
- else
+ }
+ } else {
super.completeRelationalExpression_Exp(model, assignment, context, acceptor);
+ }
}
@Override
- public void completeRelationalExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeRelationalExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeRelationalExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeConditionalExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeConditionalExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeConditionalExpression_Exp(model, assignment, context, acceptor);
}
@Override
- public void completeConditionalExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeConditionalExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeConditionalExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeAdditiveExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof AdditiveExpression) {
- AdditiveExpression exp = (AdditiveExpression)model ;
- List<MultiplicativeExpression> nestedExpressions = exp.getExp() ;
- if (nestedExpressions.size() >= 2) {
- VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkMultiplicativeExpression(nestedExpressions.get(nestedExpressions.size()-2)) ;
- Classifier specifiedType = (Classifier)validationResult.inferedType() ;
- String operator = exp.getOp().get(nestedExpressions.size()-2) ;
- if (VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
- for (Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeAdditiveExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof AdditiveExpression) {
+ AdditiveExpression exp = (AdditiveExpression)model;
+ List<MultiplicativeExpression> nestedExpressions = exp.getExp();
+ if(nestedExpressions.size() >= 2) {
+ VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkMultiplicativeExpression(nestedExpressions.get(nestedExpressions.size() - 2));
+ Classifier specifiedType = (Classifier)validationResult.inferedType();
+ String operator = exp.getOp().get(nestedExpressions.size() - 2);
+ if(VSLJavaValidator.binaryOpTypeBinding.get(operator) != null && VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType) != null) {
+ for(Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? ((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? ((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
}
- }
- else
+ } else {
super.completeAdditiveExpression_Exp(model, assignment, context, acceptor);
+ }
}
@Override
- public void completeAdditiveExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeAdditiveExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeAdditiveExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeMultiplicativeExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof MultiplicativeExpression) {
- MultiplicativeExpression exp = (MultiplicativeExpression)model ;
- List<UnaryExpression> nestedExpressions = exp.getExp() ;
- if (nestedExpressions.size() >= 1) {
- VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkUnaryExpression(nestedExpressions.get(nestedExpressions.size()-1)) ;
- Classifier specifiedType = (Classifier)validationResult.inferedType() ;
- String operator = exp.getOp().get(exp.getOp().size() == 0 ? 0 : nestedExpressions.size()-1) ;
- for (Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeMultiplicativeExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof MultiplicativeExpression) {
+ MultiplicativeExpression exp = (MultiplicativeExpression)model;
+ List<UnaryExpression> nestedExpressions = exp.getExp();
+ if(nestedExpressions.size() >= 1) {
+ VSLValidationResult validationResult = VSLJavaValidator.eInstance.checkUnaryExpression(nestedExpressions.get(nestedExpressions.size() - 1));
+ Classifier specifiedType = (Classifier)validationResult.inferedType();
+ String operator = exp.getOp().get(exp.getOp().size() == 0 ? 0 : nestedExpressions.size() - 1);
+ for(Type possibleType : VSLJavaValidator.binaryOpTypeBinding.get(operator).get(specifiedType)) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)possibleType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
- }
- else
+ } else {
super.completeMultiplicativeExpression_Exp(model, assignment, context, acceptor);
+ }
}
@Override
- public void completeMultiplicativeExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeMultiplicativeExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeMultiplicativeExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeUnaryExpression_Op(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeUnaryExpression_Op(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeUnaryExpression_Op(model, assignment, context, acceptor);
}
@Override
- public void completeUnaryExpression_Unary(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeUnaryExpression_Unary(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeUnaryExpression_Unary(model, assignment, context, acceptor);
}
@Override
- public void completeUnaryExpression_Exp(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeUnaryExpression_Exp(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeUnaryExpression_Exp(model, assignment, context, acceptor);
}
@Override
- public void completePrimaryExpression_Prefix(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completePrimaryExpression_Prefix(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completePrimaryExpression_Prefix(model, assignment, context, acceptor);
}
@Override
- public void completePrimaryExpression_Suffix(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completePrimaryExpression_Suffix(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completePrimaryExpression_Suffix(model, assignment, context, acceptor);
}
@Override
- public void completePropertyCallExpression_Property(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- Classifier classifierForScoping ;
- if (model instanceof PrimaryExpression) {
- classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(((PrimaryExpression)model).getPrefix()).getClassifierForScoping() ;
- }
- else {
- classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping() ;
+ public void completePropertyCallExpression_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ Classifier classifierForScoping;
+ if(model instanceof PrimaryExpression) {
+ classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(((PrimaryExpression)model).getPrefix()).getClassifierForScoping();
+ } else {
+ classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping();
}
- List<Property> allProperties = new ArrayList<Property>() ;
- if (classifierForScoping != null) {
- for (Feature f : classifierForScoping.allFeatures()) {
- if (f instanceof Property)
- allProperties.add((Property)f) ;
+ List<Property> allProperties = new ArrayList<Property>();
+ if(classifierForScoping != null) {
+ for(Feature f : classifierForScoping.allFeatures()) {
+ if(f instanceof Property) {
+ allProperties.add((Property)f);
+ }
}
}
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allProperties) ;
- IScope scope = new SimpleScope(iterableIEobjectDescription) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- String displayString = eobjectDescription.getName() + " : " + (((Property)eobjectDescription.getEObjectOrProxy()).getType() != null ? ((Property)eobjectDescription.getEObjectOrProxy()).getType().getName() : "<Undefined>") ;
- String completionString = eobjectDescription.getName().getLastSegment() ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allProperties);
+ IScope scope = new SimpleScope(iterableIEobjectDescription);
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ String displayString = eobjectDescription.getName() + " : " + (((Property)eobjectDescription.getEObjectOrProxy()).getType() != null ? ((Property)eobjectDescription.getEObjectOrProxy()).getType().getName() : "<Undefined>");
+ String completionString = eobjectDescription.getName().getLastSegment();
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
}
@Override
- public void completePropertyCallExpression_Suffix(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completePropertyCallExpression_Suffix(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
- super.completePropertyCallExpression_Suffix(model, assignment, context,
- acceptor);
+ super.completePropertyCallExpression_Suffix(model, assignment, context, acceptor);
}
@Override
- public void completeOperationCallExpression_Operation(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- Classifier classifierForScoping ;
- if (model instanceof PrimaryExpression) {
- classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(((PrimaryExpression)model).getPrefix()).getClassifierForScoping() ;
- }
- else {
- classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping() ;
+ public void completeOperationCallExpression_Operation(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ Classifier classifierForScoping;
+ if(model instanceof PrimaryExpression) {
+ classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(((PrimaryExpression)model).getPrefix()).getClassifierForScoping();
+ } else {
+ classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping();
}
- List<Operation> allOperations = new ArrayList<Operation>() ;
- if (classifierForScoping != null) {
- for (Feature f : classifierForScoping.allFeatures()) {
- if (f instanceof Operation) {
- Operation o = (Operation)f ;
- if (o.getType() != null &&
- !(o.getName().equals("<")
- || o.getName().equals(">")
- || o.getName().equals("<=")
- || o.getName().equals(">=")
- || o.getName().equals("==")
- || o.getName().equals("<>")
- || o.getName().equals("+")
- || o.getName().equals("-")
- || o.getName().equals("*")
- || o.getName().equals("/")
- || o.getName().equals("^"))) {
- allOperations.add(o) ;
+ List<Operation> allOperations = new ArrayList<Operation>();
+ if(classifierForScoping != null) {
+ for(Feature f : classifierForScoping.allFeatures()) {
+ if(f instanceof Operation) {
+ Operation o = (Operation)f;
+ if(o.getType() != null && !(o.getName().equals("<") || o.getName().equals(">") || o.getName().equals("<=") || o.getName().equals(">=") || o.getName().equals("==") || o.getName().equals("<>") || o.getName().equals("+") || o.getName().equals("-") || o.getName().equals("*") || o.getName().equals("/") || o.getName().equals("^"))) {
+ allOperations.add(o);
}
}
}
}
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allOperations) ;
- IScope scope = new SimpleScope(iterableIEobjectDescription) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- Operation calledOperation = (Operation)eobjectDescription.getEObjectOrProxy() ;
- String displayString = VSLProposalUtils.buildDisplayStringForOperationCall(calledOperation) ;
- String completionString = VSLProposalUtils.buildCompletionStringForOperationCall(calledOperation) ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allOperations);
+ IScope scope = new SimpleScope(iterableIEobjectDescription);
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ Operation calledOperation = (Operation)eobjectDescription.getEObjectOrProxy();
+ String displayString = VSLProposalUtils.buildDisplayStringForOperationCall(calledOperation);
+ String completionString = VSLProposalUtils.buildCompletionStringForOperationCall(calledOperation);
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
}
@Override
- public void completeOperationCallExpression_Arguments(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
-
- if (! (model instanceof OperationCallExpression))
- return ;
-
- Operation calledOperation = ((OperationCallExpression)model).getOperation() ;
- if (calledOperation != null) {
- Parameter firstParameter = null ;
- Iterator<Parameter> allParameters = calledOperation.getOwnedParameters().iterator() ;
- while (allParameters.hasNext() && firstParameter == null) {
- Parameter currentParam = allParameters.next() ;
- if (currentParam.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
- firstParameter = currentParam ;
+ public void completeOperationCallExpression_Arguments(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+
+ if(!(model instanceof OperationCallExpression)) {
+ return;
+ }
+
+ Operation calledOperation = ((OperationCallExpression)model).getOperation();
+ if(calledOperation != null) {
+ Parameter firstParameter = null;
+ Iterator<Parameter> allParameters = calledOperation.getOwnedParameters().iterator();
+ while(allParameters.hasNext() && firstParameter == null) {
+ Parameter currentParam = allParameters.next();
+ if(currentParam.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
+ firstParameter = currentParam;
+ }
}
- if (firstParameter != null) {
- Classifier expectedType = (Classifier)firstParameter.getType() ;
- Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
+ if(firstParameter != null) {
+ Classifier expectedType = (Classifier)firstParameter.getType();
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
- }
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
@@ -539,104 +473,95 @@ public class VSLProposalProvider extends AbstractVSLProposalProvider {
}
@Override
- public void completeOperationCallExpression_Suffix(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeOperationCallExpression_Suffix(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeOperationCallExpression_Suffix(model, assignment, context,
- acceptor);
+ super.completeOperationCallExpression_Suffix(model, assignment, context, acceptor);
}
@Override
- public void completeNameOrChoiceOrBehaviorCall_Path(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeNameOrChoiceOrBehaviorCall_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeNameOrChoiceOrBehaviorCall_Path(model, assignment, context,
- acceptor);
+ super.completeNameOrChoiceOrBehaviorCall_Path(model, assignment, context, acceptor);
}
@Override
- public void completeNameOrChoiceOrBehaviorCall_Id(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof NameOrChoiceOrBehaviorCall && ((NameOrChoiceOrBehaviorCall)model).getPath() != null) {
- IScope scope = VSLScopeProvider.eInstance.scope_NameOrChoiceOrBehaviorCall_id((NameOrChoiceOrBehaviorCall)model, VSLPackage.eINSTANCE.getNameOrChoiceOrBehaviorCall_Id()) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ public void completeNameOrChoiceOrBehaviorCall_Id(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof NameOrChoiceOrBehaviorCall && ((NameOrChoiceOrBehaviorCall)model).getPath() != null) {
+ IScope scope = VSLScopeProvider.eInstance.scope_NameOrChoiceOrBehaviorCall_id((NameOrChoiceOrBehaviorCall)model, VSLPackage.eINSTANCE.getNameOrChoiceOrBehaviorCall_Id());
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
boolean goOn = true;
- if (eobjectDescription.getEObjectOrProxy() instanceof Behavior) {
- Behavior behavior = (Behavior)eobjectDescription.getEObjectOrProxy() ;
- boolean behaviorHasAReturnType = false ;
- for (Parameter p : behavior.getOwnedParameters()) {
- if (p.getDirection() == ParameterDirectionKind.RETURN_LITERAL)
- behaviorHasAReturnType = true ;
+ if(eobjectDescription.getEObjectOrProxy() instanceof Behavior) {
+ Behavior behavior = (Behavior)eobjectDescription.getEObjectOrProxy();
+ boolean behaviorHasAReturnType = false;
+ for(Parameter p : behavior.getOwnedParameters()) {
+ if(p.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
+ behaviorHasAReturnType = true;
+ }
}
- goOn = behaviorHasAReturnType ;
+ goOn = behaviorHasAReturnType;
}
- if (goOn) {
- String displayString = eobjectDescription.getName().getLastSegment() ;
- String completionString = eobjectDescription.getName().getLastSegment() ;
- if (eobjectDescription.getEObjectOrProxy() instanceof Behavior) {
- displayString = VSLProposalUtils.buildDisplayStringForBehaviorCall((Behavior)eobjectDescription.getEObjectOrProxy()) ;
- completionString = VSLProposalUtils.buildCompletionStringForBehaviorCall((Behavior)eobjectDescription.getEObjectOrProxy()) ;
+ if(goOn) {
+ String displayString = eobjectDescription.getName().getLastSegment();
+ String completionString = eobjectDescription.getName().getLastSegment();
+ if(eobjectDescription.getEObjectOrProxy() instanceof Behavior) {
+ displayString = VSLProposalUtils.buildDisplayStringForBehaviorCall((Behavior)eobjectDescription.getEObjectOrProxy());
+ completionString = VSLProposalUtils.buildCompletionStringForBehaviorCall((Behavior)eobjectDescription.getEObjectOrProxy());
}
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
}
- }
- else {
+ } else {
// ignore. Already handled by other rules.
}
}
@Override
- public void completeNameOrChoiceOrBehaviorCall_Arguments(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (! (model instanceof NameOrChoiceOrBehaviorCall))
- return ;
-
- NamedElement cddBehavior = ((NameOrChoiceOrBehaviorCall)model).getId() ;
- if (cddBehavior == null || !(cddBehavior instanceof Behavior))
- return ;
- Behavior calledBehavior = (Behavior)cddBehavior ;
-
- if (calledBehavior != null) {
- Parameter firstParameter = null ;
- Iterator<Parameter> allParameters = calledBehavior.getOwnedParameters().iterator() ;
- while (allParameters.hasNext() && firstParameter == null) {
- Parameter currentParam = allParameters.next() ;
- if (currentParam.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
- firstParameter = currentParam ;
+ public void completeNameOrChoiceOrBehaviorCall_Arguments(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(!(model instanceof NameOrChoiceOrBehaviorCall)) {
+ return;
+ }
+
+ NamedElement cddBehavior = ((NameOrChoiceOrBehaviorCall)model).getId();
+ if(cddBehavior == null || !(cddBehavior instanceof Behavior)) {
+ return;
+ }
+ Behavior calledBehavior = (Behavior)cddBehavior;
+
+ if(calledBehavior != null) {
+ Parameter firstParameter = null;
+ Iterator<Parameter> allParameters = calledBehavior.getOwnedParameters().iterator();
+ while(allParameters.hasNext() && firstParameter == null) {
+ Parameter currentParam = allParameters.next();
+ if(currentParam.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
+ firstParameter = currentParam;
+ }
}
- if (firstParameter != null) {
- Classifier expectedType = (Classifier)firstParameter.getType() ;
- Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ if(firstParameter != null) {
+ Classifier expectedType = (Classifier)firstParameter.getType();
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
@@ -644,164 +569,149 @@ public class VSLProposalProvider extends AbstractVSLProposalProvider {
}
@Override
- public void completeQualifiedName_Path(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeQualifiedName_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// ignore. Treated by qualifiedName_Remaining, or the context rule.
}
@Override
- public void completeQualifiedName_Remaining(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof QualifiedName) {
- IScope scope = VSLScopeProvider.eInstance.scope_QualifiedName_remaining((QualifiedName)model, VSLPackage.eINSTANCE.getQualifiedName_Remaining()) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ public void completeQualifiedName_Remaining(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof QualifiedName) {
+ IScope scope = VSLScopeProvider.eInstance.scope_QualifiedName_remaining((QualifiedName)model, VSLPackage.eINSTANCE.getQualifiedName_Remaining());
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String displayString = eobjectDescription.getName() + "::";
String completionString = eobjectDescription.getName() + "::";
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
- }
- else {
+ } else {
// ignore. Should already be treated by the context rule
}
}
@Override
- public void completeInterval_IsLowerIncluded(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeInterval_IsLowerIncluded(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
//super.completeInterval_IsLowerIncluded(model, assignment, context, acceptor);
}
@Override
- public void completeInterval_Lower(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void completeInterval_Lower(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeInterval_Lower(model, assignment, context, acceptor);
}
@Override
- public void completeInterval_Upper(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void completeInterval_Upper(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeInterval_Upper(model, assignment, context, acceptor);
}
@Override
- public void completeInterval_IsUpperIncluded(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeInterval_IsUpperIncluded(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
//super.completeInterval_IsUpperIncluded(model, assignment, context, acceptor);
}
@Override
- public void completeCollectionOrTuple_ListOfValues(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeCollectionOrTuple_ListOfValues(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeCollectionOrTuple_ListOfValues(model, assignment, context,
- acceptor);
+ super.completeCollectionOrTuple_ListOfValues(model, assignment, context, acceptor);
}
@Override
- public void completeTuple_ListOfValueNamePairs(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeTuple_ListOfValueNamePairs(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeTuple_ListOfValueNamePairs(model, assignment, context, acceptor);
}
@Override
- public void completeListOfValues_Values(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof OperationCallExpression || model instanceof NameOrChoiceOrBehaviorCall || model instanceof CollectionOrTuple)
- return ; // already treated by other cases
-
- INode node = context.getCurrentNode() ;
- IDocument document = context.getViewer().getDocument() ;
- char startChar = ' ' ;
- char openingListChar = ' ';
- int rule = -1 ; // 0 => OperationCall, 1 => BehaviorCall, 2 => CollectionOrTuple
- if (model.eContainer() instanceof OperationCallExpression) {
- startChar = '.' ;
- openingListChar = '(' ;
- rule = 0 ;
+ public void completeListOfValues_Values(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof OperationCallExpression || model instanceof NameOrChoiceOrBehaviorCall || model instanceof CollectionOrTuple) {
+ return; // already treated by other cases
}
- else if (model.eContainer() instanceof NameOrChoiceOrBehaviorCall) {
- startChar = ' ' ;
- openingListChar = '(' ;
- rule = 1 ;
- }
- else if (model.eContainer() instanceof CollectionOrTuple) {
- startChar = ' ' ;
- openingListChar = '{' ;
- rule = 2 ;
+
+ INode node = context.getCurrentNode();
+ IDocument document = context.getViewer().getDocument();
+ char startChar = ' ';
+ char openingListChar = ' ';
+ int rule = -1; // 0 => OperationCall, 1 => BehaviorCall, 2 => CollectionOrTuple
+ if(model.eContainer() instanceof OperationCallExpression) {
+ startChar = '.';
+ openingListChar = '(';
+ rule = 0;
+ } else if(model.eContainer() instanceof NameOrChoiceOrBehaviorCall) {
+ startChar = ' ';
+ openingListChar = '(';
+ rule = 1;
+ } else if(model.eContainer() instanceof CollectionOrTuple) {
+ startChar = ' ';
+ openingListChar = '{';
+ rule = 2;
}
try {
- Classifier expectedType = null ;
- char[] completePrefix = document.get(0, node.getOffset()).toCharArray() ;
- boolean dotCallFound = false ;
- boolean openingListCharFound = false ;
- int i = completePrefix.length - 1 ;
- int positionInTheList = 0 ;
- int closingCharacters = 0 ;
- while (i > 0 && !dotCallFound) {
- char currentChar = completePrefix[i] ;
- if (currentChar == '(' || currentChar == '{') {
- if (closingCharacters != 0)
- closingCharacters-- ;
- else
- openingListCharFound = true ;
- }
- else if (currentChar == ')' || currentChar == '}')
- closingCharacters ++ ;
- else if (currentChar == ',') {
+ Classifier expectedType = null;
+ char[] completePrefix = document.get(0, node.getOffset()).toCharArray();
+ boolean dotCallFound = false;
+ boolean openingListCharFound = false;
+ int i = completePrefix.length - 1;
+ int positionInTheList = 0;
+ int closingCharacters = 0;
+ while(i > 0 && !dotCallFound) {
+ char currentChar = completePrefix[i];
+ if(currentChar == '(' || currentChar == '{') {
+ if(closingCharacters != 0) {
+ closingCharacters--;
+ } else {
+ openingListCharFound = true;
+ }
+ } else if(currentChar == ')' || currentChar == '}') {
+ closingCharacters++;
+ } else if(currentChar == ',') {
//if ()
- if (closingCharacters == 0)
- positionInTheList ++ ;
- }
- else if (currentChar == startChar && openingListCharFound) {
- dotCallFound = true ;
+ if(closingCharacters == 0) {
+ positionInTheList++;
+ }
+ } else if(currentChar == startChar && openingListCharFound) {
+ dotCallFound = true;
}
- i-- ;
+ i--;
}
- if (openingListCharFound) {
- switch (rule) {
+ if(openingListCharFound) {
+ switch(rule) {
case 0: // OperationCall
- OperationCallExpression callOp = (OperationCallExpression) model.eContainer() ;
- if (callOp.getOperation() == null || callOp.getOperation().getOwnedParameters() == null)
- return ;
- List<Parameter> operationParameters = new ArrayList<Parameter>() ;
- for (Parameter p : callOp.getOperation().getOwnedParameters()) {
- if (p.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
- operationParameters.add(p) ;
+ OperationCallExpression callOp = (OperationCallExpression)model.eContainer();
+ if(callOp.getOperation() == null || callOp.getOperation().getOwnedParameters() == null) {
+ return;
+ }
+ List<Parameter> operationParameters = new ArrayList<Parameter>();
+ for(Parameter p : callOp.getOperation().getOwnedParameters()) {
+ if(p.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
+ operationParameters.add(p);
+ }
}
- if (positionInTheList < operationParameters.size()) {
- expectedType = (Classifier)operationParameters.get(positionInTheList).getType() ;
+ if(positionInTheList < operationParameters.size()) {
+ expectedType = (Classifier)operationParameters.get(positionInTheList).getType();
}
break;
case 1: // BehaviorCall
- NameOrChoiceOrBehaviorCall callBehav = (NameOrChoiceOrBehaviorCall) model.eContainer() ;
- NamedElement cddBehavior = callBehav.getId() ;
- if (cddBehavior instanceof Behavior) {
- Behavior behavior = (Behavior)cddBehavior ;
- if (behavior.getOwnedParameters()== null)
- return ;
- List<Parameter> behaviorParameters = new ArrayList<Parameter>() ;
- for (Parameter p : behavior.getOwnedParameters()) {
- if (p.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
- behaviorParameters.add(p) ;
+ NameOrChoiceOrBehaviorCall callBehav = (NameOrChoiceOrBehaviorCall)model.eContainer();
+ NamedElement cddBehavior = callBehav.getId();
+ if(cddBehavior instanceof Behavior) {
+ Behavior behavior = (Behavior)cddBehavior;
+ if(behavior.getOwnedParameters() == null) {
+ return;
}
- if (positionInTheList < behaviorParameters.size()) {
- expectedType = (Classifier)behaviorParameters.get(positionInTheList).getType() ;
+ List<Parameter> behaviorParameters = new ArrayList<Parameter>();
+ for(Parameter p : behavior.getOwnedParameters()) {
+ if(p.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
+ behaviorParameters.add(p);
+ }
+ }
+ if(positionInTheList < behaviorParameters.size()) {
+ expectedType = (Classifier)behaviorParameters.get(positionInTheList).getType();
}
}
break;
@@ -811,730 +721,613 @@ public class VSLProposalProvider extends AbstractVSLProposalProvider {
default:
break;
}
- if (expectedType != null) {
- Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ if(expectedType != null) {
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType(expectedType);
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
}
- }
- catch (Exception exception) {
- exception.printStackTrace() ;
+ } catch (Exception exception) {
+ exception.printStackTrace();
}
//super.completeListOfValues_Values(model, assignment, context, acceptor);
}
-
+
@Override
- public void completeListOfValueNamePairs_ValueNamePairs(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeListOfValueNamePairs_ValueNamePairs(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeListOfValueNamePairs_ValueNamePairs(model, assignment, context,
- acceptor);
+ super.completeListOfValueNamePairs_ValueNamePairs(model, assignment, context, acceptor);
}
@Override
- public void completeValueNamePair_Property(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeValueNamePair_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// First retrieves all the properties available for the context type, in the case where the context type is a tuple or nfp type
- Classifier classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping() ;
- if (! VSLContextUtil.isATupleType(classifierForScoping))
+ Classifier classifierForScoping = VSLScopeProvider.eInstance.new ScopingHelper(model).getClassifierForScoping();
+ if(!VSLContextUtil.isATupleType(classifierForScoping)) {
// TMP solution. Forces the classifier for scoping to be nfp_duration
classifierForScoping = (Classifier)VSLJavaValidator._nfp_duration;
- List<Property> allProperties = new ArrayList<Property>() ;
- for (Feature f : classifierForScoping.allFeatures()) {
- if (f instanceof Property)
- allProperties.add((Property)f) ;
}
-
+ List<Property> allProperties = new ArrayList<Property>();
+ for(Feature f : classifierForScoping.allFeatures()) {
+ if(f instanceof Property) {
+ allProperties.add((Property)f);
+ }
+ }
+
// Removes already specified properties from the context ListOfValueNamePairs
- List<Property> allReadySpecifiedProperties = new ArrayList<Property>() ;
- EObject cddContextListOfValueNamePairs = model ;
- if (cddContextListOfValueNamePairs instanceof Tuple) {
- cddContextListOfValueNamePairs = ((Tuple)cddContextListOfValueNamePairs).getListOfValueNamePairs() ;
+ List<Property> allReadySpecifiedProperties = new ArrayList<Property>();
+ EObject cddContextListOfValueNamePairs = model;
+ if(cddContextListOfValueNamePairs instanceof Tuple) {
+ cddContextListOfValueNamePairs = ((Tuple)cddContextListOfValueNamePairs).getListOfValueNamePairs();
}
- while (cddContextListOfValueNamePairs != null && ! (cddContextListOfValueNamePairs instanceof ListOfValueNamePairs)) {
- cddContextListOfValueNamePairs = cddContextListOfValueNamePairs.eContainer() ;
+ while(cddContextListOfValueNamePairs != null && !(cddContextListOfValueNamePairs instanceof ListOfValueNamePairs)) {
+ cddContextListOfValueNamePairs = cddContextListOfValueNamePairs.eContainer();
}
- if (cddContextListOfValueNamePairs != null) {
- ListOfValueNamePairs listOfValueNamePairs = (ListOfValueNamePairs)cddContextListOfValueNamePairs ;
- for (ValueNamePair valueNamePair : listOfValueNamePairs.getValueNamePairs()) {
- if (valueNamePair.getProperty() != null)
- allReadySpecifiedProperties.add(valueNamePair.getProperty()) ;
+ if(cddContextListOfValueNamePairs != null) {
+ ListOfValueNamePairs listOfValueNamePairs = (ListOfValueNamePairs)cddContextListOfValueNamePairs;
+ for(ValueNamePair valueNamePair : listOfValueNamePairs.getValueNamePairs()) {
+ if(valueNamePair.getProperty() != null) {
+ allReadySpecifiedProperties.add(valueNamePair.getProperty());
+ }
}
}
- allProperties.removeAll(allReadySpecifiedProperties) ;
-
+ allProperties.removeAll(allReadySpecifiedProperties);
+
// Then builds the proposal list
- Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allProperties) ;
- IScope scope = new SimpleScope(iterableIEobjectDescription) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ Iterable<IEObjectDescription> iterableIEobjectDescription = Scopes.scopedElementsFor(allProperties);
+ IScope scope = new SimpleScope(iterableIEobjectDescription);
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
String displayString = eobjectDescription.getName() + " = ";
String completionString = eobjectDescription.getName() + " = ";
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
//super.completeValueNamePair_Property(model, assignment, context, acceptor);
}
@Override
- public void completeValueNamePair_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model == null || !(model instanceof ValueNamePair))
- return ;
- ValueNamePair valueNamePairRuleRule = (ValueNamePair)model ;
-
- if (valueNamePairRuleRule.getProperty() == null || valueNamePairRuleRule.getProperty().getType() == null)
- return ;
-
- Property p = valueNamePairRuleRule.getProperty() ;
-
- Map<String,Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)p.getType()) ;
- for (String s : allProposals.keySet()) {
- if (s.startsWith(context.getPrefix())) {
- String completionString ;
- String displayString ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- }
- else {
- if (! s.contains("|")) {
- completionString = s ;
- displayString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ public void completeValueNamePair_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model == null || !(model instanceof ValueNamePair)) {
+ return;
+ }
+ ValueNamePair valueNamePairRuleRule = (ValueNamePair)model;
+
+ if(valueNamePairRuleRule.getProperty() == null || valueNamePairRuleRule.getProperty().getType() == null) {
+ return;
+ }
+
+ Property p = valueNamePairRuleRule.getProperty();
+
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)p.getType());
+ for(String s : allProposals.keySet()) {
+ if(s.startsWith(context.getPrefix())) {
+ String completionString;
+ String displayString;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ } else {
+ if(!s.contains("|")) {
+ completionString = s;
+ displayString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context) ;
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(((allProposals.get(s) != null) && (allProposals.get(s) instanceof NamedElement)) ? (NamedElement)allProposals.get(s) : null, completionString, displayString, context);
}
- acceptor.accept(completionProposal) ;
+ acceptor.accept(completionProposal);
}
}
}
@Override
- public void completeInstantObsExpression_Id(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- for (Element e : ScopingVisitors.recursivelyownedAndImportedInstantObservations.visit(VSLJavaValidator.getModel())) {
- TimeObservation t = (TimeObservation)e ;
- if (t.getName().toLowerCase().contains((context.getPrefix().toLowerCase()))) {
- String displayString = t.getQualifiedName() ;
- String completionString = CompletionProposalUtils.getQualifiedNameLabelWithSufficientDepth(t, VSLJavaValidator.getModel()) ;
- ICompletionProposal proposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(t, completionString, displayString, context) ;
- acceptor.accept(proposal) ;
+ public void completeInstantObsExpression_Id(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ for(Element e : ScopingVisitors.recursivelyownedAndImportedInstantObservations.visit(VSLJavaValidator.getModel())) {
+ TimeObservation t = (TimeObservation)e;
+ if(t.getName().toLowerCase().contains((context.getPrefix().toLowerCase()))) {
+ String displayString = t.getQualifiedName();
+ String completionString = CompletionProposalUtils.getQualifiedNameLabelWithSufficientDepth(t, VSLJavaValidator.getModel());
+ ICompletionProposal proposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(t, completionString, displayString, context);
+ acceptor.accept(proposal);
}
}
}
@Override
- public void completeInstantObsExpression_Index(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeInstantObsExpression_Index(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeInstantObsExpression_Index(model, assignment, context, acceptor);
}
@Override
- public void completeInstantObsExpression_Condition(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeInstantObsExpression_Condition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
- super.completeInstantObsExpression_Condition(model, assignment, context,
- acceptor);
+ super.completeInstantObsExpression_Condition(model, assignment, context, acceptor);
}
@Override
- public void completeInstantObsName_Path(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeInstantObsName_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// ignore. already treated by InstantObsExpression
}
@Override
- public void completeInstantObsName_InstantId(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof InstantObsName) {
- IScope scope = VSLScopeProvider.eInstance.scope_InstantObsName_instantId((InstantObsName)model, VSLPackage.eINSTANCE.getInstantObsName_InstantId()) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- String displayString = eobjectDescription.getName().getLastSegment() ;
- String completionString = eobjectDescription.getName().getLastSegment() ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ public void completeInstantObsName_InstantId(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof InstantObsName) {
+ IScope scope = VSLScopeProvider.eInstance.scope_InstantObsName_instantId((InstantObsName)model, VSLPackage.eINSTANCE.getInstantObsName_InstantId());
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ String displayString = eobjectDescription.getName().getLastSegment();
+ String completionString = eobjectDescription.getName().getLastSegment();
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
- }
- else {
+ } else {
// ignore. Already treated by rule InstantObsExpression_ID
}
}
@Override
- public void completeDurationObsExpression_Id(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- for (Element e : ScopingVisitors.recursivelyownedAndImportedDurationObservations.visit(VSLJavaValidator.getModel())) {
- DurationObservation d = (DurationObservation)e ;
- if (d.getName().toLowerCase().contains((context.getPrefix().toLowerCase()))) {
- String displayString = d.getQualifiedName() ;
- String completionString = CompletionProposalUtils.getQualifiedNameLabelWithSufficientDepth(d, VSLJavaValidator.getModel()) ;
- ICompletionProposal proposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(d, completionString, displayString, context) ;
- acceptor.accept(proposal) ;
+ public void completeDurationObsExpression_Id(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ for(Element e : ScopingVisitors.recursivelyownedAndImportedDurationObservations.visit(VSLJavaValidator.getModel())) {
+ DurationObservation d = (DurationObservation)e;
+ if(d.getName().toLowerCase().contains((context.getPrefix().toLowerCase()))) {
+ String displayString = d.getQualifiedName();
+ String completionString = CompletionProposalUtils.getQualifiedNameLabelWithSufficientDepth(d, VSLJavaValidator.getModel());
+ ICompletionProposal proposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(d, completionString, displayString, context);
+ acceptor.accept(proposal);
}
}
}
@Override
- public void completeDurationObsExpression_Index(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeDurationObsExpression_Index(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeDurationObsExpression_Index(model, assignment, context, acceptor);
}
@Override
- public void completeDurationObsExpression_Condition(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeDurationObsExpression_Condition(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
- super.completeDurationObsExpression_Condition(model, assignment, context,
- acceptor);
+ super.completeDurationObsExpression_Condition(model, assignment, context, acceptor);
}
@Override
- public void completeDurationObsName_Path(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeDurationObsName_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeDurationObsName_Path(model, assignment, context, acceptor);
}
@Override
- public void completeDurationObsName_DurationId(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model instanceof DurationObsName) {
- IScope scope = VSLScopeProvider.eInstance.scope_DurationObsName_durationId((DurationObsName)model, VSLPackage.eINSTANCE.getDurationObsName_DurationId()) ;
- for (IEObjectDescription eobjectDescription : scope.getAllElements()) {
- if (eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- String displayString = eobjectDescription.getName().getLastSegment() ;
- String completionString = eobjectDescription.getName().getLastSegment() ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ public void completeDurationObsName_DurationId(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model instanceof DurationObsName) {
+ IScope scope = VSLScopeProvider.eInstance.scope_DurationObsName_durationId((DurationObsName)model, VSLPackage.eINSTANCE.getDurationObsName_DurationId());
+ for(IEObjectDescription eobjectDescription : scope.getAllElements()) {
+ if(eobjectDescription.getName().getLastSegment().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ String displayString = eobjectDescription.getName().getLastSegment();
+ String completionString = eobjectDescription.getName().getLastSegment();
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)eobjectDescription.getEObjectOrProxy(), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
- }
- else {
+ } else {
// ignore. Already treated by rule DurationObsExpression_ID
}
}
@Override
- public void completeJitterExp_FirstInstant(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (!context.getPrefix().equals("@")) {
- String displayString = "@" ;
- String completionString = "@" ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(null, completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ public void completeJitterExp_FirstInstant(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(!context.getPrefix().equals("@")) {
+ String displayString = "@";
+ String completionString = "@";
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(null, completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
@Override
- public void completeJitterExp_SecondInstant(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (!context.getPrefix().equals("@")) {
- String displayString = "@" ;
- String completionString = "@" ;
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(null, completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ public void completeJitterExp_SecondInstant(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(!context.getPrefix().equals("@")) {
+ String displayString = "@";
+ String completionString = "@";
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(null, completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
@Override
- public void completeVariableDeclaration_VariableDeclaration(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeVariableDeclaration_VariableDeclaration(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeVariableDeclaration_VariableDeclaration(model, assignment,
- context, acceptor);
+ super.completeVariableDeclaration_VariableDeclaration(model, assignment, context, acceptor);
}
@Override
- public void completeVariableDeclaration_Name(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeVariableDeclaration_Name(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeVariableDeclaration_Name(model, assignment, context, acceptor);
}
@Override
- public void completeVariableDeclaration_Type(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeVariableDeclaration_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeVariableDeclaration_Type(model, assignment, context, acceptor);
}
@Override
- public void completeVariableDeclaration_InitValue(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeVariableDeclaration_InitValue(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- super.completeVariableDeclaration_InitValue(model, assignment, context,
- acceptor);
+ super.completeVariableDeclaration_InitValue(model, assignment, context, acceptor);
}
@Override
- public void completeDataTypeName_Path(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void completeDataTypeName_Path(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeDataTypeName_Path(model, assignment, context, acceptor);
}
@Override
- public void completeDataTypeName_Type(EObject model, Assignment assignment,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void completeDataTypeName_Type(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.completeDataTypeName_Type(model, assignment, context, acceptor);
}
@Override
- public void completeIntegerLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeIntegerLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeIntegerLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeUnlimitedLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeUnlimitedLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeUnlimitedLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeRealLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeRealLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeRealLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeDateTimeLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeDateTimeLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeDateTimeLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeBooleanLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeBooleanLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeBooleanLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeNullLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeNullLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeNullLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeDefaultLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeDefaultLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeDefaultLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void completeStringLiteralRule_Value(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void completeStringLiteralRule_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.completeStringLiteralRule_Value(model, assignment, context, acceptor);
}
@Override
- public void complete_Expression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_Expression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.complete_Expression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_AndOrXorExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_AndOrXorExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.complete_AndOrXorExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_EqualityExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_EqualityExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// Auto-generated method stub
super.complete_EqualityExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_RelationalExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_RelationalExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_RelationalExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_ConditionalExpression(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_ConditionalExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_ConditionalExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_AdditiveExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_AdditiveExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_AdditiveExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_MultiplicativeExpression(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_MultiplicativeExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_MultiplicativeExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_UnaryExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_UnaryExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_UnaryExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_PrimaryExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_PrimaryExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_PrimaryExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_ValueSpecification(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_ValueSpecification(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_ValueSpecification(model, ruleCall, context, acceptor);
}
@Override
- public void complete_SuffixExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_SuffixExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_SuffixExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_PropertyCallExpression(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_PropertyCallExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_PropertyCallExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_OperationCallExpression(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_OperationCallExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_OperationCallExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_Literal(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_Literal(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_Literal(model, ruleCall, context, acceptor);
}
@Override
- public void complete_NameOrChoiceOrBehaviorCall(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_NameOrChoiceOrBehaviorCall(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
//super.complete_NameOrChoiceOrBehaviorCall(model, ruleCall, context, acceptor);
}
@Override
- public void complete_QualifiedName(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_QualifiedName(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_QualifiedName(model, ruleCall, context, acceptor);
}
@Override
- public void complete_Interval(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_Interval(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_Interval(model, ruleCall, context, acceptor);
}
@Override
- public void complete_CollectionOrTuple(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_CollectionOrTuple(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_CollectionOrTuple(model, ruleCall, context, acceptor);
}
@Override
- public void complete_Tuple(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_Tuple(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_Tuple(model, ruleCall, context, acceptor);
}
@Override
- public void complete_ListOfValues(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_ListOfValues(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_ListOfValues(model, ruleCall, context, acceptor);
}
@Override
- public void complete_ListOfValueNamePairs(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_ListOfValueNamePairs(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_ListOfValueNamePairs(model, ruleCall, context, acceptor);
}
@Override
- public void complete_ValueNamePair(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_ValueNamePair(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_ValueNamePair(model, ruleCall, context, acceptor);
}
@Override
- public void complete_TimeExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_TimeExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_TimeExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_InstantObsExpression(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_InstantObsExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_InstantObsExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_InstantObsName(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_InstantObsName(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
-
+
super.complete_InstantObsName(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DurationObsExpression(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_DurationObsExpression(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DurationObsExpression(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DurationObsName(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_DurationObsName(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DurationObsName(model, ruleCall, context, acceptor);
}
@Override
- public void complete_JitterExp(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_JitterExp(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_JitterExp(model, ruleCall, context, acceptor);
}
@Override
- public void complete_VariableDeclaration(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_VariableDeclaration(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_VariableDeclaration(model, ruleCall, context, acceptor);
}
@Override
- public void complete_VariableDirectionKind(EObject model,
- RuleCall ruleCall, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
+ public void complete_VariableDirectionKind(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_VariableDirectionKind(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DataTypeName(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_DataTypeName(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DataTypeName(model, ruleCall, context, acceptor);
}
@Override
- public void complete_NumberLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_NumberLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_NumberLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_IntegerLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_IntegerLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_IntegerLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_IntegerLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_IntegerLiteral(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_IntegerLiteral(model, ruleCall, context, acceptor);
}
@Override
- public void complete_UnlimitedLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_UnlimitedLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_UnlimitedLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_RealLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_RealLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_RealLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_RealLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_RealLiteral(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_RealLiteral(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DateTimeLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_DateTimeLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DateTimeLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DateTimeLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_DateTimeLiteral(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DateTimeLiteral(model, ruleCall, context, acceptor);
}
@Override
- public void complete_BooleanLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_BooleanLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_BooleanLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_BooleanLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_BooleanLiteral(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_BooleanLiteral(model, ruleCall, context, acceptor);
}
@Override
- public void complete_NullLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_NullLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_NullLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_NullLiteral(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_NullLiteral(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_NullLiteral(model, ruleCall, context, acceptor);
}
@Override
- public void complete_DefaultLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_DefaultLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_DefaultLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void complete_StringLiteralRule(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_StringLiteralRule(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
super.complete_StringLiteralRule(model, ruleCall, context, acceptor);
}
@Override
- public void completeKeyword(Keyword keyword,
- ContentAssistContext contentAssistContext,
- ICompletionProposalAcceptor acceptor) {
+ public void completeKeyword(Keyword keyword, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor) {
// TODO Auto-generated method stub
- if (!contentAssistContext.getPrefix().equals("")) {
- if (keyword.getValue().startsWith(contentAssistContext.getPrefix()))
+ if(!contentAssistContext.getPrefix().equals("")) {
+ if(keyword.getValue().startsWith(contentAssistContext.getPrefix())) {
super.completeKeyword(keyword, contentAssistContext, acceptor);
+ }
}
}
@Override
- public void complete_STRING(EObject model, RuleCall ruleCall,
- ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ public void complete_STRING(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
// super.complete_STRING(model, ruleCall, context, acceptor);
}
-
+
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/META-INF/MANIFEST.MF b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/META-INF/MANIFEST.MF
index 5138be76919..f08b6986572 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/META-INF/MANIFEST.MF
@@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext;bundl
org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.0",
org.eclipse.papyrus.marte.vsl;bundle-version="1.0.0",
org.eclipse.papyrus.marte.vsl.ui;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ui/contributions/ConstraintWithVSLPopupEditorConfiguration.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ui/contributions/ConstraintWithVSLPopupEditorConfiguration.java
index 7c2c3e770d6..7539d50b219 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ui/contributions/ConstraintWithVSLPopupEditorConfiguration.java
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/ui/contributions/ConstraintWithVSLPopupEditorConfiguration.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -14,37 +14,28 @@
package org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui.contributions;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.constraintWithVSLl.ConstraintRule;
import org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.constraintWithVSLl.ConstraintSpecification;
import org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ui.internal.ConstraintWithVSLlActivator;
-import org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.validation.ConstraintWithVSLlJavaValidator;
-import org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.validation.SemanticValidator;
import org.eclipse.papyrus.marte.vsl.extensions.VSLSerializationUtil;
-import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.OpaqueExpression;
import org.eclipse.uml2.uml.UMLFactory;
import com.google.inject.Injector;
-public class ConstraintWithVSLPopupEditorConfiguration extends PopupEditorConfiguration {
-
- private Constraint constraint = null;
-
- private String newBody = "";
+public class ConstraintWithVSLPopupEditorConfiguration extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
public ConstraintWithVSLPopupEditorConfiguration() {
super();
@@ -74,95 +65,17 @@ public class ConstraintWithVSLPopupEditorConfiguration extends PopupEditorConfig
}
}
-
-
- @Override
- public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
- // resolves the edit part, and the associated semantic element
- IGraphicalEditPart graphicalEditPart = null;
- if(!(editPart instanceof IGraphicalEditPart)) {
- return null;
- }
- graphicalEditPart = (IGraphicalEditPart)editPart;
- if(!(graphicalEditPart.resolveSemanticElement() instanceof Constraint)) {
- return null;
- }
- constraint = (Constraint)graphicalEditPart.resolveSemanticElement();
-
- ConstraintWithVSLlJavaValidator.init(constraint);
- // initializes VSL editor
- VSLJavaValidator.init(constraint);
-
- // retrieves the XText injector
- Injector injector = ConstraintWithVSLlActivator.getInstance().getInjector("org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ConstraintWithVSLl");
-
- // builds the text content and extension for a temporary file, to be edited by the xtext editor
- String textToEdit = "" + this.getTextToEdit(graphicalEditPart.resolveSemanticElement());
- String fileExtension = "" + ".constraintwithvsl";
-
- // builds a new IXtextEMFReconciler.
- // Its purpose is to extract any relevant information from the textual specification,
- // and then merge it in the context UML model if necessary
- IXtextEMFReconciler reconciler = new IXtextEMFReconciler() {
-
- public void reconcile(EObject modelObject, EObject xtextObject) {
-
- ConstraintSpecification newSpecification = null;
-
- ConstraintRule rule = (ConstraintRule)xtextObject;
- newSpecification = rule.getSpecification();
- if(newSpecification != null) {
- newBody = VSLSerializationUtil.printExpression(newSpecification.getExpression());
- }
-
- // Creates and executes the update command
- // org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = getUpdateCommand(constraint) ;
- // List<Constraint> editedObjects = new ArrayList<Constraint>() ; editedObjects.add(constraint) ;
- // TransactionalEditingDomain editingDomain = EMFUtils.getTransactionalEditingDomain(editedObjects);
- //
- // if(updateCommand.canExecute() && !(TransactionUtil.isReadTransactionInProgress(editingDomain, true, true))) {
- // try {
- // OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- // } catch (ExecutionException e) {
- // log.error(e);
- // }
- // return;
- // }
-
- UpdateConstraintWithVSLCommand updateCommand = new UpdateConstraintWithVSLCommand(constraint);
-
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- System.out.println(e);
- }
-
- }
- };
- return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new SemanticValidator());
- }
-
- private CompositeCommand getUpdateCommand(EObject editedObject) {
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand updateCommand = new CompositeCommand("Property update");
- //IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editedObject);
-
- //SetRequest setIsDerivedRequest = new SetRequest(editedObject, UMLPackage.eINSTANCE.getProperty_IsDerived(), newIsDerived) ;
- //ICommand setIsDerivedCommand = provider.getEditCommand(setIsDerivedRequest) ;
- //updateCommand.add(setIsDerivedCommand) ;
-
-
- return updateCommand;
- }
-
/**
* @author CEA LIST
- *
+ *
* A command for updating the context UML model
*/
protected class UpdateConstraintWithVSLCommand extends AbstractTransactionalCommand {
private Constraint theConstraint;
+ private String newBody;
+
/*
* (non-Javadoc)
*
@@ -184,9 +97,43 @@ public class ConstraintWithVSLPopupEditorConfiguration extends PopupEditorConfig
return CommandResult.newOKCommandResult(theConstraint);
}
- public UpdateConstraintWithVSLCommand(Constraint constraint) {
- super(EditorUtils.getTransactionalEditingDomain(), "Constraint Update", getWorkspaceFiles(constraint));
+ public UpdateConstraintWithVSLCommand(Constraint constraint, String newBody) {
+ super((TransactionalEditingDomain)EMFHelper.resolveEditingDomain(constraint), "Constraint Update", getWorkspaceFiles(constraint));
this.theConstraint = constraint;
+ this.newBody = newBody;
}
}
+
+ @Override
+ public Injector getInjector() {
+ return ConstraintWithVSLlActivator.getInstance().getInjector("org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.ConstraintWithVSLl");
+ }
+
+
+ @Override
+ protected ICommand getParseCommand(EObject umlObject, EObject xtextObject) {
+ ConstraintSpecification newSpecification = null;
+
+ ConstraintRule rule = (ConstraintRule)xtextObject;
+ newSpecification = rule.getSpecification();
+ String newBody = null;
+ if(newSpecification != null) {
+ newBody = VSLSerializationUtil.printExpression(newSpecification.getExpression());
+ }
+
+ if(!(umlObject instanceof Constraint)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if(newBody == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ Constraint constraint = (Constraint)umlObject;
+
+ UpdateConstraintWithVSLCommand updateCommand = new UpdateConstraintWithVSLCommand(constraint, newBody);
+
+ return updateCommand;
+ }
+
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/META-INF/MANIFEST.MF b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/META-INF/MANIFEST.MF
index 31e644d15b8..3040748f531 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/META-INF/MANIFEST.MF
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/META-INF/MANIFEST.MF
@@ -28,7 +28,7 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.uml2.codegen.ecore;bundle-version="1.6.0",
org.eclipse.papyrus.marte.vsl;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/validation/SemanticValidator.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/validation/SemanticValidator.java
deleted file mode 100644
index ed14da8db4a..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/constraintwithvsl/xtext/validation/SemanticValidator.java
+++ /dev/null
@@ -1,31 +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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.marte.textedit.constraintwithvsl.xtext.validation;
-
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXTextSemanticValidator;
-
-/**
- * Custom implementation for IXtextSemanticValidator in the context of the textual editor for constraints coupled with VSL
- *
- * @author CEA LIST
- *
- */
-public class SemanticValidator implements IXTextSemanticValidator {
-
- public boolean validate() {
- return ConstraintWithVSLlJavaValidator.validate();
- }
-
-}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/META-INF/MANIFEST.MF b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/META-INF/MANIFEST.MF
index 36f70776916..0ee797995fb 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/META-INF/MANIFEST.MF
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.0.0",
org.eclipse.papyrus.marte.vsl;bundle-version="1.0.0",
org.eclipse.papyrus.marte.vsl.ui;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java
index 1c3c0a4c654..f420db6ef94 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contentassist/StereotypeApplicationWithVSLProposalProvider.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -21,11 +21,10 @@ import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.contentassist.CompletionProposalUtils;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.TagSpecificationRule;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.contentassist.AbstractStereotypeApplicationWithVSLProposalProvider;
import org.eclipse.papyrus.marte.vsl.ui.contentassist.VSLProposalUtils;
+import org.eclipse.papyrus.uml.xtext.integration.CompletionProposalUtils;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
@@ -34,148 +33,144 @@ import org.eclipse.uml2.uml.TypedElement;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
+
/**
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
*/
public class StereotypeApplicationWithVSLProposalProvider extends AbstractStereotypeApplicationWithVSLProposalProvider {
@Override
- public void completeTagSpecificationRule_Property(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- List<NamedElement> visibleProperties = getVisibleProperties(model) ;
- visibleProperties = this.sortByKindAndName(visibleProperties) ;
- for (EObject o : visibleProperties) {
- NamedElement namedElement = (NamedElement) o ;
- if (namedElement.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
- String completionString =
- context.getPrefix() + namedElement.getName().substring(context.getPrefix().length()) + " = ";
- String displayString = namedElement.getName() ;
- if (namedElement instanceof TypedElement) {
- TypedElement typedElement = (TypedElement) namedElement ;
- displayString += typedElement.getType() != null ?
- " : " + typedElement.getType().getName():
- "" ;
+ public void completeTagSpecificationRule_Property(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ List<NamedElement> visibleProperties = getVisibleProperties(model);
+ visibleProperties = this.sortByKindAndName(visibleProperties);
+ for(EObject o : visibleProperties) {
+ NamedElement namedElement = (NamedElement)o;
+ if(namedElement.getName().toLowerCase().contains(context.getPrefix().toLowerCase())) {
+ String completionString = context.getPrefix() + namedElement.getName().substring(context.getPrefix().length()) + " = ";
+ String displayString = namedElement.getName();
+ if(namedElement instanceof TypedElement) {
+ TypedElement typedElement = (TypedElement)namedElement;
+ displayString += typedElement.getType() != null ? " : " + typedElement.getType().getName() : "";
}
- ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(namedElement, completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ ICompletionProposal completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix(namedElement, completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
}
-
+
private List<NamedElement> getVisibleProperties(EObject rule) {
- List<NamedElement> visibleProperties = new ArrayList<NamedElement>() ;
+ List<NamedElement> visibleProperties = new ArrayList<NamedElement>();
// first retrieves the context stereotype
- EObject context = rule ;
- while (context != null && !(context instanceof StereotypeApplicationRule)) {
- context = context.eContainer() ;
+ EObject context = rule;
+ while(context != null && !(context instanceof StereotypeApplicationRule)) {
+ context = context.eContainer();
}
- if (context != null) {
+ if(context != null) {
// retrieves the stereotype which is applied
- StereotypeApplicationRule stAppRule = (StereotypeApplicationRule)context ;
- if (stAppRule.getStereotype() != null) {
- // add all the available properties for this stereotype
- visibleProperties.addAll(stAppRule.getStereotype().getAllAttributes()) ;
+ StereotypeApplicationRule stAppRule = (StereotypeApplicationRule)context;
+ if(stAppRule.getStereotype() != null) {
+ // add all the available properties for this stereotype
+ visibleProperties.addAll(stAppRule.getStereotype().getAllAttributes());
// removes derived properties or those which name starts with "base_"
- List<Property> filteredList = new ArrayList<Property>(stAppRule.getStereotype().getAllAttributes()) ;
- for (Property p : filteredList) {
- if (p.getName() == null ||
- p.getName().startsWith("base_") ||
- p.isDerived())
- visibleProperties.remove(p) ;
+ List<Property> filteredList = new ArrayList<Property>(stAppRule.getStereotype().getAllAttributes());
+ for(Property p : filteredList) {
+ if(p.getName() == null || p.getName().startsWith("base_") || p.isDerived()) {
+ visibleProperties.remove(p);
+ }
}
// removes the ones which have already been used
- if (stAppRule.getTagSpecification() != null) {
- for (TagSpecificationRule tag : stAppRule.getTagSpecification()) {
- if (tag.getProperty() != null && visibleProperties.contains(tag.getProperty()))
- visibleProperties.remove(tag.getProperty()) ;
+ if(stAppRule.getTagSpecification() != null) {
+ for(TagSpecificationRule tag : stAppRule.getTagSpecification()) {
+ if(tag.getProperty() != null && visibleProperties.contains(tag.getProperty())) {
+ visibleProperties.remove(tag.getProperty());
+ }
}
}
}
}
- return visibleProperties ;
+ return visibleProperties;
}
-
+
@Override
- public void completeExpressionValueRule_Expression(EObject model,
- Assignment assignment, ContentAssistContext context,
- ICompletionProposalAcceptor acceptor) {
- if (model.eContainer() == null || !(model.eContainer() instanceof TagSpecificationRule))
- return ;
- TagSpecificationRule tagSpecificationRule = (TagSpecificationRule)model.eContainer() ;
-
- if (tagSpecificationRule.getProperty() == null || tagSpecificationRule.getProperty().getType() == null)
- return ;
-
- Property p = tagSpecificationRule.getProperty() ;
-
- Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)p.getType(), p) ;
-
+ public void completeExpressionValueRule_Expression(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if(model.eContainer() == null || !(model.eContainer() instanceof TagSpecificationRule)) {
+ return;
+ }
+ TagSpecificationRule tagSpecificationRule = (TagSpecificationRule)model.eContainer();
+
+ if(tagSpecificationRule.getProperty() == null || tagSpecificationRule.getProperty().getType() == null) {
+ return;
+ }
+
+ Property p = tagSpecificationRule.getProperty();
+
+ Map<String, Element> allProposals = VSLProposalUtils.buildProposalForType((Classifier)p.getType(), p);
+
// List<String> allProposals = ProposalUtils.buildProposalForType((Classifier)p.getType()) ;
- for (String s : allProposals.keySet()) {
- String completionString = s.substring(context.getPrefix().length()) ;
- String displayString = s ;
- ICompletionProposal completionProposal = null ;
- if (allProposals.get(s) == null) {
- completionString = s.substring(context.getPrefix().length()) ;
- displayString = s ;
- completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
- }
- else {
- if (! s.contains("|")) {
- displayString = s ;
- completionString = s ;
- }
- else {
- completionString = s.substring(0, s.indexOf("|")) ;
- displayString = s.substring(s.indexOf("|") + 1) ;
+ for(String s : allProposals.keySet()) {
+ String completionString = s.substring(context.getPrefix().length());
+ String displayString = s;
+ ICompletionProposal completionProposal = null;
+ if(allProposals.get(s) == null) {
+ completionString = s.substring(context.getPrefix().length());
+ displayString = s;
+ completionProposal = CompletionProposalUtils.createCompletionProposal(completionString, displayString, context);
+ acceptor.accept(completionProposal);
+ } else {
+ if(!s.contains("|")) {
+ displayString = s;
+ completionString = s;
+ } else {
+ completionString = s.substring(0, s.indexOf("|"));
+ displayString = s.substring(s.indexOf("|") + 1);
}
- if (displayString.contains(context.getPrefix())) {
- completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)allProposals.get(s), completionString, displayString, context) ;
- acceptor.accept(completionProposal) ;
+ if(displayString.contains(context.getPrefix())) {
+ completionProposal = CompletionProposalUtils.createCompletionProposalWithReplacementOfPrefix((NamedElement)allProposals.get(s), completionString, displayString, context);
+ acceptor.accept(completionProposal);
}
}
}
//super.completeExpressionValueRule_Expression(model, assignment, context,
// acceptor);
}
-
+
/* *************************************************
*
* Private utility method for sorting a list of NamedElement by kind and name
*
- **************************************************/
+ * ************************************************
+ */
protected List<NamedElement> sortByKindAndName(List<NamedElement> list) {
- List<NamedElement> sortedList = new ArrayList<NamedElement>() ;
- HashMap<EClass, List<NamedElement>> namedElementGroups = new HashMap<EClass, List<NamedElement>>() ;
-
- for (NamedElement n : list) {
- if (! namedElementGroups.containsKey(n.eClass())) {
- List<NamedElement> group = new ArrayList<NamedElement>() ;
- group.add(n) ;
- namedElementGroups.put(n.eClass(), group) ;
- }
- else {
- List<NamedElement> group = namedElementGroups.get(n.eClass()) ;
- boolean inserted = false ;
- for (int i = 0 ; inserted == false && i < group.size() ; i++) {
- if (group.get(i).getName().compareTo(n.getName()) > 0) {
- group.add(i, n) ;
- inserted = true ;
+ List<NamedElement> sortedList = new ArrayList<NamedElement>();
+ HashMap<EClass, List<NamedElement>> namedElementGroups = new HashMap<EClass, List<NamedElement>>();
+
+ for(NamedElement n : list) {
+ if(!namedElementGroups.containsKey(n.eClass())) {
+ List<NamedElement> group = new ArrayList<NamedElement>();
+ group.add(n);
+ namedElementGroups.put(n.eClass(), group);
+ } else {
+ List<NamedElement> group = namedElementGroups.get(n.eClass());
+ boolean inserted = false;
+ for(int i = 0; inserted == false && i < group.size(); i++) {
+ if(group.get(i).getName().compareTo(n.getName()) > 0) {
+ group.add(i, n);
+ inserted = true;
}
}
- if (!inserted) group.add(n) ;
- namedElementGroups.put(n.eClass(), group) ;
+ if(!inserted) {
+ group.add(n);
+ }
+ namedElementGroups.put(n.eClass(), group);
}
}
-
- for (EClass c : namedElementGroups.keySet()) {
- List<NamedElement> group = namedElementGroups.get(c) ;
- sortedList.addAll(group) ;
+
+ for(EClass c : namedElementGroups.keySet()) {
+ List<NamedElement> group = namedElementGroups.get(c);
+ sortedList.addAll(group);
}
-
- return sortedList ;
+
+ return sortedList;
}
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java
index c6fddadf2c0..100cf001bd2 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/OpenTextualEditorForStereotypeApplications.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -22,10 +22,10 @@ import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
@@ -43,6 +43,7 @@ public class OpenTextualEditorForStereotypeApplications extends AbstractHandler
/**
* {@inheritDoc}
*/
+ @Override
public Object execute(ExecutionEvent event) {
Display current = Display.getCurrent();
@@ -63,19 +64,17 @@ public class OpenTextualEditorForStereotypeApplications extends AbstractHandler
/**
* Convert each selected elements from the explorator menu, or modeling view
* to an EObject and add it to a list
- *
+ *
* @return list of EObject
*/
public void updateSelectedEObject() {
Vector<EObject> currentSelectedEObjects = new Vector<EObject>();
// Retrieve selected elements
- IStructuredSelection selection = (IStructuredSelection)PlatformUI
- .getWorkbench().getActiveWorkbenchWindow()
- .getSelectionService().getSelection();
+ IStructuredSelection selection = (IStructuredSelection)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- Iterator<?> eltIt = (Iterator<?>)selection.iterator();
+ Iterator<?> eltIt = selection.iterator();
while(eltIt.hasNext()) {
Object currentObject = eltIt.next();
@@ -83,12 +82,10 @@ public class OpenTextualEditorForStereotypeApplications extends AbstractHandler
// If the object is an edit part, try to get semantic bridge
if(currentObject instanceof GraphicalEditPart) {
GraphicalEditPart editPart = (GraphicalEditPart)currentObject;
- if(editPart.getModel() instanceof View) {
- View view = (View)editPart.getModel();
- if(view.getElement() instanceof Element) {
- currentObject = (Element)view.getElement();
- new StereotypeApplicationPopupEditorConfigurationContribution().createPopupEditorHelper(editPart).showEditor();
- }
+ EObject semantic = EMFHelper.getEObject(editPart);
+ if(semantic instanceof Element) {
+ //FIXME: The new XText integration doesn't support direct dialog creation on an edit part (The TextAwareEditPart is supposed to handle this case itself)
+ //DirectEditManager manager = new StereotypeApplicationPopupEditorConfigurationContribution().createDirectEditManager(editPart);
}
}
@@ -110,7 +107,7 @@ public class OpenTextualEditorForStereotypeApplications extends AbstractHandler
/**
* Convert each selected elements from the explorator menu, or modeling view
* to an EObject and add it to a list
- *
+ *
* @return list of EObject
*/
public EObject getSelectedEObject() {
@@ -127,16 +124,19 @@ public class OpenTextualEditorForStereotypeApplications extends AbstractHandler
private List<EObject> selectedEObjects;
+ @Override
public void run(IAction action) {
// TODO Auto-generated method stub
this.execute(null);
}
+ @Override
public void selectionChanged(IAction action, ISelection selection) {
}
+ @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java
index e04fc28a14c..6dda059f610 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/ui/contributions/StereotypeApplicationPopupEditorConfigurationContribution.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -17,30 +17,28 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.ExpressionValueRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationsRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.TagSpecificationRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.ui.internal.StereotypeApplicationWithVSLActivator;
-import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.validation.SemanticValidator;
import org.eclipse.papyrus.marte.vsl.extensions.VSLSerializationUtil;
import org.eclipse.papyrus.marte.vsl.ui.contentassist.VSLProposalUtils;
import org.eclipse.papyrus.marte.vsl.vSL.CollectionOrTuple;
import org.eclipse.papyrus.marte.vsl.vSL.Expression;
import org.eclipse.papyrus.marte.vsl.vSL.NameOrChoiceOrBehaviorCall;
import org.eclipse.papyrus.marte.vsl.validation.VSLJavaValidator;
+import org.eclipse.papyrus.uml.xtext.integration.DefaultXtextDirectEditorConfiguration;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.EnumerationLiteral;
import org.eclipse.uml2.uml.NamedElement;
@@ -54,81 +52,11 @@ import com.google.inject.Injector;
/**
* @author CEA LIST
- *
- *
+ *
+ *
*/
-public class StereotypeApplicationPopupEditorConfigurationContribution extends PopupEditorConfiguration {
-
- private Element stereotypedElement = null;
-
- private StereotypeApplicationsRule stereotypeApplicationsObject = null;
-
- private Injector injector = null;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration#createPopupEditorHelper(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)
- */
-
- @Override
- public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
-
- // resolves the edit part, and the associated semantic element
- IGraphicalEditPart graphicalEditPart = null;
- if(!(editPart instanceof IGraphicalEditPart)) {
- return null;
- }
- graphicalEditPart = (IGraphicalEditPart)editPart;
-
- if(!(graphicalEditPart.resolveSemanticElement() instanceof Element)) {
- return null;
- }
- stereotypedElement = (Element)graphicalEditPart.resolveSemanticElement();
-
- // initializes VSL editor
- VSLJavaValidator.init(stereotypedElement);
-
- // retrieves the XText injector
- injector = StereotypeApplicationWithVSLActivator.getInstance().getInjector("org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.StereotypeApplicationWithVSL");
- //VSLJavaValidator.eInstance = injector.getInstance(VSLJavaValidator.class) ;
-
- // builds the text content and extension for a temporary file, to be edited by the xtext editor
- String textToEdit = "" + this.getTextToEdit(graphicalEditPart.resolveSemanticElement());
- String fileExtension = "" + ".StereotypeApplicationWithVSL";
-
- // builds a new IXtextEMFReconciler.
- // Its purpose is to extract any relevant information from the textual specification,
- // and then merge it in the context UML model if necessary
- IXtextEMFReconciler reconciler = new IXtextEMFReconciler() {
+public class StereotypeApplicationPopupEditorConfigurationContribution extends DefaultXtextDirectEditorConfiguration implements ICustomDirectEditorConfiguration {
- public void reconcile(EObject modelObject, EObject xtextObject) {
- // first: retrieves / determines if the xtextObject is a TransitionRule object
- EObject modifiedObject = xtextObject;
- if(!(modelObject instanceof Element)) {
- return;
- }
- while(xtextObject != null && !(xtextObject instanceof StereotypeApplicationsRule)) {
- modifiedObject = modifiedObject.eContainer();
- }
- if(modifiedObject == null) {
- return;
- }
- stereotypeApplicationsObject = (StereotypeApplicationsRule)xtextObject;
-
- // Creates and executes the update command
- UpdateStereotypeApplicationsCommand updateCommand = new UpdateStereotypeApplicationsCommand(stereotypedElement);
-
- try {
- OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
- } catch (ExecutionException e) {
- System.out.println(e);
- }
- }
- };
- return super.createPopupEditorHelper(graphicalEditPart, injector, reconciler, textToEdit, fileExtension, new SemanticValidator());
- }
/*
* (non-Javadoc)
@@ -234,13 +162,15 @@ public class StereotypeApplicationPopupEditorConfigurationContribution extends P
/**
* @author CEA LIST
- *
+ *
* A command for updating the context UML model
*/
protected class UpdateStereotypeApplicationsCommand extends AbstractTransactionalCommand {
private Element stereotypedElement;
+ private StereotypeApplicationsRule stereotypeApplicationsObject;
+
/*
* (non-Javadoc)
*
@@ -335,9 +265,37 @@ public class StereotypeApplicationPopupEditorConfigurationContribution extends P
return CommandResult.newOKCommandResult(stereotypedElement);
}
- public UpdateStereotypeApplicationsCommand(Element stereotypedElement) {
- super(EditorUtils.getTransactionalEditingDomain(), "Stereotype Applications Update", getWorkspaceFiles(stereotypedElement));
+ public UpdateStereotypeApplicationsCommand(Element stereotypedElement, StereotypeApplicationsRule stereotypeApplicationsObject) {
+ super((TransactionalEditingDomain)EMFHelper.resolveEditingDomain(stereotypedElement), "Stereotype Applications Update", getWorkspaceFiles(stereotypedElement));
this.stereotypedElement = stereotypedElement;
+ this.stereotypeApplicationsObject = stereotypeApplicationsObject;
}
}
+
+ @Override
+ public Injector getInjector() {
+ return StereotypeApplicationWithVSLActivator.getInstance().getInjector(StereotypeApplicationWithVSLActivator.ORG_ECLIPSE_PAPYRUS_MARTE_TEXTEDIT_STEREOTYPEAPPLICATIONWITHVSL_XTEXT_STEREOTYPEAPPLICATIONWITHVSL);
+ }
+
+ @Override
+ protected ICommand getParseCommand(EObject modelObject, EObject xtextObject) {
+ // first: retrieves / determines if the xtextObject is a TransitionRule object
+ EObject modifiedObject = xtextObject;
+ if(!(modelObject instanceof Element)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ while(xtextObject != null && !(xtextObject instanceof StereotypeApplicationsRule)) {
+ modifiedObject = modifiedObject.eContainer();
+ }
+ if(modifiedObject == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ Element stereotypedElement = (Element)modelObject;
+ StereotypeApplicationsRule stereotypeApplicationsObject = (StereotypeApplicationsRule)xtextObject;
+
+ // Creates and executes the update command
+ UpdateStereotypeApplicationsCommand updateCommand = new UpdateStereotypeApplicationsCommand(stereotypedElement, stereotypeApplicationsObject);
+ return updateCommand;
+ }
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/META-INF/MANIFEST.MF b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/META-INF/MANIFEST.MF
index 374cf1c4ad6..d42d58e67ce 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/META-INF/MANIFEST.MF
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/META-INF/MANIFEST.MF
@@ -30,7 +30,7 @@ Require-Bundle: org.eclipse.xtext,
org.eclipse.uml2.uml;bundle-version="4.0.0",
org.eclipse.uml2.codegen.ecore;bundle-version="1.6.0",
org.eclipse.papyrus.marte.vsl;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.gmfdiag.xtext.glue;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-Version: 1.0.0.qualifier
Bundle-ManifestVersion: 2
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/scoping/StereotypeApplicationWithVSLScopeProvider.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/scoping/StereotypeApplicationWithVSLScopeProvider.java
index ac654d9aa0e..5ff46936bee 100644
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/scoping/StereotypeApplicationWithVSLScopeProvider.java
+++ b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/scoping/StereotypeApplicationWithVSLScopeProvider.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* 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
@@ -18,11 +18,10 @@ import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.PopupXtextEditorHelper;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.StereotypeApplicationRule;
import org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.stereotypeApplicationWithVSL.TagSpecificationRule;
import org.eclipse.papyrus.marte.vsl.scoping.VSLScopeProvider;
-import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.papyrus.uml.xtext.integration.core.ContextElementUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Stereotype;
@@ -33,9 +32,9 @@ import org.eclipse.xtext.scoping.impl.SimpleScope;
/**
* This class contains custom scoping description.
- *
+ *
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping
- * on how and when to use it
+ * on how and when to use it
*
*/
public class StereotypeApplicationWithVSLScopeProvider extends VSLScopeProvider {
@@ -44,109 +43,113 @@ public class StereotypeApplicationWithVSLScopeProvider extends VSLScopeProvider
*
* Custom scoping for StereotypeApplicationRule_stereotype
*
- *****************************************************************/
-
+ * ***************************************************************
+ */
+
public IScope scope_StereotypeApplicationRule_stereotype(StereotypeApplicationRule ctx, EReference ref) {
- return create___StereotypeApplicationRule_stereotype___Scope(ctx) ;
+ return create___StereotypeApplicationRule_stereotype___Scope(ctx);
}
-
+
private IScope create___StereotypeApplicationRule_stereotype___Scope(StereotypeApplicationRule ctx) {
- List<Stereotype> applicableStereotypes = ((Element)PopupXtextEditorHelper.context).getApplicableStereotypes() ;
- Iterable<IEObjectDescription> visibleStereotypes = Scopes.scopedElementsFor(applicableStereotypes) ;
- return new SimpleScope(visibleStereotypes) ;
+ Element element = (Element)ContextElementUtil.getContextElement(ctx.eResource());
+ if(element == null) {
+ return null;
+ }
+ List<Stereotype> applicableStereotypes = element.getApplicableStereotypes();
+ Iterable<IEObjectDescription> visibleStereotypes = Scopes.scopedElementsFor(applicableStereotypes);
+ return new SimpleScope(visibleStereotypes);
}
-
+
/* ****************************************************************
*
* Custom scoping for StereotypeApplicationRule_stereotype
*
- *****************************************************************/
-
+ * ***************************************************************
+ */
+
public IScope scope_TagSpecificationRule_property(TagSpecificationRule ctx, EReference ref) {
- EObject context = ctx ;
- while (context != null && !(context instanceof StereotypeApplicationRule))
- context = context.eContainer() ;
- if (context == null ||
- ! (context instanceof StereotypeApplicationRule) ||
- ((StereotypeApplicationRule)context).getStereotype() == null)
- return null ;
-
- return create___TagSpecificationRule_property___Scope((((StereotypeApplicationRule)context).getStereotype())) ;
+ EObject context = ctx;
+ while(context != null && !(context instanceof StereotypeApplicationRule)) {
+ context = context.eContainer();
+ }
+ if(context == null || !(context instanceof StereotypeApplicationRule) || ((StereotypeApplicationRule)context).getStereotype() == null) {
+ return null;
+ }
+
+ return create___TagSpecificationRule_property___Scope((((StereotypeApplicationRule)context).getStereotype()));
}
-
+
private IScope create___TagSpecificationRule_property___Scope(Stereotype stereotype) {
- IScope result = null ;
-
+ IScope result = null;
+
// build the stereotype inheritance hierarchy
-
- List<Property> visibleProperties = new ArrayList<Property>() ;
- visibleProperties.addAll(stereotype.getAllAttributes()) ;
-
+
+ List<Property> visibleProperties = new ArrayList<Property>();
+ visibleProperties.addAll(stereotype.getAllAttributes());
+
// removes derived properties or those which name starts with "base_"
- List<Property> filteredList = new ArrayList<Property>(stereotype.getAllAttributes()) ;
- for (Property p : filteredList) {
- if (p.getName() == null ||
- p.getName().startsWith("base_") ||
- p.isDerived())
- visibleProperties.remove(p) ;
+ List<Property> filteredList = new ArrayList<Property>(stereotype.getAllAttributes());
+ for(Property p : filteredList) {
+ if(p.getName() == null || p.getName().startsWith("base_") || p.isDerived()) {
+ visibleProperties.remove(p);
+ }
}
-
-// List<List<Stereotype>> inheritanceStructure = new ArrayList<List<Stereotype>>() ;
-// List<Stereotype> tmpList = new ArrayList<Stereotype>() ;
-// tmpList.add(stereotype) ;
-//
-// do {
-// inheritanceStructure.add(tmpList) ;
-// List<Stereotype> localStereotypeList = new ArrayList<Stereotype>() ;
-// for (Stereotype currentStereotype : tmpList) {
-// for (Classifier general : currentStereotype.getGenerals()) {
-// if (general instanceof Stereotype)
-// localStereotypeList.add((Stereotype)general) ;
-// }
-// }
-// tmpList = new ArrayList<Stereotype>() ;
-// tmpList.addAll(localStereotypeList) ;
-// } while (!tmpList.isEmpty());
-//
-// // builds the nested scope
-//
-// if (! inheritanceStructure.isEmpty()) {
-// List<Property> visibleProperties = new ArrayList<Property>() ;
-// List<Property> filteredProperties = new ArrayList<Property>() ;
-// List<Stereotype> currentList = inheritanceStructure.get(inheritanceStructure.size() - 1) ;
-// for (Stereotype currentStereotype : currentList) {
-// visibleProperties.addAll(currentStereotype.getOwnedAttributes()) ;
-// filteredProperties.addAll(currentStereotype.getOwnedAttributes()) ;
-// for (Property p : filteredProperties) {
-// if (p.getName() == null ||
-// p.getName().startsWith("base_") ||
-// p.isDerived())
-// visibleProperties.remove(p) ;
-// }
-// }
- Iterable<IEObjectDescription> visiblePropertiesIterable =
- Scopes.scopedElementsFor(visibleProperties) ;
- result = new SimpleScope(visiblePropertiesIterable) ;
-// for (int i = inheritanceStructure.size() - 2 ; i >= 0 ; i--) {
-// visibleProperties = new ArrayList<Property>() ;
-// currentList = inheritanceStructure.get(i) ;
-// filteredProperties = new ArrayList<Property>() ;
-// for (Stereotype currentStereotype : currentList) {
-// visibleProperties.addAll(currentStereotype.getOwnedAttributes()) ;
-// filteredProperties.addAll(currentStereotype.getOwnedAttributes()) ;
-// }
-// for (Property p : filteredProperties) {
-// if (p.getName() == null ||
-// p.getName().startsWith("base_") ||
-// p.isDerived())
-// visibleProperties.remove(p) ;
-// }
-// visiblePropertiesIterable =
-// Scopes.scopedElementsFor(visibleProperties) ;
-// result = new SimpleScope(result, visiblePropertiesIterable) ;
-// }
-// }
-
- return result ;
+
+ // List<List<Stereotype>> inheritanceStructure = new ArrayList<List<Stereotype>>() ;
+ // List<Stereotype> tmpList = new ArrayList<Stereotype>() ;
+ // tmpList.add(stereotype) ;
+ //
+ // do {
+ // inheritanceStructure.add(tmpList) ;
+ // List<Stereotype> localStereotypeList = new ArrayList<Stereotype>() ;
+ // for (Stereotype currentStereotype : tmpList) {
+ // for (Classifier general : currentStereotype.getGenerals()) {
+ // if (general instanceof Stereotype)
+ // localStereotypeList.add((Stereotype)general) ;
+ // }
+ // }
+ // tmpList = new ArrayList<Stereotype>() ;
+ // tmpList.addAll(localStereotypeList) ;
+ // } while (!tmpList.isEmpty());
+ //
+ // // builds the nested scope
+ //
+ // if (! inheritanceStructure.isEmpty()) {
+ // List<Property> visibleProperties = new ArrayList<Property>() ;
+ // List<Property> filteredProperties = new ArrayList<Property>() ;
+ // List<Stereotype> currentList = inheritanceStructure.get(inheritanceStructure.size() - 1) ;
+ // for (Stereotype currentStereotype : currentList) {
+ // visibleProperties.addAll(currentStereotype.getOwnedAttributes()) ;
+ // filteredProperties.addAll(currentStereotype.getOwnedAttributes()) ;
+ // for (Property p : filteredProperties) {
+ // if (p.getName() == null ||
+ // p.getName().startsWith("base_") ||
+ // p.isDerived())
+ // visibleProperties.remove(p) ;
+ // }
+ // }
+ Iterable<IEObjectDescription> visiblePropertiesIterable = Scopes.scopedElementsFor(visibleProperties);
+ result = new SimpleScope(visiblePropertiesIterable);
+ // for (int i = inheritanceStructure.size() - 2 ; i >= 0 ; i--) {
+ // visibleProperties = new ArrayList<Property>() ;
+ // currentList = inheritanceStructure.get(i) ;
+ // filteredProperties = new ArrayList<Property>() ;
+ // for (Stereotype currentStereotype : currentList) {
+ // visibleProperties.addAll(currentStereotype.getOwnedAttributes()) ;
+ // filteredProperties.addAll(currentStereotype.getOwnedAttributes()) ;
+ // }
+ // for (Property p : filteredProperties) {
+ // if (p.getName() == null ||
+ // p.getName().startsWith("base_") ||
+ // p.isDerived())
+ // visibleProperties.remove(p) ;
+ // }
+ // visiblePropertiesIterable =
+ // Scopes.scopedElementsFor(visibleProperties) ;
+ // result = new SimpleScope(result, visiblePropertiesIterable) ;
+ // }
+ // }
+
+ return result;
}
}
diff --git a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/validation/SemanticValidator.java b/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/validation/SemanticValidator.java
deleted file mode 100644
index 01dea043b0f..00000000000
--- a/extraplugins/marte/textedit/org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext/src/org/eclipse/papyrus/marte/textedit/stereotypeapplicationwithvsl/xtext/validation/SemanticValidator.java
+++ /dev/null
@@ -1,31 +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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.marte.textedit.stereotypeapplicationwithvsl.xtext.validation;
-
-import org.eclipse.papyrus.infra.gmfdiag.xtext.glue.edit.part.IXTextSemanticValidator;
-
-/**
- * Custom implementation for IXtextSemanticValidator in the context of the textual editor for stereotype applications
- *
- * @author CEA LIST
- *
- */
-public class SemanticValidator implements IXTextSemanticValidator {
-
- public boolean validate() {
- return StereotypeApplicationWithVSLJavaValidator.validate();
- }
-
-}

Back to the top