Search in sources :

Example 1 with UrlCombo

use of org.tigris.subversion.subclipse.ui.util.UrlCombo 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 UrlCombo

use of org.tigris.subversion.subclipse.ui.util.UrlCombo 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 UrlCombo

use of org.tigris.subversion.subclipse.ui.util.UrlCombo 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 UrlCombo

use of org.tigris.subversion.subclipse.ui.util.UrlCombo 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 UrlCombo

use of org.tigris.subversion.subclipse.ui.util.UrlCombo in project subclipse by subclipse.

the class MergeDialog method createDialogArea.

/*
   * @see Dialog#createDialogArea(Composite)
   */
protected Control createDialogArea(Composite parent) {
    // $NON-NLS-1$
    getShell().setText(Policy.bind("MergeDialog.title"));
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    Label label = new Label(composite, SWT.NONE);
    // $NON-NLS-1$
    label.setText(Policy.bind("MergeDialog.text"));
    svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
    String urlString = null;
    try {
        urlString = svnResource.getStatus().getUrlString();
    } catch (SVNException e1) {
    }
    Group fromGroup = new Group(composite, SWT.NULL);
    // $NON-NLS-1$
    fromGroup.setText(Policy.bind("MergeDialog.from"));
    GridLayout fromLayout = new GridLayout();
    fromLayout.numColumns = 2;
    fromGroup.setLayout(fromLayout);
    data = new GridData(GridData.FILL_BOTH);
    fromGroup.setLayoutData(data);
    fromUrlCombo = new UrlCombo(fromGroup, SWT.NONE);
    fromUrlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    fromUrlCombo.init(resource.getProject().getName());
    if (urlString != null) {
        fromUrlCombo.setText(urlString);
    }
    fromBrowseButton = new Button(fromGroup, SWT.PUSH);
    // $NON-NLS-1$
    fromBrowseButton.setText(Policy.bind("SwitchDialog.browse"));
    Composite fromRevisionComposite = new Composite(fromGroup, SWT.NULL);
    GridLayout fromRevisionLayout = new GridLayout();
    fromRevisionLayout.numColumns = 3;
    fromRevisionComposite.setLayout(fromRevisionLayout);
    data = new GridData(GridData.FILL_BOTH);
    fromRevisionComposite.setLayoutData(data);
    fromHeadButton = new Button(fromRevisionComposite, SWT.CHECK);
    // $NON-NLS-1$
    fromHeadButton.setText(Policy.bind("MergeDialog.fromHead"));
    data = new GridData();
    data.horizontalSpan = 3;
    fromHeadButton.setLayoutData(data);
    Label fromRevisionLabel = new Label(fromRevisionComposite, SWT.NONE);
    // $NON-NLS-1$
    fromRevisionLabel.setText(Policy.bind("MergeDialog.revision"));
    fromRevisionText = new Text(fromRevisionComposite, SWT.BORDER);
    data = new GridData();
    data.widthHint = REVISION_WIDTH_HINT;
    fromRevisionText.setLayoutData(data);
    Button fromLogButton = new Button(fromRevisionComposite, SWT.PUSH);
    // $NON-NLS-1$
    fromLogButton.setText(Policy.bind("MergeDialog.showLog"));
    fromLogButton.addSelectionListener(new SelectionAdapter() {

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

        public void widgetSelected(SelectionEvent e) {
            fromRevisionText.setEnabled(!fromHeadButton.getSelection());
            setOkButtonStatus();
            if (!fromHeadButton.getSelection()) {
                fromRevisionText.selectAll();
                fromRevisionText.setFocus();
            }
        }
    };
    fromHeadButton.addSelectionListener(fromListener);
    Group toGroup = new Group(composite, SWT.NULL);
    // $NON-NLS-1$
    toGroup.setText(Policy.bind("MergeDialog.to"));
    GridLayout toLayout = new GridLayout();
    toLayout.numColumns = 2;
    toGroup.setLayout(toLayout);
    data = new GridData(GridData.FILL_BOTH);
    toGroup.setLayoutData(data);
    Composite useFromComposite = new Composite(toGroup, SWT.NULL);
    GridLayout useFromLayout = new GridLayout();
    useFromComposite.setLayout(useFromLayout);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    useFromComposite.setLayoutData(data);
    useFromUrlButton = new Button(useFromComposite, SWT.CHECK);
    useFromUrlButton.setSelection(true);
    // $NON-NLS-1$
    useFromUrlButton.setText(Policy.bind("MergeDialog.useFrom"));
    toUrlCombo = new UrlCombo(toGroup, SWT.NONE);
    toUrlCombo.init(resource.getProject().getName());
    toUrlCombo.setText(fromUrlCombo.getText());
    toUrlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    toUrlCombo.getCombo().setVisible(false);
    toBrowseButton = new Button(toGroup, SWT.PUSH);
    // $NON-NLS-1$
    toBrowseButton.setText(Policy.bind("MergeDialog.browseTo"));
    toBrowseButton.setVisible(false);
    Composite toRevisionComposite = new Composite(toGroup, SWT.NULL);
    GridLayout toRevisionLayout = new GridLayout();
    toRevisionLayout.numColumns = 3;
    toRevisionComposite.setLayout(toRevisionLayout);
    data = new GridData(GridData.FILL_BOTH);
    toRevisionComposite.setLayoutData(data);
    toHeadButton = new Button(toRevisionComposite, SWT.CHECK);
    // $NON-NLS-1$
    toHeadButton.setText(Policy.bind("MergeDialog.toHead"));
    data = new GridData();
    data.horizontalSpan = 3;
    toHeadButton.setLayoutData(data);
    Label toRevisionLabel = new Label(toRevisionComposite, SWT.NONE);
    // $NON-NLS-1$
    toRevisionLabel.setText(Policy.bind("MergeDialog.toRevision"));
    toRevisionText = new Text(toRevisionComposite, SWT.BORDER);
    data = new GridData();
    data.widthHint = REVISION_WIDTH_HINT;
    toRevisionText.setLayoutData(data);
    Button toLogButton = new Button(toRevisionComposite, SWT.PUSH);
    // $NON-NLS-1$
    toLogButton.setText(Policy.bind("MergeDialog.showToLog"));
    toLogButton.addSelectionListener(new SelectionAdapter() {

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

        public void widgetSelected(SelectionEvent e) {
            toRevisionText.setEnabled(!toHeadButton.getSelection());
            setOkButtonStatus();
            if (!toHeadButton.getSelection()) {
                toRevisionText.selectAll();
                toRevisionText.setFocus();
            }
        }
    };
    toHeadButton.addSelectionListener(toListener);
    SelectionListener browseListener = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ChooseUrlDialog dialog = new ChooseUrlDialog(getShell(), resource);
            if ((dialog.open() == ChooseUrlDialog.OK) && (dialog.getUrl() != null)) {
                if (e.getSource() == fromBrowseButton) {
                    fromUrlCombo.setText(dialog.getUrl());
                    if (useFromUrlButton.getSelection())
                        toUrlCombo.setText(dialog.getUrl());
                } else
                    toUrlCombo.setText(dialog.getUrl());
                setOkButtonStatus();
            }
        }
    };
    fromBrowseButton.addSelectionListener(browseListener);
    toBrowseButton.addSelectionListener(browseListener);
    useFromUrlButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (useFromUrlButton.getSelection())
                toUrlCombo.setText(fromUrlCombo.getText());
            toBrowseButton.setVisible(!useFromUrlButton.getSelection());
            toUrlCombo.getCombo().setVisible(!useFromUrlButton.getSelection());
            setOkButtonStatus();
        }
    });
    fromUrlCombo.getCombo().addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (useFromUrlButton.getSelection())
                toUrlCombo.setText(fromUrlCombo.getText());
        }
    });
    fromUrlCombo.getCombo().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (useFromUrlButton.getSelection())
                toUrlCombo.setText(fromUrlCombo.getText());
        }
    });
    ModifyListener modifyListener = new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            setOkButtonStatus();
        }
    };
    fromUrlCombo.getCombo().addModifyListener(modifyListener);
    fromRevisionText.addModifyListener(modifyListener);
    toUrlCombo.getCombo().addModifyListener(modifyListener);
    toRevisionText.addModifyListener(modifyListener);
    Composite ignoreComposite = new Composite(composite, SWT.NULL);
    GridLayout ignoreLayout = new GridLayout();
    ignoreLayout.numColumns = 2;
    ignoreComposite.setLayout(ignoreLayout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    ignoreComposite.setLayoutData(data);
    ignoreAncestryButton = new Button(ignoreComposite, SWT.CHECK);
    // $NON-NLS-1$
    ignoreAncestryButton.setText(Policy.bind("MergeDialog.ignoreAncestry"));
    forceButton = new Button(ignoreComposite, SWT.CHECK);
    // $NON-NLS-1$
    forceButton.setText(Policy.bind("MergeDialog.force"));
    Group workingGroup = new Group(composite, SWT.NULL);
    GridLayout workingLayout = new GridLayout();
    workingLayout.numColumns = 2;
    workingGroup.setLayout(workingLayout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    workingGroup.setLayoutData(data);
    Composite workingComposite = new Composite(workingGroup, SWT.NULL);
    workingComposite.setLayout(new GridLayout());
    data = new GridData(GridData.FILL_HORIZONTAL);
    workingComposite.setLayoutData(data);
    Label workingLabel = new Label(workingComposite, SWT.NONE);
    // $NON-NLS-1$
    workingLabel.setText(Policy.bind("MergeDialog.workingCopy"));
    Text workingText = new Text(workingComposite, SWT.BORDER | SWT.READ_ONLY);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    workingText.setLayoutData(data);
    // workingText.setText(resource.getWorkspace().getRoot().getLocation().toString());
    workingText.setText(resource.getLocation().toString());
    Label repositoryLabel = new Label(workingComposite, SWT.NONE);
    // $NON-NLS-1$
    repositoryLabel.setText(Policy.bind("MergeDialog.repositoryUrl"));
    Text repositoryText = new Text(workingComposite, SWT.BORDER | SWT.READ_ONLY);
    data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    repositoryText.setLayoutData(data);
    if (urlString != null)
        repositoryText.setText(urlString);
    Button workingLogButton = new Button(workingGroup, SWT.PUSH);
    // $NON-NLS-1$
    workingLogButton.setText(Policy.bind("MergeDialog.showWorkingLog"));
    workingLogButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            showLog(null);
        }
    });
    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());
        }
    };
    fromRevisionText.addFocusListener(focusListener);
    toRevisionText.addFocusListener(focusListener);
    fromUrlCombo.getCombo().setFocus();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.MERGE_DIALOG);
    return composite;
}
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) SVNException(org.tigris.subversion.subclipse.core.SVNException) FocusEvent(org.eclipse.swt.events.FocusEvent) 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)

Aggregations

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