use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SvnWizardBranchTagPage method showLog.
protected void showLog() {
ISVNRemoteResource remoteResource = null;
if (resource == null)
remoteResource = this.remoteResource;
else {
try {
remoteResource = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getRemoteFile(url);
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), Policy.bind("MergeDialog.urlError") + " " + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
toUrlCombo.getText());
return;
}
HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
revisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
setPageComplete(canFinish());
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class ReplaceWithBranchTagWizardMainPage method showLog.
protected void showLog() {
ISVNRemoteResource remoteResource = null;
try {
remoteResource = SVNWorkspaceRoot.getSVNResourceFor(resources[0]).getRepository().getRemoteFile(new SVNUrl(urlCombo.getText()));
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), // $NON-NLS-1$
e.toString());
return;
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Policy.bind("MergeDialog.showLog"), Policy.bind("MergeDialog.urlError") + " " + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
urlCombo.getText());
return;
}
HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
revisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
setPageComplete(canFinish());
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class LogEntry method createLogEntriesFrom.
/**
* create the LogEntry for the logMessages
*
* @param logMessages
* @return
*/
public static ILogEntry[] createLogEntriesFrom(ISVNRemoteFile remoteFile, ISVNLogMessage[] logMessages, Tags[] tags, SVNUrl[] urls) {
ILogEntry[] result = new ILogEntry[logMessages.length];
for (int i = 0; i < logMessages.length; i++) {
ISVNLogMessage logMessage = logMessages[i];
ISVNRemoteResource correspondingResource;
correspondingResource = new RemoteFile(null, remoteFile.getRepository(), urls[i], logMessage.getRevision(), logMessage.getRevision(), logMessage.getDate(), logMessage.getAuthor());
result[i] = new LogEntry(logMessage, remoteFile, correspondingResource, (tags[i] != null) ? tags[i].getTags() : null);
}
return result;
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class MergeWizardAdvancedPage method showLog.
private void showLog(Text text) {
ISVNRemoteResource remoteResource = null;
if (text == fromRevisionText) {
try {
fromUrl = new SVNUrl(getUrl(getFrom()));
remoteResource = svnResource.getRepository().getRemoteFile(fromUrl);
} catch (Exception e) {
Activator.handleError(Messages.MergeWizardAdvancedPage_showLogError, e);
MessageDialog.openError(getShell(), Messages.MergeWizardAdvancedPage_showLog, e.toString());
return;
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Messages.MergeWizardAdvancedPage_showLog, Messages.MergeWizardAdvancedPage_invalidUrl + getFrom());
return;
}
}
if (text == toRevisionText) {
try {
toUrl = new SVNUrl(getUrl(getTo()));
remoteResource = svnResource.getRepository().getRemoteFile(toUrl);
} catch (Exception e) {
Activator.handleError(Messages.MergeWizardAdvancedPage_showLogError, e);
MessageDialog.openError(getShell(), Messages.MergeWizardAdvancedPage_showLog, e.toString());
return;
}
if (remoteResource == null) {
MessageDialog.openError(getShell(), Messages.MergeWizardAdvancedPage_showLog, Messages.MergeWizardAdvancedPage_invalidUrl + getTo());
return;
}
}
HistoryDialog dialog = null;
if ((text == fromRevisionText) || (text == toRevisionText))
dialog = new HistoryDialog(getShell(), remoteResource);
else
dialog = new HistoryDialog(getShell(), resource);
if (dialog.open() == HistoryDialog.CANCEL)
return;
ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
if (selectedEntries.length == 0)
return;
if ((text != null) && useFromButton.getSelection()) {
fromRevisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber() - 1));
fromRevisionButton.setSelection(true);
fromHeadButton.setSelection(false);
toRevisionText.setText(Long.toString(selectedEntries[0].getRevision().getNumber()));
toRevisionButton.setSelection(true);
toHeadButton.setSelection(false);
fromRevisionText.setEnabled(true);
toRevisionText.setEnabled(true);
return;
}
if ((text == fromRevisionText) || ((text == null) && (fromRevisionText.getText().trim().length() == 0))) {
fromRevisionText.setText(Long.toString(selectedEntries[0].getRevision().getNumber()));
fromRevisionButton.setSelection(true);
fromHeadButton.setSelection(false);
fromRevisionText.setEnabled(true);
}
if (text == toRevisionText) {
toRevisionText.setText(Long.toString(selectedEntries[0].getRevision().getNumber()));
toRevisionButton.setSelection(true);
toHeadButton.setSelection(false);
toRevisionText.setEnabled(true);
}
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class ShowRemoteHistoryAction method getSelectedRemoteResources.
protected ISVNRemoteResource[] getSelectedRemoteResources() {
MergeOutput mergeOutput = null;
ISVNRemoteResource remoteResource = null;
Iterator iter = fSelection.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof MergeResult) {
MergeResult mergeResult = (MergeResult) object;
IResource resource = mergeResult.getResource();
mergeOutput = mergeResult.getMergeOutput();
MergeOptions mergeOptions = mergeOutput.getMergeOptions();
SVNUrl svnUrl = mergeOptions.getFromUrl();
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
String resourceSubString = resource.getFullPath().toOSString().substring(mergeOutput.getTarget().length() + 1);
if (!resourceSubString.startsWith("/"))
// $NON-NLS-1$ //$NON-NLS-2$
resourceSubString = "/" + resourceSubString;
SVNUrl remoteResourceUrl = new SVNUrl(svnUrl.toString() + // $NON-NLS-1$ //$NON-NLS-2$
resourceSubString.replaceAll("\\\\", "/"));
remoteResource = svnResource.getRepository().getRemoteFile(remoteResourceUrl);
} catch (Exception e) {
Activator.handleError(Messages.ShowRemoteHistoryAction_error, e);
MessageDialog.openError(getShell(), Messages.ShowRemoteHistoryAction_title, e.getLocalizedMessage());
}
break;
}
if (object instanceof MergeResultsFolder) {
MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) object;
IContainer folder = mergeResultsFolder.getFolder();
mergeOutput = mergeResultsFolder.getMergeOutput();
MergeOptions mergeOptions = mergeOutput.getMergeOptions();
SVNUrl svnUrl = mergeOptions.getFromUrl();
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(folder);
try {
String resourceSubString = folder.getFullPath().toOSString().substring(mergeOutput.getTarget().length() + 1);
if (!resourceSubString.startsWith("/"))
// $NON-NLS-1$ //$NON-NLS-2$
resourceSubString = "/" + resourceSubString;
SVNUrl remoteResourceUrl = new SVNUrl(svnUrl.toString() + // $NON-NLS-1$ //$NON-NLS-2$
resourceSubString.replaceAll("\\\\", "/"));
remoteResource = svnResource.getRepository().getRemoteFile(remoteResourceUrl);
} catch (Exception e) {
Activator.handleError(Messages.ShowRemoteHistoryAction_error, e);
MessageDialog.openError(getShell(), Messages.ShowRemoteHistoryAction_title, e.getLocalizedMessage());
}
break;
}
}
if (remoteResource != null) {
ISVNRemoteResource[] selectedResource = { remoteResource };
SVNRevision.Number startRevision = null;
try {
startRevision = (SVNRevision.Number) SVNRevision.getRevision(Long.toString(mergeOutput.getLowerRevision()));
} catch (ParseException e) {
}
SVNRevision.Number endRevision = null;
if (mergeOutput.getUpperRevision() > 0) {
try {
endRevision = (SVNRevision.Number) SVNRevision.getRevision(Long.toString(mergeOutput.getUpperRevision()));
} catch (ParseException e) {
}
}
HistorySearchViewerFilter historySearchViewerFilter = new HistorySearchViewerFilter(null, null, null, null, true, startRevision, endRevision);
SVNHistoryPage.setHistorySearchViewerFilter(historySearchViewerFilter);
return selectedResource;
}
return new ISVNRemoteResource[0];
}
Aggregations