use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RemoteContentProvider method cancelJobs.
public void cancelJobs(ISVNRepositoryLocation[] roots) {
if (manager != null) {
for (int i = 0; i < roots.length; i++) {
ISVNRepositoryLocation root = roots[i];
cancelJobs(root);
}
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class RemoteContentProvider method getChildren.
/**
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof Branches)
return ((Branches) parentElement).getBranches();
if (parentElement instanceof Tags)
return ((Tags) parentElement).getTags();
if (useDeferredContentManager && manager != null) {
Object[] children = manager.getChildren(parentElement);
if (children != null) {
if (parentElement instanceof ISVNRepositoryLocation && (rootFolder != null || branches != null || tags != null)) {
ArrayList childrenArray = new ArrayList();
if (rootFolder != null)
childrenArray.add(rootFolder);
if (branches != null)
childrenArray.add(branches);
if (tags != null)
childrenArray.add(tags);
for (int i = 0; i < children.length; i++) childrenArray.add(children[i]);
children = new Object[childrenArray.size()];
childrenArray.toArray(children);
}
// that the real children are being fetched
return children;
}
}
return super.getChildren(parentElement);
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation 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.ISVNRepositoryLocation in project subclipse by subclipse.
the class CopyAction method execute.
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
final IResource[] resources = getSelectedResources();
final IProject project = resources[0].getProject();
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), project, false, // $NON-NLS-1$
Policy.bind("CopyAction.selectionLabel"));
if (dialog.open() == ContainerSelectionDialog.CANCEL)
return;
Object[] result = dialog.getResult();
if (result == null || result.length == 0)
return;
final Path path = (Path) result[0];
IProject selectedProject;
File target = null;
if (path.segmentCount() == 1) {
selectedProject = ResourcesPlugin.getWorkspace().getRoot().getProject(path.toString());
target = selectedProject.getLocation().toFile();
} else {
IFile targetFile = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
selectedProject = targetFile.getProject();
target = targetFile.getLocation().toFile();
}
final IProject targetProject = selectedProject;
final File destPath = target;
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ISVNClientAdapter client = null;
ISVNRepositoryLocation repository = null;
try {
ISVNLocalResource svnTargetResource = SVNWorkspaceRoot.getSVNResourceFor(targetProject);
for (int i = 0; i < resources.length; i++) {
final IResource resource = resources[i];
if (client == null) {
repository = SVNWorkspaceRoot.getSVNResourceFor(resources[i]).getRepository();
client = repository.getSVNClient();
}
File checkFile = new File(destPath.getPath() + File.separator + resource.getName());
File srcPath = new File(resource.getLocation().toString());
File newDestPath = new File(destPath.getPath() + File.separator + resource.getName());
if (checkFile.exists()) {
IInputValidator inputValidator = new IInputValidator() {
public String isValid(String newText) {
if (newText.equals(resource.getName()))
// $NON-NLS-1$
return Policy.bind("CopyAction.nameConflictSame");
return null;
}
};
InputDialog inputDialog = new InputDialog(getShell(), Policy.bind("CopyAction.nameConflictTitle"), Policy.bind("CopyAction.nameConflictMessage", resource.getName()), "Copy of " + resource.getName(), // $NON-NLS-1$
inputValidator);
if (inputDialog.open() == InputDialog.CANCEL)
return;
String newName = inputDialog.getValue();
if (newName == null || newName.trim().length() == 0)
return;
newDestPath = new File(destPath.getPath() + File.separator + newName);
}
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
boolean sameRepository = svnTargetResource != null && svnTargetResource.getRepository() != null && svnTargetResource.getRepository().getLocation().equals(svnResource.getRepository().getLocation());
if (sameRepository)
client.copy(srcPath, newDestPath);
else
client.doExport(srcPath, newDestPath, true);
SVNUIPlugin.getPlugin().getRepositoryManager().resourceCreated(null, null);
}
targetProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("CopyAction.copy"), // $NON-NLS-1$
e.getMessage());
} finally {
if (repository != null) {
repository.returnSVNClient(client);
}
}
}
});
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class CreateRemoteFolderAction method execute.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
*/
protected void execute(IAction action) {
ISVNRemoteFolder remoteFolder = null;
if (selection.getFirstElement() instanceof ISVNRemoteFolder)
remoteFolder = (ISVNRemoteFolder) selection.getFirstElement();
else if (selection.getFirstElement() instanceof ISVNRepositoryLocation)
remoteFolder = ((ISVNRepositoryLocation) selection.getFirstElement()).getRootFolder();
else if (selection.getFirstElement() instanceof ISVNRemoteFile)
remoteFolder = ((ISVNRemoteFile) selection.getFirstElement()).getParent();
NewRemoteFolderWizard wizard = new NewRemoteFolderWizard(remoteFolder);
WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
wizard.setParentDialog(dialog);
dialog.open();
}
Aggregations