Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-10-07 16:15:26 +0000
committerMichael Valenta2004-10-07 16:15:26 +0000
commit9a602c9783143e2dd206770939fe9a66fd62c14c (patch)
treebbf40fa2a2ac550bfa256fdb96e308dcbf0fbf30
parentf9819f75d694740f47c7b3bf22b101f61a6a6c0a (diff)
downloadeclipse.platform.team-9a602c9783143e2dd206770939fe9a66fd62c14c.tar.gz
eclipse.platform.team-9a602c9783143e2dd206770939fe9a66fd62c14c.tar.xz
eclipse.platform.team-9a602c9783143e2dd206770939fe9a66fd62c14c.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java106
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ActiveChangeSetCollector.java59
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider.java12
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelProvider.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java1
7 files changed, 93 insertions, 104 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
index 0639ae5ad..00620620f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSChangeSetCollector.java
@@ -136,7 +136,7 @@ public class CVSChangeSetCollector extends SyncInfoSetChangeSetCollector {
* @see org.eclipse.team.core.subscribers.ChangeSet#getComment()
*/
public String getComment() {
- return getName();
+ return ""; //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
index 9f7670c87..87671876d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java
@@ -10,51 +10,24 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.synchronize;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.util.*;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.core.ITeamStatus;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
-import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
-import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
+import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.core.Assert;
import org.eclipse.team.internal.core.TeamPlugin;
+import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.Policy;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePage;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;
+import org.eclipse.team.ui.synchronize.*;
/**
* This class is reponsible for creating and maintaining a presentation model of
@@ -718,8 +691,31 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* well.
* @param node the root node
*/
- protected void clearModelObjects(ISynchronizeModelElement node) {
- // Clear all the children of the node
+ protected final void clearModelObjects(ISynchronizeModelElement node) {
+ // When clearing model objects, any parents of the node
+ // That are not out-of-sync, not the model root and that would
+ // be empty as a result of this clear, should also be cleared.
+ ISynchronizeModelElement rootToClear = getRootToClear(node);
+ // Recursively clear the nodes from the root
+ recursiveClearModelObjects(rootToClear);
+ if (node == getModelRoot()) {
+ IDiffElement[] children = node.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ IDiffElement element = children[i];
+ ((SynchronizeModelElement)node).remove(element);
+ }
+ } else {
+ SynchronizeModelElement parent = ((SynchronizeModelElement)node.getParent());
+ if (parent != null) parent.remove(node);
+ }
+ }
+
+ /**
+ * Method that sublcasses can oiverride when clearing model objects.
+ * @param node the node to be cleared recursively
+ */
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ // Clear all the children of the node
IDiffElement[] children = node.getChildren();
for (int i = 0; i < children.length; i++) {
IDiffElement element = children[i];
@@ -727,33 +723,27 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
ISynchronizeModelElement sme = (ISynchronizeModelElement) element;
ISynchronizeModelProvider provider = getProvider(sme);
if (provider != null && provider instanceof AbstractSynchronizeModelProvider) {
- ((AbstractSynchronizeModelProvider)provider).clearModelObjects(sme);
+ ((AbstractSynchronizeModelProvider)provider).recursiveClearModelObjects(sme);
} else {
- clearModelObjects(sme);
+ recursiveClearModelObjects(sme);
}
}
}
- // Remove the node from the tree
- removeToRoot(node);
-
// Notify the update handler that the node has been cleared
updateHandler.modelObjectCleared(node);
- }
-
- /*
+ }
+
+ /*
* Remove to root should only remove to the root of the provider and not the
* diff tree.
*/
- private void removeToRoot(ISynchronizeModelElement node) {
- if (node == getModelRoot()) return;
- IDiffContainer parent = node.getParent();
- if (parent != null) {
- ISynchronizeModelElement element = (ISynchronizeModelElement)parent;
- ((SynchronizeModelElement)element).remove(node);
- if (!element.hasChildren() && !isOutOfSync(element)) {
- removeToRoot(element);
- }
+ private ISynchronizeModelElement getRootToClear(ISynchronizeModelElement node) {
+ if (node == getModelRoot()) return node;
+ ISynchronizeModelElement parent = (ISynchronizeModelElement)node.getParent();
+ if (parent != null && parent != getModelRoot() && !isOutOfSync(parent) && parent.getChildren().length == 1) {
+ return getRootToClear(parent);
}
+ return node;
}
/*
@@ -814,7 +804,7 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
* This is a callback from the model update handler that gets invoked
* when a node is removed from the viewer. It is only invoked for the
* root level model provider. A removed node may have children for
- * which a <code>nodeRemoved</code> callback is not recieved (see
+ * which a <code>nodeRemoved</code> callback is not received (see
* <code>modelObjectCleared</code>).
* @param node
*/
@@ -825,9 +815,9 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
/**
* This is a callback from the model update handler that gets invoked
* when a node is cleared from the model. It is only invoked for the
- * root level model provider. This calbakc is deep in the sense that
- * a callbakc is sent for each node that is cleared.
- * @param node the node that was removed.
+ * root level model provider. This callback is deep in the sense that
+ * a callback is sent for each node that is cleared.
+ * @param node the node that was cleared.
*/
public void modelObjectCleared(ISynchronizeModelElement node) {
// Default is to do nothing
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 6d434dfe9..5a0f5780b 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
@@ -20,6 +20,7 @@ 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.TeamException;
import org.eclipse.team.core.subscribers.ChangeSet;
import org.eclipse.team.core.subscribers.IChangeSetChangeListener;
import org.eclipse.team.core.subscribers.SubscriberChangeSetCollector;
@@ -28,6 +29,7 @@ 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.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
/**
@@ -117,23 +119,27 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
// Now repopulate
if (seedSet != null) {
- // Show all active change sets even if they are empty
- sets = getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- add(set);
- }
- // The above will add all sync info that are contained in sets.
- // We still need to add uncontained infos to the root set
- SyncInfo[] syncInfos = seedSet.getSyncInfos();
- for (int i = 0; i < syncInfos.length; i++) {
- SyncInfo info = syncInfos[i];
- if (isLocalChange(info)) {
- ChangeSet[] containingSets = findChangeSets(info);
- if (containingSets.length == 0) {
- rootSet.add(info);
- }
- }
+ if (getConfiguration().getComparisonType() == ISynchronizePageConfiguration.THREE_WAY) {
+ // Show all active change sets even if they are empty
+ sets = getActiveChangeSetManager().getSets();
+ for (int i = 0; i < sets.length; i++) {
+ ChangeSet set = sets[i];
+ add(set);
+ }
+ // The above will add all sync info that are contained in sets.
+ // We still need to add uncontained infos to the root set
+ SyncInfo[] syncInfos = seedSet.getSyncInfos();
+ for (int i = 0; i < syncInfos.length; i++) {
+ SyncInfo info = syncInfos[i];
+ if (isLocalChange(info)) {
+ ChangeSet[] containingSets = findChangeSets(info);
+ if (containingSets.length == 0) {
+ rootSet.add(info);
+ }
+ }
+ }
+ } else {
+ add(seedSet.getSyncInfos());
}
}
}
@@ -212,6 +218,14 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
* Return if this sync info is an outgoing change.
*/
private boolean isLocalChange(SyncInfo info) {
+ if (!info.getComparator().isThreeWay()) {
+ try {
+ // Obtain the sync info from the subscriber and use it to see if the change is local
+ info = getActiveChangeSetManager().getSubscriber().getSyncInfo(info.getLocal());
+ } catch (TeamException e) {
+ TeamUIPlugin.log(e);
+ }
+ }
return (info.getComparator().isThreeWay()
&& ((info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.OUTGOING ||
(info.getKind() & SyncInfo.DIRECTION_MASK) == SyncInfo.CONFLICTING));
@@ -238,17 +252,19 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
SyncInfoTree sis = (SyncInfoTree)activeSets.get(set);
// Register the listener last since the add will
// look for new elements
- boolean listen = false;
+ boolean added = false;
if (sis == null) {
sis = new SyncInfoTree();
activeSets.put(set, sis);
- listen = true;
+ added = true;
} else {
sis.clear();
}
sis.addAll(select(set.getSyncInfoSet().getSyncInfos()));
- if (listen)
+ if (added) {
set.getSyncInfoSet().addSyncSetChangedListener(this);
+ listener.setAdded(set);
+ }
return sis;
}
@@ -273,9 +289,8 @@ public class ActiveChangeSetCollector implements ISyncInfoSetChangeListener {
sis = new SyncInfoTree();
set.getSyncInfoSet().addSyncSetChangedListener(this);
activeSets.put(set, sis);
+ sis.addAll(select(set.getSyncInfoSet().getSyncInfos()));
}
- sis.clear();
- sis.addAll(select(set.getSyncInfoSet().getSyncInfos()));
return sis;
}
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 8e5ef14d1..0888c4d49 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
@@ -312,8 +312,8 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.CompositeModelProvider#clearModelObjects(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
*/
- protected void clearModelObjects(ISynchronizeModelElement node) {
- super.clearModelObjects(node);
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ super.recursiveClearModelObjects(node);
if (node == getModelRoot()) {
rootToProvider.clear();
// Throw away the embedded sorter
@@ -404,14 +404,6 @@ public class ChangeSetModelProvider extends CompositeModelProvider {
removeProvider(provider);
}
}
-
- public void createActiveChangeSetModelElements() {
- ChangeSet[] sets = activeCollector.getActiveChangeSetManager().getSets();
- for (int i = 0; i < sets.length; i++) {
- ChangeSet set = sets[i];
- createChangeSetModelElement(set, activeCollector.getSyncInfoSet(set));
- }
- }
public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree) {
// Add the model element and provider for the set
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
index 274bd0d0e..4c9c94d01 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompositeModelProvider.java
@@ -208,15 +208,6 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
elementToProvider.put(node, provider);
super.nodeAdded(node, provider);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#nodeRemoved(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
- */
- protected void nodeRemoved(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider) {
- // Update the resource-to-element map and the element-to-provider map
- modelObjectCleared(node);
- super.nodeRemoved(node, provider);
- }
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#modelObjectCleared(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
@@ -239,8 +230,8 @@ public abstract class CompositeModelProvider extends AbstractSynchronizeModelPro
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#clearModelObjects(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
*/
- protected void clearModelObjects(ISynchronizeModelElement node) {
- super.clearModelObjects(node);
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ super.recursiveClearModelObjects(node);
if (node == getModelRoot()) {
clearProviders();
}
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 38cecdca3..c359bce83 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
@@ -131,8 +131,8 @@ public abstract class SynchronizeModelProvider extends AbstractSynchronizeModelP
/* (non-Javadoc)
* @see org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider#clearModelObjects(org.eclipse.team.ui.synchronize.ISynchronizeModelElement)
*/
- protected void clearModelObjects(ISynchronizeModelElement node) {
- super.clearModelObjects(node);
+ protected void recursiveClearModelObjects(ISynchronizeModelElement node) {
+ super.recursiveClearModelObjects(node);
if (node == getModelRoot()) {
// If we are clearing everything under the root
// than just purge the resource map
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
index 66ecd65e2..a6c97f782 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler.java
@@ -432,6 +432,7 @@ public class SynchronizeModelUpdateHandler extends BackgroundEventHandler implem
* @param node the node that was cleared
*/
public void modelObjectCleared(ISynchronizeModelElement node) {
+ node.removePropertyChangeListener(listener);
this.provider.modelObjectCleared(node);
if (DEBUG) {
System.out.println("Node cleared: " + getDebugDisplayLabel(node)); //$NON-NLS-1$

Back to the top