| author | Kay Muench | 2012-04-12 10:06:06 (EDT) |
|---|---|---|
| committer | Michael Jastram | 2012-04-12 10:06:06 (EDT) |
| commit | 9440190397f313d0dfb5d197bc04961b81f9cf9e (patch) (side-by-side diff) | |
| tree | 061675ebdfc9395eac75eb9ab5eb16e6c0e78d09 | |
| parent | 7351a2053dc82ac7b2df84aabb3befebf2cb1c25 (diff) | |
| download | org.eclipse.rmf-9440190397f313d0dfb5d197bc04961b81f9cf9e.zip org.eclipse.rmf-9440190397f313d0dfb5d197bc04961b81f9cf9e.tar.gz org.eclipse.rmf-9440190397f313d0dfb5d197bc04961b81f9cf9e.tar.bz2 | |
Resolves https://bugs.eclipse.org/bugs/show_bug.cgi?id=374598
13 files changed, 545 insertions, 11 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/model/ID.ecore b/org.eclipse.rmf.pror.reqif10.presentation.id/model/ID.ecore index 6283279..4864951 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/model/ID.ecore +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/model/ID.ecore @@ -7,5 +7,11 @@ <eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="REQ-"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="count" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="verticalAlign" eType="#//IdVerticalAlign"
+ defaultValueLiteral="Top"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="IdVerticalAlign">
+ <eLiterals name="Top" literal="Top"/>
+ <eLiterals name="Center" value="1" literal="Center"/>
</eClassifiers>
</ecore:EPackage>
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/plugin.properties b/org.eclipse.rmf.pror.reqif10.presentation.id/plugin.properties index 76ece48..120a147 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/plugin.properties +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/plugin.properties @@ -25,6 +25,9 @@ _UI_ProRIdToolExtension_type = ProR Id Tool Extension _UI_IdConfiguration_type = ID-Generator for: {0} (count: {1})
_UI_IdConfiguration_type_not_set = ID-Generator for: (PLEASE SET TYPE)
_UI_IdConfiguration_type_feature = Type
+_UI_IdConfiguration_verticalAlign_feature = Vertical Align
+_UI_IdVerticalAlign_Top_literal = Top
+_UI_IdVerticalAlign_Center_literal = Center
_UI_XMLNamespaceDocumentRoot_type = Document Root
_UI_XMLNamespaceDocumentRoot_mixed_feature = Mixed
_UI_XMLNamespaceDocumentRoot_xMLNSPrefixMap_feature = XMLNS Prefix Map
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdConfiguration.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdConfiguration.java index 52d783f..1f42580 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdConfiguration.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdConfiguration.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.id;
@@ -24,6 +25,7 @@ import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration; * <ul>
* <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration#getPrefix <em>Prefix</em>}</li>
* <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration#getCount <em>Count</em>}</li>
+ * <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration#getVerticalAlign <em>Vertical Align</em>}</li>
* </ul>
* </p>
*
@@ -85,4 +87,34 @@ public interface IdConfiguration extends ProrPresentationConfiguration { */
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.pror.reqif10.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.pror.reqif10.presentation.id.IdVerticalAlign
+ * @see #setVerticalAlign(IdVerticalAlign)
+ * @see org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage#getIdConfiguration_VerticalAlign()
+ * @model default="Top"
+ * @generated
+ */
+ IdVerticalAlign getVerticalAlign();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.rmf.pror.reqif10.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.pror.reqif10.presentation.id.IdVerticalAlign
+ * @see #getVerticalAlign()
+ * @generated
+ */
+ void setVerticalAlign(IdVerticalAlign value);
+
} // IdConfiguration
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdPackage.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdPackage.java index 4d9b240..2966068 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdPackage.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdPackage.java @@ -7,12 +7,14 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.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.pror.reqif10.configuration.ConfigurationPackage;
@@ -102,13 +104,33 @@ public interface IdPackage extends EPackage { 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 + 2;
+ int ID_CONFIGURATION_FEATURE_COUNT = ConfigurationPackage.PROR_PRESENTATION_CONFIGURATION_FEATURE_COUNT + 3;
+
+
+ /**
+ * The meta object id for the '{@link org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign <em>Vertical Align</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign
+ * @see org.eclipse.rmf.pror.reqif10.presentation.id.impl.IdPackageImpl#getIdVerticalAlign()
+ * @generated
+ */
+ int ID_VERTICAL_ALIGN = 1;
/**
@@ -144,6 +166,27 @@ public interface IdPackage extends EPackage { EAttribute getIdConfiguration_Count();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.rmf.pror.reqif10.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.pror.reqif10.presentation.id.IdConfiguration#getVerticalAlign()
+ * @see #getIdConfiguration()
+ * @generated
+ */
+ EAttribute getIdConfiguration_VerticalAlign();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.rmf.pror.reqif10.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.pror.reqif10.presentation.id.IdVerticalAlign
+ * @generated
+ */
+ EEnum getIdVerticalAlign();
+
+ /**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -191,6 +234,24 @@ public interface IdPackage extends EPackage { */
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.pror.reqif10.presentation.id.IdVerticalAlign <em>Vertical Align</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign
+ * @see org.eclipse.rmf.pror.reqif10.presentation.id.impl.IdPackageImpl#getIdVerticalAlign()
+ * @generated
+ */
+ EEnum ID_VERTICAL_ALIGN = eINSTANCE.getIdVerticalAlign();
+
}
} //IdPackage
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdVerticalAlign.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/IdVerticalAlign.java new file mode 100644 index 0000000..0426013 --- a/dev/null +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/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.pror.reqif10.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.pror.reqif10.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.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java index 087a89b..2534bb2 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdConfigurationImpl.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.id.impl;
@@ -17,6 +18,7 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.rmf.pror.reqif10.configuration.impl.ProrPresentationConfigurationImpl;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
+import org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign;
/**
* <!-- begin-user-doc -->
@@ -27,6 +29,7 @@ import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage; * <ul>
* <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.impl.IdConfigurationImpl#getPrefix <em>Prefix</em>}</li>
* <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.impl.IdConfigurationImpl#getCount <em>Count</em>}</li>
+ * <li>{@link org.eclipse.rmf.pror.reqif10.presentation.id.impl.IdConfigurationImpl#getVerticalAlign <em>Vertical Align</em>}</li>
* </ul>
* </p>
*
@@ -74,6 +77,26 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple 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
@@ -139,6 +162,27 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple * <!-- 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) {
@@ -146,6 +190,8 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple return getPrefix();
case IdPackage.ID_CONFIGURATION__COUNT:
return getCount();
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ return getVerticalAlign();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -164,6 +210,9 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple case IdPackage.ID_CONFIGURATION__COUNT:
setCount((Integer)newValue);
return;
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ setVerticalAlign((IdVerticalAlign)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -182,6 +231,9 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple case IdPackage.ID_CONFIGURATION__COUNT:
setCount(COUNT_EDEFAULT);
return;
+ case IdPackage.ID_CONFIGURATION__VERTICAL_ALIGN:
+ setVerticalAlign(VERTICAL_ALIGN_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -198,6 +250,8 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple 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);
}
@@ -216,6 +270,8 @@ public class IdConfigurationImpl extends ProrPresentationConfigurationImpl imple result.append(prefix);
result.append(", count: ");
result.append(count);
+ result.append(", verticalAlign: ");
+ result.append(verticalAlign);
result.append(')');
return result.toString();
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdFactoryImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdFactoryImpl.java index 110b5bc..f4c1965 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdFactoryImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdFactoryImpl.java @@ -7,15 +7,18 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.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.pror.reqif10.presentation.id.*;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdFactory;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
@@ -76,6 +79,36 @@ public class IdFactoryImpl extends EFactoryImpl implements IdFactory { * <!-- 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;
@@ -86,6 +119,26 @@ public class IdFactoryImpl extends EFactoryImpl implements IdFactory { * <!-- 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();
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdPackageImpl.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdPackageImpl.java index 6d7641f..16e62a3 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdPackageImpl.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/impl/IdPackageImpl.java @@ -13,12 +13,14 @@ package org.eclipse.rmf.pror.reqif10.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.pror.reqif10.configuration.ConfigurationPackage;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdFactory;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
+import org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign;
import org.eclipse.rmf.reqif10.ReqIF10Package;
import org.eclipse.rmf.reqif10.datatypes.DatatypesPackage;
import org.eclipse.rmf.reqif10.xhtml.XhtmlPackage;
@@ -38,6 +40,13 @@ public class IdPackageImpl extends EPackageImpl implements IdPackage { 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.
@@ -136,6 +145,24 @@ public class IdPackageImpl extends EPackageImpl implements IdPackage { * <!-- 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();
}
@@ -162,6 +189,10 @@ public class IdPackageImpl extends EPackageImpl implements IdPackage { 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);
}
/**
@@ -201,6 +232,12 @@ public class IdPackageImpl extends EPackageImpl implements IdPackage { 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);
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java index 63f9650..2b88482 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/provider/IdConfigurationItemProvider.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.id.provider;
@@ -68,6 +69,7 @@ public class IdConfigurationItemProvider addPrefixPropertyDescriptor(object);
addCountPropertyDescriptor(object);
+ addVerticalAlignPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -117,6 +119,28 @@ public class IdConfigurationItemProvider }
/**
+ * 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 -->
@@ -157,6 +181,7 @@ public class IdConfigurationItemProvider 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;
}
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdAdapterFactory.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdAdapterFactory.java index e7714bb..d4722cb 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdAdapterFactory.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdAdapterFactory.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.id.util;
@@ -16,6 +17,7 @@ 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.pror.reqif10.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.pror.reqif10.presentation.id.*;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdSwitch.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdSwitch.java index 92d3985..cf30670 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdSwitch.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/id/util/IdSwitch.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.id.util;
@@ -15,6 +16,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
+import org.eclipse.rmf.pror.reqif10.presentation.id.*;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
import org.eclipse.rmf.pror.reqif10.presentation.id.IdPackage;
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java index d5b209b..725d79e 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IDPresentationService.java @@ -7,6 +7,7 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.ui;
diff --git a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IdLabelCellRenderer.java b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IdLabelCellRenderer.java index 68a60b8..bdc3cae 100644 --- a/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IdLabelCellRenderer.java +++ b/org.eclipse.rmf.pror.reqif10.presentation.id/src/org/eclipse/rmf/pror/reqif10/presentation/ui/IdLabelCellRenderer.java @@ -7,15 +7,21 @@ *
* Contributors:
* Michael Jastram - initial API and implementation
+ * Kay Münch - vertical alignment of the spec objects id
******************************************************************************/
package org.eclipse.rmf.pror.reqif10.presentation.ui;
import java.io.File;
+import org.eclipse.rmf.pror.reqif10.configuration.ProrPresentationConfiguration;
import org.eclipse.rmf.pror.reqif10.editor.presentation.service.IProrCellRenderer;
+import org.eclipse.rmf.pror.reqif10.presentation.id.IdConfiguration;
+import org.eclipse.rmf.pror.reqif10.presentation.id.IdVerticalAlign;
+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.AttributeValueSimple;
import org.eclipse.rmf.reqif10.AttributeValueString;
+import org.eclipse.rmf.reqif10.DatatypeDefinitionString;
import org.eclipse.rmf.reqif10.util.ReqIF10Util;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
@@ -23,20 +29,56 @@ import org.eclipse.swt.graphics.Rectangle; public class IdLabelCellRenderer implements IProrCellRenderer {
- public int doDrawCellContent(GC gc, Rectangle rect, Object value) {
- if (value instanceof AttributeValueSimple) {
- Object text = ReqIF10Util.getTheValue((AttributeValue) value);
- if (text != null) {
- gc.drawText(text.toString(), rect.x + 1, rect.y + 1);
- Point extend = gc.textExtent(value.toString());
- return extend.y + 2;
- }
- }
+ 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.getConfiguration(dd);
+ if (config instanceof IdConfiguration) {
+ return ((IdConfiguration) config).getVerticalAlign();
+ }
+ }
+ }
+ return IdVerticalAlign.CENTER;
+ }
+
public String doDrawHtmlContent(Object value, File folder) {
AttributeValueString av = (AttributeValueString) value;
return av.getTheValue();
|

