Search in sources :

Example 6 with SVNStatusKind

use of org.tigris.subversion.svnclientadapter.SVNStatusKind in project subclipse by subclipse.

the class SVNLocalCompareSummaryInput method getDiffSummary.

private SVNDiffSummary[] getDiffSummary(RemoteResourceStatus[] statuses, ISVNLocalResource resource) {
    List diffSummaryList = new ArrayList();
    int rootPathLength = resource.getResource().getLocation().toString().length() + 1;
    for (int i = 0; i < statuses.length; i++) {
        if (statuses[i].getFile() != null && !statuses[i].getNodeKind().equals(SVNNodeKind.DIR)) {
            SVNStatusKind textStatus = statuses[i].getTextStatus();
            boolean propertyChanges = !statuses[i].getPropStatus().equals(SVNStatusKind.NORMAL) && !statuses[i].getPropStatus().equals(SVNStatusKind.NONE);
            boolean localChanges = false;
            if (textStatus.equals(SVNStatusKind.NONE) && propertyChanges && statuses[i].getNodeKind().equals(SVNNodeKind.FILE)) {
                IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(statuses[i].getPath()));
                if (file != null) {
                    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(file);
                    try {
                        LocalResourceStatus localStatus = svnResource.getStatus();
                        if (localStatus != null) {
                            localChanges = localStatus.isAdded() || localStatus.isDirty();
                        }
                    } catch (SVNException e) {
                    }
                }
            }
            if (!textStatus.equals(SVNStatusKind.NONE) || !propertyChanges || localChanges) {
                SVNDiffKind diffKind = null;
                if (statuses[i].getTextStatus().equals(SVNStatusKind.ADDED))
                    diffKind = SVNDiffKind.ADDED;
                else if (statuses[i].getTextStatus().equals(SVNStatusKind.DELETED))
                    diffKind = SVNDiffKind.DELETED;
                else
                    diffKind = SVNDiffKind.MODIFIED;
                SVNDiffSummary diffSummary = new SVNDiffSummary(statuses[i].getPath().substring(rootPathLength).replaceAll("\\\\", "/"), diffKind, propertyChanges, // $NON-NLS-1$ //$NON-NLS-2$
                statuses[i].getNodeKind().toInt());
                diffSummaryList.add(diffSummary);
            }
        }
    }
    SVNDiffSummary[] diffSummaries = new SVNDiffSummary[diffSummaryList.size()];
    diffSummaryList.toArray(diffSummaries);
    return diffSummaries;
}
Also used : Path(org.eclipse.core.runtime.Path) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) SVNDiffSummary(org.tigris.subversion.svnclientadapter.SVNDiffSummary) ArrayList(java.util.ArrayList) List(java.util.List) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) SVNDiffKind(org.tigris.subversion.svnclientadapter.SVNDiffSummary.SVNDiffKind)

Aggregations

SVNStatusKind (org.tigris.subversion.svnclientadapter.SVNStatusKind)6 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)3 ArrayList (java.util.ArrayList)2 IResource (org.eclipse.core.resources.IResource)2 SVNException (org.tigris.subversion.subclipse.core.SVNException)2 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)2 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 IFile (org.eclipse.core.resources.IFile)1 Path (org.eclipse.core.runtime.Path)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 TeamException (org.eclipse.team.core.TeamException)1 SyncInfo (org.eclipse.team.core.synchronize.SyncInfo)1 RemoteResourceStatus (org.tigris.subversion.subclipse.core.resources.RemoteResourceStatus)1 WizardDialogWithPersistedLocation (org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation)1 GenerateDiffFileWizard (org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard)1 ISVNStatus (org.tigris.subversion.svnclientadapter.ISVNStatus)1