author | timkelly |
Thu, 30 Jul 2009 11:56:23 -0500 | |
changeset 40 | eb3c938c7fef |
permissions | -rw-r--r-- |
40
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
1 |
/******************************************************************************* |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
2 |
* Copyright (c) 2000, 2006 IBM Corporation and others. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
3 |
* All rights reserved. This program and the accompanying materials |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
5 |
* which accompanies this distribution, and is available at |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
7 |
* |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
8 |
* Contributors: |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
9 |
* IBM Corporation - initial API and implementation |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
10 |
*******************************************************************************/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
11 |
package org.eclipse.core.internal.localstore; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
12 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
13 |
import java.util.ArrayList; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
14 |
import java.util.List; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
15 |
import org.eclipse.core.internal.resources.*; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
16 |
import org.eclipse.core.internal.utils.Messages; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
17 |
import org.eclipse.core.resources.IResourceStatus; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
18 |
import org.eclipse.core.resources.ResourcesPlugin; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
19 |
import org.eclipse.core.runtime.*; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
20 |
import org.eclipse.osgi.util.NLS; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
21 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
22 |
// |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
23 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
24 |
* Visits a unified tree, and collects local sync information in |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
25 |
* a multi-status. At the end of the visit, the resource tree will NOT |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
26 |
* be synchronized with the file system, but all discrepancies between |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
27 |
* the two will be recorded in the returned status. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
28 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
29 |
public class CollectSyncStatusVisitor extends RefreshLocalVisitor { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
30 |
protected List affectedResources; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
31 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
32 |
* Determines how to treat cases where the resource is missing from |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
33 |
* the local file system. When performing a deletion with force=false, |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
34 |
* we don't care about files that are out of sync because they do not |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
35 |
* exist in the file system. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
36 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
37 |
private boolean ignoreLocalDeletions = false; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
38 |
protected MultiStatus status; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
39 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
40 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
41 |
* Creates a new visitor, whose sync status will have the given title. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
42 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
43 |
public CollectSyncStatusVisitor(String multiStatusTitle, IProgressMonitor monitor) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
44 |
super(monitor); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
45 |
status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IStatus.INFO, multiStatusTitle, null); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
46 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
47 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
48 |
protected void changed(Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
49 |
String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
50 |
status.add(new ResourceStatus(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message)); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
51 |
if (affectedResources == null) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
52 |
affectedResources = new ArrayList(20); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
53 |
affectedResources.add(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
54 |
resourceChanged = true; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
55 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
56 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
57 |
protected void createResource(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
58 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
59 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
60 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
61 |
protected void deleteResource(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
62 |
if (!ignoreLocalDeletions) |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
63 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
64 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
65 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
66 |
protected void fileToFolder(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
67 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
68 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
69 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
70 |
protected void folderToFile(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
71 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
72 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
73 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
74 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
75 |
* Returns the list of resources that were not synchronized with |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
76 |
* the local file system, or <code>null</code> if all resources |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
77 |
* are synchronized. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
78 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
79 |
public List getAffectedResources() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
80 |
return affectedResources; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
81 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
82 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
83 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
84 |
* Returns the sync status that has been collected as a result of this visit. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
85 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
86 |
public MultiStatus getSyncStatus() { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
87 |
return status; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
88 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
89 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
90 |
protected void makeLocal(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
91 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
92 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
93 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
94 |
protected void refresh(Container parent) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
95 |
changed(parent); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
96 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
97 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
98 |
protected void resourceChanged(UnifiedTreeNode node, Resource target) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
99 |
changed(target); |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
100 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
101 |
|
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
102 |
/** |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
103 |
* Instructs this visitor to ignore changes due to local deletions |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
104 |
* in the file system. |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
105 |
*/ |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
106 |
public void setIgnoreLocalDeletions(boolean value) { |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
107 |
this.ignoreLocalDeletions = value; |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
108 |
} |
eb3c938c7fef
set up for custom build for logging. merged from carbide 2.1.x builds. this state is as it comes from platform. Next changelog will add the updates.
timkelly
parents:
diff
changeset
|
109 |
} |