Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalgorzata Janczarska2012-10-31 15:06:07 +0000
committerMalgorzata Janczarska2012-10-31 15:06:07 +0000
commitb5dcf67fe304d69b6ba81d5d1cdaca10ecb32041 (patch)
treeadf4d1f80ea298b2f1e558c0673cd60244628d5b
parentd6fbf99046f2aec01c425c2c618d7589e56c5a70 (diff)
downloadeclipse.platform.team-b5dcf67fe304d69b6ba81d5d1cdaca10ecb32041.tar.gz
eclipse.platform.team-b5dcf67fe304d69b6ba81d5d1cdaca10ecb32041.tar.xz
eclipse.platform.team-b5dcf67fe304d69b6ba81d5d1cdaca10ecb32041.zip
Bug 362219 -Synchronize with Workspace errors with "outer scope rule"v20121031-150607I20121106-0800I20121031-2000
when new file is not under an existing folder
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java20
2 files changed, 9 insertions, 20 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
index d6a4c374e..eb4dc5a41 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/mapping/provider/MergeContext.java
@@ -409,7 +409,8 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
}
/**
- * Default implementation that returns the resource itself.
+ * Default implementation that returns the resource itself if it exists
+ * and the first existing parent if the resource does not exist.
* Subclass should override to provide the appropriate rule.
* @see org.eclipse.team.core.mapping.IMergeContext#getMergeRule(IDiff)
*/
@@ -418,6 +419,12 @@ public abstract class MergeContext extends SynchronizationContext implements IMe
IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
ISchedulingRule rule;
if (!resource.exists()) {
+ // for additions return rule for all parents that need to be created
+ IContainer parent = resource.getParent();
+ while (!parent.exists()) {
+ resource = parent;
+ parent = parent.getParent();
+ }
rule = ruleFactory.createRule(resource);
} else if (SyncInfoToDiffConverter.getRemote(diff) == null){
rule = ruleFactory.deleteRule(resource);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java
index 5291d0927..d3f901aeb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/patch/ApplyPatchSubscriberMergeContext.java
@@ -13,9 +13,8 @@ package org.eclipse.team.internal.ui.synchronize.patch;
import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.HunkResult;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
-import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.diff.IThreeWayDiff;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
@@ -99,21 +98,4 @@ public class ApplyPatchSubscriberMergeContext extends SubscriberMergeContext {
throws CoreException {
// do nothing
}
-
- public ISchedulingRule getMergeRule(IDiff diff) {
- IResource resource = getDiffTree().getResource(diff);
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace()
- .getRuleFactory();
- if (!resource.exists()) {
- // for additions return rule for all parents that need to be created
- IContainer parent = resource.getParent();
- while (!parent.exists()) {
- resource = parent;
- parent = parent.getParent();
- }
- return ruleFactory.createRule(resource);
- } else {
- return super.getMergeRule(diff);
- }
- }
}

Back to the top