Search in sources :

Example 1 with SvnWizard

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

the class SVNHistoryPage method getSwitchAction.

// get switch action (context menu)
private IAction getSwitchAction() {
    if (switchAction == null) {
        switchAction = new Action() {

            public void run() {
                if (selection instanceof IStructuredSelection) {
                    IStructuredSelection ss = (IStructuredSelection) selection;
                    if (ss.size() == 1) {
                        ILogEntry currentSelection = getLogEntry(ss);
                        IResource[] resources = { resource };
                        SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(resources, currentSelection.getRevision().getNumber());
                        SvnWizard wizard = new SvnWizard(switchPage);
                        SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(), wizard);
                        wizard.setParentDialog(dialog);
                        if (dialog.open() == SvnWizardDialog.OK) {
                            SVNUrl[] svnUrls = switchPage.getUrls();
                            SVNRevision svnRevision = switchPage.getRevision();
                            SwitchOperation switchOperation = new SwitchOperation(getSite().getPage().getActivePart(), resources, svnUrls, svnRevision);
                            switchOperation.setDepth(switchPage.getDepth());
                            switchOperation.setSetDepth(switchPage.isSetDepth());
                            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
                            switchOperation.setForce(switchPage.isForce());
                            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
                            switchOperation.setConflictResolver(switchPage.getConflictResolver());
                            try {
                                switchOperation.run();
                            } catch (Exception e) {
                                MessageDialog.openError(getSite().getShell(), switchAction.getText(), e.getMessage());
                            }
                        }
                    }
                }
            }
        };
    }
    ISelection selection = getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        if (ss.size() == 1) {
            ILogEntry currentSelection = getLogEntry(ss);
            switchAction.setText(Policy.bind("HistoryView.switchToRevision", // $NON-NLS-1$ //$NON-NLS-2$
            "" + currentSelection.getRevision().getNumber()));
        }
    }
    switchAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_SWITCH));
    return switchAction;
}
Also used : CompareRemoteResourcesAction(org.tigris.subversion.subclipse.ui.actions.CompareRemoteResourcesAction) ExportRemoteFolderAction(org.tigris.subversion.subclipse.ui.actions.ExportRemoteFolderAction) ShowDifferencesAsUnifiedDiffAction(org.tigris.subversion.subclipse.ui.actions.ShowDifferencesAsUnifiedDiffAction) TextViewerAction(org.tigris.subversion.subclipse.ui.console.TextViewerAction) ShowAnnotationAction(org.tigris.subversion.subclipse.ui.actions.ShowAnnotationAction) ShowHistoryAction(org.tigris.subversion.subclipse.ui.actions.ShowHistoryAction) WorkspaceAction(org.tigris.subversion.subclipse.ui.actions.WorkspaceAction) IAction(org.eclipse.jface.action.IAction) OpenRemoteFileAction(org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction) GenerateChangeLogAction(org.tigris.subversion.subclipse.ui.actions.GenerateChangeLogAction) Action(org.eclipse.jface.action.Action) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) ISelection(org.eclipse.jface.viewers.ISelection) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) CoreException(org.eclipse.core.runtime.CoreException) SVNException(org.tigris.subversion.subclipse.core.SVNException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) TeamException(org.eclipse.team.core.TeamException) ParseException(java.text.ParseException) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Example 2 with SvnWizard

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

the class CommitSynchronizeOperation method confirmCommit.

private boolean confirmCommit(SyncInfoSet set) {
    commit = false;
    IResource[] modified = set.getResources();
    List conflictFiles = new ArrayList();
    List filteredModified = new ArrayList();
    boolean switched = false;
    for (int i = 0; i < modified.length; i++) {
        IResource resource = modified[i];
        filteredModified.add(resource);
        if (!(resource instanceof IContainer)) {
            ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
            try {
                if (svnResource.isManaged() && svnResource.getStatus().isTextConflicted()) {
                    IFile conflictNewFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictNew());
                    if (conflictNewFile != null)
                        conflictFiles.add(conflictNewFile);
                    IFile conflictOldFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictOld());
                    if (conflictOldFile != null)
                        conflictFiles.add(conflictOldFile);
                    IFile conflictWorkingFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictWorking());
                    if (conflictWorkingFile != null)
                        conflictFiles.add(conflictWorkingFile);
                }
                if (svnResource.getStatus().isSwitched()) {
                    url = svnResource.getStatus().getUrlString();
                    switched = true;
                }
            } catch (SVNException e) {
            }
        }
    }
    if (switched && modified.length > 1) {
        url = null;
    }
    if (conflictFiles.size() > 0) {
        Iterator iter = conflictFiles.iterator();
        while (iter.hasNext()) {
            IFile conflictFile = (IFile) iter.next();
            filteredModified.remove(conflictFile);
        }
        modified = new IResource[filteredModified.size()];
        filteredModified.toArray(modified);
    }
    if (modified.length > 0) {
        try {
            IPreferenceStore preferenceStore = SVNUIPlugin.getPlugin().getPreferenceStore();
            boolean commitToTagsPathWithoutWarning = preferenceStore.getBoolean(ISVNUIConstants.PREF_COMMIT_TO_TAGS_PATH_WITHOUT_WARNING);
            if (!commitToTagsPathWithoutWarning && onTagPath(modified)) {
                commit = true;
                getShell().getDisplay().syncExec(new Runnable() {

                    public void run() {
                        CommitToTagsWarningDialog dialog = new CommitToTagsWarningDialog(getShell());
                        commit = dialog.open() == CommitToTagsWarningDialog.OK;
                    }
                });
                if (!commit) {
                    return false;
                }
            }
            ProjectProperties projectProperties = ProjectProperties.getProjectProperties(modified[0]);
            SvnWizardCommitPage commitPage = new SvnWizardCommitPage(modified, url, projectProperties, new HashMap(), changeSet, true);
            if (proposedComment == null || proposedComment.length() == 0)
                commitPage.setComment(getProposedComment(modified));
            else
                commitPage.setComment(proposedComment);
            commitPage.setSyncInfoSet(set);
            SvnWizard wizard = new SvnWizard(commitPage);
            final SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
            wizard.setParentDialog(dialog);
            getShell().getDisplay().syncExec(new Runnable() {

                public void run() {
                    commit = (dialog.open() == SvnWizardDialog.OK);
                }
            });
            if (commit) {
                resourcesToCommit = commitPage.getSelectedResources();
                keepLocks = commitPage.isKeepLocks();
            }
            commitComment = commitPage.getComment();
        } catch (SVNException e) {
            if (!e.operationInterrupted()) {
                SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
            }
        }
    }
    return commit;
}
Also used : IFile(org.eclipse.core.resources.IFile) HashMap(java.util.HashMap) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) ArrayList(java.util.ArrayList) SvnWizardCommitPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardCommitPage) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SVNException(org.tigris.subversion.subclipse.core.SVNException) ProjectProperties(org.tigris.subversion.subclipse.ui.settings.ProjectProperties) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) CommitToTagsWarningDialog(org.tigris.subversion.subclipse.ui.dialogs.CommitToTagsWarningDialog) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) IContainer(org.eclipse.core.resources.IContainer) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) IResource(org.eclipse.core.resources.IResource)

Example 3 with SvnWizard

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

the class SvnPropertiesView method getAddPropertyAction.

private Action getAddPropertyAction() {
    if (addPropertyAction == null) {
        SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
        addPropertyAction = new Action(Policy.bind("SvnPropertiesView.addPropertyLabel"), // $NON-NLS-1$
        plugin.getImageDescriptor(ISVNUIConstants.IMG_MENU_PROPSET)) {

            public void run() {
                SvnWizardSetPropertyPage setPropertyPage = new SvnWizardSetPropertyPage(resource);
                SvnWizard wizard = new SvnWizard(setPropertyPage);
                SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(), wizard);
                wizard.setParentDialog(dialog);
                if (dialog.open() != SvnWizardDialog.OK)
                    return;
                try {
                    if (setPropertyPage.getPropertyValue() != null) {
                        resource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyValue(), setPropertyPage.getRecurse());
                    } else {
                        resource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyFile(), setPropertyPage.getRecurse());
                    }
                    refresh();
                } catch (SVNException e) {
                    if (!e.operationInterrupted()) {
                        SVNUIPlugin.openError(getSite().getShell(), // $NON-NLS-1$
                        Policy.bind("SvnPropertiesView.errorAddTitle"), // $NON-NLS-1$
                        Policy.bind("SvnPropertiesView.errorAddMessage"), e);
                    }
                }
            }
        };
        addPropertyAction.setToolTipText(// $NON-NLS-1$
        Policy.bind("SvnPropertiesView.addPropertyTooltip"));
    }
    return addPropertyAction;
}
Also used : SVNUIPlugin(org.tigris.subversion.subclipse.ui.SVNUIPlugin) SVNPropertyDeleteAction(org.tigris.subversion.subclipse.ui.actions.SVNPropertyDeleteAction) SVNPropertyModifyAction(org.tigris.subversion.subclipse.ui.actions.SVNPropertyModifyAction) Action(org.eclipse.jface.action.Action) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SVNException(org.tigris.subversion.subclipse.core.SVNException) SvnWizardSetPropertyPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSetPropertyPage)

Example 4 with SvnWizard

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

the class RevertSynchronizeOperation method run.

protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    if (prompted)
        return;
    prompted = true;
    getShell().getDisplay().syncExec(new Runnable() {

        public void run() {
            if (resources == null || resources.length == 0) {
                revert = false;
                return;
            }
            revertPage = new SvnWizardRevertPage(resources, url, statusMap, true);
            revertPage.setResourceRemoved(SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_IGNORE_HIDDEN_CHANGES));
            SvnWizard wizard = new SvnWizard(revertPage);
            SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
            revert = (dialog.open() == SvnWizardDialog.OK);
            if (revert)
                resourcesToRevert = revertPage.getSelectedResources();
        }
    });
    if (revert) {
        boolean includesExternals = false;
        if (revertPage != null && !revertPage.isResourceRemoved()) {
            for (IResource resource : resourcesToRevert) {
                if (isExternal(resource)) {
                    includesExternals = true;
                    break;
                }
            }
        }
        RevertOperation revertOperation = null;
        if (revertPage != null && !revertPage.isResourceRemoved() && !includesExternals) {
            revertOperation = new RevertOperation(getPart(), selectedResources);
            revertOperation.setRecurse(true);
            revertOperation.setResourcesToRevert(resourcesToRevert);
        } else {
            revertOperation = new RevertOperation(getPart(), resourcesToRevert);
        }
        revertOperation.run();
    }
}
Also used : SvnWizardRevertPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardRevertPage) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) RevertOperation(org.tigris.subversion.subclipse.ui.operations.RevertOperation) IResource(org.eclipse.core.resources.IResource)

Example 5 with SvnWizard

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

the class SVNFileModificationValidatorPrompt method prompt.

public boolean prompt(IFile[] lockFiles, Object context) {
    if (context == null) {
        comment = "";
        stealLock = false;
        return true;
    }
    this.files = lockFiles;
    success = false;
    SVNUIPlugin.getStandardDisplay().syncExec(new Runnable() {

        public void run() {
            SvnWizardLockPage lockPage = new SvnWizardLockPage(files);
            SvnWizard wizard = new SvnWizard(lockPage);
            SvnWizardDialog dialog = new SvnWizardDialog(Display.getCurrent().getActiveShell(), wizard);
            wizard.setParentDialog(dialog);
            if (dialog.open() == SvnWizardDialog.OK) {
                success = true;
                comment = lockPage.getComment();
                stealLock = lockPage.isStealLock();
            }
        }
    });
    return success;
}
Also used : SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) SvnWizard(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard) SvnWizardLockPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardLockPage)

Aggregations

SvnWizard (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizard)17 SvnWizardDialog (org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog)17 IResource (org.eclipse.core.resources.IResource)9 SVNException (org.tigris.subversion.subclipse.core.SVNException)7 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IContainer (org.eclipse.core.resources.IContainer)4 CoreException (org.eclipse.core.runtime.CoreException)4 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)4 Action (org.eclipse.jface.action.Action)3 TeamException (org.eclipse.team.core.TeamException)3 Iterator (java.util.Iterator)2 IFile (org.eclipse.core.resources.IFile)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 WorkspaceModifyOperation (org.eclipse.ui.actions.WorkspaceModifyOperation)2 ISVNRemoteFile (org.tigris.subversion.subclipse.core.ISVNRemoteFile)2 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)2