Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-10-06 17:45:31 +0000
committerMichael Valenta2004-10-06 17:45:31 +0000
commiteae4dea4cdde1675d5488962fe0cecfe5520e0e9 (patch)
tree01856d1640a6059804be8e8206813993744a4304
parent1e0fc4cefea757ee25eae7adfe55e0c2664ed5f4 (diff)
downloadeclipse.platform.team-eae4dea4cdde1675d5488962fe0cecfe5520e0e9.tar.gz
eclipse.platform.team-eae4dea4cdde1675d5488962fe0cecfe5520e0e9.tar.xz
eclipse.platform.team-eae4dea4cdde1675d5488962fe0cecfe5520e0e9.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java68
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java73
2 files changed, 77 insertions, 64 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
index e8e8964ee..35ada8c6f 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java
@@ -10,16 +10,24 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.subscribers.ChangeSet;
+import org.eclipse.team.core.subscribers.IChangeSetChangeListener;
import org.eclipse.team.core.subscribers.SubscriberChangeSetCollector;
-import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
+import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
/**
@@ -42,9 +50,56 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
private final ChangeSetModelProvider provider;
+ private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
+
+ public void setAdded(final ChangeSet set) {
+ provider.runViewUpdate(new Runnable() {
+ public void run() {
+ // Remove any resources that are in the new set
+ remove(set.getResources());
+ provider.createActiveChangeSetModelElement(set);
+ }
+ });
+
+ }
+
+ public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
+ provider.runViewUpdate(new Runnable() {
+ public void run() {
+ // Refresh the label for both of the sets involved
+ provider.refreshLabel(previousDefault);
+ provider.refreshLabel(set);
+ }
+ });
+ }
+
+ public void setRemoved(final ChangeSet set) {
+ provider.runViewUpdate(new Runnable() {
+ public void run() {
+ provider.removeModelElementForSet(set);
+ remove(set);
+ }
+ });
+ }
+
+ public void nameChanged(final ChangeSet set) {
+ provider.runViewUpdate(new Runnable() {
+ public void run() {
+ provider.refreshLabel(set);
+ }
+ });
+ }
+
+ public void resourcesChanged(final ChangeSet set, final IResource[] resources) {
+ // Changes are handled by the sets themselves.
+ }
+
+ };
+
public ActiveChangeSetCollector(ISynchronizePageConfiguration configuration, ChangeSetModelProvider provider) {
this.configuration = configuration;
this.provider = provider;
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
}
public ISynchronizePageConfiguration getConfiguration() {
@@ -72,7 +127,10 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
activeSets.clear();
// Now repopulate
- if (seedSet != null) {
+ if (seedSet == null) {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ } else {
+ getActiveChangeSetManager().addListener(activeChangeSetListener);
provider.createActiveChangeSetModelElements();
add(seedSet.getSyncInfos());
}
@@ -262,4 +320,8 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {
// Errors are not injected into the active change sets
}
+
+ public void dispose() {
+ getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
index bbcf139ba..15be300f6 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java
@@ -93,58 +93,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
private ActiveChangeSetCollector activeCollector;
- private IChangeSetChangeListener activeChangeSetListener = new IChangeSetChangeListener() {
-
- public void setAdded(final ChangeSet set) {
- syncExec(new Runnable() {
- public void run() {
- // Remove any resources that are in the new set
- activeCollector.remove(set.getResources());
- createActiveChangeSetModelElement(set);
- }
- });
-
- }
-
- public void defaultSetChanged(final ChangeSet previousDefault, final ChangeSet set) {
- syncExec(new Runnable() {
- public void run() {
- // Refresh the label for both of the sets involved
- refreshLabel(getModelElement(previousDefault));
- refreshLabel(getModelElement(set));
- }
- });
- }
-
- private void refreshLabel(final ISynchronizeModelElement node) {
- if (node != null) {
- getViewer().refresh(node);
- }
- }
-
- public void setRemoved(final ChangeSet set) {
- syncExec(new Runnable() {
- public void run() {
- removeModelElementForSet(set);
- activeCollector.remove(set);
- }
- });
- }
-
- public void nameChanged(final ChangeSet set) {
- syncExec(new Runnable() {
- public void run() {
- refreshLabel(getModelElement(set));
- }
- });
- }
-
- public void resourcesChanged(final ChangeSet set, final IResource[] resources) {
- // Changes are handled by the sets themselves.
- }
-
- };
-
/* *****************************************************************************
* Descriptor for this model provider
*/
@@ -173,7 +121,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
}
if (changeSetCapability.supportsActiveChangeSets()) {
activeCollector = new ActiveChangeSetCollector(configuration, this);
- activeCollector.getActiveChangeSetManager().addListener(activeChangeSetListener);
configuration.addMenuGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, ChangeSetActionGroup.CHANGE_SET_GROUP);
}
}
@@ -234,7 +181,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
}
if (activeCollector != null) {
activeCollector.reset(null);
- activeCollector.getActiveChangeSetManager().removeListener(activeChangeSetListener);
}
// Then, re-enable the proper collection method
@@ -243,7 +189,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
checkedInCollector.reset(getSyncInfoSet());
} else if (activeCollector != null && getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())) {
- activeCollector.getActiveChangeSetManager().addListener(activeChangeSetListener);
activeCollector.reset(getSyncInfoSet());
} else {
// Forward the sync info to the root provider and trigger a build
@@ -387,8 +332,7 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
* Create a provider and node for the given change set
*/
private ISynchronizeModelProvider createProvider(ChangeSet set) {
- ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
- return createProviderRootedAt(node, set.getSyncInfoSet());
+ return createProvider(set, set.getSyncInfoSet());
}
/*
@@ -419,7 +363,7 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
checkedInCollector.dispose();
}
if (activeCollector != null) {
- activeCollector.getActiveChangeSetManager().removeListener(activeChangeSetListener);
+ activeCollector.dispose();
}
super.dispose();
}
@@ -443,7 +387,7 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
}
}
- private void removeModelElementForSet(final ChangeSet set) {
+ void removeModelElementForSet(final ChangeSet set) {
ISynchronizeModelElement node = getModelElement(set);
if (node != null) {
ISynchronizeModelProvider provider = getProviderRootedAt(node);
@@ -468,13 +412,20 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
provider = getProviderRootedAt(node);
}
if (provider == null) {
- provider = createActiveChangeSetProvider(set, activeCollector.getSyncInfoSet(set));
+ provider = createProvider(set, activeCollector.getSyncInfoSet(set));
}
provider.prepareInput(null);
}
- private ISynchronizeModelProvider createActiveChangeSetProvider(ChangeSet set, SyncInfoTree tree) {
+ private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree) {
ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
return createProviderRootedAt(node, tree);
}
+
+ public void refreshLabel(ChangeSet set) {
+ ISynchronizeModelElement node = getModelElement(set);
+ if (node != null) {
+ getViewer().refresh(node);
+ }
+ }
}

Back to the top