use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class UpdateResourcesCommand method run.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(final IProgressMonitor monitor) throws SVNException {
final ISVNClientAdapter svnClient = root.getRepository().getSVNClient();
OperationManager.getInstance().beginOperation(svnClient, new OperationProgressNotifyListener(monitor, svnClient));
try {
List<IProject> projectList = new ArrayList<IProject>();
for (IResource currentResource : resources) {
IProject project = currentResource.getProject();
if (!projectList.contains(project)) {
projectList.add(project);
}
}
if (conflictResolver != null) {
svnClient.addConflictResolutionCallback(conflictResolver);
}
IProject[] projects = new IProject[projectList.size()];
projectList.toArray(projects);
ISchedulingRule rule = MultiRule.combine(projects);
SVNProviderPlugin.run(new ISVNRunnable() {
public void run(final IProgressMonitor pm) throws SVNException {
try {
monitor.beginTask(null, 100 * resources.length);
svnClient.addNotifyListener(operationResourceCollector);
if (resources.length == 1) {
monitor.subTask(resources[0].getName());
svnClient.update(resources[0].getLocation().toFile(), revision, depth, setDepth, ignoreExternals, force);
updatedResources.add(resources[0]);
monitor.worked(100);
} else {
File[] files = new File[resources.length];
for (int i = 0; i < resources.length; i++) {
files[i] = resources[i].getLocation().toFile();
updatedResources.add(resources[i]);
}
svnClient.update(files, revision, depth, setDepth, ignoreExternals, force);
monitor.worked(100);
}
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
monitor.done();
if (svnClient != null) {
if (conflictResolver != null) {
svnClient.addConflictResolutionCallback(null);
}
svnClient.removeNotifyListener(operationResourceCollector);
root.getRepository().returnSVNClient(svnClient);
}
}
}
}, rule, Policy.monitorFor(monitor));
} finally {
OperationManager.getInstance().endOperation(true, operationResourceCollector.getOperationResources());
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class UpgradeResourcesCommand method run.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.core.commands.ISVNCommand#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws SVNException {
ISVNClientAdapter svnClient = null;
try {
monitor.beginTask(null, 100 * resources.length);
svnClient = root.getRepository().getSVNClient();
OperationManager.getInstance().beginOperation(svnClient);
for (int i = 0; i < resources.length; i++) {
svnClient.upgrade(resources[i].getLocation().toFile());
monitor.worked(100);
}
} catch (SVNClientException e) {
throw SVNException.wrapException(e);
} finally {
root.getRepository().returnSVNClient(svnClient);
OperationManager.getInstance().endOperation();
monitor.done();
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class AliasManager method getAliases.
private Alias[] getAliases(SVNUrl url, boolean checkParents) {
ArrayList<Alias> aliases = new ArrayList<Alias>();
ISVNClientAdapter client = null;
try {
client = SVNProviderPlugin.getPlugin().getSVNClient();
ISVNProperty property = null;
SVNProviderPlugin.disableConsoleLogging();
property = client.propertyGet(url, "subclipse:tags");
SVNProviderPlugin.enableConsoleLogging();
if (property != null && property.getValue() != null) {
getAliases(aliases, property.getValue(), url.toString());
} else {
if (url.getParent() != null && checkParents)
return getAliases(url.getParent(), checkParents);
}
} catch (SVNClientException e) {
} catch (SVNException e) {
} finally {
SVNProviderPlugin.enableConsoleLogging();
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
Alias[] aliasArray = new Alias[aliases.size()];
aliases.toArray(aliasArray);
return aliasArray;
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class LogEntry method getPathsOnDemand.
private ISVNLogMessageChangePath[] getPathsOnDemand(SVNUrl url) {
ISVNLogMessage[] tmpMessage;
ISVNClientAdapter client = null;
try {
// errors will not log to console
client = SVNProviderPlugin.getPlugin().getSVNClient();
SVNProviderPlugin.disableConsoleLogging();
tmpMessage = client.getLogMessages(url, getRevision(), getRevision(), true);
SVNProviderPlugin.enableConsoleLogging();
if (tmpMessage != null && tmpMessage.length > 0)
return tmpMessage[0].getChangedPaths();
else
return null;
} catch (Exception e) {
SVNProviderPlugin.enableConsoleLogging();
return null;
} finally {
SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
}
}
use of org.tigris.subversion.svnclientadapter.ISVNClientAdapter in project subclipse by subclipse.
the class MergeWizardAdvancedPage method initializeLocations.
private void initializeLocations() {
combosInitialized = true;
MergeWizard wizard = (MergeWizard) getWizard();
resource = wizard.getResource();
resources = wizard.getResources();
svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
mergeInfoPaths = null;
repositoryLocation = svnResource.getRepository().getLocation();
if (((MergeWizard) getWizard()).suggestMergeSources()) {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.setTaskName(Messages.MergeWizardStandardPage_retrievingMergeSourceInfo);
monitor.beginTask(Messages.MergeWizardStandardPage_retrievingMergeSourceInfo, IProgressMonitor.UNKNOWN);
// $NON-NLS-1$
monitor.subTask("");
ISVNClientAdapter svnClient = null;
try {
svnClient = svnResource.getRepository().getSVNClient();
try {
mergeInfoPaths = svnClient.suggestMergeSources(new SVNUrl(commonRoot), SVNRevision.HEAD);
} catch (Exception e1) {
}
} catch (Exception e) {
Activator.handleError(e);
} finally {
svnResource.getRepository().returnSVNClient(svnClient);
}
monitor.done();
}
};
try {
getContainer().run(true, false, runnable);
} catch (Exception e2) {
Activator.handleError(e2);
}
}
boolean valueAdded = false;
List<String> fromUrls = new ArrayList<String>();
if (mergeInfoPaths != null) {
for (int i = 0; i < mergeInfoPaths.length; i++) {
String url = mergeInfoPaths[i].substring(repositoryLocation.length());
if (!fromUrls.contains(url))
fromUrls.add(url);
valueAdded = true;
}
}
String previousFromUrls = null;
String previousFromUrl = null;
try {
previousFromUrls = Activator.getDefault().getDialogSettings().get("mergeFromUrls_" + commonRoot);
} catch (Exception e) {
}
if (previousFromUrls != null) {
String[] urls = previousFromUrls.split("\\,");
for (String url : urls) {
if (!fromUrls.contains(url))
fromUrls.add(url);
valueAdded = true;
}
if (urls.length > 0)
previousFromUrl = urls[0];
}
if (!valueAdded && commonRoot != null) {
fromUrls.add(commonRoot.substring(repositoryLocation.length()));
}
for (String url : fromUrls) {
fromCombo.add(url);
toCombo.add(url);
}
if (previousFromUrl != null)
fromCombo.setText(previousFromUrl);
else if (fromCombo.getItemCount() > 0)
fromCombo.setText(fromCombo.getItem(0));
if (fromCombo.getText() != null && fromCombo.getText().length() > 0) {
try {
String previousToUrl = Activator.getDefault().getDialogSettings().get("mergeToUrl_" + fromCombo.getText());
if (previousToUrl != null) {
if (toCombo.indexOf(previousToUrl) == -1) {
toCombo.add(previousToUrl);
}
try {
boolean useFromDeselected = Activator.getDefault().getDialogSettings().getBoolean("mergeUseFromDeselected_" + fromCombo.getText());
if (useFromDeselected) {
useFromButton.setSelection(false);
}
} catch (Exception e) {
}
if (!useFromButton.getSelection()) {
toCombo.setVisible(true);
toCombo.setText(previousToUrl);
}
}
} catch (Exception e) {
}
}
}
Aggregations