Search in sources :

Example 46 with ISVNRemoteResource

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());
}
Also used : HistoryDialog(org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException)

Example 47 with ISVNRemoteResource

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());
}
Also used : HistoryDialog(org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) ParseException(java.text.ParseException) MalformedURLException(java.net.MalformedURLException)

Example 48 with ISVNRemoteResource

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;
}
Also used : ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNLogMessage(org.tigris.subversion.svnclientadapter.ISVNLogMessage) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile)

Example 49 with ISVNRemoteResource

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);
    }
}
Also used : HistoryDialog(org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ParseException(java.text.ParseException) InvocationTargetException(java.lang.reflect.InvocationTargetException) MalformedURLException(java.net.MalformedURLException)

Example 50 with ISVNRemoteResource

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];
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) MergeResult(com.collabnet.subversion.merge.MergeResult) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ParseException(java.text.ParseException) MergeOutput(com.collabnet.subversion.merge.MergeOutput) Iterator(java.util.Iterator) HistorySearchViewerFilter(org.tigris.subversion.subclipse.ui.history.HistorySearchViewerFilter) MergeOptions(com.collabnet.subversion.merge.MergeOptions) ParseException(java.text.ParseException) IContainer(org.eclipse.core.resources.IContainer) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) IResource(org.eclipse.core.resources.IResource) MergeResultsFolder(com.collabnet.subversion.merge.MergeResultsFolder)

Aggregations

ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)69 SVNException (org.tigris.subversion.subclipse.core.SVNException)23 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)21 InvocationTargetException (java.lang.reflect.InvocationTargetException)16 TeamException (org.eclipse.team.core.TeamException)16 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)16 IResource (org.eclipse.core.resources.IResource)15 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)14 ArrayList (java.util.ArrayList)12 ParseException (java.text.ParseException)11 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)10 CoreException (org.eclipse.core.runtime.CoreException)9 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)8 MalformedURLException (java.net.MalformedURLException)7 ISVNRemoteFolder (org.tigris.subversion.subclipse.core.ISVNRemoteFolder)7 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)7 HistoryDialog (org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog)6 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)6