Search in sources :

Example 1 with SizePersistedWizardDialog

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

the class RepositoryBranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    ISVNRemoteResource[] resources = getSelectedRemoteResources();
    BranchTagWizard wizard = new BranchTagWizard(resources);
    WizardDialog dialog = // $NON-NLS-1$
    new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
    if (dialog.open() == WizardDialog.OK) {
        SVNUrl[] sourceUrls = wizard.getUrls();
        SVNUrl destinationUrl = wizard.getToUrl();
        String message = wizard.getComment();
        SVNRevision revision = wizard.getRevision();
        boolean makeParents = wizard.isMakeParents();
        ISVNClientAdapter client = null;
        try {
            ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
            if (repository != null)
                client = repository.getSVNClient();
            if (client == null)
                client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
            RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
            branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
            branchTagOperation.run();
        } catch (Exception e) {
            MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
        } finally {
        // BranchTagCommand will dispose.
        // SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
        }
    }
}
Also used : SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) RepositoryBranchTagOperation(org.tigris.subversion.subclipse.ui.operations.RepositoryBranchTagOperation) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ISVNRepositoryLocation(org.tigris.subversion.subclipse.core.ISVNRepositoryLocation) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 2 with SizePersistedWizardDialog

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

the class ResolveActionWithChoices method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    boolean folderSelected = false;
    boolean propertyConflicts = false;
    boolean textConflicts = false;
    boolean treeConflicts = false;
    boolean treeConflictDialogShown = false;
    IResource[] resources = getSelectedResources();
    for (int i = 0; i < resources.length; i++) {
        if (resources[i] instanceof IContainer) {
            folderSelected = true;
        }
        if (!propertyConflicts || !textConflicts || !treeConflicts) {
            ISVNLocalResource resource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
            try {
                LocalResourceStatus status = resource.getStatus();
                if (status != null && status.isPropConflicted())
                    propertyConflicts = true;
                if (status != null && status.isTextConflicted())
                    textConflicts = true;
                if (status != null && status.hasTreeConflict())
                    treeConflicts = true;
            } catch (SVNException e) {
                SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
            }
        }
    }
    if (resources.length == 1 && treeConflicts && !propertyConflicts && !textConflicts) {
        treeConflict = getTreeConflict(resources[0]);
        if (treeConflict != null) {
            ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, getTargetPart());
            WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, // $NON-NLS-1$
            "ResolveTreeConflict");
            if (dialog.open() != WizardDialog.OK)
                return;
            treeConflictDialogShown = true;
        }
    }
    if (resources.length > 1 && treeConflicts) {
        if (!MessageDialog.openConfirm(getShell(), Policy.bind("ResolveOperation.taskName"), Policy.bind("ResolveAction.confirmTreeConflicts")))
            // $NON-NLS-1$	//$NON-NLS-2$
            return;
        setResolution(ISVNConflictResolver.Choice.chooseMerged);
    } else if (!treeConflictDialogShown) {
        SvnWizardMarkResolvedPage markResolvedPage = new SvnWizardMarkResolvedPage(resources);
        markResolvedPage.setPropertyConflicts(propertyConflicts);
        markResolvedPage.setTreeConflicts(treeConflicts);
        SvnWizard wizard = new SvnWizard(markResolvedPage);
        SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
        wizard.setParentDialog(dialog);
        if (dialog.open() == SvnWizardDialog.CANCEL)
            return;
        setResolution(markResolvedPage.getResolution());
    }
    if (!treeConflictDialogShown)
        super.execute(action);
}
Also used : SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) ResolveTreeConflictWizard(org.tigris.subversion.subclipse.ui.conflicts.ResolveTreeConflictWizard) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) IContainer(org.eclipse.core.resources.IContainer) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) IResource(org.eclipse.core.resources.IResource) SvnWizardMarkResolvedPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardMarkResolvedPage)

Example 3 with SizePersistedWizardDialog

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

the class ResolveTreeConflictAction method run.

public void run() {
    IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection();
    SVNTreeConflict treeConflict = (SVNTreeConflict) selection.getFirstElement();
    ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, targetPart);
    WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, // $NON-NLS-1$
    "ResolveTreeConflict");
    dialog.open();
}
Also used : SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) SVNTreeConflict(org.tigris.subversion.subclipse.core.resources.SVNTreeConflict)

Example 4 with SizePersistedWizardDialog

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

the class MergeViewResolveAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    boolean treeConflictDialogShown = false;
    boolean compare = false;
    mergePath = null;
    if (showDialog) {
        List resources = new ArrayList();
        Iterator iter = fSelection.iterator();
        boolean folderSelected = false;
        boolean textConflicts = false;
        boolean propertyConflicts = false;
        boolean treeConflicts = false;
        while (iter.hasNext()) {
            MergeResult mergeResult = null;
            Object selectedObject = iter.next();
            if (selectedObject instanceof MergeResult)
                mergeResult = (MergeResult) selectedObject;
            if (selectedObject instanceof MergeResultsFolder) {
                folderSelected = true;
                MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) selectedObject;
                resources.add(mergeResultsFolder.getFolder());
                mergeResult = mergeResultsFolder.getMergeResult();
            }
            if (mergeResult != null && (mergeResult.hasTreeConflict() || mergeResult.isConflicted() || mergeResult.isPropertyConflicted())) {
                if (mergeResult.isConflicted())
                    textConflicts = true;
                if (mergeResult.isPropertyConflicted())
                    propertyConflicts = true;
                if (mergeResult.hasTreeConflict())
                    treeConflicts = true;
                if (!(selectedObject instanceof MergeResultsFolder)) {
                    resources.add(mergeResult.getResource());
                }
            }
        }
        if (resources.size() > 1) {
            if (!MessageDialog.openConfirm(getShell(), Messages.MergeViewResolveAction_confirm, Messages.MergeViewResolveAction_confirmMultiple))
                return;
            setResolution(ISVNConflictResolver.Choice.chooseMerged);
        } else if (treeConflicts) {
            IResource resource = (IResource) resources.get(0);
            treeConflict = getTreeConflict(resource);
            if (treeConflict == null) {
                String message = Messages.MergeViewResolveAction_confirmTreeConflict + resource.getName() + // $NON-NLS-1$
                "?";
                if (!MessageDialog.openConfirm(getShell(), Messages.MergeViewResolveAction_confirm, message))
                    return;
                setResolution(ISVNConflictResolver.Choice.chooseMerged);
            } else {
                ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, getTargetPart());
                WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, // $NON-NLS-1$
                "ResolveTreeConflict");
                if (dialog.open() != WizardDialog.OK)
                    return;
                treeConflictDialogShown = true;
                compare = wizard.isCompare();
                mergePath = wizard.getMergePath();
            }
        } else if (folderSelected) {
            IResource resource = (IResource) resources.get(0);
            String message = Messages.MergeViewResolveAction_confirmProperty + resource.getFullPath() + // $NON-NLS-1$
            "?";
            if (!MessageDialog.openConfirm(getShell(), Messages.MergeViewResolveAction_confirm, message))
                return;
            selectedResolution = ISVNConflictResolver.Choice.chooseMerged;
            setResolution(selectedResolution);
        } else {
            IResource[] resourceArray = new IResource[resources.size()];
            resources.toArray(resourceArray);
            DialogWizard dialogResolveWizard = new DialogWizard(DialogWizard.MARK_RESOLVED);
            dialogResolveWizard.setResources(resourceArray);
            dialogResolveWizard.setTextConflicts(textConflicts);
            dialogResolveWizard.setPropertyConflicts(propertyConflicts);
            dialogResolveWizard.setTreeConflicts(treeConflicts);
            MergeWizardDialog resolveDialog = new MergeWizardDialog(Display.getDefault().getActiveShell(), dialogResolveWizard);
            if (resolveDialog.open() == MergeWizardDialog.CANCEL)
                return;
            selectedResolution = dialogResolveWizard.getResolution();
            setResolution(selectedResolution);
        }
    }
    if (!treeConflictDialogShown)
        super.execute(action);
    ArrayList mergeOutputs = new ArrayList();
    Iterator iter = fSelection.iterator();
    while (iter.hasNext()) {
        MergeResult mergeResult = null;
        Object selectedObject = iter.next();
        if (selectedObject instanceof MergeResult)
            mergeResult = (MergeResult) selectedObject;
        if (selectedObject instanceof MergeResultsFolder) {
            MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) selectedObject;
            mergeResult = mergeResultsFolder.getMergeResult();
        }
        if (mergeResult != null && (mergeResult.hasTreeConflict() || mergeResult.isConflicted() || mergeResult.isPropertyConflicted())) {
            if (!compare) {
                String conflictResolution = Integer.toString(selectedResolution);
                mergeResult.setConflictResolution(conflictResolution);
                mergeResult.setPropertyResolution(conflictResolution);
                mergeResult.setTreeConflictResolution(conflictResolution);
                if (mergePath != null) {
                    MergeResult[] allResults = mergeResult.getMergeOutput().getMergeResults();
                    for (MergeResult checkResult : allResults) {
                        if (checkResult.getResource().getLocation().toFile().equals(mergePath)) {
                            try {
                                LocalResourceStatus status = SVNProviderPlugin.getPlugin().getStatusCacheManager().getStatus(checkResult.getResource());
                                if (status.isTextConflicted()) {
                                    checkResult.setAction(MergeResult.ACTION_CONFLICT);
                                    checkResult.setConflictResolution(" ");
                                    checkResult.setError(true);
                                }
                            } catch (SVNException e) {
                            }
                            break;
                        }
                    }
                }
            }
            if (!mergeOutputs.contains(mergeResult.getMergeOutput()))
                mergeOutputs.add(mergeResult.getMergeOutput());
        }
    }
    iter = mergeOutputs.iterator();
    while (iter.hasNext()) {
        MergeOutput mergeOutput = (MergeOutput) iter.next();
        mergeOutput.store();
    }
    MergeResultsView.getView().refresh();
    iter = mergeOutputs.iterator();
    while (iter.hasNext()) {
        MergeOutput mergeOutput = (MergeOutput) iter.next();
        if (!mergeOutput.hasUnresolvedConflicts()) {
            DialogWizard dialogWizard = new DialogWizard(DialogWizard.CONFLICTS_RESOLVED);
            dialogWizard.setMergeOutput(mergeOutput);
            MergeWizardDialog dialog = new MergeWizardDialog(Display.getDefault().getActiveShell(), dialogWizard, true);
            if (dialog.open() != MergeWizardDialog.CANCEL)
                MergeResultsView.getView().refresh();
        }
    }
}
Also used : ArrayList(java.util.ArrayList) MergeResult(com.collabnet.subversion.merge.MergeResult) ResolveTreeConflictWizard(org.tigris.subversion.subclipse.ui.conflicts.ResolveTreeConflictWizard) SVNException(org.tigris.subversion.subclipse.core.SVNException) Iterator(java.util.Iterator) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) MergeOutput(com.collabnet.subversion.merge.MergeOutput) DialogWizard(com.collabnet.subversion.merge.wizards.DialogWizard) ArrayList(java.util.ArrayList) List(java.util.List) MergeWizardDialog(com.collabnet.subversion.merge.wizards.MergeWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) LocalResourceStatus(org.tigris.subversion.subclipse.core.resources.LocalResourceStatus) IResource(org.eclipse.core.resources.IResource) MergeWizardDialog(com.collabnet.subversion.merge.wizards.MergeWizardDialog) MergeResultsFolder(com.collabnet.subversion.merge.MergeResultsFolder)

Example 5 with SizePersistedWizardDialog

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

the class EditPropertyConflictsAction method execute.

protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
    error = null;
    BusyIndicator.showWhile(Display.getDefault(), new Runnable() {

        public void run() {
            IResource resource = getSelectedResources()[0];
            svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            ISVNClientAdapter client = null;
            try {
                conflictSummary = PropertyConflict.getConflictSummary(svnResource);
                propertyConflicts = PropertyConflict.getPropertyConflicts(svnResource);
                client = svnResource.getRepository().getSVNClient();
                remoteProperties = client.getProperties(svnResource.getUrl(), svnResource.getRevision(), svnResource.getRevision());
            } catch (Exception e) {
                error = e;
            } finally {
                svnResource.getRepository().returnSVNClient(client);
            }
        }
    });
    if (error != null) {
        handle(error);
        return;
    }
    EditPropertyConflictsWizard wizard = new EditPropertyConflictsWizard(svnResource, conflictSummary, propertyConflicts, remoteProperties, getTargetPart());
    WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, // $NON-NLS-1$
    "EditPropertyConflicts");
    dialog.open();
}
Also used : SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) IResource(org.eclipse.core.resources.IResource) InvocationTargetException(java.lang.reflect.InvocationTargetException) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter) EditPropertyConflictsWizard(org.tigris.subversion.subclipse.ui.conflicts.EditPropertyConflictsWizard)

Aggregations

SizePersistedWizardDialog (org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog)6 WizardDialog (org.eclipse.jface.wizard.WizardDialog)5 IResource (org.eclipse.core.resources.IResource)4 SVNException (org.tigris.subversion.subclipse.core.SVNException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 LocalResourceStatus (org.tigris.subversion.subclipse.core.resources.LocalResourceStatus)2 ResolveTreeConflictWizard (org.tigris.subversion.subclipse.ui.conflicts.ResolveTreeConflictWizard)2 BranchTagWizard (org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard)2 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)2 SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)2 MergeOutput (com.collabnet.subversion.merge.MergeOutput)1 MergeResult (com.collabnet.subversion.merge.MergeResult)1 MergeResultsFolder (com.collabnet.subversion.merge.MergeResultsFolder)1 DialogWizard (com.collabnet.subversion.merge.wizards.DialogWizard)1 MergeWizardDialog (com.collabnet.subversion.merge.wizards.MergeWizardDialog)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 IContainer (org.eclipse.core.resources.IContainer)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1