Search in sources :

Example 16 with ILogEntry

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

the class MergeWizardUnblockRevisionsPage method getLogEntries.

private void getLogEntries() {
    entryArray = new ArrayList();
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                monitor.setTaskName(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo);
                monitor.beginTask(Messages.MergeWizardUnblockRevisionsPage_retrievingRevisionLogInfo, 3);
                if (SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_SHOW_TAGS_IN_REMOTE))
                    tagManager = new AliasManager(remoteResource.getUrl());
                SVNRevision pegRevision = remoteResource.getRevision();
                monitor.worked(1);
                for (int i = 0; i < revisionRanges.length; i++) {
                    rangeEntries = getLogEntries(pegRevision, revisionRanges[i].getFromRevision(), revisionRanges[i].getToRevision(), true, 0, tagManager, true);
                    monitor.worked(1);
                    for (int j = 0; j < rangeEntries.length; j++) {
                        entryArray.add(rangeEntries[j]);
                    }
                }
                entries = new ILogEntry[entryArray.size()];
                entryArray.toArray(entries);
            } catch (Exception e) {
                setErrorMessage(e.getMessage());
                entries = new ILogEntry[0];
            }
            monitor.worked(1);
            monitor.done();
        }
    };
    try {
        getContainer().run(false, false, runnable);
    } catch (Exception e1) {
        Activator.handleError(e1);
    }
    setErrorMessage(standardPage.getErrorMessage());
}
Also used : AliasManager(org.tigris.subversion.subclipse.core.history.AliasManager) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ArrayList(java.util.ArrayList) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) Point(org.eclipse.swt.graphics.Point) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 17 with ILogEntry

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

the class StandardMergeInputProvider method performMerge.

public boolean performMerge(MergeWizardMainPage mainPage, MergeWizardLastPage optionsPage, IWorkbenchPart targetPart) {
    String commonRoot = standardPage.getCommonRoot(false);
    String mergeFrom = standardPage.getMergeFrom();
    Activator.getDefault().saveMergeSource(mergeFrom, commonRoot);
    IResource[] resources = standardPage.getResources();
    SVNUrl[] urls = standardPage.getUrls();
    SVNRevisionRange[] revisions = null;
    if (standardPage.selectRevisions()) {
        Set<IResource> usedResources = new HashSet<IResource>();
        Map<SVNRevision.Number, List<IResource>> map = revisionsPage.getRevisionToResource();
        revisions = revisionsPage.getRevisions();
        CommentsManager commentsManager = SVNUIPlugin.getPlugin().getRepositoryManager().getCommentsManager();
        ILogEntry[] entries = revisionsPage.getSelectedLogEntries();
        for (int i = 0; i < entries.length; i++) {
            commentsManager.addComment(entries[i].getComment());
            if (map.size() > 0) {
                List<IResource> lst = map.get(entries[i].getRevision());
                usedResources.addAll(lst);
            }
        }
        // only filter the urls if the usedResources does have content.
        if (usedResources.size() > 0) {
            List<SVNUrl> urlsList = new ArrayList<SVNUrl>();
            List<IResource> resourcesList = new ArrayList<IResource>();
            for (int i = 0; i < resources.length; i++) {
                if (usedResources.contains(resources[i])) {
                    urlsList.add(urls[i]);
                    resourcesList.add(resources[i]);
                }
            }
            resources = resourcesList.toArray(new IResource[resourcesList.size()]);
            urls = urlsList.toArray(new SVNUrl[urlsList.size()]);
        }
    }
    MergeOperation mergeOperation = new MergeOperation(targetPart, resources, urls, null, urls, null, revisions, null);
    mergeOperation.setForce(optionsPage.isForce());
    mergeOperation.setIgnoreAncestry(optionsPage.isIgnore());
    mergeOperation.setDepth(optionsPage.getDepth());
    mergeOperation.setTextConflictHandling(optionsPage.getTextConflictHandling());
    mergeOperation.setBinaryConflictHandling(optionsPage.getBinaryConflictHandling());
    mergeOperation.setPropertyConflictHandling(optionsPage.getPropertyConflictHandling());
    mergeOperation.setTreeConflictHandling(optionsPage.getTreeConflictHandling());
    try {
        mergeOperation.run();
    } catch (Exception e) {
        Activator.handleError(Messages.StandardMergeInputProvider_error, e);
        MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.StandardMergeInputProvider_merge, e.getMessage());
        return false;
    }
    return true;
}
Also used : CommentsManager(org.tigris.subversion.subclipse.ui.comments.CommentsManager) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SVNRevisionRange(org.tigris.subversion.svnclientadapter.SVNRevisionRange) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IResource(org.eclipse.core.resources.IResource) HashSet(java.util.HashSet)

Example 18 with ILogEntry

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

the class FilterRevisionsDialog method showLog.

private void showLog(Text revisionText) {
    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()));
}
Also used : HistoryDialog(org.tigris.subversion.subclipse.ui.dialogs.HistoryDialog) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry)

Example 19 with ILogEntry

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

the class OpenBugUrlAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    Object[] selectedObjects = selection.toArray();
    HashSet urlsSet = new HashSet();
    for (int i = 0; i < selectedObjects.length; i++) {
        if (selectedObjects[i] instanceof ILogEntry) {
            ILogEntry logEntry = (ILogEntry) selectedObjects[i];
            try {
                ProjectProperties projectProperties = ProjectProperties.getProjectProperties(logEntry.getResource().getResource());
                LinkList linkList = projectProperties.getLinkList(logEntry.getComment());
                String[] urls = linkList.getUrls();
                for (int j = 0; j < urls.length; j++) {
                    urlsSet.add(urls[j]);
                }
            } catch (Exception e) {
                handle(e, null, null);
            }
        }
    }
    int i = 0;
    Iterator it = urlsSet.iterator();
    while (it.hasNext()) {
        try {
            PlatformUI.getWorkbench().getBrowserSupport().createBrowser("bugurlbrowser" + (i++)).openURL(new URL((String) it.next()));
        } catch (Exception e) {
            handle(e, null, null);
        }
    }
    return;
}
Also used : ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) Iterator(java.util.Iterator) ProjectProperties(org.tigris.subversion.subclipse.ui.settings.ProjectProperties) LinkList(org.tigris.subversion.subclipse.ui.util.LinkList) TeamException(org.eclipse.team.core.TeamException) InvocationTargetException(java.lang.reflect.InvocationTargetException) URL(java.net.URL) HashSet(java.util.HashSet)

Example 20 with ILogEntry

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

the class ShowDifferencesAsUnifiedDiffAction method isEnabled.

protected boolean isEnabled() throws TeamException {
    Object[] selectedObjects = selection.toArray();
    if (selectedObjects.length == 0 || selectedObjects.length > 2)
        return false;
    ISVNResource svnResource1 = null;
    ISVNResource svnResource2 = null;
    if (selectedObjects[0] instanceof ISVNResource)
        svnResource1 = (ISVNResource) selectedObjects[0];
    else {
        if (selectedObjects[0] instanceof ILogEntry)
            svnResource1 = ((ILogEntry) selectedObjects[0]).getResource();
    }
    if (svnResource1 == null)
        return false;
    if (selectedObjects.length > 1) {
        if (selectedObjects[1] instanceof ISVNResource)
            svnResource2 = (ISVNResource) selectedObjects[1];
        else {
            if (selectedObjects[1] instanceof ILogEntry)
                svnResource2 = ((ILogEntry) selectedObjects[1]).getResource();
        }
        if (!svnResource1.getRepository().getRepositoryRoot().toString().equals(svnResource2.getRepository().getRepositoryRoot().toString()))
            return false;
        return (svnResource1.isFolder() == svnResource2.isFolder());
    }
    return true;
}
Also used : ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) ISVNResource(org.tigris.subversion.subclipse.core.ISVNResource)

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