Search in sources :

Example 1 with FastSyncInfoFilter

use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.

the class EditConflictsSynchronizeAction method getSyncInfoFilter.

/* (non-Javadoc)
   * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
   */
protected FastSyncInfoFilter getSyncInfoFilter() {
    return new FastSyncInfoFilter() {

        public boolean select(SyncInfo info) {
            IStructuredSelection selection = getStructuredSelection();
            if (selection.size() != 1)
                return false;
            ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
            IResource resource = element.getResource();
            if (resource == null)
                return false;
            if (!(resource instanceof IFile))
                return false;
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {
                return svnResource.getStatus().isTextConflicted();
            } catch (SVNException e) {
                return false;
            }
        }
    };
}
Also used : IFile(org.eclipse.core.resources.IFile) SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) ISynchronizeModelElement(org.eclipse.team.ui.synchronize.ISynchronizeModelElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) FastSyncInfoFilter(org.eclipse.team.core.synchronize.FastSyncInfoFilter)

Example 2 with FastSyncInfoFilter

use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.

the class ShowHistorySynchronizeAction method getSyncInfoFilter.

/* (non-Javadoc)
   * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
   */
protected FastSyncInfoFilter getSyncInfoFilter() {
    return new FastSyncInfoFilter() {

        public boolean select(SyncInfo info) {
            IStructuredSelection selection = getStructuredSelection();
            if (selection.size() != 1)
                return false;
            ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
            IResource resource = element.getResource();
            if (resource == null)
                return false;
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {
                return !resource.exists() || (svnResource.getStatus().isManaged() && !svnResource.getStatus().isAdded());
            } catch (SVNException e) {
                return false;
            }
        }
    };
}
Also used : SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) ISynchronizeModelElement(org.eclipse.team.ui.synchronize.ISynchronizeModelElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) FastSyncInfoFilter(org.eclipse.team.core.synchronize.FastSyncInfoFilter)

Example 3 with FastSyncInfoFilter

use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.

the class MarkMergedSynchronizeAction method getSyncInfoFilter.

/* (non-Javadoc)
   * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
   */
protected FastSyncInfoFilter getSyncInfoFilter() {
    return new FastSyncInfoFilter() {

        public boolean select(SyncInfo info) {
            SyncInfoDirectionFilter filter = new SyncInfoDirectionFilter(new int[] { SyncInfo.CONFLICTING });
            if (!filter.select(info))
                return false;
            IStructuredSelection selection = getStructuredSelection();
            Iterator iter = selection.iterator();
            while (iter.hasNext()) {
                ISynchronizeModelElement element = (ISynchronizeModelElement) iter.next();
                IResource resource = element.getResource();
                if (resource == null || !resource.exists())
                    return false;
                ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
                try {
                    if (!svnResource.isManaged() || svnResource.isAdded())
                        return false;
                } catch (SVNException e) {
                    return false;
                }
            }
            return true;
        }
    };
}
Also used : SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) Iterator(java.util.Iterator) ISynchronizeModelElement(org.eclipse.team.ui.synchronize.ISynchronizeModelElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) FastSyncInfoFilter(org.eclipse.team.core.synchronize.FastSyncInfoFilter)

Example 4 with FastSyncInfoFilter

use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.

the class ResolveSynchronizeAction method getSyncInfoFilter.

/* (non-Javadoc)
   * @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
   */
protected FastSyncInfoFilter getSyncInfoFilter() {
    return new FastSyncInfoFilter() {

        public boolean select(SyncInfo info) {
            IStructuredSelection selection = getStructuredSelection();
            Iterator iter = selection.iterator();
            while (iter.hasNext()) {
                ISynchronizeModelElement element = (ISynchronizeModelElement) iter.next();
                if (element.getResource() instanceof IFile) {
                    ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(element.getResource());
                    try {
                        if (svnResource.getStatus().isTextConflicted() || svnResource.getStatus().hasTreeConflict())
                            return true;
                    } catch (SVNException e) {
                    }
                }
            }
            return false;
        }
    };
}
Also used : IFile(org.eclipse.core.resources.IFile) SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) Iterator(java.util.Iterator) ISynchronizeModelElement(org.eclipse.team.ui.synchronize.ISynchronizeModelElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) FastSyncInfoFilter(org.eclipse.team.core.synchronize.FastSyncInfoFilter)

Example 5 with FastSyncInfoFilter

use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.

the class ShowPropertiesSynchronizeAction method getSyncInfoFilter.

protected FastSyncInfoFilter getSyncInfoFilter() {
    return new FastSyncInfoFilter() {

        public boolean select(SyncInfo info) {
            SyncInfoDirectionFilter outgoingFilter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING });
            if (!outgoingFilter.select(info))
                return false;
            IStructuredSelection selection = getStructuredSelection();
            if (selection.size() != 1)
                return false;
            ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
            IResource resource = element.getResource();
            if (resource == null)
                return false;
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {
                return !svnResource.getStatus().isDeleted() && svnResource.getStatus().isManaged() && resource.exists();
            } catch (SVNException e) {
                return false;
            }
        }
    };
}
Also used : SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) ISynchronizeModelElement(org.eclipse.team.ui.synchronize.ISynchronizeModelElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) IResource(org.eclipse.core.resources.IResource) FastSyncInfoFilter(org.eclipse.team.core.synchronize.FastSyncInfoFilter)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 FastSyncInfoFilter (org.eclipse.team.core.synchronize.FastSyncInfoFilter)10 SyncInfo (org.eclipse.team.core.synchronize.SyncInfo)10 ISynchronizeModelElement (org.eclipse.team.ui.synchronize.ISynchronizeModelElement)10 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)10 SVNException (org.tigris.subversion.subclipse.core.SVNException)10 IResource (org.eclipse.core.resources.IResource)9 Iterator (java.util.Iterator)6 IFile (org.eclipse.core.resources.IFile)2 IProject (org.eclipse.core.resources.IProject)1