use of org.tigris.subversion.subclipse.core.commands.GetStatusCommand in project subclipse by subclipse.
the class GenerateDiffFileAction method getModifiedResources.
protected IResource[] getModifiedResources(IResource[] resources, IProgressMonitor iProgressMonitor) throws SVNException {
final List modified = new ArrayList();
List unversionedFolders = new ArrayList();
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
// This check is for when the action is called with unmanaged resources
if (svnResource.getRepository() == null) {
continue;
}
// get adds, deletes, updates and property updates.
GetStatusCommand command = new GetStatusCommand(svnResource, true, false);
command.run(iProgressMonitor);
ISVNStatus[] statuses = command.getStatuses();
for (int j = 0; j < statuses.length; j++) {
if (SVNStatusUtils.isReadyForCommit(statuses[j]) || SVNStatusUtils.isMissing(statuses[j])) {
IResource currentResource = SVNWorkspaceRoot.getResourceFor(resource, statuses[j]);
if (currentResource != null) {
ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(currentResource);
if (!localResource.isIgnored()) {
if (!SVNStatusUtils.isManaged(statuses[j])) {
if (!isSymLink(currentResource)) {
if (currentResource.getType() != IResource.FILE)
unversionedFolders.add(currentResource);
else if (!modified.contains(currentResource)) {
modified.add(currentResource);
if (currentResource instanceof IContainer)
statusMap.put(currentResource, statuses[j].getPropStatus());
else
statusMap.put(currentResource, statuses[j].getTextStatus());
if (addToUnadded(currentResource))
unaddedList.add(currentResource);
}
}
} else if (!modified.contains(currentResource)) {
modified.add(currentResource);
if (currentResource instanceof IContainer)
statusMap.put(currentResource, statuses[j].getPropStatus());
else
statusMap.put(currentResource, statuses[j].getTextStatus());
}
}
}
}
}
}
// get unadded resources and add them to the list.
IResource[] unaddedResources = getUnaddedResources(unversionedFolders, iProgressMonitor);
for (int i = 0; i < unaddedResources.length; i++) {
if (!modified.contains(unaddedResources[i])) {
if (unaddedResources[i].getType() == IResource.FILE) {
modified.add(unaddedResources[i]);
statusMap.put(unaddedResources[i], SVNStatusKind.UNVERSIONED);
}
if (addToUnadded(unaddedResources[i]))
unaddedList.add(unaddedResources[i]);
}
}
return (IResource[]) modified.toArray(new IResource[modified.size()]);
}
Aggregations