1 11 package org.eclipse.core.internal.localstore; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 import org.eclipse.core.internal.resources.*; 16 import org.eclipse.core.internal.utils.Messages; 17 import org.eclipse.core.resources.IResourceStatus; 18 import org.eclipse.core.resources.ResourcesPlugin; 19 import org.eclipse.core.runtime.*; 20 import org.eclipse.osgi.util.NLS; 21 22 29 public class CollectSyncStatusVisitor extends RefreshLocalVisitor { 30 protected List affectedResources; 31 37 private boolean ignoreLocalDeletions = false; 38 protected MultiStatus status; 39 40 43 public CollectSyncStatusVisitor(String multiStatusTitle, IProgressMonitor monitor) { 44 super(monitor); 45 status = new MultiStatus(ResourcesPlugin.PI_RESOURCES, IStatus.INFO, multiStatusTitle, null); 46 } 47 48 protected void changed(Resource target) { 49 String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); 50 status.add(new ResourceStatus(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message)); 51 if (affectedResources == null) 52 affectedResources = new ArrayList (20); 53 affectedResources.add(target); 54 resourceChanged = true; 55 } 56 57 protected void createResource(UnifiedTreeNode node, Resource target) { 58 changed(target); 59 } 60 61 protected void deleteResource(UnifiedTreeNode node, Resource target) { 62 if (!ignoreLocalDeletions) 63 changed(target); 64 } 65 66 protected void fileToFolder(UnifiedTreeNode node, Resource target) { 67 changed(target); 68 } 69 70 protected void folderToFile(UnifiedTreeNode node, Resource target) { 71 changed(target); 72 } 73 74 79 public List getAffectedResources() { 80 return affectedResources; 81 } 82 83 86 public MultiStatus getSyncStatus() { 87 return status; 88 } 89 90 protected void makeLocal(UnifiedTreeNode node, Resource target) { 91 changed(target); 92 } 93 94 protected void refresh(Container parent) { 95 changed(parent); 96 } 97 98 protected void resourceChanged(UnifiedTreeNode node, Resource target) { 99 changed(target); 100 } 101 102 106 public void setIgnoreLocalDeletions(boolean value) { 107 this.ignoreLocalDeletions = value; 108 } 109 } 110 | Popular Tags |