Example usage for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH

List of usage examples for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH.

Prototype

int ENTRY_FIELD_WIDTH

To view the source code for org.eclipse.jface.dialogs IDialogConstants ENTRY_FIELD_WIDTH.

Click Source Link

Document

Entry field width in dialog units (value 200).

Usage

From source file:org.eclipse.team.svn.ui.composite.SSLComposite.java

License:Open Source License

public void initialize() {
    GridLayout layout = null;/*w w w.  j ava 2 s  . co m*/
    GridData data = null;

    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 7;
    layout.verticalSpacing = 3;
    data = new GridData(GridData.FILL_BOTH);
    this.setLayout(layout);
    this.setLayoutData(data);

    this.enableAuthenticationCheckBox = new Button(this, SWT.CHECK);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    data.horizontalSpan = 2;
    this.enableAuthenticationCheckBox.setLayoutData(data);
    this.enableAuthenticationCheckBox.setText(SVNUIMessages.SSLComposite_EnableAuthentication);
    this.enableAuthenticationCheckBox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            SSLComposite.this.refreshControlsEnablement();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    this.mscapiSupport = false;
    Provider pjacapi = Security.getProvider("CAPI"); //$NON-NLS-1$
    Provider pmscapi = Security.getProvider("SunMSCAPI"); //$NON-NLS-1$
    // Check that Java supports MSCAPI
    if (pmscapi != null) {
        try {
            ClassLoader.getSystemClassLoader().loadClass("sun.security.mscapi.NONEwithRSASignature");
        } catch (Exception e1) {
            pmscapi = null;
        }
    }
    // ms capi is only suported for windows and for provider SunMSCAPI and JACAPI from keyon
    // further ms capi is only supported from svnkit as client!
    // JAVAHL supports this feature, with version > 1.6.16 and windows 32 platforms 
    String svnClientText = CoreExtensionsManager.instance().getSVNConnectorFactory().getId();
    if (FileUtility.isWindows() && (pjacapi != null || pmscapi != null) && svnClientText.contains("svnkit")) { //$NON-NLS-1$
        this.mscapiSupport = true;
    }
    if (this.mscapiSupport) {
        this.mscapiButton = new Button(this, SWT.CHECK);
        data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
        data.horizontalSpan = 2;
        this.mscapiButton.setLayoutData(data);
        this.mscapiButton.setText("Use MSCAPI");
        SelectionListener mscapiSelectionListener = new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                if (mscapiButton.getSelection()) {
                    certificateFileText.setText("MSCAPI");
                    certificateFileText.setEnabled(false);
                    certificatePassphraseText.setEnabled(false);
                    browseButton.setEnabled(false);
                    aliasButton.setEnabled(true);
                } else {
                    certificateFileText.setEnabled(true);
                    certificatePassphraseText.setEnabled(true);
                    browseButton.setEnabled(true);
                    aliasButton.setEnabled(false);
                    aliasText.setText(""); //$NON-NLS-1$
                    certificateFileText.setText("");
                }
            }
        };
        this.mscapiButton.addSelectionListener(mscapiSelectionListener);
    }
    /*
    Group group1 = new Group(this, SWT.NONE);
    group1.setText("MSCAPI"+FileUtility.isWindows()+" - JACAPI:"+pjacapi + " - MSCAPI:"+ pmscapi + " - SVN Clien:" + svnClientText);
    layout = new GridLayout();
    layout.verticalSpacing = 12;
    group1.setLayout(layout);
    */
    Group group = new Group(this, SWT.NONE);
    group.setText(SVNUIMessages.SSLComposite_ClientCertificate);
    layout = new GridLayout();
    layout.verticalSpacing = 12;
    group.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    group.setLayoutData(data);

    Composite fileAndPassphrase = new Composite(group, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    layout.numColumns = 2;
    fileAndPassphrase.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    fileAndPassphrase.setLayoutData(data);

    Label description = new Label(fileAndPassphrase, SWT.NULL);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    description.setLayoutData(data);
    description.setText(SVNUIMessages.SSLComposite_File);

    Composite inner = new Composite(fileAndPassphrase, SWT.FILL);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = layout.marginWidth = 0;
    inner.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    inner.setLayoutData(data);

    this.certificateFileText = new Text(inner, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.certificateFileText.setLayoutData(data);
    this.validationManager.attachTo(this.certificateFileText, new AbstractVerifierProxy(
            new SSLCertificateResourceVerifier(SVNUIMessages.SSLComposite_File_Verifier, true)) {
        protected boolean isVerificationEnabled(Control input) {
            return SSLComposite.this.enableAuthenticationCheckBox.getSelection();
        }
    });
    this.browseButton = new Button(inner, SWT.PUSH);
    this.browseButton.setText(SVNUIMessages.Button_Browse);
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    data.widthHint = DefaultDialog.computeButtonWidth(this.browseButton);
    this.browseButton.setLayoutData(data);
    this.browseButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            FileDialog fileDialog = new FileDialog(SSLComposite.this.getShell(), SWT.OPEN);
            String res = fileDialog.open();
            if (res != null) {
                SSLComposite.this.certificateFileText.setText(res);
                SSLComposite.this.validationManager.validateContent();
            }
        }
    });

    description = new Label(fileAndPassphrase, SWT.NULL);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    description.setLayoutData(data);
    description.setText(SVNUIMessages.SSLComposite_Passphrase);

    this.certificatePassphraseText = new Text(fileAndPassphrase, SWT.BORDER | SWT.PASSWORD);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.certificatePassphraseText.setLayoutData(data);

    if (this.mscapiSupport) { //$NON-NLS-1$
        description = new Label(fileAndPassphrase, SWT.NULL);
        data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
        description.setLayoutData(data);
        description.setText("Certificate Alias:"); //$NON-NLS-1$

        inner = new Composite(fileAndPassphrase, SWT.FILL);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = layout.marginWidth = 0;
        inner.setLayout(layout);
        data = new GridData(GridData.FILL_HORIZONTAL);
        inner.setLayoutData(data);

        this.aliasText = new Text(inner, SWT.BORDER);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
        this.aliasText.setLayoutData(data);
        aliasText.setEnabled(false);

        this.aliasButton = new Button(inner, SWT.PUSH);
        this.aliasButton.setText("Select alias"); //$NON-NLS-1$
        data = new GridData(GridData.HORIZONTAL_ALIGN_END);
        data.widthHint = DefaultDialog.computeButtonWidth(this.aliasButton);
        this.aliasButton.setLayoutData(data);
        SelectionListener msCapiCertificateSelectionListener = new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                SSLClientCertificatesMSCapi dialog = new SSLClientCertificatesMSCapi(
                        Display.getCurrent().getActiveShell(), "Certifacte selection");
                if (dialog.open() == SSLClientCertificatesMSCapi.OK) {
                    aliasText.setText(dialog.getAlias());
                    certificateFileText.setText("MSCAPI;" + dialog.getAlias());
                }
            }
        };
        this.aliasButton.addSelectionListener(msCapiCertificateSelectionListener);
        this.aliasButton.setEnabled(false);
    }

    inner = new Composite(group, SWT.FILL);
    layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    inner.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    inner.setLayoutData(data);

    this.savePassphraseCheckBox = new Button(inner, SWT.CHECK);
    this.savePassphraseCheckBox.setText(SVNUIMessages.SSLComposite_SavePassphrase);

    new SecurityWarningComposite(inner);
}

From source file:org.eclipse.team.svn.ui.panel.view.property.ExternalsEditPanel.java

License:Open Source License

protected void createRepositoryResourceSelectionControls(Composite parent) {
    Label urlLabel = new Label(parent, SWT.NONE);
    urlLabel.setLayoutData(new GridData());
    urlLabel.setText(SVNUIMessages.getString(this.comboId));

    this.urlText = new Combo(parent, SWT.NULL);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.urlText.setLayoutData(data);
    this.urlText.setVisibleItemCount(this.urlHistory.getDepth());
    this.urlText.setItems(this.urlHistory.getHistory());

    Listener urlTextListener = new Listener() {
        public void handleEvent(Event event) {
            ExternalsEditPanel.this.onChangeUrlText();
        }/*from   w  ww .j ava2s  .c o m*/
    };
    this.urlText.addListener(SWT.Selection, urlTextListener);
    this.urlText.addListener(SWT.Modify, urlTextListener);

    this.browse = new Button(parent, SWT.PUSH);
    this.browse.setText(SVNUIMessages.Button_Browse);
    data = new GridData();
    data.widthHint = DefaultDialog.computeButtonWidth(this.browse);
    this.browse.setLayoutData(data);
    this.browse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ExternalsEditPanel.this.onRepositoryResourceSelection();
        }
    });

    //format url      
    Label label = new Label(parent, SWT.NONE);
    label.setLayoutData(new GridData());
    label.setText(SVNUIMessages.ExternalsEditPanel_FormatUrl);

    this.relativeText = new Combo(parent, SWT.READ_ONLY);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.relativeText.setLayoutData(data);

    this.relativeText.add(SVNUIMessages.ExternalsEditPanel_RelativeToRepositoryRoot,
            ExternalsEditPanel.REPOSITORY_ROOT_INDEX);
    this.relativeText.add(SVNUIMessages.ExternalsEditPanel_RelativeToUrlScheme,
            ExternalsEditPanel.URL_SCHEME_INDEX);
    this.relativeText.add(SVNUIMessages.ExternalsEditPanel_RelativeToHostName,
            ExternalsEditPanel.HOST_NAME_INDEX);
    this.relativeText.add(SVNUIMessages.ExternalsEditPanel_RelativeToDirectory,
            ExternalsEditPanel.EXTERNAL_DIRECTORY_INDEX);
    this.relativeText.setVisibleItemCount(4);
    this.relativeText.select(0);

    this.formatButton = new Button(parent, SWT.PUSH);
    this.formatButton.setText(SVNUIMessages.ExternalsEditPanel_FormatButton);
    data = new GridData();
    data.widthHint = DefaultDialog.computeButtonWidth(this.formatButton);
    this.formatButton.setLayoutData(data);

    this.formatButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ExternalsEditPanel.this.formatUrl();
        }
    });

    CompositeVerifier urlVerifier = new CompositeVerifier() {
        @Override
        protected void fireError(String errorReason) {
            super.fireError(errorReason);
            ExternalsEditPanel.this.onUrlValidity(false);
        }

        @Override
        protected void fireOk() {
            super.fireOk();
            ExternalsEditPanel.this.onUrlValidity(true);
        }
    };
    urlVerifier.add(new NonEmptyFieldVerifier(SVNUIMessages.getString(this.comboId + "_Verifier"))); //$NON-NLS-1$
    urlVerifier.add(new URLVerifier(SVNUIMessages.getString(this.comboId + "_Verifier")) { //$NON-NLS-1$
        protected String getText(Control input) {
            return processedUrl != null ? processedUrl : url;
        }
    });
    this.attachTo(this.urlText, urlVerifier);

    CompositeVerifier localPathVerifier = new CompositeVerifier();
    localPathVerifier.add(new NonEmptyFieldVerifier(SVNUIMessages.ExternalsEditPanel_LocalPathLabel_Verifier));
    //don't allow spaces  if SVN < 1.6
    localPathVerifier
            .add(new AbstractFormattedVerifier(SVNUIMessages.ExternalsEditPanel_LocalPathLabel_Verifier) {
                @Override
                protected String getErrorMessageImpl(Control input) {
                    String text = this.getText(input);
                    text = text.trim();
                    if (text.contains(" ") && ExternalsEditPanel.this.isLessSVN16()) { //$NON-NLS-1$
                        return SVNUIMessages.format(SVNUIMessages.Verifier_NoSpaces,
                                new String[] { AbstractFormattedVerifier.FIELD_NAME });
                    }
                    return null;
                }

                @Override
                protected String getWarningMessageImpl(Control input) {
                    return null;
                }
            });
    //TODO check that resource doesn't exist on file system ?
    this.attachTo(this.localPathText, localPathVerifier);
}

From source file:org.eclipse.team.svn.ui.preferences.SVNTeamDecorationPreferencesPage.java

License:Open Source License

protected Composite createGeneralSettingsPage(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite noteComposite = new Composite(composite, SWT.FILL);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;/*w ww  . ja v  a 2  s  .  c o  m*/
    noteComposite.setLayout(layout);
    noteComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label noteLabel = new Label(noteComposite, SWT.WRAP);
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    data.heightHint = this.convertHeightInCharsToPixels(4);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    noteLabel.setLayoutData(data);
    noteLabel.setText(SVNUIMessages.PreferencePage_noteLabel);

    Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    new PreferenceLinkArea(composite, SWT.NONE, SVNUIMessages.PreferencePage_generalUseLabels_1,
            SVNUIMessages.PreferencePage_generalUseLabels_2,
            (IWorkbenchPreferenceContainer) this.getContainer(), null);

    this.useFontsButton = new Button(composite, SWT.CHECK);
    this.useFontsButton.setLayoutData(new GridData());
    this.useFontsButton.setText(SVNUIMessages.PreferencePage_generalUseFonts_2);
    new PreferenceLinkArea(composite, SWT.NONE, SVNUIMessages.PreferencePage_generalUseFonts_1,
            SVNUIMessages.PreferencePage_generalUseFonts_3, (IWorkbenchPreferenceContainer) this.getContainer(),
            null);
    this.useFontsButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            SVNTeamDecorationPreferencesPage.this.useFontsDecor = SVNTeamDecorationPreferencesPage.this.useFontsButton
                    .getSelection();
        }
    });

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.checkoutas.CheckoutMethodSelectionPage.java

License:Open Source License

protected Composite createControlImpl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    this.initializeDialogUnits(composite);

    // GridLayout
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);/*from www .  j  a v  a2s .c o m*/

    // GridData
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);

    this.setControl(composite);

    Label description = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = this.convertHeightInCharsToPixels(
            this.checkoutType == CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD ? 1 : 2);
    description.setLayoutData(data);
    String message = SVNUIMessages.format(SVNUIMessages.CheckoutMethodSelectionPage_HintHead,
            new String[] { this.defaultName });
    description.setText(message + (this.checkoutType != CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD
            ? " " + SVNUIMessages.CheckoutMethodSelectionPage_HintTail //$NON-NLS-1$
            : "")); //$NON-NLS-1$
    this.projectName = this.defaultName = FileUtility.formatResourceName(this.defaultName);

    Button useNewProjectWizardButton = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    useNewProjectWizardButton.setLayoutData(data);
    useNewProjectWizardButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            CheckoutMethodSelectionPage.this
                    .selectionChanged(CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD);
        }
    });
    useNewProjectWizardButton.setText(SVNUIMessages.CheckoutMethodSelectionPage_NewWizard);
    useNewProjectWizardButton
            .setSelection(this.checkoutType == CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD);
    useNewProjectWizardButton
            .setEnabled(this.checkoutType == CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD);

    Button findProjectsButton = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    findProjectsButton.setLayoutData(data);
    findProjectsButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            CheckoutMethodSelectionPage.this.selectionChanged(CheckoutMethodSelectionPage.FIND_PROJECTS);
        }
    });
    findProjectsButton.setText(SVNUIMessages.CheckoutMethodSelectionPage_Find);
    findProjectsButton.setEnabled(this.checkoutType == CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD
            || ExtensionsManager.getInstance().getCurrentCheckoutFactory().findProjectsOptionEnabled());

    Button checkoutAsFolder = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    checkoutAsFolder.setLayoutData(data);
    checkoutAsFolder.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            CheckoutMethodSelectionPage.this.selectionChanged(CheckoutMethodSelectionPage.CHECKOUT_AS_FOLDER);
        }
    });
    checkoutAsFolder.setText(SVNUIMessages.CheckoutMethodSelectionPage_Folder);

    this.selectLocationButton = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    this.selectLocationButton.setLayoutData(data);
    this.selectLocationButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            CheckoutMethodSelectionPage.this.selectionChanged(CheckoutMethodSelectionPage.CHECKOUT_AS_PROJECT);
        }
    });
    this.selectLocationButton.setText(SVNUIMessages.CheckoutMethodSelectionPage_Project);
    this.selectLocationButton
            .setSelection(this.checkoutType != CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD);

    this.nameField = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    this.nameField.setLayoutData(data);
    this.nameField.setText(this.defaultName);
    this.nameField.setEnabled(this.checkoutType != CheckoutMethodSelectionPage.USE_NEW_PROJECT_WIZARD);
    this.nameField.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String name = CheckoutMethodSelectionPage.this.nameField.getText().trim();
            CheckoutMethodSelectionPage.this.projectName = name;
        }
    });
    String name = SVNUIMessages.CheckoutMethodSelectionPage_ProjectName_Verifier;
    CompositeVerifier verifier = new CompositeVerifier();
    verifier.add(new ResourceNameVerifier(name, false));
    verifier.add(new NonEmptyFieldVerifier(name));
    this.attachTo(this.nameField, new AbstractVerifierProxy(verifier) {
        protected boolean isVerificationEnabled(Control input) {
            return CheckoutMethodSelectionPage.this.selectLocationButton.getSelection();
        }
    });

    Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.verticalIndent = 5;
    separator.setLayoutData(data);

    data = new GridData(GridData.FILL_HORIZONTAL);
    this.depthSelector = new DepthSelectionComposite(composite, SWT.NONE, false);
    this.depthSelector.setLayoutData(data);

    this.revisionComposite = new RevisionComposite(composite, this, false, new String[] {
            SVNUIMessages.RevisionComposite_Revision, SVNUIMessages.RevisionComposite_HeadRevision },
            SVNRevision.HEAD, false);
    data = new GridData(GridData.FILL_HORIZONTAL);
    this.revisionComposite.setLayoutData(data);
    this.revisionComposite.setSelectedResource(this.resource);

    //      Setting context help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            "org.eclipse.team.svn.help.checkoutMethodSelectionContext"); //$NON-NLS-1$

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.checkoutas.ProjectsSelectionPage.java

License:Open Source License

public Composite createControlImpl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 12;//  w ww  .  ja  va 2s .  co m
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);

    Composite coTypeComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    coTypeComposite.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    coTypeComposite.setLayoutData(data);

    this.checkoutAsFolderButton = new Button(coTypeComposite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    this.checkoutAsFolderButton.setLayoutData(data);
    this.checkoutAsFolderButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProjectsSelectionPage.this.checkoutAsFolders = true;
            ProjectsSelectionPage.this.respectHierarchyButton.setEnabled(false);
            ProjectsSelectionPage.this.validateContent();
        }
    });
    this.checkoutAsFolderButton.setSelection(false);

    this.checkoutAsProjectButton = new Button(coTypeComposite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    this.checkoutAsProjectButton.setLayoutData(data);
    this.checkoutAsProjectButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProjectsSelectionPage.this.checkoutAsFolders = false;
            ProjectsSelectionPage.this.respectHierarchyButton.setEnabled(true);
            ProjectsSelectionPage.this.validateContent();
        }
    });
    this.checkoutAsProjectButton.setSelection(true);

    this.listViewer = this.createViewer(composite);
    data = new GridData(GridData.FILL_BOTH);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.listViewer.getTable().setLayoutData(data);

    this.listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            ProjectsSelectionPage.this.refreshSelectedResult();
            ProjectsSelectionPage.this.validateContent();
        }
    });
    layout = null;

    this.attachTo(this.listViewer.getTable(), new AbstractVerifier() {
        protected String getWarningMessage(Control input) {
            return null;
        }

        protected String getErrorMessage(Control input) {
            Object[] elements = ProjectsSelectionPage.this.listViewer.getCheckedElements();
            return elements == null || elements.length == 0
                    ? SVNUIMessages.ProjectsSelectionPage_CheckoutAsProject_Verifier_Error
                    : null;
        }
    });

    Composite bottomPart = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    bottomPart.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    bottomPart.setLayoutData(data);

    Composite tComposite = new Composite(bottomPart, SWT.LEFT);
    GridLayout gLayout = new GridLayout();
    gLayout.numColumns = 2;
    gLayout.marginWidth = gLayout.marginHeight = 0;
    tComposite.setLayout(gLayout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.FILL_BOTH);
    data.grabExcessHorizontalSpace = true;
    tComposite.setData(data);

    Button selectButton = new Button(tComposite, SWT.PUSH);
    selectButton.setText(SVNUIMessages.Button_SelectAll);
    data = new GridData();
    data.widthHint = DefaultDialog.computeButtonWidth(selectButton);
    selectButton.setLayoutData(data);
    selectButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProjectsSelectionPage.this.listViewer.setAllChecked(true);
            ProjectsSelectionPage.this.refreshSelectedResult();
            ProjectsSelectionPage.this.validateContent();
        }
    });

    Button deselectButton = new Button(tComposite, SWT.PUSH);
    deselectButton.setText(SVNUIMessages.Button_ClearSelection);
    data = new GridData();
    data.widthHint = DefaultDialog.computeButtonWidth(deselectButton);
    deselectButton.setLayoutData(data);
    deselectButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProjectsSelectionPage.this.listViewer.setAllChecked(false);
            ProjectsSelectionPage.this.refreshSelectedResult();
            ProjectsSelectionPage.this.validateContent();
        }
    });

    this.respectHierarchyButton = new Button(bottomPart, SWT.CHECK);
    this.respectHierarchyButton.setText(SVNUIMessages.ProjectsSelectionPage_RespectHierarchy);
    this.respectHierarchyButton
            .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL));
    this.respectHierarchyButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ProjectsSelectionPage.this.respectHierarchy = ((Button) e.widget).getSelection();
            if (ProjectsSelectionPage.this.locationPage != null) {
                ProjectsSelectionPage.this.locationPage
                        .setUseDefaultLocation(!ProjectsSelectionPage.this.respectHierarchy);
                ProjectsSelectionPage.this.locationPage.validateContent();
            }
            ProjectsSelectionPage.this.validateContent();
        }
    });

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.selectresource.SelectSimpleRepositoryLocationPage.java

License:Open Source License

protected Composite createControlImpl(Composite parent) {
    GridLayout layout = null;/*from  w  w  w . jav a2  s.c  om*/
    GridData data = null;
    this.initializeDialogUnits(parent);

    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    composite.setLayout(layout);
    data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);

    Label description = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = this.convertHeightInCharsToPixels(2);
    description.setLayoutData(data);
    description.setText(SVNUIMessages.SelectSimpleRepositoryLocationPage_Details);

    this.repositoriesView = SelectRepositoryLocationPage.createRepositoriesListTable(composite,
            this.repositories);

    this.repositoriesView.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IWizard wizard = SelectSimpleRepositoryLocationPage.this.getWizard();
            IWizardPage nextPage = wizard.getNextPage(SelectSimpleRepositoryLocationPage.this);
            if (nextPage != null) {
                wizard.getContainer().showPage(nextPage);
            }
        }
    });

    this.repositoriesView.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) SelectSimpleRepositoryLocationPage.this.repositoriesView
                    .getSelection();
            SelectSimpleRepositoryLocationPage.this.location = (IRepositoryLocation) selection
                    .getFirstElement();
            SelectSimpleRepositoryLocationPage.this.setPageComplete(true);
        }
    });

    IStructuredSelection selection = (IStructuredSelection) this.repositoriesView.getSelection();
    this.location = (IRepositoryLocation) selection.getFirstElement();

    //Setting context help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            "org.eclipse.team.svn.help.selectRepositoryLocationContext"); //$NON-NLS-1$

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.shareproject.AlreadyConnectedPage.java

License:Open Source License

public Composite createControlImpl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);//from   w w  w .ja  v a2s  .c om
    GridData data = new GridData();
    data.verticalAlignment = GridData.FILL;
    data.horizontalAlignment = GridData.FILL;
    composite.setLayoutData(data);

    this.initializeDialogUnits(parent);

    Label description = new Label(composite, SWT.WRAP);
    description.setLayoutData(this.makeGridData());
    description.setText(SVNUIMessages.AlreadyConnectedPage_ProjectURL);

    this.urlText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    this.urlText.setLayoutData(data);
    this.urlText.setEditable(false);

    description = new Label(composite, SWT.WRAP);
    description.setLayoutData(this.makeGridData());
    description.setText(SVNUIMessages.AlreadyConnectedPage_RepositoryLocation);

    Table table = new Table(composite,
            SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tLayout = new TableLayout();
    tLayout.addColumnData(new ColumnWeightData(30, true));
    tLayout.addColumnData(new ColumnWeightData(70, true));
    table.setLayout(tLayout);

    this.repositoryRootsView = new TableViewer(table);
    this.repositoryRootsView.setContentProvider(new ArrayStructuredContentProvider());
    final ITableLabelProvider labelProvider = new ITableLabelProvider() {
        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }

        public String getColumnText(Object element, int columnIndex) {
            IRepositoryRoot root = (IRepositoryRoot) element;
            if (columnIndex == 0) {
                return root.getRepositoryLocation().getLabel();
            }
            return root.getRepositoryLocation().getUrl();
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void dispose() {
        }

        public boolean isLabelProperty(Object element, String property) {
            return true;
        }

        public void removeListener(ILabelProviderListener listener) {
        }
    };
    this.repositoryRootsView.setLabelProvider(labelProvider);

    ColumnedViewerComparator comparator = new ColumnedViewerComparator(this.repositoryRootsView) {
        public int compareImpl(Viewer viewer, Object row1, Object row2) {
            String val1 = labelProvider.getColumnText(row1, this.column);
            String val2 = labelProvider.getColumnText(row2, this.column);
            return ColumnedViewerComparator.compare(val1, val2);
        }
    };
    this.repositoryRootsView.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) AlreadyConnectedPage.this.repositoryRootsView
                    .getSelection();
            AlreadyConnectedPage.this.selectedRoot = (IRepositoryRoot) selection.getFirstElement();
            AlreadyConnectedPage.this.setPageComplete(true);
        }
    });

    TableColumn col = new TableColumn(table, SWT.LEFT);
    col.setResizable(true);
    col.setText(SVNUIMessages.AlreadyConnectedPage_LocationLabel);
    col.addSelectionListener(comparator);

    col = new TableColumn(table, SWT.LEFT);
    col.setResizable(true);
    col.setText(SVNUIMessages.AlreadyConnectedPage_URL);
    col.addSelectionListener(comparator);

    this.repositoryRootsView.getTable().setSortDirection(SWT.UP);
    this.repositoryRootsView.getTable().setSortColumn(this.repositoryRootsView.getTable().getColumn(0));

    Composite btnComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    btnComposite.setLayout(layout);
    data = new GridData();
    data.verticalAlignment = GridData.FILL;
    data.horizontalAlignment = GridData.FILL;
    btnComposite.setLayoutData(data);

    description = new Label(btnComposite, SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = this.convertHeightInCharsToPixels(2);
    description.setLayoutData(data);
    description.setText(SVNUIMessages.AlreadyConnectedPage_Hint);

    this.useProjectSettingsButton = new Button(btnComposite, SWT.RADIO);
    this.useProjectSettingsButton.setLayoutData(this.makeGridData());
    this.useProjectSettingsButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.widget;
            boolean selectEnabled = AlreadyConnectedPage.this.useProjectSettings = button.getSelection();
            AlreadyConnectedPage.this.repositoryRootsView.getTable().setEnabled(selectEnabled);
            AlreadyConnectedPage.this.setPageComplete(true);
        }
    });
    this.useProjectSettingsButton.setText(SVNUIMessages.AlreadyConnectedPage_UseProjectSettings);

    this.createProjectLocationButton = new Button(btnComposite, SWT.RADIO);
    this.createProjectLocationButton.setLayoutData(this.makeGridData());
    this.createProjectLocationButton.setText(SVNUIMessages.AlreadyConnectedPage_CreateLocation);
    this.createProjectLocationButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.widget;
            AlreadyConnectedPage.this.createUsingProjectSettings = button.getSelection();
            AlreadyConnectedPage.this.repositoryRootsView.getTable().setEnabled(false);
            AlreadyConnectedPage.this.setPageComplete(true);
        }
    });

    this.reconnectButton = new Button(btnComposite, SWT.RADIO);
    this.reconnectButton.setLayoutData(this.makeGridData());
    this.reconnectButton.setText(SVNUIMessages.AlreadyConnectedPage_ReconnectToAnother);

    this.initControls();

    //      Setting context help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            "org.eclipse.team.svn.help.alreadyConnectedContext"); //$NON-NLS-1$

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.shareproject.AlreadyConnectedPage.java

License:Open Source License

protected GridData makeGridData() {
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    return data;/* w  w  w  .j  a va2  s .c  om*/
}

From source file:org.eclipse.team.svn.ui.wizard.shareproject.SelectRepositoryLocationPage.java

License:Open Source License

protected Composite createControlImpl(Composite parent) {
    GridLayout layout = null;/*from w w w  .  j  a v  a 2s.  c  o  m*/
    GridData data = null;
    this.initializeDialogUnits(parent);

    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    composite.setLayout(layout);
    data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);

    Label description = new Label(composite, SWT.WRAP);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = this.convertHeightInCharsToPixels(2);
    description.setLayoutData(data);
    description.setText(SVNUIMessages.getString("SelectRepositoryLocationPage_Hint" //$NON-NLS-1$
            + SelectRepositoryLocationPage.getNationalizationSuffix(this.importProject)));

    Button addLocationButton = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    addLocationButton.setText(SVNUIMessages.SelectRepositoryLocationPage_AddLocation);
    addLocationButton.setSelection(false);

    Button useExistingLocationButton = new Button(composite, SWT.RADIO);
    data = new GridData(GridData.FILL_HORIZONTAL);
    useExistingLocationButton.setLayoutData(data);
    useExistingLocationButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.widget;
            SelectRepositoryLocationPage.this.repositoriesView.getTable()
                    .setEnabled(SelectRepositoryLocationPage.this.useExistingLocation = button.getSelection());
            SelectRepositoryLocationPage.this.setPageComplete(true);
        }
    });
    useExistingLocationButton.setText(SVNUIMessages.SelectRepositoryLocationPage_UseLocation);
    useExistingLocationButton.setSelection(true);

    this.repositoriesView = SelectRepositoryLocationPage.createRepositoriesListTable(composite,
            this.repositories);

    this.repositoriesView.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IWizard wizard = SelectRepositoryLocationPage.this.getWizard();
            IWizardPage nextPage = wizard.getNextPage(SelectRepositoryLocationPage.this);
            if (nextPage != null) {
                wizard.getContainer().showPage(nextPage);
            }
        }
    });

    this.repositoriesView.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) SelectRepositoryLocationPage.this.repositoriesView
                    .getSelection();
            SelectRepositoryLocationPage.this.location = (IRepositoryLocation) selection.getFirstElement();
            SelectRepositoryLocationPage.this.setPageComplete(true);
        }
    });

    IStructuredSelection selection = (IStructuredSelection) this.repositoriesView.getSelection();
    this.location = (IRepositoryLocation) selection.getFirstElement();

    //Setting context help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            "org.eclipse.team.svn.help.reposLocationContext"); //$NON-NLS-1$

    return composite;
}

From source file:org.eclipse.team.svn.ui.wizard.shareproject.ShareProjectNameAdvancedModeComposite.java

License:Open Source License

protected GridData makeGridData() {
    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.horizontalSpan = 1;/*from  w w w  .  ja  v  a 2  s . co  m*/
    return data;
}