Search in sources :

Example 1 with WizardDialogWithPersistedLocation

use of org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation in project subclipse by subclipse.

the class GenerateDiffFileSynchronizeOperation method run.

protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    IResource[] resources = set.getResources();
    HashMap statusMap = new HashMap();
    unaddedList = new ArrayList();
    for (int i = 0; i < resources.length; i++) {
        ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
        SyncInfo syncInfo = set.getSyncInfo(resources[i]);
        SVNStatusKind statusKind = null;
        try {
            if (!svnResource.isManaged()) {
                statusKind = SVNStatusKind.UNVERSIONED;
            } else {
                switch(SyncInfo.getChange(syncInfo.getKind())) {
                    case SyncInfo.ADDITION:
                        statusKind = SVNStatusKind.ADDED;
                        break;
                    case SyncInfo.DELETION:
                        statusKind = SVNStatusKind.DELETED;
                        break;
                    case SyncInfo.CONFLICTING:
                        statusKind = SVNStatusKind.CONFLICTED;
                        break;
                    default:
                        statusKind = SVNStatusKind.MODIFIED;
                        break;
                }
            }
            statusMap.put(resources[i], statusKind);
            if (!svnResource.isManaged() && !svnResource.isIgnored())
                unaddedList.add(resources[i]);
        } catch (SVNException e) {
            SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
        }
    }
    ArrayList dedupedList = new ArrayList();
    Iterator iter = unaddedList.iterator();
    while (iter.hasNext()) {
        IResource resource = (IResource) iter.next();
        if (!isDupe(resource))
            dedupedList.add(resource);
    }
    IResource[] unversionedResources = new IResource[dedupedList.size()];
    dedupedList.toArray(unversionedResources);
    GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), unversionedResources, statusMap);
    // $NON-NLS-1$
    wizard.setWindowTitle(Policy.bind("GenerateSVNDiff.title"));
    wizard.setSelectedResources(selectedResources);
    // final WizardDialog dialog = new WizardDialog(getShell(), wizard);
    // dialog.setMinimumPageSize(350, 250);
    final WizardDialog dialog = new WizardDialogWithPersistedLocation(getShell(), wizard, // $NON-NLS-1$
    "GenerateDiffFileWizard");
    dialog.setMinimumPageSize(350, 250);
    getShell().getDisplay().syncExec(new Runnable() {

        public void run() {
            dialog.open();
        }
    });
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) GenerateDiffFileWizard(org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard) WizardDialogWithPersistedLocation(org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation) SyncInfo(org.eclipse.team.core.synchronize.SyncInfo) Iterator(java.util.Iterator) SVNStatusKind(org.tigris.subversion.svnclientadapter.SVNStatusKind) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource)

Example 2 with WizardDialogWithPersistedLocation

use of org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation in project subclipse by subclipse.

the class GenerateDiffFileAction method execute.

/**
 * (Non-javadoc) Method declared on IActionDelegate.
 *
 * @throws InterruptedException
 * @throws InvocationTargetException
 */
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
    statusMap = new HashMap();
    unaddedList = new ArrayList();
    // $NON-NLS-1$
    String title = Policy.bind("GenerateSVNDiff.title");
    final IResource[] resources = getSelectedResources();
    run(new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                modifiedResources = getModifiedResources(resources, monitor);
            } catch (SVNException e) {
                SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
            }
        }
    }, true, PROGRESS_BUSYCURSOR);
    if (modifiedResources == null || modifiedResources.length == 0) {
        MessageDialog.openInformation(getShell(), Policy.bind("GenerateSVNDiff.title"), // $NON-NLS-1$ //$NON-NLS-1$
        Policy.bind("GenerateSVNDiff.noDiffsFoundMsg"));
        return;
    }
    IResource[] unaddedResources = new IResource[unaddedList.size()];
    unaddedList.toArray(unaddedResources);
    GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(modifiedResources), unaddedResources, statusMap);
    wizard.setWindowTitle(title);
    wizard.setSelectedResources(getSelectedResources());
    WizardDialog dialog = new WizardDialogWithPersistedLocation(getShell(), wizard, // $NON-NLS-1$
    "GenerateDiffFileWizard");
    dialog.setMinimumPageSize(350, 250);
    dialog.open();
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) GenerateDiffFileWizard(org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) WizardDialogWithPersistedLocation(org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IResource(org.eclipse.core.resources.IResource)

Aggregations

ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 IResource (org.eclipse.core.resources.IResource)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 SVNException (org.tigris.subversion.subclipse.core.SVNException)2 WizardDialogWithPersistedLocation (org.tigris.subversion.subclipse.ui.wizards.WizardDialogWithPersistedLocation)2 GenerateDiffFileWizard (org.tigris.subversion.subclipse.ui.wizards.generatediff.GenerateDiffFileWizard)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Iterator (java.util.Iterator)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 SyncInfo (org.eclipse.team.core.synchronize.SyncInfo)1 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)1 SVNStatusKind (org.tigris.subversion.svnclientadapter.SVNStatusKind)1