use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.
the class UpdateSynchronizeAction 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.INCOMING, 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 true;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (!svnResource.isManaged() || svnResource.isAdded())
return false;
} catch (SVNException e) {
return false;
}
}
return true;
}
};
}
use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.
the class OverrideAndUpdateSynchronizeAction method getSyncInfoFilter.
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
public boolean select(SyncInfo info) {
SyncInfoDirectionFilter filter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
if (!filter.select(info))
return false;
IStructuredSelection selection = getStructuredSelection();
boolean removeUnAdded = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_REMOVE_UNADDED_RESOURCES_ON_REPLACE);
Iterator iter = selection.iterator();
while (iter.hasNext()) {
ISynchronizeModelElement element = (ISynchronizeModelElement) iter.next();
IResource resource = element.getResource();
if (resource == null) {
return false;
}
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnResource == null) {
return false;
}
try {
if (!resource.exists() && !svnResource.getStatusFromCache().isDeleted()) {
return false;
}
if (svnResource.isAdded())
return false;
if (!removeUnAdded && !svnResource.isManaged())
return false;
} catch (SVNException e) {
return false;
}
}
return true;
}
};
}
use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.
the class RevertSynchronizeAction method getSyncInfoFilter.
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
*/
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
@SuppressWarnings("rawtypes")
public boolean select(SyncInfo info) {
SyncInfoDirectionFilter outgoingFilter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING, SyncInfo.CONFLICTING });
if (!outgoingFilter.select(info))
return false;
IStructuredSelection selection = getStructuredSelection();
Iterator iter = selection.iterator();
boolean removeUnAdded = SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_REMOVE_UNADDED_RESOURCES_ON_REPLACE);
while (iter.hasNext()) {
ISynchronizeModelElement element = (ISynchronizeModelElement) iter.next();
IResource resource = element.getResource();
if (resource == null)
continue;
if (resource.isLinked())
return false;
if (!removeUnAdded) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (!svnResource.isManaged())
return false;
} catch (SVNException e) {
return false;
}
}
}
return true;
}
};
}
use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.
the class IgnoreSynchronizeAction 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.OUTGOING });
if (!filter.select(info))
return false;
IStructuredSelection selection = getStructuredSelection();
ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
IResource resource = element.getResource();
if (resource == null)
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
// If the resource is a IProject then the action should not be enabled.
if (svnResource.getIResource() instanceof IProject)
return false;
// If the parent is not managed there is no way to set the svn:ignore property
if (!svnResource.getParent().isManaged()) {
return false;
}
return !svnResource.getStatus().isManaged() && resource.exists();
} catch (SVNException e) {
return false;
}
}
};
}
use of org.eclipse.team.core.synchronize.FastSyncInfoFilter in project subclipse by subclipse.
the class AddSynchronizeAction method getSyncInfoFilter.
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
public boolean select(SyncInfo info) {
SyncInfoDirectionFilter filter = new SyncInfoDirectionFilter(new int[] { SyncInfo.OUTGOING });
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)
return false;
if (resource.isLinked())
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (svnResource.isManaged())
return false;
} catch (SVNException e) {
return false;
}
}
return true;
}
};
}
Aggregations