Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-10-01 13:08:36 +0000
committerMichael Valenta2004-10-01 13:08:36 +0000
commitb215b8d73ed65ca396d169e9dc8283871b8d8281 (patch)
tree54acdb50dd632c6c651ea620c93c78ee5d15d394
parent0078240fae70faa9c725e0b5be2a663ef35c4aca (diff)
downloadeclipse.platform.team-b215b8d73ed65ca396d169e9dc8283871b8d8281.tar.gz
eclipse.platform.team-b215b8d73ed65ca396d169e9dc8283871b8d8281.tar.xz
eclipse.platform.team-b215b8d73ed65ca396d169e9dc8283871b8d8281.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider.java20
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java6
3 files changed, 27 insertions, 6 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
index bb50291c0..ba6249258 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/Utils.java
@@ -683,4 +683,11 @@ public class Utils {
});
}
}
+
+ public static SyncInfo getSyncInfo(ISynchronizeModelElement node) {
+ if (node instanceof IAdaptable) {
+ return (SyncInfo)((IAdaptable)node).getAdapter(SyncInfo.class);
+ }
+ return null;
+ }
}
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 b3d9c9bae..a65cc09fb 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
@@ -645,13 +645,27 @@ public abstract class AbstractSynchronizeModelProvider implements ISynchronizeMo
if (node == getModelRoot()) return;
IDiffContainer parent = node.getParent();
if (parent != null) {
- ((SynchronizeModelElement)parent).remove(node);
- if (!parent.hasChildren()) {
- removeToRoot((ISynchronizeModelElement)parent);
+ ISynchronizeModelElement element = (ISynchronizeModelElement)parent;
+ ((SynchronizeModelElement)element).remove(node);
+ if (!element.hasChildren() && !isOutOfSync(element)) {
+ removeToRoot(element);
}
}
}
+ /*
+ * Return whether the node represents an out-of-sync resource.
+ */
+ protected boolean isOutOfSync(ISynchronizeModelElement node) {
+ SyncInfo info = Utils.getSyncInfo(node);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
+ protected boolean isOutOfSync(IResource resource) {
+ SyncInfo info = getSyncInfoSet().getSyncInfo(resource);
+ return (info != null && info.getKind() != SyncInfo.IN_SYNC);
+ }
+
/**
* Return the provider that created and manages the given
* model element. The default is to return the receiver.
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
index ad4f801d3..c71ae7814 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/CompressedFoldersModelProvider.java
@@ -266,7 +266,7 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
IResource resource = resources[i];
if (!removedProjects.contains(resource.getProject())) {
if (resource.getType() == IResource.FILE) {
- if (isCompressedParentEmpty(resource)) {
+ if (isCompressedParentEmpty(resource) && !isOutOfSync(resource.getParent())) {
// The parent compressed folder is also empty so remove it
removeFromViewer(resource.getParent());
} else {
@@ -284,8 +284,8 @@ public class CompressedFoldersModelProvider extends HierarchicalModelProvider {
}
}
}
-
- protected int getLogicalModelDepth(IResource resource) {
+
+ protected int getLogicalModelDepth(IResource resource) {
if(resource.getType() == IResource.PROJECT) {
return IResource.DEPTH_INFINITE;
} else {

Back to the top