Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-03-19 15:22:38 +0000
committercletavernie2012-03-19 15:22:38 +0000
commit99fb29bf32e877cf89092facf46e1e46b07689ca (patch)
treec6327538bf39dc7a292ef14b58845c79b89c14ca /deprecated
parent9f7c21a9191f2489a1c76abd186d773019a7af40 (diff)
downloadorg.eclipse.papyrus-99fb29bf32e877cf89092facf46e1e46b07689ca.tar.gz
org.eclipse.papyrus-99fb29bf32e877cf89092facf46e1e46b07689ca.tar.xz
org.eclipse.papyrus-99fb29bf32e877cf89092facf46e1e46b07689ca.zip
359058: [Refactoring - Architecture] Identify the layers and sub-layers for the Papyrus architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359058 Move the duplicate plug-in to deprecated. See uml.textedit.constraintwithessentialocl.editor.xtext
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/META-INF/MANIFEST.MF23
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/icons/OCLModelFile.gifbin0 -> 558 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/plugin.xml17
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPartialModelEditor.java52
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java209
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupPlugin.java70
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupRuntimeModule.java25
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupUiModule.java29
-rw-r--r--deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/IXtextEMFReconciler2.java24
14 files changed, 531 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.classpath b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.project b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.project
new file mode 100644
index 00000000000..58744a0a5c3
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.constraintwithessentialocl.editor.xtext</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..6b0e4a20312
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Wed May 18 14:49:57 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2d6f47c1488
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.extensionpoints.editors;bundle-version="0.9.0",
+ org.eclipse.xtext.gmf.glue,
+ com.google.inject;bundle-version="2.0.0",
+ org.eclipse.uml2.uml;bundle-version="3.2.0",
+ org.eclipse.ocl.examples.xtext.essentialocl.ui;bundle-version="3.1.0",
+ org.eclipse.gef;bundle-version="3.7.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.properties.runtime;bundle-version="0.9.0",
+ org.eclipse.papyrus.core;bundle-version="0.9.0",
+ org.eclipse.core.expressions
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.9.0.qualifier
+Bundle-Name: Papyrus
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.ocl.examples.xtext.papyrus.EssentialOCLP
+ opupPlugin
+Bundle-SymbolicName: org.eclipse.papyrus.constraintwithessentialocl.ed
+ itor.xtext;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/about.html b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/build.properties b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/build.properties
new file mode 100644
index 00000000000..4b9cf3663a1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/build.properties
@@ -0,0 +1,7 @@
+#
+#Thu Sep 15 16:42:18 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,about.html
+output..=bin/
+src.includes=META-INF/,.,plugin.xml,about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/icons/OCLModelFile.gif b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/icons/OCLModelFile.gif
new file mode 100644
index 00000000000..2945103032e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/icons/OCLModelFile.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/plugin.xml b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/plugin.xml
new file mode 100644
index 00000000000..2db8823f50f
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/plugin.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.extensionpoints.editors.DirectEditor">
+ <DirectEditor
+ contributor="Eclipse Modeling Project"
+ icon="icons/OCLModelFile.gif"
+ language="Essential OCL constraint editor"
+ objectToEdit="org.eclipse.uml2.uml.Constraint">
+ <popupeditor
+ editorConfiguration="org.eclipse.ocl.examples.xtext.papyrus.EssentialOCLPopupEditorConfiguration">
+ </popupeditor>
+ </DirectEditor>
+ </extension>s
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPartialModelEditor.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPartialModelEditor.java
new file mode 100644
index 00000000000..2ffe27451b5
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPartialModelEditor.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ * CEA LIST - Architecture refactoring
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+import java.util.Collections;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.xtext.gmf.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.xtext.gmf.glue.partialEditing.ISyntheticResourceProvider;
+import org.eclipse.xtext.gmf.glue.partialEditing.PartialModelEditor;
+import org.eclipse.xtext.resource.XtextResource;
+import org.eclipse.xtext.util.StringInputStream;
+
+public class EssentialOCLPartialModelEditor extends PartialModelEditor {
+
+ public EssentialOCLPartialModelEditor(SourceViewer viewer,
+ ISyntheticResourceProvider resourceProvider,
+ boolean insertLineBreaks,
+ EObject semanticElement,
+ IXtextEMFReconciler modelReconciler) {
+ super(viewer, resourceProvider, insertLineBreaks, semanticElement, modelReconciler);
+ }
+
+ @Override
+ public XtextResource createResource(String content) {
+ XtextResource result = resourceProvider.createResource();
+ if (modelReconciler instanceof IXtextEMFReconciler2) {
+ ((IXtextEMFReconciler2)modelReconciler).configureResource(result, semanticElement);
+ }
+ try {
+ result.load(new StringInputStream(content, result.getEncoding()), Collections.emptyMap());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return result;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java
new file mode 100644
index 00000000000..3b9f599bc63
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupEditorConfiguration.java
@@ -0,0 +1,209 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ * CEA LIST - Architecture refactoring
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+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.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.ocl.examples.pivot.evaluation.EvaluationContext;
+import org.eclipse.ocl.examples.pivot.uml.UML2Ecore2Pivot;
+import org.eclipse.ocl.examples.pivot.utilities.TypeManager;
+import org.eclipse.ocl.examples.pivot.utilities.TypeManagerResourceAdapter;
+import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
+import org.eclipse.uml2.uml.Constraint;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.xtext.gmf.glue.edit.part.DefaultXtextSemanticValidator;
+import org.eclipse.xtext.gmf.glue.edit.part.IXTextSemanticValidator;
+import org.eclipse.xtext.gmf.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.xtext.gmf.glue.edit.part.PopupXtextEditorHelper;
+import org.eclipse.xtext.gmf.glue.partialEditing.SourceViewerHandle;
+import org.eclipse.xtext.resource.XtextResource;
+
+import com.google.inject.Injector;
+
+public class EssentialOCLPopupEditorConfiguration extends org.eclipse.xtext.gmf.glue.PopupEditorConfiguration
+{
+ public class Reconciler implements IXtextEMFReconciler2
+ {
+ public void configureResource(XtextResource resource, EObject umlObject) {
+ if (resource instanceof EvaluationContext) {
+ TypeManagerResourceAdapter.getAdapter(resource, typeManager);
+ org.eclipse.ocl.examples.pivot.Element pivotElement = getPivotModel(umlObject);
+ if (pivotElement instanceof org.eclipse.ocl.examples.pivot.NamedElement) {
+ ((EvaluationContext)resource).setContext((org.eclipse.ocl.examples.pivot.NamedElement)pivotElement, null);
+ }
+ }
+ }
+
+ public void reconcile(EObject modelObject, EObject xtextObject) {
+ if (!(modelObject instanceof org.eclipse.uml2.uml.Constraint)) {
+ return;
+ }
+ String newTextualRepresentation = editorHelper.getSourceViewerHandle().getDocument().get() ;
+ //
+ // Creates and executes the update command
+ //
+ UpdateConstraintCommand updateCommand = new UpdateConstraintCommand((org.eclipse.uml2.uml.Constraint)modelObject, newTextualRepresentation);
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(updateCommand, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ /* [AC] TODO AC => check why LogHelper is not visible
+ * org.eclipse.papyrus.properties.runtime.Activator.log.error(e);
+ */
+ e.printStackTrace() ;
+ }
+ //
+ }
+ }
+
+ protected class UpdateConstraintCommand extends AbstractTransactionalCommand
+ {
+ protected final org.eclipse.uml2.uml.Constraint constraint;
+ protected final String newTextualRepresentation;
+
+ public UpdateConstraintCommand(org.eclipse.uml2.uml.Constraint constraint, String newTextualRepresentation) {
+ super(EditorUtils.getTransactionalEditingDomain(), "Constraint Update", getWorkspaceFiles(constraint));
+ this.constraint = constraint;
+ this.newTextualRepresentation = newTextualRepresentation;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor arg0, IAdaptable arg1) throws ExecutionException {
+ org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = null ;
+ int indexOfOCLBody = -1 ;
+ if (constraint.getSpecification() == null || !(constraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression))
+ opaqueExpression = UMLFactory.eINSTANCE.createOpaqueExpression() ;
+ 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"))
+ indexOfOCLBody = i ;
+ }
+ }
+ if (indexOfOCLBody == -1) {
+ opaqueExpression.getLanguages().add("OCL") ;
+ opaqueExpression.getBodies().add(newTextualRepresentation) ;
+ }
+ else {
+ opaqueExpression.getBodies().remove(indexOfOCLBody) ;
+ opaqueExpression.getBodies().add(indexOfOCLBody, newTextualRepresentation) ;
+ }
+ constraint.setSpecification(opaqueExpression) ;
+ return CommandResult.newOKCommandResult(constraint);
+ }
+ }
+
+ protected PopupXtextEditorHelper editorHelper = null ;
+ private TypeManager typeManager = null;
+
+ public EssentialOCLPopupEditorConfiguration() {}
+
+ @Override
+ public IPopupEditorHelper createPopupEditorHelper(Object editPart) {
+ if (!(editPart instanceof IGraphicalEditPart)) {
+ return null;
+ }
+ IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart)editPart;
+ Object model = graphicalEditPart.getModel();
+ if (model == null) {
+ return null;
+ }
+ if (!(model instanceof View)) {
+ return null;
+ }
+ View view = (View) model;
+ EObject element = view.getElement();
+ if (element == null) {
+ return null;
+ }
+ if (!(element instanceof org.eclipse.uml2.uml.Constraint)) {
+ return null;
+ }
+ org.eclipse.uml2.uml.Constraint constraint = (org.eclipse.uml2.uml.Constraint) element;
+ org.eclipse.uml2.uml.ValueSpecification specification = constraint.getSpecification();
+ if (specification == null) {
+ return null;
+ }
+ if (!(specification instanceof org.eclipse.uml2.uml.LiteralString || specification instanceof org.eclipse.uml2.uml.OpaqueExpression)) {
+ return null;
+ }
+ getPivotModel(constraint);
+ Injector xtextInjector = EssentialOCLPopupPlugin.getInstance().getInjector(EssentialOCLPlugin.LANGUAGE_ID);
+ IXtextEMFReconciler modelReconciler = new Reconciler();
+ String textToEdit = getTextToEdit(element);
+ String fileExtension = "essentialocl";
+ IXTextSemanticValidator semanticValidator = new DefaultXtextSemanticValidator();
+ SourceViewerHandle.bindPartialModelEditorClass(EssentialOCLPartialModelEditor.class) ;
+ editorHelper = (PopupXtextEditorHelper)super.createPopupEditorHelper(graphicalEditPart, xtextInjector, modelReconciler, textToEdit, fileExtension, semanticValidator);
+ return editorHelper ;
+ }
+
+ protected org.eclipse.ocl.examples.pivot.Element getPivotModel(EObject umlObject) {
+ if (!(umlObject instanceof org.eclipse.uml2.uml.Constraint)) {
+ return null;
+ }
+ Resource umlResource = umlObject.eResource();
+ if (umlResource == null) {
+ return null;
+ }
+ if (typeManager == null) {
+ typeManager = new TypeManager();
+ }
+ UML2Ecore2Pivot adapter = UML2Ecore2Pivot.getAdapter(umlResource, typeManager);
+ adapter.getPivotRoot();
+ org.eclipse.uml2.uml.Namespace umlContainer = ((org.eclipse.uml2.uml.Constraint)umlObject).getContext();
+ if (umlContainer instanceof org.eclipse.uml2.uml.Operation) {
+ umlContainer = ((org.eclipse.uml2.uml.Operation)umlObject).getNamespace();
+ }
+ return adapter.getCreated(org.eclipse.ocl.examples.pivot.Element.class, umlContainer);
+ }
+
+ @Override
+ public String getTextToEdit(Object editedObject) {
+ Constraint umlConstraint = (Constraint)editedObject ;
+ String value = "" ;
+ if (umlConstraint.getSpecification() != null) {
+ if (umlConstraint.getSpecification() instanceof LiteralString) {
+ if (((LiteralString)umlConstraint.getSpecification()).getValue() != null)
+ value += ((LiteralString)umlConstraint.getSpecification()).getValue() ;
+ }
+ else if (umlConstraint.getSpecification() instanceof org.eclipse.uml2.uml.OpaqueExpression) {
+ int indexOfOCLBody = -1 ;
+ org.eclipse.uml2.uml.OpaqueExpression opaqueExpression = (org.eclipse.uml2.uml.OpaqueExpression)umlConstraint.getSpecification() ;
+ for (int i = 0 ;
+ i < opaqueExpression.getLanguages().size() && indexOfOCLBody == -1 ;
+ i ++) {
+ if (opaqueExpression.getLanguages().get(i).equals("OCL")) {
+ value += opaqueExpression.getBodies().get(i) ;
+ indexOfOCLBody = i ;
+ }
+ }
+ }
+ }
+ return value;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupPlugin.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupPlugin.java
new file mode 100644
index 00000000000..e6a5e8f0dc6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupPlugin.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ * CEA LIST - Architecture refactoring
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+import org.eclipse.ocl.examples.xtext.essentialocl.ui.internal.EssentialOCLActivator;
+import org.eclipse.ocl.examples.xtext.essentialocl.utilities.EssentialOCLPlugin;
+
+import com.google.inject.Module;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class EssentialOCLPopupPlugin extends EssentialOCLActivator
+{
+ // The shared instance.
+ private static EssentialOCLPopupPlugin plugin;
+
+ /**
+ * Returns the shared instance.
+ */
+ public static EssentialOCLPopupPlugin getInstance() {
+ return plugin;
+ }
+
+ /**
+ * Obtains my plug-in ID.
+ *
+ * @return my plug-in ID
+ */
+ public static String getPluginId() {
+ return getInstance().getBundle().getSymbolicName();
+ }
+
+ /**
+ * The constructor.
+ */
+ public EssentialOCLPopupPlugin() {
+ super();
+ plugin = this;
+ }
+
+ protected Module getRuntimeModule(String grammar) {
+ if (EssentialOCLPlugin.LANGUAGE_ID.equals(grammar)) {
+ return new EssentialOCLPopupRuntimeModule();
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+
+ protected Module getUiModule(String grammar) {
+ if (EssentialOCLPlugin.LANGUAGE_ID.equals(grammar)) {
+ return new EssentialOCLPopupUiModule(this);
+ }
+
+ throw new IllegalArgumentException(grammar);
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupRuntimeModule.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupRuntimeModule.java
new file mode 100644
index 00000000000..a6140a009e9
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupRuntimeModule.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+import org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCLRuntimeModule;
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class EssentialOCLPopupRuntimeModule extends EssentialOCLRuntimeModule
+{
+
+}
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupUiModule.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupUiModule.java
new file mode 100644
index 00000000000..ec90a08abd0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/EssentialOCLPopupUiModule.java
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+import org.eclipse.ocl.examples.xtext.essentialocl.ui.EssentialOCLUiModule;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class EssentialOCLPopupUiModule extends EssentialOCLUiModule
+{
+ public EssentialOCLPopupUiModule(AbstractUIPlugin plugin) {
+ super(plugin);
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/IXtextEMFReconciler2.java b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/IXtextEMFReconciler2.java
new file mode 100644
index 00000000000..8ffc92baecb
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.constraintwithessentialocl.editor.xtext/src/org/eclipse/ocl/examples/xtext/papyrus/IXtextEMFReconciler2.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * E.D.Willink - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.ocl.examples.xtext.papyrus;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.gmf.glue.edit.part.IXtextEMFReconciler;
+import org.eclipse.xtext.resource.XtextResource;
+
+public interface IXtextEMFReconciler2 extends IXtextEMFReconciler
+{
+ void configureResource(XtextResource result, EObject semanticElement);
+}

Back to the top