Search in sources :

Example 71 with SVNUrl

use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.

the class BranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) {
        action.setEnabled(true);
    } else {
        IResource[] resources = getSelectedResources();
        BranchTagWizard wizard = new BranchTagWizard(resources);
        SizePersistedWizardDialog dialog = // $NON-NLS-1$
        new SizePersistedWizardDialog(getShell(), wizard, "BranchTag");
        wizard.setParentDialog(dialog);
        if (dialog.open() == WizardDialog.OK) {
            SVNUrl[] sourceUrls = wizard.getUrls();
            SVNUrl destinationUrl = wizard.getToUrl();
            String message = wizard.getComment();
            boolean createOnServer = wizard.isCreateOnServer();
            BranchTagOperation branchTagOperation = new BranchTagOperation(getTargetPart(), getSelectedResources(), sourceUrls, destinationUrl, createOnServer, wizard.getRevision(), message);
            branchTagOperation.setMakeParents(wizard.isMakeParents());
            branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
            branchTagOperation.setNewAlias(wizard.getNewAlias());
            branchTagOperation.switchAfterTagBranchOperation(wizard.isSwitchAfterBranchTag());
            branchTagOperation.setSvnExternals(wizard.getSvnExternals());
            branchTagOperation.run();
        }
    }
}
Also used : BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) BranchTagOperation(org.tigris.subversion.subclipse.ui.operations.BranchTagOperation) SizePersistedWizardDialog(org.tigris.subversion.subclipse.ui.wizards.SizePersistedWizardDialog) IResource(org.eclipse.core.resources.IResource)

Example 72 with SVNUrl

use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.

the class ReplaceWithBranchTagAction method execute.

protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    IResource[] resources = getSelectedResources();
    ReplaceWithBranchTagWizard wizard = new ReplaceWithBranchTagWizard(resources);
    WizardDialog dialog = new WizardDialog(getShell(), wizard);
    if (dialog.open() == WizardDialog.OK) {
        ReplaceWithBranchTagWizardMainPage mainPage = wizard.getMainPage();
        if (wizard.isReplaceContents()) {
            SVNUrl url = mainPage.getUrl();
            SVNRevision svnRevision = mainPage.getRevision();
            ReplaceWithRemoteOperation replaceOperation = new ReplaceWithRemoteOperation(getTargetPart(), resources[0], url, svnRevision);
            replaceOperation.run();
        } else {
            SvnWizardSwitchPage switchPage = wizard.getSwitchPage();
            SVNUrl[] svnUrls;
            SVNRevision svnRevision;
            if (mainPage == null) {
                svnUrls = switchPage.getUrls();
                svnRevision = switchPage.getRevision();
            } else {
                svnUrls = new SVNUrl[] { mainPage.getUrl() };
                svnRevision = mainPage.getRevision();
            }
            SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), resources, svnUrls, svnRevision);
            switchOperation.setDepth(switchPage.getDepth());
            switchOperation.setSetDepth(switchPage.isSetDepth());
            switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
            switchOperation.setForce(switchPage.isForce());
            switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
            switchOperation.setCanRunAsJob(true);
            switchOperation.setConflictResolver(switchPage.getConflictResolver());
            switchOperation.run();
        }
    }
}
Also used : ReplaceWithBranchTagWizardMainPage(org.tigris.subversion.subclipse.ui.wizards.ReplaceWithBranchTagWizardMainPage) ReplaceWithBranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.ReplaceWithBranchTagWizard) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SvnWizardSwitchPage(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardSwitchPage) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ReplaceWithRemoteOperation(org.tigris.subversion.subclipse.ui.operations.ReplaceWithRemoteOperation) IResource(org.eclipse.core.resources.IResource) SwitchOperation(org.tigris.subversion.subclipse.ui.operations.SwitchOperation)

Example 73 with SVNUrl

use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.

the class SVNHistoryPage method getCreateTagFromRevisionChangedPathAction.

private IAction getCreateTagFromRevisionChangedPathAction() {
    if (createTagFromRevisionChangedPathAction == null) {
        createTagFromRevisionChangedPathAction = new // $NON-NLS-1$
        Action() {

            public void run() {
                SVNRevision selectedRevision = null;
                ISelection selection = changePathsViewer.getSelection();
                if (!(selection instanceof IStructuredSelection))
                    return;
                IStructuredSelection sel = (IStructuredSelection) selection;
                ISVNRemoteResource remoteResource = null;
                if (sel.getFirstElement() instanceof LogEntryChangePath) {
                    try {
                        remoteResource = ((LogEntryChangePath) sel.getFirstElement()).getRemoteResource();
                        selectedRevision = remoteResource.getRevision();
                    } catch (SVNException e) {
                    }
                } else if (sel.getFirstElement() instanceof HistoryFolder) {
                    HistoryFolder historyFolder = (HistoryFolder) sel.getFirstElement();
                    Object[] children = historyFolder.getChildren();
                    if (children != null && children.length > 0 && children[0] instanceof LogEntryChangePath) {
                        LogEntryChangePath changePath = (LogEntryChangePath) children[0];
                        try {
                            remoteResource = changePath.getRemoteResource().getRepository().getRemoteFolder(historyFolder.getPath());
                            selectedRevision = getSelectedRevision();
                        } catch (SVNException e) {
                        }
                    }
                }
                if (remoteResource == null)
                    return;
                ISVNRemoteResource[] remoteResources = { remoteResource };
                BranchTagWizard wizard = new BranchTagWizard(remoteResources);
                wizard.setRevisionNumber(Long.parseLong(selectedRevision.toString()));
                WizardDialog dialog = new ClosableWizardDialog(getSite().getShell(), wizard);
                if (dialog.open() == WizardDialog.OK) {
                    final SVNUrl sourceUrl = wizard.getUrl();
                    final SVNUrl destinationUrl = wizard.getToUrl();
                    final String message = wizard.getComment();
                    final SVNRevision revision = wizard.getRevision();
                    final boolean makeParents = wizard.isMakeParents();
                    try {
                        BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

                            public void run() {
                                ISVNClientAdapter client = null;
                                try {
                                    client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
                                    client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
                                    SVNUIPlugin.getPlugin().getRepositoryManager().resourceCreated(null, null);
                                } catch (Exception e) {
                                    MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
                                    e.getMessage());
                                } finally {
                                    SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
                                }
                            }
                        });
                    } catch (Exception e) {
                        MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
                        e.getMessage());
                    }
                }
            // SvnWizardBranchTagPage branchTagPage = new
            // SvnWizardBranchTagPage(remoteResource);
            // 
            // branchTagPage.setRevisionNumber(Long.parseLong(selectedRevision.toString()));
            // SvnWizard wizard = new SvnWizard(branchTagPage);
            // SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(),
            // wizard);
            // wizard.setParentDialog(dialog);
            // if (!(dialog.open() == SvnWizardDialog.OK)) return;
            // final SVNUrl sourceUrl = branchTagPage.getUrl();
            // final SVNUrl destinationUrl = branchTagPage.getToUrl();
            // final String message = branchTagPage.getComment();
            // final SVNRevision revision = branchTagPage.getRevision();
            // final boolean makeParents = branchTagPage.isMakeParents();
            // try {
            // BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
            // public void run() {
            // try {
            // ISVNClientAdapter client =
            // SVNProviderPlugin.getPlugin().getSVNClientManager().createSVNClient();
            // client.copy(sourceUrl, destinationUrl, message, revision,
            // makeParents);
            // } catch(Exception e) {
            // MessageDialog.openError(getSite().getShell(),
            // Policy.bind("HistoryView.createTagFromRevision"), e
            // .getMessage());
            // }
            // }
            // });
            // } catch(Exception e) {
            // MessageDialog.openError(getSite().getShell(),
            // Policy.bind("HistoryView.createTagFromRevision"), e
            // .getMessage());
            // }
            }
        };
    }
    ISelection selection = changePathsViewer.getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sel = (IStructuredSelection) selection;
        SVNRevision selectedRevision = null;
        if (sel.size() == 1) {
            // ISVNRemoteResource remoteResource = null;
            if (sel.getFirstElement() instanceof LogEntryChangePath && ((LogEntryChangePath) sel.getFirstElement()).getAction() != 'D') {
                // try {
                // remoteResource = ((LogEntryChangePath)sel.getFirstElement()).getRemoteResource();
                selectedRevision = ((LogEntryChangePath) sel.getFirstElement()).getRevision();
            // selectedRevision = remoteResource.getRevision();
            // } catch (SVNException e) {}
            } else if (sel.getFirstElement() instanceof HistoryFolder) {
                HistoryFolder historyFolder = (HistoryFolder) sel.getFirstElement();
                Object[] children = historyFolder.getChildren();
                if (children != null && children.length > 0 && children[0] instanceof LogEntryChangePath) {
                    selectedRevision = getSelectedRevision();
                }
            }
            createTagFromRevisionChangedPathAction.setEnabled(selectedRevision != null);
            if (selectedRevision == null) {
                createTagFromRevisionChangedPathAction.setText(Policy.bind("HistoryView.createTagFromRevision", // $NON-NLS-1$ //$NON-NLS-2$
                "" + ((LogEntryChangePath) sel.getFirstElement()).getRevision()));
            } else {
                createTagFromRevisionChangedPathAction.setText(Policy.bind("HistoryView.createTagFromRevision", // $NON-NLS-1$ //$NON-NLS-2$
                "" + selectedRevision));
            }
        }
    }
    createTagFromRevisionChangedPathAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_BRANCHTAG));
    return createTagFromRevisionChangedPathAction;
}
Also used : LogEntryChangePath(org.tigris.subversion.subclipse.core.history.LogEntryChangePath) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) SVNException(org.tigris.subversion.subclipse.core.SVNException) 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) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) ISelection(org.eclipse.jface.viewers.ISelection) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 74 with SVNUrl

use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.

the class SVNHistoryPage method getCreateTagFromRevisionAction.

// get create tag from revision action (context menu)
private IAction getCreateTagFromRevisionAction() {
    if (createTagFromRevisionAction == null) {
        createTagFromRevisionAction = new Action() {

            public void run() {
                ISelection selection = getSelection();
                if (!(selection instanceof IStructuredSelection))
                    return;
                ILogEntry currentSelection = getLogEntry((IStructuredSelection) selection);
                BranchTagWizard wizard;
                if (resource == null) {
                    ISVNRemoteResource[] remoteResources = { historyTableProvider.getRemoteResource() };
                    wizard = new BranchTagWizard(remoteResources);
                } else {
                    IResource[] resources = { resource };
                    wizard = new BranchTagWizard(resources);
                }
                wizard.setRevisionNumber(currentSelection.getRevision().getNumber());
                WizardDialog dialog = new ClosableWizardDialog(getSite().getShell(), wizard);
                if (dialog.open() == WizardDialog.OK) {
                    final SVNUrl sourceUrl = wizard.getUrl();
                    final SVNUrl destinationUrl = wizard.getToUrl();
                    final String message = wizard.getComment();
                    final SVNRevision revision = wizard.getRevision();
                    final boolean makeParents = wizard.isMakeParents();
                    boolean createOnServer = wizard.isCreateOnServer();
                    IResource[] resources = { resource };
                    try {
                        if (resource == null) {
                            BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

                                public void run() {
                                    ISVNClientAdapter client = null;
                                    try {
                                        client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
                                        client.copy(sourceUrl, destinationUrl, message, revision, makeParents);
                                        SVNUIPlugin.getPlugin().getRepositoryManager().resourceCreated(null, null);
                                    } catch (Exception e) {
                                        MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
                                        e.getMessage());
                                    } finally {
                                        SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
                                    }
                                }
                            });
                        } else {
                            BranchTagOperation branchTagOperation = new BranchTagOperation(getSite().getPage().getActivePart(), resources, new SVNUrl[] { sourceUrl }, destinationUrl, createOnServer, wizard.getRevision(), message);
                            branchTagOperation.setMakeParents(makeParents);
                            branchTagOperation.setNewAlias(wizard.getNewAlias());
                            branchTagOperation.run();
                        }
                    } catch (Exception e) {
                        MessageDialog.openError(getSite().getShell(), Policy.bind("HistoryView.createTagFromRevision"), // $NON-NLS-1$
                        e.getMessage());
                    }
                }
            }
        };
    }
    ISelection selection = getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection ss = (IStructuredSelection) selection;
        if (ss.size() == 1) {
            ILogEntry currentSelection = getLogEntry(ss);
            createTagFromRevisionAction.setText(Policy.bind("HistoryView.createTagFromRevision", // $NON-NLS-1$ //$NON-NLS-2$
            "" + currentSelection.getRevision().getNumber()));
        }
    }
    createTagFromRevisionAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_BRANCHTAG));
    return createTagFromRevisionAction;
}
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) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) 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) BranchTagWizard(org.tigris.subversion.subclipse.ui.wizards.BranchTagWizard) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) BranchTagOperation(org.tigris.subversion.subclipse.ui.operations.BranchTagOperation) ISelection(org.eclipse.jface.viewers.ISelection) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ClosableWizardDialog(org.tigris.subversion.subclipse.ui.wizards.ClosableWizardDialog) SvnWizardDialog(org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog) ISVNClientAdapter(org.tigris.subversion.svnclientadapter.ISVNClientAdapter)

Example 75 with SVNUrl

use of org.tigris.subversion.svnclientadapter.SVNUrl in project subclipse by subclipse.

the class ComparePropertiesDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    // $NON-NLS-1$
    getShell().setText(Policy.bind("ComparePropertiesDialog.1"));
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Group fromGroup = new Group(composite, SWT.NULL);
    // $NON-NLS-1$
    fromGroup.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.compareFrom"));
    GridLayout fromLayout = new GridLayout();
    fromLayout.numColumns = 3;
    fromGroup.setLayout(fromLayout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    fromGroup.setLayoutData(data);
    fromWorkingCopyButton = new Button(fromGroup, SWT.RADIO);
    // $NON-NLS-1$
    fromWorkingCopyButton.setText(Policy.bind("ComparePropertiesDialog.2"));
    fromWorkingCopyText = new Text(fromGroup, SWT.BORDER | SWT.READ_ONLY);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    data.widthHint = 600;
    fromWorkingCopyText.setLayoutData(data);
    fromWorkingCopyBrowseButton = new Button(fromGroup, SWT.PUSH);
    // $NON-NLS-1$
    fromWorkingCopyBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    fromRepositoryButton = new Button(fromGroup, SWT.RADIO);
    // $NON-NLS-1$
    fromRepositoryButton.setText(Policy.bind("ComparePropertiesDialog.4"));
    fromRepositoryText = new Text(fromGroup, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    data.widthHint = 600;
    fromRepositoryText.setLayoutData(data);
    fromRepositoryBrowseButton = new Button(fromGroup, SWT.PUSH);
    // $NON-NLS-1$
    fromRepositoryBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    fromHeadButton = new Button(fromGroup, SWT.CHECK);
    data = new GridData();
    data.horizontalSpan = 3;
    fromHeadButton.setLayoutData(data);
    // $NON-NLS-1$
    fromHeadButton.setText(Policy.bind("ComparePropertiesDialog.6"));
    fromHeadButton.setSelection(true);
    Composite fromRevisionGroup = new Composite(fromGroup, SWT.NONE);
    GridLayout fromRevisionLayout = new GridLayout();
    fromRevisionLayout.numColumns = 3;
    fromRevisionLayout.marginHeight = 0;
    fromRevisionLayout.marginWidth = 0;
    fromRevisionGroup.setLayout(fromRevisionLayout);
    data = new GridData();
    data.horizontalSpan = 3;
    fromRevisionGroup.setLayoutData(data);
    fromRevisionLabel = new Label(fromRevisionGroup, SWT.NONE);
    // $NON-NLS-1$
    fromRevisionLabel.setText(Policy.bind("ComparePropertiesDialog.7"));
    fromRevisionLabel.setEnabled(false);
    fromRevisionText = new Text(fromRevisionGroup, SWT.BORDER);
    data = new GridData();
    data.widthHint = 40;
    fromRevisionText.setLayoutData(data);
    fromRevisionText.setEnabled(false);
    fromRevisionBrowseButton = new Button(fromRevisionGroup, SWT.PUSH);
    // $NON-NLS-1$
    fromRevisionBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    fromRevisionBrowseButton.setEnabled(false);
    Group toGroup = new Group(composite, SWT.NULL);
    // $NON-NLS-1$
    toGroup.setText(Policy.bind("ShowDifferencesAsUnifiedDiffDialog.compareTo"));
    GridLayout toLayout = new GridLayout();
    toLayout.numColumns = 3;
    toGroup.setLayout(toLayout);
    data = new GridData(SWT.FILL, SWT.FILL, true, false);
    toGroup.setLayoutData(data);
    toWorkingCopyButton = new Button(toGroup, SWT.RADIO);
    // $NON-NLS-1$
    toWorkingCopyButton.setText(Policy.bind("ComparePropertiesDialog.2"));
    toWorkingCopyText = new Text(toGroup, SWT.BORDER | SWT.READ_ONLY);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    data.widthHint = 600;
    toWorkingCopyText.setLayoutData(data);
    toWorkingCopyBrowseButton = new Button(toGroup, SWT.PUSH);
    // $NON-NLS-1$
    toWorkingCopyBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    toRepositoryButton = new Button(toGroup, SWT.RADIO);
    // $NON-NLS-1$
    toRepositoryButton.setText(Policy.bind("ComparePropertiesDialog.4"));
    toRepositoryText = new Text(toGroup, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    data.widthHint = 600;
    toRepositoryText.setLayoutData(data);
    toRepositoryBrowseButton = new Button(toGroup, SWT.PUSH);
    // $NON-NLS-1$
    toRepositoryBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    toHeadButton = new Button(toGroup, SWT.CHECK);
    data = new GridData();
    data.horizontalSpan = 3;
    toHeadButton.setLayoutData(data);
    // $NON-NLS-1$
    toHeadButton.setText(Policy.bind("ComparePropertiesDialog.6"));
    toHeadButton.setSelection(true);
    Composite toRevisionGroup = new Composite(toGroup, SWT.NONE);
    GridLayout toRevisionLayout = new GridLayout();
    toRevisionLayout.numColumns = 3;
    toRevisionLayout.marginHeight = 0;
    toRevisionLayout.marginWidth = 0;
    toRevisionGroup.setLayout(toRevisionLayout);
    data = new GridData();
    data.horizontalSpan = 3;
    toRevisionGroup.setLayoutData(data);
    toRevisionLabel = new Label(toRevisionGroup, SWT.NONE);
    // $NON-NLS-1$
    toRevisionLabel.setText(Policy.bind("ComparePropertiesDialog.7"));
    toRevisionLabel.setEnabled(false);
    toRevisionText = new Text(toRevisionGroup, SWT.BORDER);
    data = new GridData();
    data.widthHint = 40;
    toRevisionText.setLayoutData(data);
    toRevisionText.setEnabled(false);
    toRevisionBrowseButton = new Button(toRevisionGroup, SWT.PUSH);
    // $NON-NLS-1$
    toRevisionBrowseButton.setText(Policy.bind("ComparePropertiesDialog.3"));
    toRevisionBrowseButton.setEnabled(false);
    recursiveButton = new Button(composite, SWT.CHECK);
    // $NON-NLS-1$
    recursiveButton.setText(Policy.bind("ComparePropertiesDialog.16"));
    if (left != null) {
        if (left instanceof PropertyCompareLocalResourceNode) {
            fromWorkingCopyText.setText(((PropertyCompareLocalResourceNode) left).getResource().getFullPath().toString());
            fromWorkingCopyButton.setSelection(true);
            fromRepositoryText.setEnabled(false);
            fromRepositoryBrowseButton.setEnabled(false);
            fromHeadButton.setEnabled(false);
            fromLocalResource = ((PropertyCompareLocalResourceNode) left).getResource();
        } else if (left instanceof PropertyCompareRemoteResourceNode) {
            fromRepositoryText.setText(((PropertyCompareRemoteResourceNode) left).getRemoteResource().getUrl().toString());
            fromRepositoryButton.setSelection(true);
            fromWorkingCopyText.setEnabled(false);
            fromWorkingCopyBrowseButton.setEnabled(false);
            fromHeadButton.setEnabled(true);
        }
    }
    if (right == null) {
        right = left;
    }
    if (right != null) {
        if (right instanceof PropertyCompareLocalResourceNode) {
            toWorkingCopyText.setText(((PropertyCompareLocalResourceNode) right).getResource().getFullPath().toString());
            toWorkingCopyButton.setSelection(true);
            toRepositoryText.setEnabled(false);
            toRepositoryBrowseButton.setEnabled(false);
            toHeadButton.setEnabled(false);
            repository = SVNWorkspaceRoot.getSVNResourceFor(((PropertyCompareLocalResourceNode) right).getResource()).getRepository();
            toLocalResource = ((PropertyCompareLocalResourceNode) right).getResource();
        } else if (right instanceof PropertyCompareRemoteResourceNode) {
            toRepositoryText.setText(((PropertyCompareRemoteResourceNode) right).getRemoteResource().getUrl().toString());
            toRepositoryButton.setSelection(true);
            toWorkingCopyText.setEnabled(false);
            toWorkingCopyBrowseButton.setEnabled(false);
            toHeadButton.setEnabled(true);
            repository = ((PropertyCompareRemoteResourceNode) right).getRemoteResource().getRepository();
        }
    }
    ModifyListener modifyListener = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            okButton.setEnabled(canFinish());
        }
    };
    fromWorkingCopyText.addModifyListener(modifyListener);
    fromRepositoryText.addModifyListener(modifyListener);
    fromRevisionText.addModifyListener(modifyListener);
    toWorkingCopyText.addModifyListener(modifyListener);
    toRepositoryText.addModifyListener(modifyListener);
    toRevisionText.addModifyListener(modifyListener);
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.getSource() == fromWorkingCopyBrowseButton || e.getSource() == toWorkingCopyBrowseButton) {
                ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
                // $NON-NLS-1$
                dialog.setTitle(Policy.bind("ComparePropertiesDialog.1"));
                // $NON-NLS-1$
                dialog.setMessage(Policy.bind("ComparePropertiesDialog.18"));
                dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
                if (dialog.open() != ElementTreeSelectionDialog.CANCEL) {
                    Object result = dialog.getFirstResult();
                    if (result instanceof IResource) {
                        if (e.getSource() == fromWorkingCopyBrowseButton) {
                            fromWorkingCopyText.setText(((IResource) result).getFullPath().toString());
                            fromLocalResource = (IResource) result;
                        } else {
                            toWorkingCopyText.setText(((IResource) result).getFullPath().toString());
                            toLocalResource = (IResource) result;
                        }
                    }
                }
            } else if (e.getSource() == fromRepositoryBrowseButton || e.getSource() == toRepositoryBrowseButton) {
                ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), null);
                dialog.setRepositoryLocation(repository);
                if (dialog.open() != ChooseUrlDialog.CANCEL) {
                    String url = dialog.getUrl();
                    if (url != null) {
                        if (e.getSource() == fromRepositoryBrowseButton) {
                            fromRepositoryText.setText(url);
                        } else {
                            toRepositoryText.setText(url);
                        }
                    }
                }
            } else if (e.getSource() == fromRevisionBrowseButton || e.getSource() == toRevisionBrowseButton) {
                try {
                    SVNUrl url = null;
                    if (e.getSource() == fromRevisionBrowseButton) {
                        url = new SVNUrl(fromRepositoryText.getText().trim());
                    } else {
                        url = new SVNUrl(toRepositoryText.getText().trim());
                    }
                    ISVNRemoteResource remoteResource = repository.getRemoteFile(url);
                    HistoryDialog dialog = new HistoryDialog(getShell(), remoteResource);
                    if (dialog.open() != HistoryDialog.CANCEL) {
                        ILogEntry[] selectedEntries = dialog.getSelectedLogEntries();
                        if (selectedEntries.length > 0) {
                            if (e.getSource() == fromRevisionBrowseButton) {
                                fromRevisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
                            } else {
                                toRevisionText.setText(Long.toString(selectedEntries[selectedEntries.length - 1].getRevision().getNumber()));
                            }
                        }
                    }
                } catch (Exception exc) {
                    MessageDialog.openError(getShell(), Policy.bind("ComparePropertiesDialog.1"), // $NON-NLS-1$
                    exc.getMessage());
                }
            }
            setEnablement();
            okButton.setEnabled(canFinish());
        }
    };
    fromWorkingCopyButton.addSelectionListener(selectionListener);
    fromWorkingCopyBrowseButton.addSelectionListener(selectionListener);
    fromRepositoryButton.addSelectionListener(selectionListener);
    fromRepositoryBrowseButton.addSelectionListener(selectionListener);
    fromHeadButton.addSelectionListener(selectionListener);
    fromRevisionBrowseButton.addSelectionListener(selectionListener);
    toWorkingCopyButton.addSelectionListener(selectionListener);
    toWorkingCopyBrowseButton.addSelectionListener(selectionListener);
    toRepositoryButton.addSelectionListener(selectionListener);
    toRepositoryBrowseButton.addSelectionListener(selectionListener);
    toHeadButton.addSelectionListener(selectionListener);
    toRevisionBrowseButton.addSelectionListener(selectionListener);
    return composite;
}
Also used : PropertyCompareLocalResourceNode(org.tigris.subversion.subclipse.ui.compare.PropertyCompareLocalResourceNode) Group(org.eclipse.swt.widgets.Group) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ModifyListener(org.eclipse.swt.events.ModifyListener) ILogEntry(org.tigris.subversion.subclipse.core.history.ILogEntry) Label(org.eclipse.swt.widgets.Label) PropertyCompareRemoteResourceNode(org.tigris.subversion.subclipse.ui.compare.PropertyCompareRemoteResourceNode) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) BaseWorkbenchContentProvider(org.eclipse.ui.model.BaseWorkbenchContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Composite(org.eclipse.swt.widgets.Composite) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ISVNRemoteResource(org.tigris.subversion.subclipse.core.ISVNRemoteResource) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) GridData(org.eclipse.swt.layout.GridData) IResource(org.eclipse.core.resources.IResource) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

SVNUrl (org.tigris.subversion.svnclientadapter.SVNUrl)83 SVNException (org.tigris.subversion.subclipse.core.SVNException)29 SVNRevision (org.tigris.subversion.svnclientadapter.SVNRevision)26 MalformedURLException (java.net.MalformedURLException)25 ISVNRemoteResource (org.tigris.subversion.subclipse.core.ISVNRemoteResource)21 ISVNClientAdapter (org.tigris.subversion.svnclientadapter.ISVNClientAdapter)19 ParseException (java.text.ParseException)18 ILogEntry (org.tigris.subversion.subclipse.core.history.ILogEntry)17 IResource (org.eclipse.core.resources.IResource)16 InvocationTargetException (java.lang.reflect.InvocationTargetException)14 ISVNRepositoryLocation (org.tigris.subversion.subclipse.core.ISVNRepositoryLocation)14 TeamException (org.eclipse.team.core.TeamException)13 SVNClientException (org.tigris.subversion.svnclientadapter.SVNClientException)13 ArrayList (java.util.ArrayList)12 ISVNInfo (org.tigris.subversion.svnclientadapter.ISVNInfo)12 File (java.io.File)11 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 RemoteFile (org.tigris.subversion.subclipse.core.resources.RemoteFile)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)8 RemoteFolder (org.tigris.subversion.subclipse.core.resources.RemoteFolder)8