Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2015-01-22 17:53:21 +0000
committervincent lorenzo2015-02-04 14:00:53 +0000
commit2e170893a137055c261d2cff671489f49d8ff8b6 (patch)
treebb2f67414d67a392cf0ac346598cef464933fab5
parentc81643fd932df80c31d79056403772856e5b0929 (diff)
downloadorg.eclipse.papyrus-2e170893a137055c261d2cff671489f49d8ff8b6.tar.gz
org.eclipse.papyrus-2e170893a137055c261d2cff671489f49d8ff8b6.tar.xz
org.eclipse.papyrus-2e170893a137055c261d2cff671489f49d8ff8b6.zip
Bug 454040 - [OCL for Papyrus] Track migration of Eclipse OCL to OCL 2.51.1.0_M5
candidate support Change-Id: I67c5bf2113b1420cea18707695568313f9637111 Signed-off-by: Ed Willink <ed@willink.me.uk>
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/META-INF/MANIFEST.MF3
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/build.properties1
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java40
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/Activator.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/adapter/PapyrusSearchAdapterFactory.java6
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/manager/PapyrusSearchTextManager.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchPage.java104
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchResultPage.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java3
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java104
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/validator/ParticipantValidator.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java4
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/oclpivot/AbstractOCLpivotModelConstraint.java29
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/build.properties1
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java30
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java15
21 files changed, 137 insertions, 234 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/META-INF/MANIFEST.MF
index 3687528c432..6fdbfed60ee 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/META-INF/MANIFEST.MF
@@ -3,8 +3,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.uml.commands;bundle-version="1.1.0",
org.eclipse.ui.console;bundle-version="3.5.100",
- org.eclipse.ocl.examples.pivot;bundle-version="3.2.0",
- org.eclipse.ocl.examples.xtext.base;bundle-version="3.2.0",
+ org.eclipse.ocl.pivot.uml;bundle-version="[1.0.0,2.0.0)",
org.eclipse.uml2.uml;bundle-version="5.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/build.properties b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/build.properties
index 653ec3c3daf..3ae128f0806 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/build.properties
+++ b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/build.properties
@@ -6,3 +6,4 @@ bin.includes = META-INF/,\
about.html,\
plugin.properties
src.includes = about.html
+additional.bundles = org.eclipse.ocl.jdt.annotation7
diff --git a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java
index 2a05a007ca5..82159d6fe33 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.oclconstraintevaluation/src/org/eclipse/papyrus/uml/oclconstraintevaluation/OCLEvaluationView.java
@@ -16,13 +16,13 @@ package org.eclipse.papyrus.uml.oclconstraintevaluation;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.ocl.examples.pivot.ExpressionInOCL;
-import org.eclipse.ocl.examples.pivot.OCL;
-import org.eclipse.ocl.examples.pivot.helper.OCLHelper;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironment;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironmentFactory;
-import org.eclipse.ocl.examples.xtext.base.utilities.ElementUtil;
+import org.eclipse.ocl.pivot.ExpressionInOCL;
+import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
+import org.eclipse.ocl.pivot.uml.UMLOCL;
+import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
+import org.eclipse.ocl.pivot.utilities.MetamodelManager;
+import org.eclipse.ocl.pivot.utilities.OCL;
+import org.eclipse.ocl.pivot.utilities.OCLHelper;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -42,7 +42,7 @@ public class OCLEvaluationView extends ViewPart {
*/
public static String ID = "org.eclipse.papyrus.uml.oclconstraintevaluation.OCLEvaluationView";
- protected MetaModelManager metaModelManager = null;
+ protected MetamodelManager metamodelManager = null;
/**
*
@@ -71,15 +71,12 @@ public class OCLEvaluationView extends ViewPart {
* @param contextObject
* @return the metamodelManager
*/
- protected MetaModelManager getMetaModelManager(EObject contextObject) {
- MetaModelManager metaModelManager = ElementUtil.findMetaModelManager(contextObject);
- if (metaModelManager != null) {
- return metaModelManager;
+ protected MetamodelManager getMetamodelManager(EObject contextObject) {
+ EnvironmentFactory environmentFactory = PivotUtilInternal.findEnvironmentFactory(contextObject);
+ if (environmentFactory != null) {
+ return environmentFactory.getMetamodelManager();
}
- if (metaModelManager == null) {
- metaModelManager = new MetaModelManager();
- }
- return metaModelManager;
+ return UMLOCL.newInstance().getMetamodelManager();
}
@@ -94,12 +91,11 @@ public class OCLEvaluationView extends ViewPart {
*/
public void compute(EObject contextObject, String expression) {
// initialize the context of an evaluation of the OCL expression
- MetaModelManager metaModelManager = getMetaModelManager(contextObject);
- PivotEnvironmentFactory envFactory = new PivotEnvironmentFactory(null, metaModelManager);
- PivotEnvironment environment = envFactory.createEnvironment();
- OCL ocl = OCL.newInstance(environment);
- OCLHelper oclHelper = ocl.createOCLHelper(contextObject);
- oclHelper.setContext(contextObject.eClass());
+ MetamodelManager metamodelManager = getMetamodelManager(contextObject);
+ EnvironmentFactory environmentFactory = metamodelManager.getEnvironmentFactory();
+ OCL ocl = OCL.newInstance(environmentFactory);
+ org.eclipse.ocl.pivot.Class contextType = ocl.getContextType(contextObject);
+ OCLHelper oclHelper = ocl.createOCLHelper(contextType);
try {
ExpressionInOCL createQuery = oclHelper.createQuery(expression);
Object evaluate = ocl.evaluate(contextObject, createQuery);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF
index 721c7965afa..23c824ae5d2 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/META-INF/MANIFEST.MF
@@ -23,9 +23,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface,
org.eclipse.emf.transaction,
org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.1.0",
- org.eclipse.ocl.examples.xtext.essentialocl;bundle-version="3.3.0",
- org.eclipse.ocl.examples.xtext.essentialocl.ui;bundle-version="3.3.0",
- org.eclipse.ocl.examples.xtext.console,
+ org.eclipse.ocl.pivot.uml;bundle-version="1.0.0",
+ org.eclipse.ocl.examples.xtext.console;bundle-version="4.0.0",
org.eclipse.ltk.ui.refactoring;bundle-version="3.7.100"
Bundle-Vendor: %vendorName
Bundle-ActivationPolicy: lazy
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/Activator.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/Activator.java
index cff21be53e2..08ee52e79bb 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/Activator.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/Activator.java
@@ -13,7 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.search.ui;
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.internal.EssentialOCLActivator;
+import org.eclipse.ocl.xtext.essentialocl.ui.internal.EssentialOCLActivator;
import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.osgi.framework.BundleContext;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/adapter/PapyrusSearchAdapterFactory.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/adapter/PapyrusSearchAdapterFactory.java
index f64561dccaa..92438f09f0c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/adapter/PapyrusSearchAdapterFactory.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/adapter/PapyrusSearchAdapterFactory.java
@@ -28,14 +28,14 @@ public class PapyrusSearchAdapterFactory implements IAdapterFactory {
// Nothing
}
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public Object getAdapter(Object adaptableObject, @SuppressWarnings("rawtypes") Class adapterType) {
if (adapterType == ISearchPageScoreComputer.class) {
return new PapyrusSearchPageScoreComputer();
}
return null;
}
- public Class[] getAdapterList() {
- return new Class[] { ISearchPageScoreComputer.class };
+ public Class<?>[] getAdapterList() {
+ return new Class<?>[] { ISearchPageScoreComputer.class };
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/manager/PapyrusSearchTextManager.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/manager/PapyrusSearchTextManager.java
index 57fcd5fc467..23c0e85065e 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/manager/PapyrusSearchTextManager.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/manager/PapyrusSearchTextManager.java
@@ -50,7 +50,7 @@ public class PapyrusSearchTextManager {
}
public ISearchQuery manageSimpleSearch(boolean searchAllStrings, Object[] umlMetaClassesArray) {
- if (fQueryText.isEmpty()) {
+ if (fQueryText.length() == 0) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.PapyrusSearchPage_29, Messages.PapyrusSearchPage_30);
return null;
} else {
@@ -69,7 +69,7 @@ public class PapyrusSearchTextManager {
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.PapyrusSearchPage_31, Messages.PapyrusSearchPage_32);
return null;
} else {
- if (fQueryText.isEmpty()) {
+ if (fQueryText.length() == 0) {
for (Object participantChecked : checkedElements) {
if (participantChecked instanceof ParticipantTypeAttribute) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.PapyrusSearchPage_33, Messages.PapyrusSearchPage_34);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchPage.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchPage.java
index 4d389f70ff9..2360da98ba4 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchPage.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchPage.java
@@ -47,24 +47,20 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.ocl.examples.domain.evaluation.DomainModelManager;
-import org.eclipse.ocl.examples.domain.values.Value;
-import org.eclipse.ocl.examples.domain.values.impl.InvalidValueException;
-import org.eclipse.ocl.examples.pivot.ExpressionInOCL;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.context.EObjectContext;
-import org.eclipse.ocl.examples.pivot.context.ParserContext;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManagerListener;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManagerResourceSetAdapter;
-import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
-import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
-import org.eclipse.ocl.examples.xtext.base.utilities.CS2PivotResourceAdapter;
import org.eclipse.ocl.examples.xtext.console.xtfo.EmbeddedXtextEditor;
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.internal.EssentialOCLActivator;
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.model.BaseDocument;
-import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLCSResource;
-import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
+import org.eclipse.ocl.pivot.ExpressionInOCL;
+import org.eclipse.ocl.pivot.internal.context.EObjectContext;
+import org.eclipse.ocl.pivot.resource.CSResource;
+import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
+import org.eclipse.ocl.pivot.utilities.ParserContext;
+import org.eclipse.ocl.pivot.utilities.ParserException;
+import org.eclipse.ocl.pivot.utilities.PivotUtil;
+import org.eclipse.ocl.pivot.values.InvalidValueException;
+import org.eclipse.ocl.pivot.values.Value;
+import org.eclipse.ocl.xtext.base.ui.model.BaseDocument;
+import org.eclipse.ocl.xtext.essentialocl.ui.internal.EssentialOCLActivator;
+import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
+import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLPlugin;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl;
@@ -127,7 +123,6 @@ import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
import org.eclipse.xtext.ui.editor.outline.impl.EObjectNode;
import org.eclipse.xtext.ui.editor.outline.impl.EStructuralFeatureNode;
@@ -140,7 +135,7 @@ import com.google.inject.Injector;
* Papyrus specific search page
*
*/
-public class PapyrusSearchPage extends DialogPage implements ISearchPage, IReplacePage, MetaModelManagerListener {
+public class PapyrusSearchPage extends DialogPage implements ISearchPage, IReplacePage {
private HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>> participantsList = new HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>();
@@ -191,9 +186,7 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
private ParserContext parserContext;
- private MetaModelManager nullMetaModelManager = null;
-
- private DomainModelManager modelManager = null;
+// private ModelManager modelManager = null;
protected Composite textQueryComposite;
@@ -207,7 +200,6 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
-
protected void createSimpleSearchQueryField() {
textQueryComposite = new Composite(queryComposite, SWT.NONE);
@@ -924,7 +916,7 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
EObjectNode selectedObjectNode = (EObjectNode) selectedObject;
selectedObjectNode.getEObjectURI();
contextObject = null; // FIXME
- // metaModelManager.loadResource(eObjectURI,
+ // metamodelManager.loadResource(eObjectURI,
// null, null);
} else if (selectedObject instanceof EStructuralFeatureNode) {
contextObject = null;
@@ -941,16 +933,16 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
contextObject = null;
}
}
- MetaModelManager metaModelManager = getMetaModelManager(contextObject);
- parserContext = new EObjectContext(metaModelManager, null, contextObject);
+ EnvironmentFactory environmentFactory = getEnvironmentFactory();
+ parserContext = new EObjectContext(environmentFactory, null, contextObject);
EssentialOCLCSResource csResource = (EssentialOCLCSResource) resource;
if (csResource != null) {
if (contextObject != null) {
- CS2PivotResourceAdapter.getAdapter(csResource, metaModelManager);
+ csResource.getCS2AS(); // FIXME redundant ??
}
ResourceSet resourceSet = oclEditor.getResourceSet();
if (resourceSet != null) {
- MetaModelManagerResourceSetAdapter.getAdapter(resourceSet, metaModelManager);
+ environmentFactory.adapt(resourceSet); // FIXME redundant ??
}
csResource.setParserContext(parserContext);
}
@@ -961,6 +953,7 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
}
+ @SuppressWarnings("unused")
private Collection<ScopeEntry> createScopeEntries(Collection<URI> scope) {
Collection<ScopeEntry> results = new HashSet<ScopeEntry>();
@@ -975,6 +968,7 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
return results;
}
+ @SuppressWarnings("unused")
private List<ParticipantTypeElement> getParticipantsToEvaluate(HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>> participantsList) {
List<ParticipantTypeElement> participantsToEvaluate = new ArrayList<ParticipantTypeElement>();
@@ -1057,15 +1051,15 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
try {
PivotUtil.checkResourceErrors("", oclEditor.getResource()); //$NON-NLS-1$
- ExpressionInOCL expressionInOCL = parserContext.getExpression((BaseResource) oclEditor.getResource());
- ISearchQuery query = new PapyrusOCLQuery((BaseDocument) oclEditor.getDocument(), parserContext, getMetaModelManager(contextObject), modelManager, contextObject, scopeEntry);
+ @SuppressWarnings("unused") ExpressionInOCL expressionInOCL = parserContext.getExpression((CSResource) oclEditor.getResource());
+ ISearchQuery query = new PapyrusOCLQuery((BaseDocument) oclEditor.getDocument(), parserContext, getEnvironmentFactory(), null, contextObject, scopeEntry);
if (query.canRunInBackground()) {
NewSearchUI.runQueryInBackground(query);
}
} catch (ParserException e) {
- Object value = new InvalidValueException(e, Messages.PapyrusSearchPage_35);
+ @SuppressWarnings("unused") Object value = new InvalidValueException(e, Messages.PapyrusSearchPage_35);
MessageDialog.openError(Display.getCurrent().getActiveShell(), SEARCH_ISSUE, OCL_QUERY_ILLFORMED);
return false;
}
@@ -1172,26 +1166,8 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
}
-
-
-
- public MetaModelManager getMetaModelManager(EObject contextObject) {
- MetaModelManager metaModelManager = contextObject != null ? PivotUtil.findMetaModelManager(contextObject) : null;
- if (metaModelManager != null) {
- return metaModelManager;
- }
- MetaModelManager nullMetaModelManager2 = nullMetaModelManager;
- if (nullMetaModelManager2 == null) {
- nullMetaModelManager2 = nullMetaModelManager = new MetaModelManager();
- nullMetaModelManager2.addListener(this);
- }
- return nullMetaModelManager2;
- }
-
- public void metaModelManagerDisposed(MetaModelManager metaModelManager) {
- metaModelManager.removeListener(this);
- reset();
-
+ protected EnvironmentFactory getEnvironmentFactory() {
+ return oclEditor.getOCL().getEnvironmentFactory();
}
protected void flushEvents() {
@@ -1203,35 +1179,9 @@ public class PapyrusSearchPage extends DialogPage implements ISearchPage, IRepla
public void reset() {
if (oclEditor != null) {
- IXtextDocument document = oclEditor.getDocument();
- MetaModelManager metaModelManager = document.modify(new IUnitOfWork<MetaModelManager, XtextResource>() { // Cancel
-
- // validation
-
- public MetaModelManager exec(XtextResource state) throws Exception {
- if (state == null) {
- return null;
- }
- if (state instanceof BaseResource) {
- ((BaseResource) state).setParserContext(null);
- }
- return PivotUtil.findMetaModelManager(state);
- }
- });
flushEvents();
// editor.close(false);
flushEvents();
- if (metaModelManager != null) {
- metaModelManager.dispose();
- }
- }
- if (modelManager != null) {
- // modelManager.dispose();
- modelManager = null;
- }
- if (nullMetaModelManager != null) {
- nullMetaModelManager.dispose();
- nullMetaModelManager = null;
}
parserContext = null;
contextObject = null;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchResultPage.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchResultPage.java
index 6bca13e899d..79a9a260763 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchResultPage.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/pages/PapyrusSearchResultPage.java
@@ -147,8 +147,9 @@ public class PapyrusSearchResultPage extends AbstractTextSearchViewPage implemen
}
+ @SuppressWarnings("unchecked")
@Override
- protected void evaluateChangedElements(Match[] matches, Set changedElements) {
+ protected void evaluateChangedElements(Match[] matches, @SuppressWarnings("rawtypes") Set changedElements) {
for (int i = 0; i < matches.length; i++) {
changedElements.add(matches[i]);
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java
index cdd1670ed6e..8eb5d48e4a8 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/OCLContextContentProvider.java
@@ -23,7 +23,7 @@ public class OCLContextContentProvider implements ITreeContentProvider {
}
public Object[] getElements(Object inputElement) {
- ArrayList result = new ArrayList();
+ ArrayList<EObject> result = new ArrayList<EObject>();
if (inputElement instanceof ModelSet) {
UmlModel root = (UmlModel) ((ModelSet) inputElement).getModel(UmlModel.MODEL_ID);
try {
@@ -37,7 +37,7 @@ public class OCLContextContentProvider implements ITreeContentProvider {
}
public Object[] getChildren(Object parentElement) {
- ArrayList result = new ArrayList();
+ ArrayList<EObject> result = new ArrayList<EObject>();
if (parentElement instanceof EObject) {
result.addAll(((EObject) parentElement).eContents());
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java
index 04e5480df03..ae72eb05a66 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/providers/ParticipantTypeContentProvider.java
@@ -42,6 +42,7 @@ public class ParticipantTypeContentProvider implements ITreeContentProvider {
}
+ @SuppressWarnings("unchecked")
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
participantsList = (HashMap<ParticipantTypeElement, List<ParticipantTypeAttribute>>) newInput;
}
@@ -52,7 +53,7 @@ public class ParticipantTypeContentProvider implements ITreeContentProvider {
List<Object> result = new ArrayList<Object>();
if (inputElement instanceof HashMap) {
- return ((HashMap) inputElement).keySet().toArray();
+ return ((HashMap<?,?>) inputElement).keySet().toArray();
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
index cb357cdbd1e..05fa2d4af7a 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/query/PapyrusOCLQuery.java
@@ -26,30 +26,26 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.ocl.examples.domain.evaluation.DomainModelManager;
-import org.eclipse.ocl.examples.domain.utilities.DomainUtil;
-import org.eclipse.ocl.examples.domain.values.CollectionValue;
-import org.eclipse.ocl.examples.domain.values.impl.InvalidValueException;
-import org.eclipse.ocl.examples.domain.values.util.ValuesUtil;
-import org.eclipse.ocl.examples.pivot.Environment;
-import org.eclipse.ocl.examples.pivot.EnvironmentFactory;
-import org.eclipse.ocl.examples.pivot.ExpressionInOCL;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.context.ParserContext;
-import org.eclipse.ocl.examples.pivot.evaluation.EvaluationEnvironment;
-import org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitor;
-import org.eclipse.ocl.examples.pivot.evaluation.EvaluationVisitorImpl;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
-import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironment;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironmentFactory;
-import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
import org.eclipse.ocl.examples.xtext.console.messages.ConsoleMessages;
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.model.BaseDocument;
+import org.eclipse.ocl.pivot.ExpressionInOCL;
+import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
+import org.eclipse.ocl.pivot.evaluation.EvaluationVisitor;
+import org.eclipse.ocl.pivot.evaluation.ModelManager;
+import org.eclipse.ocl.pivot.resource.CSResource;
+import org.eclipse.ocl.pivot.utilities.ClassUtil;
+import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
+import org.eclipse.ocl.pivot.utilities.ParserContext;
+import org.eclipse.ocl.pivot.utilities.ParserException;
+import org.eclipse.ocl.pivot.utilities.PivotUtil;
+import org.eclipse.ocl.pivot.utilities.ValueUtil;
+import org.eclipse.ocl.pivot.values.CollectionValue;
+import org.eclipse.ocl.pivot.values.InvalidValueException;
+import org.eclipse.ocl.xtext.base.ui.model.BaseDocument;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.uml.search.ui.Messages;
import org.eclipse.papyrus.uml.search.ui.results.PapyrusSearchResult;
@@ -82,18 +78,18 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
private ParserContext parserContext;
- private MetaModelManager metaModelManager;
+ private EnvironmentFactory environmentFactory;
- private DomainModelManager modelManager;
+ private ModelManager modelManager;
protected Set<AbstractResultEntry> fResults = null;
- public PapyrusOCLQuery(BaseDocument queryEditorDocument, ParserContext parserContext, MetaModelManager metaModelManager, DomainModelManager modelManager, EObject contextObject, ScopeEntry scopeEntry) {
+ public PapyrusOCLQuery(BaseDocument queryEditorDocument, ParserContext parserContext, EnvironmentFactory environmentFactory, ModelManager modelManager, EObject contextObject, ScopeEntry scopeEntry) {
this.queryEditorDocument = queryEditorDocument;
this.contextObject = contextObject;
this.scopeEntry = scopeEntry;
this.parserContext = parserContext;
- this.metaModelManager = metaModelManager;
+ this.environmentFactory = environmentFactory;
this.modelManager = modelManager;
Collection<ScopeEntry> scopeEntries = new ArrayList<ScopeEntry>();
@@ -114,7 +110,7 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
try {
- IDocument doc = queryEditorDocument;
+ @SuppressWarnings("unused") IDocument doc = queryEditorDocument;
final BaseDocument editorDocument = queryEditorDocument;
Object value = null;
@@ -124,8 +120,8 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
public Object exec(XtextResource state) throws Exception {
assert state != null;
- IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
- EvaluationRunnable runnable = new EvaluationRunnable((BaseResource) state, expression);
+ @SuppressWarnings("unused") IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
+ EvaluationRunnable runnable = new EvaluationRunnable((CSResource) state, expression);
runnable.run(new NullProgressMonitor());
// progressService.busyCursorWhile(runnable);
return runnable.getValue();
@@ -142,7 +138,7 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
// MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", cause.getMessage());
}
} else if (value != null) {
- CollectionValue collectionValue = ValuesUtil.isCollectionValue(value);
+ CollectionValue collectionValue = ValueUtil.isCollectionValue(value);
if (collectionValue != null) {
for (Object elementValue : collectionValue.iterable()) {
if (elementValue instanceof EObject) {
@@ -178,13 +174,13 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
private class EvaluationRunnable implements IRunnableWithProgress {
- private final BaseResource resource;
+ private final CSResource resource;
private final String expression;
private Object value = null;
- public EvaluationRunnable(BaseResource resource, String expression) {
+ public EvaluationRunnable(CSResource resource, String expression) {
this.resource = resource;
this.expression = expression;
}
@@ -210,20 +206,20 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
if (expressionInOCL != null) {
// monitor.worked(2);
monitor.subTask(ConsoleMessages.Progress_Extent);
- PivotEnvironmentFactory envFactory = new PivotEnvironmentFactory(null, metaModelManager);
- PivotEnvironment environment = envFactory.createEnvironment();
- EvaluationEnvironment evaluationEnvironment = envFactory.createEvaluationEnvironment();
- Object contextValue = metaModelManager.getIdResolver().boxedValueOf(contextObject);
- evaluationEnvironment.add(DomainUtil.nonNullModel(expressionInOCL.getContextVariable()), contextValue);
- // if (modelManager == null) {
- // let the evaluation environment create one
- DomainModelManager modelManager2 = modelManager = evaluationEnvironment.createModelManager(contextObject);
- // }
+ ModelManager modelManager2 = modelManager;
+ if (modelManager2 == null) {
+ // let the evaluation environment create one
+ modelManager2 = modelManager = environmentFactory.createModelManager(contextObject);
+ }
+ EvaluationEnvironment evaluationEnvironment = environmentFactory.createEvaluationEnvironment(expressionInOCL, modelManager2);
+ Object contextValue = environmentFactory.getIdResolver().boxedValueOf(contextObject);
+ evaluationEnvironment.add(ClassUtil.nonNullModel(expressionInOCL.getOwnedContext()), contextValue);
monitor.worked(2);
monitor.subTask(ConsoleMessages.Progress_Evaluating);
try {
- // metaModelManager.setMonitor(monitor);
- CancelableEvaluationVisitor evaluationVisitor = new CancelableEvaluationVisitor(monitor, environment, evaluationEnvironment, modelManager2);
+ // metamodelManager.setMonitor(monitor);
+ EvaluationVisitor evaluationVisitor = environmentFactory.createEvaluationVisitor(evaluationEnvironment);
+ evaluationVisitor.setMonitor(BasicMonitor.toMonitor(monitor));
// evaluationVisitor.setLogger(new DomainLogger() {
//
// public void append(final @NonNull String message) {
@@ -241,37 +237,13 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
} catch (Exception e) {
value = new InvalidValueException(e, ConsoleMessages.Result_EvaluationFailure);
} finally {
- // metaModelManager.setMonitor(null);
+ // metamodelManager.setMonitor(null);
}
}
monitor.worked(4);
}
}
- /**
- * CancelableEvaluationVisitor refines the EvaluationVisitor to poll the
- * monitor foer cancelation at a variety of significant
- * evaluation events, such as feature vists and {@link #getValueFactory()}.
- */
- protected static class CancelableEvaluationVisitor extends EvaluationVisitorImpl {
-
- private final IProgressMonitor monitor;
-
- protected CancelableEvaluationVisitor(IProgressMonitor monitor, Environment env, EvaluationEnvironment evalEnv, DomainModelManager modelManager) {
- super(env, evalEnv, modelManager);
- this.monitor = monitor;
- }
-
- @Override
- public EvaluationVisitor createNestedEvaluator() {
- EnvironmentFactory factory = environment.getFactory();
- EvaluationEnvironment nestedEvalEnv = factory.createEvaluationEnvironment(evaluationEnvironment);
- CancelableEvaluationVisitor nestedVisitor = new CancelableEvaluationVisitor(monitor, environment, nestedEvalEnv, modelManager);
- nestedVisitor.setLogger(getLogger());
- return nestedVisitor;
- }
- }
-
public IStatus run(IProgressMonitor monitor) throws OperationCanceledException {
results.removeAll();
fResults.clear();
@@ -301,7 +273,7 @@ public class PapyrusOCLQuery extends AbstractPapyrusQuery {
value = value != null ? value : ""; //$NON-NLS-1$
- Matcher m = pattern.matcher(value);
+ @SuppressWarnings("unused") Matcher m = pattern.matcher(value);
// if(isRegularExpression) {
// if(m.matches()) {
diff --git a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/validator/ParticipantValidator.java b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/validator/ParticipantValidator.java
index b3a4804e712..19931b30e3f 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/validator/ParticipantValidator.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.search.ui/src/org/eclipse/papyrus/uml/search/ui/validator/ParticipantValidator.java
@@ -63,7 +63,7 @@ public class ParticipantValidator implements IParticipantValidator {
EObject modelElement = it.next();
// Check that metaclass of this element is a supported metaclass
- EClass e = modelElement.eClass();
+ @SuppressWarnings("unused") EClass e = modelElement.eClass();
if (participantsTypesList.contains(modelElement.eClass())) {
results.add(modelElement);
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
index cecab2d5f90..9c5ceeb9ace 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/META-INF/MANIFEST.MF
@@ -9,8 +9,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.uml2.uml;bundle-version="4.1.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
- org.eclipse.ocl.examples.pivot;bundle-version="3.4.0",
- org.eclipse.ocl;bundle-version="3.4.0"
+ org.eclipse.ocl.pivot;bundle-version="1.0.0",
+ org.eclipse.ocl.pivot.uml;bundle-version="1.0.0"
Bundle-Vendor: %pluginProvider
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.1.0.qualifier
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
index 238caa11a67..702e0c05f1c 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/OCLEValidatorAdapter.java
@@ -21,8 +21,8 @@ import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.validation.model.IConstraintStatus;
-import org.eclipse.ocl.examples.pivot.delegate.OCLDelegateValidator;
-import org.eclipse.ocl.examples.pivot.uml.UMLOCLEValidator;
+import org.eclipse.ocl.pivot.internal.delegate.OCLDelegateValidator;
+import org.eclipse.ocl.pivot.uml.internal.validation.UMLOCLEValidator;
import org.eclipse.papyrus.infra.services.validation.EValidatorAdapter;
import org.eclipse.uml2.uml.InstanceSpecification;
import org.eclipse.uml2.uml.OpaqueAction;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
index 42d1e4c6f04..1fca27047ec 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/UMLDiagnostician.java
@@ -23,7 +23,7 @@ import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.ocl.examples.pivot.delegate.OCLDelegateDomain;
+import org.eclipse.ocl.pivot.internal.delegate.OCLDelegateDomain;
import org.eclipse.papyrus.infra.services.validation.EcoreDiagnostician;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.util.UMLUtil;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/oclpivot/AbstractOCLpivotModelConstraint.java b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/oclpivot/AbstractOCLpivotModelConstraint.java
index 34ec0e76510..e3572d2f4a7 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/oclpivot/AbstractOCLpivotModelConstraint.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.validation/src/org/eclipse/papyrus/uml/service/validation/oclpivot/AbstractOCLpivotModelConstraint.java
@@ -27,14 +27,9 @@ import org.eclipse.emf.validation.IValidationContext;
import org.eclipse.emf.validation.model.ConstraintStatus;
import org.eclipse.emf.validation.model.IModelConstraint;
import org.eclipse.emf.validation.service.IConstraintDescriptor;
-import org.eclipse.ocl.examples.pivot.ExpressionInOCL;
-import org.eclipse.ocl.examples.pivot.NamedElement;
-import org.eclipse.ocl.examples.pivot.OCL;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.Type;
-import org.eclipse.ocl.examples.pivot.helper.OCLHelper;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironmentFactory;
+import org.eclipse.ocl.pivot.ExpressionInOCL;
+import org.eclipse.ocl.pivot.uml.UMLOCL;
+import org.eclipse.ocl.pivot.utilities.ParserException;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.util.UMLUtil;
@@ -59,7 +54,7 @@ public abstract class AbstractOCLpivotModelConstraint implements IModelConstrain
private QueryManager queryManager;
- protected static OCL oclInstance = null;
+ protected static UMLOCL oclInstance = null;
/**
* Initializes me with the <code>descriptor</code> which contains my OCL
@@ -99,22 +94,16 @@ public abstract class AbstractOCLpivotModelConstraint implements IModelConstrain
if (result == null) {
// lazily initialize the condition.
if (oclInstance == null) {
- OCL.initialize(null);
- PivotEnvironmentFactory pef = new PivotEnvironmentFactory(null,
- new MetaModelManager());
- oclInstance = OCL.newInstance(pef);
+ UMLOCL.initialize(null);
+ oclInstance = UMLOCL.newInstance();
}
- OCLHelper oclHelper = oclInstance.createOCLHelper();
-
try {
- NamedElement context =
- oclInstance.getMetaModelManager().getPivotOf(NamedElement.class, umlStereotype);
-
- oclHelper.setContext((Type) context);
+ org.eclipse.ocl.pivot.Class context =
+ oclInstance.getMetamodelManager().getASOf(org.eclipse.ocl.pivot.Class.class, umlStereotype);
String expression = getDescriptor().getBody();
- result = oclHelper.createQuery(expression);
+ result = oclInstance.createQuery(context, expression);
} catch (ParserException parserException) {
throw new WrappedException(parserException);
}
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
index 0e70ec8973b..12cad2d433d 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/META-INF/MANIFEST.MF
@@ -3,9 +3,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.1.0",
org.eclipse.uml2.uml;bundle-version="3.2.0",
- org.eclipse.ocl.examples.xtext.essentialocl.ui;bundle-version="3.1.0",
org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.ocl.examples.xtext.console;bundle-version="3.2.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.1.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.1.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.1.0",
@@ -13,7 +11,8 @@ Require-Bundle: org.eclipse.ui,
org.apache.log4j;bundle-version="1.2.15",
org.eclipse.papyrus.uml.xtext.integration.ui;bundle-version="1.1.0",
org.eclipse.papyrus.infra.services.validation;bundle-version="1.1.0",
- org.eclipse.papyrus.uml.service.validation;bundle-version="1.1.0"
+ org.eclipse.papyrus.uml.service.validation;bundle-version="1.1.0",
+ org.eclipse.ocl.pivot.ui;bundle-version="1.0.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.1.0.qualifier
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/build.properties b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/build.properties
index 2ba50d93cb5..199d8472939 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/build.properties
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/build.properties
@@ -10,3 +10,4 @@ output..=bin/
src.includes = about.html
source..=src/
bin..=bin/
+additional.bundles = org.eclipse.ocl.jdt.annotation7
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
index c1174bcd295..b8430c2144b 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/EssentialOCLEditorConfiguration.java
@@ -36,10 +36,10 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.utilities.BaseResource;
-import org.eclipse.ocl.examples.pivot.utilities.PivotUtil;
-import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
+import org.eclipse.ocl.pivot.resource.CSResource;
+import org.eclipse.ocl.pivot.ui.OCLUI;
+import org.eclipse.ocl.pivot.utilities.PivotConstants;
+import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand;
import org.eclipse.papyrus.infra.services.validation.commands.AsyncValidateSubtreeCommand;
@@ -68,8 +68,6 @@ import com.google.inject.Injector;
public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorConfiguration {
// org.eclipse.papyrus.infra.gmfdiag.xtext.glue.PopupEditorConfiguration {
- private static final String OCL = "OCL"; //$NON-NLS-1$
-
@Inject
protected XtextResource fakeResource;
@@ -122,13 +120,13 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
} else {
opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression) constraint.getSpecification();
for (int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
- if (opaqueExpression.getLanguages().get(i).equals(OCL)) {
+ if (opaqueExpression.getLanguages().get(i).equals(PivotConstants.OCL_LANGUAGE)) {
indexOfOCLBody = i;
}
}
}
if (indexOfOCLBody == -1) {
- opaqueExpression.getLanguages().add(OCL);
+ opaqueExpression.getLanguages().add(PivotConstants.OCL_LANGUAGE);
opaqueExpression.getBodies().add(newTextualRepresentation);
} else {
opaqueExpression.getBodies().set(indexOfOCLBody, newTextualRepresentation);
@@ -159,12 +157,12 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
int indexOfOCLBody = -1;
for (int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
- if (opaqueExpression.getLanguages().get(i).equals(OCL)) {
+ if (opaqueExpression.getLanguages().get(i).equals(PivotConstants.OCL_LANGUAGE)) {
indexOfOCLBody = i;
}
}
if (indexOfOCLBody == -1) {
- opaqueExpression.getLanguages().add(OCL);
+ opaqueExpression.getLanguages().add(PivotConstants.OCL_LANGUAGE);
opaqueExpression.getBodies().add(newTextualRepresentation);
} else if (indexOfOCLBody < opaqueExpression.getBodies().size()) { // might not be true, if body list is not synchronized with language list
opaqueExpression.getBodies().set(indexOfOCLBody, newTextualRepresentation);
@@ -194,7 +192,7 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
int indexOfOCLBody = -1;
org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression) specification;
for (int i = 0; i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1; i++) {
- if (opaqueExpression.getLanguages().get(i).equals(OCL)) {
+ if (opaqueExpression.getLanguages().get(i).equals(PivotConstants.OCL_LANGUAGE)) {
if (i < opaqueExpression.getBodies().size()) {
value += opaqueExpression.getBodies().get(i);
}
@@ -232,10 +230,8 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
public void initResource(XtextResource resource) {
try {
- if (resource instanceof BaseResource) {
- PivotUtil.setParserContext((BaseResource) resource, getEditObject());
- }
- } catch (ParserException e) {
+ PivotUtil.setParserContext((CSResource)resource, getEditObject());
+ } catch (Exception e) {
}
}
};
@@ -243,7 +239,7 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
@Override
public Injector getInjector() {
- return UMLConstraintEditorActivator.getInstance().getInjector(EssentialOCLRuntimeModule.LANGUAGE_ID);
+ return UMLConstraintEditorActivator.getInstance().getInjector(OCLUI.ESSENTIAL_OCL_LANGUAGE_ID);
}
@Override
@@ -304,7 +300,7 @@ public class EssentialOCLEditorConfiguration extends DefaultXtextDirectEditorCon
return null;
}
- public List getSemanticElementsBeingParsed(EObject element) {
+ public List<EObject> getSemanticElementsBeingParsed(EObject element) {
// Add specification to list.
List<EObject> list = new BasicEList<EObject>();
if (element instanceof Constraint) {
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java
index d40d0493172..06bf29f7a86 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.constraintwithessentialocl.xtext/src/org/eclipse/papyrus/uml/textedit/constraintwithessentialocl/xtext/UMLConstraintEditorActivator.java
@@ -7,8 +7,7 @@ import java.util.Collections;
import java.util.Map;
import org.apache.log4j.Logger;
-import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
-import org.eclipse.ocl.examples.xtext.essentialocl.ui.EssentialOCLUiModule;
+import org.eclipse.ocl.pivot.ui.OCLUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.ui.shared.SharedStateModule;
import org.eclipse.xtext.util.Modules2;
@@ -73,18 +72,18 @@ public class UMLConstraintEditorActivator extends AbstractUIPlugin {
}
protected Module getRuntimeModule(String grammar) {
- if (EssentialOCLRuntimeModule.LANGUAGE_ID.equals(grammar)) {
- return new EssentialOCLRuntimeModule();
+ Module module = OCLUI.getRuntimeModule(grammar);
+ if (module != null) {
+ return module;
}
-
throw new IllegalArgumentException(grammar);
}
protected Module getUiModule(String grammar) {
- if (EssentialOCLRuntimeModule.LANGUAGE_ID.equals(grammar)) {
- return new EssentialOCLUiModule(this);
+ Module module = OCLUI.getUiModule(this, grammar);
+ if (module != null) {
+ return module;
}
-
throw new IllegalArgumentException(grammar);
}

Back to the top