Search in sources :

Example 21 with ILogEntry

use of org.tigris.subversion.subclipse.core.history.ILogEntry in project subclipse by subclipse.

the class CompareRemoteResourcesAction method isEnabled.

/*
   * @see TeamAction#isEnabled()
   */
protected boolean isEnabled() {
    ISVNRemoteResource[] resources = getSelectedRemoteResources();
    boolean enabled = (resources.length == 2) && (resources[0].isContainer() == resources[1].isContainer());
    if (!enabled) {
        Object[] selectedObjects = selection.toArray();
        if (selectedObjects.length == 2 && selectedObjects[0] instanceof ILogEntry && selectedObjects[1] instanceof ILogEntry) {
            ILogEntry logEntry1 = (ILogEntry) selectedObjects[0];
            ILogEntry logEntry2 = (ILogEntry) selectedObjects[1];
            if (logEntry1.getResource() != null && logEntry1.getResource().isFolder() && logEntry2.getResource() != null && logEntry2.getResource().isFolder())
                enabled = true;
        }
    }
    return enabled;
}
Also used : ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource)

Example 22 with ILogEntry

use of org.tigris.subversion.subclipse.core.history.ILogEntry in project subclipse by subclipse.

the class Util method getUrlForRevision.

public static SVNUrl getUrlForRevision(ISVNRemoteResource resource, SVNRevision.Number revision, IProgressMonitor pm) throws SVNException {
    SVNUrl url = resource.getUrl();
    SVNRevision revisionStart = new SVNRevision.Number(revision.getNumber());
    GetLogsCommand getLogsCommand = new GetLogsCommand(resource, SVNRevision.HEAD, revisionStart, SVNRevision.HEAD, false, 0, null, true);
    getLogsCommand.run(pm);
    ILogEntry[] logEntries = getLogsCommand.getLogEntries();
    String path = resource.getRepositoryRelativePath().replaceAll("%20", " ");
    for (int i = logEntries.length - 1; i > -1; i--) {
        ILogEntry logEntry = logEntries[i];
        if (!logEntry.getRevision().equals(revision)) {
            LogEntryChangePath[] changePaths = logEntry.getLogEntryChangePaths();
            for (LogEntryChangePath changePath : changePaths) {
                if (changePath.getPath().equals(path) && changePath.getCopySrcPath() != null) {
                    try {
                        path = changePath.getCopySrcPath();
                        url = new SVNUrl(resource.getRepository().getRepositoryRoot().toString() + changePath.getCopySrcPath());
                    } catch (MalformedURLException e) {
                    }
                }
            }
        }
    }
    return url;
}
Also used : MalformedURLException(java.net.MalformedURLException) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) LogEntryChangePath(org.tigris.subversion.subclipse.core.history.LogEntryChangePath) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) GetLogsCommand(org.tigris.subversion.subclipse.core.commands.GetLogsCommand) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision)

Example 23 with ILogEntry

use of org.tigris.subversion.subclipse.core.history.ILogEntry in project subclipse by subclipse.

the class SvnWizardSwitchPage 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 24 with ILogEntry

use of org.tigris.subversion.subclipse.core.history.ILogEntry in project subclipse by subclipse.

the class SvnWizardAnnotatePage method showLog.

private void showLog(Text text) {
    HistoryDialog dialog = new HistoryDialog(getShell(), svnResource);
    if (dialog.open() == HistoryDialog.CANCEL)
        return;
    ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
    if (selectedEntries.length == 0)
        return;
    if ((text == fromRevisionText) || ((text == null) && (fromRevisionText.getText().trim().length() == 0))) {
        fromRevisionText.setText(Long.toString(selectedEntries[0].getRevision().getNumber()));
        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)

Example 25 with ILogEntry

use of org.tigris.subversion.subclipse.core.history.ILogEntry 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)

Aggregations

ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)48 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)17 SVNException (org.tigris.subversion.subclipse.core.SVNException)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 InvocationTargetException (java.lang.reflect.InvocationTargetException)14 ISelection (org.eclipse.jface.viewers.ISelection)14 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)14 TeamException (org.eclipse.team.core.TeamException)13 HistoryDialog (org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog)13 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)10 MalformedURLException (java.net.MalformedURLException)9 ParseException (java.text.ParseException)9 Point (org.eclipse.swt.graphics.Point)7 ArrayList (java.util.ArrayList)6 Iterator (java.util.Iterator)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)6 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)6 IResource (org.eclipse.core.resources.IResource)5 GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5