Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-07 13:29:22 +0000
committerMichael Valenta2004-05-07 13:29:22 +0000
commitd1051141d35c43fc193d8dc7a11611e4f5ac2f30 (patch)
treec6a361e369b83daa3c91d4d824d6471386b47e27
parente0be7b99b3373cf46c03d4612d4a970358bb1bde (diff)
downloadeclipse.platform.team-d1051141d35c43fc193d8dc7a11611e4f5ac2f30.tar.gz
eclipse.platform.team-d1051141d35c43fc193d8dc7a11611e4f5ac2f30.tar.xz
eclipse.platform.team-d1051141d35c43fc193d8dc7a11611e4f5ac2f30.zip
Fixes to allow test cases to work
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java6
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java27
2 files changed, 30 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
index f54b0a2ba..7b13f6452 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java
@@ -450,8 +450,10 @@ public abstract class SynchronizeModelProvider implements ISyncInfoSetChangeList
final Object[][] selectedElements = new Object[1][1];
viewer.getControl().getDisplay().syncExec(new Runnable() {
public void run() {
- expandedElements[0] = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
- selectedElements[0] = ((IStructuredSelection) viewer.getSelection()).toArray();
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+ expandedElements[0] = ((AbstractTreeViewer) viewer).getVisibleExpandedElements();
+ selectedElements[0] = ((IStructuredSelection) viewer.getSelection()).toArray();
+ }
}
});
//
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java
index 363cb0462..ab356aa90 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/SynchronizeModelOperation.java
@@ -15,10 +15,12 @@ import java.util.List;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.team.ui.TeamOperation;
+import org.eclipse.ui.IWorkbenchPart;
/**
* A subscriber operation provides access to a {@link SyncInfoSet} containing
@@ -35,6 +37,29 @@ public abstract class SynchronizeModelOperation extends TeamOperation {
private IDiffElement[] elements;
+ /*
+ * Helper method for extacting the part safely from a configuration
+ */
+ private static IWorkbenchPart getPart(ISynchronizePageConfiguration configuration) {
+ if (configuration != null) {
+ ISynchronizePageSite site = configuration.getSite();
+ if (site != null) {
+ return site.getPart();
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Helper method for extacting the runnable context safely from a configuration
+ */
+ private static IRunnableContext getRunnableContext(ISynchronizePageConfiguration configuration) {
+ if (configuration != null) {
+ return configuration.getRunnableContext();
+ }
+ return null;
+ }
+
/**
* Create an operation that will operate on the given diff elements
* that were obtained from a view populated by a
@@ -42,7 +67,7 @@ public abstract class SynchronizeModelOperation extends TeamOperation {
* @param elements
*/
protected SynchronizeModelOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
- super(configuration.getSite().getPart(), configuration.getRunnableContext());
+ super(getPart(configuration), getRunnableContext(configuration));
this.elements = elements;
}

Back to the top