Search in sources :

Example 1 with ChooseUrlDialog

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

the class SvnWizardBranchTagPage method createControls.

public void createControls(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite top = new Composite(composite, SWT.NULL);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    top.setLayout(gridLayout);
    top.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Group repositoryGroup = new Group(top, SWT.NULL);
    // $NON-NLS-1$
    repositoryGroup.setText(Policy.bind("BranchTagDialog.repository"));
    repositoryGroup.setLayout(new GridLayout());
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    repositoryGroup.setLayoutData(data);
    Label fromUrlLabel = new Label(repositoryGroup, SWT.NONE);
    if (resource == null)
        // $NON-NLS-1$
        fromUrlLabel.setText(Policy.bind("BranchTagDialog.fromUrl"));
    else
        // $NON-NLS-1$
        fromUrlLabel.setText(Policy.bind("BranchTagDialog.url"));
    Text urlText = new Text(repositoryGroup, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    urlText.setLayoutData(data);
    if (resource == null) {
        url = remoteResource.getUrl();
        urlText.setText(url.toString());
    } else {
        svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
        try {
            url = svnResource.getStatus().getUrl();
            if (url != null)
                urlText.setText(svnResource.getStatus().getUrlString());
        } catch (SVNException e1) {
        }
    }
    urlText.setEditable(false);
    Label toUrlLabel = new Label(repositoryGroup, SWT.NONE);
    // $NON-NLS-1$
    toUrlLabel.setText(Policy.bind("BranchTagDialog.toUrl"));
    Composite urlComposite = new Composite(repositoryGroup, SWT.NULL);
    GridLayout urlLayout = new GridLayout();
    urlLayout.numColumns = 2;
    urlLayout.marginWidth = 0;
    urlLayout.marginHeight = 0;
    urlComposite.setLayout(urlLayout);
    data = new GridData(SWT.FILL, SWT.FILL, true, false);
    urlComposite.setLayoutData(data);
    toUrlCombo = new UrlCombo(urlComposite, SWT.NONE);
    toUrlCombo.init(// $NON-NLS-1$
    resource == null ? "repositoryBrowser" : resource.getProject().getName());
    toUrlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    toUrlCombo.setText(urlText.getText());
    Button browseButton = new Button(urlComposite, SWT.PUSH);
    // $NON-NLS-1$
    browseButton.setText(Policy.bind("SwitchDialog.browse"));
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
            if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                toUrlCombo.setText(dialog.getUrl());
            }
        }
    });
    makeParentsButton = new Button(urlComposite, SWT.CHECK);
    // $NON-NLS-1$
    makeParentsButton.setText(Policy.bind("BranchTagDialog.makeParents"));
    data = new GridData();
    data.horizontalSpan = 2;
    makeParentsButton.setLayoutData(data);
    makeParentsButton.setSelection(// $NON-NLS-1$
    settings.getBoolean("BranchTagDialog.makeParents"));
    makeParentsButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            settings.put("BranchTagDialog.makeParents", // $NON-NLS-1$
            makeParentsButton.getSelection());
        }
    });
    // Group serverComposite = new Group(repositoryGroup, SWT.NULL);
    Group serverComposite = new Group(top, SWT.NULL);
    // $NON-NLS-1$
    serverComposite.setText(Policy.bind("BranchTagDialog.createCopy"));
    GridLayout serverLayout = new GridLayout();
    serverLayout.numColumns = 3;
    serverComposite.setLayout(serverLayout);
    data = new GridData(SWT.FILL, SWT.FILL, true, false);
    serverComposite.setLayoutData(data);
    serverButton = new Button(serverComposite, SWT.RADIO);
    // $NON-NLS-1$
    serverButton.setText(Policy.bind("BranchTagDialog.head"));
    data = new GridData();
    data.horizontalSpan = 3;
    serverButton.setLayoutData(data);
    revisionButton = new Button(serverComposite, SWT.RADIO);
    // $NON-NLS-1$
    revisionButton.setText(Policy.bind("BranchTagDialog.revision"));
    revisionText = new Text(serverComposite, SWT.BORDER);
    data = new GridData();
    data.widthHint = REVISION_WIDTH_HINT;
    revisionText.setLayoutData(data);
    if (revisionNumber == 0)
        revisionText.setEnabled(false);
    else
        revisionText.setText("" + revisionNumber);
    revisionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    logButton = new Button(serverComposite, SWT.PUSH);
    // $NON-NLS-1$
    logButton.setText(Policy.bind("MergeDialog.showLog"));
    if (revisionNumber == 0)
        logButton.setEnabled(false);
    logButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            showLog();
        }
    });
    workingCopyButton = new Button(serverComposite, SWT.RADIO);
    // $NON-NLS-1$
    workingCopyButton.setText(Policy.bind("BranchTagDialog.working"));
    data = new GridData();
    data.horizontalSpan = 3;
    workingCopyButton.setLayoutData(data);
    if (resource == null)
        workingCopyButton.setVisible(false);
    if (revisionNumber == 0)
        serverButton.setSelection(true);
    else
        revisionButton.setSelection(true);
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            revisionText.setEnabled(revisionButton.getSelection());
            logButton.setEnabled(revisionButton.getSelection());
            if (revisionButton.getSelection())
                revisionText.setFocus();
            setPageComplete(canFinish());
        }
    };
    serverButton.addSelectionListener(selectionListener);
    revisionButton.addSelectionListener(selectionListener);
    workingCopyButton.addSelectionListener(selectionListener);
    if (projectProperties != null) {
        if (projectProperties.getMessage() != null) {
            addBugtrackingArea(top);
        }
    }
    commitCommentArea.createArea(composite);
    commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty() == CommitCommentArea.OK_REQUESTED && canFinish()) {
                IClosableWizard wizard = (IClosableWizard) getWizard();
                wizard.finishAndClose();
            }
        }
    });
    toUrlCombo.getCombo().setFocus();
    if (resource != null) {
        switchAfterBranchTagCheckBox = new Button(composite, SWT.CHECK);
        switchAfterBranchTagCheckBox.setText(Policy.bind("BranchTagDialog.switchAfterTagBranch"));
    }
    setPageComplete(canFinish());
    FocusListener focusListener = new FocusListener() {

        public void focusGained(FocusEvent e) {
            ((Text) e.getSource()).selectAll();
        }

        public void focusLost(FocusEvent e) {
            ((Text) e.getSource()).setText(((Text) e.getSource()).getText());
        }
    };
    revisionText.addFocusListener(focusListener);
    if (issueText != null)
        issueText.addFocusListener(focusListener);
    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.BRANCH_TAG_DIALOG);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) Group(org.eclipse.swt.widgets.Group) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) UrlCombo(org.tigris.subversion.subclipse.ui.util.UrlCombo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) SVNException(org.tigris.subversion.subclipse.core.SVNException) IClosableWizard(org.tigris.subversion.subclipse.ui.wizards.IClosableWizard) FocusEvent(org.eclipse.swt.events.FocusEvent) ChooseUrlDialog(org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 2 with ChooseUrlDialog

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

the class SvnWizardCompareMultipleResourcesWithBranchTagPage method createControls.

public void createControls(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    Label urlLabel = new Label(composite, SWT.NONE);
    // $NON-NLS-1$
    urlLabel.setText(Policy.bind("SwitchDialog.url"));
    urlCombo = new UrlCombo(composite, SWT.NONE);
    urlCombo.init(resources[0].getProject().getName());
    urlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    commonRoot = getCommonRoot();
    if (commonRoot != null)
        urlCombo.setText(commonRoot);
    urlCombo.getCombo().addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    Button browseButton = new Button(composite, SWT.PUSH);
    // $NON-NLS-1$
    browseButton.setText(Policy.bind("SwitchDialog.browse"));
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resources[0]);
            dialog.setIncludeBranchesAndTags(resources.length == 1);
            if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                urlCombo.setText(dialog.getUrl());
                setPageComplete(canFinish());
            }
        }
    });
    final Composite revisionGroup = new Composite(composite, SWT.NULL);
    GridLayout revisionLayout = new GridLayout();
    revisionLayout.numColumns = 3;
    revisionLayout.marginWidth = 0;
    revisionLayout.marginHeight = 0;
    revisionGroup.setLayout(revisionLayout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    revisionGroup.setLayoutData(data);
    headButton = new Button(revisionGroup, SWT.CHECK);
    headButton.setText(// $NON-NLS-1$
    Policy.bind("SvnWizardCompareMultipleResourcesWithBranchTagPage.1"));
    data = new GridData();
    data.horizontalSpan = 3;
    headButton.setLayoutData(data);
    Label revisionLabel = new Label(revisionGroup, SWT.NONE);
    // $NON-NLS-1$
    revisionLabel.setText(Policy.bind("SvnWizardSwitchPage.revision"));
    revisionText = new Text(revisionGroup, SWT.BORDER);
    data = new GridData();
    data.widthHint = REVISION_WIDTH_HINT;
    revisionText.setLayoutData(data);
    if (revisionNumber == 0) {
        headButton.setSelection(true);
        revisionText.setEnabled(false);
    } else {
        // $NON-NLS-1$
        revisionText.setText("" + revisionNumber);
    }
    revisionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    FocusListener focusListener = new FocusAdapter() {

        public void focusGained(FocusEvent e) {
            ((Text) e.getSource()).selectAll();
        }

        public void focusLost(FocusEvent e) {
            ((Text) e.getSource()).setText(((Text) e.getSource()).getText());
        }
    };
    revisionText.addFocusListener(focusListener);
    logButton = new Button(revisionGroup, SWT.PUSH);
    // $NON-NLS-1$
    logButton.setText(Policy.bind("MergeDialog.showLog"));
    logButton.setEnabled(false);
    logButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            showLog();
        }
    });
    SelectionListener listener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            revisionText.setEnabled(!headButton.getSelection());
            logButton.setEnabled(!headButton.getSelection());
            setPageComplete(canFinish());
            if (!headButton.getSelection()) {
                revisionText.selectAll();
                revisionText.setFocus();
            }
        }
    };
    headButton.addSelectionListener(listener);
    if (resources.length > 1) {
        table = new Table(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
        table.setLinesVisible(false);
        table.setHeaderVisible(true);
        data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
        data.horizontalSpan = 3;
        table.setLayoutData(data);
        TableLayout tableLayout = new TableLayout();
        table.setLayout(tableLayout);
        viewer = new TableViewer(table);
        viewer.setContentProvider(new CompareContentProvider());
        ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
        viewer.setLabelProvider(new TableDecoratingLabelProvider(new CompareLabelProvider(), decorator));
        for (int i = 0; i < columnHeaders.length; i++) {
            tableLayout.addColumnData(columnLayouts[i]);
            TableColumn tc = new TableColumn(table, SWT.NONE, i);
            tc.setResizable(columnLayouts[i].resizable);
            tc.setText(columnHeaders[i]);
        }
        viewer.setInput(this);
        urlCombo.getCombo().addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                viewer.refresh();
            }
        });
    }
    setPageComplete(canFinish());
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) ModifyListener(org.eclipse.swt.events.ModifyListener) UrlCombo(org.tigris.subversion.subclipse.ui.util.UrlCombo) Label(org.eclipse.swt.widgets.Label) FocusEvent(org.eclipse.swt.events.FocusEvent) ChooseUrlDialog(org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableLayout(org.eclipse.jface.viewers.TableLayout) ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) FocusListener(org.eclipse.swt.events.FocusListener) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 3 with ChooseUrlDialog

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

the class BranchTagWizardRepositoryPage method createControl.

public void createControl(Composite parent) {
    resources = ((BranchTagWizard) getWizard()).getResources();
    remoteResources = ((BranchTagWizard) getWizard()).getRemoteResources();
    Composite outerContainer = new Composite(parent, SWT.NONE);
    GridLayout outerLayout = new GridLayout();
    outerLayout.numColumns = 1;
    outerLayout.marginHeight = 0;
    outerLayout.marginWidth = 0;
    outerContainer.setLayout(outerLayout);
    outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    Group repositoryGroup = new Group(outerContainer, SWT.NULL);
    // $NON-NLS-1$
    repositoryGroup.setText(Policy.bind("BranchTagDialog.repository"));
    repositoryGroup.setLayout(new GridLayout());
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    repositoryGroup.setLayoutData(data);
    if (multipleSelections()) {
        ArrayList urlArray = new ArrayList();
        if (resources == null) {
            for (int i = 0; i < remoteResources.length; i++) {
                urlArray.add(remoteResources[i].getUrl());
            }
        } else {
            for (int i = 0; i < resources.length; i++) {
                ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]);
                try {
                    SVNUrl url = svnResource.getStatus().getUrl();
                    if (url != null) {
                        urlArray.add(url);
                    }
                } catch (SVNException e1) {
                }
            }
        }
        urls = new SVNUrl[urlArray.size()];
        urlArray.toArray(urls);
    } else {
        if (resources == null) {
            urls = new SVNUrl[1];
            urls[0] = remoteResources[0].getUrl();
        } else {
            svnResources = new ISVNLocalResource[1];
            svnResources[0] = SVNWorkspaceRoot.getSVNResourceFor(resources[0]);
            try {
                urls = new SVNUrl[1];
                urls[0] = svnResources[0].getStatus().getUrl();
            } catch (SVNException e1) {
            }
        }
    }
    Label toUrlLabel = new Label(repositoryGroup, SWT.NONE);
    // $NON-NLS-1$
    toUrlLabel.setText(Policy.bind("BranchTagDialog.toUrl"));
    Composite urlComposite = new Composite(repositoryGroup, SWT.NULL);
    GridLayout urlLayout = new GridLayout();
    urlLayout.numColumns = 2;
    urlLayout.marginWidth = 0;
    urlLayout.marginHeight = 0;
    urlComposite.setLayout(urlLayout);
    data = new GridData(SWT.FILL, SWT.FILL, true, false);
    urlComposite.setLayoutData(data);
    toUrlCombo = new UrlCombo(urlComposite, SWT.NONE);
    toUrlCombo.init(resources == null ? "repositoryBrowser" : // $NON-NLS-1$
    resources[0].getProject().getName());
    toUrlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    toUrlCombo.setText(getCommonRoot());
    toUrlCombo.getCombo().addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    Button browseButton = new Button(urlComposite, SWT.PUSH);
    // $NON-NLS-1$
    browseButton.setText(Policy.bind("SwitchDialog.browse"));
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IResource resource = null;
            if (resources != null && resources.length > 0)
                resource = resources[0];
            ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
            if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                toUrlCombo.setText(dialog.getUrl());
            }
        }
    });
    makeParentsButton = new Button(urlComposite, SWT.CHECK);
    // $NON-NLS-1$
    makeParentsButton.setText(Policy.bind("BranchTagDialog.makeParents"));
    data = new GridData();
    data.horizontalSpan = 2;
    makeParentsButton.setLayoutData(data);
    makeParentsButton.setSelection(// $NON-NLS-1$
    settings.getBoolean("BranchTagDialog.makeParents"));
    makeParentsButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            settings.put("BranchTagDialog.makeParents", // $NON-NLS-1$
            makeParentsButton.getSelection());
        }
    });
    if (multipleSelections() && !sameParents()) {
        sameStructureButton = new Button(urlComposite, SWT.CHECK);
        // $NON-NLS-1$
        sameStructureButton.setText(Policy.bind("BranchTagDialog.sameStructure"));
        data = new GridData();
        data.horizontalSpan = 2;
        sameStructureButton.setLayoutData(data);
        sameStructureButton.setSelection(// $NON-NLS-1$
        settings.getBoolean("BranchTagDialog.sameStructure"));
        sameStructureButton.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                settings.put("BranchTagDialog.sameStructure", // $NON-NLS-1$
                sameStructureButton.getSelection());
                viewer.refresh();
            }
        });
    }
    // Label label = new Label(outerContainer, SWT.NONE);
    // label.setText(Policy.bind("BranchTagDialog.resources"));
    table = new Table(outerContainer, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    // table.setLinesVisible(false);
    table.setHeaderVisible(true);
    data = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    data.heightHint = 75;
    table.setLayoutData(data);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    viewer = new TableViewer(table);
    viewer.setContentProvider(new BranchContentProvider());
    ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
    viewer.setLabelProvider(new TableDecoratingLabelProvider(new BranchLabelProvider(), decorator));
    for (int i = 0; i < columnHeaders.length; i++) {
        tableLayout.addColumnData(columnLayouts[i]);
        TableColumn tc = new TableColumn(table, SWT.NONE, i);
        tc.setResizable(columnLayouts[i].resizable);
        tc.setText(columnHeaders[i]);
    }
    viewer.setInput(this);
    toUrlCombo.getCombo().addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            viewer.refresh();
        }
    });
    toUrlCombo.getCombo().setFocus();
    setPageComplete(canFinish());
    setControl(outerContainer);
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) UrlCombo(org.tigris.subversion.subclipse.ui.util.UrlCombo) ArrayList(java.util.ArrayList) Label(org.eclipse.swt.widgets.Label) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ChooseUrlDialog(org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableLayout(org.eclipse.jface.viewers.TableLayout) ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer) IResource(org.eclipse.core.resources.IResource)

Example 4 with ChooseUrlDialog

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

the class ReplaceWithBranchTagWizardMainPage method createControl.

public void createControl(Composite parent) {
    Composite outerContainer = new Composite(parent, SWT.NONE);
    GridLayout outerLayout = new GridLayout();
    outerLayout.numColumns = 1;
    outerLayout.marginHeight = 0;
    outerLayout.marginWidth = 0;
    outerContainer.setLayout(outerLayout);
    outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    Group urlGroup = new Group(outerContainer, SWT.NONE);
    GridLayout urlLayout = new GridLayout();
    urlLayout.numColumns = 3;
    urlGroup.setLayout(urlLayout);
    urlGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    // $NON-NLS-1$
    urlGroup.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.3"));
    Label urlLabel = new Label(urlGroup, SWT.NONE);
    // $NON-NLS-1$
    urlLabel.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.0"));
    urlCombo = new UrlCombo(urlGroup, SWT.NONE);
    urlCombo.init(resources[0].getProject().getName());
    urlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    commonRoot = getCommonRoot();
    if (commonRoot != null)
        urlCombo.setText(commonRoot);
    urlCombo.getCombo().addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    Button browseButton = new Button(urlGroup, SWT.PUSH);
    // $NON-NLS-1$
    browseButton.setText(Policy.bind("SwitchDialog.browse"));
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resources[0]);
            dialog.setIncludeBranchesAndTags(resources.length == 1);
            if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                urlCombo.setText(dialog.getUrl());
                setPageComplete(canFinish());
            }
        }
    });
    final Composite revisionGroup = new Composite(urlGroup, SWT.NULL);
    GridLayout revisionLayout = new GridLayout();
    revisionLayout.numColumns = 3;
    revisionLayout.marginWidth = 0;
    revisionLayout.marginHeight = 0;
    revisionGroup.setLayout(revisionLayout);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    revisionGroup.setLayoutData(data);
    headButton = new Button(revisionGroup, SWT.CHECK);
    // $NON-NLS-1$
    headButton.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.5"));
    data = new GridData();
    data.horizontalSpan = 3;
    headButton.setLayoutData(data);
    Label revisionLabel = new Label(revisionGroup, SWT.NONE);
    // $NON-NLS-1$
    revisionLabel.setText(Policy.bind("SvnWizardSwitchPage.revision"));
    revisionText = new Text(revisionGroup, SWT.BORDER);
    data = new GridData();
    data.widthHint = REVISION_WIDTH_HINT;
    revisionText.setLayoutData(data);
    if (revisionNumber == 0) {
        headButton.setSelection(true);
        revisionText.setEnabled(false);
    } else {
        // $NON-NLS-1$
        revisionText.setText("" + revisionNumber);
    }
    revisionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setPageComplete(canFinish());
        }
    });
    FocusListener focusListener = new FocusAdapter() {

        public void focusGained(FocusEvent e) {
            ((Text) e.getSource()).selectAll();
        }

        public void focusLost(FocusEvent e) {
            ((Text) e.getSource()).setText(((Text) e.getSource()).getText());
        }
    };
    revisionText.addFocusListener(focusListener);
    logButton = new Button(revisionGroup, SWT.PUSH);
    // $NON-NLS-1$
    logButton.setText(Policy.bind("MergeDialog.showLog"));
    logButton.setEnabled(false);
    logButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            showLog();
        }
    });
    SelectionListener listener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            revisionText.setEnabled(!headButton.getSelection());
            logButton.setEnabled(!headButton.getSelection());
            setPageComplete(canFinish());
            if (!headButton.getSelection()) {
                revisionText.selectAll();
                revisionText.setFocus();
            }
        }
    };
    headButton.addSelectionListener(listener);
    Group typeGroup = new Group(outerContainer, SWT.NONE);
    GridLayout typeLayout = new GridLayout();
    typeLayout.numColumns = 1;
    typeGroup.setLayout(typeLayout);
    typeGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    // $NON-NLS-1$
    typeGroup.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.6"));
    switchButton = new Button(typeGroup, SWT.RADIO);
    // $NON-NLS-1$
    switchButton.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.7"));
    Label switchLabel = new Label(typeGroup, SWT.WRAP);
    // $NON-NLS-1$
    switchLabel.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.8"));
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 500;
    data.horizontalIndent = 15;
    switchLabel.setLayoutData(data);
    replaceButton = new Button(typeGroup, SWT.RADIO);
    // $NON-NLS-1$
    replaceButton.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.9"));
    data = new GridData();
    data.verticalIndent = 15;
    replaceButton.setLayoutData(data);
    Label contentsLabel = new Label(typeGroup, SWT.WRAP);
    // $NON-NLS-1$
    contentsLabel.setText(Policy.bind("ReplaceWithBranchTagWizardMainPage.10"));
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 500;
    data.horizontalIndent = 15;
    contentsLabel.setLayoutData(data);
    if (settings.getBoolean(REPLACE_CONTENTS)) {
        replaceButton.setSelection(true);
    } else {
        switchButton.setSelection(true);
    }
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            settings.put(REPLACE_CONTENTS, replaceButton.getSelection());
            setPageComplete(canFinish());
        }
    };
    replaceButton.addSelectionListener(selectionListener);
    switchButton.addSelectionListener(selectionListener);
    setControl(outerContainer);
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) UrlCombo(org.tigris.subversion.subclipse.ui.util.UrlCombo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) ChooseUrlDialog(org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with ChooseUrlDialog

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

the class MergeWizardAdvancedPage method getSelectionListener.

private SelectionListener getSelectionListener() {
    SelectionListener selectionListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (e.getSource() == selectFromButton) {
                ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
                dialog.setIncludeBranchesAndTags(resources.length == 1);
                if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                    fromCombo.setText(dialog.getUrl());
                    if (useFromButton.getSelection())
                        toCombo.setText(dialog.getUrl());
                }
            } else if (e.getSource() == fromHeadButton || e.getSource() == fromRevisionButton) {
                fromRevisionText.setEnabled(fromRevisionButton.getSelection());
                selectFromRevisionButton.setEnabled(fromRevisionButton.getSelection());
                if (fromRevisionButton.getSelection())
                    fromRevisionText.setFocus();
            } else if (e.getSource() == selectFromRevisionButton) {
                showLog(fromRevisionText);
            } else if (e.getSource() == useFromButton) {
                Activator.getDefault().getDialogSettings().put("mergeUseFromDeselected_" + fromCombo.getText(), !useFromButton.getSelection());
                if (useFromButton.getSelection())
                    toCombo.setText(fromCombo.getText());
                toCombo.setVisible(!useFromButton.getSelection());
                selectToButton.setVisible(!useFromButton.getSelection());
                if (toResourcesLabel != null)
                    toResourcesLabel.setVisible(!useFromButton.getSelection());
                if (toTable != null)
                    toTable.setVisible(!useFromButton.getSelection());
            } else if (e.getSource() == selectToButton) {
                ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
                dialog.setIncludeBranchesAndTags(resources.length == 1);
                if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                    toCombo.setText(dialog.getUrl());
                }
            } else if (e.getSource() == toHeadButton || e.getSource() == toRevisionButton) {
                toRevisionText.setEnabled(toRevisionButton.getSelection());
                selectToRevisionButton.setEnabled(toRevisionButton.getSelection());
                if (toRevisionButton.getSelection())
                    toRevisionText.setFocus();
            } else if (e.getSource() == selectToRevisionButton) {
                showLog(toRevisionText);
            }
            setPageComplete(canFinish());
        }
    };
    return selectionListener;
}
Also used : ChooseUrlDialog(org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 ChooseUrlDialog (org.tigris.subversion.subclipse.ui.dialogs.ChooseUrlDialog)9 GridData (org.eclipse.swt.layout.GridData)8 GridLayout (org.eclipse.swt.layout.GridLayout)8 Button (org.eclipse.swt.widgets.Button)8 Composite (org.eclipse.swt.widgets.Composite)8 ModifyEvent (org.eclipse.swt.events.ModifyEvent)7 ModifyListener (org.eclipse.swt.events.ModifyListener)7 Group (org.eclipse.swt.widgets.Group)7 Label (org.eclipse.swt.widgets.Label)7 FocusEvent (org.eclipse.swt.events.FocusEvent)6 FocusListener (org.eclipse.swt.events.FocusListener)6 SelectionListener (org.eclipse.swt.events.SelectionListener)6 Text (org.eclipse.swt.widgets.Text)6 FocusAdapter (org.eclipse.swt.events.FocusAdapter)5 ILabelDecorator (org.eclipse.jface.viewers.ILabelDecorator)4 TableLayout (org.eclipse.jface.viewers.TableLayout)4 TableViewer (org.eclipse.jface.viewers.TableViewer)4 Table (org.eclipse.swt.widgets.Table)4