use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class ShowPropertiesSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
try {
SvnPropertiesView view = (SvnPropertiesView) showView(SvnPropertiesView.VIEW_ID);
if (view != null) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
view.showSvnProperties(svnResource);
}
} catch (SVNException e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
});
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource 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.tigris.subversion.subclipse.core.ISVNLocalResource 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.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class ResolveSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
boolean folderSelected = false;
propertyConflicts = false;
textConflicts = false;
treeConflicts = false;
canceled = false;
final IResource[] resources = set.getResources();
for (int i = 0; i < resources.length; i++) {
if (resources[i] instanceof IContainer) {
folderSelected = true;
break;
}
if (!propertyConflicts || !textConflicts || !treeConflicts) {
ISVNLocalResource resource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
try {
LocalResourceStatus status = resource.getStatus();
if (status != null && status.isPropConflicted())
propertyConflicts = true;
if (status != null && status.isTextConflicted())
textConflicts = true;
if (status != null && status.hasTreeConflict())
treeConflicts = true;
} catch (SVNException e) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
if (folderSelected) {
selectedResolution = ISVNConflictResolver.Choice.chooseMerged;
} else {
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (propertyConflicts && !textConflicts) {
String message;
if (resources.length > 1)
// $NON-NLS-1$
message = Policy.bind("ResolveAction.confirmMultiple");
else
message = Policy.bind("ResolveAction.confirm", // $NON-NLS-1$
resources[0].getName());
if (!MessageDialog.openConfirm(getShell(), Policy.bind("ResolveOperation.taskName"), message)) {
// $NON-NLS-1$
canceled = true;
return;
}
selectedResolution = ISVNConflictResolver.Choice.chooseMerged;
} else {
SvnWizardMarkResolvedPage markResolvedPage = new SvnWizardMarkResolvedPage(resources);
markResolvedPage.setPropertyConflicts(propertyConflicts);
markResolvedPage.setTreeConflicts(treeConflicts);
SvnWizard wizard = new SvnWizard(markResolvedPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.CANCEL) {
canceled = true;
return;
}
selectedResolution = markResolvedPage.getResolution();
}
}
});
}
if (canceled)
return;
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException {
ISVNRepositoryLocation repository = null;
ISVNClientAdapter svnClient = null;
try {
for (int i = 0; i < resources.length; i++) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
repository = svnResource.getRepository();
svnClient = repository.getSVNClient();
svnClient.resolve(resources[i].getLocation().toFile(), selectedResolution);
repository.returnSVNClient(svnClient);
repository = null;
svnClient = null;
// for some reason, just refreshing the file won't cut it.
resources[i].getParent().refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} catch (CoreException e) {
throw new InvocationTargetException(e);
} catch (SVNClientException e) {
throw new InvocationTargetException(e);
} finally {
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
}
}, false, /* cancelable */
PROGRESS_BUSYCURSOR);
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource 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;
}
};
}
Aggregations