| author | Zeb Ford-Reitz | 2011-05-24 05:39:57 (EDT) |
|---|---|---|
| committer | Zeb Ford-Reitz | 2011-05-24 05:39:57 (EDT) |
| commit | 6dae79c606a4d610fc5b6024febe5e787eb5c49f (patch) (side-by-side diff) | |
| tree | 22ec3c2b8f5ac6ca9cd11d2f859bc71db2507dc2 | |
| parent | d9cdccc6fe8e2183c1ec844ed23ec7b9579c6a89 (diff) | |
| download | org.eclipse.jubula.core-6dae79c606a4d610fc5b6024febe5e787eb5c49f.zip org.eclipse.jubula.core-6dae79c606a4d610fc5b6024febe5e787eb5c49f.tar.gz org.eclipse.jubula.core-6dae79c606a4d610fc5b6024febe5e787eb5c49f.tar.bz2 | |
fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=346713
As a low-risk solution to the problem, I have disabled deletion of
Object Mapping Categories that are not empty.
| -rw-r--r-- | org.eclipse.jubula.client.ui/plugin.xml | 6 | ||||
| -rw-r--r-- | org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/ObjectMappingCategoryPropertyTester.java | 19 |
2 files changed, 24 insertions, 1 deletions
diff --git a/org.eclipse.jubula.client.ui/plugin.xml b/org.eclipse.jubula.client.ui/plugin.xml index 6f9388b..b929bbc 100644 --- a/org.eclipse.jubula.client.ui/plugin.xml +++ b/org.eclipse.jubula.client.ui/plugin.xml @@ -99,7 +99,7 @@ class="org.eclipse.jubula.client.ui.propertytester.ObjectMappingCategoryPropertyTester" id="org.eclipse.jubula.client.ui.propertytester.ObjectMappingCategoryPropertyTester" namespace="org.eclipse.jubula.client.core.model.ObjectMappingCategory" - properties="isTopLevel" + properties="isTopLevel,isEmpty" type="org.eclipse.jubula.client.core.model.IObjectMappingCategoryPO"> </propertyTester> <propertyTester @@ -1956,6 +1956,10 @@ property="org.eclipse.jubula.client.core.model.ObjectMappingCategory.isTopLevel" value="false"> </test> + <test + property="org.eclipse.jubula.client.core.model.ObjectMappingCategory.isEmpty" + value="true"> + </test> </iterate> <iterate ifEmpty="false" operator="and"> <instanceof diff --git a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/ObjectMappingCategoryPropertyTester.java b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/ObjectMappingCategoryPropertyTester.java index 927c257..a220277 100644 --- a/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/ObjectMappingCategoryPropertyTester.java +++ b/org.eclipse.jubula.client.ui/src/org/eclipse/jubula/client/ui/propertytester/ObjectMappingCategoryPropertyTester.java @@ -29,6 +29,9 @@ public class ObjectMappingCategoryPropertyTester extends PropertyTester { /** the id of the "isTopLevel" property */ public static final String IS_TOP_LEVEL = "isTopLevel"; //$NON-NLS-1$ + /** the id of the "isEmpty" property */ + public static final String IS_EMPTY = "isEmpty"; //$NON-NLS-1$ + /** the logger */ private static final Log LOG = LogFactory.getLog(ObjectMappingCategoryPropertyTester.class); @@ -48,6 +51,11 @@ public class ObjectMappingCategoryPropertyTester extends PropertyTester { boolean expectedBoolean = expectedValue instanceof Boolean ? ((Boolean)expectedValue).booleanValue() : true; return areSameType == expectedBoolean; + } else if (property.equals(IS_EMPTY)) { + boolean isEmpty = testEmpty(category); + boolean expectedBoolean = expectedValue instanceof Boolean + ? ((Boolean)expectedValue).booleanValue() : true; + return isEmpty == expectedBoolean; } LOG.warn(NLS.bind(Messages.PropertyTesterPropertyNotSupported, @@ -74,4 +82,15 @@ public class ObjectMappingCategoryPropertyTester extends PropertyTester { return category.getParent() == null; } + /** + * + * @param category The Object Mapping Category to test. + * @return <code>true</code> if the given category is empty. + * Otherwise <code>false</code>. + */ + private boolean testEmpty(IObjectMappingCategoryPO category) { + + return category.getUnmodifiableAssociationList().isEmpty() + && category.getUnmodifiableCategoryList().isEmpty(); + } } |

