Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2015-06-08 13:07:18 +0000
committerSebastian Struckmann2015-06-08 13:07:18 +0000
commit099b9abab3053e627f3620236c8ed586252198dc (patch)
tree324d11d1f49201aabc38dc86062f3d66d4aa2fa0 /org.eclipse.jubula.client.ui.rcp
parent383ea8ecf4d03b37ab9571fadfc8d444d5dd3006 (diff)
downloadorg.eclipse.jubula.core-099b9abab3053e627f3620236c8ed586252198dc.tar.gz
org.eclipse.jubula.core-099b9abab3053e627f3620236c8ed586252198dc.tar.xz
org.eclipse.jubula.core-099b9abab3053e627f3620236c8ed586252198dc.zip
Sprint task - Prevent wrong thread access
Diffstat (limited to 'org.eclipse.jubula.client.ui.rcp')
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/CentralTestDataEditor.java84
-rw-r--r--org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/JBPropertiesPage.java77
2 files changed, 100 insertions, 61 deletions
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/CentralTestDataEditor.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/CentralTestDataEditor.java
index 5faf06256..8bd65cc87 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/CentralTestDataEditor.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/editors/CentralTestDataEditor.java
@@ -329,15 +329,19 @@ public class CentralTestDataEditor extends AbstractJBEditor implements
/** {@inheritDoc} */
protected void setInitialInput() {
- ITestDataCategoryPO rootPOTop = (ITestDataCategoryPO)getEditorHelper()
- .getEditSupport().getWorkVersion();
- try {
- getTreeViewer().getTree().getParent().setRedraw(false);
- getTreeViewer().setInput(rootPOTop);
- getTreeViewer().expandAll();
- } finally {
- getTreeViewer().getTree().getParent().setRedraw(true);
- }
+ final ITestDataCategoryPO rootPOTop = (ITestDataCategoryPO)
+ getEditorHelper().getEditSupport().getWorkVersion();
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ getTreeViewer().getTree().getParent().setRedraw(false);
+ getTreeViewer().setInput(rootPOTop);
+ getTreeViewer().expandAll();
+ } finally {
+ getTreeViewer().getTree().getParent().setRedraw(true);
+ }
+ }
+ });
}
/** {@inheritDoc} */
@@ -452,15 +456,23 @@ public class CentralTestDataEditor extends AbstractJBEditor implements
}
/** {@inheritDoc} */
- public void handleDataChanged(DataChangedEvent... events) {
- getMainTreeViewer().getTree().setRedraw(false);
+ public void handleDataChanged(final DataChangedEvent... events) {
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ getMainTreeViewer().getTree().setRedraw(false);
+ }
+ });
try {
for (DataChangedEvent e : events) {
handleDataChanged(e.getPo(), e.getDataState(),
e.getUpdateState());
}
} finally {
- getMainTreeViewer().getTree().setRedraw(true);
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ getMainTreeViewer().getTree().setRedraw(true);
+ }
+ });
}
}
@@ -521,28 +533,32 @@ public class CentralTestDataEditor extends AbstractJBEditor implements
* @param category
* the category
*/
- private void handleDataChanged(
- DataState dataState, ITestDataCategoryPO category) {
-
- switch (dataState) {
- case Added:
- getTreeViewer().add(category.getParent(), category);
- getTreeViewer().setSelection(new StructuredSelection(category));
- break;
- case Deleted:
- getTreeViewer().remove(category);
- break;
- case Renamed:
- getTreeViewer().update(category, null);
- break;
- case ReuseChanged:
- break;
- case StructureModified:
- getTreeViewer().refresh(category);
- break;
- default:
- break;
- }
+ private void handleDataChanged(final DataState dataState,
+ final ITestDataCategoryPO category) {
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ switch (dataState) {
+ case Added:
+ getTreeViewer().add(category.getParent(), category);
+ getTreeViewer().setSelection(
+ new StructuredSelection(category));
+ break;
+ case Deleted:
+ getTreeViewer().remove(category);
+ break;
+ case Renamed:
+ getTreeViewer().update(category, null);
+ break;
+ case ReuseChanged:
+ break;
+ case StructureModified:
+ getTreeViewer().refresh(category);
+ break;
+ default:
+ break;
+ }
+ }
+ });
}
/**
diff --git a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/JBPropertiesPage.java b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/JBPropertiesPage.java
index 82e9b3d0e..7a094cbf2 100644
--- a/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/JBPropertiesPage.java
+++ b/org.eclipse.jubula.client.ui.rcp/src/org/eclipse/jubula/client/ui/rcp/views/JBPropertiesPage.java
@@ -521,7 +521,11 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
case Added:
case StructureModified:
if (po != null) {
- m_treeViewer.refresh();
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ m_treeViewer.refresh();
+ }
+ });
expandTrackedChanges();
}
break;
@@ -529,7 +533,11 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
clearView();
break;
case Renamed:
- m_treeViewer.refresh();
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ m_treeViewer.refresh();
+ }
+ });
expandTrackedChanges();
break;
default:
@@ -549,9 +557,13 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
* For some reasons the view needs persuasion to expand the tracked changes sometimes.
*/
private void expandTrackedChanges() {
- m_treeViewer.setExpandedState(
- Messages.SpecTestCaseGUIPropertySourceTrackedChangesCategory,
- true);
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ m_treeViewer.setExpandedState(Messages.
+ SpecTestCaseGUIPropertySourceTrackedChangesCategory,
+ true);
+ }
+ });
}
/**
@@ -577,8 +589,12 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
return;
}
}
- m_treeViewer.refresh();
- m_treeViewer.expandToLevel(m_treeViewer.getAutoExpandLevel());
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ m_treeViewer.refresh();
+ m_treeViewer.expandToLevel(m_treeViewer.getAutoExpandLevel());
+ }
+ });
}
/**
@@ -593,27 +609,30 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
IStructuredSelection selection) {
m_correspondingPart = part;
- Object firstElement = selection.getFirstElement();
+ final Object firstElement = selection.getFirstElement();
- if (firstElement == null) {
- // e.g. when a project was opened and no view has a selection
- m_treeViewer.setSelection(null);
- m_treeViewer.setInput(null);
- } else { // TestResultNodes must be excluded
- if (firstElement instanceof IPersistentObject) {
- m_treeViewer.setInput(firstElement);
- workaroundSpringySelection(m_focusCellManager);
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (firstElement == null) {
+ // e.g. when a project was opened and no view has a selection
+ m_treeViewer.setSelection(null);
+ m_treeViewer.setInput(null);
+ } else { // TestResultNodes must be excluded
+ if (firstElement instanceof IPersistentObject) {
+ m_treeViewer.setInput(firstElement);
+ workaroundSpringySelection(m_focusCellManager);
+ }
+ }
+ // property informations should be collapsed by default
+ m_treeViewer.setExpandedState(Messages.
+ OMTechNameGUIPropertySourcePropertyInformation,
+ false);
+
+ // parameters should be expanded by default
+ m_treeViewer.setExpandedState(Messages.
+ SpecTestCaseGUIPropertySourceParameter, true);
}
- }
-
- // property informations should be collapsed by default
- m_treeViewer.setExpandedState(Messages.
- OMTechNameGUIPropertySourcePropertyInformation,
- false);
-
- // parameters should be expanded by default
- m_treeViewer.setExpandedState(Messages.
- SpecTestCaseGUIPropertySourceParameter, true);
+ });
expandTrackedChanges();
@@ -1106,7 +1125,11 @@ public class JBPropertiesPage extends Page implements IDataChangedListener,
* {@inheritDoc}
*/
public void handleLanguageChanged(Locale locale) {
- m_treeViewer.refresh();
+ Plugin.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ m_treeViewer.refresh();
+ }
+ });
}
/**

Back to the top