Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2017-09-01 02:15:02 -0400
committerMarvin Mueller2018-02-14 09:38:18 -0500
commitae558c31eeb580a6833ad79cf8ef08edc00ee376 (patch)
tree8c02e014a2d7527b34dd441f4c63fdecdc02372a
parentc8a6ed55fcfbc7d258d302a928cdfd693ad2163f (diff)
downloadorg.eclipse.jubula.core-ae558c31eeb580a6833ad79cf8ef08edc00ee376.tar.gz
org.eclipse.jubula.core-ae558c31eeb580a6833ad79cf8ef08edc00ee376.tar.xz
org.eclipse.jubula.core-ae558c31eeb580a6833ad79cf8ef08edc00ee376.zip
Fix problems with decorations
the problems should be cleared completly before the local checks runs. Also refreshing the ObjectMapping after a change in the ObjectMappingEditor occurred Change-Id: I406387a99229584e7ad6b50f809e7fae630350ca
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/INodePO.java5
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/NodePO.java5
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/AbstractTestCaseEditor.java92
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java3
4 files changed, 60 insertions, 45 deletions
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/INodePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/INodePO.java
index 558777c99..3ff95d0a0 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/INodePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/INodePO.java
@@ -241,6 +241,11 @@ public interface INodePO extends ITimestampPO {
public boolean removeProblem(IProblem problem);
/**
+ * clears the problem list which is necessary for local (editor) use of the Problems
+ */
+ public void clearProblems();
+
+ /**
* Returns an immutable list of problems. To remove or add problems, please
* use addProblem and removeProblem.
*
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/NodePO.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/NodePO.java
index 1d82cba84..5eef2ed80 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/NodePO.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/model/NodePO.java
@@ -688,6 +688,11 @@ abstract class NodePO implements INodePO {
}
/** {@inheritDoc} */
+ public void clearProblems() {
+ m_problems.clear();
+ }
+
+ /** {@inheritDoc} */
public boolean removeProblem(IProblem problem) {
return m_problems.remove(problem);
}
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 78fa1f015..ac112c4ed 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
@@ -11,15 +11,18 @@
package org.eclipse.jubula.client.ui.rcp.editors;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
+
+import javax.persistence.EntityManager;
import org.apache.commons.collections.IteratorUtils;
import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ICoreRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
@@ -36,9 +39,6 @@ import org.eclipse.jubula.client.core.businessprocess.TestCaseParamBP;
import org.eclipse.jubula.client.core.businessprocess.UsedToolkitBP;
import org.eclipse.jubula.client.core.businessprocess.compcheck.CompletenessGuard;
import org.eclipse.jubula.client.core.businessprocess.db.TimestampBP;
-import org.eclipse.jubula.client.core.businessprocess.problems.IProblem;
-import org.eclipse.jubula.client.core.businessprocess.problems.ProblemFactory;
-import org.eclipse.jubula.client.core.businessprocess.problems.ProblemType;
import org.eclipse.jubula.client.core.commands.CAPRecordedCommand;
import org.eclipse.jubula.client.core.events.DataChangedEvent;
import org.eclipse.jubula.client.core.events.DataEventDispatcher;
@@ -50,11 +50,11 @@ import org.eclipse.jubula.client.core.events.DataEventDispatcher.UpdateState;
import org.eclipse.jubula.client.core.model.ICapPO;
import org.eclipse.jubula.client.core.model.ICompNamesPairPO;
import org.eclipse.jubula.client.core.model.IComponentNamePO;
-import org.eclipse.jubula.client.core.model.IControllerPO;
import org.eclipse.jubula.client.core.model.IDataSetPO;
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.IParamDescriptionPO;
import org.eclipse.jubula.client.core.model.IParamNodePO;
import org.eclipse.jubula.client.core.model.IParameterInterfacePO;
@@ -81,6 +81,7 @@ import org.eclipse.jubula.client.core.utils.ParamValueConverter;
import org.eclipse.jubula.client.core.utils.StringHelper;
import org.eclipse.jubula.client.core.utils.TreeTraverser;
import org.eclipse.jubula.client.ui.constants.CommandIDs;
+import org.eclipse.jubula.client.ui.constants.Constants;
import org.eclipse.jubula.client.ui.provider.DecoratingCellLabelProvider;
import org.eclipse.jubula.client.ui.rcp.Plugin;
import org.eclipse.jubula.client.ui.rcp.constants.RCPCommandIDs;
@@ -111,8 +112,10 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IDecoratorManager;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchCommandConstants;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.CommandContributionItem;
@@ -127,7 +130,26 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
/** central test data update listener */
private CentralTestDataUpdateListener m_ctdUpdateListener =
new CentralTestDataUpdateListener();
-
+ /** update job for renewing the decorator*/
+ private Job m_decoraterUpdateJob =
+ Job.create("Update decoraters", new ICoreRunnable() { //$NON-NLS-1$
+ @Override
+ public void run(IProgressMonitor monitor) {
+ Plugin.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ IDecoratorManager dm = PlatformUI.getWorkbench()
+ .getDecoratorManager();
+ try {
+ dm.setEnabled(Constants.CC_DECORATOR_ID, true);
+ dm.update(Constants.CC_DECORATOR_ID);
+ } catch (CoreException e) {
+ LOG.error(e.getLocalizedMessage(), e);
+ }
+ }
+ });
+ }
+ });
/**
* Creates the initial Context of this Editor.<br>
* Subclasses may override this method.
@@ -273,7 +295,16 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
public void runLocalChecks() {
INodePO node = (INodePO) getEditorHelper().getEditSupport()
.getWorkVersion();
+ node.clearProblems();
+ for (Iterator<INodePO> childIterator =
+ node.getAllNodeIter(); childIterator.hasNext();) {
+ INodePO next = childIterator.next();
+ next.clearProblems();
+ }
CompletenessGuard.checkAll(node, new NullProgressMonitor());
+ m_decoraterUpdateJob.setPriority(Job.DECORATE);
+ m_decoraterUpdateJob.schedule(300);
+
}
/**
@@ -798,6 +829,16 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
} else if (po instanceof IComponentNamePO
&& updState != UpdateState.onlyInEditor) {
handleCompNameChanged((IComponentNamePO) po, dataState);
+ } else if (po instanceof IObjectMappingPO
+ && updState != UpdateState.onlyInEditor) {
+ IPersistentObject workversion =
+ getEditorHelper().getEditSupport().getWorkVersion();
+ if (workversion instanceof ITestSuitePO) {
+ EntityManager session =
+ getEditorHelper().getEditSupport().getSession();
+ session.refresh(session.find(po.getClass(), po.getId()));
+ }
+ runLocalChecks();
}
}
@@ -999,43 +1040,6 @@ public abstract class AbstractTestCaseEditor extends AbstractJBEditor
refresh();
setSelection(new StructuredSelection(addedNode));
}
-
- /**
- * Checks for empty controllers
- * @param node the node
- */
- private void checkForEmptyControllers(INodePO node) {
- for (Iterator<INodePO> it = node.getNodeListIterator();
- it.hasNext(); ) {
- INodePO next = it.next();
- if (next instanceof IControllerPO) {
- removeIncompleteProblems((IControllerPO) next);
- }
- }
- Set<IProblem> copy = new HashSet<IProblem>(node.getProblems());
- for (IProblem problem : copy) {
- if (problem.equals(ProblemFactory.ERROR_IN_CHILD)) {
- node.removeProblem(problem);
- break;
- }
- }
- CompletenessGuard.checkEmptyContainer(node);
- }
-
- /**
- * Removes empty controller error markers from a node
- * @param cont the ConditionPO node
- */
- private void removeIncompleteProblems(IControllerPO cont) {
- Set<IProblem> copy = new HashSet<IProblem>(cont.getProblems());
- for (IProblem problem : copy) {
- if (problem.getProblemType().equals(
- ProblemType.REASON_IF_WITHOUT_TEST)) {
- cont.removeProblem(problem);
- return;
- }
- }
- }
/**
* @return the icon of the editor
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
index fcb10f553..750998eaa 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/dataset/AbstractDataSetPage.java
@@ -1367,7 +1367,8 @@ public abstract class AbstractDataSetPage extends Page
getParamInterfaceObj().getSpecificationUser());
}
// Not perfect, because the actual value being persisted is not exactly 'value'...
- if (value.length() > IPersistentObject.MAX_STR_LGT_CHAR) {
+ if (value != null
+ && value.length() > IPersistentObject.MAX_STR_LGT_CHAR) {
value = value.substring(0, IPersistentObject.MAX_STR_LGT_CHAR);
if (value.getBytes(StandardCharsets.UTF_8).length
> IPersistentObject.MAX_STRING_LENGTH) {

Back to the top