Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Jastram2012-10-25 14:31:36 +0000
committerMichael Jastram2012-10-25 14:31:36 +0000
commitdb783c1003d31f694a69d2378e0485181a3a34d1 (patch)
treee3cb2fb042525aa2ffc8e385c44a18867782878e /org.eclipse.rmf.reqif10.pror.presentation.id/src
parent05c84b6a10606c110b19e1080fe3789bb0a341a0 (diff)
downloadorg.eclipse.rmf-db783c1003d31f694a69d2378e0485181a3a34d1.tar.gz
org.eclipse.rmf-db783c1003d31f694a69d2378e0485181a3a34d1.tar.xz
org.eclipse.rmf-db783c1003d31f694a69d2378e0485181a3a34d1.zip
Step 3 package name refactoring
Diffstat (limited to 'org.eclipse.rmf.reqif10.pror.presentation.id/src')
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdConfiguration.java120
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdFactory.java51
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdPackage.java257
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdVerticalAlign.java214
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdConfigurationImpl.java352
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdFactoryImpl.java154
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdPackageImpl.java246
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IDEditPlugin.java99
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdConfigurationItemProvider.java337
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdItemProviderAdapterFactory.java219
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdAdapterFactory.java147
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdSwitch.java135
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/validation/IdConfigurationValidator.java26
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdLabelCellRenderer.java85
-rw-r--r--org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdPresentationService.java46
15 files changed, 2488 insertions, 0 deletions
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdConfiguration.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdConfiguration.java
new file mode 100644
index 00000000..f8715487
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdConfiguration.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id;
+
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Configuration</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getPrefix <em>Prefix</em>}</li>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getCount <em>Count</em>}</li>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getVerticalAlign <em>Vertical Align</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage#getIdConfiguration()
+ * @model
+ * @generated
+ */
+public interface IdConfiguration extends ProrPresentationConfiguration {
+ /**
+ * Returns the value of the '<em><b>Prefix</b></em>' attribute.
+ * The default value is <code>"REQ-"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Prefix</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Prefix</em>' attribute.
+ * @see #setPrefix(String)
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage#getIdConfiguration_Prefix()
+ * @model default="REQ-" required="true"
+ * @generated
+ */
+ String getPrefix();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getPrefix <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Prefix</em>' attribute.
+ * @see #getPrefix()
+ * @generated
+ */
+ void setPrefix(String value);
+
+ /**
+ * Returns the value of the '<em><b>Count</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Count</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Count</em>' attribute.
+ * @see #setCount(int)
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage#getIdConfiguration_Count()
+ * @model required="true"
+ * @generated
+ */
+ int getCount();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getCount <em>Count</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Count</em>' attribute.
+ * @see #getCount()
+ * @generated
+ */
+ void setCount(int value);
+
+ /**
+ * Returns the value of the '<em><b>Vertical Align</b></em>' attribute.
+ * The default value is <code>"Top"</code>.
+ * The literals are from the enumeration {@link org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Vertical Align</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Vertical Align</em>' attribute.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign
+ * @see #setVerticalAlign(IdVerticalAlign)
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage#getIdConfiguration_VerticalAlign()
+ * @model default="Top"
+ * @generated
+ */
+ IdVerticalAlign getVerticalAlign();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getVerticalAlign <em>Vertical Align</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Vertical Align</em>' attribute.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign
+ * @see #getVerticalAlign()
+ * @generated
+ */
+ void setVerticalAlign(IdVerticalAlign value);
+
+} // IdConfiguration
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdFactory.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdFactory.java
new file mode 100644
index 00000000..5e96fa71
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdFactory.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id;
+
+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.rmf.reqif10.pror.presentation.id.IdPackage
+ * @generated
+ */
+public interface IdFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ IdFactory eINSTANCE = org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Configuration</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Configuration</em>'.
+ * @generated
+ */
+ IdConfiguration createIdConfiguration();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ IdPackage getIdPackage();
+
+} //IdFactory
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdPackage.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdPackage.java
new file mode 100644
index 00000000..8707cfb6
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdPackage.java
@@ -0,0 +1,257 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.rmf.reqif10.pror.configuration.ConfigurationPackage;
+
+/**
+ * <!-- 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.rmf.reqif10.pror.presentation.id.IdFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface IdPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "id";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://pror.org/presentation/id";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "id";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ IdPackage eINSTANCE = org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl <em>Configuration</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdPackageImpl#getIdConfiguration()
+ * @generated
+ */
+ int ID_CONFIGURATION = 0;
+
+ /**
+ * The feature id for the '<em><b>Datatype</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ID_CONFIGURATION__DATATYPE = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION__DATATYPE;
+
+ /**
+ * The feature id for the '<em><b>Prefix</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ID_CONFIGURATION__PREFIX = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Count</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ID_CONFIGURATION__COUNT = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Vertical Align</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ID_CONFIGURATION__VERTICAL_ALIGN = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Configuration</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ID_CONFIGURATION_FEATURE_COUNT = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION_FEATURE_COUNT + 3;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign <em>Vertical Align</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdPackageImpl#getIdVerticalAlign()
+ * @generated
+ */
+ int ID_VERTICAL_ALIGN = 1;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration <em>Configuration</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Configuration</em>'.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration
+ * @generated
+ */
+ EClass getIdConfiguration();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getPrefix <em>Prefix</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Prefix</em>'.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getPrefix()
+ * @see #getIdConfiguration()
+ * @generated
+ */
+ EAttribute getIdConfiguration_Prefix();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getCount <em>Count</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Count</em>'.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getCount()
+ * @see #getIdConfiguration()
+ * @generated
+ */
+ EAttribute getIdConfiguration_Count();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getVerticalAlign <em>Vertical Align</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Vertical Align</em>'.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration#getVerticalAlign()
+ * @see #getIdConfiguration()
+ * @generated
+ */
+ EAttribute getIdConfiguration_VerticalAlign();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign <em>Vertical Align</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Vertical Align</em>'.
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign
+ * @generated
+ */
+ EEnum getIdVerticalAlign();
+
+ /**
+ * 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
+ */
+ IdFactory getIdFactory();
+
+ /**
+ * <!-- 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.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl <em>Configuration</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdPackageImpl#getIdConfiguration()
+ * @generated
+ */
+ EClass ID_CONFIGURATION = eINSTANCE.getIdConfiguration();
+
+ /**
+ * The meta object literal for the '<em><b>Prefix</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ID_CONFIGURATION__PREFIX = eINSTANCE.getIdConfiguration_Prefix();
+
+ /**
+ * The meta object literal for the '<em><b>Count</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ID_CONFIGURATION__COUNT = eINSTANCE.getIdConfiguration_Count();
+
+ /**
+ * The meta object literal for the '<em><b>Vertical Align</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ID_CONFIGURATION__VERTICAL_ALIGN = eINSTANCE.getIdConfiguration_VerticalAlign();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign <em>Vertical Align</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdPackageImpl#getIdVerticalAlign()
+ * @generated
+ */
+ EEnum ID_VERTICAL_ALIGN = eINSTANCE.getIdVerticalAlign();
+
+ }
+
+} //IdPackage
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdVerticalAlign.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdVerticalAlign.java
new file mode 100644
index 00000000..f0426659
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/IdVerticalAlign.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Kay Münch.
+ * 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:
+ * Kay Münch - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.rmf.reqif10.pror.presentation.id;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Vertical Align</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage#getIdVerticalAlign()
+ * @model
+ * @generated
+ */
+public enum IdVerticalAlign implements Enumerator {
+ /**
+ * The '<em><b>Top</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TOP_VALUE
+ * @generated
+ * @ordered
+ */
+ TOP(0, "Top", "Top"), /**
+ * The '<em><b>Center</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #CENTER_VALUE
+ * @generated
+ * @ordered
+ */
+ CENTER(1, "Center", "Center");
+
+ /**
+ * The '<em><b>Top</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Top</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TOP
+ * @model name="Top"
+ * @generated
+ * @ordered
+ */
+ public static final int TOP_VALUE = 0;
+
+ /**
+ * The '<em><b>Center</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Center</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #CENTER
+ * @model name="Center"
+ * @generated
+ * @ordered
+ */
+ public static final int CENTER_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Vertical Align</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final IdVerticalAlign[] VALUES_ARRAY =
+ new IdVerticalAlign[] {
+ TOP,
+ CENTER,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Vertical Align</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<IdVerticalAlign> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Vertical Align</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static IdVerticalAlign get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ IdVerticalAlign result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Vertical Align</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static IdVerticalAlign getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ IdVerticalAlign result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Vertical Align</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static IdVerticalAlign get(int value) {
+ switch (value) {
+ case TOP_VALUE: return TOP;
+ case CENTER_VALUE: return CENTER;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private IdVerticalAlign(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //IdVerticalAlign
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdConfigurationImpl.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdConfigurationImpl.java
new file mode 100644
index 00000000..b4cdf7b2
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdConfigurationImpl.java
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.rmf.reqif10.AttributeValueString;
+import org.eclipse.rmf.reqif10.ReqIF;
+import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
+import org.eclipse.rmf.reqif10.pror.configuration.impl.ProrPresentationConfigurationImpl;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Configuration</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl#getPrefix <em>Prefix</em>}</li>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl#getCount <em>Count</em>}</li>
+ * <li>{@link org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl#getVerticalAlign <em>Vertical Align</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class IdConfigurationImpl extends ProrPresentationConfigurationImpl implements IdConfiguration {
+ /**
+ * The default value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrefix()
+ * @generated
+ * @ordered
+ */
+ protected static final String PREFIX_EDEFAULT = "REQ-";
+
+ /**
+ * The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrefix()
+ * @generated
+ * @ordered
+ */
+ protected String prefix = PREFIX_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getCount() <em>Count</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCount()
+ * @generated
+ * @ordered
+ */
+ protected static final int COUNT_EDEFAULT = 0;
+
+ /**
+ * The cached value of the '{@link #getCount() <em>Count</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCount()
+ * @generated
+ * @ordered
+ */
+ protected int count = COUNT_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getVerticalAlign() <em>Vertical Align</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVerticalAlign()
+ * @generated
+ * @ordered
+ */
+ protected static final IdVerticalAlign VERTICAL_ALIGN_EDEFAULT = IdVerticalAlign.TOP;
+
+ /**
+ * The cached value of the '{@link #getVerticalAlign() <em>Vertical Align</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVerticalAlign()
+ * @generated
+ * @ordered
+ */
+ protected IdVerticalAlign verticalAlign = VERTICAL_ALIGN_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IdConfigurationImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return IdPackage.Literals.ID_CONFIGURATION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPrefix(String newPrefix) {
+ String oldPrefix = prefix;
+ prefix = newPrefix;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, IdPackage.ID_CONFIGURATION__PREFIX, oldPrefix, prefix));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getCount() {
+ return count;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCount(int newCount) {
+ int oldCount = count;
+ count = newCount;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, IdPackage.ID_CONFIGURATION__COUNT, oldCount, count));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdVerticalAlign getVerticalAlign() {
+ return verticalAlign;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setVerticalAlign(IdVerticalAlign newVerticalAlign) {
+ IdVerticalAlign oldVerticalAlign = verticalAlign;
+ verticalAlign = newVerticalAlign == null ? VERTICAL_ALIGN_EDEFAULT : newVerticalAlign;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN, oldVerticalAlign, verticalAlign));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case IdPackage.ID_CONFIGURATION__PREFIX:
+ return getPrefix();
+ case IdPackage.ID_CONFIGURATION__COUNT:
+ return getCount();
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ return getVerticalAlign();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case IdPackage.ID_CONFIGURATION__PREFIX:
+ setPrefix((String)newValue);
+ return;
+ case IdPackage.ID_CONFIGURATION__COUNT:
+ setCount((Integer)newValue);
+ return;
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ setVerticalAlign((IdVerticalAlign)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case IdPackage.ID_CONFIGURATION__PREFIX:
+ setPrefix(PREFIX_EDEFAULT);
+ return;
+ case IdPackage.ID_CONFIGURATION__COUNT:
+ setCount(COUNT_EDEFAULT);
+ return;
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ setVerticalAlign(VERTICAL_ALIGN_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case IdPackage.ID_CONFIGURATION__PREFIX:
+ return PREFIX_EDEFAULT == null ? prefix != null : !PREFIX_EDEFAULT.equals(prefix);
+ case IdPackage.ID_CONFIGURATION__COUNT:
+ return count != COUNT_EDEFAULT;
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ return verticalAlign != VERTICAL_ALIGN_EDEFAULT;
+ }
+ 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(" (prefix: ");
+ result.append(prefix);
+ result.append(", count: ");
+ result.append(count);
+ result.append(", verticalAlign: ");
+ result.append(verticalAlign);
+ result.append(')');
+ return result.toString();
+ }
+
+ private EContentAdapter reqifAdapter;
+
+ /**
+ * Two listeners must be registered:
+ * <ul>
+ * <li>An adapter on the {@link ReqIF}, reacting to relevant SpecObject
+ * changes that require the creation of new IDs
+ * <li>An adapter to the {@link IdConfiguration}, reacting to changes of its
+ * attributes.
+ * </ul>
+ */
+ public void registerReqIF() {
+ reqifAdapter = buildReqifListener();
+ ReqIF10Util.getReqIF(this).getCoreContent().eAdapters()
+ .add(reqifAdapter);
+ }
+
+ public void unregisterReqIF() {
+ if (reqifAdapter != null) {
+ ReqIF10Util.getReqIF(this).getCoreContent().eAdapters()
+ .remove(reqifAdapter);
+ }
+ }
+
+ private EContentAdapter buildReqifListener() {
+ EContentAdapter adapter = new EContentAdapter() {
+ @Override
+ public void setTarget(Notifier target) {
+ super.setTarget(target);
+ if (target instanceof AttributeValueString) {
+ AttributeValueString value = (AttributeValueString) target;
+ if (value.getDefinition() != null
+ && value.getDefinition().getType() != null
+ && value.getDefinition().getType()
+ .equals(getDatatype())) {
+ if (value.getTheValue() == null
+ || value.getTheValue().length() == 0) {
+ int newCount = getCount() + 1;
+ value.setTheValue(getPrefix() + newCount);
+ setCount(newCount);
+ }
+ }
+ }
+ }
+ };
+ return adapter;
+ }
+
+ // private EContentAdapter buildAdapter(final IdConfiguration config) {
+ // config.eAdapters().add(new AdapterImpl() {
+ // @Override
+ // public void notifyChanged(Notification msg) {
+ // if
+ // (ConfigurationPackage.Literals.PROR_PRESENTATION_CONFIGURATION__DATATYPE
+ // .equals(msg.getFeature())) {
+ // EContentAdapter adapter = adapters.get(config);
+ // if (adapter != null) {
+ // ReqIF reqif = ReqIF10Util.getReqIF(config);
+ // reqif.eAdapters().remove(adapter);
+ // adapter = buildAdapter(config);
+ // reqif.eAdapters().add(adapter);
+ // adapters.put(config, adapter);
+ // }
+ // }
+ // }
+ // });
+ // }
+
+} //IdConfigurationImpl
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdFactoryImpl.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdFactoryImpl.java
new file mode 100644
index 00000000..fd010938
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdFactoryImpl.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+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.rmf.reqif10.pror.presentation.id.*;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IdFactoryImpl extends EFactoryImpl implements IdFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static IdFactory init() {
+ try {
+ IdFactory theIdFactory = (IdFactory)EPackage.Registry.INSTANCE.getEFactory("http://pror.org/presentation/id");
+ if (theIdFactory != null) {
+ return theIdFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new IdFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case IdPackage.ID_CONFIGURATION: return createIdConfiguration();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case IdPackage.ID_VERTICAL_ALIGN:
+ return createIdVerticalAlignFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case IdPackage.ID_VERTICAL_ALIGN:
+ return convertIdVerticalAlignToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdConfiguration createIdConfiguration() {
+ IdConfigurationImpl idConfiguration = new IdConfigurationImpl();
+ return idConfiguration;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdVerticalAlign createIdVerticalAlignFromString(EDataType eDataType, String initialValue) {
+ IdVerticalAlign result = IdVerticalAlign.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertIdVerticalAlignToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdPackage getIdPackage() {
+ return (IdPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static IdPackage getPackage() {
+ return IdPackage.eINSTANCE;
+ }
+
+} //IdFactoryImpl
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdPackageImpl.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdPackageImpl.java
new file mode 100644
index 00000000..28fccbc3
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/impl/IdPackageImpl.java
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.rmf.reqif10.ReqIF10Package;
+import org.eclipse.rmf.reqif10.datatypes.DatatypesPackage;
+import org.eclipse.rmf.reqif10.pror.configuration.ConfigurationPackage;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdFactory;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign;
+import org.eclipse.rmf.reqif10.xhtml.XhtmlPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IdPackageImpl extends EPackageImpl implements IdPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass idConfigurationEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum idVerticalAlignEEnum = 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.rmf.reqif10.pror.presentation.id.IdPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private IdPackageImpl() {
+ super(eNS_URI, IdFactory.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 IdPackage#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 IdPackage init() {
+ if (isInited) return (IdPackage)EPackage.Registry.INSTANCE.getEPackage(IdPackage.eNS_URI);
+
+ // Obtain or create and register package
+ IdPackageImpl theIdPackage = (IdPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof IdPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new IdPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ ConfigurationPackage.eINSTANCE.eClass();
+ ReqIF10Package.eINSTANCE.eClass();
+ XhtmlPackage.eINSTANCE.eClass();
+ DatatypesPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theIdPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theIdPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theIdPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(IdPackage.eNS_URI, theIdPackage);
+ return theIdPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getIdConfiguration() {
+ return idConfigurationEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIdConfiguration_Prefix() {
+ return (EAttribute)idConfigurationEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIdConfiguration_Count() {
+ return (EAttribute)idConfigurationEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getIdConfiguration_VerticalAlign() {
+ return (EAttribute)idConfigurationEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getIdVerticalAlign() {
+ return idVerticalAlignEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdFactory getIdFactory() {
+ return (IdFactory)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
+ idConfigurationEClass = createEClass(ID_CONFIGURATION);
+ createEAttribute(idConfigurationEClass, ID_CONFIGURATION__PREFIX);
+ createEAttribute(idConfigurationEClass, ID_CONFIGURATION__COUNT);
+ createEAttribute(idConfigurationEClass, ID_CONFIGURATION__VERTICAL_ALIGN);
+
+ // Create enums
+ idVerticalAlignEEnum = createEEnum(ID_VERTICAL_ALIGN);
+ }
+
+ /**
+ * <!-- 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
+ ConfigurationPackage theConfigurationPackage = (ConfigurationPackage)EPackage.Registry.INSTANCE.getEPackage(ConfigurationPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ idConfigurationEClass.getESuperTypes().add(theConfigurationPackage.getProrPresentationConfiguration());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(idConfigurationEClass, IdConfiguration.class, "IdConfiguration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getIdConfiguration_Prefix(), ecorePackage.getEString(), "prefix", "REQ-", 1, 1, IdConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getIdConfiguration_Count(), ecorePackage.getEInt(), "count", null, 1, 1, IdConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getIdConfiguration_VerticalAlign(), this.getIdVerticalAlign(), "verticalAlign", "Top", 0, 1, IdConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(idVerticalAlignEEnum, IdVerticalAlign.class, "IdVerticalAlign");
+ addEEnumLiteral(idVerticalAlignEEnum, IdVerticalAlign.TOP);
+ addEEnumLiteral(idVerticalAlignEEnum, IdVerticalAlign.CENTER);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //IdPackageImpl
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IDEditPlugin.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IDEditPlugin.java
new file mode 100644
index 00000000..972aa169
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IDEditPlugin.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.rmf.pror.reqif10.provider.Reqif10EditPlugin;
+
+/**
+ * This is the central singleton for the ID edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class IDEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final IDEditPlugin INSTANCE = new IDEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IDEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ Reqif10EditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdConfigurationItemProvider.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdConfigurationItemProvider.java
new file mode 100644
index 00000000..c016ccd6
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdConfigurationItemProvider.java
@@ -0,0 +1,337 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.rmf.reqif10.AttributeValue;
+import org.eclipse.rmf.reqif10.AttributeValueString;
+import org.eclipse.rmf.reqif10.ReqIF10Package;
+import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
+import org.eclipse.rmf.reqif10.pror.configuration.ConfigurationPackage;
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.reqif10.pror.configuration.provider.ProrPresentationConfigurationItemProvider;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IdConfigurationItemProvider
+ extends ProrPresentationConfigurationItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdConfigurationItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addPrefixPropertyDescriptor(object);
+ addCountPropertyDescriptor(object);
+ addVerticalAlignPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Prefix feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addPrefixPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IdConfiguration_prefix_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_IdConfiguration_prefix_feature", "_UI_IdConfiguration_type"),
+ IdPackage.Literals.ID_CONFIGURATION__PREFIX,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Count feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCountPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IdConfiguration_count_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_IdConfiguration_count_feature", "_UI_IdConfiguration_type"),
+ IdPackage.Literals.ID_CONFIGURATION__COUNT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Vertical Align feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addVerticalAlignPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_IdConfiguration_verticalAlign_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_IdConfiguration_verticalAlign_feature", "_UI_IdConfiguration_type"),
+ IdPackage.Literals.ID_CONFIGURATION__VERTICAL_ALIGN,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns IdConfiguration.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public Object getImage(Object object) {
+ return super.getImage(object);
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public String getText(Object object) {
+ IdConfiguration idConfiguration = (IdConfiguration)object;
+ if (idConfiguration.getDatatype() == null)
+ return getString("_UI_IdConfiguration_type_not_set");
+ return getString("_UI_IdConfiguration_type", new Object[] {
+ idConfiguration.getDatatype().getLongName(),
+ idConfiguration.getCount() });
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(IdConfiguration.class)) {
+ case IdPackage.ID_CONFIGURATION__PREFIX:
+ case IdPackage.ID_CONFIGURATION__COUNT:
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return IDEditPlugin.INSTANCE;
+ }
+
+ // Listener to be attached to the ReqIF
+ private EContentAdapter contentAdapter;
+
+ /**
+ * We do two things:
+ * <ul>
+ * <li>Register an adapter with the model to set IDs as needed
+ * <li>Register an adapter with the config element to react to config value
+ * changes.
+ * <ul>
+ */
+ public void registerPresentationConfiguration(
+ final ProrPresentationConfiguration config,
+ final EditingDomain editingDomain) {
+ registerModelListener((IdConfiguration) config, editingDomain);
+
+ config.eAdapters().add(new AdapterImpl() {
+ public void notifyChanged(Notification notification) {
+ if (notification.getFeature() == ConfigurationPackage.Literals.PROR_PRESENTATION_CONFIGURATION__DATATYPE) {
+ unregisterModelListener(config);
+ registerModelListener((IdConfiguration) config,
+ editingDomain);
+ }
+ }
+ });
+ }
+
+ public void unregisterPresentationConfiguration(
+ ProrPresentationConfiguration config) {
+ unregisterModelListener(config);
+ }
+
+ private void registerModelListener(final IdConfiguration config,
+ final EditingDomain editingDomain) {
+ if (contentAdapter != null) {
+ throw new IllegalStateException(
+ "Cannot register IDConfigAdapter without unregistering first!");
+ }
+ contentAdapter = new EContentAdapter() {
+ @Override
+ public void setTarget(final Notifier target) {
+ super.setTarget(target);
+ if (target instanceof AttributeValueString) {
+ AttributeValueString value = (AttributeValueString) target;
+ if (value.getDefinition() != null
+ && value.getDefinition().getType() != null
+ && value.getDefinition().getType()
+ .equals(config.getDatatype())) {
+ if (value.getTheValue() == null
+ || value.getTheValue().length() == 0) {
+ int newCount = config.getCount() + 1;
+
+ String label = "Assigning ID " + config.getPrefix()
+ + newCount;
+
+ // Catch undo
+ Command redoCommand = editingDomain
+ .getCommandStack().getRedoCommand();
+ if (redoCommand != null
+ && label.equals(redoCommand.getLabel())) {
+ System.out.println("Detected Undo - skip "
+ + label);
+ return;
+ }
+ CompoundCommand cmd = new CompoundCommand(
+ label);
+ cmd.append(SetCommand
+ .create(editingDomain,
+ value,
+ ReqIF10Package.Literals.ATTRIBUTE_VALUE_STRING__THE_VALUE,
+ config.getPrefix() + newCount));
+ cmd.append(SetCommand.create(editingDomain, config,
+ IdPackage.Literals.ID_CONFIGURATION__COUNT,
+ newCount));
+ editingDomain.getCommandStack().execute(cmd);
+ }
+ }
+ }
+ }
+ };
+ ReqIF10Util.getReqIF(config).getCoreContent().eAdapters()
+ .add(contentAdapter);
+ }
+
+ private void unregisterModelListener(ProrPresentationConfiguration config) {
+ if (contentAdapter != null) {
+ ReqIF10Util.getReqIF(config).getCoreContent().eAdapters()
+ .remove(contentAdapter);
+ contentAdapter = null;
+ }
+ }
+
+ public Command handleDragAndDrop(Collection<?> source, Object target,
+ EditingDomain editingDomain, int operation) {
+ // No drag and drop support
+ return null;
+ }
+
+ public String getLabel(AttributeValue av) {
+ // No custom label
+ return null;
+ }
+
+ /**
+ * Don't allow editing.
+ */
+ public boolean canEdit() {
+ return false;
+ }
+
+}
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdItemProviderAdapterFactory.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdItemProviderAdapterFactory.java
new file mode 100644
index 00000000..e2d3bdf9
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/provider/IdItemProviderAdapterFactory.java
@@ -0,0 +1,219 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.Disposable;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.rmf.reqif10.pror.presentation.id.util.IdAdapterFactory;
+
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class IdItemProviderAdapterFactory extends IdAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the item providers created, so that they can be {@link #dispose disposed}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Disposable disposable = new Disposable();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createIdConfigurationAdapter() {
+ return new IdConfigurationItemProvider(this);
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Associates an adapter with a notifier via the base implementation, then records it to ensure it will be disposed.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void associate(Adapter adapter, Notifier target) {
+ super.associate(adapter, target);
+ if (adapter != null) {
+ disposable.add(adapter);
+ }
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ disposable.dispose();
+ }
+
+}
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdAdapterFactory.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdAdapterFactory.java
new file mode 100644
index 00000000..fdd47158
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdAdapterFactory.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.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.EObject;
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage;
+
+/**
+ * <!-- 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.rmf.reqif10.pror.presentation.id.IdPackage
+ * @generated
+ */
+public class IdAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static IdPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = IdPackage.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 IdSwitch<Adapter> modelSwitch =
+ new IdSwitch<Adapter>() {
+ @Override
+ public Adapter caseIdConfiguration(IdConfiguration object) {
+ return createIdConfigurationAdapter();
+ }
+ @Override
+ public Adapter caseProrPresentationConfiguration(ProrPresentationConfiguration object) {
+ return createProrPresentationConfigurationAdapter();
+ }
+ @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.rmf.reqif10.pror.presentation.id.IdConfiguration <em>Configuration</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.rmf.reqif10.pror.presentation.id.IdConfiguration
+ * @generated
+ */
+ public Adapter createIdConfigurationAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration <em>Pror Presentation Configuration</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.rmf.reqif10.pror.configuration.ProrPresentationConfiguration
+ * @generated
+ */
+ public Adapter createProrPresentationConfigurationAdapter() {
+ 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;
+ }
+
+} //IdAdapterFactory
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdSwitch.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdSwitch.java
new file mode 100644
index 00000000..08808a33
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/util/IdSwitch.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.Switch;
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdPackage;
+
+/**
+ * <!-- 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.rmf.reqif10.pror.presentation.id.IdPackage
+ * @generated
+ */
+public class IdSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * @generated
+ */
+ protected static IdPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdSwitch() {
+ if (modelPackage == null) {
+ modelPackage = IdPackage.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 IdPackage.ID_CONFIGURATION: {
+ IdConfiguration idConfiguration = (IdConfiguration)theEObject;
+ T result = caseIdConfiguration(idConfiguration);
+ if (result == null) result = caseProrPresentationConfiguration(idConfiguration);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Configuration</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>Configuration</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIdConfiguration(IdConfiguration object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Pror Presentation Configuration</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>Pror Presentation Configuration</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseProrPresentationConfiguration(ProrPresentationConfiguration 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;
+ }
+
+} //IdSwitch
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/validation/IdConfigurationValidator.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/validation/IdConfigurationValidator.java
new file mode 100644
index 00000000..56725cd0
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/id/validation/IdConfigurationValidator.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.rmf.reqif10.pror.presentation.id.validation;
+
+
+/**
+ * A sample validator interface for {@link org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration}.
+ * This doesn't really do anything, and it's not a real EMF artifact.
+ * It was generated by the org.eclipse.emf.examples.generator.validator plug-in to illustrate how EMF's code generator can be extended.
+ * This can be disabled with -vmargs -Dorg.eclipse.emf.examples.generator.validator=false.
+ */
+public interface IdConfigurationValidator {
+ boolean validate();
+
+ boolean validatePrefix(String value);
+ boolean validateCount(int value);
+}
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdLabelCellRenderer.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdLabelCellRenderer.java
new file mode 100644
index 00000000..0f66e49f
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdLabelCellRenderer.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+package org.eclipse.rmf.reqif10.pror.presentation.ui;
+
+import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
+import org.eclipse.rmf.reqif10.AttributeDefinitionString;
+import org.eclipse.rmf.reqif10.AttributeValue;
+import org.eclipse.rmf.reqif10.AttributeValueString;
+import org.eclipse.rmf.reqif10.DatatypeDefinitionString;
+import org.eclipse.rmf.reqif10.common.util.ReqIF10Util;
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.reqif10.pror.editor.presentation.service.IProrCellRenderer;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdConfiguration;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdVerticalAlign;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+
+public class IdLabelCellRenderer implements IProrCellRenderer {
+
+ IdConfiguration config;
+
+ public IdLabelCellRenderer() {
+
+ }
+
+ public IdLabelCellRenderer(IdConfiguration config) {
+ this.config = config;
+ }
+
+ public int doDrawCellContent(GC gc, Rectangle rect, Object value) {
+ if (value instanceof AttributeValueString) {
+ Object text = ReqIF10Util.getTheValue((AttributeValue) value);
+ if (text != null) {
+ IdVerticalAlign align = getAlignment((AttributeValueString) value);
+ Point extend = gc.textExtent(value.toString());
+ int y = rect.y + 1;
+ if (IdVerticalAlign.CENTER.equals(align)) {
+ y = rect.y + rect.height / 2 - extend.y / 2;
+ }
+ gc.drawText(text.toString(), rect.x + 1, y);
+ return extend.y + 2;
+ }
+ }
+
+ // Default
+ return 16;
+ }
+
+
+ /**
+ * Finds the corresponding configuration element and extracts the alignment
+ * information from it.
+ *
+ * @return either the configured alignment or the default alignment, never null.
+ */
+ private IdVerticalAlign getAlignment(AttributeValueString av) {
+ AttributeDefinitionString ad = av.getDefinition();
+ if (ad != null) {
+ DatatypeDefinitionString dd = ad.getType();
+ if (dd != null) {
+ ProrPresentationConfiguration config = ConfigurationUtil.getPresentationConfiguration(dd);
+ if (config instanceof IdConfiguration) {
+ return ((IdConfiguration) config).getVerticalAlign();
+ }
+ }
+ }
+ return IdVerticalAlign.CENTER;
+ }
+
+ public String doDrawHtmlContent(AttributeValue value) {
+ AttributeValueString av = (AttributeValueString) value;
+ return av.getTheValue();
+ }
+
+}
diff --git a/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdPresentationService.java b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdPresentationService.java
new file mode 100644
index 00000000..db79d3a5
--- /dev/null
+++ b/org.eclipse.rmf.reqif10.pror.presentation.id/src/org/eclipse/rmf/reqif10/pror/presentation/ui/IdPresentationService.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Formal Mind GmbH and University of Dusseldorf.
+ * 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:
+ * Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
+ ******************************************************************************/
+package org.eclipse.rmf.reqif10.pror.presentation.ui;
+
+import org.eclipse.rmf.reqif10.AttributeValueString;
+import org.eclipse.rmf.reqif10.pror.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.reqif10.pror.editor.presentation.service.AbstractPresentationService;
+import org.eclipse.rmf.reqif10.pror.presentation.id.IdFactory;
+import org.eclipse.rmf.reqif10.pror.presentation.id.impl.IdConfigurationImpl;
+
+/**
+ * A presentation to automatically assign human-readable IDs of the form
+ * Label-###, where ### is numeric. The ID is stored in an
+ * {@link AttributeValueString}.
+ * <p>
+ * The "hooking" takes place via {@link IdConfigurationImpl#registerReqIF()},
+ * which calls methods in this class.
+ * <p>
+ *
+ * TODOS:
+ * <ul>
+ * <li>Allow renaming of prefix
+ * <li>Prevent duplicates
+ * </ul>
+ *
+ * @author jastram
+ */
+public class IdPresentationService extends AbstractPresentationService {
+
+ public IdPresentationService() {
+ }
+
+ @Override
+ public ProrPresentationConfiguration getConfigurationInstance() {
+ return IdFactory.eINSTANCE.createIdConfiguration();
+ }
+}

Back to the top