Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2018-02-09 06:22:26 -0500
committerMarvin Mueller2018-02-19 07:38:55 -0500
commitfca7c87758533708673aeb4484b0b78112039c5c (patch)
treef6b36e605c9653d5f2a9af7f277516604c54e0f8
parent0eb96da4e20e83b4552f9f983147dd3bd5fa211f (diff)
downloadorg.eclipse.jubula.core-fca7c87758533708673aeb4484b0b78112039c5c.tar.gz
org.eclipse.jubula.core-fca7c87758533708673aeb4484b0b78112039c5c.tar.xz
org.eclipse.jubula.core-fca7c87758533708673aeb4484b0b78112039c5c.zip
Setting allowed values for parameters
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java18
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java53
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ParamDescriptionDTO.java17
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ValueSetDTO.java67
-rw-r--r--org.eclipse.jubula.client.core/META-INF/orm.xml2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/AbstractParamInterfaceBP.java55
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestCaseParamBP.java75
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestExecution.java2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IParamValueSetPO.java54
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITcParamDescriptionPO.java10
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IValueCommentPO.java44
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamValueSetPO.java122
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java17
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java1
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TcParamDescriptionPO.java40
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ValueCommentPO.java94
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/ContentAssistCellEditor.java1
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertydescriptors/ParamTextPropertyDescriptor.java25
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AbstractEditParametersDialog.java186
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/EditParametersValueSetDialog.java581
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/factory/TestDataControlFactory.java48
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractEditParametersHandler.java143
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java13
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties13
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java9
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CheckedParamTextContentAssisted.java27
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java62
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/search/refactor/pages/FillParameterValuesWizardPage.java5
-rw-r--r--org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java6
-rw-r--r--org.eclipse.jubula.documentation/releasenotes/en/docbook/8.6.0/features.xml14
-rw-r--r--org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithData/sectionUsingTheEditParametersDialog.xml14
-rw-r--r--org.eclipse.jubula.toolkit.api/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/i18n/jubulaI18n.properties2
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/Param.java15
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ParamValueSet.java15
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ValueSetElement.java29
36 files changed, 1783 insertions, 100 deletions
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java
index a787cbceb..5777bdf7e 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java
@@ -61,6 +61,7 @@ import org.eclipse.jubula.client.archive.dto.TestJobDTO;
import org.eclipse.jubula.client.archive.dto.TestSuiteDTO;
import org.eclipse.jubula.client.archive.dto.TestresultSummaryDTO;
import org.eclipse.jubula.client.archive.dto.UsedToolkitDTO;
+import org.eclipse.jubula.client.archive.dto.ValueSetDTO;
import org.eclipse.jubula.client.archive.dto.WhileDTO;
import org.eclipse.jubula.client.archive.i18n.Messages;
import org.eclipse.jubula.client.core.businessprocess.ProjectNameBP;
@@ -90,6 +91,7 @@ import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IObjectMappingPO;
import org.eclipse.jubula.client.core.model.IObjectMappingProfilePO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
import org.eclipse.jubula.client.core.model.IProjectPO;
import org.eclipse.jubula.client.core.model.IProjectPropertiesPO;
@@ -97,6 +99,7 @@ import org.eclipse.jubula.client.core.model.IRefTestSuitePO;
import org.eclipse.jubula.client.core.model.IReusedProjectPO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITDManager;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
import org.eclipse.jubula.client.core.model.ITestDataCategoryPO;
import org.eclipse.jubula.client.core.model.ITestDataCubePO;
import org.eclipse.jubula.client.core.model.ITestJobPO;
@@ -104,6 +107,7 @@ import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO.AlmReportStatus;
import org.eclipse.jubula.client.core.model.ITestSuitePO;
import org.eclipse.jubula.client.core.model.IUsedToolkitPO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.core.model.IWhileDoPO;
import org.eclipse.jubula.client.core.model.ReentryProperty;
import org.eclipse.jubula.client.core.persistence.CompNamePM;
@@ -384,6 +388,20 @@ public class JsonExporter {
} else {
pdDTO.setName(po.getName());
}
+ if (po instanceof ITcParamDescriptionPO) {
+ ITcParamDescriptionPO tcParamPo = (ITcParamDescriptionPO) po;
+ IParamValueSetPO valueSet = tcParamPo.getValueSet();
+ if (valueSet != null) {
+ List<IValueCommentPO> values = valueSet.getValues();
+ List<MapEntryDTO> valueDTOs = new ArrayList<>();
+ for (IValueCommentPO iValueCommentPO : values) {
+ valueDTOs.add(new MapEntryDTO(iValueCommentPO.getValue(),
+ iValueCommentPO.getComment()));
+ }
+ pdDTO.setValueSet(
+ new ValueSetDTO(valueSet.getDefaultValue(), valueDTOs));
+ }
+ }
pdDTO.setType(po.getType());
pdDTO.setUuid(po.getUniqueId());
}
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java
index 4348e32e8..2293a58e6 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java
@@ -69,6 +69,7 @@ import org.eclipse.jubula.client.archive.dto.TestJobDTO;
import org.eclipse.jubula.client.archive.dto.TestSuiteDTO;
import org.eclipse.jubula.client.archive.dto.TestresultSummaryDTO;
import org.eclipse.jubula.client.archive.dto.UsedToolkitDTO;
+import org.eclipse.jubula.client.archive.dto.ValueSetDTO;
import org.eclipse.jubula.client.archive.dto.WhileDTO;
import org.eclipse.jubula.client.archive.i18n.Messages;
import org.eclipse.jubula.client.core.Activator;
@@ -103,6 +104,7 @@ import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IObjectMappingPO;
import org.eclipse.jubula.client.core.model.IObjectMappingProfilePO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
import org.eclipse.jubula.client.core.model.IProjectPO;
import org.eclipse.jubula.client.core.model.IProjectPropertiesPO;
@@ -110,12 +112,14 @@ import org.eclipse.jubula.client.core.model.IRefTestSuitePO;
import org.eclipse.jubula.client.core.model.IReusedProjectPO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITDManager;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
import org.eclipse.jubula.client.core.model.ITestDataCategoryPO;
import org.eclipse.jubula.client.core.model.ITestDataCubePO;
import org.eclipse.jubula.client.core.model.ITestJobPO;
import org.eclipse.jubula.client.core.model.ITestResultSummaryPO;
import org.eclipse.jubula.client.core.model.ITestSuitePO;
import org.eclipse.jubula.client.core.model.IUsedToolkitPO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.core.model.IWhileDoPO;
import org.eclipse.jubula.client.core.model.NodeMaker;
import org.eclipse.jubula.client.core.model.PoMaker;
@@ -845,9 +849,9 @@ public class JsonImporter {
}
for (ParamDescriptionDTO pdDto : dto.getParameterDescription()) {
String uniqueId = pdDto.getUuid();
-
+ IParamDescriptionPO paramDesc = null;
if (assignNewGuid) {
- IParamDescriptionPO paramDesc =
+ paramDesc =
tc.addParameter(pdDto.getType(), pdDto.getName(), mapper);
m_oldToNewGuids.put(uniqueId, paramDesc.getUniqueId());
} else {
@@ -855,14 +859,21 @@ public class JsonImporter {
&& Pattern.matches(
"[0-9a-fA-F]{" + ImportExportUtil.UUID_LENGTH + "}", uniqueId)) { //$NON-NLS-1$ //$NON-NLS-2$
// use the existent guid for parameter
- tc.addParameter(pdDto.getType(), pdDto.getName(), uniqueId,
- mapper);
+ paramDesc = tc.addParameter(pdDto.getType(),
+ pdDto.getName(), uniqueId, mapper);
} else {
// creates a new GUID for parameter (only for conversion of
// old projects)
- tc.addParameter(pdDto.getType(), pdDto.getName(), mapper);
+ paramDesc = tc.addParameter(pdDto.getType(),
+ pdDto.getName(), mapper);
}
}
+ ValueSetDTO valueSetDto = pdDto.getValueSet();
+ if (paramDesc != null && valueSetDto != null
+ && paramDesc instanceof ITcParamDescriptionPO) {
+ fillValueSetToParamDesc((ITcParamDescriptionPO) paramDesc,
+ valueSetDto);
+ }
}
tc.setDataManager(createTDManager(tc, dto.getTDManager(),
@@ -873,6 +884,25 @@ public class JsonImporter {
}
return tc;
}
+
+ /**
+ * @param paramDesc the {@link ITcParamDescriptionPO} to fill
+ * @param valueSetDto the {@link ValueSetDTO}
+ */
+ private void fillValueSetToParamDesc(ITcParamDescriptionPO paramDesc,
+ ValueSetDTO valueSetDto) {
+ String defaultValue = valueSetDto.getDefaultValue();
+ List<MapEntryDTO> valueComment = valueSetDto.getValueComment();
+ List<IValueCommentPO> valuePos = new ArrayList<>();
+ for (MapEntryDTO mapEntryDTO : valueComment) {
+ valuePos.add(PoMaker.createValueComment(
+ mapEntryDTO.getKey(), mapEntryDTO.getValue()));
+ }
+ IParamValueSetPO valueSetPO = PoMaker.createParamValueSet();
+ valueSetPO.setDefaultValue(defaultValue);
+ valueSetPO.getValues().addAll(valuePos);
+ paramDesc.setValueSet(valueSetPO);
+ }
/**
* Creates the instance of the persistent object which is defined by the
@@ -1092,15 +1122,22 @@ public class JsonImporter {
PoMaker.createTestDataCubePO(dto.getName());
for (ParamDescriptionDTO dtoParamDesc
: dto.getParameterDescriptions()) {
+ IParamDescriptionPO paramDesc = null;
if (assignNewGuids) {
- IParamDescriptionPO paramDesc =
+ paramDesc =
testDataCube.addParameter(dtoParamDesc.getType(),
dtoParamDesc.getName(), mapper);
m_oldToNewGuids.put(dtoParamDesc.getUuid(),
paramDesc.getUniqueId());
} else {
- testDataCube.addParameter(dtoParamDesc.getType(), dtoParamDesc
- .getName(), dtoParamDesc.getUuid(), mapper);
+ paramDesc = testDataCube.addParameter(dtoParamDesc.getType(),
+ dtoParamDesc.getName(), dtoParamDesc.getUuid(), mapper);
+ }
+ ValueSetDTO valueSetDto = dtoParamDesc.getValueSet();
+ if (paramDesc instanceof ITcParamDescriptionPO
+ && valueSetDto != null) {
+ fillValueSetToParamDesc((ITcParamDescriptionPO) paramDesc,
+ valueSetDto);
}
}
testDataCube.setDataManager(createTDManager(testDataCube,
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ParamDescriptionDTO.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ParamDescriptionDTO.java
index 4e1068fbf..5d53cff42 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ParamDescriptionDTO.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ParamDescriptionDTO.java
@@ -18,6 +18,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class ParamDescriptionDTO {
/** */
private String m_name, m_type, m_uuid;
+ /** */
+ private ValueSetDTO m_valueSet;
/**
* @return name
@@ -63,4 +65,19 @@ public class ParamDescriptionDTO {
public void setUuid(String uuid) {
this.m_uuid = uuid;
}
+
+ /**
+ * @return the {@link ValueSetDTO} or null
+ */
+ @JsonProperty("valueSetData")
+ public ValueSetDTO getValueSet() {
+ return m_valueSet;
+ }
+
+ /**
+ * @param valueSet the {@link ValueSetDTO}
+ */
+ public void setValueSet(ValueSetDTO valueSet) {
+ m_valueSet = valueSet;
+ }
}
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ValueSetDTO.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ValueSetDTO.java
new file mode 100644
index 000000000..524dfcc49
--- /dev/null
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/ValueSetDTO.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH.
+ * 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:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.jubula.client.archive.dto;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public class ValueSetDTO {
+
+ /** */
+ private String m_defaultValue;
+ /** values with comment */
+ private List<MapEntryDTO> m_valueComment;
+ /** */
+ public ValueSetDTO() {
+
+ }
+ /**
+ * @param defaultValue default value
+ * @param valueComment values with comment
+ */
+ public ValueSetDTO(String defaultValue, List<MapEntryDTO> valueComment) {
+ m_defaultValue = defaultValue;
+ m_valueComment = valueComment;
+ }
+ /**
+ * @return the default value
+ */
+ @JsonProperty("defaultValue")
+ public String getDefaultValue() {
+ return m_defaultValue;
+ }
+ /**
+ * @param defaultValue the default value
+ */
+ public void setDefaultValue(String defaultValue) {
+ m_defaultValue = defaultValue;
+ }
+ /**
+ * @return the values with comment
+ */
+ @JsonProperty("valueSet")
+ public List<MapEntryDTO> getValueComment() {
+ return m_valueComment;
+ }
+ /**
+ * @param valueComment the values with comment
+ */
+ public void setValueComment(List<MapEntryDTO> valueComment) {
+ m_valueComment = valueComment;
+ }
+
+}
diff --git a/org.eclipse.jubula.client.core/META-INF/orm.xml b/org.eclipse.jubula.client.core/META-INF/orm.xml
index 3b308070a..0c7958cda 100644
--- a/org.eclipse.jubula.client.core/META-INF/orm.xml
+++ b/org.eclipse.jubula.client.core/META-INF/orm.xml
@@ -61,5 +61,7 @@
<entity class="org.eclipse.jubula.client.core.model.TestResultAdditionPO" />
<entity class="org.eclipse.jubula.client.core.model.DataCellPO" />
<entity class="org.eclipse.jubula.client.core.model.TestResultCleanupInfoPO" />
+ <entity class="org.eclipse.jubula.client.core.model.ParamValueSetPO" />
+ <entity class="org.eclipse.jubula.client.core.model.ValueCommentPO"/>
<embeddable class="org.eclipse.jubula.client.core.model.MonitoringValuePO" />
</entity-mappings>
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/AbstractParamInterfaceBP.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/AbstractParamInterfaceBP.java
index f0e4ba6f4..aa156eefa 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/AbstractParamInterfaceBP.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/AbstractParamInterfaceBP.java
@@ -12,6 +12,8 @@ package org.eclipse.jubula.client.core.businessprocess;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jubula.client.core.model.ICapPO;
@@ -23,6 +25,9 @@ import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITDManager;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.ITestDataCubePO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.core.model.PoMaker;
import org.eclipse.jubula.client.core.utils.ComboParamValidator;
import org.eclipse.jubula.client.core.utils.GuiParamValueConverter;
@@ -63,6 +68,8 @@ public abstract class AbstractParamInterfaceBP<T> {
} else if (obj instanceof ISpecTestCasePO) {
spec = (ISpecTestCasePO) obj;
dataManager = spec.getDataManager();
+ } else if (obj instanceof ITestDataCubePO) {
+ dataManager = obj.getDataManager();
}
if (dataManager != null && spec != null) {
List<String> uniqueIds = dataManager.getUniqueIds();
@@ -74,6 +81,20 @@ public abstract class AbstractParamInterfaceBP<T> {
list.add(value);
}
}
+ if (dataManager != null && spec == null) {
+ List<String> uniqueIds = dataManager.getUniqueIds();
+ for (int i = 0; i < uniqueIds.size(); i++) {
+ String uuid = uniqueIds.get(i);
+ IParamDescriptionPO uniqueID = obj
+ .getParameterForUniqueId(uuid);
+ String value = StringConstants.EMPTY;
+ if (uniqueID instanceof ITcParamDescriptionPO) {
+ value = ((ITcParamDescriptionPO) uniqueID).getValueSet()
+ .getDefaultValue();
+ }
+ list.add(value);
+ }
+ }
if (list.size() > 0) {
IDataSetPO dataSet = PoMaker.createListWrapperPO(list);
obj.getDataManager().insertDataSet(dataSet, row);
@@ -240,6 +261,17 @@ public abstract class AbstractParamInterfaceBP<T> {
}
}
+ IParamDescriptionPO paramForID =
+ specNode.getParameterForUniqueId(srcDesc.getUniqueId());
+ if (paramForID != null) {
+ if (paramForID instanceof ITcParamDescriptionPO) {
+ String defaultValue = ((ITcParamDescriptionPO) paramForID)
+ .getValueSet().getDefaultValue();
+ if (StringUtils.isNotEmpty(defaultValue)) {
+ return defaultValue;
+ }
+ }
+ }
return null;
}
/**
@@ -340,6 +372,29 @@ public abstract class AbstractParamInterfaceBP<T> {
IModifiableParameterInterfacePO obj, IParamNameMapper mapper) {
obj.addParameter(type, name, mapper);
}
+
+ /**
+ * @param name the new name of the parameter
+ * @param type the type of the parameter
+ * @param values the valuesets (value,comment)
+ * @param defaultValue the default value
+ * @param obj the object to add the parameter for
+ * @param mapper the mapper to resolve param names
+ */
+ public void addParameter(String name, String type,
+ Map<String, String> values, String defaultValue,
+ IModifiableParameterInterfacePO obj, IParamNameMapper mapper) {
+ IParamDescriptionPO addParameter = obj.addParameter(type, name, mapper);
+ if (addParameter instanceof ITcParamDescriptionPO) {
+ ITcParamDescriptionPO tcd = (ITcParamDescriptionPO) addParameter;
+ tcd.getValueSet().setDefaultValue(defaultValue);
+ List<IValueCommentPO> valueSet = tcd.getValueSet().getValues();
+ for (Entry<String, String> element : values.entrySet()) {
+ valueSet.add(PoMaker.createValueComment(element.getKey(),
+ element.getValue()));
+ }
+ }
+ }
/**
* @param desc
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestCaseParamBP.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestCaseParamBP.java
index 5f912c414..c2336dcc5 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestCaseParamBP.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestCaseParamBP.java
@@ -17,15 +17,19 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.eclipse.jubula.client.core.model.ICapPO;
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.core.model.INodePO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParamNodePO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITDManager;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.core.model.TDCell;
import org.eclipse.jubula.client.core.persistence.NodePM;
import org.eclipse.jubula.client.core.utils.GuiParamValueConverter;
@@ -35,6 +39,7 @@ import org.eclipse.jubula.tools.internal.xml.businessmodell.Action;
import org.eclipse.jubula.tools.internal.xml.businessmodell.CompSystem;
import org.eclipse.jubula.tools.internal.xml.businessmodell.Component;
import org.eclipse.jubula.tools.internal.xml.businessmodell.Param;
+import org.eclipse.jubula.tools.internal.xml.businessmodell.ValueSetElement;
/**
@@ -100,9 +105,13 @@ public class TestCaseParamBP extends AbstractParamInterfaceBP<ISpecTestCasePO> {
* @param result storage for results, owned by caller
*/
private static void getValuesForParameterImp(IParamNodePO node,
- String paramGUID, boolean isFirstCall,
- Set<Param> result) {
+ String paramGUID, boolean isFirstCall, Set<Param> result) {
if (node instanceof ISpecTestCasePO) {
+ ISpecTestCasePO spec = (ISpecTestCasePO) node;
+ boolean found = getParameterValueSet(paramGUID, result, spec);
+ if (found) {
+ return;
+ }
Iterator<INodePO> it = node.getNodeListIterator();
while (it.hasNext()) {
INodePO next = it.next();
@@ -127,19 +136,24 @@ public class TestCaseParamBP extends AbstractParamInterfaceBP<ISpecTestCasePO> {
}
}
} else if (node instanceof ICapPO) {
- ICapPO cap = (ICapPO)node;
- final CompSystem compSystem = ComponentBuilder.getInstance()
- .getCompSystem();
+ ICapPO cap = (ICapPO) node;
+ final CompSystem compSystem =
+ ComponentBuilder.getInstance().getCompSystem();
for (IParamDescriptionPO pd : cap.getParameterList()) {
try {
- String pID =
- cap.getDataManager().getCell(0, pd);
- if ((pID != null) // check for unset data
+ String pID = cap.getDataManager().getCell(0, pd);
+ if ((pID != null) // check for unset data
&& pID.endsWith(paramGUID)) {
- Component c = compSystem.findComponent(cap
- .getComponentType());
+ Component c = compSystem
+ .findComponent(cap.getComponentType());
Action a = c.findAction(cap.getActionName());
- result.add(a.findParam(pd.getUniqueId()));
+ Param findParam = a.findParam(pd.getUniqueId());
+ for (Iterator<ValueSetElement> iterator =
+ findParam.getValueSet().iterator(); iterator
+ .hasNext();) {
+ ValueSetElement param = iterator.next();
+ }
+ result.add(findParam);
}
} catch (IndexOutOfBoundsException e) {
// Cell for the given row and column does not exist
@@ -149,6 +163,41 @@ public class TestCaseParamBP extends AbstractParamInterfaceBP<ISpecTestCasePO> {
}
}
+ /**
+ *
+ * @param paramGUID the parameter to check
+ * @param result result storage for results, owned by caller
+ * @param spec the {@link ISpecTestCasePO}
+ * @return if there has a result been found <code>true</code>
+ */
+ private static boolean getParameterValueSet(String paramGUID,
+ Set<Param> result, ISpecTestCasePO spec) {
+ boolean found = false;
+ for (Iterator<IParamDescriptionPO> iterator =
+ spec.getParameterListIter(); iterator.hasNext();) {
+ IParamDescriptionPO param = iterator.next();
+ if (param.getUniqueId().equals(paramGUID)) {
+ if (param instanceof ITcParamDescriptionPO) {
+ IParamValueSetPO valueSet =
+ ((ITcParamDescriptionPO) param).getValueSet();
+ if ((valueSet != null)
+ && valueSet.getValues().size() > 0) {
+ Param param2 = new Param(param.getName(),
+ param.getType(),
+ valueSet.getValues().stream()
+ .collect(Collectors.toMap(
+ IValueCommentPO::getValue,
+ IValueCommentPO::getComment)));
+ result.add(param2);
+ param2.setOptional(false);
+ found = true;
+ }
+ }
+ }
+ }
+ return found;
+ }
+
@@ -257,7 +306,7 @@ public class TestCaseParamBP extends AbstractParamInterfaceBP<ISpecTestCasePO> {
* @param newGuid The new GUID to change the reference to.
* @param mapper The parameter name mapping used here to persist test data.
*/
- private void changeUsageReferences(Iterator childrenIt,
+ private void changeUsageReferences(Iterator<?> childrenIt,
IParamDescriptionPO desc, String newGuid,
ParamNameBPDecorator mapper) {
while (childrenIt.hasNext()) {
@@ -297,7 +346,7 @@ public class TestCaseParamBP extends AbstractParamInterfaceBP<ISpecTestCasePO> {
List<IExecTestCasePO> unusedTDExecList =
new LinkedList<IExecTestCasePO>();
- for (Iterator nodeIt = nodePO.getNodeListIterator();
+ for (Iterator<?> nodeIt = nodePO.getNodeListIterator();
nodeIt.hasNext();) {
final INodePO childNode = (INodePO)nodeIt.next();
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestExecution.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestExecution.java
index eea50d66b..b30f2fe0c 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestExecution.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/businessprocess/TestExecution.java
@@ -1624,7 +1624,7 @@ public class TestExecution {
LOG.error("ClassNotFoundException", e); //$NON-NLS-1$
fireError(e);
}
- Constructor constructor = null;
+ Constructor<?> constructor = null;
try {
constructor = cmdClazz.getConstructor(new Class[0]);
cmdInstance = constructor.newInstance(new Object[0]);
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IParamValueSetPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IParamValueSetPO.java
new file mode 100644
index 000000000..642310beb
--- /dev/null
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IParamValueSetPO.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH. 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: BREDEX GmbH - initial API and implementation and/or initial
+ * documentation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.jubula.client.core.model;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public interface IParamValueSetPO {
+
+ /**
+ * @return the id
+ */
+ Long getId();
+
+ /**
+ * @return the project id
+ */
+ Long getParentProjectId();
+ /**
+ *
+ * @param id the project id
+ */
+ void setParentProjectId(Long id);
+
+ /**
+ * @return a {@link Map} with the value as key and the comment as value
+ */
+ List<IValueCommentPO> getValues();
+
+ /**
+ * @return the default value
+ */
+ String getDefaultValue();
+
+ /**
+ * @param defaultValue the default value
+ */
+ void setDefaultValue(String defaultValue);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITcParamDescriptionPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITcParamDescriptionPO.java
index 6e9b3c213..2f3034231 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITcParamDescriptionPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ITcParamDescriptionPO.java
@@ -22,4 +22,14 @@ public interface ITcParamDescriptionPO extends IParamDescriptionPO {
* important for resolving of parameter names
*/
public void setParamNameMapper(IParamNameMapper mapper);
+
+ /**
+ * @return {@link IParamValueSetPO} for Value Sets and default value
+ */
+ public IParamValueSetPO getValueSet();
+
+ /**
+ * @param valueSet {@link IParamValueSetPO} for Value Sets and default value
+ */
+ public void setValueSet(IParamValueSetPO valueSet);
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IValueCommentPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IValueCommentPO.java
new file mode 100644
index 000000000..952a17167
--- /dev/null
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IValueCommentPO.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH. 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: BREDEX GmbH - initial API and implementation and/or initial
+ * documentation
+ *******************************************************************************/
+
+package org.eclipse.jubula.client.core.model;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public interface IValueCommentPO {
+
+ /**
+ * @return the persistence id
+ */
+ Long getId();
+
+ /**
+ * @return the value
+ */
+ String getValue();
+
+ /**
+ * @param value the value
+ */
+ void setValue(String value);
+
+ /**
+ * @return the comment
+ */
+ String getComment();
+
+ /**
+ * @param comment the comment
+ */
+ void setComment(String comment);
+
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamValueSetPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamValueSetPO.java
new file mode 100644
index 000000000..906b4413b
--- /dev/null
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ParamValueSetPO.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH. 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: BREDEX GmbH - initial API and implementation and/or initial
+ * documentation
+ *******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.jubula.client.core.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import org.eclipse.jubula.tools.internal.constants.StringConstants;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+@Entity
+@Table(name = "PARAM_VALUE_SETS")
+public class ParamValueSetPO implements IParamValueSetPO {
+ /** id */
+ private Long m_id;
+ /** project id */
+ private Long m_parentProjectID;
+ /** the map from values with comment */
+ private List<IValueCommentPO> m_values = new ArrayList<>();
+ /** the default value */
+ private String m_defaultValue;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return m_id;
+ }
+
+ /**
+ * @param id the persistence id
+ */
+ void setId(Long id) {
+ m_id = id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Column(name = "PARENT_PROJECT")
+ public Long getParentProjectId() {
+ return m_parentProjectID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setParentProjectId(Long parentProjectID) {
+ this.m_parentProjectID = parentProjectID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @OneToMany(fetch = FetchType.EAGER,
+ cascade = CascadeType.ALL,
+ targetEntity = ValueCommentPO.class, orphanRemoval = true)
+ @JoinColumn(name = "VALUE_SET_ID")
+ public List<IValueCommentPO> getValues() {
+ return m_values;
+ }
+
+ /**
+ * @param values {@link Map} with the value as key and the comment as value
+ */
+ void setValues(List<IValueCommentPO> values) {
+ m_values = values;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Column(name = "DEFAULT_VALUE")
+ public String getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDefaultValue(String defaultValue) {
+ m_defaultValue = defaultValue;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ public String toString() {
+ return getId() + StringConstants.SPACE + getDefaultValue()
+ + StringConstants.SPACE + getValues();
+ }
+
+}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java
index ec604ec3b..b04cc0ad0 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java
@@ -494,6 +494,23 @@ public abstract class PoMaker {
return new ComponentNamePO((ComponentNamePO) toClone);
}
+ /**
+ * @return a new {@link ParamValueSetPO}
+ */
+ public static IParamValueSetPO createParamValueSet() {
+ return new ParamValueSetPO();
+ }
+
+ /**
+ *
+ * @param value the value
+ * @param comment the comment
+ * @return a new instance of {@link ValueCommentPO}
+ */
+ public static IValueCommentPO createValueComment(
+ String value, String comment) {
+ return new ValueCommentPO(value, comment);
+ }
/**
* get the class instance of the PO (needed by Persistor)
* @return the class instance of the PO
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
index 91f06a5e4..45d3a8c4a 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TDManagerPO.java
@@ -327,6 +327,7 @@ class TDManagerPO implements ITDManager {
private String getCell(int dataSetRow, String uniqueId)
throws IllegalArgumentException {
int index = getUniqueIds().indexOf(uniqueId);
+ System.out.println(index);
if (index == -1) {
throw new IndexOutOfBoundsException(Messages.ParameterWithUniqueId
+ StringConstants.SPACE + uniqueId + StringConstants.SPACE
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TcParamDescriptionPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TcParamDescriptionPO.java
index abbfc5166..6c71ef064 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TcParamDescriptionPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/TcParamDescriptionPO.java
@@ -10,8 +10,11 @@
*******************************************************************************/
package org.eclipse.jubula.client.core.model;
+import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToOne;
import javax.persistence.Transient;
import org.eclipse.jubula.client.core.businessprocess.IParamNameMapper;
@@ -31,6 +34,8 @@ class TcParamDescriptionPO extends ParamDescriptionPO implements
* <code>m_mapper</code>mapper for resolving of param names
*/
private IParamNameMapper m_mapper = null;
+ /** the {@link IParamValueSetPO} for restricting values for a parameter */
+ private IParamValueSetPO m_paramValueSet = null;
/**
* only for Persistence (JPA / EclipseLink)
@@ -78,4 +83,39 @@ class TcParamDescriptionPO extends ParamDescriptionPO implements
return m_mapper;
}
+ /**
+ * {@inheritDoc}
+ */
+ @OneToOne(targetEntity = ParamValueSetPO.class, cascade = CascadeType.ALL)
+ @JoinColumn(name = "VALUE_SET_ID")
+ protected IParamValueSetPO getPersistenceValueSet() {
+ return m_paramValueSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Transient
+ public IParamValueSetPO getValueSet() {
+ if (m_paramValueSet == null) {
+ m_paramValueSet = new ParamValueSetPO();
+ m_paramValueSet.setParentProjectId(getParentProjectId());
+ }
+ return m_paramValueSet;
+ }
+ /**
+ * persistence method
+ * @param valueSet the value set
+ */
+ void setPersistenceValueSet(IParamValueSetPO valueSet) {
+ m_paramValueSet = valueSet;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setValueSet(IParamValueSetPO valueSet) {
+ setPersistenceValueSet(valueSet);
+ }
+
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ValueCommentPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ValueCommentPO.java
new file mode 100644
index 000000000..563569f02
--- /dev/null
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ValueCommentPO.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH. 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: BREDEX GmbH - initial API and implementation and/or initial
+ * documentation
+ *******************************************************************************/
+
+package org.eclipse.jubula.client.core.model;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+@Entity
+@Table(name = "PARAM_VALUE_VALUES")
+class ValueCommentPO implements IValueCommentPO {
+ /** */
+ private Long m_id;
+ /** */
+ private String m_value;
+ /** */
+ private String m_comment;
+ /** for persistence */
+ ValueCommentPO() {
+ // persistence
+ }
+ /**
+ * @param value value
+ * @param comment comment
+ */
+ public ValueCommentPO(String value, String comment) {
+ m_value = value;
+ m_comment = comment;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return m_id;
+ }
+ /**
+ * @param id persistence id
+ */
+ public void setId(Long id) {
+ m_id = id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Basic
+ @Column(name = "VALUE")
+ public String getValue() {
+ return m_value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setValue(String value) {
+ m_value = value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Basic
+ @Column(name = "VALUE_COMMENT")
+ public String getComment() {
+ return m_comment;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setComment(String comment) {
+ m_comment = comment;
+ }
+
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/ContentAssistCellEditor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/ContentAssistCellEditor.java
index e6666333a..f62e04a65 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/ContentAssistCellEditor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/ContentAssistCellEditor.java
@@ -106,6 +106,7 @@ public class ContentAssistCellEditor extends TextCellEditor {
@SuppressWarnings("synthetic-access")
public void proposalPopupClosed(
ContentProposalAdapter adapter) {
+ setFocus();
m_popupOpen = false;
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertydescriptors/ParamTextPropertyDescriptor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertydescriptors/ParamTextPropertyDescriptor.java
index 71b71d104..064228a8c 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertydescriptors/ParamTextPropertyDescriptor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertydescriptors/ParamTextPropertyDescriptor.java
@@ -10,9 +10,11 @@
*******************************************************************************/
package org.eclipse.jubula.client.ui.rcp.controllers.propertydescriptors;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
@@ -80,6 +82,24 @@ public class ParamTextPropertyDescriptor extends TextPropertyDescriptor
return values.toArray(new String[values.size()]);
}
+
+ /**
+ * @param valueSet alueSet Source for returned values. May be <code>null</code>.
+ * @return a {@link Map} with values as key and comments as value
+ */
+ public static Map<String, String> getValuesWithComment(
+ ParamValueSet valueSet) {
+ Map<String, String> valueToComment = new HashMap<>();
+ if (valueSet == null) {
+ return valueToComment;
+ }
+ Iterator<ValueSetElement> valueSetIter = valueSet.iterator();
+ while (valueSetIter.hasNext()) {
+ ValueSetElement value = valueSetIter.next();
+ valueToComment.put(value.getValue(), value.getComment());
+ }
+ return valueToComment;
+ }
/**
*
@@ -108,10 +128,11 @@ public class ParamTextPropertyDescriptor extends TextPropertyDescriptor
public CellEditor createPropertyEditor(Composite parent) {
AbstractParamValueController contr =
(AbstractParamValueController)getId();
+ ParamValueSet valuesSet = getValuesSet(contr.getParamNode(),
+ contr.getParamDesc().getUniqueId());
return new ContentAssistCellEditor(
parent, new ParamProposalProvider(
- getValues(getValuesSet(contr.getParamNode(),
- contr.getParamDesc().getUniqueId())),
+ getValuesWithComment(valuesSet),
contr.getParamNode(), contr.getParamDesc()),
new CheckedParamText.StringTextValidator(
contr.getParamNode(), contr.getParamDesc(),
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AbstractEditParametersDialog.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AbstractEditParametersDialog.java
index d89be2805..afa9d8673 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AbstractEditParametersDialog.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AbstractEditParametersDialog.java
@@ -15,8 +15,10 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
@@ -32,10 +34,12 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.ui.constants.ContextHelpIds;
import org.eclipse.jubula.client.ui.constants.IconConstants;
import org.eclipse.jubula.client.ui.rcp.Plugin;
@@ -104,7 +108,13 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
/** Name of the type-column */
private static final String TYPE_COL_NAME =
Messages.EditParametersDialogTypeTableColumnName;
-
+ /** Name of the default Value Column */
+ private static final String DEFAULT_VAL_COL_NAME =
+ Messages.EditParametersDialogDefaultValueTableColumnName;
+ /** Name of the Allowed Value Colum */
+ private static final String ALLOWED_VAL_COL_NAME =
+ Messages.EditParametersDialogValueSetTableColumnName;
+
/** Constant for an empty Cell entry */
private static final String EMPTY_ENTRY = StringUtils.EMPTY;
@@ -125,12 +135,16 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
/** Constant for the index of the type column of the table */
private static final int TYPE_TABLE_COLUMN = 1;
+ /** Constant for the index of the default value column of the table */
+ private static final int DEFAULT_TABLE_COLUMN = 2;
+ /** Constant for the index of the valueSet column of the table */
+ private static final int ALLOWED_TABLE_COLUMN = 3;
/**
* <code>TABLE_COLUMNS</code>
*/
- private static final String[] TABLE_COLUMNS =
- new String[]{NAME_COL_NAME, TYPE_COL_NAME};
+ private static final String[] TABLE_COLUMNS = new String[] { NAME_COL_NAME,
+ TYPE_COL_NAME, DEFAULT_VAL_COL_NAME, ALLOWED_VAL_COL_NAME };
/** The IParameterInterfacePO */
private IParameterInterfacePO m_paramInterfaceObj;
@@ -220,17 +234,6 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
public Object[] getElements(Object inputElement) {
return ((List)inputElement).toArray();
}
-
- /** {@inheritDoc} */
- public void dispose() {
- // nothing
- }
-
- /** {@inheritDoc} */
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- // nothing
- }
}
/**
@@ -378,7 +381,50 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
}
-
+ /**
+ * a value comment object for the valueSets
+ * @author BREDEX GmbH
+ */
+ public static final class ValueComment {
+ /** value */
+ private String m_value;
+ /** comment */
+ private String m_comment;
+ /**
+ * @param value value
+ * @param comment comment
+ */
+ public ValueComment(String value, String comment) {
+ super();
+ m_value = value;
+ m_comment = comment;
+ }
+ /**
+ * @return value
+ */
+ public String getValue() {
+ return m_value;
+ }
+ /**
+ * @param value value
+ */
+ public void setValue(String value) {
+ m_value = value;
+ }
+ /**
+ * @return comment
+ */
+ public String getComment() {
+ return StringUtils.defaultIfBlank(m_comment,
+ StringConstants.SPACE);
+ }
+ /**
+ * @param comment comment
+ */
+ public void setComment(String comment) {
+ m_comment = comment;
+ }
+ }
/**
* Inner data model for parameter
* @author BREDEX GmbH
@@ -392,6 +438,10 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
private String m_name = StringConstants.EMPTY;
/** The type */
private String m_type = StringConstants.EMPTY;
+ /** the Value sets with its comments */
+ private List<ValueComment> m_valueSet = new ArrayList<>();
+ /** the default value*/
+ private String m_defaultValue = StringConstants.EMPTY;
/**
@@ -421,6 +471,14 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
*/
public Parameter(IParamDescriptionPO descr) {
this(descr.getUniqueId(), descr.getName(), descr.getType());
+ if (descr instanceof ITcParamDescriptionPO) {
+ IParamValueSetPO valueSet =
+ ((ITcParamDescriptionPO) descr).getValueSet();
+ if (valueSet != null) {
+ setDefaultValue(valueSet.getDefaultValue());
+ setPersistenceValueSet(valueSet.getValues());
+ }
+ }
}
/**
@@ -465,8 +523,43 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
public String getGuid() {
return m_guid;
}
+ /**
+ * @return the ValueSet with its comments to each value
+ */
+ public List<ValueComment> getValueSet() {
+ return m_valueSet;
+ }
+ /**
+ * @param valueSet the ValueSet with its comments to each value
+ */
+ public void setPersistenceValueSet(List<IValueCommentPO> valueSet) {
+ m_valueSet.clear();
+ for (IValueCommentPO entry : valueSet) {
+ m_valueSet.add(
+ new ValueComment(entry.getValue(), entry.getComment()));
+ }
+ }
/**
+ * @param list the ValueSet with its comments to each value
+ */
+ public void setValueSet(List<ValueComment> list) {
+ m_valueSet = list;
+ }
+ /**
+ * @return default value
+ */
+ public String getDefaultValue() {
+ return m_defaultValue;
+ }
+ /**
+ * @param defaultValue default value
+ */
+ public void setDefaultValue(String defaultValue) {
+ m_defaultValue = defaultValue;
+ }
+
+ /**
* {@inheritDoc}
*/
public int hashCode() {
@@ -677,8 +770,11 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
final GridData buttonsGridData = new GridData();
buttonsGridData.grabExcessHorizontalSpace = true;
buttonsGridData.horizontalAlignment = GridData.FILL;
+ buttonsGridData.widthHint = 110;
+ buttonsGridData.minimumWidth = 110;
createAddButton(tableButtonArea, buttonsGridData);
createDeleteButton(tableButtonArea, buttonsGridData);
+ createEditValueSetButton(tableButtonArea, buttonsGridData);
LayoutUtil.createSeparator(tableButtonArea);
createUpButton(tableButtonArea, buttonsGridData);
createDownButton(tableButtonArea, buttonsGridData);
@@ -853,6 +949,55 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
afterAddButtonCreation(addButton);
return addButton;
}
+ /**
+ * @param parent parent
+ * @param layoutData the {@link GridData}
+ * @return the edit value set {@link Button}
+ */
+ private Button createEditValueSetButton(Composite parent,
+ GridData layoutData) {
+ final Button editButton = new Button(parent, SWT.NONE);
+ editButton.setText(Messages.EditParametersDialogEditValueSet);
+ editButton.setLayoutData(layoutData);
+ editButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ handleSelection(e);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ handleSelection(e);
+ }
+
+ /**
+ * Handles the selection
+ * @param e SelectionEvent
+ */
+ private void handleSelection(SelectionEvent e) {
+ IStructuredSelection structuredSelection =
+ m_paramTableViewer.getStructuredSelection();
+ Object firstElement = structuredSelection.getFirstElement();
+ if (firstElement instanceof Parameter) {
+ Parameter param = (Parameter) firstElement;
+ EditParametersValueSetDialog editDialog =
+ new EditParametersValueSetDialog(getShell(), param);
+ int status = editDialog.open();
+ if (status == Status.OK) {
+ param.setValueSet(editDialog.getValueSets());
+ param.setDefaultValue(editDialog.getDefaultValue());
+ getParamTableViewer().refresh();
+ }
+
+ }
+ }
+ });
+ final SelectionBasedButtonEnabler buttonEnabler =
+ new SelectionBasedButtonEnabler(editButton);
+ getParamTableViewer().addSelectionChangedListener(buttonEnabler);
+ editButton.setEnabled(!getParamTableViewer().getSelection().isEmpty());
+ return editButton;
+
+ }
/**
* subclasses may override
@@ -1026,7 +1171,12 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
case TYPE_TABLE_COLUMN:
final String paramType = parameter.getType();
return CompSystemI18n.getString(paramType, true);
-
+ case DEFAULT_TABLE_COLUMN:
+ return parameter.getDefaultValue();
+ case ALLOWED_TABLE_COLUMN:
+ return parameter.getValueSet().stream()
+ .map(value -> value.getValue())
+ .collect(Collectors.toList()).toString();
default:
StringBuilder msg = new StringBuilder();
msg.append(Messages.ColumnIndex)
@@ -1117,6 +1267,8 @@ public abstract class AbstractEditParametersDialog extends TitleAreaDialog {
}
if (isNewParameter(parameter)) {
parameter.setType(type);
+ parameter.setDefaultValue(StringConstants.EMPTY);
+ parameter.getValueSet().clear();
} else if (confirmChangeParamType()) { // already used Parameter
final int index = m_parameters.indexOf(parameter);
final Parameter newParam = new Parameter(parameter.getName(), type);
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/EditParametersValueSetDialog.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/EditParametersValueSetDialog.java
new file mode 100644
index 000000000..7812775a3
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/EditParametersValueSetDialog.java
@@ -0,0 +1,581 @@
+/*******************************************************************************
+ * Copyright (c) 2018 BREDEX GmbH. 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: BREDEX GmbH - initial API and implementation and/or initial
+ * documentation
+ *******************************************************************************/
+package org.eclipse.jubula.client.ui.rcp.dialogs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditor;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jubula.client.ui.constants.ContextHelpIds;
+import org.eclipse.jubula.client.ui.constants.IconConstants;
+import org.eclipse.jubula.client.ui.rcp.Plugin;
+import org.eclipse.jubula.client.ui.rcp.dialogs.AbstractEditParametersDialog.Parameter;
+import org.eclipse.jubula.client.ui.rcp.dialogs.AbstractEditParametersDialog.ValueComment;
+import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
+import org.eclipse.jubula.client.ui.utils.LayoutUtil;
+import org.eclipse.jubula.tools.internal.constants.StringConstants;
+import org.eclipse.jubula.tools.internal.constants.TestDataConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+import static org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent.TRAVERSAL;
+import static org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent.KEY_PRESSED;
+import static org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent.PROGRAMMATIC;
+import static org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public class EditParametersValueSetDialog extends TitleAreaDialog {
+
+ /** the index of the value column */
+ private static final int VALUE_COLUMN_INDEX = 0;
+ /** the index of the comment column */
+ private static final int COMMENT_COLUMN_INDEX = 1;
+ /** the comment column name */
+ private static final String COMMENT_COLUMN_NAME =
+ Messages.EditValueSetDialogCommentTableColumnName;
+ /** the value column name */
+ private static final String VALUE_COLUMN_NAME =
+ Messages.EditValueSetDialogValueTableColumnName;
+ /** the value set */
+ private List<ValueComment> m_valueSets = new ArrayList<>();
+ /** default value*/
+ private String m_defaultValue;
+ /** the type of the parameter*/
+ private String m_parameterType;
+
+ /** default value combo box*/
+ private Combo m_defaultValueCombo;
+ /** the table viewer */
+ private TableViewer m_tableViewer = null;
+
+ /**
+ * @param parentShell the parent shell
+ * @param param the {@link Parameter} to change to value set
+ */
+ public EditParametersValueSetDialog(Shell parentShell, Parameter param) {
+ super(parentShell);
+ m_parameterType = param.getType();
+ m_defaultValue = param.getDefaultValue();
+ for (ValueComment vc : param.getValueSet()) {
+ m_valueSets.add(new ValueComment(vc.getValue(), vc.getComment()));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Point getInitialSize() {
+ final Point initialSize = super.getInitialSize();
+ initialSize.y = 500;
+ return initialSize;
+ }
+
+ /**
+ * @return list of {@link ValueComment}
+ */
+ public List<ValueComment> getValueSets() {
+ return m_valueSets;
+ }
+
+ /**
+ * @return the default value String
+ */
+ public String getDefaultValue() {
+ return m_defaultValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void setShellStyle(int newShellStyle) {
+ super.setShellStyle(newShellStyle | SWT.RESIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Control createDialogArea(Composite parent) {
+ final String dialogTitle = Messages.EditValueSetDialogTitle;
+ setTitle(dialogTitle);
+ Plugin.getHelpSystem().setHelp(parent, ContextHelpIds.EDIT_PARAMETERS);
+ setHelpAvailable(true);
+ setMessage(Messages.EditValueSetDialogMessage);
+
+ getShell().setText(dialogTitle);
+
+ final GridLayout gridLayoutParent = new GridLayout();
+ gridLayoutParent.numColumns = 1;
+ parent.setLayout(gridLayoutParent);
+ LayoutUtil.createSeparator(parent);
+
+ final Composite area = new Composite(parent, SWT.NONE);
+ final GridLayout areaLayout = new GridLayout();
+ area.setLayout(areaLayout);
+ final GridData areaGridData = new GridData();
+ areaGridData.grabExcessVerticalSpace = true;
+ areaGridData.grabExcessHorizontalSpace = true;
+ areaGridData.horizontalAlignment = GridData.FILL;
+ areaGridData.verticalAlignment = GridData.FILL;
+ area.setLayoutData(areaGridData);
+
+ createTableComposite(area);
+ createDefaultValueCombo(area);
+ return parent;
+
+ }
+
+ /**
+ * @param parent the parent control
+ */
+ private void createDefaultValueCombo(Composite parent) {
+ final Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.EditValueSetDialogComboLabel);
+ m_defaultValueCombo = new Combo(parent, SWT.READ_ONLY);
+ final GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.BEGINNING;
+ gridData.minimumWidth = 150;
+ gridData.widthHint = 150;
+ m_defaultValueCombo.setLayoutData(gridData);
+ setComboBoxValues();
+
+ m_defaultValueCombo.addSelectionListener(
+ SelectionListener.widgetSelectedAdapter(c -> {
+ String[] items = m_defaultValueCombo.getItems();
+ int selectionIndex =
+ m_defaultValueCombo.getSelectionIndex();
+ if (selectionIndex >= 0
+ && selectionIndex < m_valueSets.size() + 1) {
+ m_defaultValue = items[selectionIndex];
+ }
+ }));
+ }
+ /**
+ * sets the comboboxValues according to the {@link #m_valueSets}
+ */
+ private void setComboBoxValues() {
+ int size = m_valueSets.size();
+ String[] values = (String[]) ArrayUtils.add(
+ m_valueSets.stream().map(ValueComment::getValue)
+ .collect(Collectors.toList()).toArray(new String[size]),
+ 0, StringConstants.EMPTY);
+ m_defaultValueCombo.setItems(values);
+ int indexOf = ArrayUtils.indexOf(values, m_defaultValue);
+ m_defaultValueCombo.select(indexOf == -1 ? 0 : indexOf);
+ }
+
+ /**
+ * creates the table and the add/remove buttons
+ * @param parent the parent control
+ */
+ private void createTableComposite(Composite parent) {
+ final Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.EditValueSetDialogTableLabel);
+
+ final Composite tableArea = new Composite(parent, SWT.NONE);
+ final GridLayout areaLayout = new GridLayout(2, false);
+ tableArea.setLayout(areaLayout);
+ final GridData tableAreaGridData = new GridData();
+ tableAreaGridData.grabExcessVerticalSpace = true;
+ tableAreaGridData.grabExcessHorizontalSpace = true;
+ tableAreaGridData.horizontalAlignment = GridData.FILL;
+ tableAreaGridData.verticalAlignment = GridData.FILL;
+ tableArea.setLayoutData(tableAreaGridData);
+
+ createValueSetTable(tableArea);
+
+ createTableButtons(tableArea);
+
+ }
+
+ /**
+ * @param parent the parent control
+ */
+ private void createTableButtons(Composite parent) {
+ final Composite tableButtonArea = new Composite(parent, SWT.NONE);
+ final GridLayout areaLayout = new GridLayout(1, true);
+ tableButtonArea.setLayout(areaLayout);
+ final GridData tableAreaGridData = new GridData();
+ tableAreaGridData.grabExcessVerticalSpace = true;
+ tableAreaGridData.horizontalAlignment = GridData.FILL;
+ tableAreaGridData.verticalAlignment = GridData.FILL;
+ tableButtonArea.setLayoutData(tableAreaGridData);
+
+ final GridData buttonsGridData = new GridData();
+ buttonsGridData.grabExcessHorizontalSpace = true;
+ buttonsGridData.horizontalAlignment = GridData.FILL;
+ createAddButton(tableButtonArea, buttonsGridData);
+ createDeleteButton(tableButtonArea, buttonsGridData);
+ LayoutUtil.createSeparator(tableButtonArea);
+
+ }
+
+ /**
+ * @param parent the parent control
+ * @param layoutData the LayoutData
+ */
+ private void createDeleteButton(Composite parent, GridData layoutData) {
+ final Button deleteButton = new Button(parent, SWT.NONE);
+ deleteButton.setText(Messages.EditParametersDialogRemove);
+ deleteButton.setLayoutData(layoutData);
+ deleteButton.addSelectionListener(
+ SelectionListener.widgetSelectedAdapter(c -> {
+ IStructuredSelection selection =
+ m_tableViewer.getStructuredSelection();
+ for (@SuppressWarnings("unchecked")
+ Iterator<ValueComment> iterator =
+ selection.iterator(); iterator.hasNext();) {
+ ValueComment valueComment = iterator.next();
+ m_valueSets.remove(valueComment);
+ m_tableViewer.refresh();
+ checkOKButton();
+ }
+ String item = m_defaultValueCombo
+ .getItem(m_defaultValueCombo.getSelectionIndex());
+ if (!doesExist(item)) {
+ setComboBoxValues();
+ m_defaultValueCombo.select(0);
+ m_defaultValue = null;
+ }
+ }));
+
+ }
+
+ /**
+ * @param parent the parent control
+ * @param layoutData the LayoutData
+ */
+ private void createAddButton(Composite parent, GridData layoutData) {
+ final Button addButton = new Button(parent, SWT.NONE);
+ addButton.setText(Messages.EditParametersDialogAdd);
+ addButton.setLayoutData(layoutData);
+ addButton.addSelectionListener(
+ SelectionListener.widgetSelectedAdapter(c -> {
+ m_valueSets.add(new ValueComment(StringConstants.EMPTY,
+ StringConstants.EMPTY));
+ m_tableViewer.refresh();
+ checkOKButton();
+ }));
+
+ }
+
+ /**
+ * @param parent the parent control
+ */
+ private void createValueSetTable(Composite parent) {
+ m_tableViewer = new TableViewer(parent,
+ SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ final GridData gridData = new GridData();
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.verticalAlignment = GridData.FILL;
+ Table table = m_tableViewer.getTable();
+ TableViewerColumn tvColumn1 =
+ new TableViewerColumn(m_tableViewer, SWT.NONE);
+ tvColumn1.getColumn().setText(VALUE_COLUMN_NAME);
+ tvColumn1.getColumn().setWidth(200);
+ TableViewerColumn tvColumn2 =
+ new TableViewerColumn(m_tableViewer, SWT.NONE);
+ tvColumn2.getColumn().setText(COMMENT_COLUMN_NAME);
+ tvColumn2.getColumn().setWidth(200);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ table.setLayoutData(gridData);
+ m_tableViewer.setColumnProperties(
+ new String[] { VALUE_COLUMN_NAME, COMMENT_COLUMN_NAME });
+ m_tableViewer.setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return ((List<?>) inputElement).toArray();
+ }
+ });
+ setLabelProvider();
+ m_tableViewer.setInput(m_valueSets);
+ final TextCellEditor textCellEditor = new TextCellEditor(table);
+ final ICellModifier cellModifier = createCellModifier();
+ m_tableViewer.setCellModifier(cellModifier);
+ m_tableViewer.setCellEditors(
+ new CellEditor[] { textCellEditor, textCellEditor });
+ ColumnViewerEditorActivationStrategy activationStrategy =
+ new ColumnViewerEditorActivationStrategy(m_tableViewer) {
+ protected boolean isEditorActivationEvent(
+ ColumnViewerEditorActivationEvent event) {
+ return event.eventType == TRAVERSAL
+ || event.eventType == MOUSE_CLICK_SELECTION
+ || (event.eventType == KEY_PRESSED
+ && event.keyCode == SWT.CR)
+ || event.eventType == PROGRAMMATIC;
+ }
+ };
+ TableViewerEditor.create(m_tableViewer,
+ activationStrategy,
+ ColumnViewerEditor.TABBING_HORIZONTAL
+ | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
+ | ColumnViewerEditor.KEYBOARD_ACTIVATION);
+
+ }
+
+ /**
+ * @return {@link ICellModifier}
+ */
+ private ICellModifier createCellModifier() {
+ final ICellModifier cellModifier = new ICellModifier() {
+
+ @Override
+ public void modify(Object element, String property, Object value) {
+ TableItem ti = (TableItem) element;
+ ValueComment vc = (ValueComment) ti.getData();
+ if (property.equals(VALUE_COLUMN_NAME)) {
+
+ vc.setValue(value.toString());
+ m_tableViewer.refresh();
+ int selectionIndex =
+ m_defaultValueCombo.getSelectionIndex();
+ setComboBoxValues();
+ if (selectionIndex < 0
+ && selectionIndex > m_defaultValueCombo
+ .getItems().length) {
+ m_defaultValueCombo.select(0);
+ } else {
+ String item =
+ m_defaultValueCombo.getItem(selectionIndex);
+ if (!doesExist(item)) {
+ m_defaultValueCombo.select(0);
+ m_defaultValue = m_defaultValueCombo.getItem(0);
+ } else {
+ m_defaultValueCombo.select(selectionIndex);
+ m_defaultValue = item;
+ }
+ }
+ } else if (property.equals(COMMENT_COLUMN_NAME)) {
+
+ vc.setComment(value.toString());
+ m_tableViewer.refresh();
+ }
+ checkOKButton();
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ ValueComment vc = (ValueComment) element;
+ if (property.equals(VALUE_COLUMN_NAME)) {
+ return vc.getValue();
+ } else if (property.equals(COMMENT_COLUMN_NAME)) {
+ return vc.getComment();
+
+ }
+ return null;
+ }
+
+ @Override
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ };
+ return cellModifier;
+ }
+
+ /**
+ * sets the label provider for the table viewer
+ */
+ private void setLabelProvider() {
+ m_tableViewer.setLabelProvider(new ITableLabelProvider() {
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ // nothing
+ }
+
+ @Override
+ public void dispose() {
+ // nothing
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ // nothing
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == VALUE_COLUMN_INDEX) {
+ final ValueComment valuecomment = (ValueComment) element;
+ String value = valuecomment.getValue();
+ if (StringConstants.EMPTY.equals(value.trim())
+ || isDuplicate(valuecomment)
+ || !isValidBoolean(value)
+ || !isValidInteger(value)) {
+
+ return IconConstants.ERROR_IMAGE;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof ValueComment) {
+ ValueComment entry = (ValueComment) element;
+ switch (columnIndex) {
+ case VALUE_COLUMN_INDEX:
+ return entry.getValue();
+ case COMMENT_COLUMN_INDEX:
+ return entry.getComment();
+ default:
+ break;
+ }
+ }
+ return null;
+ }
+
+ });
+ }
+
+ /**
+ * enables or disables the OK button base ond the {@link #isDataValid()} method
+ */
+ private void checkOKButton() {
+ getButton(IDialogConstants.OK_ID).setEnabled(isDataValid());
+ }
+
+ /**
+ * checks if the data is valid
+ * @return <code>true</code> if there is not empty entry and no double
+ */
+ private boolean isDataValid() {
+ Set<String> values = new HashSet<>();
+ for (ValueComment valueComment : m_valueSets) {
+ String value = valueComment.getValue();
+ if (StringUtils.isBlank(value)) {
+ setErrorMessage(Messages.EditValueSetDialogErrorEmpty);
+ return false;
+ }
+ boolean contains = values.contains(value);
+ if (contains) {
+ setErrorMessage(Messages.EditValueSetDialogErrorDuplicate);
+ return false;
+ }
+ if (!isValidBoolean(value)) {
+ setErrorMessage(Messages.EditValueSetDialogErrorNoBoolean);
+ return false;
+ }
+ if (!isValidInteger(value)) {
+ setErrorMessage(Messages.EditValueSetDialogErrorNoInt);
+ return false;
+ }
+ values.add(value);
+ }
+ setErrorMessage(null);
+ return true;
+ }
+
+ /**
+ * checks if the type is Integer and if the value is a valid integer
+ * @param value the value
+ * @return <code>true</code> if the {@link #m_parameterType} is integer and the value is parsable
+ */
+ private boolean isValidInteger(String value) {
+ if (TestDataConstants.INTEGER.equals(m_parameterType)) {
+ try {
+ Integer.parseInt(value);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * checks if the type is Integer and if the value is a valid integer
+ *
+ * @param value the value
+ * @return <code>true</code> if the {@link #m_parameterType} is boolean and
+ * the value is <code>true</code> or <code>false</code> ignoring the
+ * case
+ */
+ private boolean isValidBoolean(String value) {
+ if (TestDataConstants.BOOLEAN.equals(m_parameterType)) {
+ boolean valid = StringUtils
+ .equalsIgnoreCase(Boolean.TRUE.toString(), value)
+ || StringUtils.equalsIgnoreCase(
+ Boolean.FALSE.toString(), value);
+ if (!valid) {
+ return false;
+ }
+ }
+ return true;
+ }
+ /**
+ *
+ * @param vc the {@link ValueComment} to check
+ * @return <code>true</code> if the {@link ValueComment#getValue()} is already existing
+ */
+ private boolean isDuplicate(ValueComment vc) {
+ for (ValueComment valueComment : m_valueSets) {
+ if ((valueComment != null) && (vc != null)
+ && !vc.equals(valueComment) && StringUtils
+ .equals(vc.getValue(), valueComment.getValue())) {
+ return true;
+ }
+ }
+ return false;
+ }
+ /**
+ * @param value the value to check
+ * @return <code>true</code> if the values already exists in the {@link #m_valueSets}
+ */
+ private boolean doesExist(String value) {
+ for (ValueComment valueComment : m_valueSets) {
+ if (StringUtils.equals(value, valueComment.getValue())) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/factory/TestDataControlFactory.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/factory/TestDataControlFactory.java
index 754da657d..e68788773 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/factory/TestDataControlFactory.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/factory/TestDataControlFactory.java
@@ -14,14 +14,18 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import org.eclipse.jubula.client.core.businessprocess.AbstractParamInterfaceBP;
import org.eclipse.jubula.client.core.businessprocess.CapBP;
import org.eclipse.jubula.client.core.model.ICapPO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParamNodePO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
import org.eclipse.jubula.client.core.model.ITestDataCubePO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
import org.eclipse.jubula.client.core.utils.IParamValueValidator;
import org.eclipse.jubula.client.core.utils.StringHelper;
import org.eclipse.jubula.client.ui.rcp.controllers.propertydescriptors.ParamComboPropertyDescriptor;
@@ -30,7 +34,6 @@ import org.eclipse.jubula.client.ui.rcp.controllers.propertysources.AbstractNode
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
import org.eclipse.jubula.client.ui.rcp.widgets.CheckedParamText;
import org.eclipse.jubula.client.ui.rcp.widgets.CheckedParamTextContentAssisted;
-import org.eclipse.jubula.client.ui.rcp.widgets.FunctionProposalProvider;
import org.eclipse.jubula.client.ui.rcp.widgets.ParamProposalProvider;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.constants.TestDataConstants;
@@ -93,8 +96,9 @@ public class TestDataControlFactory {
Action action = CapBP.getAction(cap);
List<String> values = new ArrayList<String>();
Param param = action.findParam(paramDesc.getUniqueId());
- for (Iterator iter = param.valueSetIterator(); iter.hasNext();) {
- values.add(map.get(((ValueSetElement)iter.next()).getValue()));
+ for (Iterator<ValueSetElement> iter = param.valueSetIterator(); iter
+ .hasNext();) {
+ values.add(map.get((iter.next()).getValue()));
}
if (!values.isEmpty()) {
return new CheckedParamText(parent, style, cap, paramDesc,
@@ -109,8 +113,13 @@ public class TestDataControlFactory {
ParamTextPropertyDescriptor.getValuesSet(
paramNode, paramDesc.getUniqueId());
String [] values = ParamTextPropertyDescriptor.getValues(valueSet);
+ Map<String, String> valuesWithComment =
+ ParamTextPropertyDescriptor.getValuesWithComment(valueSet);
if (TestDataConstants.BOOLEAN.equals(paramDesc.getType())) {
values = BOOLEAN_VALUES;
+ valuesWithComment.clear();
+ valuesWithComment.put(BOOLEAN_VALUES[0], StringConstants.EMPTY);
+ valuesWithComment.put(BOOLEAN_VALUES[1], StringConstants.EMPTY);
}
return new CheckedParamTextContentAssisted(parent, style,
@@ -120,29 +129,50 @@ public class TestDataControlFactory {
valueSet != null ? valueSet.isCombinable() : false,
values),
new ParamProposalProvider(
- values, paramNode, paramDesc));
+ valuesWithComment, paramNode, paramDesc));
}
if (paramObj instanceof ITestDataCubePO) {
ITestDataCubePO tdc = (ITestDataCubePO)paramObj;
+ String[] values = getValuesFromValueSet(paramDesc);
if (TestDataConstants.BOOLEAN.equals(paramDesc.getType())) {
return new CheckedParamTextContentAssisted(parent, style,
tdc, paramDesc,
createParamValueValidator(
paramDesc.getType(),
false, BOOLEAN_VALUES),
- new FunctionProposalProvider());
+ new ParamProposalProvider(BOOLEAN_VALUES,
+ null, paramDesc));
}
- return new CheckedParamTextContentAssisted(parent, style,
- tdc, paramDesc,
- createParamValueValidator(paramDesc.getType(), false),
- new FunctionProposalProvider());
+ return new CheckedParamTextContentAssisted(parent, style, tdc,
+ paramDesc,
+ createParamValueValidator(paramDesc.getType(), false,
+ values),
+ new ParamProposalProvider(values, null, paramDesc));
}
Assert.notReached(Messages.ImplementFor + StringConstants.SPACE
+ paramObj.getClass().getName());
return null;
}
+
+ /**
+ *
+ * @param paramDesc the {@link IParamDescriptionPO} should be of type {@link ITcParamDescriptionPO}
+ * @return the values from the {@link IParamValueSetPO}
+ */
+ private static String[] getValuesFromValueSet(
+ IParamDescriptionPO paramDesc) {
+ String [] values = new String[0];
+ if (paramDesc instanceof ITcParamDescriptionPO) {
+ ITcParamDescriptionPO desc = (ITcParamDescriptionPO) paramDesc;
+ List<String> collect = desc.getValueSet().getValues().stream()
+ .map(IValueCommentPO::getValue)
+ .collect(Collectors.toList());
+ values = collect.toArray(new String[collect.size()]);
+ }
+ return values;
+ }
/**
* Creates a PropertyDescriptor depending on the given paramValController,
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractEditParametersHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractEditParametersHandler.java
index e07b9eda7..1b16d4f49 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractEditParametersHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/AbstractEditParametersHandler.java
@@ -15,17 +15,25 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jubula.client.core.businessprocess.AbstractParamInterfaceBP;
import org.eclipse.jubula.client.core.businessprocess.ParamNameBPDecorator;
import org.eclipse.jubula.client.core.businessprocess.TestCaseParamBP;
import org.eclipse.jubula.client.core.model.IModifiableParameterInterfacePO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
+import org.eclipse.jubula.client.core.model.IParamValueSetPO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
+import org.eclipse.jubula.client.core.model.ITcParamDescriptionPO;
import org.eclipse.jubula.client.core.model.ITestDataCubePO;
+import org.eclipse.jubula.client.core.model.IValueCommentPO;
+import org.eclipse.jubula.client.core.model.PoMaker;
import org.eclipse.jubula.client.ui.handlers.AbstractHandler;
import org.eclipse.jubula.client.ui.rcp.dialogs.AbstractEditParametersDialog.Parameter;
+import org.eclipse.jubula.client.ui.rcp.dialogs.AbstractEditParametersDialog.ValueComment;
import org.eclipse.jubula.client.ui.rcp.editors.IJBEditor;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
@@ -106,12 +114,10 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
* the param interface business process to use for model changes
* @return if occurs any modification of parameters
*/
- protected static
- <T extends IModifiableParameterInterfacePO> boolean editParameters(
- T paramIntObj,
- List<Parameter> parameters,
- boolean isInterfaceLocked,
- ParamNameBPDecorator mapper,
+ protected static <T extends IModifiableParameterInterfacePO>
+ boolean editParameters(
+ T paramIntObj, List<Parameter> parameters,
+ boolean isInterfaceLocked, ParamNameBPDecorator mapper,
AbstractParamInterfaceBP<T> paramInterfaceBP) {
Map<String, IParamDescriptionPO> oldParamsMap =
createOldParamsMap(paramIntObj);
@@ -130,6 +136,48 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
new HashMap<IParamDescriptionPO, String>();
Map<IParamDescriptionPO, String> paramsToChangeUsage =
new HashMap<IParamDescriptionPO, String>();
+ Map<IParamDescriptionPO, Parameter> paramsToUpdate = new HashMap<>();
+ fillMapsWithChanges(oldParamsMap, params, paramsToRename,
+ paramsToChangeUsage, paramsToUpdate);
+ // find parameters to remove
+ List<IParamDescriptionPO> paramsToRemove = findParamsToRemove(
+ parameters, oldParamsMap);
+ boolean isInterfaceLockedChanged = false;
+ ISpecTestCasePO specTc = null;
+ if (paramIntObj instanceof ISpecTestCasePO) {
+ specTc = (ISpecTestCasePO)paramIntObj;
+ isInterfaceLockedChanged = !((specTc).isInterfaceLocked()
+ == isInterfaceLocked);
+ TestCaseParamBP.setInterfaceLocked(specTc, isInterfaceLocked);
+ }
+ // update model
+ updateModel(paramIntObj, mapper, paramInterfaceBP, paramsToAdd,
+ paramsToRename, paramsToChangeUsage, paramsToRemove,
+ paramsToUpdate);
+ final boolean moved = moveParameters(paramIntObj, parameters);
+ // changes have been made, if one or more lists/maps are not empty
+ return !paramsToRemove.isEmpty()
+ || !paramsToAdd.isEmpty()
+ || !paramsToRename.isEmpty()
+ || !paramsToChangeUsage.isEmpty()
+ || !paramsToUpdate.isEmpty()
+ || moved
+ || isInterfaceLockedChanged;
+ }
+ /**
+ *
+ * @param oldParamsMap the old parameters for comparison
+ * @param params the maybe changed parmaters
+ * @param paramsToRename the map which parameter should be renamed
+ * @param paramsToChangeUsage the map which parameter should the usage be updated
+ * @param paramsToUpdate the map which parameter should the value set be updated
+ */
+ private static void fillMapsWithChanges(
+ Map<String, IParamDescriptionPO> oldParamsMap,
+ List<Parameter> params,
+ Map<IParamDescriptionPO, String> paramsToRename,
+ Map<IParamDescriptionPO, String> paramsToChangeUsage,
+ Map<IParamDescriptionPO, Parameter> paramsToUpdate) {
for (Parameter param : params) {
IParamDescriptionPO paramDescr = oldParamsMap.get(param.getGuid());
if (paramDescr != null) {
@@ -145,6 +193,37 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
paramNotRenamed.getGuid());
}
}
+ if (paramDescr instanceof ITcParamDescriptionPO) {
+ ITcParamDescriptionPO tcdesc =
+ (ITcParamDescriptionPO) paramDescr;
+ IParamValueSetPO valueSet = tcdesc.getValueSet();
+ List<IValueCommentPO> values = valueSet.getValues();
+ List<ValueComment> paramValues = param.getValueSet();
+ String paramDefault = param.getDefaultValue();
+ String valueSetDefault = valueSet.getDefaultValue();
+ if (!StringUtils.equals(valueSetDefault, paramDefault)) {
+ paramsToUpdate.put(tcdesc, param);
+ } else if (values.size() != paramValues.size()) {
+ paramsToUpdate.put(tcdesc, param);
+ } else {
+ for (ValueComment vcParam : paramValues) {
+ boolean found = false;
+ for (IValueCommentPO vc : values) {
+ if (StringUtils.equals(vcParam.getValue(),
+ (vc.getValue()))) {
+ found = true;
+ if (StringUtils.equals(vcParam.getComment(),
+ vc.getComment())) {
+ paramsToUpdate.put(tcdesc, param);
+ }
+ }
+ }
+ if (!found) {
+ paramsToUpdate.put(tcdesc, param);
+ }
+ }
+ }
+ }
} else {
Assert.notReached(Messages.UnexpectedError
+ StringConstants.COLON + StringConstants.SPACE
@@ -152,28 +231,6 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
+ StringConstants.DOT);
}
}
- // find parameters to remove
- List<IParamDescriptionPO> paramsToRemove = findParamsToRemove(
- parameters, oldParamsMap);
- boolean isInterfaceLockedChanged = false;
- ISpecTestCasePO specTc = null;
- if (paramIntObj instanceof ISpecTestCasePO) {
- specTc = (ISpecTestCasePO)paramIntObj;
- isInterfaceLockedChanged = !((specTc).isInterfaceLocked()
- == isInterfaceLocked);
- TestCaseParamBP.setInterfaceLocked(specTc, isInterfaceLocked);
- }
- // update model
- updateModel(paramIntObj, mapper, paramInterfaceBP, paramsToAdd,
- paramsToRename, paramsToChangeUsage, paramsToRemove);
- final boolean moved = moveParameters(paramIntObj, parameters);
- // changes have been made, if one or more lists/maps are not empty
- return !paramsToRemove.isEmpty()
- || !paramsToAdd.isEmpty()
- || !paramsToRename.isEmpty()
- || !paramsToChangeUsage.isEmpty()
- || moved
- || isInterfaceLockedChanged;
}
/**
@@ -187,6 +244,7 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
* @param paramsToRename The map of renamed parameters.
* @param paramsToChangeUsage The map of changed parameters.
* @param paramsToRemove The list of removed parameter descriptions.
+ * @param paramsToUpdate The list of updated value sets
*/
private static <T extends IModifiableParameterInterfacePO> void updateModel(
T paramIntObj, ParamNameBPDecorator mapper,
@@ -194,11 +252,16 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
List<Parameter> paramsToAdd,
Map<IParamDescriptionPO, String> paramsToRename,
Map<IParamDescriptionPO, String> paramsToChangeUsage,
- List<IParamDescriptionPO> paramsToRemove) {
+ List<IParamDescriptionPO> paramsToRemove,
+ Map<IParamDescriptionPO, Parameter> paramsToUpdate) {
// add
for (Parameter addParam : paramsToAdd) {
- paramInterfaceBP.addParameter(addParam.getName(), addParam
- .getType(), paramIntObj, mapper);
+ paramInterfaceBP.addParameter(addParam.getName(),
+ addParam.getType(),
+ addParam.getValueSet().stream()
+ .collect(Collectors.toMap(ValueComment::getValue,
+ ValueComment::getComment)),
+ addParam.getDefaultValue(), paramIntObj, mapper);
}
// remove
for (IParamDescriptionPO desc : paramsToRemove) {
@@ -214,6 +277,24 @@ public abstract class AbstractEditParametersHandler extends AbstractHandler {
paramInterfaceBP.changeUsageParameter(paramIntObj,
desc, paramsToChangeUsage.get(desc), mapper);
}
+ for (Entry<IParamDescriptionPO, Parameter> entry : paramsToUpdate
+ .entrySet()) {
+ if (entry.getKey() instanceof ITcParamDescriptionPO) {
+ ITcParamDescriptionPO tcDesc =
+ (ITcParamDescriptionPO) entry.getKey();
+ IParamValueSetPO valueSet = tcDesc.getValueSet();
+ Parameter param = entry.getValue();
+ valueSet.setDefaultValue(param.getDefaultValue());
+ List<IValueCommentPO> values = valueSet.getValues();
+ values.clear();
+ List<ValueComment> paramValues = param.getValueSet();
+ for (ValueComment valueComment : paramValues) {
+ values.add(
+ PoMaker.createValueComment(valueComment.getValue(),
+ valueComment.getComment()));
+ }
+ }
+ }
}
/**
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
index efc5d0eaa..8d2d119c8 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java
@@ -260,10 +260,12 @@ public class Messages extends NLS {
public static String EditorWillBeClosed;
public static String EditParametersDialogAdd;
public static String EditParametersDialogDefaultNewParameterName;
+ public static String EditParametersDialogDefaultValueTableColumnName;
public static String EditParametersDialogDown;
public static String EditParametersDialogDuplicateParamName;
public static String EditParametersDialogEditParameters;
public static String EditParametersDialogEditParamsOfTestCase;
+ public static String EditParametersDialogEditValueSet;
public static String EditParametersDialogEmptyParamName;
public static String EditParametersDialogLockInterface;
public static String EditParametersDialogNameTableColumnName;
@@ -272,10 +274,21 @@ public class Messages extends NLS {
public static String EditParametersDialogTestCaseName;
public static String EditParametersDialogTypeTableColumnName;
public static String EditParametersDialogUp;
+ public static String EditParametersDialogValueSetTableColumnName;
public static String EditParametersTDMDialogEditParameters;
public static String EditParametersTDMDialogEditParametersShellTitle;
public static String EditParametersTDMDialogEditParamsOfTestDataSet;
public static String EditParametersTDMDialogTdmName;
+ public static String EditValueSetDialogCommentTableColumnName;
+ public static String EditValueSetDialogComboLabel;
+ public static String EditValueSetDialogErrorNoBoolean;
+ public static String EditValueSetDialogErrorDuplicate;
+ public static String EditValueSetDialogErrorEmpty;
+ public static String EditValueSetDialogErrorNoInt;
+ public static String EditValueSetDialogMessage;
+ public static String EditValueSetDialogTableLabel;
+ public static String EditValueSetDialogTitle;
+ public static String EditValueSetDialogValueTableColumnName;
public static String Elements;
public static String ElementType;
public static String EnterAutIdDialogAutIdLabel;
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
index 0c764aecb..8763332fa 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties
@@ -244,10 +244,12 @@ EditorsSaveEditors=Save editor
EditorWillBeClosed=editor will be closed
EditParametersDialogAdd=&Add
EditParametersDialogDefaultNewParameterName=newParam
+EditParametersDialogDefaultValueTableColumnName=Default value
EditParametersDialogDown=&Down
EditParametersDialogDuplicateParamName=The name "{0}" is used for more than one parameter. Please use different names for each parameter.
EditParametersDialogEditParameters=Edit Parameters
EditParametersDialogEditParamsOfTestCase=Edit the Parameters of the Test Case
+EditParametersDialogEditValueSet=Edit Value Set
EditParametersDialogEmptyParamName=At least one parameter name is missing. Please provide a name for this parameter.
EditParametersDialogLockInterface=&Lock
EditParametersDialogNameTableColumnName=Name
@@ -256,10 +258,21 @@ EditParametersDialogRemove=&Remove
EditParametersDialogTestCaseName=Test Case Name\:
EditParametersDialogTypeTableColumnName=Type
EditParametersDialogUp=&Up
+EditParametersDialogValueSetTableColumnName=Value set
EditParametersTDMDialogEditParameters=Edit Test Data Set Parameters
EditParametersTDMDialogEditParametersShellTitle=Edit Test Data Set
EditParametersTDMDialogEditParamsOfTestDataSet=Edit the Interface of this Test Data Set
EditParametersTDMDialogTdmName=Test Data Set\:
+EditValueSetDialogComboLabel=Default Value:
+EditValueSetDialogCommentTableColumnName=Comment
+EditValueSetDialogErrorNoBoolean=At least one value is is not a Boolean.
+EditValueSetDialogErrorDuplicate=At least one value has a duplicate entry.
+EditValueSetDialogErrorEmpty=At least one value is missing.
+EditValueSetDialogErrorNoInt=At least one value is is not a Integer.
+EditValueSetDialogMessage=Edit the value which are allowed for the Parameter.
+EditValueSetDialogTableLabel=Values:
+EditValueSetDialogTitle=Edit Value Set
+EditValueSetDialogValueTableColumnName=Value
Elements=elements
ElementType=Element type
EnterAutIdDialogAutIdLabel=AUT ID\:
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
index 750998eaa..c136d931d 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
@@ -1622,6 +1622,15 @@ public abstract class AbstractDataSetPage extends Page
* Handles the CR keys
*/
private void handleCR() {
+ if (m_editor.getEditor()
+ instanceof CheckedParamTextContentAssisted) {
+ CheckedParamTextContentAssisted ed =
+ (CheckedParamTextContentAssisted)m_editor.getEditor();
+ if (ed.isAccepted()) {
+ ed.setAccepted(false);
+ return;
+ }
+ }
final Control editorControl = m_editor.getEditor();
if (!editorControl.isDisposed()) {
writeData();
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CheckedParamTextContentAssisted.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CheckedParamTextContentAssisted.java
index 9b909f372..ad629d68d 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CheckedParamTextContentAssisted.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CheckedParamTextContentAssisted.java
@@ -11,6 +11,8 @@
package org.eclipse.jubula.client.ui.rcp.widgets;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalListener;
import org.eclipse.jface.fieldassist.IContentProposalListener2;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.fieldassist.TextContentAdapter;
@@ -51,6 +53,10 @@ public class CheckedParamTextContentAssisted extends CheckedParamText {
/** is this content assistent active? */
private boolean m_popupOpen = false;
+ /** the accepted state*/
+ private boolean m_accepted;
+
+
/** controller for popupOpen */
private IContentProposalListener2Implementation m_popupListener;
@@ -82,6 +88,14 @@ public class CheckedParamTextContentAssisted extends CheckedParamText {
cpa.setFilterStyle(ContentProposalAdapter.FILTER_NONE);
cpa.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_INSERT);
cpa.addContentProposalListener(m_popupListener);
+ cpa.addContentProposalListener(new IContentProposalListener() {
+
+ @Override
+ public void proposalAccepted(IContentProposal proposal) {
+ m_accepted = true;
+
+ }
+ });
}
/**
@@ -90,4 +104,17 @@ public class CheckedParamTextContentAssisted extends CheckedParamText {
public boolean isPopupOpen() {
return m_popupOpen;
}
+ /**
+ * @return if the content was accepted
+ */
+ public boolean isAccepted() {
+ return m_accepted;
+ }
+ /**
+ *
+ * @param accepted the sccepted state
+ */
+ public void setAccepted(boolean accepted) {
+ m_accepted = accepted;
+ }
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java
index 17e84600e..fbe222f00 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java
@@ -15,6 +15,8 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.ArrayUtils;
@@ -31,6 +33,7 @@ import org.eclipse.jubula.client.core.utils.LiteralToken;
import org.eclipse.jubula.client.core.utils.SimpleStringConverter;
import org.eclipse.jubula.client.core.utils.SimpleValueToken;
import org.eclipse.jubula.client.core.utils.VariableToken;
+import org.eclipse.jubula.tools.internal.constants.StringConstants;
import org.eclipse.jubula.tools.internal.constants.TestDataConstants;
import org.eclipse.jubula.tools.internal.exception.InvalidDataException;
@@ -55,7 +58,8 @@ public class ParamProposalProvider implements IContentProposalProvider {
/** the content that will be inserted if this proposal is selected */
private String m_content;
-
+ /** description */
+ private String m_description;
/**
* Constructor
*
@@ -77,6 +81,19 @@ public class ParamProposalProvider implements IContentProposalProvider {
}
/**
+ * Constructor
+ *
+ * @param content The content of the proposal.
+ * @param displayValue The label for the proposal.
+ * @param description the description text.
+ */
+ public ParamProposal(String content, String displayValue,
+ String description) {
+ this(content, displayValue);
+ m_description = description;
+ }
+
+ /**
* {@inheritDoc}
*/
public String getContent() {
@@ -94,7 +111,7 @@ public class ParamProposalProvider implements IContentProposalProvider {
* {@inheritDoc}
*/
public String getDescription() {
- return null;
+ return StringUtils.defaultIfBlank(m_description, null);
}
/**
@@ -106,9 +123,8 @@ public class ParamProposalProvider implements IContentProposalProvider {
}
- /** fixed values */
- private String[] m_valueSet;
-
+ /** a map with values as key and comment as value */
+ private Map<String, String> m_valueToComment;
/** the node for which to provide proposals */
private INodePO m_node;
@@ -131,7 +147,26 @@ public class ParamProposalProvider implements IContentProposalProvider {
*/
public ParamProposalProvider(String[] valueSet, INodePO node,
IParamDescriptionPO paramDesc) {
- m_valueSet = valueSet;
+ for (String string : valueSet) {
+ m_valueToComment.put(string, StringConstants.EMPTY);
+ }
+ m_node = node;
+ m_paramDesc = paramDesc;
+ }
+
+ /**
+ * Constructor
+ *
+ * @param valueSet Fixed values to propose (for example, "true" and "false"
+ * for a boolean parameter).
+ * @param node The node to use as a base for dynamically generating
+ * proposals.
+ * @param paramDesc The param description to use as a base for dynamically
+ * generating proposals.
+ */
+ public ParamProposalProvider(Map<String, String> valueSet, INodePO node,
+ IParamDescriptionPO paramDesc) {
+ m_valueToComment = valueSet;
m_node = node;
m_paramDesc = paramDesc;
}
@@ -156,7 +191,7 @@ public class ParamProposalProvider implements IContentProposalProvider {
// if there are predefined values offer them first
- if (m_valueSet != null) {
+ if (m_valueToComment != null) {
proposals.addAll(getValueSetProposals(contents, position));
}
@@ -247,6 +282,9 @@ public class ParamProposalProvider implements IContentProposalProvider {
private Collection<IContentProposal> getParentVariableProposals(
String content, boolean varTypeParam) {
List<IContentProposal> props = new ArrayList<>();
+ if (m_node == null) {
+ return props;
+ }
INodePO spec = m_node.getSpecAncestor();
if (spec == null || content == null) {
return props;
@@ -378,14 +416,18 @@ public class ParamProposalProvider implements IContentProposalProvider {
sb.delete(position, sb.length());
sb.delete(0,
sb.lastIndexOf(TestDataConstants.COMBI_VALUE_SEPARATOR) + 1);
- for (String predefValue : m_valueSet) {
+ for (Entry<String, String> entry: m_valueToComment.entrySet()) {
+ String predefValue = entry.getKey();
+ String comment = entry.getValue();
if (predefValue.startsWith(sb.toString())) {
proposals.add(new ParamProposal(
- predefValue.substring(sb.length()), predefValue));
+ predefValue.substring(sb.length()), predefValue,
+ comment));
} else if (predefValue.startsWith(contents)) {
proposals.add(new ParamProposal(
predefValue.substring(
- contents.length()), predefValue));
+ contents.length()), predefValue,
+ comment));
}
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/search/refactor/pages/FillParameterValuesWizardPage.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/search/refactor/pages/FillParameterValuesWizardPage.java
index 30673d7f0..382ccef61 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/search/refactor/pages/FillParameterValuesWizardPage.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/search/refactor/pages/FillParameterValuesWizardPage.java
@@ -114,7 +114,10 @@ public class FillParameterValuesWizardPage extends AbstractMatchSelectionPage
SWT.NONE, null, paramDesc,
AbstractParamInterfaceBP.createParamValueValidator(
paramDesc.getType(), false, values),
- new ParamProposalProvider(values, null, paramDesc));
+ new ParamProposalProvider(
+ ParamTextPropertyDescriptor
+ .getValuesWithComment(valSet),
+ null, paramDesc));
fieldEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fieldEditor.addModifyListener(this);
m_valueTexts.put(paramDesc, fieldEditor);
diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java
index 00c0d7380..682a0df33 100644
--- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java
+++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java
@@ -298,7 +298,11 @@ public interface ContextHelpIds {
/** help context id for the edit parameters dialog */
public static final String EDIT_PARAMETERS = PRAEFIX
- + "editParametersDialogContextId"; //$NON-NLS-1$
+ + "editParameterValuesSetsDialogContextId"; //$NON-NLS-1$
+
+ /** help context id for the edit parameters dialog */
+ public static final String EDIT_PARAMETER_VALUESSETS = PRAEFIX
+ + "editParameterValueSetDialogContextId"; //$NON-NLS-1$
/** help context id for the edit parameters dialog */
public static final String EDIT_DESCRIPTION = PRAEFIX
diff --git a/org.eclipse.jubula.documentation/releasenotes/en/docbook/8.6.0/features.xml b/org.eclipse.jubula.documentation/releasenotes/en/docbook/8.6.0/features.xml
index 421573316..3d60debbf 100644
--- a/org.eclipse.jubula.documentation/releasenotes/en/docbook/8.6.0/features.xml
+++ b/org.eclipse.jubula.documentation/releasenotes/en/docbook/8.6.0/features.xml
@@ -12,7 +12,18 @@
xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xl="http://www.w3.org/1999/xlink">
<title>New Features and Developments</title>
-
+ <para>
+ <emphasis role="strong">Value sets for parameter</emphasis>
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ The data for new data set rows can now restricted to specific values.
+ Also it is possible to set a default value, so that new data sets begin with this value.
+ This is possible in the Edit Parameters dialog.
+ </para>
+ </listitem>
+</itemizedlist>
<para>
<emphasis role="strong">Possibility to reduce the amount of component name proposals</emphasis>
</para>
@@ -25,7 +36,6 @@
</para>
</listitem>
</itemizedlist>
-
<para>
<emphasis role="strong">New Teststyle to gather TODO's in the problems view</emphasis>
</para>
diff --git a/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithData/sectionUsingTheEditParametersDialog.xml b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithData/sectionUsingTheEditParametersDialog.xml
index f37835da4..a465bd22a 100644
--- a/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithData/sectionUsingTheEditParametersDialog.xml
+++ b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithData/sectionUsingTheEditParametersDialog.xml
@@ -20,6 +20,8 @@
section is concerned with using the dialog for editing
parameters in a Test Case. For editing parameters for a central
test data set, see the section later (<xref linkend="using-central-data-sets"/>).
+
+ Also there is the possibility to restrict the values which could be used in the data <xref linkend="editing-value-sets-for-parameter"/>.
</para>
<para>
To edit the parameters for a Test Case:
@@ -59,4 +61,16 @@
</para>
</listitem>
</orderedlist>
+ <section xml:id="editing-value-sets-for-parameter">
+ <anchor role="helpid" condition="editParameterValuesSetsDialogContextId"
+ xml:id="using-the-edit-parameters-dialog-to-add-edit-and-delete-references.editParameterValuesSetsDialogContextId"
+ xreflabel="Editing Parameter value sets"/>
+ <title>Add and edit ValueSets for Parameters</title>
+ <para>
+ After Selecting a Parameter in the Edit Parameters Dialog,
+ you can edit the allowed values for this parameter. Therefore the
+ Edit Value Set Dialog will be opened. You can add and remove values
+ in the allowed Values Table and select a default value in the combobox.
+ </para>
+ </section>
</section> \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api/META-INF/MANIFEST.MF b/org.eclipse.jubula.toolkit.api/META-INF/MANIFEST.MF
index 009f1db5c..89de8a858 100644
--- a/org.eclipse.jubula.toolkit.api/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.toolkit.api/META-INF/MANIFEST.MF
@@ -10,8 +10,8 @@ Bundle-ClassPath: .
Export-Package: org.eclipse.jubula.toolkit,
org.eclipse.jubula.toolkit.annotations,
org.eclipse.jubula.toolkit.enums,
- org.eclipse.jubula.toolkit.internal;x-internal:=true,
- org.eclipse.jubula.toolkit.internal.annotations;x-internal:=true
+ org.eclipse.jubula.toolkit.internal;x-friends:="org.eclipse.jubula.client.core",
+ org.eclipse.jubula.toolkit.internal.annotations;x-friends:="org.eclipse.jubula.client.core"
Require-Bundle: org.apache.commons.lang;bundle-version="[2.4.0,3.0.0)",
org.eclipse.jubula.tools;bundle-version="[4.0.0,5.0.0)",
org.eclipse.jubula.communication;bundle-version="[4.0.0,5.0.0)",
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/i18n/jubulaI18n.properties b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/i18n/jubulaI18n.properties
index 383617d83..5c18e92e7 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/i18n/jubulaI18n.properties
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/i18n/jubulaI18n.properties
@@ -462,7 +462,7 @@ org.eclipse.jubula.client.core.model.TestDataCubePO=Central Test Data Sets
org.eclipse.jubula.client.core.model.TestJobPO=Test Jobs
org.eclipse.jubula.client.core.model.TestSuitePO=Test Suites
org.eclipse.jubula.client.core.model.EventExecTestCasePO=Event Handler
-QuestionMessage.CHANGE_INTERFACE_CHANGE_PARAM_TYPE=If the type of an already used Parameter is changed, all data sets will be lost\!\nDo you want to continue?
+QuestionMessage.CHANGE_INTERFACE_CHANGE_PARAM_TYPE=If the type of an already used Parameter is changed, all data sets will be lost\!\nAll values from the value sets will be removed\!\n\nDo you want to continue?
QuestionMessage.CHANGE_INTERFACE_REMOVE_PARAM=If a Parameter is deleted, all its data sets will also be deleted\!\nDo you want to continue?
QuestionMessage.CLEAN_OM=All unused mappings will be removed\!\nDo you want to continue?
QuestionMessage.DELETE_ACTUAL_PROJECT=Do you really want to delete the currently opened Project?
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/Param.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/Param.java
index f05e329ee..0332a009c 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/Param.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/Param.java
@@ -11,6 +11,7 @@
package org.eclipse.jubula.tools.internal.xml.businessmodell;
import java.util.Iterator;
+import java.util.Map;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
@@ -57,6 +58,18 @@ public class Param {
public Param(String name, String type) {
m_name = name;
m_type = type;
+ }
+
+ /**
+ * Sets the member-variables m_name and m_type
+ * @param name A <code>String</code> value.
+ * @param type A <code>String</code> value.
+ * @param valueSet a ValueSet
+ */
+ public Param(String name, String type, Map<String, String> valueSet) {
+ m_name = name;
+ m_type = type;
+ m_valueSet = new ParamValueSet(valueSet);
}
/**
* @return The set of predefined values, may be of length <code>0</code>
@@ -105,7 +118,7 @@ public class Param {
* @return The iterator of the value set.<br>
* The elements of the Iterator are of the type <code>ValueSetElement</code>
*/
- public Iterator valueSetIterator() {
+ public Iterator<ValueSetElement> valueSetIterator() {
return getValueSet().iterator();
}
/**
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ParamValueSet.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ParamValueSet.java
index a372412b3..5a92e8db8 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ParamValueSet.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ParamValueSet.java
@@ -14,6 +14,8 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
/**
* Container for permitted values.
@@ -38,6 +40,19 @@ public class ParamValueSet {
public ParamValueSet() {
this(false);
}
+
+ /**
+ * Constructor. Equivalent to calling
+ * {@link ParamValueSet#ParamValueSet(boolean)} with <code>false</code>.
+ * @param valueSet a valueSet with comment
+ */
+ public ParamValueSet(Map<String, String> valueSet) {
+ this(false);
+ for (Entry<String, String> entry : valueSet.entrySet()) {
+ getValueSet().add(new ValueSetElement(entry.getKey(),
+ entry.getKey(), entry.getValue()));
+ }
+ }
/**
* Constructor
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ValueSetElement.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ValueSetElement.java
index b6505ce1f..82fc745cc 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ValueSetElement.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/xml/businessmodell/ValueSetElement.java
@@ -25,7 +25,9 @@ public class ValueSetElement {
private String m_name;
/** The value of the element. */
- private String m_value;
+ private String m_value;
+ /** a comment value of the element*/
+ private String m_comment;
/** Constructor. Used by deserialization only. */
public ValueSetElement() {
@@ -42,6 +44,17 @@ public class ValueSetElement {
m_name = name;
m_value = value;
}
+ /**
+ * The constructor.
+ * @param name The name (I18N key) of the element.
+ * @param value The value of the element.
+ * @param comment The comment to the value
+ */
+ public ValueSetElement(String name, String value, String comment) {
+ this(name, value);
+ m_comment = comment;
+ }
+
/** @return Returns the value. */
public String getValue() {
@@ -53,6 +66,20 @@ public class ValueSetElement {
return m_name;
}
+ /**
+ * @return the comment to the value
+ */
+ public String getComment() {
+ return m_comment;
+ }
+
+ /**
+ * @param comment the comment to the value
+ */
+ public void setComment(String comment) {
+ m_comment = comment;
+ }
+
/** {@inheritDoc} */
public boolean equals(Object obj) {
if (!(obj instanceof ValueSetElement)) {

Back to the top