aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Ladenberger2012-03-28 05:56:17 (EDT)
committerMichael Jastram2012-04-05 06:44:17 (EDT)
commit3bde70f45c61fe649c56ad0ec1ba44b4f217e151 (patch)
tree83c2a3d272bc267b2a6fd603a64d0180fea12d5f
parent4fff8ee6912914d319e874cade58b8d4f4865080 (diff)
downloadorg.eclipse.rmf-3bde70f45c61fe649c56ad0ec1ba44b4f217e151.zip
org.eclipse.rmf-3bde70f45c61fe649c56ad0ec1ba44b4f217e151.tar.gz
org.eclipse.rmf-3bde70f45c61fe649c56ad0ec1ba44b4f217e151.tar.bz2
added static method to return the left header column for a given
specification in ConfigurationUtil.java + used this new method in the specification editor
-rw-r--r--org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ConfigurationUtil.java32
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrAgileGridViewer.java8
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10ModelWizard.java7
3 files changed, 40 insertions, 7 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ConfigurationUtil.java b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ConfigurationUtil.java
index 039ba8f..39f0957 100644
--- a/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ConfigurationUtil.java
+++ b/org.eclipse.rmf.pror.reqif10.edit/src/org/eclipse/rmf/pror/reqif10/util/ConfigurationUtil.java
@@ -47,6 +47,9 @@ import org.eclipse.rmf.reqif10.util.Reqif10Util;
public class ConfigurationUtil {
+ public static final String DEFAULT_LEFT_HEADER_COLUMN_NAME = "Lead Header Column";
+ public static final int DEFAULT_LEFT_HEADER_COLUMN_WIDTH = 50;
+
/**
* @return The Configuration element for the given
* {@link DatatypeDefinition} or null if none is configured.
@@ -150,7 +153,31 @@ public class ConfigurationUtil {
extension));
return extension;
}
-
+
+ /**
+ * Returns the left header {@link Column} (which shows the hierarchy level)
+ * associated with this {@link Specification}. If it doesn't exist yet, it
+ * is created.
+ */
+ public static Column getLeftHeaderColumn(Specification specification,
+ EditingDomain domain) {
+
+ ProrSpecViewConfiguration specViewConfiguration = getSpecViewConfiguration(
+ specification, domain);
+
+ Column leftHeaderColumn = specViewConfiguration.getLeftHeaderColumn();
+
+ if (leftHeaderColumn == null) {
+ leftHeaderColumn = ConfigFactory.eINSTANCE.createColumn();
+ leftHeaderColumn.setLabel(DEFAULT_LEFT_HEADER_COLUMN_NAME);
+ leftHeaderColumn.setWidth(DEFAULT_LEFT_HEADER_COLUMN_WIDTH);
+ specViewConfiguration.setLeftHeaderColumn(leftHeaderColumn);
+ }
+
+ return leftHeaderColumn;
+
+ }
+
/**
* Finds the best labels, according to what is set in the preferences.
*
@@ -217,10 +244,10 @@ public class ConfigurationUtil {
* Retrieves the {@link ProrSpecViewConfiguration} for the given
* {@link Specification}. If none exists, it is built. The builder collects
* all attribute names of all SpecObjects and creates corresponding columns.
- * <p>
*/
public static ProrSpecViewConfiguration getSpecViewConfiguration(
Specification specification, EditingDomain domain) {
+
ProrToolExtension extension = getProrToolExtension(Reqif10Util.getReqIf(specification), domain);
EList<ProrSpecViewConfiguration> configs = extension
@@ -277,6 +304,7 @@ public class ConfigurationUtil {
specViewConfig));
return specViewConfig;
+
}
public static ProrPresentationConfiguration getPresentationConfig(AttributeValue value, EditingDomain domain) {
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrAgileGridViewer.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrAgileGridViewer.java
index 95c05ce..bd4b70b 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrAgileGridViewer.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/agilegrid/ProrAgileGridViewer.java
@@ -306,8 +306,9 @@ public class ProrAgileGridViewer extends Viewer {
public void columnResized(int col, int newWidth) {
// If the column index is -1 we resized the very first column,
// otherwise we resized a normal column
- Column column = (col == -1) ? specViewConfig
- .getLeftHeaderColumn() : specViewConfig.getColumns()
+ Column column = (col == -1) ? ConfigurationUtil
+ .getLeftHeaderColumn(specification, editingDomain)
+ : specViewConfig.getColumns()
.get(col);
if (column != null) {
Command cmd = SetCommand.create(editingDomain, column,
@@ -455,7 +456,8 @@ public class ProrAgileGridViewer extends Viewer {
*/
private void updateColumnInformation() {
EList<Column> cols = specViewConfig.getColumns();
- Column leftHeaderColumn = specViewConfig.getLeftHeaderColumn();
+ Column leftHeaderColumn = ConfigurationUtil.getLeftHeaderColumn(
+ specification, editingDomain);
// Handle first column
if (leftHeaderColumn != null)
agileGrid.getLayoutAdvisor().setLeftHeaderWidth(
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10ModelWizard.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10ModelWizard.java
index 74f6b1b..f221e61 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10ModelWizard.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/presentation/Reqif10ModelWizard.java
@@ -59,6 +59,7 @@ import org.eclipse.rmf.pror.reqif10.configuration.ProrGeneralConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.ProrSpecViewConfiguration;
import org.eclipse.rmf.pror.reqif10.configuration.ProrToolExtension;
import org.eclipse.rmf.pror.reqif10.provider.Reqif10EditPlugin;
+import org.eclipse.rmf.pror.reqif10.util.ConfigurationUtil;
import org.eclipse.rmf.reqif10.AttributeDefinitionString;
import org.eclipse.rmf.reqif10.AttributeValueString;
import org.eclipse.rmf.reqif10.DatatypeDefinitionString;
@@ -274,8 +275,10 @@ public class Reqif10ModelWizard extends Wizard implements INewWizard {
prorSpecViewConfiguration.getColumns().add(col);
Column leftHeaderColumn = ConfigFactory.eINSTANCE.createColumn();
- leftHeaderColumn.setWidth(50);
- leftHeaderColumn.setLabel("Left Header Column");
+ leftHeaderColumn
+ .setWidth(ConfigurationUtil.DEFAULT_LEFT_HEADER_COLUMN_WIDTH);
+ leftHeaderColumn
+ .setLabel(ConfigurationUtil.DEFAULT_LEFT_HEADER_COLUMN_NAME);
prorSpecViewConfiguration.setLeftHeaderColumn(leftHeaderColumn);
// Configure the Label configuration