Search in sources :

Example 26 with ILogEntry

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

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

the class MergeWizardRevisionsPage method refresh.

private void refresh() {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                monitor.setTaskName(Messages.MergeWizardRevisionsPage_retrievingRemoteResource);
                monitor.beginTask(Messages.MergeWizardRevisionsPage_retrievingRemoteResource, IProgressMonitor.UNKNOWN);
                monitor.worked(1);
                remoteResource = repositoryLocation.getRemoteFile(new SVNUrl(getUrl()));
                monitor.done();
            } catch (Exception e) {
                Activator.handleError(e);
            }
        }
    };
    setPageComplete(false);
    setErrorMessage(null);
    fromUrl = standardPage.getFromUrl();
    remoteResource = null;
    try {
        getContainer().run(true, false, runnable);
        if (remoteResource == null) {
            setErrorMessage(Messages.MergeWizardRevisionsPage_errorRetrievingRemoteResource);
            entries = new ILogEntry[0];
        } else {
            getLogEntries(false, false);
            if (noEligibleEntries) {
                setErrorMessage(Messages.MergeWizardRevisionsPage_noEligibleRevisions);
            }
        }
    } catch (Exception e) {
        Activator.handleError(e);
        setErrorMessage(e.getMessage());
        entries = new ILogEntry[0];
    }
    if (tableHistoryViewer.getInput() == null)
        tableHistoryViewer.setInput(getUrl());
    else
        tableHistoryViewer.refresh();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) MalformedURLException(java.net.MalformedURLException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 28 with ILogEntry

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

the class MergeWizardRevisionsPage method getLogEntries.

private void getLogEntries(final boolean getAll, final boolean getNext) {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                monitor.setTaskName(Messages.MergeWizardRevisionsPage_retrievingRevisionLogInfo);
                monitor.beginTask(Messages.MergeWizardRevisionsPage_retrievingRevisionLogInfo, 5);
                if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
                    tagManager = new AliasManager(remoteResource.getUrl());
                monitor.worked(1);
                noEligibleEntries = false;
                entries = getEligibleLogEntries(monitor);
                monitor.worked(1);
                if (entries == null || entries.length == 0)
                    noEligibleEntries = true;
                monitor.worked(1);
            } catch (Exception e) {
                Activator.handleError(e);
                Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                        setErrorMessage(Messages.MergeWizardChangeSetRevisionsPage_errorRetrievingLogEntries);
                    }
                });
                entries = new ILogEntry[0];
            }
            monitor.worked(1);
            monitor.done();
        }
    };
    try {
        getContainer().run(true, false, runnable);
    } catch (Exception e1) {
        Activator.handleError(e1);
    }
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) MalformedURLException(java.net.MalformedURLException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 29 with ILogEntry

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

the class MergeWizardRevisionsPage method getSelectionListener.

private SelectionListener getSelectionListener() {
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.getSource() == MergeWizardRevisionsPage.this.moreOptionsButton) {
                if (dialog == null) {
                    final TreeSet<String> set = new TreeSet<String>();
                    if (entries != null && entries.length > 0) {
                        set.add(ALL_AUTHORS);
                        for (int i = 0; i < entries.length; i++) {
                            if (entries[i].getAuthor() != null) {
                                set.add(entries[i].getAuthor());
                            }
                        }
                        if (set.size() == 2) {
                            set.remove(ALL_AUTHORS);
                        }
                    }
                    dialog = new FilterRevisionsDialog(getShell(), set);
                }
                dialog.setRemoteResource(MergeWizardRevisionsPage.this.remoteResource);
                int returnCode = dialog.open();
                if (returnCode < 1) {
                    clearSearchCriteria();
                    historySearchFilter = new HistorySearchViewerFilter(dialog.getUser(), dialog.getComment(), dialog.getStartDate(), dialog.getEndDate(), dialog.getRegExp(), dialog.getStartRevision(), dialog.getEndRevision());
                    tableHistoryViewer.setFilters(new ViewerFilter[] { historySearchFilter });
                    MergeWizardRevisionsPage.this.tableHistoryViewer.refresh();
                    TableItem[] items = tableHistoryViewer.getTable().getItems();
                    for (TableItem item : items) {
                        ILogEntry entry = adaptToLogEntry(item.getData());
                        if (entry != null) {
                            historySearchFilter.select(tableHistoryViewer, null, entry);
                        }
                    }
                    showMessage();
                    setPageComplete(canFinish());
                }
            }
        }

        private void clearSearchCriteria() {
            filterText.setText("");
        }
    };
    return selectionListener;
}
Also used : FilterRevisionsDialog(com.collabnet.subversion.merge.dialogs.FilterRevisionsDialog) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) TreeSet(java.util.TreeSet) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableItem(org.eclipse.swt.widgets.TableItem) SelectionEvent(org.eclipse.swt.events.SelectionEvent) HistorySearchViewerFilter(org.tigris.subversion.subclipse.ui.history.HistorySearchViewerFilter) Point(org.eclipse.swt.graphics.Point) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 30 with ILogEntry

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

the class MergeWizardUnblockRevisionsPage method refresh.

private void refresh() {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                monitor.setTaskName(Messages.MergeWizardUnblockRevisionsPage_retrievingRemoteResource);
                monitor.beginTask(Messages.MergeWizardUnblockRevisionsPage_retrievingRemoteResource, 2);
                monitor.worked(1);
                remoteResource = repositoryLocation.getRemoteFile(new SVNUrl(fromUrl));
                monitor.worked(1);
                monitor.done();
            } catch (Exception e) {
                Activator.handleError(e);
            }
        }
    };
    setPageComplete(false);
    setErrorMessage(null);
    fromUrl = standardPage.getFromUrl();
    ISVNMergeInfo mergeInfo = standardPage.getMergeInfo();
    if (mergeInfo == null) {
        entries = new ILogEntry[0];
        return;
    }
    revisionRanges = mergeInfo.getRevisionRange(fromUrl);
    remoteResource = null;
    try {
        getContainer().run(false, false, runnable);
        if (remoteResource == null) {
            setErrorMessage(Messages.MergeWizardUnblockRevisionsPage_errorRetrievingRemoteResource);
            entries = new ILogEntry[0];
        } else
            getLogEntries();
    } catch (Exception e) {
        setErrorMessage(e.getMessage());
        entries = new ILogEntry[0];
    }
    if (tableHistoryViewer.getInput() == null)
        tableHistoryViewer.setInput(fromUrl);
    else
        tableHistoryViewer.refresh();
    setPageComplete(canFinish());
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ISVNMergeInfo(org.tigris.subversion.svnclientadapter.ISVNMergeInfo) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

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