diff options
author | vlorenzo | 2012-02-20 15:27:03 +0000 |
---|---|---|
committer | vlorenzo | 2012-02-20 15:27:03 +0000 |
commit | 7e261b421b63b9800379f0fc13ac9c957b598651 (patch) | |
tree | f785203fb3f6ea8053b07ddd1402a82dc68de74e | |
parent | 134f9e43368e057363cc8e082998e96959a499b1 (diff) | |
download | org.eclipse.papyrus-7e261b421b63b9800379f0fc13ac9c957b598651.tar.gz org.eclipse.papyrus-7e261b421b63b9800379f0fc13ac9c957b598651.tar.xz org.eclipse.papyrus-7e261b421b63b9800379f0fc13ac9c957b598651.zip |
372031: [Documentation][Developper] The creation of nested Editor should be documented
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372031
32 files changed, 2393 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/.classpath b/incoming/org.eclipse.papyrus.example.text.instance/.classpath new file mode 100644 index 00000000000..45f024e850e --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <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="output" path="bin"/>
+</classpath>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/.project b/incoming/org.eclipse.papyrus.example.text.instance/.project new file mode 100644 index 00000000000..1f1bbbf348a --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.example.text.instance</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..0bac0a45882 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.example.text.instance;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.example.test.instance.papyrustextinstance,
+ org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl,
+ org.eclipse.papyrus.example.test.instance.papyrustextinstance.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/about.html b/incoming/org.eclipse.papyrus.example.text.instance/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/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 ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/incoming/org.eclipse.papyrus.example.text.instance/build.properties b/incoming/org.eclipse.papyrus.example.text.instance/build.properties new file mode 100644 index 00000000000..6672f2400bf --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/build.properties @@ -0,0 +1,23 @@ +# Copyright (c) 2012 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:
+# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+#
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ about.html,\
+ plugin.pdoc,\
+ plugin.properties,\
+ build.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore b/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore new file mode 100644 index 00000000000..1efefbcdd3e --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.ecore @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="papyrustextinstance" nsURI="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"
+ nsPrefix="papyrustextinstance">
+ <eClassifiers xsi:type="ecore:EClass" name="PapyrusTextInstance" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="editedObject" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel b/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel new file mode 100644 index 00000000000..02d981047ff --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/model/papyrustextinstance.genmodel @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2012 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:
 Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
"
+ modelDirectory="/org.eclipse.papyrus.example.text.instance/src" modelPluginID="org.eclipse.papyrus.example.text.instance"
+ modelName="Papyrustextinstance" importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0"
+ copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ <foreignModel>papyrustextinstance.ecore</foreignModel>
+ <genPackages prefix="Papyrustextinstance" basePackage="org.eclipse.papyrus.example.test.instance"
+ disposableProviderFactory="true" ecorePackage="papyrustextinstance.ecore#/">
+ <genClasses ecoreClass="papyrustextinstance.ecore#//PapyrusTextInstance">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference papyrustextinstance.ecore#//PapyrusTextInstance/editedObject"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/type"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrustextinstance.ecore#//PapyrusTextInstance/name"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/plugin.pdoc b/incoming/org.eclipse.papyrus.example.text.instance/plugin.pdoc new file mode 100644 index 00000000000..e59da2f931a --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/plugin.pdoc @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides the content model for the papyrus text editor">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/plugin.properties b/incoming/org.eclipse.papyrus.example.text.instance/plugin.properties new file mode 100644 index 00000000000..fa4bae9bc58 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/plugin.properties @@ -0,0 +1,13 @@ +# Copyright (c) 2012 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:
+# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+#
+
+pluginName = Papyrus Text Editor Example (Incubation)
+providerName = Eclipse Modeling Project
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/plugin.xml b/incoming/org.eclipse.papyrus.example.text.instance/plugin.xml new file mode 100644 index 00000000000..42c33afe106 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/plugin.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ Copyright (c) 2012 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:
+ Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance"
+ class="org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage"
+ genModel="model/papyrustextinstance.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrusTextInstance.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrusTextInstance.java new file mode 100644 index 00000000000..050038b7169 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrusTextInstance.java @@ -0,0 +1,115 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Papyrus Text Instance</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}</li>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance()
+ * @model
+ * @generated
+ */
+public interface PapyrusTextInstance extends EModelElement {
+ /**
+ * Returns the value of the '<em><b>Edited Object</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Edited Object</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Edited Object</em>' reference.
+ * @see #setEditedObject(EObject)
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_EditedObject()
+ * @model
+ * @generated
+ */
+ EObject getEditedObject();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Edited Object</em>' reference.
+ * @see #getEditedObject()
+ * @generated
+ */
+ void setEditedObject(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see #setType(String)
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Type()
+ * @model
+ * @generated
+ */
+ String getType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see #getType()
+ * @generated
+ */
+ void setType(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage#getPapyrusTextInstance_Name()
+ * @model
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // PapyrusTextInstance
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstanceFactory.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstanceFactory.java new file mode 100644 index 00000000000..f0acec03b0a --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstanceFactory.java @@ -0,0 +1,52 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage
+ * @generated
+ */
+public interface PapyrustextinstanceFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ PapyrustextinstanceFactory eINSTANCE = org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrustextinstanceFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Papyrus Text Instance</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Papyrus Text Instance</em>'.
+ * @generated
+ */
+ PapyrusTextInstance createPapyrusTextInstance();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ PapyrustextinstancePackage getPapyrustextinstancePackage();
+
+} //PapyrustextinstanceFactory
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstancePackage.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstancePackage.java new file mode 100644 index 00000000000..6e238307c56 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/PapyrustextinstancePackage.java @@ -0,0 +1,226 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstanceFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface PapyrustextinstancePackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "papyrustextinstance";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "papyrustextinstance";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ PapyrustextinstancePackage eINSTANCE = org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance()
+ * @generated
+ */
+ int PAPYRUS_TEXT_INSTANCE = 0;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_TEXT_INSTANCE__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Edited Object</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_TEXT_INSTANCE__TYPE = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_TEXT_INSTANCE__NAME = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Papyrus Text Instance</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_TEXT_INSTANCE_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Papyrus Text Instance</em>'.
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance
+ * @generated
+ */
+ EClass getPapyrusTextInstance();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject <em>Edited Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Edited Object</em>'.
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getEditedObject()
+ * @see #getPapyrusTextInstance()
+ * @generated
+ */
+ EReference getPapyrusTextInstance_EditedObject();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getType <em>Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Type</em>'.
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getType()
+ * @see #getPapyrusTextInstance()
+ * @generated
+ */
+ EAttribute getPapyrusTextInstance_Type();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance#getName()
+ * @see #getPapyrusTextInstance()
+ * @generated
+ */
+ EAttribute getPapyrusTextInstance_Name();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ PapyrustextinstanceFactory getPapyrustextinstanceFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl <em>Papyrus Text Instance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrustextinstancePackageImpl#getPapyrusTextInstance()
+ * @generated
+ */
+ EClass PAPYRUS_TEXT_INSTANCE = eINSTANCE.getPapyrusTextInstance();
+
+ /**
+ * The meta object literal for the '<em><b>Edited Object</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT = eINSTANCE.getPapyrusTextInstance_EditedObject();
+
+ /**
+ * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PAPYRUS_TEXT_INSTANCE__TYPE = eINSTANCE.getPapyrusTextInstance_Type();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PAPYRUS_TEXT_INSTANCE__NAME = eINSTANCE.getPapyrusTextInstance_Name();
+
+ }
+
+} //PapyrustextinstancePackage
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java new file mode 100644 index 00000000000..0a4d5b01ef9 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrusTextInstanceImpl.java @@ -0,0 +1,289 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.EModelElementImpl;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Papyrus Text Instance</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getEditedObject <em>Edited Object</em>}</li>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl.PapyrusTextInstanceImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class PapyrusTextInstanceImpl extends EModelElementImpl implements PapyrusTextInstance {
+ /**
+ * The cached value of the '{@link #getEditedObject() <em>Edited Object</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEditedObject()
+ * @generated
+ * @ordered
+ */
+ protected EObject editedObject;
+
+ /**
+ * The default value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected String type = TYPE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PapyrusTextInstanceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return PapyrustextinstancePackage.Literals.PAPYRUS_TEXT_INSTANCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getEditedObject() {
+ if (editedObject != null && editedObject.eIsProxy()) {
+ InternalEObject oldEditedObject = (InternalEObject)editedObject;
+ editedObject = eResolveProxy(oldEditedObject);
+ if (editedObject != oldEditedObject) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject));
+ }
+ }
+ return editedObject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetEditedObject() {
+ return editedObject;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setEditedObject(EObject newEditedObject) {
+ EObject oldEditedObject = editedObject;
+ editedObject = newEditedObject;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT, oldEditedObject, editedObject));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setType(String newType) {
+ String oldType = type;
+ type = newType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE, oldType, type));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
+ if (resolve) return getEditedObject();
+ return basicGetEditedObject();
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
+ return getType();
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
+ setEditedObject((EObject)newValue);
+ return;
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
+ setType((String)newValue);
+ return;
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
+ setEditedObject((EObject)null);
+ return;
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
+ setType(TYPE_EDEFAULT);
+ return;
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT:
+ return editedObject != null;
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__TYPE:
+ return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (type: ");
+ result.append(type);
+ result.append(", name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} //PapyrusTextInstanceImpl
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java new file mode 100644 index 00000000000..c4db400e40d --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstanceFactoryImpl.java @@ -0,0 +1,105 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class PapyrustextinstanceFactoryImpl extends EFactoryImpl implements PapyrustextinstanceFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static PapyrustextinstanceFactory init() {
+ try {
+ PapyrustextinstanceFactory thePapyrustextinstanceFactory = (PapyrustextinstanceFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/Papyrus/Example/0.9.0/papyrustextinstance");
+ if (thePapyrustextinstanceFactory != null) {
+ return thePapyrustextinstanceFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new PapyrustextinstanceFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrustextinstanceFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: return createPapyrusTextInstance();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusTextInstance createPapyrusTextInstance() {
+ PapyrusTextInstanceImpl papyrusTextInstance = new PapyrusTextInstanceImpl();
+ return papyrusTextInstance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrustextinstancePackage getPapyrustextinstancePackage() {
+ return (PapyrustextinstancePackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static PapyrustextinstancePackage getPackage() {
+ return PapyrustextinstancePackage.eINSTANCE;
+ }
+
+} //PapyrustextinstanceFactoryImpl
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java new file mode 100644 index 00000000000..e6dccc76e0f --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/impl/PapyrustextinstancePackageImpl.java @@ -0,0 +1,218 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstanceFactory;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class PapyrustextinstancePackageImpl extends EPackageImpl implements PapyrustextinstancePackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass papyrusTextInstanceEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private PapyrustextinstancePackageImpl() {
+ super(eNS_URI, PapyrustextinstanceFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link PapyrustextinstancePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static PapyrustextinstancePackage init() {
+ if (isInited) return (PapyrustextinstancePackage)EPackage.Registry.INSTANCE.getEPackage(PapyrustextinstancePackage.eNS_URI);
+
+ // Obtain or create and register package
+ PapyrustextinstancePackageImpl thePapyrustextinstancePackage = (PapyrustextinstancePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PapyrustextinstancePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PapyrustextinstancePackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ thePapyrustextinstancePackage.createPackageContents();
+
+ // Initialize created meta-data
+ thePapyrustextinstancePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ thePapyrustextinstancePackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(PapyrustextinstancePackage.eNS_URI, thePapyrustextinstancePackage);
+ return thePapyrustextinstancePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getPapyrusTextInstance() {
+ return papyrusTextInstanceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getPapyrusTextInstance_EditedObject() {
+ return (EReference)papyrusTextInstanceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getPapyrusTextInstance_Type() {
+ return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getPapyrusTextInstance_Name() {
+ return (EAttribute)papyrusTextInstanceEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrustextinstanceFactory getPapyrustextinstanceFactory() {
+ return (PapyrustextinstanceFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ papyrusTextInstanceEClass = createEClass(PAPYRUS_TEXT_INSTANCE);
+ createEReference(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__EDITED_OBJECT);
+ createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__TYPE);
+ createEAttribute(papyrusTextInstanceEClass, PAPYRUS_TEXT_INSTANCE__NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ papyrusTextInstanceEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(papyrusTextInstanceEClass, PapyrusTextInstance.class, "PapyrusTextInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getPapyrusTextInstance_EditedObject(), theEcorePackage.getEObject(), null, "editedObject", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPapyrusTextInstance_Type(), ecorePackage.getEString(), "type", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPapyrusTextInstance_Name(), ecorePackage.getEString(), "name", null, 0, 1, PapyrusTextInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //PapyrustextinstancePackageImpl
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java new file mode 100644 index 00000000000..2b1eacd4a82 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceAdapterFactory.java @@ -0,0 +1,149 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage
+ * @generated
+ */
+public class PapyrustextinstanceAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PapyrustextinstancePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrustextinstanceAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = PapyrustextinstancePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PapyrustextinstanceSwitch<Adapter> modelSwitch =
+ new PapyrustextinstanceSwitch<Adapter>() {
+ @Override
+ public Adapter casePapyrusTextInstance(PapyrusTextInstance object) {
+ return createPapyrusTextInstanceAdapter();
+ }
+ @Override
+ public Adapter caseEModelElement(EModelElement object) {
+ return createEModelElementAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance <em>Papyrus Text Instance</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance
+ * @generated
+ */
+ public Adapter createPapyrusTextInstanceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EModelElement
+ * @generated
+ */
+ public Adapter createEModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //PapyrustextinstanceAdapterFactory
diff --git a/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java new file mode 100644 index 00000000000..41507f9b2c5 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.text.instance/src/org/eclipse/papyrus/example/test/instance/papyrustextinstance/util/PapyrustextinstanceSwitch.java @@ -0,0 +1,137 @@ +/**
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.example.test.instance.papyrustextinstance.util;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstancePackage
+ * @generated
+ */
+public class PapyrustextinstanceSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PapyrustextinstancePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrustextinstanceSwitch() {
+ if (modelPackage == null) {
+ modelPackage = PapyrustextinstancePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case PapyrustextinstancePackage.PAPYRUS_TEXT_INSTANCE: {
+ PapyrusTextInstance papyrusTextInstance = (PapyrusTextInstance)theEObject;
+ T result = casePapyrusTextInstance(papyrusTextInstance);
+ if (result == null) result = caseEModelElement(papyrusTextInstance);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Papyrus Text Instance</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePapyrusTextInstance(PapyrusTextInstance object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEModelElement(EModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //PapyrustextinstanceSwitch
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.classpath b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.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/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.project b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.project new file mode 100644 index 00000000000..a3c9e924989 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.example.uml.comment.editor.v2</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/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.settings/org.eclipse.jdt.core.prefs b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +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.compliance=1.5
+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/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..97c82fcd9b9 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Papyrus Comment Editor Example (Incubation) +Bundle-SymbolicName: org.eclipse.papyrus.example.uml.comment.editor.v2;singleton:=true +Bundle-Version: 0.9.0.qualifier +Bundle-Activator: org.eclipse.papyrus.example.uml.comment.editor.v2.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.infra.core.log;bundle-version="0.9.0", + org.eclipse.ui.editors;bundle-version="3.8.0", + org.eclipse.text, + org.eclipse.emf.ecore;bundle-version="2.8.0", + org.eclipse.papyrus.example.text.instance;bundle-version="0.9.0", + org.eclipse.uml2.uml;bundle-version="4.0.0", + org.eclipse.papyrus.infra.core, + org.eclipse.emf.transaction, + org.eclipse.emf.workspace, + org.eclipse.jface.text;bundle-version="3.8.0", + org.eclipse.papyrus.infra.services.edit, + org.eclipse.gmf.runtime.common.core, + org.eclipse.gmf.runtime.emf.type.core +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/about.html b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/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 ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/build.properties b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/build.properties new file mode 100644 index 00000000000..6f20375d6c7 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/build.properties @@ -0,0 +1,5 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/icons/texteditorv2.bmp b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/icons/texteditorv2.bmp Binary files differnew file mode 100644 index 00000000000..1376f03a47e --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/icons/texteditorv2.bmp diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.pdoc b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.pdoc new file mode 100644 index 00000000000..6b487d87c0f --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.pdoc @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides a editor for uml.Comment">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.xml b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.xml new file mode 100644 index 00000000000..e9b5e3955a4 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/plugin.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.example.uml.comment.editor.v2.modelresource.TextEditorModelCommentResource">
+ </model>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Open a Comment Editor (Comment Resource)"
+ id="org.eclipse.papyrus.example.uml.comment.editor.command.v2"
+ name="Open a Comment Editor (Comment Resource)">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.example.uml.comment.editor.v2.handler.CommentEditorHandler"
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.v2">
+ <activeWhen>
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ <editorDiagram
+ factoryClass="org.eclipse.papyrus.example.uml.comment.editor.v2.factory.CommentEditorFactory"
+ icon="icons/texteditorv2.bmp">
+ </editorDiagram>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup">
+ <command
+ commandId="org.eclipse.papyrus.example.uml.comment.editor.command.v2"
+ icon="icons/texteditorv2.bmp"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/Activator.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/Activator.java new file mode 100644 index 00000000000..ba79f5c0ded --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/Activator.java @@ -0,0 +1,67 @@ +/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.v2;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.example.uml.comment.editor.v2"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/editor/PapyrusCommentEditor.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/editor/PapyrusCommentEditor.java new file mode 100644 index 00000000000..0ef00d7d6a2 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/editor/PapyrusCommentEditor.java @@ -0,0 +1,205 @@ +/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.v2.editor;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.ITextListener;
+import org.eclipse.jface.text.TextEvent;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.uml2.uml.Comment;
+
+public class PapyrusCommentEditor extends TextEditor {
+
+ /** the service registry */
+ protected final ServicesRegistry registry;
+
+ /** the papyrus text instance */
+ protected final PapyrusTextInstance papyrusTextInstance;
+
+ /** the text listener */
+ protected ITextListener listener;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param registry
+ * @param papyrusTextInstance
+ */
+ public PapyrusCommentEditor(final ServicesRegistry registry, final PapyrusTextInstance papyrusTextInstance) {
+ super();
+ this.registry = registry;
+ this.papyrusTextInstance = papyrusTextInstance;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.jface.text.source.IVerticalRuler, int)
+ *
+ * @param parent
+ * @param ruler
+ * @param styles
+ * @return
+ */
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
+ ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
+ //we add a listener on the viewer to be notified when the text is edited
+ //TODO try to improve, because we execute a command for each character
+ listener = new ITextListener() {
+ //we edit the uml.Comment
+ public void textChanged(TextEvent event) {
+ String currentText = getSourceViewer().getTextWidget().getText();
+ Comment cmt = (Comment)papyrusTextInstance.getEditedObject();
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(cmt);
+ EStructuralFeature feature = cmt.eClass().getEStructuralFeature("body");
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(cmt);
+ SetRequest request = new SetRequest((TransactionalEditingDomain)editingDomain, cmt, feature, currentText);
+ ICommand command = elementEditService.getEditCommand(request);
+ if(command.canExecute()) {
+ editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command));
+ }
+ }
+ };
+
+ viewer.addTextListener(listener);
+ return viewer;
+ }
+
+ /**
+ * We override this method because setInput can't be overriden for TextEditor.
+ * We replace the default papyrus input by our input for Comment
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ *
+ * @param input
+ * @throws CoreException
+ */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+ String string = ((Comment)papyrusTextInstance.getEditedObject()).getBody();
+ if(string == null) {
+ string = "";
+ }
+ IStorage storage = new TextStorage(string);
+ super.doSetInput(new TextInput(storage));
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.editors.text.TextEditor#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ //we remove the listener
+ getSourceViewer().removeTextListener(listener);
+ super.dispose();
+ }
+
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextStorage implements IStorage {
+
+ private String string;
+
+ TextStorage(String input) {
+ this.string = input;
+ }
+
+ public InputStream getContents() throws CoreException {
+ return new ByteArrayInputStream(string.getBytes());
+ }
+
+ public IPath getFullPath() {
+ return null;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public String getName() {
+ int len = Math.min(5, string.length());
+ return string.substring(0, len).concat("..."); //$NON-NLS-1$
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+ }
+
+ //for this classes , see : http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F
+ class TextInput implements IStorageEditorInput {
+
+ private IStorage storage;
+
+ TextInput(IStorage storage) {
+ this.storage = storage;
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return storage.getName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public IStorage getStorage() {
+ return storage;
+ }
+
+ public String getToolTipText() {
+ return "String-based file: " + storage.getName();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+ }
+
+}
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/factory/CommentEditorFactory.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/factory/CommentEditorFactory.java new file mode 100644 index 00000000000..38348fe79a6 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/factory/CommentEditorFactory.java @@ -0,0 +1,206 @@ +/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.v2.factory;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.uml.comment.editor.v2.Activator;
+import org.eclipse.papyrus.example.uml.comment.editor.v2.editor.PapyrusCommentEditor;
+import org.eclipse.papyrus.example.uml.comment.editor.v2.handler.CommentEditorHandler;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+
+public class CommentEditorFactory extends AbstractEditorFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editorClass
+ * the editor class
+ * @param editorType
+ * the type of editor
+ */
+ public CommentEditorFactory() {
+ super(PapyrusCommentEditor.class,CommentEditorHandler.EDITOR_TYPE);
+ }
+
+ /**
+ * Create the IPageModel that is used by the SashWindows to manage the editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * The model pushed in the sashmodel by the creation command
+ * @return A model implementing the IPageModel
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new TextEditorModel(pageIdentifier, getServiceRegistry());
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * @return
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if(pageIdentifier instanceof PapyrusTextInstance) {
+ return ((PapyrusTextInstance)pageIdentifier).getType().equals(this.getExpectedType());
+ }
+ return false;
+ }
+
+ /**
+ * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
+ *
+ *
+ *
+ */
+ class TextEditorModel implements IEditorModel {
+
+
+ /**
+ * The servicesRegistry provided at creation.
+ */
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ * The created editor.
+ */
+ private IEditorPart editor;
+
+ /**
+ * The raw model stored in the SashProvider.
+ */
+ private PapyrusTextInstance rawModel;
+
+ /**
+ *
+ * Constructor.
+ */
+ public TextEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
+ rawModel = (PapyrusTextInstance)pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the IEditor for the diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
+ editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+ return editor;
+
+ } catch (Exception e) {
+ // Lets propagate. This is an implementation problem that should be solved by
+ // programmer.
+ throw new PartInitException("Can't create TextEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Get the action bar requested by the Editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
+ * @return
+ *
+ */
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if(actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ // ServicesRegistry serviceRegistry = getServicesRegistry();
+ ActionBarContributorRegistry registry;
+ try {
+ registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ Activator.log.error(e);
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ Activator.log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Get the underlying RawModel. Return the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return rawModel;
+ }
+
+ /**
+ * Get the icon to be shown by Tabs
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
+ if(imageDescriptor == null){
+ return null;
+ }
+ return imageDescriptor.createImage();
+ }
+
+ /**
+ * Get the title of the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return rawModel.getName();
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/handler/CommentEditorHandler.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/handler/CommentEditorHandler.java new file mode 100644 index 00000000000..1f5f8a646f5 --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/handler/CommentEditorHandler.java @@ -0,0 +1,176 @@ +/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.v2.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrustextinstanceFactory;
+import org.eclipse.papyrus.example.uml.comment.editor.v2.Activator;
+import org.eclipse.papyrus.example.uml.comment.editor.v2.modelresource.TextEditorModelCommentResource;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.Comment;
+
+
+public class CommentEditorHandler extends AbstractHandler {
+
+
+ public static final String EDITOR_DEFAULT_NAME = "Comment Editor v2";
+
+ public static final String EDITOR_TYPE = "CommentEditorv2";
+
+ public CommentEditorHandler(){
+ }
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return getSelection().size() == 1;
+ }
+
+ //TODO essayer de merger cet handler avec un autre fournissant une commande et la sélection!
+ protected List<EObject> getSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ List<EObject> currentSelection = new ArrayList<EObject>();
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable){
+ EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(tmp!=null){
+ if(tmp instanceof Comment){
+ currentSelection.add(tmp);
+ }
+ }
+ }
+ }
+ return currentSelection;
+ }
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+
+ runAsTransaction();
+ } catch (ServiceException e) {
+ throw new ExecutionException("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Run the command as a transaction.
+ * Create a Transaction and delegate the command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ public void runAsTransaction() throws ServiceException {
+ final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+
+ //Create the transactional command
+ AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create CompareEditor") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ try {
+ CommentEditorHandler.this.doExecute(serviceRegistry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // Execute the command
+ try {
+ CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ Activator.log.error("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+
+ /**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ Object editorModel = createEditorModel(serviceRegistry);
+ // Get the mngr allowing to add/open new editor.
+ IPageMngr pageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
+ // add the new editor model to the sash.
+ pageMngr.openPage(editorModel);
+
+ }
+
+ /**
+ * Create a model identifying the editor. This model will be saved with the sash
+ *
+ * @return
+ * @throws ServiceException
+ * @throws NotFoundException
+ * The model where to save the TableInstance is not found.
+ */
+ protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ PapyrusTextInstance editorModel = PapyrustextinstanceFactory.eINSTANCE.createPapyrusTextInstance();
+ editorModel.setEditedObject(getSelection().get(0));
+ editorModel.setType(EDITOR_TYPE);
+ editorModel.setName(EDITOR_DEFAULT_NAME);
+ TextEditorModelCommentResource model = (TextEditorModelCommentResource)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelCommentResource.MODEL_ID);
+ model.addPapyrusTextInstance(editorModel);
+ return editorModel;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/modelresource/TextEditorModelCommentResource.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/modelresource/TextEditorModelCommentResource.java new file mode 100644 index 00000000000..5d85e8be7ad --- /dev/null +++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.v2/src/org/eclipse/papyrus/example/uml/comment/editor/v2/modelresource/TextEditorModelCommentResource.java @@ -0,0 +1,108 @@ +/*****************************************************************************
+ * Copyright (c) 2012 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:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.example.uml.comment.editor.v2.modelresource;
+import org.eclipse.papyrus.example.test.instance.papyrustextinstance.PapyrusTextInstance;
+import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+
+
+public class TextEditorModelCommentResource extends AbstractBaseModel implements IModel {
+
+ /*
+ * To save in a new file :
+ * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
+ */
+
+
+ /**
+ * File extension used for notation.
+ */
+ public static final String COMMENT_FILE_EXTENSION = "comment"; //$NON-NLS-1$
+
+// public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.example.text.TextEditorModelCommentResource"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public TextEditorModelCommentResource() {
+
+ }
+
+
+ /**
+ * Get the file extension used for this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return COMMENT_FILE_EXTENSION;
+ }
+
+ /**
+ * Get the identifier used to register this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void addPapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ getResource().getContents().add(compareInstance);
+ }
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void removePapyrusTextInstance(PapyrusTextInstance compareInstance) {
+ getResource().getContents().remove(compareInstance);
+ }
+
+// /**
+// *
+// * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
+// *
+// * @param object
+// * @return
+// */
+// @Override
+// protected boolean isModelRoot(EObject object) {
+// return false;
+// }
+
+}
|