Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2018-02-06 03:52:05 -0500
committerMarvin Mueller2018-02-19 07:38:54 -0500
commit0eb96da4e20e83b4552f9f983147dd3bd5fa211f (patch)
tree10a00c58645286885b4d2b437c944d26deafdfa8
parent3b18abb178b1be629d76cde21c30509a854afe59 (diff)
downloadorg.eclipse.jubula.core-0eb96da4e20e83b4552f9f983147dd3bd5fa211f.tar.gz
org.eclipse.jubula.core-0eb96da4e20e83b4552f9f983147dd3bd5fa211f.tar.xz
org.eclipse.jubula.core-0eb96da4e20e83b4552f9f983147dd3bd5fa211f.zip
Adding the possibility to assign OM categories to spec TC
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonExporter.java9
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/JsonImporter.java32
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/OmCategoryDTO.java35
-rw-r--r--org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/TestCaseDTO.java18
-rw-r--r--org.eclipse.jubula.client.core/.externalToolBuilders/genParser.launch2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/AUTMainPO.java2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ComponentNamePO.java1
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IModifiableParameterInterfacePO.java2
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IObjectMappingCategoryPO.java10
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ISpecTestCasePO.java20
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ObjectMappingCategoryPO.java23
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/PoMaker.java27
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/SpecTestCasePO.java30
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java20
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/ObjectMappingPM.java65
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/utils/NativeSQLUtils.java51
-rw-r--r--org.eclipse.jubula.client.ui.rcp/.classpath2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/.project2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.properties1
-rw-r--r--org.eclipse.jubula.client.ui.rcp/plugin.xml5
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/OMEditorBP.java6
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/constants/RCPCommandIDs.java3
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertysources/SpecTestCaseGUIPropertySource.java47
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AssocOMtoSpecTCDialog.java535
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java23
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/ObjectMappingMultiPageEditor.java52
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/OMNewCategoryHandler.java2
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/EditorOMAssocHandler.java87
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/TCBEditOmAssocHandler.java91
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/Messages.java6
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/i18n/messages.properties5
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/provider/contentprovider/objectmapping/OMEditorTreeContentProvider.java25
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopUpTextField.java10
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopupTextCellEditor.java11
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamesProposalProvider.java64
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java1
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ParamProposalProvider.java7
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/pages/ImportXLSTestdataWizardPage.java1
-rw-r--r--org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/constants/ContextHelpIds.java4
-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/workWithEditors/content.xml1
-rw-r--r--org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/sectionObjectCategoryAssociation.xml35
43 files changed, 1333 insertions, 56 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 d8364224f..a787cbceb 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
@@ -19,6 +19,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import org.apache.commons.io.output.FileWriterWithEncoding;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -510,12 +511,17 @@ public class JsonExporter {
private void fillObjectMappingCategory(OmCategoryDTO categoryDTO,
IObjectMappingCategoryPO category) {
categoryDTO.setName(category.getName());
+ categoryDTO.setId(category.getId());
for (IObjectMappingCategoryPO subcategory : category
.getUnmodifiableCategoryList()) {
OmCategoryDTO mappedDTO = new OmCategoryDTO();
fillObjectMappingCategory(mappedDTO, subcategory);
categoryDTO.addCategories(mappedDTO);
+ IAUTMainPO aut = subcategory.getAutMainParent();
+ if (aut != null) {
+ categoryDTO.setAut(ImportExportUtil.i2str(aut.getId()));
+ }
}
for (IObjectMappingAssoziationPO assoc : category
.getUnmodifiableAssociationList()) {
@@ -662,6 +668,9 @@ public class JsonExporter {
addParamDesc(tcDTO, po);
tcDTO.setInterfaceLocked(po.isInterfaceLocked());
+ tcDTO.setAssocOMCategories(po.getOmCategoryAssoc().stream()
+ .map(IObjectMappingCategoryPO::getId)
+ .collect(Collectors.toList()));
addTestDataManager(tcDTO, po);
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 fd1a62d81..4348e32e8 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
@@ -18,6 +18,7 @@ import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import javax.persistence.EntityManager;
@@ -160,6 +161,9 @@ public class JsonImporter {
/** Mapping between old and new GUIDs. Only used when assigning new GUIDs */
private Map<String, String> m_oldToNewGuids =
new HashMap<String, String>();
+ /** old IDs to new {@link IObjectMappingCategoryPO}*/
+ private Map<Long, IObjectMappingCategoryPO> m_omCategories =
+ new HashMap<>();
/** The progress monitor for this importer. */
private IProgressMonitor m_monitor;
@@ -437,6 +441,10 @@ public class JsonImporter {
try {
ISpecTestCasePO tc = !newGuid && stcPo != null ? stcPo
: m_tcRef.get(m_oldToNewGuids.get(dto.getUuid()));
+ List<Long> omCategoryAssoc = dto.getAssocOMCategories();
+ tc.setOmCategoryAssoc(omCategoryAssoc.stream()
+ .map(m_omCategories::get)
+ .collect(Collectors.toList()));
for (NodeDTO stepDto : dto.getTestSteps()) {
if (stepDto instanceof CapDTO) {
tc.addNode(createCap(proj, (CapDTO)stepDto, newGuid));
@@ -1172,7 +1180,7 @@ public class JsonImporter {
aut.setToolkit(dto.getToolkit());
aut.setGenerateNames(dto.isGenerateNames());
m_autRef.put(dto.getId(), aut);
- aut.setObjMap(createOM(dto));
+ aut.setObjMap(createOM(dto, aut));
for (AutConfigDTO confdto : dto.getConfigs()) {
aut.addAutConfigToSet(createAUTConfig(confdto, assignNewGuid));
}
@@ -1220,11 +1228,13 @@ public class JsonImporter {
* DTO element used as parameter. The method generates all dependent objects
* as well.
* @param dto Abstraction of the DTO element
+ * @param aut
* @return a persistent object generated from the information in the DTO
* element
*/
- private IObjectMappingPO createOM(AutDTO dto) {
- IObjectMappingPO om = PoMaker.createObjectMappingPO();
+ private IObjectMappingPO createOM(AutDTO dto, IAUTMainPO aut) {
+ IObjectMappingPO om = PoMaker.createObjectMappingPO(
+ m_autRef.get(dto.getId()));
ObjectMappingDTO omDto = dto.getObjectMapping();
ObjectMappingProfileDTO profileSto = omDto.getProfile();
if (profileSto != null) {
@@ -1241,19 +1251,19 @@ public class JsonImporter {
OmCategoryDTO mappedCategoryDto = omDto.getMapped();
if (mappedCategoryDto != null) {
fillObjectMappingCategory(
- mappedCategoryDto, om.getMappedCategory());
+ mappedCategoryDto, om.getMappedCategory(), aut);
}
OmCategoryDTO unmappedComponentCategory = omDto.getUnmappedComponent();
if (unmappedComponentCategory != null) {
fillObjectMappingCategory(unmappedComponentCategory,
- om.getUnmappedLogicalCategory());
+ om.getUnmappedLogicalCategory(), aut);
}
OmCategoryDTO unmappedTechnicalCategory = omDto.getUnmappedTechnical();
if (unmappedTechnicalCategory != null) {
fillObjectMappingCategory(unmappedTechnicalCategory,
- om.getUnmappedTechnicalCategory());
+ om.getUnmappedTechnicalCategory(), aut);
}
return om;
@@ -1263,17 +1273,21 @@ public class JsonImporter {
* Write the information from the DTO element to its corresponding Object.
* @param categoryDto The DTO element which contains the information
* @param category The persistent object Object
+ * @param aut
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private void fillObjectMappingCategory(OmCategoryDTO categoryDto,
- IObjectMappingCategoryPO category) {
+ IObjectMappingCategoryPO category, IAUTMainPO aut) {
category.setName(categoryDto.getName());
+ category.setAutMainParent(aut);
+ m_omCategories.put(categoryDto.getId(), category);
for (OmCategoryDTO subcategoryDto : categoryDto.getCategories()) {
IObjectMappingCategoryPO subcategory =
- PoMaker.createObjectMappingCategoryPO(subcategoryDto.getName());
+ PoMaker.createObjectMappingCategoryPO(subcategoryDto.getName(),
+ m_autRef.get(categoryDto.getAut()));
category.addCategory(subcategory);
- fillObjectMappingCategory(subcategoryDto, subcategory);
+ fillObjectMappingCategory(subcategoryDto, subcategory, aut);
}
for (OmEntryDTO assocDTO : categoryDto.getAssociations()) {
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/OmCategoryDTO.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/OmCategoryDTO.java
index c5c257cf0..c6643db37 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/OmCategoryDTO.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/OmCategoryDTO.java
@@ -19,15 +19,33 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* @author BREDEX GmbH
*/
public class OmCategoryDTO {
-
+ /** the old database id */
+ private Long m_id;
/** */
private String m_name;
/** */
private List<OmEntryDTO> m_associations = new ArrayList<OmEntryDTO>();
/** */
private List<OmCategoryDTO> m_categories = new ArrayList<OmCategoryDTO>();
+ /** */
+ private String m_aut;
-
+ /**
+ * @return the id
+ */
+ @JsonProperty("id")
+ public Long getId() {
+ return m_id;
+ }
+
+ /**
+ *
+ * @param id the id
+ */
+ public void setId(Long id) {
+ m_id = id;
+ }
+
/**
* @return name
*/
@@ -72,4 +90,17 @@ public class OmCategoryDTO {
public void addCategories(OmCategoryDTO categorie) {
this.m_categories.add(categorie);
}
+ /**
+ * @return the id of{@link AutDTO}
+ */
+ public String getAut() {
+ return m_aut;
+ }
+
+ /**
+ * @param aut a id of a{@link AutDTO}
+ */
+ public void setAut(String aut) {
+ m_aut = aut;
+ }
}
diff --git a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/TestCaseDTO.java b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/TestCaseDTO.java
index b0acf140c..094efce65 100644
--- a/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/TestCaseDTO.java
+++ b/org.eclipse.jubula.client.archive/src/org/eclipse/jubula/client/archive/dto/TestCaseDTO.java
@@ -28,7 +28,8 @@ public class TestCaseDTO extends ParameterDTO {
new ArrayList<EventTestCaseDTO>(4);
/** */
private boolean m_interfaceLocked = false;
-
+ /** id list of object mapping categories*/
+ private List<Long> m_assocOMCategories = new ArrayList<>();
/** needed because JSON mapping */
public TestCaseDTO() { }
@@ -93,4 +94,19 @@ public class TestCaseDTO extends ParameterDTO {
public void setInterfaceLocked(boolean interfaceLocked) {
this.m_interfaceLocked = interfaceLocked;
}
+
+ /**
+ * @return the id list of Object Mapping categoires
+ */
+ @JsonProperty("omCategoryList")
+ public List<Long> getAssocOMCategories() {
+ return m_assocOMCategories;
+ }
+
+ /**
+ * @param categoryList the id list of Object Mapping categoires
+ */
+ public void setAssocOMCategories(List<Long> categoryList) {
+ m_assocOMCategories = categoryList;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/.externalToolBuilders/genParser.launch b/org.eclipse.jubula.client.core/.externalToolBuilders/genParser.launch
index 6e05f54ed..e42c94a02 100644
--- a/org.eclipse.jubula.client.core/.externalToolBuilders/genParser.launch
+++ b/org.eclipse.jubula.client.core/.externalToolBuilders/genParser.launch
@@ -13,7 +13,7 @@
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jubula.client.core"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/org.eclipse.jubula.releng/lib/sablecc/parameter.sable&quot; type=&quot;1&quot;/&gt;&#10;&lt;/resources&gt;}"/>
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/AUTMainPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/AUTMainPO.java
index 5168fc072..cbb81ccb2 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/AUTMainPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/AUTMainPO.java
@@ -105,7 +105,7 @@ class AUTMainPO implements IAUTMainPO {
*/
AUTMainPO(String autName, String guid) {
m_autName = autName;
- m_objMap = PoMaker.createObjectMappingPO();
+ m_objMap = PoMaker.createObjectMappingPO(this);
m_objMap.setParentProjectId(getParentProjectId());
m_guid = guid;
m_generateNames = false;
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ComponentNamePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ComponentNamePO.java
index 8f1e74a9e..032c0f73e 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ComponentNamePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ComponentNamePO.java
@@ -97,6 +97,7 @@ class ComponentNamePO extends AbstractGuidNamePO
m_creationContext = toClone.getHbmCreationContext();
m_version = toClone.getVersion();
m_typeProblem = toClone.getTypeProblem();
+ m_usageType = toClone.getUsageType();
setId(toClone.getId());
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IModifiableParameterInterfacePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IModifiableParameterInterfacePO.java
index 440f18688..a4bb1e9f3 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IModifiableParameterInterfacePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IModifiableParameterInterfacePO.java
@@ -61,7 +61,7 @@ public interface IModifiableParameterInterfacePO extends IParameterInterfacePO {
* times, if <code>false</code>, it will not be added if the
* <code>userDefName</code> already exists
* @param mapper mapper to resolve param names
- * * @return The new parameter description or null
+ * @return The new parameter description or null
*/
public abstract IParamDescriptionPO addParameter(
String type, String userDefName,
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IObjectMappingCategoryPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IObjectMappingCategoryPO.java
index dc4091f2f..2221ed1f4 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IObjectMappingCategoryPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/IObjectMappingCategoryPO.java
@@ -114,4 +114,14 @@ public interface IObjectMappingCategoryPO extends IPersistentObject {
* top-level category (has no parent category).
*/
public IObjectMappingCategoryPO getSection();
+
+ /**
+ * @return the {@link IAUTMainPO} where the category is from
+ */
+ public IAUTMainPO getAutMainParent();
+
+ /**
+ * @param autMainParent the {@link IAUTMainPO} where the category is from
+ */
+ public void setAutMainParent(IAUTMainPO autMainParent);
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ISpecTestCasePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ISpecTestCasePO.java
index c5608c720..c3629d101 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ISpecTestCasePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ISpecTestCasePO.java
@@ -8,8 +8,10 @@
* Contributors:
* BREDEX GmbH - initial API and implementation and/or initial documentation
*******************************************************************************/
-package org.eclipse.jubula.client.core.model;
-
+package org.eclipse.jubula.client.core.model;
+
+import java.util.List;
+
/**
* @author BREDEX GmbH
* @created 19.12.2005
@@ -30,5 +32,17 @@ public interface ISpecTestCasePO extends ITestCasePO,
/**
* @param isInterfaceLocked the isInterfaceLocked to set
*/
- public void setInterfaceLocked(Boolean isInterfaceLocked);
+ public void setInterfaceLocked(Boolean isInterfaceLocked);
+
+ /**
+ * Object Mapping category association are used to reduce the amount of proposals for component names
+ * @return a List of {@link IObjectMappingCategoryPO}
+ */
+ public List<IObjectMappingCategoryPO> getOmCategoryAssoc();
+
+ /**
+ * @param omCategoryAssoc a List of {@link IObjectMappingCategoryPO}
+ */
+ public void setOmCategoryAssoc(
+ List<IObjectMappingCategoryPO> omCategoryAssoc);
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ObjectMappingCategoryPO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ObjectMappingCategoryPO.java
index 62e07e1d6..41c5da9e4 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ObjectMappingCategoryPO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/ObjectMappingCategoryPO.java
@@ -62,7 +62,9 @@ public class ObjectMappingCategoryPO implements IObjectMappingCategoryPO {
/** parent of this category */
private IObjectMappingCategoryPO m_parent = null;
-
+
+ /** {@link IAUTMainPO} */
+ private IAUTMainPO m_autMainParent = null;
/**
* Default constructor (for Persistence (JPA / EclipseLink)).
*/
@@ -75,9 +77,11 @@ public class ObjectMappingCategoryPO implements IObjectMappingCategoryPO {
* Constructor
*
* @param name The name of the category.
+ * @param aut the {@link IAUTMainPO}
*/
- ObjectMappingCategoryPO(String name) {
+ ObjectMappingCategoryPO(String name, IAUTMainPO aut) {
setName(name);
+ setAutMainParent(aut);
}
/**
@@ -314,6 +318,21 @@ public class ObjectMappingCategoryPO implements IObjectMappingCategoryPO {
return section;
}
+ /**
+ * @return the {@link IAUTMainPO} where the category is from
+ */
+ @ManyToOne(targetEntity = AUTMainPO.class)
+ @JoinColumn(name = "AUTMAIN_ID")
+ public IAUTMainPO getAutMainParent() {
+ return m_autMainParent;
+ }
+
+ /**
+ * @param autMainParent the {@link IAUTMainPO} where the category is from
+ */
+ public void setAutMainParent(IAUTMainPO autMainParent) {
+ m_autMainParent = autMainParent;
+ }
/**
* {@inheritDoc}
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 3dd94b58f..ec604ec3b 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
@@ -128,12 +128,13 @@ public abstract class PoMaker {
/**
* factory method to replace constructor
- * @param name name
+ * @param name name
+ * @param aut the {@link IAUTMainPO}
* @return ObjectMappingCategoryPO
*/
public static IObjectMappingCategoryPO createObjectMappingCategoryPO(
- String name) {
- return new ObjectMappingCategoryPO(name);
+ String name, IAUTMainPO aut) {
+ return new ObjectMappingCategoryPO(name, aut);
}
/**
@@ -169,30 +170,32 @@ public abstract class PoMaker {
}
/**
- * factory method to replace constructor
+ * factory method to replace constructor
+ * @param aut the {@link IAUTMainPO} the category belongs to
* @return ObjectMappingPO
*/
- public static IObjectMappingPO createObjectMappingPO() {
- return createObjectMappingPO(createObjectMappingProfile());
+ public static IObjectMappingPO createObjectMappingPO(IAUTMainPO aut) {
+ return createObjectMappingPO(createObjectMappingProfile(), aut);
}
/**
* factory method to replace constructor
- * @param profilePo profilePo
+ * @param profilePo profilePo
+ * @param aut the {@link IAUTMainPO} the category belongs to
* @return ObjectMappingProfilePO
*/
public static IObjectMappingPO createObjectMappingPO(
- IObjectMappingProfilePO profilePo) {
+ IObjectMappingProfilePO profilePo, IAUTMainPO aut) {
IObjectMappingCategoryPO mappedCategory =
createObjectMappingCategoryPO(
- IObjectMappingCategoryPO.MAPPEDCATEGORY);
+ IObjectMappingCategoryPO.MAPPEDCATEGORY, aut);
IObjectMappingCategoryPO unmappedLogicalCategory =
createObjectMappingCategoryPO(
- IObjectMappingCategoryPO.UNMAPPEDLOGICALCATEGORY);
+ IObjectMappingCategoryPO.UNMAPPEDLOGICALCATEGORY, aut);
IObjectMappingCategoryPO unmappedTechnicalCategory =
createObjectMappingCategoryPO(
- IObjectMappingCategoryPO.UNMAPPEDTECHNICALCATEGORY);
+ IObjectMappingCategoryPO.UNMAPPEDTECHNICALCATEGORY, aut);
IObjectMappingPO map = new ObjectMappingPO(
mappedCategory, unmappedLogicalCategory,
@@ -661,7 +664,7 @@ public abstract class PoMaker {
*/
public static Class<TestCasePO> getTestCasePOClass() {
return TestCasePO.class;
- }
+ }
/**
* get the class instance of the PO (needed by Persistor)
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/SpecTestCasePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/SpecTestCasePO.java
index b68c87f37..7c3cca117 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/SpecTestCasePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/SpecTestCasePO.java
@@ -15,6 +15,10 @@ import java.util.List;
import javax.persistence.Basic;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.OneToMany;
import javax.persistence.Transient;
import org.apache.commons.lang.Validate;
@@ -54,6 +58,10 @@ class SpecTestCasePO extends TestCasePO implements ISpecTestCasePO {
* reserved flag for user defined InterfaceLocked state contrary to isReused state
*/
private Boolean m_isInterfaceLocked = false;
+ /** list of {@link IObjectMappingCategoryPO} to reduce the amount in the component name proposal*/
+ private List<IObjectMappingCategoryPO> m_omCategoryAssoc;
+
+
/**
* only for Persistence (JPA / EclipseLink)
@@ -267,4 +275,26 @@ class SpecTestCasePO extends TestCasePO implements ISpecTestCasePO {
return desc;
}
+ /**
+ * {@inheritDoc}
+ */
+ @OneToMany(
+ targetEntity = ObjectMappingCategoryPO.class,
+ fetch = FetchType.EAGER)
+ @JoinTable(name = "SPEC_OM_CATEGORIES", joinColumns = {
+ @JoinColumn(name = "SPEC_ID", referencedColumnName = "ID") },
+ inverseJoinColumns =
+ @JoinColumn(name = "OMC_ID", referencedColumnName = "ID"))
+ public List<IObjectMappingCategoryPO> getOmCategoryAssoc() {
+ return m_omCategoryAssoc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setOmCategoryAssoc(
+ List<IObjectMappingCategoryPO> omCategoryAssoc) {
+ m_omCategoryAssoc = omCategoryAssoc;
+ }
+
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java
index ce6993f2a..234b4b7ec 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/NodePM.java
@@ -39,6 +39,7 @@ import org.eclipse.jubula.client.core.model.ICategoryPO;
import org.eclipse.jubula.client.core.model.IEventExecTestCasePO;
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.core.model.INodePO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IPersistentObject;
import org.eclipse.jubula.client.core.model.IProjectPO;
import org.eclipse.jubula.client.core.model.IRefTestSuitePO;
@@ -1238,4 +1239,23 @@ public class NodePM extends PersistenceManager {
return result;
}
+ /**
+ * @param spec the {@link ISpecTestCasePO}
+ * @param selectedItems the new {@link IObjectMappingCategoryPO} to set
+ */
+ public static void setOMAssoc(ISpecTestCasePO spec,
+ Collection<IObjectMappingCategoryPO> selectedItems)
+ throws PMException, ProjectDeletedException {
+ EntityTransaction tx = null;
+ Persistor per = Persistor.instance();
+ EntityManager session = per.openSession();
+ ISpecTestCasePO sessionSpec =
+ session.find(spec.getClass(), spec.getId());
+ tx = per.getTransaction(session);
+ per.lockPO(session, spec);
+ sessionSpec.setOmCategoryAssoc(new ArrayList<>(selectedItems));
+ per.commitTransaction(session, tx);
+ refreshMasterSession(spec);
+ }
+
}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/ObjectMappingPM.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/ObjectMappingPM.java
new file mode 100644
index 000000000..da353f1a1
--- /dev/null
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/persistence/ObjectMappingPM.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.persistence;
+
+import java.util.Collection;
+import java.util.stream.Collectors;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Query;
+
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
+import org.eclipse.jubula.client.core.model.PoMaker;
+
+/**
+ * @author BREDEX GmbH
+ */
+public class ObjectMappingPM {
+
+ /**
+ * Utility
+ */
+ private ObjectMappingPM() {
+ // Utility
+ }
+
+ /**
+ * deletes the {@link IObjectMappingCategoryPO} and its assoc
+ * @param categories the categories to delete
+ */
+ public static void deleteOMCategories(
+ Collection<IObjectMappingCategoryPO> categories) {
+ if (categories.size() < 1) {
+ return;
+ }
+ EntityManager session = Persistor.instance().openSession();
+ EntityTransaction transaction = session.getTransaction();
+ transaction.begin();
+ final Query q = session.createQuery("DELETE FROM " //$NON-NLS-1$
+ + PoMaker.getObjectMappingAssoziationClass().getSimpleName()
+ + " assoc WHERE assoc.hbmCategory IN :ids"); //$NON-NLS-1$
+ q.setParameter("ids", //$NON-NLS-1$
+ categories.stream().map(IObjectMappingCategoryPO::getId)
+ .collect(Collectors.toList()));
+ final Query q2 = session.createQuery("DELETE FROM " //$NON-NLS-1$
+ + PoMaker.getObjectMappingCategoryClass().getSimpleName()
+ + " omc WHERE omc.id IN :ids"); //$NON-NLS-1$
+ q2.setParameter("ids", //$NON-NLS-1$
+ categories.stream().map(IObjectMappingCategoryPO::getId)
+ .collect(Collectors.toList()));
+ q.executeUpdate();
+ q2.executeUpdate();
+ transaction.commit();
+ }
+}
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/utils/NativeSQLUtils.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/utils/NativeSQLUtils.java
index cb7c6aff5..a8d644464 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/utils/NativeSQLUtils.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/utils/NativeSQLUtils.java
@@ -10,23 +10,29 @@
*******************************************************************************/
package org.eclipse.jubula.client.core.utils;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.persistence.EntityManager;
+import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jubula.client.core.model.INodePO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IPersistentObject;
import org.eclipse.jubula.client.core.model.IProjectPO;
import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+import org.eclipse.jubula.client.core.persistence.Persistor;
+import org.eclipse.jubula.tools.internal.constants.StringConstants;
/**
* Class helping handling native SQL queries
@@ -228,4 +234,49 @@ public class NativeSQLUtils {
}
return result;
}
+
+ /**
+ * @param omc the {@link IObjectMappingCategoryPO} which association should be removed
+ */
+ public static void removeOMCatAssoc(
+ IObjectMappingCategoryPO omc) {
+ EntityManager session = Persistor.instance().openSession();
+ EntityTransaction transaction = session.getTransaction();
+ transaction.begin();
+ Query query = session.createNativeQuery(
+ "DELETE FROM SPEC_OM_CATEGORIES WHERE OMC_ID = ?1"); //$NON-NLS-1$
+ query.setParameter(1, omc.getId());
+ query.executeUpdate();
+ transaction.commit();
+ }
+
+ /**
+ *
+ * @param sess the session
+ * @param deletedOMC the {@link IObjectMappingCategoryPO} which should be deleted
+ * @return the ids for the spec TC used in the specified OM association
+ */
+ public static List<BigDecimal> getSpecIdsforAssoc(EntityManager sess,
+ Set<IObjectMappingCategoryPO> deletedOMC) {
+ StringBuilder builder = new StringBuilder();
+ for (Iterator iterator = deletedOMC.iterator(); iterator.hasNext();) {
+ IObjectMappingCategoryPO cat =
+ (IObjectMappingCategoryPO) iterator.next();
+ if (cat != null && cat.getId() != null && cat.getId() > 0) {
+ builder.append(cat.getId());
+ if (iterator.hasNext()) {
+ builder.append(StringConstants.COMMA);
+ }
+ }
+ }
+ String string = builder.toString();
+ if (StringUtils.isBlank(string)) {
+ return new ArrayList<>();
+ }
+ Query query = sess.createNativeQuery(
+ "SELECT SPEC_ID FROM SPEC_OM_CATEGORIES WHERE OMC_ID in( ?1 )"); //$NON-NLS-1$
+ query.setParameter(1, string);
+ List resultList = query.getResultList();
+ return resultList;
+ }
}
diff --git a/org.eclipse.jubula.client.ui.rcp/.classpath b/org.eclipse.jubula.client.ui.rcp/.classpath
index 098194ca4..eca7bdba8 100644
--- a/org.eclipse.jubula.client.ui.rcp/.classpath
+++ b/org.eclipse.jubula.client.ui.rcp/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.jubula.client.ui.rcp/.project b/org.eclipse.jubula.client.ui.rcp/.project
index e52281796..23e3efb90 100644
--- a/org.eclipse.jubula.client.ui.rcp/.project
+++ b/org.eclipse.jubula.client.ui.rcp/.project
@@ -35,7 +35,7 @@
<link>
<name>.settings</name>
<type>2</type>
- <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.jubula.project.configuration/settings/1.7</locationURI>
+ <locationURI>PARENT-1-PROJECT_LOC/org.eclipse.jubula.project.configuration/settings/1.8</locationURI>
</link>
</linkedResources>
<filteredResources>
diff --git a/org.eclipse.jubula.client.ui.rcp/META-INF/MANIFEST.MF b/org.eclipse.jubula.client.ui.rcp/META-INF/MANIFEST.MF
index 2b8dd3518..fd9fbc83a 100644
--- a/org.eclipse.jubula.client.ui.rcp/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.client.ui.rcp/META-INF/MANIFEST.MF
@@ -83,4 +83,4 @@ Require-Bundle: org.eclipse.jubula.tools;bundle-version="[4.0.0,5.0.0)",
org.eclipse.jubula.toolkit.html;bundle-version="[3.1.0,5.0.0)",
org.eclipse.ui.views.log;bundle-version="[1.0.600,2.0.0)"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.properties b/org.eclipse.jubula.client.ui.rcp/plugin.properties
index 85eb25dc0..bb2622301 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.properties
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.properties
@@ -47,6 +47,7 @@ Edit=&Edit
EditedGoBack=Previous Edited Editor
EditedGoForward=Next Edited Editor
EditParameters=&Edit Parameters
+EditOMAssoc=Edit OM Association
Editor=Editors
EventHandler=New Event &Handler
Expand=E&xpand
diff --git a/org.eclipse.jubula.client.ui.rcp/plugin.xml b/org.eclipse.jubula.client.ui.rcp/plugin.xml
index 4a1ecbba2..2804448ee 100644
--- a/org.eclipse.jubula.client.ui.rcp/plugin.xml
+++ b/org.eclipse.jubula.client.ui.rcp/plugin.xml
@@ -2173,6 +2173,7 @@
</command>
<command
commandId="org.eclipse.jubula.client.ui.rcp.commands.EditOMAssoc"
+ label="%EditOMAssoc"
style="push">
</command>
<command
@@ -2672,7 +2673,7 @@
</enabledWhen>
</handler>
<handler
- class="org.eclipse.jubula.client.ui.rcp.handlers.TCBEditOmAssocHandler"
+ class="org.eclipse.jubula.client.ui.rcp.handlers.edit.TCBEditOmAssocHandler"
commandId="org.eclipse.jubula.client.ui.rcp.commands.EditOMAssoc">
<activeWhen>
<with variable="activePartId">
@@ -3858,7 +3859,7 @@
</activeWhen>
</handler>
<handler
- class="org.eclipse.jubula.client.ui.rcp.handlers.EditorOMAssocHandler"
+ class="org.eclipse.jubula.client.ui.rcp.handlers.edit.EditorOMAssocHandler"
commandId="org.eclipse.jubula.client.ui.rcp.commands.EditOMAssoc">
<activeWhen>
<and>
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/OMEditorBP.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/OMEditorBP.java
index 932a1131b..e7fe4ec58 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/OMEditorBP.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/businessprocess/OMEditorBP.java
@@ -149,7 +149,8 @@ public class OMEditorBP {
if (subcategory == null) {
// Create new category
subcategory =
- PoMaker.createObjectMappingCategoryPO(catName);
+ PoMaker.createObjectMappingCategoryPO(catName,
+ getEditor().getAut());
newCategory.addCategory(subcategory);
}
newCategory = subcategory;
@@ -321,7 +322,8 @@ public class OMEditorBP {
}
if (!childExists) {
IObjectMappingCategoryPO newCat =
- PoMaker.createObjectMappingCategoryPO(pathEntry);
+ PoMaker.createObjectMappingCategoryPO(pathEntry,
+ getEditor().getAut());
curCat.addCategory(newCat);
curCat = newCat;
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/constants/RCPCommandIDs.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/constants/RCPCommandIDs.java
index b106afece..80fa7aaa5 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/constants/RCPCommandIDs.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/constants/RCPCommandIDs.java
@@ -46,6 +46,9 @@ public interface RCPCommandIDs {
/** the ID of the "edit parameters" command */
public static final String EDIT_PARAMETERS = "org.eclipse.jubula.client.ui.rcp.commands.EditParameters"; //$NON-NLS-1$
+ /** the ID of the "edit OM Assoc" command */
+ public static final String EDIT_OM_ASSOC = "org.eclipse.jubula.client.ui.rcp.commands.EditOMAssoc"; //$NON-NLS-1$
+
/** the ID of the "extract test case" command */
public static final String EXTRACT_TESTCASE = "org.eclipse.jubula.client.ui.rcp.commands.ExtractTestCase"; //$NON-NLS-1$
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertysources/SpecTestCaseGUIPropertySource.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertysources/SpecTestCaseGUIPropertySource.java
index 36d9c4b54..e47c458a1 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertysources/SpecTestCaseGUIPropertySource.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/controllers/propertysources/SpecTestCaseGUIPropertySource.java
@@ -13,6 +13,7 @@ package org.eclipse.jubula.client.ui.rcp.controllers.propertysources;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
+import java.util.stream.Collectors;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
@@ -26,6 +27,7 @@ import org.eclipse.jubula.client.core.events.DataEventDispatcher.DataState;
import org.eclipse.jubula.client.core.events.DataEventDispatcher.UpdateState;
import org.eclipse.jubula.client.core.model.ICapPO;
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParamNodePO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
@@ -104,7 +106,9 @@ public class SpecTestCaseGUIPropertySource
/** cached property descriptor for referenced Test Data Cube */
private PropertyDescriptor m_referencedCubePropDesc = null;
-
+ /** cached property descriptor for om categories */
+ private IPropertyDescriptor m_oMCatPropDesc;
+
/**
* Constructor.
* Use this only for ISpecTestCasePO!
@@ -187,13 +191,26 @@ public class SpecTestCaseGUIPropertySource
m_lockPropDesc = propDes;
}
addPropertyDescriptor(m_lockPropDesc);
-
+ addPropertyDescriptor(getOMCategorieDescriptor());
initParameterPropDescriptors();
initTrackedChangesPropDescriptor();
}
-
+ /**
+ * @return the OM association {@link IPropertyDescriptor}
+ */
+ private IPropertyDescriptor getOMCategorieDescriptor() {
+ if (m_oMCatPropDesc == null) {
+ JBPropertyDescriptor cbpd = new JBPropertyDescriptor(
+ new OMCategorieController(),
+ Messages.SpecTestCaseGUIPropertySourceOMCat);
+ cbpd.setLabelProvider(new DisabledLabelProvider());
+ m_oMCatPropDesc = cbpd;
+ }
+ return m_oMCatPropDesc;
+ }
+
/**
* Initializes the parameter property descriptors, if needed, and adds
* them to the given list. The contents of the list are then added to
@@ -220,7 +237,31 @@ public class SpecTestCaseGUIPropertySource
addPropertyDescriptor(paramPropDescList);
}
+
+ /**
+ * for the associated {@link IObjectMappingCategoryPO}
+ */
+ protected class OMCategorieController extends AbstractPropertyController {
+ /** {@inheritDoc} */
+ public boolean setProperty(Object value) {
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ public Object getProperty() {
+ ISpecTestCasePO poNode = (ISpecTestCasePO) getNode();
+ List<IObjectMappingCategoryPO> omCategoryAssoc =
+ poNode.getOmCategoryAssoc();
+ if (omCategoryAssoc != null) {
+ return omCategoryAssoc.stream()
+ .map(IObjectMappingCategoryPO::getName)
+ .collect(Collectors.joining(",")); //$NON-NLS-1$
+ }
+ return StringConstants.EMPTY;
+ }
+ }
+
/**
* This controllers allows to set FileName for external datas
* @author BREDEX GmbH
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AssocOMtoSpecTCDialog.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AssocOMtoSpecTCDialog.java
new file mode 100644
index 000000000..830df63f2
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/dialogs/AssocOMtoSpecTCDialog.java
@@ -0,0 +1,535 @@
+/*******************************************************************************
+ * 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.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jubula.client.core.businessprocess.IComponentNameCache;
+import org.eclipse.jubula.client.core.model.IAUTMainPO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
+import org.eclipse.jubula.client.core.model.IProjectPO;
+import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
+import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+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.i18n.Messages;
+import org.eclipse.jubula.client.ui.rcp.provider.contentprovider.objectmapping.OMEditorTreeContentProvider;
+import org.eclipse.jubula.client.ui.rcp.provider.labelprovider.OMEditorTreeLabelProvider;
+import org.eclipse.jubula.client.ui.utils.LayoutUtil;
+import org.eclipse.jubula.tools.internal.constants.StringConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+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;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public class AssocOMtoSpecTCDialog extends TitleAreaDialog {
+ /** the button to shift a selection from used list to available tree */
+ private Button m_selectionAvailableToUsedButton;
+ /** the button to shift all from available tree to used list */
+ private Button m_allAvailableToUsedButton;
+
+ /** the button to shift a selection from used list to available tree */
+ private Button m_selectionUsedToAvailableButton;
+ /** the button to shift all from available tree to used list */
+ private Button m_allUsedToAvailableButton;
+ /** the selected {@link IAUTMainPO} */
+ private IAUTMainPO m_autMain;
+ /** the {@link Combo} for selecting the {@link IAUTMainPO} **/
+ private Combo m_autSelectorCombo;
+ /** list of all {@link IAUTMainPO} for this project */
+ private List<IAUTMainPO> m_auts = new ArrayList<>();
+ /** the list field for the available items */
+ private TreeViewer m_availableTree;
+
+ /** the list field for the available items */
+ private TreeViewer m_usedTree;
+ /** images for add/remove buttons*/
+ private Image[] m_activeButtonContents =
+ new Image[] { IconConstants.RIGHT_ARROW_IMAGE,
+ IconConstants.DOUBLE_RIGHT_ARROW_IMAGE,
+ IconConstants.LEFT_ARROW_IMAGE,
+ IconConstants.DOUBLE_LEFT_ARROW_IMAGE };
+ /** disabled images for add/remove buttons*/
+ private Image[] m_disabledButtonContents =
+ new Image[] { IconConstants.RIGHT_ARROW_DIS_IMAGE,
+ IconConstants.DOUBLE_RIGHT_ARROW_DIS_IMAGE,
+ IconConstants.LEFT_ARROW_DIS_IMAGE,
+ IconConstants.DOUBLE_LEFT_ARROW_DIS_IMAGE };
+
+ /** selection handler */
+ private SelectionListener m_selectionListener =
+ new WidgetSelectionListener();
+ /** selected categories*/
+ private Set<IObjectMappingCategoryPO> m_selectedCat = new HashSet<>();
+
+ /**
+ * This private inner class contains a new SelectionListener.
+ *
+ * @author BREDEX GmbH
+ * @created 10.02.2005
+ */
+ private class WidgetSelectionListener implements SelectionListener {
+
+ /** {@inheritDoc} */
+ public void widgetSelected(SelectionEvent e) {
+ Object source = e.getSource();
+ if (source.equals(m_availableTree.getTree())
+ || source.equals(m_usedTree.getTree())) {
+ checkButtons();
+ } else if (source.equals(m_selectionAvailableToUsedButton)) {
+ handleSelectionAvailableToUsedButtonEvent();
+ } else if (source.equals(m_selectionUsedToAvailableButton)) {
+ handleSelectionUsedToAvailableButtonEvent();
+ } else if (source.equals(m_allAvailableToUsedButton)) {
+ handleSelectionAllAvailableToUsedButtonEvent();
+ } else if (source.equals(m_allUsedToAvailableButton)) {
+ handleSelectionAllUsedToAvailableButtonEvent();
+ } else if (source.equals(m_autSelectorCombo)) {
+ handleSelectionAutSelectorEvent();
+ }
+ checkButtons();
+
+ }
+
+ /** {@inheritDoc} */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // do nothing
+ }
+
+ }
+
+ /**
+ * @param parentShell the parent {@link Shell}
+ * @param specTC the {@link ISpecTestCasePO} to change the OMAssoc
+ */
+ public AssocOMtoSpecTCDialog(Shell parentShell,
+ ISpecTestCasePO specTC) {
+ super(parentShell);
+ List<IObjectMappingCategoryPO> omCategoryAssoc =
+ specTC.getOmCategoryAssoc();
+ m_selectedCat.addAll(omCategoryAssoc);
+ if (omCategoryAssoc.size() > 0) {
+ m_autMain = omCategoryAssoc.get(0).getAutMainParent();
+ } else {
+ IProjectPO project = GeneralStorage.getInstance().getProject();
+ Set<IAUTMainPO> autMainList = project.getAutMainList();
+ if (autMainList.size() > 0) {
+ m_autMain = autMainList.iterator().next();
+ }
+ }
+ m_auts.addAll(
+ GeneralStorage.getInstance().getProject().getAutMainList());
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Control createDialogArea(Composite parent) {
+ setTitle(Messages.AssocOMtoSpecTCDialogTitle);
+ getShell().setText(Messages.AssocOMtoSpecTCDialogTitle);
+ setMessage(Messages.AssocOMtoSpecTCDialogMessage);
+ Composite composite = new Composite(parent, SWT.FILL);
+ GridLayout parentLayout = new GridLayout(1, false);
+ parent.setLayout(parentLayout);
+ GridLayout compositeLayout = new GridLayout(1, false);
+ composite.setLayout(compositeLayout);
+ composite.setLayoutData(createGrabAllGridData());
+ new Label(composite, SWT.FILL);
+ LayoutUtil.createSeparator(composite);
+ m_autSelectorCombo = new Combo(composite, SWT.READ_ONLY);
+ m_autSelectorCombo.addSelectionListener(m_selectionListener);
+
+ m_autSelectorCombo.setItems(m_auts.stream().map(IAUTMainPO::getName)
+ .toArray(String[]::new));
+ m_autSelectorCombo.setBounds(50, 50, 150, 65);
+ m_autSelectorCombo.select(m_auts.indexOf(m_autMain));
+ new Label(composite, SWT.FILL);
+ createLayout(composite);
+ m_availableTree.setContentProvider(new OMEditorTreeContentProvider(
+ Plugin.getActiveCompCache(), m_selectedCat));
+ m_availableTree.setInput(m_autMain.getObjMap().getMappedCategory());
+ m_usedTree.setInput(m_selectedCat);
+ checkButtons();
+ Plugin.getHelpSystem().setHelp(parent,
+ ContextHelpIds.ASSIGN_OM_CAT_SPEC);
+ setHelpAvailable(true);
+ return parent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected void setShellStyle(int newShellStyle) {
+ super.setShellStyle(newShellStyle | SWT.RESIZE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Point getInitialSize() {
+ final Point initialSize = super.getInitialSize();
+ initialSize.x = 800;
+ initialSize.y = 600;
+ return initialSize;
+ }
+
+ /**
+ * Creates the layout with Vertical alignment.
+ *
+ * @param parent The parent composite.
+ */
+ private void createLayout(Composite parent) {
+ Composite composite = new Composite(parent, SWT.FILL);
+ GridLayout compositeLayout = new GridLayout();
+ compositeLayout.numColumns = 3;
+ compositeLayout.marginHeight = 0;
+ compositeLayout.marginWidth = 0;
+ composite.setLayout(compositeLayout);
+ composite.setLayoutData(createGrabAllGridData());
+ Composite compositeLeft =
+ createComposite(composite, 1, GridData.FILL, true);
+
+ Composite compositeMiddle =
+ createComposite(composite, 1, GridData.FILL, false);
+
+ Composite compositeRight =
+ createComposite(composite, 1, GridData.FILL, true);
+
+ m_availableTree = createTree(compositeLeft,
+ Messages.AssocOMtoSpecTCDialogAvailableCat, 10);
+ m_availableTree.getTree().addSelectionListener(m_selectionListener);
+
+ createShiftButtons(compositeMiddle);
+
+ m_usedTree = createTree(compositeRight,
+ Messages.AssocOMtoSpecTCDialogSelectedCat, 10);
+ m_usedTree.getTree().addSelectionListener(m_selectionListener);
+ }
+
+ /**
+ * Creates a new composite.
+ *
+ * @param parent The parent composite.
+ * @param numColumns the number of columns for this composite.
+ * @param alignment The horizontalAlignment.
+ * @param horizontalSpace The horizontalSpace.
+ * @return The new composite.
+ */
+ private Composite createComposite(Composite parent, int numColumns,
+ int alignment, boolean horizontalSpace) {
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout compositeLayout = new GridLayout();
+ compositeLayout.numColumns = numColumns;
+ compositeLayout.marginHeight = 0;
+ compositeLayout.marginWidth = 0;
+ composite.setLayout(compositeLayout);
+ GridData compositeData = new GridData();
+ compositeData.horizontalAlignment = alignment;
+ compositeData.grabExcessHorizontalSpace = horizontalSpace;
+ composite.setLayoutData(compositeData);
+ return composite;
+ }
+
+ /**
+ * Creates the 4 arrow buttons
+ *
+ * @param parent The parent composite.
+ */
+ private void createShiftButtons(Composite parent) {
+ createLabel(parent, StringConstants.EMPTY);
+ m_selectionAvailableToUsedButton = new Button(parent, SWT.PUSH);
+ m_selectionAvailableToUsedButton
+ .addSelectionListener(m_selectionListener);
+ m_selectionAvailableToUsedButton.setLayoutData(createButtonGridData());
+
+ m_allAvailableToUsedButton = new Button(parent, SWT.PUSH);
+ m_allAvailableToUsedButton.addSelectionListener(m_selectionListener);
+ createLabel(parent, StringConstants.EMPTY);
+ m_allAvailableToUsedButton.setLayoutData(createButtonGridData());
+
+ m_selectionUsedToAvailableButton = new Button(parent, SWT.PUSH);
+ m_selectionUsedToAvailableButton
+ .addSelectionListener(m_selectionListener);
+ m_selectionUsedToAvailableButton.setLayoutData(createButtonGridData());
+
+ m_allUsedToAvailableButton = new Button(parent, SWT.PUSH);
+ m_allUsedToAvailableButton.addSelectionListener(m_selectionListener);
+ m_allUsedToAvailableButton.setLayoutData(createButtonGridData());
+ }
+
+ /**
+ * Creates a label for this composite.
+ *
+ * @param text The label text to set.
+ * @param parent The composite.
+ * @return a new label
+ */
+ private Label createLabel(Composite parent, String text) {
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ GridData labelGrid = new GridData(GridData.BEGINNING, GridData.CENTER,
+ false, false, 1, 1);
+ label.setLayoutData(labelGrid);
+ return label;
+ }
+
+ /**
+ * Creates a new tree
+ *
+ * @param composite The parent composite.
+ * @param labelText The text for the label.
+ * @param lines The quantity of lines of this list.
+ * @return The new tree.
+ */
+ private TreeViewer createTree(Composite composite, String labelText,
+ int lines) {
+
+ Composite firstComposite =
+ createComposite(composite, 2, GridData.BEGINNING, false);
+ Composite secondComposite =
+ createComposite(composite, 1, GridData.FILL, true);
+ Label label = createLabel(firstComposite, labelText);
+ secondComposite.setLayoutData(createGrabAllGridData());
+ composite.setLayoutData(createGrabAllGridData());
+ TreeViewer tree =
+ new TreeViewer(secondComposite, LayoutUtil.MULTI_TEXT_STYLE);
+ tree.setAutoExpandLevel(3);
+ tree.setData("Label", label); //$NON-NLS-1$
+ GridData treeGridData = createGrabAllGridData();
+ treeGridData.widthHint = 300;
+ IComponentNameCache activeCompCache = Plugin.getActiveCompCache();
+ tree.setLabelProvider(new OMEditorTreeLabelProvider(activeCompCache));
+ tree.setContentProvider(
+ new OMEditorTreeContentProvider(activeCompCache));
+ tree.getTree().setLayoutData(treeGridData);
+ return tree;
+ }
+
+ /**
+ * @return a new {@link GridData} with grabbing and filling horizontal space
+ */
+ private GridData createButtonGridData() {
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ return gridData;
+ }
+
+ /**
+ * @return a new {@link GridData} which grabs and fills horizontal and vertical
+ */
+ private GridData createGrabAllGridData() {
+ return new GridData(GridData.FILL, GridData.FILL, true, true);
+ }
+
+ /**
+ * checks and sets the switch button status
+ */
+ private void checkButtons() {
+ ITreeSelection selection = m_availableTree.getStructuredSelection();
+ enableAvailableToUsedButton(!selection.isEmpty());
+ for (Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
+ Object type = iterator.next();
+ if (!(type instanceof IObjectMappingCategoryPO)) {
+ enableAvailableToUsedButton(false);
+ break;
+ }
+ }
+ ITreeSelection usedSelection = m_usedTree.getStructuredSelection();
+ enableRemoveUsedButton(!usedSelection.isEmpty());
+ for (Iterator<?> iterator = usedSelection.iterator(); iterator
+ .hasNext();) {
+ Object type = iterator.next();
+ if (!(type instanceof IObjectMappingCategoryPO)) {
+ enableRemoveUsedButton(false);
+ break;
+ }
+ }
+ enableRemoveAllUsedButton(m_selectedCat.size() > 0);
+ enableAllAvailableToUsedButton(m_availableTree
+ .getVisibleExpandedElements().length != m_availableTree
+ .getTree().getItemCount());
+ }
+
+ /**
+ * enable or disable(and change the icon) of the {@link Button} to move from {@link #m_availableTree} to {@link #m_usedTree}
+ * @param enable enable
+ */
+ private void enableAvailableToUsedButton(boolean enable) {
+ enableButton(m_selectionAvailableToUsedButton, enable,
+ m_activeButtonContents[0], m_disabledButtonContents[0]);
+ }
+
+ /**
+ * enable or disable(and change the icon) of the {@link Button} to move all from {@link #m_availableTree} to {@link #m_usedTree}
+ * @param enable enable
+ */
+ private void enableAllAvailableToUsedButton(boolean enable) {
+ enableButton(m_allAvailableToUsedButton, enable,
+ m_activeButtonContents[1], m_disabledButtonContents[1]);
+ }
+
+ /**
+ * enable or disable(and change the icon) of the {@link Button} to move from {@link #m_usedTree} to {@link #m_availableTree}
+ * @param enable enable
+ */
+ private void enableRemoveUsedButton(boolean enable) {
+ enableButton(m_selectionUsedToAvailableButton, enable,
+ m_activeButtonContents[2], m_disabledButtonContents[2]);
+ }
+
+ /**
+ * enable or disable(and change the icon) of the {@link Button} to move all from {@link #m_usedTree} to {@link #m_availableTree}
+ * @param enable enable
+ */
+ private void enableRemoveAllUsedButton(boolean enable) {
+ enableButton(m_allUsedToAvailableButton, enable,
+ m_activeButtonContents[3], m_disabledButtonContents[3]);
+ }
+
+ /**
+ *
+ * @param button the {@link Button}
+ * @param enable enable
+ * @param activeImage the active {@link Image}
+ * @param disabledImage the disabeld {@link Image}
+ */
+ private void enableButton(Button button, boolean enable, Image activeImage,
+ Image disabledImage) {
+ button.setEnabled(enable);
+ if (enable) {
+ button.setImage(activeImage);
+ } else {
+ button.setImage(disabledImage);
+ }
+ }
+
+ /**
+ *
+ */
+ private void handleSelectionAutSelectorEvent() {
+ IAUTMainPO autMain = m_auts.get(m_autSelectorCombo.getSelectionIndex());
+ if (!autMain.equals(m_autMain)) {
+ m_autMain = autMain;
+ m_selectedCat.clear();
+ m_availableTree.setInput(m_autMain.getObjMap().getMappedCategory());
+ m_availableTree.refresh();
+ m_usedTree.refresh();
+ checkButtons();
+ }
+ }
+ /**
+ * Handles the selectionEvent for {@link #m_selectionAvailableToUsedButton}
+ */
+ protected void handleSelectionAvailableToUsedButtonEvent() {
+ if (m_selectionAvailableToUsedButton.isEnabled()) {
+ IStructuredSelection selection =
+ m_availableTree.getStructuredSelection();
+ for (Iterator<?> selIterator = selection.iterator(); selIterator
+ .hasNext();) {
+ IObjectMappingCategoryPO iObjectMappingCategoryPO =
+ (IObjectMappingCategoryPO) selIterator.next();
+ List<IObjectMappingCategoryPO> toRemove = new ArrayList<>();
+ for (Iterator<?> usedIterator = m_selectedCat.iterator();
+ usedIterator.hasNext();) {
+ IObjectMappingCategoryPO selecteCat =
+ (IObjectMappingCategoryPO) usedIterator.next();
+ IObjectMappingCategoryPO parent = selecteCat.getParent();
+ while (parent != null) {
+ if (iObjectMappingCategoryPO.equals(parent)) {
+ usedIterator.remove();
+ }
+ parent = parent.getParent();
+ }
+
+ }
+ m_selectedCat.add(iObjectMappingCategoryPO);
+ }
+ m_usedTree.refresh();
+ m_availableTree.refresh();
+ }
+ }
+
+ /**
+ * Handles the selectionEvent for {@link #m_selectionUsedToAvailableButton}
+ */
+ protected void handleSelectionUsedToAvailableButtonEvent() {
+ if (m_selectionUsedToAvailableButton.isEnabled()) {
+ IStructuredSelection selection =
+ m_usedTree.getStructuredSelection();
+ for (Iterator<?> iterator = selection.iterator(); iterator
+ .hasNext();) {
+ IObjectMappingCategoryPO iObjectMappingCategoryPO =
+ (IObjectMappingCategoryPO) iterator.next();
+ m_selectedCat.remove(iObjectMappingCategoryPO);
+ }
+ m_usedTree.refresh();
+ m_availableTree.refresh();
+ }
+ }
+
+ /**
+ * Handles the selectionEvent for {@link #m_allUsedToAvailableButton}
+ */
+ private void handleSelectionAllUsedToAvailableButtonEvent() {
+ if (m_allUsedToAvailableButton.isEnabled()) {
+ m_selectedCat.clear();
+ m_usedTree.refresh();
+ m_availableTree.refresh();
+ }
+ }
+
+ /**
+ * Handles the selectionEvent for {@link #m_allAvailableToUsedButton}
+ */
+ private void handleSelectionAllAvailableToUsedButtonEvent() {
+ if (m_allAvailableToUsedButton.isEnabled()) {
+ m_selectedCat.clear();
+ m_selectedCat.addAll(m_autMain.getObjMap().getMappedCategory()
+ .getUnmodifiableCategoryList());
+ m_usedTree.refresh();
+ m_availableTree.refresh();
+ }
+ }
+ /**
+ * @return the {@link IObjectMappingCategoryPO} which should be associated with the {@link ISpecTestCasePO}
+ */
+ public Collection<IObjectMappingCategoryPO> getSelectedItems() {
+ return m_selectedCat;
+ }
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java
index ac112c4ed..5a91111e1 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java
@@ -55,6 +55,7 @@ import org.eclipse.jubula.client.core.model.IEventExecTestCasePO;
import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.core.model.INodePO;
import org.eclipse.jubula.client.core.model.IObjectMappingPO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
import org.eclipse.jubula.client.core.model.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParamNodePO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
@@ -669,6 +670,8 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
mgr.add(new Separator());
CommandHelper.createContributionPushItem(mgr,
RCPCommandIDs.EDIT_PARAMETERS);
+ CommandHelper.createContributionPushItem(mgr,
+ RCPCommandIDs.EDIT_OM_ASSOC);
mgr.add(new GroupMarker("editing")); //$NON-NLS-1$
CommandHelper.createContributionPushItem(mgr,
RCPCommandIDs.REVERT_CHANGES);
@@ -787,10 +790,11 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
public void handleDataChanged(IPersistentObject po, DataState dataState,
UpdateState updState) {
+ IPersistentObject workVersion = getEditorHelper().getEditSupport()
+ .getWorkVersion();
if (po instanceof INodePO) {
INodePO changedNode = (INodePO)po;
- INodePO editorNode = (INodePO)getEditorHelper().getEditSupport()
- .getWorkVersion();
+ INodePO editorNode = (INodePO)workVersion;
boolean isVisibleInEditor = editorNode.indexOf(changedNode) > -1;
isVisibleInEditor |= contains(editorNode, changedNode);
if (editorNode instanceof ISpecTestCasePO) {
@@ -839,6 +843,21 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
session.refresh(session.find(po.getClass(), po.getId()));
}
runLocalChecks();
+ } else if (po instanceof IObjectMappingCategoryPO
+ && updState == UpdateState.all) {
+ if (workVersion instanceof ISpecTestCasePO) {
+ ISpecTestCasePO spec = (ISpecTestCasePO) workVersion;
+ List<IObjectMappingCategoryPO> omCategoryAssoc =
+ spec.getOmCategoryAssoc();
+ for (Iterator<IObjectMappingCategoryPO> iterator =
+ omCategoryAssoc.iterator(); iterator.hasNext();) {
+ IObjectMappingCategoryPO cat = iterator.next();
+ if (po.getId().equals(cat.getId())) {
+ iterator.remove();
+ }
+
+ }
+ }
}
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/ObjectMappingMultiPageEditor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/ObjectMappingMultiPageEditor.java
index f6c17a679..df10e02a0 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/ObjectMappingMultiPageEditor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/ObjectMappingMultiPageEditor.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jubula.client.ui.rcp.editors;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -51,9 +52,9 @@ import org.eclipse.jubula.client.core.commands.AUTModeChangedCommand;
import org.eclipse.jubula.client.core.events.DataChangedEvent;
import org.eclipse.jubula.client.core.events.DataEventDispatcher;
import org.eclipse.jubula.client.core.events.DataEventDispatcher.DataState;
+import org.eclipse.jubula.client.core.events.DataEventDispatcher.IDataChangedListener;
import org.eclipse.jubula.client.core.events.DataEventDispatcher.OMState;
import org.eclipse.jubula.client.core.events.DataEventDispatcher.UpdateState;
-import org.eclipse.jubula.client.core.events.DataEventDispatcher.IDataChangedListener;
import org.eclipse.jubula.client.core.model.IAUTMainPO;
import org.eclipse.jubula.client.core.model.ICapPO;
import org.eclipse.jubula.client.core.model.IComponentNamePO;
@@ -63,18 +64,22 @@ 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.IPersistentObject;
+import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.model.ITestSuitePO;
import org.eclipse.jubula.client.core.model.ITimestampPO;
import org.eclipse.jubula.client.core.model.PoMaker;
import org.eclipse.jubula.client.core.persistence.CompNamePM;
import org.eclipse.jubula.client.core.persistence.EditSupport;
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+import org.eclipse.jubula.client.core.persistence.NodePM;
+import org.eclipse.jubula.client.core.persistence.ObjectMappingPM;
import org.eclipse.jubula.client.core.persistence.PMAlreadyLockedException;
import org.eclipse.jubula.client.core.persistence.PMException;
import org.eclipse.jubula.client.core.persistence.PMReadException;
import org.eclipse.jubula.client.core.persistence.PMSaveException;
import org.eclipse.jubula.client.core.utils.AbstractNonPostOperatingTreeNodeOperation;
import org.eclipse.jubula.client.core.utils.ITreeTraverserContext;
+import org.eclipse.jubula.client.core.utils.NativeSQLUtils;
import org.eclipse.jubula.client.core.utils.TreeTraverser;
import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.constants.ContextHelpIds;
@@ -173,6 +178,9 @@ public class ObjectMappingMultiPageEditor extends MultiPageEditorPart
/** the tree viewer for mapped Component Names in the Split Pane view */
private TreeViewer m_mappedComponentTreeViewer;
+ /** deleted object mapping categories*/
+ private Set<IObjectMappingCategoryPO> m_deletedOMC = new HashSet<>();
+
/**
* the component responsible for handling the profile
* configuration page
@@ -377,7 +385,7 @@ public class ObjectMappingMultiPageEditor extends MultiPageEditorPart
m_omEditorBP = new OMEditorBP(this);
IObjectMappingPO objMap = getAut().getObjMap();
if (objMap == null) {
- objMap = PoMaker.createObjectMappingPO();
+ objMap = PoMaker.createObjectMappingPO(getAut());
getAut().setObjMap(objMap);
}
@@ -869,17 +877,27 @@ public class ObjectMappingMultiPageEditor extends MultiPageEditorPart
fixCompNameReferences(getAut().getObjMap(),
compNameCache);
+ List<DataChangedEvent> datachanged = new ArrayList<>();
editSupport.saveWorkVersion();
+ List<BigDecimal> specIdsforAssoc = NativeSQLUtils
+ .getSpecIdsforAssoc(getEntityManager(), m_deletedOMC);
+ for (IObjectMappingCategoryPO omc : m_deletedOMC) {
+ NativeSQLUtils.removeOMCatAssoc(omc);
+ datachanged.add(new DataChangedEvent(omc, DataState.Deleted,
+ UpdateState.all));
+ }
compNameCache.clear();
-
+ refreshInMasterSession(specIdsforAssoc);
DataEventDispatcher.getInstance().fireDataChangedListener(
this.getAut().getObjMap(),
DataState.StructureModified,
UpdateState.all);
-
+ ObjectMappingPM.deleteOMCategories(m_deletedOMC);
+ m_deletedOMC.clear();
+ datachanged.add(new DataChangedEvent(getAut().getObjMap(),
+ DataState.Saved, UpdateState.all));
DataEventDispatcher.getInstance().fireDataChangedListener(
- getAut().getObjMap(), DataState.Saved, UpdateState.all);
-
+ datachanged.toArray(new DataChangedEvent[datachanged.size()]));
if (getAut().equals(
TestExecution.getInstance().getConnectedAut())
&& !workProfile.equals(origProfile)) {
@@ -892,6 +910,16 @@ public class ObjectMappingMultiPageEditor extends MultiPageEditorPart
}
/**
+ * @param specIdsforAssoc the {@link ISpecTestCasePO} ids
+ */
+ private void refreshInMasterSession(List<BigDecimal> specIdsforAssoc) {
+ for (BigDecimal id : specIdsforAssoc) {
+ INodePO find = NodePM.findNodeById(id.longValue());
+ NodePM.refreshMasterSession(find);
+ }
+ }
+
+ /**
* Replaces Component Name references with the referenced Component Names
* and deletes any Component Name references that are no longer used.
*
@@ -1361,10 +1389,22 @@ public class ObjectMappingMultiPageEditor extends MultiPageEditorPart
handleOneChange((IComponentNamePO) e.getPo(), e.getDataState());
break;
}
+ if (e.getUpdateState() == UpdateState.onlyInEditor
+ && e.getPo() instanceof IObjectMappingCategoryPO
+ && e.getDataState() == DataState.Deleted) {
+ handleOMdeleted((IObjectMappingCategoryPO) e.getPo());
+ }
}
}
/**
+ * @param po the {@link IObjectMappingCategoryPO}
+ */
+ private void handleOMdeleted(IObjectMappingCategoryPO po) {
+ m_deletedOMC.add(po);
+ }
+
+ /**
* Deals with a single data change event
* @param compName the Component Name
* @param state the data state
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/OMNewCategoryHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/OMNewCategoryHandler.java
index da8e6f087..722cb99d8 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/OMNewCategoryHandler.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/OMNewCategoryHandler.java
@@ -114,7 +114,7 @@ public class OMNewCategoryHandler extends AbstractSelectionBasedHandler {
if (dialog.open() == Window.OK) {
IObjectMappingCategoryPO newCategory =
PoMaker.createObjectMappingCategoryPO(
- dialog.getName());
+ dialog.getName(), editor.getAut());
node.addCategory(newCategory);
editor.getEditorHelper().setDirty(true);
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/EditorOMAssocHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/EditorOMAssocHandler.java
new file mode 100644
index 000000000..1b684d146
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/EditorOMAssocHandler.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.handlers.edit;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jubula.client.core.events.DataEventDispatcher;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
+import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
+import org.eclipse.jubula.client.core.model.PoMaker;
+import org.eclipse.jubula.client.ui.handlers.AbstractSelectionBasedHandler;
+import org.eclipse.jubula.client.ui.rcp.dialogs.AssocOMtoSpecTCDialog;
+import org.eclipse.jubula.client.ui.rcp.editors.IJBEditor;
+import org.eclipse.jubula.client.ui.rcp.editors.JBEditorHelper;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public class EditorOMAssocHandler extends AbstractSelectionBasedHandler {
+
+ /** {@inheritDoc} */
+ protected Object executeImpl(ExecutionEvent event)
+ throws ExecutionException {
+ final ISpecTestCasePO firstElement =
+ getFirstElement(ISpecTestCasePO.class);
+ final IEditorPart editor = HandlerUtil.getActiveEditor(event);
+ ((IJBEditor) editor).getEditorHelper().doEditorOperation(workingPo -> {
+ if (firstElement != null) {
+ AssocOMtoSpecTCDialog dialog = new AssocOMtoSpecTCDialog(
+ getActiveShell(), firstElement);
+ dialog.create();
+ int result = dialog.open();
+ if (result != Window.OK) {
+ return;
+ }
+ saveNewSelection(firstElement, editor,
+ dialog.getSelectedItems());
+ }
+ });
+
+ return null;
+ }
+ /**
+ *
+ * @param specTC the {@link ISpecTestCasePO} to save the new OM Assoc
+ * @param editor the editor, must be instance of {@link IJBEditor}
+ * @param selectedItems the selected {@link IObjectMappingCategoryPO}
+ */
+ private void saveNewSelection(final ISpecTestCasePO specTC,
+ final IEditorPart editor,
+ Collection<IObjectMappingCategoryPO> selectedItems) {
+ if (editor instanceof IJBEditor) {
+ JBEditorHelper editHelper = ((IJBEditor) editor).getEditorHelper();
+ editHelper.setDirty(true);
+ List<IObjectMappingCategoryPO> toAdd = new ArrayList<>();
+
+ for (IObjectMappingCategoryPO category : selectedItems) {
+ toAdd.add(editHelper.getEditSupport().getSession().find(
+ PoMaker.getObjectMappingCategoryClass(),
+ category.getId()));
+
+ }
+ specTC.setOmCategoryAssoc(new ArrayList<>(toAdd));
+ DataEventDispatcher.getInstance().firePropertyChanged(false);
+ } else {
+ throw new IllegalArgumentException("IEdittorPart is not instance if IJBEditor"); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/TCBEditOmAssocHandler.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/TCBEditOmAssocHandler.java
new file mode 100644
index 000000000..eb49ca73a
--- /dev/null
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/handlers/edit/TCBEditOmAssocHandler.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.handlers.edit;
+
+import java.util.Collection;
+
+import javax.persistence.EntityManager;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jubula.client.core.events.DataEventDispatcher;
+import org.eclipse.jubula.client.core.events.DataEventDispatcher.DataState;
+import org.eclipse.jubula.client.core.events.DataEventDispatcher.UpdateState;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
+import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
+import org.eclipse.jubula.client.core.persistence.GeneralStorage;
+import org.eclipse.jubula.client.core.persistence.NodePM;
+import org.eclipse.jubula.client.core.persistence.PMException;
+import org.eclipse.jubula.client.core.persistence.Persistor;
+import org.eclipse.jubula.client.core.persistence.locking.LockManager;
+import org.eclipse.jubula.client.ui.handlers.AbstractSelectionBasedHandler;
+import org.eclipse.jubula.client.ui.rcp.controllers.PMExceptionHandler;
+import org.eclipse.jubula.client.ui.rcp.dialogs.AssocOMtoSpecTCDialog;
+import org.eclipse.jubula.tools.internal.exception.ProjectDeletedException;
+
+/**
+ * @author BREDEX GmbH
+ *
+ */
+public class TCBEditOmAssocHandler extends AbstractSelectionBasedHandler {
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Object executeImpl(ExecutionEvent event)
+ throws ExecutionException {
+ final ISpecTestCasePO firstElement =
+ getFirstElement(ISpecTestCasePO.class);
+ if (firstElement != null) {
+ EntityManager masterSession =
+ GeneralStorage.getInstance().getMasterSession();
+ try {
+ Persistor.instance().lockPO(masterSession, firstElement);
+ } catch (PMException e) {
+ PMExceptionHandler.handlePMExceptionForMasterSession(e);
+ return null;
+ }
+ AssocOMtoSpecTCDialog dialog =
+ new AssocOMtoSpecTCDialog(getActiveShell(), firstElement);
+ dialog.create();
+ int result = dialog.open();
+ if (result != Window.OK) {
+ LockManager.instance().unlockPO(firstElement);
+ return null;
+ }
+ persistChanges(firstElement, dialog.getSelectedItems());
+ }
+ LockManager.instance().unlockPO(firstElement);
+
+ return null;
+ }
+
+ /**
+ * @param firstElement the {@link ISpecTestCasePO} to associate the {@link IObjectMappingCategoryPO} with
+ * @param selectedItems the selected {@link IObjectMappingCategoryPO}
+ */
+ private void persistChanges(ISpecTestCasePO firstElement,
+ Collection<IObjectMappingCategoryPO> selectedItems) {
+ try {
+ LockManager.instance().unlockPO(firstElement);
+ NodePM.setOMAssoc(firstElement, selectedItems);
+ DataEventDispatcher.getInstance().fireDataChangedListener(
+ firstElement, DataState.StructureModified, UpdateState.all);
+ } catch (PMException e) {
+ PMExceptionHandler.handlePMExceptionForEditor(e, null);
+ } catch (ProjectDeletedException e) {
+ PMExceptionHandler.handleProjectDeletedException();
+ }
+ }
+}
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 b99ec37a5..efc5d0eaa 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
@@ -20,6 +20,7 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.jubula.client.ui.rcp.i18n.messages"; //$NON-NLS-1$
+
public static String AbstractGuiNodePropertySourceComment;
public static String Action;
public static String ActionBuilderExportAll;
@@ -134,6 +135,10 @@ public class Messages extends NLS {
public static String AUTSettingWizardPageToolkit;
public static String AUTSettingWizardPageUpperLabel;
public static String AUTSettingWizardPageUpToolTip;
+ public static String AssocOMtoSpecTCDialogAvailableCat;
+ public static String AssocOMtoSpecTCDialogMessage;
+ public static String AssocOMtoSpecTCDialogSelectedCat;
+ public static String AssocOMtoSpecTCDialogTitle;
public static String BrowserPreferencePageDescription;
public static String BrowserPreferencePageFilterColoringButton;
public static String BrowserPreferencePageFilterColoringColorFieldLabel;
@@ -811,6 +816,7 @@ public class Messages extends NLS {
public static String SimpleSearchPageSearchInGroupHeader;
public static String SpecTestCaseGUIPropertySourceDataSource;
public static String SpecTestCaseGUIPropertySourceLockedParameters;
+ public static String SpecTestCaseGUIPropertySourceOMCat;
public static String SpecTestCaseGUIPropertySourceParameter;
public static String SpecTestCaseGUIPropertySourceTestCaseFileName;
public static String SpecTestCaseGUIPropertySourceTestCaseName;
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 3303841ee..0c764aecb 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
@@ -119,6 +119,10 @@ AUTSettingWizardPageEmptyAUTName=Enter details about the AUT (name, toolkit, sup
AUTSettingWizardPageToolkit=Toolkit\:
AUTSettingWizardPageUpperLabel=Project Languages\:
AUTSettingWizardPageUpToolTip=Delete a selected AUT language.
+AssocOMtoSpecTCDialogAvailableCat=Available OM Categories
+AssocOMtoSpecTCDialogMessage=Assign Object Mapping Categories for the specification Test Case to reduce the proposed component names
+AssocOMtoSpecTCDialogSelectedCat=Selected OM Categories
+AssocOMtoSpecTCDialogTitle=Assign Object Mapping Categories
BrowserPreferencePageDescription=Configure your browser preferences.
BrowserPreferencePageFilterColoringButton=Enable coloring
BrowserPreferencePageFilterColoringColorFieldLabel=Background color
@@ -796,6 +800,7 @@ SimpleSearchPageSearchForGroupHeader=Search for
SimpleSearchPageSearchInGroupHeader=Search in
SpecTestCaseGUIPropertySourceDataSource=Data Source
SpecTestCaseGUIPropertySourceLockedParameters=Locked Parameters
+SpecTestCaseGUIPropertySourceOMCat=Object Mapping Association
SpecTestCaseGUIPropertySourceParameter=Parameter
SpecTestCaseGUIPropertySourceTestCaseFileName=Excel Data File
SpecTestCaseGUIPropertySourceTestCaseName=Test Case Name
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/provider/contentprovider/objectmapping/OMEditorTreeContentProvider.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/provider/contentprovider/objectmapping/OMEditorTreeContentProvider.java
index e2335353a..98eb6ec90 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/provider/contentprovider/objectmapping/OMEditorTreeContentProvider.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/provider/contentprovider/objectmapping/OMEditorTreeContentProvider.java
@@ -11,6 +11,7 @@
package org.eclipse.jubula.client.ui.rcp.provider.contentprovider.objectmapping;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -55,6 +56,9 @@ public class OMEditorTreeContentProvider extends
/** listener for updates to the model */
private IDataChangedListener m_modelListener;
+ /** which {@link IObjectMappingCategoryPO} should be ignored during proposal generation */
+ private Collection<IObjectMappingCategoryPO> m_categoriesToIgnore;
+
/**
* Constructor.
*
@@ -63,6 +67,18 @@ public class OMEditorTreeContentProvider extends
public OMEditorTreeContentProvider(IComponentNameCache compNameCache) {
m_compNameCache = compNameCache;
}
+
+ /**
+ * Constructor.
+ *
+ * @param compNameCache The cache to use for finding Component Names.
+ * @param categoriesToIgnore which {@link IObjectMappingCategoryPO} should be ignored during proposal generation
+ */
+ public OMEditorTreeContentProvider(IComponentNameCache compNameCache,
+ Collection<IObjectMappingCategoryPO> categoriesToIgnore) {
+ m_compNameCache = compNameCache;
+ m_categoriesToIgnore = categoriesToIgnore;
+ }
/**
*
@@ -99,16 +115,21 @@ public class OMEditorTreeContentProvider extends
Validate.noNullElements(componentNamePoList);
return componentNamePoList.toArray();
}
-
if (parentElement instanceof IComponentNamePO) {
return ArrayUtils.EMPTY_OBJECT_ARRAY;
}
-
+ if (parentElement instanceof Collection) {
+ return ((Collection<?>) parentElement).toArray();
+ }
if (parentElement instanceof IObjectMappingCategoryPO) {
List<Object> childList = new ArrayList<Object>();
IObjectMappingCategoryPO category =
(IObjectMappingCategoryPO)parentElement;
childList.addAll(category.getUnmodifiableCategoryList());
+ if (m_categoriesToIgnore != null
+ && m_categoriesToIgnore.size() > 0) {
+ childList.removeAll(m_categoriesToIgnore);
+ }
for (IObjectMappingAssoziationPO assoc
: category.getUnmodifiableAssociationList()) {
if (assoc.getTechnicalName() != null) {
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopUpTextField.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopUpTextField.java
index 797bd695a..94d298c24 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopUpTextField.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopUpTextField.java
@@ -19,6 +19,7 @@ import org.eclipse.jface.fieldassist.TextContentAdapter;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jubula.client.core.businessprocess.IComponentNameCache;
+import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.constants.IconConstants;
import org.eclipse.jubula.client.ui.rcp.Plugin;
@@ -325,4 +326,13 @@ public final class CompNamePopUpTextField extends CheckedCompNameText {
notifyListeners(SWT.KeyDown, triggerEvent);
}
}
+
+ /**
+ * @param selectedExecNode the selected {@link IExecTestCasePO}
+ */
+ public void setSelectedNode(IExecTestCasePO selectedExecNode) {
+ if (m_contentProposalProvider != null) {
+ m_contentProposalProvider.setSelectedNode(selectedExecNode);
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopupTextCellEditor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopupTextCellEditor.java
index 9f620e5db..1d23c8b94 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopupTextCellEditor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamePopupTextCellEditor.java
@@ -14,6 +14,7 @@ import java.text.MessageFormat;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jubula.client.core.businessprocess.IComponentNameCache;
+import org.eclipse.jubula.client.core.model.IExecTestCasePO;
import org.eclipse.jubula.client.ui.rcp.i18n.Messages;
import org.eclipse.jubula.client.ui.utils.ErrorHandlingUtil;
import org.eclipse.jubula.tools.internal.constants.CharacterConstants;
@@ -544,4 +545,14 @@ public class CompNamePopupTextCellEditor extends CellEditor {
// http://eclip.se/58777.
return false;
}
+
+ /**
+ * @param selectedExecNode the selected {@link IExecTestCasePO}
+ */
+ public void setSelectedNode(IExecTestCasePO selectedExecNode) {
+ if (m_popupText != null) {
+ m_popupText.setSelectedNode(selectedExecNode);
+ }
+
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamesProposalProvider.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamesProposalProvider.java
index 75a581653..daea854b5 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamesProposalProvider.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/CompNamesProposalProvider.java
@@ -11,9 +11,12 @@
package org.eclipse.jubula.client.ui.rcp.widgets;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.fieldassist.IContentProposal;
@@ -21,6 +24,11 @@ import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jubula.client.core.businessprocess.CompNameTypeManager;
import org.eclipse.jubula.client.core.businessprocess.IComponentNameCache;
import org.eclipse.jubula.client.core.model.IComponentNamePO;
+import org.eclipse.jubula.client.core.model.IExecTestCasePO;
+import org.eclipse.jubula.client.core.model.INodePO;
+import org.eclipse.jubula.client.core.model.IObjectMappingAssoziationPO;
+import org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO;
+import org.eclipse.jubula.client.core.model.ISpecTestCasePO;
import org.eclipse.jubula.client.core.persistence.GeneralStorage;
import org.eclipse.jubula.client.core.utils.StringHelper;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
@@ -80,6 +88,9 @@ public class CompNamesProposalProvider implements IContentProposalProvider {
* initialization is complete.
*/
private String m_typeFilter = StringConstants.EMPTY;
+
+ /** selected Node */
+ private IExecTestCasePO m_selectedExecNode;
/**
* Constructor
@@ -108,8 +119,30 @@ public class CompNamesProposalProvider implements IContentProposalProvider {
} else {
subString = contents.substring(0, position);
}
-
- for (IComponentNamePO cN : m_compNameCache.getAllCompNamePOs()) {
+ Set<String> logicalNames = new HashSet<>();
+ if (m_selectedExecNode != null) {
+ INodePO specAncestor = m_selectedExecNode.getSpecAncestor();
+ if (specAncestor instanceof ISpecTestCasePO) {
+ ISpecTestCasePO spec = (ISpecTestCasePO) specAncestor;
+ List<IObjectMappingCategoryPO> omCategoryAssoc =
+ spec.getOmCategoryAssoc();
+ for (IObjectMappingCategoryPO omCategory : omCategoryAssoc) {
+ getLogicalNames(logicalNames, omCategory);
+ }
+ }
+ }
+ Collection<IComponentNamePO> pos = m_compNameCache.getAllCompNamePOs();
+ if (logicalNames.size() > 0) {
+ pos = new HashSet<>();
+ for (String guid : logicalNames) {
+ IComponentNamePO compNamePo =
+ m_compNameCache.getResCompNamePOByGuid(guid);
+ if (compNamePo != null) {
+ pos.add(compNamePo);
+ }
+ }
+ }
+ for (IComponentNamePO cN : pos) {
if (StringUtils.isEmpty(cN.getName())
|| !cN.getName().startsWith(subString)
|| cN.getParentProjectId() == null
@@ -135,6 +168,26 @@ public class CompNamesProposalProvider implements IContentProposalProvider {
}
/**
+ * searches recursively through {@link IObjectMappingCategoryPO}s to search for logical names
+ * @param logicalNames the {@link Set} Logical Names to add the new ones to
+ * @param iObjectMappingCategoryPO the {@link IObjectMappingCategoryPO} to get the logical names from
+ */
+ private void getLogicalNames(Set<String> logicalNames,
+ IObjectMappingCategoryPO iObjectMappingCategoryPO) {
+ List<IObjectMappingAssoziationPO> unmodifiableAssociationList =
+ iObjectMappingCategoryPO.getUnmodifiableAssociationList();
+ for (IObjectMappingAssoziationPO assoc : unmodifiableAssociationList) {
+ logicalNames.addAll(assoc.getLogicalNames());
+ }
+
+ List<IObjectMappingCategoryPO> unmodifiableCategoryList =
+ iObjectMappingCategoryPO.getUnmodifiableCategoryList();
+ for (IObjectMappingCategoryPO subCat : unmodifiableCategoryList) {
+ getLogicalNames(logicalNames, subCat);
+ }
+ }
+
+ /**
*
* @param typeFilter The new filter to use. Only Component Names
* with a type that is compatible with the given type
@@ -151,4 +204,11 @@ public class CompNamesProposalProvider implements IContentProposalProvider {
public void setComponentNameCache(IComponentNameCache compNameCache) {
m_compNameCache = compNameCache;
}
+
+ /**
+ * @param selectedExecNode the selected {@link IExecTestCasePO}
+ */
+ public void setSelectedNode(IExecTestCasePO selectedExecNode) {
+ m_selectedExecNode = selectedExecNode;
+ }
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
index 9debde63a..c5c6d5194 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/widgets/ComponentNamesTableComposite.java
@@ -734,6 +734,7 @@ public class ComponentNamesTableComposite extends Composite implements
*/
public void setSelectedExecNode(IExecTestCasePO selectedExecNode) {
m_selectedExecNode = selectedExecNode;
+ getCellEdit().setSelectedNode(selectedExecNode);
updateTableInput();
}
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 f4e4913d9..17e84600e 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
@@ -315,7 +315,12 @@ public class ParamProposalProvider implements IContentProposalProvider {
// (we need the ParamDescPO's type)
for (IParamDescriptionPO param : paramNode.getParameterList()) {
for (int i = 0; i < man.getDataSetCount(); i++) {
- String data = man.getCell(i, param);
+ String data = null;
+ try {
+ data = man.getCell(i, param);
+ } catch (IndexOutOfBoundsException ioobe) {
+ // ignore we will continue with other data
+ }
if (data == null) {
continue;
}
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/pages/ImportXLSTestdataWizardPage.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/pages/ImportXLSTestdataWizardPage.java
index 3da8fa7b1..e7ac66eef 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/pages/ImportXLSTestdataWizardPage.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/wizards/pages/ImportXLSTestdataWizardPage.java
@@ -91,6 +91,7 @@ import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider;
* @author BREDEX GmbH
* @created Oct 19, 2010
*/
+@SuppressWarnings("restriction")
public class ImportXLSTestdataWizardPage extends WizardResourceImportPage {
/**
* @author BREDEX GmbH
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 beedf1aa0..00c0d7380 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
@@ -29,6 +29,10 @@ public interface ContextHelpIds {
/** Praefix = Plugin_id + . */
public static final String PRAEFIX = HELP_PLUGIN_ID + "."; //$NON-NLS-1$
+ /** ContextHelpId for assigning om to spec TC */
+ public static final String ASSIGN_OM_CAT_SPEC =
+ PRAEFIX + "assignOMCategoriesToSpec"; //$NON-NLS-1$
+
/** ContextHelpId for adding existing test cases */
public static final String TESTCASE_ADD_EXISTING = PRAEFIX
+ "testCaseAddExistingContextId"; //$NON-NLS-1$
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 16805bd06..421573316 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,6 +12,20 @@
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">Possibility to reduce the amount of component name proposals</emphasis>
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can now reduce the amount of proposed component names.
+ This can be done by setting Object Mapping Categories in Specification Test Cases. The association can be done with a dialog
+ which opens when you open the context menu on a specification of a test case and use Edit OM association.
+ </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/workWithEditors/content.xml b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/content.xml
index bcd98aa95..7d20e8378 100644
--- a/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/content.xml
+++ b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/content.xml
@@ -29,6 +29,7 @@
<xi:include href="sectionExtractingTestCasesFromEditors.xml"/>
<xi:include href="sectionReplacingTestCasesInEditors.xml"/>
<xi:include href="sectionSavingTestCasesFromAnEditorAsNewTestCase.xml"/>
+ <xi:include href="sectionObjectCategoryAssociation.xml"/>
<xi:include href="sectionRevertingChangesInAnEditor.xml"/>
</section> \ No newline at end of file
diff --git a/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/sectionObjectCategoryAssociation.xml b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/sectionObjectCategoryAssociation.xml
new file mode 100644
index 000000000..e5c390050
--- /dev/null
+++ b/org.eclipse.jubula.documentation/userManual/en/docbook/tasks/workWithEditors/sectionObjectCategoryAssociation.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2014 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
+-->
+
+<section xml:id="associating-om-categories" version="5.0" xmlns="http://docbook.org/ns/docbook"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:xl="http://www.w3.org/1999/xlink" >,
+ <title>Object Mapping Cagegory Association</title>
+ <anchor role="helpid" condition="assignOMCategoriesToSpec" xml:id="associating-om-categories.assignOMCategoriesToSpec" xreflabel="Assign OM Categories to TC"/>
+ <para>
+ Using Object Mapping Category association will reduce the proposed component
+ names for the Component Names View to only the restricted Object Mapping categories and their children.
+
+ This is only working for all the children of a test case.
+ </para>
+ <para>
+ There are two ways to assign Object Mapping Categories to a test case.
+ Either in the Test Case Browser select a test case from the project and
+ select <emphasis>Edit OM association</emphasis> in the context menu.
+ You can also do the same within the Test Case Editor when selecting the root node.
+ </para>
+ <para>
+ The Dialog which is opening is having one combobox and two trees with buttons between them.
+ The Combobox shows which AUT is used for using the categories.
+ Only one AUT can be selected at any time, if it is switched to another AUT all selected Categories will be removed.
+ The left tree shows the available categories and the
+ right shows the categories which are already selected.
+ You can move the categories between both trees with the buttons between them.
+ </para>
+</section>

Back to the top