org.eclipse.swt.widgets.Combo

Here are the examples of the java api class org.eclipse.swt.widgets.Combo taken from open source projects.

1. DB2ReorgTableDialog#createTempTablespaceCombo()

Project: dbeaver
File: DB2ReorgTableDialog.java
private Combo createTempTablespaceCombo(Composite parent) {
    final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (String tablespaceName : listTempTsNames) {
        combo.add(tablespaceName);
    }
    combo.select(0);
    combo.setEnabled(false);
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            tempTablespace = listTempTsNames.get(combo.getSelectionIndex());
            updateSQL();
        }
    });
    return combo;
}

2. DB2ReorgTableDialog#createIndexesCombo()

Project: dbeaver
File: DB2ReorgTableDialog.java
private Combo createIndexesCombo(Composite parent) {
    final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (String indexName : listIndexNames) {
        combo.add(indexName);
    }
    combo.select(0);
    combo.setEnabled(false);
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            indexName = listIndexNames.get(combo.getSelectionIndex());
            updateSQL();
        }
    });
    return combo;
}

3. EditConstraintDialog#createContentsBeforeColumns()

Project: dbeaver
File: EditConstraintDialog.java
@Override
protected void createContentsBeforeColumns(Composite panel) {
    UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_constrain_label_type);
    final Combo typeCombo = new Combo(panel, SWT.DROP_DOWN | SWT.READ_ONLY);
    typeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (DBSEntityConstraintType constraintType : constraintTypes) {
        typeCombo.add(constraintType.getName());
        if (selectedConstraintType == null) {
            selectedConstraintType = constraintType;
        }
    }
    typeCombo.select(0);
    typeCombo.setEnabled(constraintTypes.length > 1);
    typeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedConstraintType = constraintTypes[typeCombo.getSelectionIndex()];
        }
    });
}

4. DB2ReorgTableDialog#createLobsTempTablespaceCombo()

Project: dbeaver
File: DB2ReorgTableDialog.java
private Combo createLobsTempTablespaceCombo(Composite parent) {
    final Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (String tablespaceName : listTempTsNames) {
        combo.add(tablespaceName);
    }
    if (!listTempTsNames.isEmpty()) {
        combo.select(0);
    }
    combo.setEnabled(false);
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            lobsTablespace = listTempTsNames.get(combo.getSelectionIndex());
            updateSQL();
        }
    });
    return combo;
}

5. LambdaFunctionGroup#createPredefinedHandlerInputTypeCombo()

Project: aws-toolkit-eclipse
File: LambdaFunctionGroup.java
private Combo createPredefinedHandlerInputTypeCombo(Composite composite, int colspan) {
    final Combo combo = newCombo(composite, 1);
    for (PredefinedHandlerInputType type : PredefinedHandlerInputType.values()) {
        combo.add(type.getDisplayName());
        combo.setData(type.getDisplayName(), type);
    }
    combo.add(CUSTOM_INPUT_TYPE_COMBO_TEXT);
    combo.setData(CUSTOM_INPUT_TYPE_COMBO_TEXT, CUSTOM_INPUT_TYPE_COMBO_DATA);
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            onPredefinedHandlerInputTypeComboSelectionChange();
        }
    });
    return combo;
}

6. ImportTemplateDialog#createCustomArea()

Project: aws-toolkit-eclipse
File: ImportTemplateDialog.java
@Override
protected Control createCustomArea(Composite parent) {
    parent.setLayout(new FillLayout());
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    new Label(composite, SWT.None).setText("Template to import: ");
    final Combo existingTemplateNamesCombo = new Combo(composite, SWT.READ_ONLY);
    existingTemplateNamesCombo.setItems(existingTemplateNames.toArray(new String[existingTemplateNames.size()]));
    existingTemplateNamesCombo.select(0);
    existingTemplateNamesCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            templateName = existingTemplateNamesCombo.getItem(existingTemplateNamesCombo.getSelectionIndex());
        }
    });
    return composite;
}

7. INSDEnvironmentPage#addCombo()

Project: uima-uimaj
File: INSDEnvironmentPage.java
private Combo addCombo(Composite parent, String strLabel) {
    Label label = new Label(parent, SWT.NULL);
    label.setText(strLabel);
    Combo text = new Combo(parent, SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    // gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 100;
    text.setLayoutData(gd);
    text.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    return text;
}

8. SearchConditionItem#createFieldCombo()

Project: RSSOwl
File: SearchConditionItem.java
private void createFieldCombo() {
    Combo fieldCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
    fieldCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
    fieldCombo.setVisibleItemCount(100);
    fFieldViewer = new ComboViewer(fieldCombo);
    fFieldViewer.setContentProvider(new ComboContentProvider());
    fFieldViewer.setLabelProvider(new ComboLabelProvider());
    fFieldViewer.setInput(fCondition);
    /* Select the Condition's Field */
    fFieldViewer.setSelection(new StructuredSelection(fCondition.getField()));
    /* Listen to Changes */
    fFieldViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            fModified = true;
        }
    });
}

9. WASSLOffloading#createCombo()

Project: azure-tools-for-java
File: WASSLOffloading.java
private Combo createCombo(Composite container, boolean isLower) {
    Combo combo = new Combo(container, SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.widthHint = 280;
    gridData.horizontalIndent = 10;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    if (isLower) {
        gridData.verticalIndent = 5;
    }
    combo.setLayoutData(gridData);
    return combo;
}

10. JdkSrvConfig#createCombo()

Project: azure-tools-for-java
File: JdkSrvConfig.java
/**
	 * Method creates read only combo box.
	 * @param parent
	 * @param lowerCmb
	 * @return
	 */
public static Combo createCombo(Composite parent, boolean lowerCmb) {
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    GridData groupGridData = new GridData();
    if (lowerCmb) {
        groupGridData.widthHint = 300;
        groupGridData.verticalIndent = 10;
        groupGridData.horizontalIndent = 10;
    } else {
        groupGridData.horizontalSpan = 2;
        groupGridData.horizontalIndent = 23;
        groupGridData.widthHint = 385;
    }
    combo.setLayoutData(groupGridData);
    return combo;
}

11. WindowsAzurePage#createCombo()

Project: azure-tools-for-java
File: WindowsAzurePage.java
protected Combo createCombo(Composite container, int style, int verticalIndent, int horiAlign, int width) {
    Combo combo = new Combo(container, style);
    GridData comboData = new GridData();
    if (width > 0) {
        comboData.widthHint = width;
    }
    comboData.heightHint = 23;
    comboData.horizontalAlignment = horiAlign;
    comboData.grabExcessHorizontalSpace = true;
    comboData.verticalIndent = verticalIndent;
    combo.setLayoutData(comboData);
    return combo;
}

12. LambdaFunctionGroup#createHandlerTypeCombo()

Project: aws-toolkit-eclipse
File: LambdaFunctionGroup.java
private Combo createHandlerTypeCombo(Composite composite, int colspan) {
    final Combo combo = newCombo(composite, 1);
    for (LambdaHandlerType handlerType : LambdaHandlerType.values()) {
        combo.add(handlerType.getName());
        combo.setData(handlerType.getName(), handlerType);
    }
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            onHandlerTypeSelectionChange();
        }
    });
    return combo;
}

13. EnvironmentConfigEditorSection#createCombo()

Project: aws-toolkit-eclipse
File: EnvironmentConfigEditorSection.java
/**
     * Creates a drop-down combo with the option given.
     */
protected void createCombo(Composite parent, ConfigurationOptionDescription option) {
    Label label = createLabel(toolkit, parent, option);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    combo.setItems(option.getValueOptions().toArray(new String[option.getValueOptions().size()]));
    IObservableValue modelv = model.observeEntry(option);
    ISWTObservableValue widget = SWTObservables.observeSelection(combo);
    parentEditor.bindingContext.bindValue(widget, modelv, new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
    modelv.addChangeListener(new DirtyMarker());
}

14. QueryEditorControl#createTreeOptionsComposite()

Project: team-explorer-everywhere
File: QueryEditorControl.java
private Composite createTreeOptionsComposite() {
    final Composite composite = new Composite(optionsComposite, SWT.NONE);
    SWTUtil.gridLayout(composite, 2, false, 0, 8);
    final Label label2 = new Label(composite, SWT.DROP_DOWN);
    label2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
    //$NON-NLS-1$
    label2.setText(Messages.getString("QueryEditorControl.TreeTypeLabelText"));
    final Combo combo = new Combo(composite, SWT.NONE);
    combo.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1));
    AutomationIDHelper.setWidgetID(combo, TYPEOFTREE_COMBO_ID);
    populateTreeOptionsCombo(combo, query.getTreeQueryLinkType());
    return composite;
}

15. TypesTreeSectionPart#createLabelAndCombo()

Project: uima-sandbox
File: TypesTreeSectionPart.java
/*************************************************************************/
//    private FSIndex getIndexForType(CAS aTCAS, String typeName)
//    {
//        return getIndexForType(aTCAS, aTCAS.getTypeSystem().getType(typeName));
//    }
//    
//    private FSIndex getIndexForType(CAS aTCAS, Type aType)
//    {
//        if (aType != null) {
//            return null;
//        }
//        
//        Iterator iter = aTCAS.getIndexRepository().getLabels();
//        while (iter.hasNext())
//        {
//            String label = (String) iter.next();
//            FSIndex index = aTCAS.getIndexRepository().getIndex(label);
//            if (aTCAS.getTypeSystem().subsumes(index.getType(), aType))
//            {
//                return aTCAS.getIndexRepository().getIndex(label, aType);
//            }
//        }
//        return null;
//    }
/*************************************************************************/
public static Combo createLabelAndCombo(FormToolkit toolkit, Composite parent, String labelText, int style) {
    Label label = toolkit.createLabel(parent, labelText);
    label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
    Combo ccombo = new Combo(parent, style);
    toolkit.adapt(ccombo);
    FormSection.fillIntoGridOrTableLayout(parent, label, ccombo, 10, 0);
    return ccombo;
}

16. ComponentWizardPage#createProjectComposite()

Project: idecore
File: ComponentWizardPage.java
protected void createProjectComposite(Composite parent) {
    final Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    group.setLayout(new GridLayout(3, false));
    final CLabel label = new CLabel(group, SWT.NONE);
    label.setLayoutData(new GridData(SWT.BEGINNING));
    label.setText("Project:");
    projectField = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    projectField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    projectField.addSelectionListener(projectSelectionListener);
    final List<IProject> projects = getProjects();
    projectField.setData(projects);
    projectField.setEnabled(!projects.isEmpty());
    for (final IProject project : projects) {
        projectField.add(project.getName());
    }
}

17. ProjectConfigurationTab#shouldEnableLevels()

Project: idecore
File: ProjectConfigurationTab.java
/**
     * Enable or disable the log categories
     */
@VisibleForTesting
public void shouldEnableLevels(boolean shouldEnable) {
    if (Utils.isEmpty(logStatus) || Utils.isEmpty(logSettings)) {
        return;
    }
    logStatus.setSelection(shouldEnable);
    for (Combo logCategoryCombo : logSettings.values()) {
        logCategoryCombo.setEnabled(shouldEnable);
    }
}

18. GrailsInplaceDialog#createProjectList()

Project: grails-ide
File: GrailsInplaceDialog.java
private void createProjectList(Composite parent) {
    projectLabel = new Label(parent, SWT.FILL);
    projectLabel.setText("Project: ");
    smallFont(projectLabel);
    projectList = new Combo(parent, SWT.READ_ONLY);
    smallFont(projectList);
    GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.FILL).grab(true, false).applyTo(projectList);
    projectList.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            handleProjectSelection();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            handleProjectSelection();
        }

        private void handleProjectSelection() {
            if (!projectList.getText().equals(getSelectedProjectName())) {
                setSelectedProject(projectList.getText());
            }
        }
    });
    // force refresh of created projectList
    refreshProjects();
}

19. SampleProjectSection#createContents()

Project: eclipse-integration-gradle
File: SampleProjectSection.java
@Override
public void createContents(Composite page) {
    Composite group = new Composite(page, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    group.setLayout(layout);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label projectLabel = new Label(group, SWT.NONE);
    projectLabel.setText("Sample project:");
    sampleProjectField = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
    sampleProjectField.setItems(getSampleProjectNames());
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    sampleProjectField.setLayoutData(data);
    sampleProjectField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            sampleProjectExp.refresh();
        }
    });
    sampleProjectExp.refresh();
}

20. ConsoleInplaceDialog#createProjectList()

Project: eclipse-integration-gradle
File: ConsoleInplaceDialog.java
private void createProjectList(Composite parent) {
    projectLabel = new Label(parent, SWT.FILL);
    projectLabel.setText("Project: ");
    smallFont(projectLabel);
    projectList = new Combo(parent, SWT.READ_ONLY);
    smallFont(projectList);
    GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.FILL).grab(true, false).applyTo(projectList);
    projectList.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            handleProjectSelection();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            handleProjectSelection();
        }

        private void handleProjectSelection() {
            if (!projectList.getText().equals(getSelectedProjectName())) {
                setSelectedProject(projectList.getText());
            }
        }
    });
    // force refresh of created projectList
    refreshProjects();
}

21. SelectionEditorTool#setupModeCombo()

Project: depan
File: SelectionEditorTool.java
private Composite setupModeCombo(Composite parent, List<SelectionMode> modeChoices, SelectionMode initialMode) {
    Composite result = new Composite(parent, SWT.NONE);
    result.setLayout(new GridLayout(2, false));
    Label label = new Label(result, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    label.setText("Creation mode:");
    modeChoice = new Combo(result, SWT.READ_ONLY | SWT.BORDER);
    modeChoice.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    for (SelectionMode mode : modeChoices) {
        modeChoice.add(mode.getLabel());
    }
    int modeIndex = modeChoices.indexOf(initialMode);
    modeChoice.select(modeIndex >= 0 ? modeIndex : 0);
    return result;
}

22. NewResourceGroupDialog#createSubCmpnt()

Project: azure-tools-for-java
File: NewResourceGroupDialog.java
private void createSubCmpnt(Composite container) {
    Label lblName = new Label(container, SWT.LEFT);
    GridData gridData = gridDataForLbl();
    lblName.setLayoutData(gridData);
    lblName.setText(Messages.sub);
    subscriptionCombo = new Combo(container, SWT.READ_ONLY);
    gridData = gridDataForText(180);
    subscriptionCombo.setLayoutData(gridData);
    subscriptionCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            String subName = subscriptionCombo.getText();
            if (subName != null && !subName.isEmpty()) {
                populateLocations();
            }
            enableOkBtn();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }
    });
}

23. CreateWebAppDialog#createWebContainerCmpnt()

Project: azure-tools-for-java
File: CreateWebAppDialog.java
private void createWebContainerCmpnt(Composite container) {
    Label lblName = new Label(container, SWT.LEFT);
    GridData gridData = gridDataForLbl();
    lblName.setLayoutData(gridData);
    lblName.setText(Messages.container);
    containerCombo = new Combo(container, SWT.READ_ONLY);
    gridData = gridDataForText(180);
    containerCombo.setLayoutData(gridData);
    List<String> containerList = new ArrayList<String>();
    for (WebAppsContainers type : WebAppsContainers.values()) {
        containerList.add(type.getName());
    }
    String[] containerArray = containerList.toArray(new String[containerList.size()]);
    containerCombo.setItems(containerArray);
    containerCombo.setText(containerArray[0]);
    new Link(container, SWT.NO);
}

24. CreateAppServicePlanDialog#createPricingCmpnt()

Project: azure-tools-for-java
File: CreateAppServicePlanDialog.java
private void createPricingCmpnt(Composite container) {
    Label lblName = new Label(container, SWT.LEFT);
    GridData gridData = gridDataForLbl();
    lblName.setLayoutData(gridData);
    lblName.setText(Messages.price);
    pricingCombo = new Combo(container, SWT.READ_ONLY);
    gridData = gridDataForText(180);
    pricingCombo.setLayoutData(gridData);
    pricingCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent event) {
        }

        @Override
        public void widgetSelected(SelectionEvent event) {
            fillWorkerSize(pricingCombo.getText());
        }
    });
}

25. ApplicationInsightsNewDialog#createRegionCmpnt()

Project: azure-tools-for-java
File: ApplicationInsightsNewDialog.java
private void createRegionCmpnt(Composite container) {
    Label lblName = new Label(container, SWT.LEFT);
    GridData gridData = gridDataForLbl();
    lblName.setLayoutData(gridData);
    lblName.setText(Messages.region);
    region = new Combo(container, SWT.READ_ONLY);
    gridData = gridDataForText(180);
    region.setLayoutData(gridData);
    new Link(container, SWT.NO);
}

26. DeviceDialog#createCustomArea()

Project: aws-toolkit-eclipse
File: DeviceDialog.java
/* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createCustomArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout(2, false));
    Label label = new Label(composite, SWT.NONE);
    label.setText("Device:");
    deviceCombo = new Combo(composite, SWT.READ_ONLY);
    deviceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    String devicePrefix = "/dev/sd";
    for (char c = 'b'; c <= 'z'; c++) {
        deviceCombo.add(devicePrefix + c);
    }
    deviceCombo.setText(DEFAULT_DEVICE);
    return composite;
}

27. ScaleTool#setupComposite()

Project: depan
File: ScaleTool.java
@Override
public Control setupComposite(Composite parent) {
    Composite baseComposite = new Composite(parent, SWT.NONE);
    // zoom components
    new Label(baseComposite, SWT.NONE).setText("Zoom %");
    final Combo zoomPercents = new Combo(baseComposite, SWT.SINGLE | SWT.BORDER);
    new Label(baseComposite, SWT.NONE).setText("%");
    Button applyZoom = new Button(baseComposite, SWT.PUSH);
    // stretch components
    new Label(baseComposite, SWT.NONE).setText("Stretch %");
    final Combo percents = new Combo(baseComposite, SWT.SINGLE | SWT.BORDER);
    new Label(baseComposite, SWT.NONE).setText("%");
    Button apply = new Button(baseComposite, SWT.PUSH);
    Button autoStretch = new Button(baseComposite, SWT.PUSH);
    Label help = new Label(baseComposite, SWT.WRAP);
    for (String text : new String[] { "100", "800", "600", "400", "200", "150", "100", "90", "80", "70", "60", "50", "40" }) {
        percents.add(text);
        zoomPercents.add(text);
    }
    percents.pack();
    zoomPercents.pack();
    apply.setText("Ok");
    applyZoom.setText("Ok");
    autoStretch.setText("Automatic stretch (a)");
    help.setText("If you are \"lost\", setting the zoom level to 100%, then " + "applying an automatic scaling should restore a good view.\n" + "\n" + "The stretch value is relative to the previously applied stretch " + "value. Therefore, applying a stretch value of 100% will never do " + "anything, and a stretch value of 200% always makes the graph two " + "times larger even if applied multiple times consecutivelly.\n");
    position = setupCameraPositionGroup(baseComposite);
    direction = setupCameraDirectionGroup(baseComposite);
    Composite metrics = setupMetrics(baseComposite);
    Composite rate = setupFrameRate(baseComposite);
    // layout
    baseComposite.setLayout(new GridLayout(4, false));
    autoStretch.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 4, 1));
    help.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
    percents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    zoomPercents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    position.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
    direction.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
    metrics.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
    rate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1));
    // actions
    apply.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                float size = Float.parseFloat(percents.getText());
                // we have percents, we need a /1 scale.
                size /= 100.0f;
                scaleLayout(size);
            } catch (NumberFormatException ex) {
                System.out.println("Error in the number format. Must be float.");
            }
        }
    });
    applyZoom.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            try {
                float size = Float.parseFloat(zoomPercents.getText());
                // we have percents, we need a /1 scale.
                size /= 100.0f;
                applyZoom(size);
            } catch (NumberFormatException ex) {
                System.out.println("Error in the number format. Must be float.");
            }
        }
    });
    autoStretch.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            scaleToViewport();
        }
    });
    return baseComposite;
}

28. JAREntryPart#createContent()

Project: bndtools
File: JAREntryPart.java
private void createContent(Composite parent, FormToolkit toolkit) {
    Section textSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    textSection.setText("Entry Content");
    Composite textComposite = toolkit.createComposite(textSection);
    text = toolkit.createText(textComposite, "", SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
    text.setFont(JFaceResources.getTextFont());
    textSection.setClient(textComposite);
    Section encodingSection = toolkit.createSection(parent, Section.TITLE_BAR | Section.EXPANDED);
    encodingSection.setText("Display Options");
    Composite encodingPanel = toolkit.createComposite(encodingSection);
    encodingSection.setClient(encodingPanel);
    toolkit.createLabel(encodingPanel, "Show As:");
    final Button btnText = toolkit.createButton(encodingPanel, "Text", SWT.RADIO);
    btnText.setSelection(showAsText);
    Button btnBinary = toolkit.createButton(encodingPanel, "Binary (hex)", SWT.RADIO);
    btnBinary.setSelection(!showAsText);
    toolkit.createLabel(encodingPanel, "Text Encoding:");
    final Combo encodingCombo = new Combo(encodingPanel, SWT.READ_ONLY);
    encodingCombo.setEnabled(showAsText);
    // INITIALISE
    encodingCombo.setItems(charsets);
    encodingCombo.select(selectedCharset);
    // LISTENERS
    encodingSection.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            getManagedForm().reflow(true);
        }
    });
    SelectionListener radioListener = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            showAsText = btnText.getSelection();
            encodingCombo.setEnabled(showAsText);
            loadContent();
        }
    };
    btnText.addSelectionListener(radioListener);
    btnBinary.addSelectionListener(radioListener);
    encodingCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedCharset = encodingCombo.getSelectionIndex();
            loadContent();
        }
    });
    // LAYOUT
    GridLayout layout;
    GridData gd;
    layout = new GridLayout(1, false);
    parent.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    textSection.setLayoutData(gd);
    layout = new GridLayout(1, false);
    textComposite.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    text.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    encodingSection.setLayoutData(gd);
    encodingSection.setLayout(new FillLayout());
    encodingPanel.setLayout(new GridLayout(3, false));
    encodingCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
}

29. NewLinkedWorkItemDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: NewLinkedWorkItemDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);
    // Create the link-type label and combo.
    final Label linkTypeLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    linkTypeLabel.setText(Messages.getString("NewLinkedWorkItemDialog.LinkTypeLabelText"));
    final Combo linkTypeCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    linkTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
    populateLinkTypeCombo(linkTypeCombo);
    // Create the work item details group.
    final Group linkDetailsGroup = new Group(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    linkDetailsGroup.setText(Messages.getString("NewLinkedWorkItemDialog.DetailsGroupText"));
    linkDetailsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    final GridLayout linkDetailsGroupLayout = new GridLayout(2, false);
    linkDetailsGroupLayout.marginWidth = getHorizontalMargin();
    linkDetailsGroupLayout.marginHeight = getVerticalMargin();
    linkDetailsGroupLayout.horizontalSpacing = getHorizontalSpacing();
    linkDetailsGroupLayout.verticalSpacing = getVerticalSpacing();
    linkDetailsGroup.setLayout(linkDetailsGroupLayout);
    // Create the work item type label and combo.
    final Label workItemTypeLabel = new Label(linkDetailsGroup, SWT.NONE);
    //$NON-NLS-1$
    workItemTypeLabel.setText(Messages.getString("NewLinkedWorkItemDialog.TypeLabelText"));
    final Combo workItemTypeCombo = new Combo(linkDetailsGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    workItemTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
    populateWorkItemTypeCombo(workItemTypeCombo);
    // Create the title label and text box.
    final Label workItemTitle = new Label(linkDetailsGroup, SWT.NONE);
    //$NON-NLS-1$
    workItemTitle.setText(Messages.getString("NewLinkedWorkItemDialog.TitleLabelText"));
    textWorkItemTitle = new Text(linkDetailsGroup, SWT.BORDER);
    textWorkItemTitle.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
    textWorkItemTitle.setTextLimit(LinkTextMaxLengths.WORK_ITEM_TITLE_MAX_LENGTH);
    ControlSize.setCharWidthHint(textWorkItemTitle, 60);
    // Create the comment label and text box.
    final Label workItemComment = new Label(linkDetailsGroup, SWT.NONE);
    //$NON-NLS-1$
    workItemComment.setText(Messages.getString("NewLinkedWorkItemDialog.CommentLabelText"));
    textWorkItemComment = new Text(linkDetailsGroup, SWT.BORDER);
    textWorkItemComment.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
    textWorkItemComment.setTextLimit(LinkTextMaxLengths.COMMENT_MAX_LENGTH);
    ControlSize.setCharWidthHint(textWorkItemTitle, 60);
    // Add listener for the link-type combo.
    linkTypeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectedLinkTypeIndex = linkTypeCombo.getSelectionIndex();
        }
    });
    // Add listener for the link-type combo.
    workItemTypeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectedWorkItemTypeIndex = workItemTypeCombo.getSelectionIndex();
        }
    });
}

30. VersionedItemLinkProvider#initialize()

Project: team-explorer-everywhere
File: VersionedItemLinkProvider.java
@Override
public void initialize(final Composite composite) {
    ((GridLayout) composite.getLayout()).numColumns = 5;
    final Label versionedItemLabel = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    versionedItemLabel.setText(Messages.getString("VersionedItemLinkProvider.VersionedItemLabelText"));
    versionedItemText = new Text(composite, SWT.BORDER);
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.horizontalSpan = 3;
    versionedItemText.setLayoutData(gd);
    final Button browseVersionedItemsButton = new Button(composite, SWT.NONE);
    //$NON-NLS-1$
    browseVersionedItemsButton.setText(Messages.getString("VersionedItemLinkProvider.BrowseButtonText"));
    browseVersionedItemsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            browseForVersionedItem(((Button) e.widget).getShell());
        }
    });
    final Label versionLabel = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    versionLabel.setText(Messages.getString("VersionedItemLinkProvider.VersionLabelText"));
    final Combo linkToCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    //$NON-NLS-1$
    linkToCombo.add(Messages.getString("VersionedItemLinkProvider.LatestVersionChoice"));
    //$NON-NLS-1$
    linkToCombo.add(Messages.getString("VersionedItemLinkProvider.ChangesetChoice"));
    final Label changesetLabel = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    changesetLabel.setText(Messages.getString("VersionedItemLinkProvider.ChangesetLabelText"));
    changesetText = new Text(composite, SWT.BORDER);
    changesetText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    final Button browseChangesetsButton = new Button(composite, SWT.NONE);
    //$NON-NLS-1$
    browseChangesetsButton.setText(Messages.getString("VersionedItemLinkProvider.BrowseButton2Text"));
    browseChangesetsButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            browseForChangeset(((Button) e.widget).getShell());
        }
    });
    final Label commentLabel = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    commentLabel.setText(Messages.getString("VersionedItemLinkProvider.CommentLabelText"));
    commentText = new Text(composite, SWT.BORDER);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.horizontalSpan = 4;
    commentText.setLayoutData(gd);
    commentText.setTextLimit(LinkTextMaxLengths.COMMENT_MAX_LENGTH);
    latestVersionMode = true;
    linkToCombo.select(0);
    changesetLabel.setVisible(false);
    changesetText.setVisible(false);
    browseChangesetsButton.setVisible(false);
    linkToCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            latestVersionMode = (linkToCombo.getSelectionIndex() == 0);
            changesetLabel.setVisible(!latestVersionMode);
            changesetText.setVisible(!latestVersionMode);
            browseChangesetsButton.setVisible(!latestVersionMode);
        }
    });
}

31. DB2TablespaceChooser#createDialogArea()

Project: dbeaver
File: DB2TablespaceChooser.java
@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(DB2Messages.dialog_explain_choose_tablespace);
    Control container = super.createDialogArea(parent);
    Composite composite = UIUtils.createPlaceholder((Composite) container, 2);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    // Add Label
    // Add combo box with the tablespaces
    UIUtils.createControlLabel(parent, DB2Messages.dialog_explain_choose_tablespace_tablespace);
    final Combo tsCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    tsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (String tablespaceName : listTablespaceNames) {
        tsCombo.add(tablespaceName);
    }
    tsCombo.select(0);
    tsCombo.setEnabled(true);
    tsCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedTablespace = listTablespaceNames.get(tsCombo.getSelectionIndex());
        }
    });
    return parent;
}

32. EditIndexDialog#createContentsBeforeColumns()

Project: dbeaver
File: EditIndexDialog.java
@Override
protected void createContentsBeforeColumns(Composite panel) {
    UIUtils.createControlLabel(panel, CoreMessages.dialog_struct_edit_index_label_type);
    final Combo typeCombo = new Combo(panel, SWT.DROP_DOWN | SWT.READ_ONLY);
    typeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (DBSIndexType indexType : indexTypes) {
        typeCombo.add(indexType.getName());
        if (selectedIndexType == null) {
            selectedIndexType = indexType;
        }
    }
    typeCombo.select(0);
    typeCombo.setEnabled(indexTypes.size() > 1);
    typeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedIndexType = indexTypes.get(typeCombo.getSelectionIndex());
        }
    });
    final Button uniqueButton = UIUtils.createLabelCheckbox(panel, "Unique", false);
    uniqueButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            unique = uniqueButton.getSelection();
        }
    });
}

33. BndBuildPreferencePage#createContents()

Project: bndtools
File: BndBuildPreferencePage.java
@Override
protected Control createContents(Composite parent) {
    GridLayout layout;
    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout(2, false);
    composite.setLayout(layout);
    // Create controls
    new Label(composite, SWT.NONE).setText("Build Debug Logging:");
    final Combo cmbBuildLogging = new Combo(composite, SWT.READ_ONLY);
    cmbBuildLogging.setItems(new String[] { Messages.BndPreferencePage_cmbBuildLogging_None, Messages.BndPreferencePage_cmbBuildLogging_Basic, Messages.BndPreferencePage_cmbBuildLogging_Full });
    cmbBuildLogging.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    // Load Data
    cmbBuildLogging.select(buildLogging);
    // Listeners
    cmbBuildLogging.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            buildLogging = cmbBuildLogging.getSelectionIndex();
        }
    });
    return composite;
}

34. CloudServiceStep#createCloudServiceSettings()

Project: azure-tools-for-java
File: CloudServiceStep.java
private void createCloudServiceSettings(Composite container) {
    final Composite composite = new Composite(container, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = GridData.BEGINNING;
    //        gridData.grabExcessHorizontalSpace = true;
    gridData.widthHint = 250;
    composite.setLayout(gridLayout);
    composite.setLayoutData(gridData);
    cloudServiceLabel = new Label(composite, SWT.LEFT);
    cloudServiceLabel.setText("Cloud service");
    cloudServiceComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    cloudServiceComboBox.setLayoutData(gridData);
    networkLabel = new Label(composite, SWT.LEFT);
    networkLabel.setText("Virtual Network");
    networkComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    networkComboBox.setLayoutData(gridData);
    subnetLabel = new Label(composite, SWT.LEFT);
    subnetLabel.setText("Subnet");
    subnetComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    subnetComboBox.setLayoutData(gridData);
    storageLabel = new Label(composite, SWT.LEFT);
    storageLabel.setText("Storage account");
    storageComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    storageComboBox.setLayoutData(gridData);
    availabilitySetCheckBox = new Button(composite, SWT.CHECK);
    availabilitySetCheckBox.setText("Specify an availability set");
    availabilityComboBox = new Combo(composite, SWT.READ_ONLY);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    availabilityComboBox.setLayoutData(gridData);
}

35. CalendarDialog#showWithTime()

Project: scouter
File: CalendarDialog.java
public void showWithTime(int x, int y, long time) {
    final Shell dialog = new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    dialog.setLayout(new GridLayout(4, false));
    dialog.setText("Date/Time");
    UIUtil.setDialogDefaultFunctions(dialog);
    final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1);
    calendar.setLayoutData(data);
    if (time > 0) {
        int year = CastUtil.cint(DateUtil.format(time, "yyyy"));
        int month = CastUtil.cint(DateUtil.format(time, "MM")) - 1;
        int day = CastUtil.cint(DateUtil.format(time, "dd"));
        calendar.setDate(year, month, day);
        calendar.setDay(day);
    }
    Label label = new Label(dialog, SWT.NONE);
    label.setText("From");
    final DateTime startTime = new DateTime(dialog, SWT.TIME | SWT.SHORT);
    if (time > 0) {
        int hours = CastUtil.cint(DateUtil.format(time, "HH"));
        int minutes = CastUtil.cint(DateUtil.format(time, "mm"));
        int seconds = CastUtil.cint(DateUtil.format(time, "ss"));
        startTime.setTime(hours, minutes, seconds);
    } else {
        startTime.setHours(7);
        startTime.setMinutes(0);
    }
    label = new Label(dialog, SWT.NONE);
    label.setText("To");
    final Combo afterMinutes = new Combo(dialog, SWT.DROP_DOWN | SWT.READ_ONLY);
    ArrayList<String> minuteStrList = new ArrayList<String>();
    for (AfterMinuteUnit minute : AfterMinuteUnit.values()) {
        minuteStrList.add(minute.getLabel());
    }
    afterMinutes.setItems(minuteStrList.toArray(new String[AfterMinuteUnit.values().length]));
    afterMinutes.select(0);
    afterMinutes.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    Button okButton = new Button(dialog, SWT.PUSH);
    okButton.setText("&OK");
    okButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    okButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    try {
                        String fromTime = (calendar.getMonth() + 1) + "/" + calendar.getDay() + "/" + calendar.getYear() + " " + startTime.getHours() + ":" + (startTime.getMinutes() < 10 ? "0" : "") + startTime.getMinutes();
                        long startTime = DateUtil.getTime(fromTime, "MM/dd/yyyy HH:mm");
                        long endTime = 0;
                        String afterMinute = afterMinutes.getText();
                        AfterMinuteUnit m = AfterMinuteUnit.fromString(afterMinute);
                        if (m != null) {
                            endTime = startTime + m.getTime();
                        }
                        if (endTime <= startTime) {
                            MessageDialog.openWarning(dialog, "Warning", "Time range is incorrect");
                        } else {
                            if (DateUtil.isSameDay(new Date(startTime), new Date(endTime)) == false) {
                                endTime = DateUtil.getTime((calendar.getMonth() + 1) + "/" + calendar.getDay() + "/" + calendar.getYear() + " 23:59", "MM/dd/yyyy HH:mm");
                            }
                            callback.onPressedOk(startTime, endTime);
                            dialog.close();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        MessageDialog.openError(dialog, "Error", "Date format error:" + e.getMessage());
                    }
                    break;
            }
        }
    });
    Button cancelButton = new Button(dialog, SWT.PUSH);
    cancelButton.setText("&Cancel");
    cancelButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    cancelButton.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    callback.onPressedCancel();
                    dialog.close();
                    break;
            }
        }
    });
    dialog.setDefaultButton(okButton);
    dialog.pack();
    if (x > 0 && y > 0) {
        dialog.setLocation(x, y);
    }
    dialog.open();
}

36. SearchConditionItem#createSpecifierCombo()

Project: RSSOwl
File: SearchConditionItem.java
private void createSpecifierCombo() {
    final Combo specifierCombo = new Combo(this, SWT.BORDER | SWT.READ_ONLY);
    specifierCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, true));
    ((GridData) specifierCombo.getLayoutData()).widthHint = Application.IS_WINDOWS ? 90 : 160;
    specifierCombo.setVisibleItemCount(100);
    fSpecifierViewer = new ComboViewer(specifierCombo);
    fSpecifierViewer.setContentProvider(new ComboContentProvider());
    fSpecifierViewer.setLabelProvider(new ComboLabelProvider());
    fSpecifierViewer.setInput(fCondition.getField());
    /* Select the Condition's Specifier */
    if (fCondition.getSpecifier() != null)
        fSpecifierViewer.setSelection(new StructuredSelection(fCondition.getSpecifier()));
    /* Make sure to at least select the first item */
    if (fSpecifierViewer.getSelection().isEmpty())
        fSpecifierViewer.getCombo().select(0);
    specifierCombo.setToolTipText(getSpecifierTooltip((IStructuredSelection) fSpecifierViewer.getSelection()));
    /* Listen to Selection Changes in the Field-Viewer */
    fFieldViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (!selection.isEmpty()) {
                /* Remember old Selection */
                ISelection oldSelection = fSpecifierViewer.getSelection();
                /* Set Field as Input */
                ISearchField field = (ISearchField) selection.getFirstElement();
                fSpecifierViewer.setInput(field);
                /* Try keeping the selection */
                fSpecifierViewer.setSelection(oldSelection);
                if (fSpecifierViewer.getCombo().getSelectionIndex() == -1)
                    selectFirstItem(fSpecifierViewer);
            }
        }
    });
    /* Listen to Changes */
    fSpecifierViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            fModified = true;
            specifierCombo.setToolTipText(getSpecifierTooltip((IStructuredSelection) event.getSelection()));
        }
    });
}

37. WSDL2apexWizardFindPage#createControl()

Project: idecore
File: WSDL2apexWizardFindPage.java
@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 3;
    container.setLayout(gridLayout);
    setControl(container);
    //ensures upon entering the page, we cannot continue through the wizard
    setPageComplete(false);
    final Label label = new Label(container, SWT.NONE);
    final GridData gridData = new GridData();
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setText("Select the WSDL file you would like to convert.");
    final Label wsdlFileLabel = new Label(container, SWT.NONE);
    final GridData gridData2 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    wsdlFileLabel.setLayoutData(gridData2);
    wsdlFileLabel.setText("WSDL File:");
    wsdlFileField = new Text(container, SWT.BORDER);
    wsdlFileField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            updatePageComplete();
        }
    });
    wsdlFileField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Button button = new Button(container, SWT.NONE);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            browseForWsdlFile();
        }
    });
    button.setText(" Browse ");
    button.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
    final Label async = new Label(container, SWT.NONE);
    final GridData asyncGridData = new GridData();
    async.setLayoutData(asyncGridData);
    async.setText("Add Async Class?");
    final Combo combo = new Combo(container, SWT.READ_ONLY);
    combo.setItems(new String[] { "True", "False" });
    combo.setText("True");
    combo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            setAsyncTrue(Boolean.valueOf(combo.getText()));
        }
    });
}

38. BooleanInlineEditor#createControl()

Project: dbeaver
File: BooleanInlineEditor.java
@Override
protected Combo createControl(Composite editPlaceholder) {
    final Combo editor = new Combo(editPlaceholder, SWT.READ_ONLY);
    editor.add("FALSE");
    editor.add("TRUE");
    editor.setEnabled(!valueController.isReadOnly());
    return editor;
}

39. BitInlineEditor#createControl()

Project: dbeaver
File: BitInlineEditor.java
@Override
protected Combo createControl(Composite editPlaceholder) {
    final Combo editor = new Combo(valueController.getEditPlaceholder(), SWT.READ_ONLY);
    //$NON-NLS-1$
    editor.add(Boolean.FALSE.toString());
    //$NON-NLS-1$
    editor.add(Boolean.TRUE.toString());
    editor.setEnabled(!valueController.isReadOnly());
    return editor;
}

40. EnvironmentTypeConfigEditorSection#createCombo()

Project: aws-toolkit-eclipse
File: EnvironmentTypeConfigEditorSection.java
@Override
protected void createCombo(Composite parent, ConfigurationOptionDescription option) {
    Label label = createLabel(toolkit, parent, option);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    final Combo combo = new Combo(parent, SWT.READ_ONLY);
    combo.setItems(option.getValueOptions().toArray(new String[option.getValueOptions().size()]));
    IObservableValue modelv = model.observeEntry(option);
    ISWTObservableValue widget = SWTObservables.observeSelection(combo);
    parentEditor.getDataBindingContext().bindValue(widget, modelv, new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE), new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));
    final String oldEnvironmentType = (String) modelv.getValue();
    // After you do the confirmation, we will update the environment and refresh the layout.
    combo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            boolean confirmation = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Change Environment Type", CHANGE_ENVIRONMENT_TYPE_WARNING);
            if (confirmation == true) {
                parentEditor.destroyOldLayouts();
                UpdateEnvironmentRequest rq = generateUpdateEnvironmentTypeRequest();
                if (rq != null) {
                    UpdateEnvironmentAndRefreshLayoutJob job = new UpdateEnvironmentAndRefreshLayoutJob(environment, rq);
                    job.schedule();
                }
            } else {
                combo.setText(oldEnvironmentType);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}

41. LaunchWizardPage#createControl()

Project: aws-toolkit-eclipse
File: LaunchWizardPage.java
/* (non-Javadoc)
     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
     */
public void createControl(Composite originalParent) {
    Composite parent = new Composite(originalParent, SWT.NONE);
    GridLayout parentLayout = new GridLayout(2, false);
    parent.setLayout(parentLayout);
    newLabel(parent, "AMI:");
    amiLabel = newLabel(parent, "N/A");
    amiLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newLabel(parent, "Number of Hosts:");
    numberOfHostsSpinner = new Spinner(parent, SWT.BORDER);
    numberOfHostsSpinner.setSelection(1);
    numberOfHostsSpinner.setMaximum(20);
    numberOfHostsSpinner.setMinimum(1);
    numberOfHostsSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newLabel(parent, "Instance Type:");
    instanceTypeCombo = new Combo(parent, SWT.READ_ONLY);
    instanceTypeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    instanceTypeCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            updateInstanceTypeInformation();
        }
    });
    populateValidInstanceTypes();
    new Label(parent, SWT.NONE);
    createInstanceTypeDetailsComposite(parent);
    // Create the availability zone combo; zones are loaded when the page
    // becomes visible
    newLabel(parent, "Availability Zone:");
    availabilityZoneCombo = new Combo(parent, SWT.READ_ONLY);
    availabilityZoneCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    SelectionListener selectionListener = new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            updateControls();
        }
    };
    newLabel(parent, "Key Pair:");
    keyPairComposite = new KeyPairComposite(parent);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 100;
    keyPairComposite.setLayoutData(gridData);
    keyPairComposite.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            updateControls();
        }
    });
    newLabel(parent, "Security Group:");
    securityGroupSelectionComposite = new SecurityGroupSelectionComposite(parent);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 100;
    securityGroupSelectionComposite.setLayoutData(gridData);
    securityGroupSelectionComposite.addSelectionListener(selectionListener);
    newLabel(parent, "Instance Profile:");
    instanceProfileCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    instanceProfileCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    instanceProfileCombo.setItems(new String[] { NO_INSTANCE_PROFILE });
    instanceProfileCombo.select(0);
    newLabel(parent, "User Data:");
    userDataText = new Text(parent, SWT.MULTI | SWT.BORDER);
    userDataText.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.heightHint = 85;
    userDataText.setLayoutData(gridData);
    userDataText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            updateControls();
        }
    });
    ChargeWarningComposite chargeWarningComposite = new ChargeWarningComposite(parent, SWT.NONE);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.widthHint = 150;
    chargeWarningComposite.setLayoutData(data);
    updateControls();
    this.setControl(parent);
}

42. CreateStackWizardFirstPage#createTimeoutControl()

Project: aws-toolkit-eclipse
File: CreateStackWizardFirstPage.java
private void createTimeoutControl(final Composite comp) {
    new Label(comp, SWT.None).setText("Creation Timeout:");
    Combo timeoutCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(timeoutCombo);
    timeoutCombo.setItems(new String[] { "None", "5 minutes", "10 minutes", "15 minutes", "20 minutes", "30 minutes", "60 minutes", "90 minutes" });
    timeoutCombo.select(0);
    UpdateValueStrategy timeoutUpdateStrategy = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
    timeoutUpdateStrategy.setConverter(new IConverter() {

        public Object getToType() {
            return Integer.class;
        }

        public Object getFromType() {
            return String.class;
        }

        public Object convert(Object fromObject) {
            String value = (String) fromObject;
            if ("None".equals(value)) {
                return 0;
            } else {
                String minutes = value.substring(0, value.indexOf(' '));
                return Integer.parseInt(minutes);
            }
        }
    });
    bindingContext.bindValue(SWTObservables.observeSelection(timeoutCombo), timeoutMinutes, timeoutUpdateStrategy, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER)).updateTargetToModel();
}

43. QueueEditorPage#createControls()

Project: team-explorer-everywhere
File: QueueEditorPage.java
private void createControls(final Composite composite) {
    final GridLayout layout = new GridLayout(1, false);
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    final Composite header = new Composite(composite, SWT.NONE);
    GridDataBuilder.newInstance().hFill().hGrab().applyTo(header);
    /* Compute metrics in pixels */
    final GC gc = new GC(header);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();
    final GridLayout headerLayout = new GridLayout(3, false);
    headerLayout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    headerLayout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    headerLayout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    headerLayout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    header.setLayout(headerLayout);
    //$NON-NLS-1$
    SWTUtil.createLabel(header, Messages.getString("QueueEditorPage.BuildDefinitionLabelText"));
    //$NON-NLS-1$
    SWTUtil.createLabel(header, Messages.getString("QueueEditorPage.StatusFilterLabelText"));
    SWTUtil.createLabel(header, buildServer.getBuildServerVersion().isV3OrGreater() ? //$NON-NLS-1$
    Messages.getString("QueueEditorPage.ControlFilterLabelText") : //$NON-NLS-1$
    Messages.getString("QueueEditorPage.AgentFilterLabelText"));
    buildDefinitionFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().hGrab().applyTo(buildDefinitionFilterCombo);
    statusFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().applyTo(statusFilterCombo);
    ControlSize.setCharWidthHint(statusFilterCombo, 25);
    controllerFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().applyTo(controllerFilterCombo);
    ControlSize.setCharWidthHint(controllerFilterCombo, 30);
    onlyMyBuildsCheck = new Button(header, SWT.CHECK);
    //$NON-NLS-1$
    onlyMyBuildsCheck.setText(Messages.getString("BuildEditorPage.OnlyMyBuilds"));
    onlyMyBuildsCheck.setEnabled(buildServer.getBuildServerVersion().isV3OrGreater());
    GridDataBuilder.newInstance().fill().hSpan(3).applyTo(onlyMyBuildsCheck);
    final Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(separator);
    queuedBuildsTable = new QueuedBuildsTableControl(composite, SWT.MULTI | SWT.FULL_SELECTION | TableControl.NO_BORDER, buildServer);
    GridDataBuilder.newInstance().hSpan(layout).grab().fill().applyTo(queuedBuildsTable);
    queuedBuildsTable.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(final DoubleClickEvent event) {
            onDoubleClick(event);
        }
    });
    queuedBuildsTable.getContextMenu().addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillMenu(manager);
        }
    });
    populateCombos(false);
    getSite().setSelectionProvider(this);
    buildDefinitionFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    statusFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    controllerFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    onlyMyBuildsCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
}

44. BuildEditorPage#createControls()

Project: team-explorer-everywhere
File: BuildEditorPage.java
private void createControls(final Composite composite) {
    final GridLayout layout = new GridLayout(1, false);
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    final Composite header = new Composite(composite, SWT.NONE);
    GridDataBuilder.newInstance().hFill().hGrab().applyTo(header);
    /* Compute metrics in pixels */
    final GC gc = new GC(header);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();
    final GridLayout headerLayout = new GridLayout(3, false);
    headerLayout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    headerLayout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    headerLayout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    headerLayout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    header.setLayout(headerLayout);
    //$NON-NLS-1$
    SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.BuildDefinitionLabelText"));
    //$NON-NLS-1$
    SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.QualityFilterLabelText"));
    //$NON-NLS-1$
    SWTUtil.createLabel(header, Messages.getString("BuildEditorPage.DateFilterLabelText"));
    buildDefinitionFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().hGrab().applyTo(buildDefinitionFilterCombo);
    qualityFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().applyTo(qualityFilterCombo);
    ControlSize.setCharWidthHint(qualityFilterCombo, 30);
    dateFilterCombo = new Combo(header, SWT.READ_ONLY);
    GridDataBuilder.newInstance().fill().applyTo(dateFilterCombo);
    ControlSize.setCharWidthHint(dateFilterCombo, 25);
    onlyMyBuildsCheck = new Button(header, SWT.CHECK);
    //$NON-NLS-1$
    onlyMyBuildsCheck.setText(Messages.getString("BuildEditorPage.OnlyMyBuilds"));
    onlyMyBuildsCheck.setEnabled(buildServer.getBuildServerVersion().isV3OrGreater());
    GridDataBuilder.newInstance().fill().hSpan(3).applyTo(onlyMyBuildsCheck);
    final Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(separator);
    buildsTableControl = new BuildsTableControl(composite, SWT.MULTI | SWT.FULL_SELECTION | TableControl.NO_BORDER, buildServer, teamProject);
    GridDataBuilder.newInstance().grab().fill().applyTo(buildsTableControl);
    buildsTableControl.addDoubleClickListener(new IDoubleClickListener() {

        @Override
        public void doubleClick(final DoubleClickEvent event) {
            onDoubleClick(event);
        }
    });
    buildsTableControl.getContextMenu().addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillMenu(manager);
        }
    });
    // Add listener to be informed when build details are changed and our
    // copy might become stale. Remove the listener on dispose.
    BuildHelpers.getBuildManager().addBuildManagerListener(buildManagerListener);
    buildsTableControl.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(final DisposeEvent e) {
            BuildHelpers.getBuildManager().removeBuildManagerListener(buildManagerListener);
        }
    });
    populateCombos(false);
    buildDefinitionFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    dateFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    qualityFilterCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    onlyMyBuildsCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            filterChanged();
        }
    });
    getSite().setSelectionProvider(this);
    if (buildServer.getBuildServerVersion().isV1()) {
        //$NON-NLS-1$
        dateFilterCombo.setText(Messages.getString("BuildEditorPage.AnyTimeChoice"));
        dateFilterCombo.setEnabled(false);
        qualityFilterCombo.setEnabled(false);
    }
}

45. LinkDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: LinkDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);
    /*
         * create top label
         */
    final Label label = new Label(dialogArea, SWT.NONE);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);
    //$NON-NLS-1$
    label.setText(Messages.getString("LinkDialog.SelectLinkTypeLabelText"));
    /*
         * create combo label
         */
    final Label linkTypeLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    linkTypeLabel.setText(Messages.getString("LinkDialog.LinkTypeLabelText"));
    /*
         * create link combo
         */
    final Combo linkTypeCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    linkTypeCombo.setLayoutData(gd);
    /*
         * populate the link combo
         */
    populateLinkTypeCombo(linkTypeCombo);
    /*
         * create link details group
         */
    final Group linkDetailsGroup = new Group(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    linkDetailsGroup.setText(Messages.getString("LinkDialog.DetailsGroupText"));
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    linkDetailsGroup.setLayoutData(gd);
    /*
         * populate the details group
         */
    populateLinkDetailsGroup(linkDetailsGroup);
    /*
         * create the selection listener for the link type combo
         */
    linkTypeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectedIndex = linkTypeCombo.getSelectionIndex();
            processSelectedLinkType();
            linkDetailsGroupStack.topControl = getSelectedComposite();
            linkDetailsGroup.layout();
        }
    });
}

46. CheckoutDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: CheckoutDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    dialogArea.setLayout(layout);
    itemSpecTable = new TypedItemSpecTable(dialogArea, SWT.CHECK | SWT.MULTI);
    itemSpecTable.setTypedItemSpecs(initialItemSpecs);
    //$NON-NLS-1$
    itemSpecTable.setText(Messages.getString("CheckoutDialog.FilesLabelText"));
    GridDataBuilder.newInstance().hSpan(2).grab().fill().applyTo(itemSpecTable);
    ControlSize.setCharHeightHint(itemSpecTable, 10);
    final Label lockTypeLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    lockTypeLabel.setText(Messages.getString("CheckoutDialog.LockTypeLabelText"));
    final Combo lockTypeCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    AutomationIDHelper.setWidgetID(lockTypeCombo, LOCK_LEVEL_COMBO_ID);
    final LockLevelComboItem[] enabledLockLevelItems = getEnabledLockLevelItems();
    //$NON-NLS-1$
    Check.notNull(enabledLockLevelItems, "enabledLockLevelItems");
    final String[] descriptions = new String[enabledLockLevelItems.length];
    String currentDescription = null;
    for (int i = 0; i < enabledLockLevelItems.length; i++) {
        descriptions[i] = enabledLockLevelItems[i].getDescription();
        if (enabledLockLevelItems[i].getLockLevel().equals(lockLevel)) {
            currentDescription = enabledLockLevelItems[i].getDescription();
        }
    }
    lockTypeCombo.setItems(descriptions);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(lockTypeCombo);
    lockTypeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final LockLevelComboItem[] enabledLockLevelItems = getEnabledLockLevelItems();
            final int selectedIndex = ((Combo) e.getSource()).getSelectionIndex();
            lockLevel = enabledLockLevelItems[selectedIndex].getLockLevel();
        }

        ;
    });
    /*
         * Users may be forcing a specific lock level (for example, when the
         * server is configured to force checkout locks.)
         */
    if (lockLevelForced == true) {
        lockTypeCombo.setText(currentDescription != null ? currentDescription : lockLevel.toUIString());
        lockTypeCombo.setEnabled(false);
    } else {
        lockLevel = getDefaultLockLevelItem().getLockLevel();
        lockTypeCombo.setText(getDefaultLockLevelItem().getDescription());
    }
    /*
         * TODO: description of the version being checked out -- if force get
         * latest is on (on the client or server) we should report that.
         */
    itemSpecTable.checkAll();
}

47. AnnotationConfigPage#createPage()

Project: scouter
File: AnnotationConfigPage.java
public void createPage(final Composite composite) {
    this.composite = composite;
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setLayout(new GridLayout(2, false));
    final Label nameLabel = new Label(composite, 0);
    nameLabel.setText(Messages.Annotation_Name);
    nameLabel.setLayoutData(new GridData());
    nameText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    nameText.setToolTipText(Messages.Annotation_NameTT);
    nameText.setLayoutData(new GridData(SWT.FILL, 0, true, false));
    snapToTrace = new Button(composite, SWT.CHECK);
    snapToTrace.setText(Messages.Annotation_Snap);
    snapToTrace.setToolTipText(Messages.Annotation_SnapTT);
    snapToTrace.setLayoutData(new GridData(0, 0, false, false, 2, 1));
    xAxisLabel = new Label(composite, 0);
    xAxisLabel.setLayoutData(new GridData());
    xAxisOrTraceCombo = new Combo(composite, SWT.DROP_DOWN);
    xAxisOrTraceCombo.setLayoutData(new GridData(SWT.FILL, 0, true, false));
    yAxisLabel = new Label(composite, 0);
    yAxisLabel.setText(Messages.Annotation_YAxis);
    yAxisLabel.setLayoutData(new GridData());
    yAxisCombo = new Combo(composite, SWT.DROP_DOWN);
    yAxisCombo.setToolTipText(Messages.Annotation_YAxisSnapTT);
    yAxisCombo.setLayoutData(new GridData(SWT.FILL, 0, true, false));
    //snapToTrace listener
    snapToTrace.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (snapToTrace.getSelection()) {
                xAxisLabel.setText(Messages.Annotation_Trace);
                xAxisOrTraceCombo.setToolTipText(Messages.Annotation_TraceSnapTT);
            } else {
                xAxisLabel.setText(Messages.Annotation_XAxis);
                xAxisOrTraceCombo.setToolTipText(Messages.Annotation_XAxisSnapTT);
            }
            xAxisOrTraceCombo.removeAll();
            if (snapToTrace.getSelection()) {
                for (Trace trace : xyGraph.getPlotArea().getTraceList()) xAxisOrTraceCombo.add(trace.getName());
            } else {
                for (Axis axis : xyGraph.getXAxisList()) xAxisOrTraceCombo.add(axis.getTitle());
            }
            xAxisOrTraceCombo.select(0);
            if (annotation.isFree() && !snapToTrace.getSelection())
                xAxisOrTraceCombo.select(xyGraph.getXAxisList().indexOf(annotation.getXAxis()));
            else if (!annotation.isFree() && snapToTrace.getSelection())
                xAxisOrTraceCombo.select(xyGraph.getPlotArea().getTraceList().indexOf(annotation.getTrace()));
            yAxisLabel.setVisible(!snapToTrace.getSelection());
            yAxisCombo.setVisible(!snapToTrace.getSelection());
            composite.layout(true, true);
        }
    });
    //annotation color
    useDefaultColorButton = new Button(composite, SWT.CHECK);
    useDefaultColorButton.setText(Messages.Annotation_ColorFromYAxis);
    useDefaultColorButton.setLayoutData(new GridData(SWT.FILL, 0, false, false, 2, 1));
    colorLabel = new Label(composite, 0);
    colorLabel.setText(Messages.Annotation_Color);
    colorLabel.setLayoutData(new GridData());
    colorSelector = new ColorSelector(composite);
    colorSelector.getButton().setLayoutData(new GridData());
    useDefaultColorButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            colorSelector.getButton().setVisible(!useDefaultColorButton.getSelection());
            colorLabel.setVisible(!useDefaultColorButton.getSelection());
        }
    });
    fontLabel = new Label(composite, 0);
    fontLabel.setLayoutData(new GridData());
    final Button fontButton = new Button(composite, SWT.PUSH);
    fontButton.setText(Messages.Annotation_ChangeFont);
    fontButton.setLayoutData(new GridData());
    fontButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FontDialog fontDialog = new FontDialog(composite.getShell());
            if (font != null)
                fontDialog.setFontList(font.getFontData());
            FontData fontData = fontDialog.open();
            if (fontData != null) {
                font = XYGraphMediaFactory.getInstance().getFont(fontData);
                fontLabel.setFont(font);
                fontLabel.setText(Messages.Annotation_Font + fontData.getName());
                composite.getShell().layout(true, true);
            }
        }
    });
    final Label cursorLineLabel = new Label(composite, 0);
    cursorLineLabel.setText(Messages.Annotation_Cursor);
    cursorLineLabel.setLayoutData(new GridData());
    cursorLineCombo = new Combo(composite, SWT.DROP_DOWN);
    cursorLineCombo.setItems(CursorLineStyle.stringValues());
    cursorLineCombo.setLayoutData(new GridData());
    showNameButton = new Button(composite, SWT.CHECK);
    showNameButton.setText(Messages.Annotation_ShowName);
    showNameButton.setLayoutData(new GridData(0, 0, false, false, 2, 1));
    showSampleInfoButton = new Button(composite, SWT.CHECK);
    showSampleInfoButton.setText(Messages.Annotation_ShowInfo);
    showSampleInfoButton.setLayoutData(new GridData(0, 0, false, false, 2, 1));
    showPositionButton = new Button(composite, SWT.CHECK);
    showPositionButton.setText(Messages.Annotation_ShowPosition);
    showPositionButton.setLayoutData(new GridData(0, 0, false, false, 2, 1));
    initialize();
}

48. NewsActionItem#initComponents()

Project: RSSOwl
File: NewsActionItem.java
private void initComponents() {
    setLayout(LayoutUtils.createGridLayout(2, 5, 5));
    /* Chooser for Action */
    Combo combo = new Combo(this, SWT.READ_ONLY | SWT.BORDER);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    fViewer = new ComboViewer(combo);
    fViewer.setContentProvider(new ArrayContentProvider());
    fViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((NewsActionDescriptor) element).getName();
        }
    });
    Collection<NewsActionDescriptor> actions = fNewsActionPresentationManager.getSortedNewsActions();
    fViewer.setInput(actions);
    combo.setVisibleItemCount(actions.size());
    /* Properly set Selection */
    NewsActionDescriptor selectedFilterAction = null;
    for (NewsActionDescriptor action : actions) {
        if (action.getActionId().equals(fInitialFilterAction.getActionId())) {
            fViewer.setSelection(new StructuredSelection(action));
            selectedFilterAction = action;
            updateInfoControl(action);
            break;
        }
    }
    /* Update Presentation on Selection Changes */
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            NewsActionDescriptor descriptor = (NewsActionDescriptor) selection.getFirstElement();
            showFilterAction(descriptor, null);
            updateInfoControl(descriptor);
        }
    });
    if (selectedFilterAction != null)
        showFilterAction(selectedFilterAction, fInitialFilterAction.getData());
}

49. ProjectOrganizationPage#initEnviornmentDefaults()

Project: idecore
File: ProjectOrganizationPage.java
// set defaults and/or last used
private void initEnviornmentDefaults() {
    Combo cmbEndpointServers = projectOrganizationComposite.getCmbEndpointServer();
    Combo cmbEnvironment = projectOrganizationComposite.getCmbEnvironment();
    // environment
    String lastEnvironmentSelected = ForceIdeCorePlugin.getPreferenceString(Constants.LAST_ENV_SELECTED);
    String selectedEndpointLabel = getSalesforceEndpoints().getDefaultEndpointLabel();
    if (Utils.isNotEmpty(lastEnvironmentSelected) && (getSalesforceEndpoints().isValidEndpointLabel(lastEnvironmentSelected) || OTHER_LABEL_NAME.equals(lastEnvironmentSelected))) {
        selectCombo(cmbEnvironment, lastEnvironmentSelected);
    } else if (Utils.isNotEmpty(selectedEndpointLabel)) {
        selectCombo(cmbEnvironment, selectedEndpointLabel);
    } else {
        cmbEnvironment.select(0);
    }
    // server
    String lastServerSelected = ForceIdeCorePlugin.getPreferenceString(Constants.LAST_SERVER_SELECTED);
    if (Utils.isNotEmpty(lastServerSelected)) {
        selectCombo(cmbEndpointServers, lastServerSelected);
    } else {
        cmbEndpointServers.select(0);
    }
    // keep endpoint and protocol
    boolean lastKeepEndpointSelected = ForceIdeCorePlugin.getPreferenceBoolean(Constants.LAST_KEEP_ENDPOINT_SELECTED);
    projectOrganizationComposite.getChkBoxResetEndpoint().setSelection(lastKeepEndpointSelected);
    String username = ForceIdeCorePlugin.getPreferenceString(Constants.LAST_USERNAME_SELECTED);
    if (Utils.isNotEmpty(username)) {
        projectOrganizationComposite.setTxtUsername(username);
    }
    // set visibility of advanced server stuff
    projectOrganizationComposite.enableServerEntryControls();
}

50. DeploymentDestinationSettingsPage#initEnviornmentDefaults()

Project: idecore
File: DeploymentDestinationSettingsPage.java
// set defaults and/or last used
private void initEnviornmentDefaults() {
    Combo cmbEndpointServers = destinationSettingsComposite.getCmbEndpointServer();
    Combo cmbEnvironment = destinationSettingsComposite.getCmbEnvironment();
    // environment
    String lastEnvironmentSelected = ForceIdeDeploymentPlugin.getPreferenceString(DeploymentConstants.LAST_DEPLOYMENT_ENV_SELECTED);
    String selectedEndpointLabel = getSalesforceEndpoints().getDefaultEndpointLabel();
    if (Utils.isNotEmpty(lastEnvironmentSelected)) {
        selectCombo(cmbEnvironment, lastEnvironmentSelected);
    } else if (Utils.isNotEmpty(selectedEndpointLabel)) {
        selectCombo(cmbEnvironment, selectedEndpointLabel);
    } else {
        cmbEnvironment.select(0);
    }
    // server
    String lastServerSelected = ForceIdeDeploymentPlugin.getPreferenceString(DeploymentConstants.LAST_DEPLOYMENT_SERVER_SELECTED);
    if (Utils.isNotEmpty(lastServerSelected)) {
        selectCombo(cmbEndpointServers, lastServerSelected);
    } else {
        cmbEndpointServers.select(0);
    }
    // keep endpoint and protocol
    boolean lastKeepEndpointSelected = ForceIdeDeploymentPlugin.getPreferenceBoolean(DeploymentConstants.LAST_DEPLOYMENT_KEEP_ENDPOINT_SELECTED);
    destinationSettingsComposite.getChkBoxResetEndpoint().setSelection(lastKeepEndpointSelected);
    String username = ForceIdeDeploymentPlugin.getPreferenceString(DeploymentConstants.LAST_DEPLOYMENT_USERNAME_SELECTED);
    if (Utils.isNotEmpty(username)) {
        destinationSettingsComposite.setTxtUsername(username);
    }
    // set visibility of advanced server stuff
    destinationSettingsComposite.enableServerEntryControls();
}

51. ComboBoxField#createFieldCombo()

Project: goclipse
File: ComboBoxField.java
/* -----------------  ----------------- */
public static Combo createFieldCombo(final FieldWidget<Integer> field, Composite parent, int style) {
    final Combo combo = new Combo(parent, style);
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = combo.getSelectionIndex();
            field.setFieldValueFromControl(selectionIndex);
        }
    });
    return combo;
}

52. JavaHomeSectionImpl#createWidgets()

Project: eclipse-integration-gradle
File: JavaHomeSectionImpl.java
/**
	 * This does more or less what a PageSection implementation of createContents should do (i.e. 
	 * create the widgets on the page).
	 * <p>
	 * However, it does not fill the widget contents with the contents of the preferences because
	 * this implementation may not yet be connected to a preferences store yet when the widgets
	 * are being created. It is up to the caller/client to make sure a to call copyFrom method
	 * to (re)initialise the widget contents at an appropriate time. 
	 * 
	 * @param page
	 */
public void createWidgets(Composite page) {
    GridDataFactory grabHor = GridDataFactory.fillDefaults().grab(true, false);
    Group group = null;
    if (!border) {
        Label label = new Label(page, SWT.NONE);
        label.setText(TITLE);
    } else {
        group = new Group(page, SWT.BORDER);
        group.setText(TITLE);
    }
    //Alternative 1
    Composite composite = border ? group : new Composite(page, SWT.NONE);
    GridLayout layout = new GridLayout(3, false);
    composite.setLayout(layout);
    grabHor.applyTo(composite);
    defaultButton = new Button(composite, SWT.RADIO);
    defaultButton.setText("Use Gradle wrapper's default");
    GridDataFactory span = GridDataFactory.fillDefaults().span(3, 1);
    span.applyTo(defaultButton);
    //Alternative 2: choose a workspace JRE
    customHomeButton = new Button(composite, SWT.RADIO);
    customHomeButton.setText("Workspace JRE: ");
    customHomeButton.setToolTipText("Use a specific Java installation configured in this workspace");
    customJRECombo = new Combo(composite, SWT.DROP_DOWN + SWT.READ_ONLY);
    configureJREsButton = new Button(composite, SWT.PUSH);
    configureJREsButton.setText("Configure JREs");
    grabHor.applyTo(configureJREsButton);
    grabHor.applyTo(customJRECombo);
    //Alternative 3: choose an execution environment
    customExecutionEnvButton = new Button(composite, SWT.RADIO);
    customExecutionEnvButton.setText("Execution Environment");
    customExecutionEnvButton.setToolTipText("Specify a JRE indirectly via an execution environment");
    customExecutionEnvCombo = new Combo(composite, SWT.DROP_DOWN + SWT.READ_ONLY);
    configureExecEnvsButton = new Button(composite, SWT.PUSH);
    configureExecEnvsButton.setText("Configure EEs");
    grabHor.applyTo(configureExecEnvsButton);
    grabHor.applyTo(customExecutionEnvCombo);
    refreshJREs();
    customHomeButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            enableDisableWidgets(customHomeButton, customJRECombo, configureJREsButton);
            doRefresh();
        }
    });
    customExecutionEnvButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            enableDisableWidgets(customExecutionEnvButton, customExecutionEnvCombo, configureExecEnvsButton);
            doRefresh();
        }
    });
    configureJREsButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            @SuppressWarnings("restriction") IPreferencePage page = new org.eclipse.jdt.internal.debug.ui.jres.JREsPreferencePage();
            PreferenceManager mgr = new PreferenceManager();
            IPreferenceNode node = new PreferenceNode("1", page);
            mgr.addToRoot(node);
            PreferenceDialog dialog = new PreferenceDialog(owner.getShell(), mgr);
            dialog.create();
            dialog.setMessage(page.getTitle());
            dialog.open();
            refreshJREs();
        }
    });
    configureExecEnvsButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            @SuppressWarnings("restriction") IPreferencePage page = new org.eclipse.jdt.internal.debug.ui.jres.ExecutionEnvironmentsPreferencePage();
            PreferenceManager mgr = new PreferenceManager();
            IPreferenceNode node = new PreferenceNode("1", page);
            mgr.addToRoot(node);
            PreferenceDialog dialog = new PreferenceDialog(owner.getShell(), mgr);
            dialog.create();
            dialog.setMessage(page.getTitle());
            dialog.open();
            refreshJREs();
        }
    });
    customJRECombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            doRefresh();
        }
    });
    customExecutionEnvCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            doRefresh();
        }
    });
    grabHor.applyTo(customJRECombo);
}

53. ChooseOneSectionCombo#createContents()

Project: eclipse-integration-commons
File: ChooseOneSectionCombo.java
@Override
public void createContents(Composite page) {
    Composite field = new Composite(page, SWT.NONE);
    GridLayout layout = GridLayoutFactory.fillDefaults().numColumns(2).create();
    field.setLayout(layout);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(field);
    Label fieldNameLabel = new Label(field, SWT.NONE);
    fieldNameLabel.setText(label);
    GridDataFactory.fillDefaults().hint(UIConstants.fieldLabelWidthHint(fieldNameLabel), SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(fieldNameLabel);
    final Combo combo = new Combo(field, inputParser == null ? SWT.READ_ONLY : SWT.NONE);
    options.addListener(new ValueListener<T[]>() {

        public void gotValue(org.springsource.ide.eclipse.commons.livexp.core.LiveExpression<T[]> exp, T[] value) {
            if (combo != null) {
                String oldText = combo.getText();
                //This will clear the selection sometimes
                combo.setItems(getLabels());
                combo_setText(combo, oldText);
            }
        }

        ;
    });
    if (inputParser == null) {
        GridDataFactory.fillDefaults().applyTo(combo);
    } else {
        GridDataFactory.fillDefaults().hint(FIELD_TEXT_AREA_WIDTH, SWT.DEFAULT).applyTo(combo);
    }
    combo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            handleModifyText(combo);
        }
    });
    selection.selection.addListener(new ValueListener<T>() {

        public void gotValue(LiveExpression<T> exp, T newSelection) {
            if (newSelection != null) {
                //Technically, not entirely correct. This might
                // select the wrong element if more than one option
                // has the same label text.
                String newText = labelProvider.getText(newSelection);
                combo_setText(combo, newText);
                if (!combo.getText().equals(newText)) {
                    //widget rejected the selection. To avoid widget state
                    // and model state getting out-of-sync, refelct current
                    // widget state back to the model:
                    handleModifyText(combo);
                }
            }
        }
    });
}

54. NewMavenPomPage#createProcessCombo()

Project: depan
File: NewMavenPomPage.java
private Combo createProcessCombo(Composite container) {
    Combo result = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (PomProcessing item : PomProcessing.values()) {
        result.add(item.label);
    }
    result.select(0);
    return result;
}

55. NewGraphMLPage#createProcessCombo()

Project: depan
File: NewGraphMLPage.java
private Combo createProcessCombo(Composite container) {
    Combo result = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
    for (GraphMLProcessing item : GraphMLProcessing.values()) {
        result.add(item.label);
    }
    result.select(0);
    return result;
}

56. PostgreCreateSchemaDialog#createDialogArea()

Project: dbeaver
File: PostgreCreateSchemaDialog.java
@Override
protected Composite createDialogArea(Composite parent) {
    final Composite composite = super.createDialogArea(parent);
    final Composite group = new Composite(composite, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    final Text nameText = UIUtils.createLabelText(group, "Schema name", "");
    nameText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            name = nameText.getText();
            getButton(IDialogConstants.OK_ID).setEnabled(!name.isEmpty());
        }
    });
    final Combo userCombo = UIUtils.createLabelCombo(group, "Owner", SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY);
    userCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            owner = allUsers.get(userCombo.getSelectionIndex());
        }
    });
    new AbstractJob("Load users") {

        @Override
        protected IStatus run(DBRProgressMonitor monitor) {
            try {
                final List<String> userNames = new ArrayList<>();
                allUsers = new ArrayList<>(database.getUsers(monitor));
                final PostgreAuthId dba = database.getDBA(monitor);
                final String defUserName = dba == null ? "" : dba.getName();
                UIUtils.runInUI(null, new Runnable() {

                    @Override
                    public void run() {
                        for (PostgreAuthId authId : allUsers) {
                            String name = authId.getName();
                            userCombo.add(name);
                            if (name.equals(defUserName)) {
                                owner = authId;
                            }
                        }
                        userCombo.setText(defUserName);
                    }
                });
            } catch (DBException e) {
                return GeneralUtils.makeExceptionStatus(e);
            }
            return Status.OK_STATUS;
        }
    }.schedule();
    return composite;
}

57. PrefPageConfirmations#createConfirmCheckbox()

Project: dbeaver
File: PrefPageConfirmations.java
private void createConfirmCheckbox(Composite parent, String id) {
    ResourceBundle bundle = DBeaverActivator.getCoreResourceBundle();
    String labelKey = ConfirmationDialog.getResourceKey(id, ConfirmationDialog.RES_KEY_TITLE);
    UIUtils.createControlLabel(parent, bundle.getString(labelKey));
    Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    //UIUtils.createCheckbox(parent, bundle.getString(labelKey), false);
    combo.setItems(new String[] { CoreMessages.pref_page_confirmations_combo_always, CoreMessages.pref_page_confirmations_combo_never, CoreMessages.pref_page_confirmations_combo_prompt });
    confirmChecks.put(id, combo);
}

58. RunFrameworkPart#createSection()

Project: bndtools
File: RunFrameworkPart.java
final void createSection(Section section, FormToolkit tk) {
    section.setText("Core Runtime");
    Composite composite = tk.createComposite(section);
    section.setClient(composite);
    Label lblFramework = new Label(composite, SWT.NONE);
    tk.adapt(lblFramework, true, true);
    lblFramework.setText("OSGi Framework:");
    cmbFramework = new Combo(composite, SWT.DROP_DOWN);
    tk.adapt(cmbFramework);
    tk.paintBordersFor(cmbFramework);
    cmbFramework.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    frameworkViewer = new ComboViewer(cmbFramework);
    frameworkViewer.setUseHashlookup(true);
    frameworkViewer.setContentProvider(fwkContentProvider);
    Label lblExecEnv = tk.createLabel(composite, "Execution Env.:");
    cmbExecEnv = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    ControlDecoration eeDecor = new ControlDecoration(cmbExecEnv, SWT.LEFT | SWT.TOP, composite);
    eeDecor.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
    eeDecor.setDescriptionText("The runtime Java Virtual Machine will be required/assumed " + "\nto support this Execution Environment");
    eeViewer = new ComboViewer(cmbExecEnv);
    eeViewer.setContentProvider(ArrayContentProvider.getInstance());
    eeViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return ((EE) element).getEEName();
        }
    });
    eeViewer.setInput(EE.values());
    // Listeners
    cmbFramework.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    selectedFramework = cmbFramework.getText();
                }
            });
        }
    });
    frameworkViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    Object element = ((IStructuredSelection) frameworkViewer.getSelection()).getFirstElement();
                    if (element == null)
                        selectedFramework = null;
                    else
                        selectedFramework = element.toString();
                }
            });
        }
    });
    eeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(final SelectionChangedEvent event) {
            lock.ifNotModifying(new Runnable() {

                @Override
                public void run() {
                    markDirty();
                    selectedEE = (EE) ((IStructuredSelection) event.getSelection()).getFirstElement();
                }
            });
        }
    });
    GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing = 10;
    composite.setLayout(layout);
    lblFramework.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    GridData gd;
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.widthHint = 20;
    gd.heightHint = 20;
    cmbFramework.setLayoutData(gd);
    lblExecEnv.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.widthHint = 20;
    gd.heightHint = 20;
    cmbExecEnv.setLayoutData(gd);
}

59. WAEndpointDialog#createEndptTypeComponent()

Project: azure-tools-for-java
File: WAEndpointDialog.java
/**
     * Creates an endpoint type component consisting of label and combo box.
     * Also adds a selection listener to combo box.
     *
     * @param container
     */
private void createEndptTypeComponent(Composite container) {
    Label lblType = new Label(container, SWT.LEFT);
    GridData gridData = new GridData();
    gridData.horizontalIndent = DIALOG_LEFT_MARGIN;
    lblType.setLayoutData(gridData);
    lblType.setText(Messages.adRolType);
    comboType = new Combo(container, SWT.READ_ONLY);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    comboType.setLayoutData(gridData);
    comboType.setItems(arrType);
    comboType.setText(arrType[0]);
    final Combo comboTemp = comboType;
    comboType.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            String comboTxt = comboTemp.getText();
            String portTxt = txtPrivatePort.getText();
            enableControlsDependingOnEnpointType(comboTxt);
            /*
        		 * auto not allowed for InstanceInput endpoint,
        		 * hence clear it.
        		 */
            if (comboTxt.equalsIgnoreCase(WindowsAzureEndpointType.InstanceInput.toString()) && portTxt.equalsIgnoreCase(auto)) {
                txtPrivatePort.setText("");
            } else if (comboTxt.equalsIgnoreCase(WindowsAzureEndpointType.Input.toString()) && (portTxt.isEmpty() || portTxt.equalsIgnoreCase("*"))) {
                txtPrivatePort.setText(auto);
            } else if (comboTxt.equalsIgnoreCase(WindowsAzureEndpointType.Internal.toString()) && (portTxt.isEmpty() || portTxt.equalsIgnoreCase("*")) && txtPrivatePortRangeEnd.getText().isEmpty()) {
                txtPrivatePort.setText(auto);
            }
        }
    });
}

60. JdkSrvConfig#createThirdPartyJdkCombo()

Project: azure-tools-for-java
File: JdkSrvConfig.java
/**
	 * Method creates third party JDK combo box.
	 * @param parent
	 * @return
	 */
public static Combo createThirdPartyJdkCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    GridData groupGridData = new GridData();
    groupGridData.horizontalSpan = 2;
    groupGridData.horizontalIndent = 17;
    groupGridData.widthHint = 382;
    combo.setLayoutData(groupGridData);
    return combo;
}

61. WAWinAzurePropertyPage#createContents()

Project: azure-tools-for-java
File: WAWinAzurePropertyPage.java
/**
     * Draw controls for property page.
     *
     *  @param parent
     *
     *  @return Control on which controls(button/label) are drawn
     */
@Override
protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();
    //display help content
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "com.persistent.winazure.eclipseplugin." + "windows_azure_project_project_property");
    loadProject();
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    container.setLayout(gridLayout);
    Label lblServiceName = new Label(container, SWT.LEFT);
    lblServiceName.setText(Messages.proPageServName);
    txtServiceName = new Text(container, SWT.SINGLE | SWT.BORDER);
    try {
        txtServiceName.setText(waProjManager.getServiceName());
    } catch (WindowsAzureInvalidProjectOperationException e) {
        errorMessage = Messages.proPageErrMsgBox1 + Messages.proPageErrMsgBox2;
        PluginUtil.displayErrorDialogAndLog(this.getShell(), Messages.proPageErrTitle, errorMessage, e);
    }
    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    txtServiceName.setLayoutData(gridData);
    Label lblbuildFor = new Label(container, SWT.LEFT);
    lblbuildFor.setText(Messages.proPageBldForLbl);
    comboType = new Combo(container, SWT.READ_ONLY);
    comboType.setLayoutData(gridData);
    comboType.setItems(arrType);
    Label lblTargetOS = new Label(container, SWT.LEFT);
    lblTargetOS.setText(Messages.proPageTgtOSLbl);
    targetOSComboType = new Combo(container, SWT.READ_ONLY);
    targetOSComboType.setLayoutData(gridData);
    List<String> osNames = new ArrayList<String>();
    for (OSFamilyType osType : OSFamilyType.values()) {
        osNames.add(osType.getName());
    }
    targetOSComboType.setItems(osNames.toArray(new String[osNames.size()]));
    WindowsAzurePackageType type;
    try {
        type = waProjManager.getPackageType();
        if (type.equals(WindowsAzurePackageType.LOCAL)) {
            comboType.setText(arrType[0]);
        } else {
            comboType.setText(arrType[1]);
        }
        //Set current value for target OS
        targetOSComboType.setText(waProjManager.getOSFamily().getName());
    } catch (WindowsAzureInvalidProjectOperationException e) {
        errorMessage = Messages.proPageErrMsgBox1 + Messages.proPageErrMsgBox2;
        PluginUtil.displayErrorDialogAndLog(this.getShell(), Messages.proPageErrTitle, errorMessage, e);
    }
    return container;
}

62. ServiceEndptPreferencePage#createCombo()

Project: azure-tools-for-java
File: ServiceEndptPreferencePage.java
/**
	 * Method to create combo box.
	 * @param parent
	 * @return
	 */
public static Combo createCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    GridData gridData = new GridData();
    gridData.horizontalIndent = 34;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    combo.setLayoutData(gridData);
    return combo;
}

63. NewStorageAccountDialog#createDialogArea()

Project: azure-tools-for-java
File: NewStorageAccountDialog.java
@Override
protected Control createDialogArea(Composite parent) {
    setTitle(Messages.storageNew);
    setMessage(Messages.storageCreateNew);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, Messages.pluginPrefix + Messages.newStorageAccountHelp);
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginBottom = 50;
    GridData gridData = new GridData();
    gridData.widthHint = 30;
    gridData.heightHint = 150;
    gridLayout.numColumns = 2;
    gridData.verticalIndent = 10;
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    gridData.verticalAlignment = SWT.FILL;
    container.setLayout(gridLayout);
    container.setLayoutData(gridData);
    Label hostedServiceLbl = new Label(container, SWT.LEFT);
    hostedServiceLbl.setText(Messages.storageAccountLbl);
    gridData = new GridData();
    gridData.widthHint = 250;
    gridData.horizontalIndent = 10;
    gridData.verticalIndent = 5;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    storageAccountTxt = new Text(container, SWT.BORDER);
    storageAccountTxt.addModifyListener(new ValidateInputCompletion());
    storageAccountTxt.setLayoutData(gridData);
    Label locationLbl = new Label(container, SWT.LEFT);
    locationLbl.setText(Messages.hostedLocationLbl);
    locationComb = new Combo(container, SWT.READ_ONLY);
    locationComb.setLayoutData(gridData);
    locationComb.addModifyListener(new ValidateInputCompletion());
    Label descriptionLbl = new Label(container, SWT.LEFT);
    descriptionLbl.setText(Messages.hostedLocDescLbl);
    descriptionTxt = new Text(container, SWT.BORDER);
    descriptionTxt.setLayoutData(gridData);
    Label subLbl = new Label(container, SWT.LEFT);
    subLbl.setText(Messages.deplSubscriptionLbl);
    subscrptnCombo = new Combo(container, SWT.READ_ONLY);
    subscrptnCombo.setLayoutData(gridData);
    subscrptnCombo = UIUtils.populateSubscriptionCombo(subscrptnCombo);
    subscrptnCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            populateLocations();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
    /*
		 * If subscription name is there,
		 * dialog invoked from publish wizard,
		 * hence disable subscription combo.
		 */
    if (subscription != null && !subscription.isEmpty()) {
        subscrptnCombo.setEnabled(false);
        subscrptnCombo.setText(subscription);
    }
    populateLocations();
    validateDialog();
    return super.createDialogArea(parent);
}

64. ExportTemplateDialog#createCustomArea()

Project: aws-toolkit-eclipse
File: ExportTemplateDialog.java
@Override
protected Control createCustomArea(Composite parent) {
    parent.setLayout(new FillLayout());
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    Group templateNameGroup = new Group(composite, SWT.None);
    templateNameGroup.setLayout(new GridLayout(2, false));
    GridData groupData = new GridData();
    groupData.horizontalSpan = 2;
    templateNameGroup.setLayoutData(groupData);
    // Update existing template
    final Button updateExistingRadioButton = new Button(templateNameGroup, SWT.RADIO);
    updateExistingRadioButton.setText("Update an existing template");
    final Combo existingTemplateNamesCombo = new Combo(templateNameGroup, SWT.READ_ONLY);
    existingTemplateNamesCombo.setEnabled(false);
    if (existingTemplateNames.isEmpty()) {
        updateExistingRadioButton.setEnabled(false);
    } else {
        existingTemplateNamesCombo.setItems(existingTemplateNames.toArray(new String[existingTemplateNames.size()]));
        existingTemplateNamesCombo.select(0);
    }
    // Create new template -- default option
    Button createNewRadioButton = new Button(templateNameGroup, SWT.RADIO);
    createNewRadioButton.setText("Create a new template");
    final Text templateNameText = new Text(templateNameGroup, SWT.BORDER);
    templateNameText.setText(templateName);
    templateNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    updateExistingRadioButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            templateNameText.setEnabled(!updateExistingRadioButton.getSelection());
            existingTemplateNamesCombo.setEnabled(updateExistingRadioButton.getSelection());
        }
    });
    // Description
    new Label(composite, SWT.NONE).setText("Template description: ");
    final Text templateDescriptionText = new Text(composite, SWT.BORDER);
    templateDescriptionText.setText("");
    templateDescriptionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    // Data binding
    bindingContext.bindValue(SWTObservables.observeSelection(createNewRadioButton), isCreatingNew);
    isCreatingNew.setValue(true);
    bindingContext.bindValue(SWTObservables.observeSelection(existingTemplateNamesCombo), existingTemplateName).updateTargetToModel();
    bindingContext.bindValue(SWTObservables.observeText(templateNameText, SWT.Modify), newTemplateName);
    bindingContext.bindValue(SWTObservables.observeText(templateDescriptionText, SWT.Modify), templateDescription);
    WritableSet inUseNames = new WritableSet();
    inUseNames.addAll(existingTemplateNames);
    ChainValidator<String> validator = new ChainValidator<String>(newTemplateName, isCreatingNew, new NotEmptyValidator("Template name cannot be empty"), new NotInListValidator<String>(inUseNames, "Template name already in use"));
    bindingContext.addValidationStatusProvider(validator);
    // Decorate the new name field with error status
    ControlDecoration decoration = new ControlDecoration(templateNameText, SWT.TOP | SWT.LEFT);
    decoration.setDescriptionText("Invalid value");
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    decoration.setImage(fieldDecoration.getImage());
    new DecorationChangeListener(decoration, validator.getValidationStatus());
    return composite;
}

65. AbstractDeployWizardPage#newCombo()

Project: aws-toolkit-eclipse
File: AbstractDeployWizardPage.java
public static Combo newCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    return combo;
}

66. WizardWidgetFactory#newCombo()

Project: aws-toolkit-eclipse
File: WizardWidgetFactory.java
public static Combo newCombo(Composite parent, int colspan) {
    Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.horizontalSpan = colspan;
    combo.setLayoutData(gridData);
    return combo;
}

67. CreateStackWizardFirstPage#createSNSTopicControl()

Project: aws-toolkit-eclipse
File: CreateStackWizardFirstPage.java
private void createSNSTopicControl(final Composite comp, int fieldDecorationWidth) {
    final Button notifyWithSNSButton = new Button(comp, SWT.CHECK);
    notifyWithSNSButton.setText("SNS Topic (Optional):");
    final Combo snsTopicCombo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridDataFactory.fillDefaults().grab(true, false).indent(fieldDecorationWidth, 0).applyTo(snsTopicCombo);
    loadTopics(snsTopicCombo);
    bindingContext.bindValue(SWTObservables.observeSelection(notifyWithSNSButton), notifyWithSNS).updateTargetToModel();
    bindingContext.bindValue(SWTObservables.observeSelection(snsTopicCombo), snsTopicArn).updateTargetToModel();
    ChainValidator<String> snsTopicValidationStatusProvider = new ChainValidator<String>(snsTopicArn, notifyWithSNS, new NotEmptyValidator("Please select an SNS notification topic"));
    bindingContext.addValidationStatusProvider(snsTopicValidationStatusProvider);
    addStatusDecorator(snsTopicCombo, snsTopicValidationStatusProvider);
    final Button newTopicButton = new Button(comp, SWT.PUSH);
    newTopicButton.setText("Create New Topic");
    newTopicButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CreateTopicDialog dialog = new CreateTopicDialog();
            if (dialog.open() == 0) {
                try {
                    AwsToolkitCore.getClientFactory().getSNSClient().createTopic(new CreateTopicRequest().withName(dialog.getTopicName()));
                } catch (Exception ex) {
                    AwsToolkitCore.getDefault().logException("Failed to create new topic", ex);
                }
                loadTopics(snsTopicCombo);
            }
        }
    });
    snsTopicCombo.setEnabled(false);
    newTopicButton.setEnabled(false);
    notifyWithSNSButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean selection = notifyWithSNSButton.getSelection();
            snsTopicCombo.setEnabled(selection);
            newTopicButton.setEnabled(selection);
        }
    });
}

68. GitSourceSettingsControl#createControls()

Project: team-explorer-everywhere
File: GitSourceSettingsControl.java
private void createControls(final Composite composite) {
    final GridLayout layout = SWTUtil.gridLayout(composite, 1);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    final Label helperLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    helperLabel.setText(Messages.getString("GitSourceSettingsControl.SourceSettingHelperLabelText"));
    GridDataBuilder.newInstance().hSpan(layout).fill().hGrab().applyTo(helperLabel);
    SWTUtil.createGridLayoutSpacer(composite);
    Label label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("GitSourceSettingsControl.RepositoryLabelText"));
    GridDataBuilder.newInstance().applyTo(label);
    repoCombo = new Combo(this, SWT.READ_ONLY);
    GridDataBuilder.newInstance().hFill().vAlign(SWT.LEFT).applyTo(repoCombo);
    repoComboViewer = new ComboViewer(repoCombo);
    setupRepoComboViewer();
    label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("GitSourceSettingsControl.RepoLocalPathLabel"));
    GridDataBuilder.newInstance().applyTo(label);
    repoPathText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
    GridDataBuilder.newInstance().hFill().hGrab().applyTo(repoPathText);
    label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("GitSourceSettingsControl.BranchLabelText"));
    GridDataBuilder.newInstance().applyTo(label);
    branchCombo = new Combo(composite, SWT.READ_ONLY);
    GridDataBuilder.newInstance().hFill().vAlign(SWT.LEFT).applyTo(branchCombo);
    label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("GitSourceSettingsControl.MonitoredBranchLabelText"));
    GridDataBuilder.newInstance().applyTo(label);
    final Table table = new Table(composite, SWT.BORDER | SWT.CHECK | SWT.FULL_SELECTION | SWT.MULTI);
    final TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    GridDataBuilder.newInstance().grab().fill().applyTo(table);
    tableLayout.addColumnData(new ColumnWeightData(40, 20, true));
    final TableColumn nameTableColumn = new TableColumn(table, SWT.NONE);
    //$NON-NLS-1$
    nameTableColumn.setText("Branch");
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    branchComboViewer = new ComboViewer(branchCombo);
    branchViewer = new CheckboxTableViewer(table);
    setupBranchViewers();
    initializeRepos();
    loadSourceProvider();
}

69. WITSearchDialog#createQueryableFieldsCombo()

Project: team-explorer-everywhere
File: WITSearchDialog.java
private Combo createQueryableFieldsCombo(final Composite composite, final FieldDefinition[] queryableFields) {
    final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.add(WITSearchModel.SEARCH_FIELD_SELECT);
    for (int i = 0; i < queryableFields.length; i++) {
        if (/*
             * these 3 fields are hard-coded as search fields - there's no
             * reason to include them as custom fields too
             */
        queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.TITLE) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.DESCRIPTION) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.HISTORY) || /*
             * these fields can have values specified in the constraints area
             * (right side of the form) - so no need to have them as custom
             * fields too
             */
        queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.TEAM_PROJECT) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.AREA_PATH) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.ITERATION_PATH) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.WORK_ITEM_TYPE) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.STATE) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.ASSIGNED_TO) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.CHANGED_DATE) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.CREATED_DATE) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.AUTHORIZED_DATE) || /*
             * these tree path id fields shouldn't be included as custom search
             * fields, as the string equivalent fields can be queried in the
             * constraints area
             */
        queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.ITERATION_ID) || queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.AREA_ID) || /*
             * System.Id doesn't make a lot of sense to query on
             */
        queryableFields[i].getReferenceName().equals(CoreFieldReferenceNames.ID)) {
            continue;
        }
        combo.add(queryableFields[i].getName());
    }
    return combo;
}

70. WITSearchDialog#createProjectCombo()

Project: team-explorer-everywhere
File: WITSearchDialog.java
private Combo createProjectCombo(final Composite composite) {
    final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    //$NON-NLS-1$
    combo.add("");
    for (int i = 0; i < projects.length; i++) {
        combo.add(projects[i].getName());
    }
    return combo;
}

71. CopyWorkItemsDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: CopyWorkItemsDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout gridLayout = new GridLayout(1, false);
    dialogArea.setLayout(gridLayout);
    final Label teamProjectLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    teamProjectLabel.setText(Messages.getString("CopyWorkItemsDialog.TeamProjectLabelText"));
    projectCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    projectCombo.setLayoutData(gd);
    populateProjects();
    projectCombo.addSelectionListener(new ProjectChangedListener());
    final Label workItemTypeLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    workItemTypeLabel.setText(Messages.getString("CopyWorkItemsDialog.TypeLabelText"));
    workItemTypeCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    workItemTypeCombo.setLayoutData(gd);
    populateWorkItemTypes();
    workItemTypeCombo.addSelectionListener(new WorkItemTypeChangedListener());
}

72. AbstractComboControlValidator#dispose()

Project: team-explorer-everywhere
File: AbstractComboControlValidator.java
/**
     * {@link AbstractComboControlValidator} overrides {@link #dispose()} to
     * remove the {@link ModifyListener} from the subject. If subclasses
     * override to perform their own cleanup, they must invoke
     * <code>super.dispose()</code>.
     */
@Override
public void dispose() {
    final Combo subject = getComboControlSubject();
    subject.removeModifyListener(modifyListener);
}

73. HTMLEditor#createFontToolBar()

Project: team-explorer-everywhere
File: HTMLEditor.java
private ToolBar createFontToolBar(final CoolBar parent) {
    final ToolBar toolBar = new ToolBar(parent, toolbarStyle);
    fontNameCombo = new Combo(toolBar, SWT.NONE);
    fontNameCombo.setItems(getSystemFontNames(getShell()));
    //$NON-NLS-1$
    fontNameCombo.setToolTipText(Messages.getString("HTMLEditor.FontNameToolTip"));
    fontNameCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            applyFontName(fontNameCombo.getText());
            /*
                 * Throw the focus back into the browser so the user can type
                 * with their newly selected font.
                 */
            browser.setFocus();
        }
    });
    final ToolItem fontNameComboItem = new ToolItem(toolBar, SWT.SEPARATOR);
    fontNameComboItem.setWidth(140);
    fontNameComboItem.setControl(fontNameCombo);
    fontSizeCombo = new Combo(toolBar, SWT.NONE);
    //$NON-NLS-1$
    fontSizeCombo.setToolTipText(Messages.getString("HTMLEditor.FontSizeToolTip"));
    fontSizeCombo.setItems(new String[] { //$NON-NLS-1$
    "1", //$NON-NLS-1$
    "2", //$NON-NLS-1$
    "3", //$NON-NLS-1$
    "4", //$NON-NLS-1$
    "5", //$NON-NLS-1$
    "6", //$NON-NLS-1$
    "7" });
    fontSizeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            applyFontSize(fontSizeCombo.getText());
            /*
                 * Throw the focus back into the browser so the user can type
                 * with their newly selected size.
                 */
            browser.setFocus();
        }
    });
    final ToolItem fontSizeComboItem = new ToolItem(toolBar, SWT.SEPARATOR);
    fontSizeComboItem.setWidth(80);
    fontSizeComboItem.setControl(fontSizeCombo);
    return toolBar;
}

74. StartExplorerPreferencePageDesktopEnvironment#createWorkingDirectoryComboAndLabel()

Project: startexplorer
File: StartExplorerPreferencePageDesktopEnvironment.java
private Combo createWorkingDirectoryComboAndLabel(Composite parent, String labelText) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(labelText);
    Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    combo.setItems(WorkingDirectoryMode.allLabels().toArray(new String[WorkingDirectoryMode.allLabels().size()]));
    return combo;
}

75. ChooseArchetypeWizardPage#createControl()

Project: sling
File: ChooseArchetypeWizardPage.java
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    container.setLayout(layout);
    layout.numColumns = 3;
    layout.verticalSpacing = 9;
    useDefaultWorkspaceLocationButton = new Button(container, SWT.CHECK);
    GridData useDefaultWorkspaceLocationButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
    useDefaultWorkspaceLocationButton.setLayoutData(useDefaultWorkspaceLocationButtonData);
    useDefaultWorkspaceLocationButton.setText("Use default Workspace location");
    useDefaultWorkspaceLocationButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            boolean inWorkspace = useDefaultWorkspaceLocationButton.getSelection();
            locationLabel.setEnabled(!inWorkspace);
            locationCombo.setEnabled(!inWorkspace);
            dialogChanged();
        }
    });
    useDefaultWorkspaceLocationButton.setSelection(true);
    locationLabel = new Label(container, SWT.NONE);
    GridData locationLabelData = new GridData();
    locationLabelData.horizontalIndent = 10;
    locationLabel.setLayoutData(locationLabelData);
    locationLabel.setText("Location:");
    locationLabel.setEnabled(false);
    locationCombo = new Combo(container, SWT.NONE);
    GridData locationComboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    locationCombo.setLayoutData(locationComboData);
    locationCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            dialogChanged();
        }
    });
    locationCombo.setEnabled(false);
    Button locationBrowseButton = new Button(container, SWT.NONE);
    GridData locationBrowseButtonData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    locationBrowseButton.setLayoutData(locationBrowseButtonData);
    locationBrowseButton.setText("Browse...");
    locationBrowseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell());
            dialog.setText("Select Location");
            String path = locationCombo.getText();
            if (path.length() == 0) {
                path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toPortableString();
            }
            dialog.setFilterPath(path);
            String selectedDir = dialog.open();
            if (selectedDir != null) {
                locationCombo.setText(selectedDir);
                useDefaultWorkspaceLocationButton.setSelection(false);
                dialogChanged();
            }
        }
    });
    Label label = new Label(container, SWT.NULL);
    label.setText("&Archetype:");
    knownArchetypes = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    knownArchetypes.setLayoutData(gd);
    knownArchetypes.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            dialogChanged();
        }
    });
    knownArchetypes.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            getContainer().showPage(getNextPage());
        }
    });
    setPageComplete(false);
    MavenPlugin.getIndexManager().addIndexListener(this);
    setControl(container);
}

76. GeneralPreferencePage#createContents()

Project: scouter
File: GeneralPreferencePage.java
@Override
protected Control createContents(Composite parent) {
    ((GridLayout) parent.getLayout()).marginBottom = 30;
    Label versionLabel = new Label(parent, SWT.NONE);
    versionLabel.setText(" - Current Version : " + Version.getClientFullVersion());
    versionLabel.setLayoutData(UIUtil.gridData(SWT.FILL));
    // ----Default Object Type----
    Group layoutGroup = new Group(parent, SWT.NONE);
    layoutGroup.setText("Default Object Type");
    layoutGroup.setLayout(UIUtil.formLayout(5, 5));
    layoutGroup.setLayoutData(UIUtil.gridData(SWT.FILL));
    CounterEngine counterEngine = ServerManager.getInstance().getDefaultServer().getCounterEngine();
    hostCombo = new Combo(layoutGroup, SWT.VERTICAL | SWT.BORDER | SWT.H_SCROLL);
    hostCombo.setItems(counterEngine.getChildren(CounterConstants.FAMILY_HOST));
    hostCombo.setText(host);
    hostCombo.setEnabled(true);
    hostCombo.setLayoutData(UIUtil.formData(null, -1, 0, 8, 100, -5, null, -1, 220));
    CLabel hostLabel = new CLabel(layoutGroup, SWT.NONE);
    hostLabel.setText("default \'Host\'");
    hostLabel.setImage(Images.getObjectIcon(CounterConstants.FAMILY_HOST, true, 0));
    hostLabel.setLayoutData(UIUtil.formData(null, -1, 0, 8, hostCombo, -5, null, -1, 130));
    javaeeCombo = new Combo(layoutGroup, SWT.VERTICAL | SWT.BORDER | SWT.H_SCROLL);
    javaeeCombo.setItems(counterEngine.getChildren(CounterConstants.FAMILY_JAVAEE));
    javaeeCombo.setText(javaee);
    javaeeCombo.setEnabled(true);
    javaeeCombo.setLayoutData(UIUtil.formData(null, -1, hostCombo, 8, 100, -5, null, -1, 220));
    CLabel javaLabel = new CLabel(layoutGroup, SWT.NONE);
    javaLabel.setText("default \'JavaEE\'");
    javaLabel.setImage(Images.getObjectIcon(CounterConstants.JAVA, true, 0));
    javaLabel.setLayoutData(UIUtil.formData(null, -1, hostLabel, 8, javaeeCombo, -5, null, -1, 130));
    // ----Mass Profiling----
    layoutGroup = new Group(parent, SWT.NONE);
    layoutGroup.setText("Profiling");
    layoutGroup.setLayout(UIUtil.formLayout(5, 5));
    layoutGroup.setLayoutData(UIUtil.gridData(SWT.FILL));
    maxText = new Text(layoutGroup, SWT.BORDER | SWT.RIGHT);
    maxText.setText("" + maxBlock);
    maxText.setBackground(ColorUtil.getInstance().getColor("white"));
    maxText.setLayoutData(UIUtil.formData(null, -1, 0, -2, 100, -5, null, -1, 265));
    maxText.addVerifyListener(new // for number only input.
    VerifyListener() {

        public void verifyText(VerifyEvent e) {
            Text text = (Text) e.getSource();
            final String oldS = text.getText();
            String newS = oldS.substring(0, e.start) + e.text + oldS.substring(e.end);
            boolean isFloat = true;
            try {
                Float.parseFloat(newS);
            } catch (NumberFormatException ex) {
                isFloat = false;
            }
            if (!isFloat)
                e.doit = false;
        }
    });
    Label label = new Label(layoutGroup, SWT.NONE);
    label.setText("Max Block count:");
    label.setLayoutData(UIUtil.formData(null, -1, null, -1, maxText, -5, null, -1, 100));
    return super.createContents(parent);
}

77. DjangoSettingsPage#createControl()

Project: Pydev
File: DjangoSettingsPage.java
@Override
@SuppressWarnings("unused")
public void createControl(Composite parent) {
    Composite topComp = new Composite(parent, SWT.NONE);
    GridLayout innerLayout = new GridLayout();
    innerLayout.numColumns = 1;
    innerLayout.marginHeight = 0;
    innerLayout.marginWidth = 0;
    topComp.setLayout(innerLayout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    topComp.setLayoutData(gd);
    //General Settings
    Group general_grp = new Group(topComp, SWT.NONE);
    general_grp.setText("General");
    GridLayout general_layout = new GridLayout();
    general_layout.horizontalSpacing = 8;
    general_layout.numColumns = 2;
    general_grp.setLayout(general_layout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    general_grp.setLayoutData(gd);
    Label versionLabel = newLabel(general_grp, "Django version");
    djVersionCombo = new Combo(general_grp, SWT.READ_ONLY);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    djVersionCombo.setLayoutData(gd);
    //Database Settings
    Group group = new Group(topComp, SWT.NONE);
    group.setText("Database settings");
    GridLayout layout = new GridLayout();
    layout.horizontalSpacing = 8;
    layout.numColumns = 2;
    group.setLayout(layout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayoutData(gd);
    // Database Engine
    Label engineLabel = newLabel(group, "Database &Engine");
    engineCombo = new Combo(group, 0);
    final IWizardNewProjectNameAndLocationPage projectPage = projectPageCallback.call();
    engineCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updateSqlitePathIfNeeded(projectPage);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    gd = new GridData(GridData.FILL_HORIZONTAL);
    engineCombo.setLayoutData(gd);
    // Database Name
    Label nameLabel = newLabel(group, "Database &Name");
    nameText = newText(group);
    // Database Host
    Label hostLabel = newLabel(group, "Database &Host");
    hostText = newText(group);
    // Database Port
    Label portLabel = newLabel(group, "Database P&ort");
    portText = newText(group);
    // Database User
    Label userLabel = newLabel(group, "&Username");
    userText = newText(group);
    // Database Pass
    Label passLabel = newLabel(group, "&Password");
    passText = newText(group);
    passText.setEchoChar('*');
    setErrorMessage(null);
    setMessage(null);
    setControl(topComp);
}

78. FindAnnotateDialog#createInputPanel()

Project: uima-uimaj
File: FindAnnotateDialog.java
/**
   * Creates the search string input field.
   * 
   * @param parent
   * 
   * @return
   */
private Composite createInputPanel(Composite parent) {
    Composite panel = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    panel.setLayout(layout);
    // find label
    Label findLabel = new Label(panel, SWT.LEFT);
    findLabel.setText("Find:");
    GridData labelData = new GridData();
    labelData.horizontalAlignment = SWT.LEFT;
    findLabel.setLayoutData(labelData);
    // find combo box
    findField = new Combo(panel, SWT.DROP_DOWN | SWT.BORDER);
    GridData findFieldData = new GridData();
    findFieldData.horizontalAlignment = SWT.FILL;
    findFieldData.grabExcessHorizontalSpace = true;
    findField.setLayoutData(findFieldData);
    // type label
    Label typeLabel = new Label(panel, SWT.LEFT);
    typeLabel.setText("Type:");
    GridData typeData = new GridData();
    typeData.horizontalAlignment = SWT.LEFT;
    typeLabel.setLayoutData(typeData);
    typeField = new TypeCombo(panel);
    typeField.setInput(document.getCAS().getTypeSystem().getType(CAS.TYPE_NAME_ANNOTATION), document.getCAS().getTypeSystem());
    typeField.select(modeType);
    GridData typeFieldData = new GridData();
    typeFieldData.horizontalAlignment = SWT.FILL;
    typeFieldData.grabExcessHorizontalSpace = true;
    typeField.setLayoutData(typeFieldData);
    return panel;
}

79. GitImportWizardSelectProjectsPage#createWorkingSetOption()

Project: team-explorer-everywhere
File: GitImportWizardSelectProjectsPage.java
private void createWorkingSetOption(final Composite container) {
    final Composite optionsContainer = new Composite(container, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().vIndent(getVerticalSpacing() * 2).applyTo(optionsContainer);
    final GridLayout optionsLayout = new GridLayout(3, false);
    optionsLayout.marginWidth = 0;
    optionsLayout.marginHeight = 0;
    optionsLayout.horizontalSpacing = getHorizontalSpacing();
    optionsLayout.verticalSpacing = 0;
    optionsContainer.setLayout(optionsLayout);
    workingSetButton = new Button(optionsContainer, SWT.CHECK);
    //$NON-NLS-1$
    workingSetButton.setText(Messages.getString("GitImportWizardSelectProjectsPage.WorkingSetButtonText"));
    workingSetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            /*
                 * No working set: simply open the dialog instead of enabling a
                 * useless combo.
                 */
            if (workingSets.length == 0) {
                selectWorkingSet();
                /* Still no working set. (Dialog canceled.) Abort. */
                if (workingSets.length == 0) {
                    workingSetButton.setSelection(false);
                    return;
                }
            }
            workingSetCombo.setEnabled(workingSetButton.getSelection());
            workingSetSelectButton.setEnabled(workingSetButton.getSelection());
        }
    });
    workingSetCombo = new Combo(optionsContainer, SWT.READ_ONLY);
    workingSetCombo.setEnabled(false);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(workingSetCombo);
    workingSetSelectButton = new Button(optionsContainer, SWT.NONE);
    workingSetSelectButton.setText(//$NON-NLS-1$
    Messages.getString("GitImportWizardSelectProjectsPage.WorkingSetSelectButtonText"));
    workingSetSelectButton.setEnabled(false);
    workingSetSelectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectWorkingSet();
        }
    });
    ButtonHelper.resizeButtons(new Button[] { workingSetSelectButton });
    computeWorkingSets();
    if (options.getWorkingSet() != null) {
        workingSetButton.setSelection(true);
        selectWorkingSet(options.getWorkingSet());
    }
}

80. TfsImportWizardTreePage#doCreateControl()

Project: team-explorer-everywhere
File: TfsImportWizardTreePage.java
@Override
protected void doCreateControl(final Composite parent, final IDialogSettings dialogSettings) {
    final ImportOptions options = (ImportOptions) getImportWizard().getPageData(ImportOptions.class);
    final Composite container = new Composite(parent, SWT.NONE);
    setControl(container);
    final GridLayout layout = new GridLayout(3, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    container.setLayout(layout);
    /*
         * Build a composite to hold the prompt label and the folder control
         * with lessened spacing
         */
    final Composite folderContainer = new Composite(container, SWT.NONE);
    final GridLayout folderLayout = new GridLayout();
    folderLayout.marginWidth = 0;
    folderLayout.marginHeight = 0;
    folderLayout.horizontalSpacing = getHorizontalSpacing();
    folderLayout.verticalSpacing = 0;
    folderContainer.setLayout(folderLayout);
    final Label folderLabel = new Label(folderContainer, SWT.NONE);
    //$NON-NLS-1$
    folderLabel.setText(Messages.getString("ImportWizardTreePage.FolderLabelText"));
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(folderLabel);
    final ServerItemType[] visibleItemTypes = ServerItemType.ALL_FOLDERS;
    folderControl = new ServerItemTreeControl(folderContainer, SWT.MULTI);
    folderControl.setVisibleServerItemTypes(visibleItemTypes);
    folderControl.setLabelProvider(new ImportWizardTreeLabelProvider(options));
    folderControl.addSelectionChangedListener(new ImportWizardSelectionListener());
    GridDataBuilder.newInstance().grab().fill().applyTo(folderControl);
    ControlSize.setCharSizeHints(folderControl, 40, 15);
    GridDataBuilder.newInstance().hSpan(3).grab().fill().applyTo(folderContainer);
    statusLabel = new Label(container, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(statusLabel);
    final List<Button> buttons = new ArrayList<Button>(3);
    /*
         * Add load/save plan buttons
         */
    final Button loadButton = new Button(container, SWT.PUSH);
    //$NON-NLS-1$
    loadButton.setText(Messages.getString("TfsImportWizardTreePage.LoadButtonText"));
    loadButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            loadSelections();
            handleSelection();
        }
    });
    buttons.add(loadButton);
    final Button saveButton = new Button(container, SWT.PUSH);
    //$NON-NLS-1$
    saveButton.setText(Messages.getString("TfsImportWizardTreePage.SaveButtonText"));
    saveButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            saveSelections();
        }
    });
    buttons.add(saveButton);
    /*
         * Options buttons
         */
    final Composite optionsContainer = new Composite(container, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().hSpan(3).vIndent(getVerticalSpacing() * 2).applyTo(optionsContainer);
    final GridLayout optionsLayout = new GridLayout(3, false);
    optionsLayout.marginWidth = 0;
    optionsLayout.marginHeight = 0;
    optionsLayout.horizontalSpacing = getHorizontalSpacing();
    optionsLayout.verticalSpacing = 0;
    optionsContainer.setLayout(optionsLayout);
    workingSetButton = new Button(optionsContainer, SWT.CHECK);
    //$NON-NLS-1$
    workingSetButton.setText(Messages.getString("ImportWizardTreePage.WorkingSetButtonText"));
    workingSetButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            /*
                 * No working set: simply open the dialog instead of enabling a
                 * useless combo.
                 */
            if (workingSets.length == 0) {
                selectWorkingSet();
                /* Still no working set. (Dialog canceled.) Abort. */
                if (workingSets.length == 0) {
                    workingSetButton.setSelection(false);
                    return;
                }
            }
            workingSetCombo.setEnabled(workingSetButton.getSelection());
            workingSetSelectButton.setEnabled(workingSetButton.getSelection());
        }
    });
    workingSetCombo = new Combo(optionsContainer, SWT.READ_ONLY);
    workingSetCombo.setEnabled(false);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(workingSetCombo);
    workingSetSelectButton = new Button(optionsContainer, SWT.NONE);
    //$NON-NLS-1$
    workingSetSelectButton.setText(Messages.getString("ImportWizardTreePage.WorkingSetSelectButtonText"));
    workingSetSelectButton.setEnabled(false);
    workingSetSelectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectWorkingSet();
        }
    });
    buttons.add(workingSetSelectButton);
    ButtonHelper.resizeButtons(buttons.toArray(new Button[buttons.size()]));
    newProjectButton = new Button(optionsContainer, SWT.CHECK);
    //$NON-NLS-1$
    newProjectButton.setText(Messages.getString("ImportWizardTreePage.NewProjectButtonText"));
    GridDataBuilder.newInstance().hGrab().hFill().hSpan(3).applyTo(newProjectButton);
    forceButton = new Button(optionsContainer, SWT.CHECK);
    //$NON-NLS-1$
    forceButton.setText(Messages.getString("ImportWizardTreePage.ForceButtonText"));
    AutomationIDHelper.setWidgetID(forceButton, FORCE_BUTTON_ID);
    GridDataBuilder.newInstance().hGrab().hFill().hSpan(3).vIndent(getVerticalSpacing()).applyTo(forceButton);
    computeWorkingSets();
    if (options.getWorkingSet() != null) {
        workingSetButton.setSelection(true);
        selectWorkingSet(options.getWorkingSet());
    }
}

81. BuildToolPicker#createUI()

Project: team-explorer-everywhere
File: BuildToolPicker.java
protected void createUI() {
    SWTUtil.gridLayout(this, 4, false);
    label = new Label(this, SWT.NONE);
    label.setText(labelName);
    if (labelWidth > 0) {
        GridDataBuilder.newInstance().vAlign(SWT.CENTER).wCHint(label, labelWidth).applyTo(label);
    } else {
        GridDataBuilder.newInstance().vAlign(SWT.CENTER).applyTo(label);
    }
    pathTypeCombo = new Combo(this, SWT.READ_ONLY);
    GridDataBuilder.newInstance().hFill().vAlign(SWT.CENTER).applyTo(pathTypeCombo);
    selectedIndex = 0;
    updateCombo(pathTypeCombo);
    pathText = new Text(this, SWT.BORDER);
    GridDataBuilder.newInstance().hAlign(SWT.FILL).hGrab().vAlign(SWT.CENTER).applyTo(pathText);
    selectButton = new Button(this, SWT.NONE);
    //$NON-NLS-1$
    selectButton.setText(Messages.getString("BuildToolPicker.SelectButtonLabel"));
    GridDataBuilder.newInstance().vAlign(SWT.CENTER).applyTo(selectButton);
    selectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            browseOnServer(((Button) e.widget).getShell());
        }
    });
    SWTUtil.createHorizontalGridLayoutSpacer(this, 1);
    helpLabel = new Label(this, SWT.WRAP);
    GridDataBuilder.newInstance().hSpan(2).hFill().hGrab().wHint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH).applyTo(helpLabel);
    pathTypeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            selectedIndex = pathTypeCombo.getSelectionIndex();
            processSelectedLinkType();
        }
    });
    processSelectedLinkType();
}

82. SelectMergeSourceTargetWizardPage#createMergeTargeControls()

Project: team-explorer-everywhere
File: SelectMergeSourceTargetWizardPage.java
private void createMergeTargeControls(final Composite container) {
    final Label selectTheTargetLabel = new Label(container, SWT.WRAP);
    final FormData selectTheTargetLabelData = new FormData();
    selectTheTargetLabelData.top = new FormAttachment(selectedChangesetsButton, 5, SWT.BOTTOM);
    selectTheTargetLabelData.left = new FormAttachment(0, 0);
    selectTheTargetLabel.setLayoutData(selectTheTargetLabelData);
    //$NON-NLS-1$
    selectTheTargetLabel.setText(Messages.getString("SelectMergeSourceTargetWizardPage.SelectTargetLabelText"));
    ControlSize.setCharWidthHint(selectTheTargetLabel, MergeWizard.TEXT_CHARACTER_WIDTH);
    final Label targetBranchLabel = new Label(container, SWT.NONE);
    final FormData targetBranchLabelData = new FormData();
    targetBranchLabelData.top = new FormAttachment(selectTheTargetLabel, 5, SWT.BOTTOM);
    targetBranchLabelData.left = new FormAttachment(0, 0);
    targetBranchLabel.setLayoutData(targetBranchLabelData);
    //$NON-NLS-1$
    targetBranchLabel.setText(Messages.getString("SelectMergeSourceTargetWizardPage.TargetBranchLabelText"));
    final Button browseTargetButton = new Button(container, SWT.NONE);
    final FormData browseTargetButtonData = new FormData();
    browseTargetButtonData.top = new FormAttachment(targetBranchLabel, 0, SWT.BOTTOM);
    browseTargetButtonData.right = new FormAttachment(100, 0);
    browseTargetButton.setLayoutData(browseTargetButtonData);
    //$NON-NLS-1$
    browseTargetButton.setText(Messages.getString("SelectMergeSourceTargetWizardPage.BrowseButtonText"));
    browseTargetButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            browseTargetClicked();
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            browseTargetClicked();
        }
    });
    targetCombo = new Combo(container, SWT.BORDER);
    final FormData targetComboData = new FormData();
    final int targetComboTopOffset = FormHelper.VerticalOffset(targetCombo, browseTargetButton);
    targetComboData.top = new FormAttachment(browseTargetButton, targetComboTopOffset, SWT.TOP);
    targetComboData.left = new FormAttachment(0, 0);
    targetComboData.right = new FormAttachment(browseTargetButton, 0, SWT.LEFT);
    targetCombo.setLayoutData(targetComboData);
    targetCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            targetPathChanged();
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            targetPathChanged();
        }
    });
    targetCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            targetPathChanged();
        }
    });
    targetCombo.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(final FocusEvent e) {
            updatePageComplete();
        }

        @Override
        public void focusLost(final FocusEvent e) {
            updatePageComplete();
        }
    });
    createBaselessWarningMessage(container, targetBranchLabel);
}

83. AbstractComboControlValidator#validate()

Project: team-explorer-everywhere
File: AbstractComboControlValidator.java
/**
     * Called by subclasses inside the subclass constructor to perform the
     * initial validation of the subject. Normally, there is no need for
     * subclasses to override.
     */
protected void validate() {
    final Combo subject = getComboControlSubject();
    final String text = subject.getText();
    validate(text);
}

84. AbstractComboControlValidator#onTextModified()

Project: team-explorer-everywhere
File: AbstractComboControlValidator.java
/**
     * Called when a {@link ModifyEvent} is sent by the {@link Combo} subject.
     * This implementation validates the new {@link String} value in the
     * subject. Normally, there is no need for subclasses to override or call
     * this method.
     *
     * @param e
     *        the {@link ModifyEvent} (never <code>null</code>)
     */
protected void onTextModified(final ModifyEvent e) {
    final Combo subject = (Combo) e.widget;
    validate(subject.getText());
}

85. InputWIQLDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: InputWIQLDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);
    final Label projectLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    projectLabel.setText(Messages.getString("InputWiqlDialog.projectLabelText"));
    projectCombo = new Combo(dialogArea, SWT.READ_ONLY);
    final Label wiqlLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    wiqlLabel.setText(Messages.getString("InputWiqlDialog.EnterWiqlLabelText"));
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    wiqlLabel.setLayoutData(gd);
    wiqlText = new Text(dialogArea, SWT.BORDER | SWT.MULTI | SWT.WRAP);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalSpan = 2;
    wiqlText.setLayoutData(gd);
    initialPopulate();
}

86. SetEncodingDialog#hookAddToDialogArea()

Project: team-explorer-everywhere
File: SetEncodingDialog.java
@Override
protected void hookAddToDialogArea(final Composite dialogArea) {
    final GridLayout layout = new GridLayout(3, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    dialogArea.setLayout(layout);
    //$NON-NLS-1$
    final String messageFormat = Messages.getString("SetEncodingDialog.ExplainLabelTextFormat");
    final String message = MessageFormat.format(messageFormat, getFileName());
    final Label explanationLabel = new Label(dialogArea, SWT.NONE);
    explanationLabel.setText(message);
    GridDataBuilder.newInstance().hGrab().hFill().hSpan(3).applyTo(explanationLabel);
    final Label promptLabel = new Label(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    promptLabel.setText(Messages.getString("SetEncodingDialog.PromptLabelText"));
    encodingCombo = new Combo(dialogArea, SWT.DROP_DOWN | SWT.READ_ONLY);
    encodingCombo.setItems(getCharsetList());
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(encodingCombo);
    detectButton = new Button(dialogArea, SWT.NONE);
    //$NON-NLS-1$
    detectButton.setText(Messages.getString("SetEncodingDialog.DetectButtonText"));
    detectButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            try {
                final FileEncoding encoding = FileEncodingDetector.detectEncoding(localPath, FileEncoding.AUTOMATICALLY_DETECT);
                encodingCombo.select(getEncodingIndex(encoding));
            } catch (final Exception ex) {
                MessageDialog.openError(getShell(), Messages.getString("SetEncodingDialog.ErrorDialogTitle"), ex.getLocalizedMessage());
            }
        }
    });
    if (originalEncoding != null) {
        encodingCombo.select(getEncodingIndex(originalEncoding));
    } else {
        encodingCombo.select(getEncodingIndex(FileEncoding.getDefaultTextEncoding()));
    }
}

87. VersionPickerControl#createControls()

Project: team-explorer-everywhere
File: VersionPickerControl.java
private void createControls(final Composite composite) {
    final int width = prompt ? 3 : 2;
    final GridLayout layout = new GridLayout(width, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    composite.setLayout(layout);
    if (prompt) {
        //$NON-NLS-1$
        typeLabel = SWTUtil.createLabel(composite, Messages.getString("VersionPickerControl.VersionLabelText"));
    }
    typeCombo = new Combo(composite, SWT.READ_ONLY);
    dataArea = SWTUtil.createComposite(composite);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(dataArea);
    dataAreaLayout = new StackLayout();
    dataArea.setLayout(dataAreaLayout);
    dataAreaControls = new Control[COMBO_ITEMS.length];
    for (int i = 0; i < COMBO_ITEMS.length; i++) {
        typeCombo.add(COMBO_ITEMS[i].toUIString());
        dataAreaControls[i] = createVersionTypeControls(dataArea, COMBO_ITEMS[i]);
    }
    typeCombo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final Combo combo = (Combo) e.widget;
            final int ix = combo.getSelectionIndex();
            newVersionTypeSelected(ix);
        }
    });
    setRepository(null);
}

88. FindLabelControl#createFindOptionsArea()

Project: team-explorer-everywhere
File: FindLabelControl.java
private Control createFindOptionsArea(final Composite parent) {
    final Group composite = new Group(parent, SWT.NONE);
    //$NON-NLS-1$
    composite.setText(Messages.getString("FindLabelControl.FindOptionsGroupText"));
    final GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = getHorizontalMargin();
    layout.marginHeight = getVerticalMargin();
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    composite.setLayout(layout);
    Label label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("FindLabelControl.NameLabelText"));
    nameText = new Text(composite, SWT.BORDER);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(nameText);
    label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("FindLabelControl.ProjectLabelText"));
    projectCombo = new Combo(composite, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(projectCombo);
    populateProjectCombo();
    label = new Label(composite, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("FindLabelControl.OwnerLabelText"));
    ownerText = new Text(composite, SWT.BORDER);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(ownerText);
    final Button button = new Button(composite, SWT.NONE);
    //$NON-NLS-1$
    button.setText(Messages.getString("FindLabelControl.FindButtonText"));
    GridDataBuilder.newInstance().hSpan(layout).applyTo(button);
    // Make this the default button.
    getShell().setDefaultButton(button);
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            find();
        }
    });
    return composite;
}

89. ServerTypeSelectControl#setupServerCombo()

Project: team-explorer-everywhere
File: ServerTypeSelectControl.java
private void setupServerCombo(final GridLayout parentLayout) {
    // Set up a new container to avoid problems with column spacing
    final Composite container = new Composite(this, SWT.NULL);
    final GridLayout layout = SWTUtil.gridLayout(container, 2, false, 0, 0);
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing();
    // Add the combo box
    serverCombo = new Combo(container, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(serverCombo);
    serverCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(final ModifyEvent e) {
            if (!ignoreServerChangeEvents) {
                setVstsSelection(false);
                setServerInternal(getServerFromCombo());
            }
        }
    });
    // Setup Auto Complete for the combo box
    proposalProvider = new ProposalProvider();
    final ComboContentAdapter comboContentAdapter = new ComboContentAdapter();
    final ContentProposalAdapter serverComboAdapter = new ContentProposalAdapter(serverCombo, comboContentAdapter, proposalProvider, null, null);
    serverComboAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
    // Add the servers button
    final Button serversButton = //$NON-NLS-1$
    SWTUtil.createButton(container, Messages.getString("ServerSelectControl.ServersButtonText"));
    serversButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            onServersButtonSelected();
        }
    });
    // Add the container to the parent layout
    GridDataBuilder.newInstance().hSpan(parentLayout).hIndent(getHorizontalSpacing() * 4).hFill().hGrab().vIndent(getVerticalSpacing()).applyTo(container);
}

90. SymfonyURLLaunchDialog#createCustomArea()

Project: Symfony-2-Eclipse-Plugin
File: SymfonyURLLaunchDialog.java
@Override
protected Control createCustomArea(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText("Launch URL");
    group.setLayout(new GridLayout(1, true));
    group.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    combo = new Combo(group, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1);
    data.widthHint = convertWidthInCharsToPixels(80);
    combo.setLayoutData(data);
    Object[] urls = previousURLs.toArray();
    for (Object element : urls) {
        combo.add(element.toString());
    }
    try {
        String selectedURL = launchConfiguration.getAttribute(Server.BASE_URL, "");
        int comboIndex = combo.indexOf(selectedURL);
        if (comboIndex > -1) {
            combo.select(comboIndex);
        } else {
            combo.add(selectedURL, 0);
            combo.select(0);
        }
        Map<String, RouteParameter> params = route.getParameters();
        if (params.size() == 1) {
            RouteParameter param = params.entrySet().iterator().next().getValue();
            int start = selectedURL.indexOf(param.getName());
            if (start > 0) {
                Point point = new Point(start, param.getName().length() + start);
                combo.setSelection(point);
            }
        }
    } catch (CoreException e) {
        Logger.logException(e);
    }
    return parent;
}

91. LaunchConfigurationTab#createControl()

Project: Symfony-2-Eclipse-Plugin
File: LaunchConfigurationTab.java
@Override
public void createControl(Composite parent) {
    Font font = parent.getFont();
    comp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    comp.setLayout(layout);
    comp.setFont(font);
    GridData gd = new GridData(GridData.FILL_BOTH);
    comp.setLayoutData(gd);
    setControl(comp);
    // setHelpContextId();
    Group group = new Group(comp, SWT.NONE);
    group.setFont(font);
    layout = new GridLayout();
    group.setLayout(layout);
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    String controlName = "Launch Settings";
    group.setText(controlName);
    Label label = new Label(group, SWT.NONE);
    label.setText("Environment");
    GridData data = new GridData(200, GridData.FILL, true, false);
    label.setLayoutData(data);
    kernelCombo = new Combo(group, SWT.READ_ONLY);
    data = new GridData();
    data.horizontalIndent = 0;
    kernelCombo.setLayoutData(data);
    kernelCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            for (AppKernel k : kernels) {
                String env = kernelCombo.getItem(kernelCombo.getSelectionIndex());
                if (env.equals(k.getEnvironment())) {
                    kernel = k;
                    break;
                }
            }
            setDirty(true);
            updateLaunchConfigurationDialog();
            updateURL();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    Label routeLabel = new Label(group, SWT.NONE);
    routeLabel.setText("Route");
    route = new Text(group, SWT.SINGLE | SWT.BORDER);
    data = new GridData();
    data.widthHint = 200;
    route.addKeyListener(routeListener);
    route.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
            currentRoute = model.findRoute(route.getText(), project);
            setDirty(true);
            updateLaunchConfigurationDialog();
            updateURL();
        }

        @Override
        public void focusGained(FocusEvent e) {
        }
    });
    route.setLayoutData(data);
    ac = new AutoCompleteField(route, new TextContentAdapter(), new String[] {});
    Label urlLabel = new Label(group, SWT.NONE);
    urlLabel.setText("Generated URL");
    url = new Text(group, SWT.BORDER | SWT.SINGLE);
    url.addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
        }

        @Override
        public void keyPressed(KeyEvent e) {
            setDirty(true);
            updateLaunchConfigurationDialog();
        }
    });
    data = new GridData(GridData.FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false);
    url.setLayoutData(data);
    Dialog.applyDialogFont(comp);
    setControl(comp);
}

92. NewNodeDialog#createDialogArea()

Project: sling
File: NewNodeDialog.java
@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    Control[] children = composite.getChildren();
    Control errorMessageText = children[children.length - 1];
    GridData errorMessageGridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    errorMessageGridData.heightHint = convertHeightInCharsToPixels(2);
    errorMessageText.setLayoutData(errorMessageGridData);
    // now add the node type dropbox-combo
    Label label = new Label(composite, SWT.WRAP);
    label.moveAbove(errorMessageText);
    label.setText("Define node type");
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    combo = new Combo(composite, SWT.DROP_DOWN);
    combo.moveAbove(errorMessageText);
    if (allowedChildren != null) {
        combo.setItems(allowedChildren.toArray(new String[0]));
    }
    combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    combo.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            comboSelection = combo.getText();
            validateInput();
        }
    });
    combo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            comboSelection = combo.getText();
            validateInput();
        }
    });
    SimpleContentProposalProvider proposalProvider = new SimpleContentProposalProvider(combo.getItems());
    proposalProvider.setFiltering(true);
    final ComboContentAdapter controlContentAdapter = new ComboContentAdapter() {

        @Override
        public void insertControlContents(Control control, String text, int cursorPosition) {
            Point selection = combo.getSelection();
            combo.setText(text);
            selection.x = selection.x + cursorPosition;
            selection.y = selection.x;
            combo.setSelection(selection);
        }

        @Override
        public Rectangle getInsertionBounds(Control control) {
            final Rectangle insertionBounds = super.getInsertionBounds(control);
            // always insert at start
            insertionBounds.x = 0;
            insertionBounds.y = 0;
            return insertionBounds;
        }
    };
    // this variant opens auto-complete on each character
    proposalAdapter = new ContentProposalAdapter(combo, controlContentAdapter, proposalProvider, null, null);
    // this variant opens auto-complete only when invoking the auto-complete hotkey
    if (allowedChildren != null && allowedChildren.size() == 1) {
        combo.setText(allowedChildren.iterator().next());
    } else if (allowedChildren != null) {
        if (allowedChildren.contains(lastChosenNodeType)) {
            combo.setText(lastChosenNodeType);
        }
    }
    return composite;
}

93. XLogFilterDialog#createDialogArea()

Project: scouter
File: XLogFilterDialog.java
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE);
    setBlockOnOpen(false);
    newStatus = status.clone();
    this.filterHash = status.hashCode();
    container.setLayout(new GridLayout(1, true));
    Group filterGrp = new Group(container, SWT.NONE);
    filterGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    filterGrp.setLayout(new GridLayout(2, false));
    Label label = new Label(filterGrp, SWT.NONE);
    label.setText("Object");
    label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
    objCombo = new Combo(filterGrp, SWT.VERTICAL | SWT.BORDER | SWT.H_SCROLL);
    objCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    objCombo.setItems(view.getExistObjNames());
    objCombo.setText(status.objName);
    objCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            newStatus.objName = objCombo.getText();
            compareHash();
        }
    });
    label = new Label(filterGrp, SWT.NONE);
    label.setText("Service");
    label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
    serviceTxt = new Text(filterGrp, SWT.BORDER | SWT.SINGLE);
    serviceTxt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    serviceTxt.setText(status.service);
    serviceTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            newStatus.service = serviceTxt.getText();
            compareHash();
        }
    });
    label = new Label(filterGrp, SWT.NONE);
    label.setText("IP");
    label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
    ipTxt = new Text(filterGrp, SWT.BORDER | SWT.SINGLE);
    ipTxt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    ipTxt.setText(status.ip);
    ipTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            newStatus.ip = ipTxt.getText();
            compareHash();
        }
    });
    label = new Label(filterGrp, SWT.NONE);
    label.setText("User-Agent");
    label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false));
    userAgentTxt = new Text(filterGrp, SWT.BORDER | SWT.SINGLE);
    userAgentTxt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    userAgentTxt.setText(status.userAgent);
    userAgentTxt.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent arg0) {
            newStatus.userAgent = userAgentTxt.getText();
            compareHash();
        }
    });
    Group checkGroup = new Group(filterGrp, SWT.NONE);
    checkGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1));
    checkGroup.setLayout(new GridLayout(3, true));
    onlySqlBtn = new Button(checkGroup, SWT.CHECK);
    onlySqlBtn.setText("SQL");
    onlySqlBtn.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
    onlySqlBtn.setSelection(status.onlySql);
    onlySqlBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            newStatus.onlySql = onlySqlBtn.getSelection();
            compareHash();
        }
    });
    onlyApiBtn = new Button(checkGroup, SWT.CHECK);
    onlyApiBtn.setText("ApiCall");
    onlyApiBtn.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
    onlyApiBtn.setSelection(status.onlyApicall);
    onlyApiBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            newStatus.onlyApicall = onlyApiBtn.getSelection();
            compareHash();
        }
    });
    onlyErrorBtn = new Button(checkGroup, SWT.CHECK);
    onlyErrorBtn.setText("Error");
    onlyErrorBtn.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false));
    onlyErrorBtn.setSelection(status.onlyError);
    onlyErrorBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            newStatus.onlyError = onlyErrorBtn.getSelection();
            compareHash();
        }
    });
    Composite btnComp = new Composite(container, SWT.NONE);
    btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
    btnComp.setLayout(new RowLayout());
    RowData rd = new RowData();
    rd.width = 90;
    clearBtn = new Button(btnComp, SWT.PUSH);
    clearBtn.setLayoutData(rd);
    clearBtn.setText("&Clear");
    clearBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            objCombo.setText("");
            serviceTxt.setText("");
            ipTxt.setText("");
            userAgentTxt.setText("");
            onlySqlBtn.setSelection(false);
            onlyApiBtn.setSelection(false);
            onlyErrorBtn.setSelection(false);
            newStatus = new XLogFilterStatus();
            if (newStatus.hashCode() != filterHash) {
                applyBtn.setEnabled(true);
            }
        }
    });
    applyBtn = new Button(btnComp, SWT.PUSH);
    applyBtn.setLayoutData(rd);
    applyBtn.setText("&Apply");
    applyBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            view.setFilter(newStatus);
            filterHash = newStatus.hashCode();
            compareHash();
        }
    });
    applyBtn.setEnabled(false);
    return container;
}

94. CounterPastDateGroupTotalView#createUpperMenu()

Project: scouter
File: CounterPastDateGroupTotalView.java
private void createUpperMenu(Composite composite) {
    headerComp = new Composite(composite, SWT.NONE);
    headerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    headerComp.setLayout(UIUtil.formLayout(0, 0));
    applyBtn = new Button(headerComp, SWT.PUSH);
    applyBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, 100, -5, null, -1));
    applyBtn.setText("Apply");
    applyBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    applyBtn.setEnabled(false);
                    forceRefresh();
                    break;
            }
        }
    });
    Button manualBtn = new Button(headerComp, SWT.PUSH);
    manualBtn.setImage(Images.CTXMENU_RDC);
    manualBtn.setText("Manual");
    manualBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, applyBtn, -5, null, -1));
    manualBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    Display display = Display.getCurrent();
                    if (display == null) {
                        display = Display.getDefault();
                    }
                    calDialog = new DualCalendarDialog(display, CounterPastDateGroupTotalView.this);
                    calDialog.show(UIUtil.getMousePosition());
                    break;
            }
        }
    });
    periodCombo = new Combo(headerComp, SWT.VERTICAL | SWT.BORDER | SWT.READ_ONLY);
    periodCombo.setLayoutData(UIUtil.formData(null, -1, 0, 3, manualBtn, -5, null, -1));
    DatePeriodUnit[] periodArray = DatePeriodUnit.values();
    int index = 0;
    for (; index < periodArray.length; index++) {
        periodCombo.add(periodArray[index].getLabel(), index);
        periodCombo.setData(periodArray[index].getLabel(), periodArray[index].getTime());
    }
    periodCombo.select(index - 1);
    periodCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            long time = (Long) periodCombo.getData(periodCombo.getText());
            long etime = DateUtil.getTime(eDate, "yyyyMMdd");
            sDate = DateUtil.yyyymmdd(etime - (time - DateUtil.MILLIS_PER_DAY));
            setHeadText();
        }
    });
    eDateText = new Label(headerComp, SWT.NONE);
    eDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, periodCombo, -5, null, -1));
    Label windbarLabel = new Label(headerComp, SWT.NONE);
    windbarLabel.setLayoutData(UIUtil.formData(null, -1, 0, 7, eDateText, -5, null, -1));
    windbarLabel.setText("~");
    sDateText = new Label(headerComp, SWT.NONE);
    sDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, windbarLabel, -5, null, -1));
    serverText = new Label(headerComp, SWT.NONE | SWT.RIGHT);
    serverText.setLayoutData(UIUtil.formData(0, 0, 0, 7, sDateText, -5, null, -1));
    setHeadText();
}

95. CounterPastDateGroupAllView#createUpperMenu()

Project: scouter
File: CounterPastDateGroupAllView.java
private void createUpperMenu(Composite composite) {
    headerComp = new Composite(composite, SWT.NONE);
    headerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    headerComp.setLayout(UIUtil.formLayout(0, 0));
    applyBtn = new Button(headerComp, SWT.PUSH);
    applyBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, 100, -5, null, -1));
    applyBtn.setText("Apply");
    applyBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    forceRefresh();
                    break;
            }
        }
    });
    Button manualBtn = new Button(headerComp, SWT.PUSH);
    manualBtn.setImage(Images.CTXMENU_RDC);
    manualBtn.setText("Manual");
    manualBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, applyBtn, -5, null, -1));
    manualBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    Display display = Display.getCurrent();
                    if (display == null) {
                        display = Display.getDefault();
                    }
                    calDialog = new DualCalendarDialog(display, CounterPastDateGroupAllView.this);
                    calDialog.show(UIUtil.getMousePosition());
                    break;
            }
        }
    });
    periodCombo = new Combo(headerComp, SWT.VERTICAL | SWT.BORDER | SWT.READ_ONLY);
    periodCombo.setLayoutData(UIUtil.formData(null, -1, 0, 3, manualBtn, -5, null, -1));
    DatePeriodUnit[] periodArray = DatePeriodUnit.values();
    int index = 0;
    for (; index < periodArray.length; index++) {
        periodCombo.add(periodArray[index].getLabel(), index);
        periodCombo.setData(periodArray[index].getLabel(), periodArray[index].getTime());
    }
    periodCombo.select(index - 1);
    periodCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            long time = (Long) periodCombo.getData(periodCombo.getText());
            long etime = DateUtil.yyyymmdd(eDate);
            sDate = DateUtil.yyyymmdd(etime - (time - DateUtil.MILLIS_PER_DAY));
            setHeadText();
        }
    });
    eDateText = new Label(headerComp, SWT.NONE);
    eDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, periodCombo, -5, null, -1));
    Label windbarLabel = new Label(headerComp, SWT.NONE);
    windbarLabel.setLayoutData(UIUtil.formData(null, -1, 0, 7, eDateText, -5, null, -1));
    windbarLabel.setText("~");
    sDateText = new Label(headerComp, SWT.NONE);
    sDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, windbarLabel, -5, null, -1));
    serverText = new Label(headerComp, SWT.NONE | SWT.RIGHT);
    serverText.setLayoutData(UIUtil.formData(0, 0, 0, 7, sDateText, -5, null, -1));
    setHeadText();
}

96. CounterPastLongDateTotalView#createUpperMenu()

Project: scouter
File: CounterPastLongDateTotalView.java
private void createUpperMenu(Composite composite) {
    headerComp = new Composite(composite, SWT.NONE);
    headerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    headerComp.setLayout(UIUtil.formLayout(0, 0));
    long initialTime = TimeUtil.getCurrentTime(serverId) - DatePeriodUnit.A_DAY.getTime();
    applyBtn = new Button(headerComp, SWT.PUSH);
    applyBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, 100, -5, null, -1));
    applyBtn.setText("Apply");
    applyBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    ((Button) event.widget).setEnabled(false);
                    try {
                        setInput(sDate, eDate, objType, counter, serverId);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
            }
        }
    });
    Button manualBtn = new Button(headerComp, SWT.PUSH);
    manualBtn.setImage(Images.CTXMENU_RDC);
    manualBtn.setText("Manual");
    manualBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, applyBtn, -5, null, -1));
    manualBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    Display display = Display.getCurrent();
                    if (display == null) {
                        display = Display.getDefault();
                    }
                    calDialog = new DualCalendarDialog(display, CounterPastLongDateTotalView.this);
                    calDialog.show(UIUtil.getMousePosition());
                    break;
            }
        }
    });
    periodCombo = new Combo(headerComp, SWT.VERTICAL | SWT.BORDER | SWT.READ_ONLY);
    periodCombo.setLayoutData(UIUtil.formData(null, -1, 0, 3, manualBtn, -5, null, -1));
    ArrayList<String> periodStrList = new ArrayList<String>();
    for (DatePeriodUnit minute : DatePeriodUnit.values()) {
        periodStrList.add(minute.getLabel());
    }
    periodCombo.setItems(periodStrList.toArray(new String[DatePeriodUnit.values().length]));
    periodCombo.select(2);
    periodCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (((Combo) e.widget).getSelectionIndex() == 0) {
                setStartEndDate(30);
            } else if (((Combo) e.widget).getSelectionIndex() == 1) {
                setStartEndDate(7);
            } else {
                setStartEndDate(1);
            }
        }

        private void setStartEndDate(int i) {
            long yesterday = TimeUtil.getCurrentTime(serverId) - DatePeriodUnit.A_DAY.getTime();
            long startDate = TimeUtil.getCurrentTime(serverId) - (DatePeriodUnit.A_DAY.getTime() * i);
            sDateText.setText(DateUtil.format(startDate, "yyyy-MM-dd"));
            eDateText.setText(DateUtil.format(yesterday, "yyyy-MM-dd"));
            sDate = DateUtil.format(startDate, "yyyyMMdd");
            eDate = DateUtil.format(yesterday, "yyyyMMdd");
            stime = DateUtil.getTime(sDate, "yyyyMMdd");
            etime = DateUtil.getTime(eDate, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY;
        }
    });
    eDateText = new Label(headerComp, SWT.NONE);
    eDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, periodCombo, -5, null, -1));
    eDateText.setText(DateUtil.format(initialTime - 1, "yyyy-MM-dd"));
    Label windbarLabel = new Label(headerComp, SWT.NONE);
    windbarLabel.setLayoutData(UIUtil.formData(null, -1, 0, 7, eDateText, -5, null, -1));
    windbarLabel.setText("~");
    sDateText = new Label(headerComp, SWT.NONE);
    sDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, windbarLabel, -5, null, -1));
    sDateText.setText(DateUtil.format(initialTime, "yyyy-MM-dd"));
    serverText = new Label(headerComp, SWT.NONE | SWT.RIGHT);
    serverText.setLayoutData(UIUtil.formData(0, 0, 0, 7, sDateText, -5, null, -1));
    serverText.setText("?");
}

97. CounterPastLongDateAllView#createUpperMenu()

Project: scouter
File: CounterPastLongDateAllView.java
private void createUpperMenu(Composite composite) {
    headerComp = new Composite(composite, SWT.NONE);
    headerComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    headerComp.setLayout(UIUtil.formLayout(0, 0));
    long initialTime = TimeUtil.getCurrentTime(serverId) - DatePeriodUnit.A_DAY.getTime();
    applyBtn = new Button(headerComp, SWT.PUSH);
    applyBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, 100, -5, null, -1));
    applyBtn.setText("Apply");
    applyBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    ((Button) event.widget).setEnabled(false);
                    try {
                        setInput(sDate, eDate, objType, counter, serverId);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    break;
            }
        }
    });
    Button manualBtn = new Button(headerComp, SWT.PUSH);
    manualBtn.setImage(Images.CTXMENU_RDC);
    manualBtn.setText("Manual");
    manualBtn.setLayoutData(UIUtil.formData(null, -1, 0, 2, applyBtn, -5, null, -1));
    manualBtn.addListener(SWT.Selection, new Listener() {

        public void handleEvent(Event event) {
            switch(event.type) {
                case SWT.Selection:
                    Display display = Display.getCurrent();
                    if (display == null) {
                        display = Display.getDefault();
                    }
                    calDialog = new DualCalendarDialog(display, CounterPastLongDateAllView.this);
                    calDialog.show(UIUtil.getMousePosition());
                    break;
            }
        }
    });
    periodCombo = new Combo(headerComp, SWT.VERTICAL | SWT.BORDER | SWT.READ_ONLY);
    periodCombo.setLayoutData(UIUtil.formData(null, -1, 0, 3, manualBtn, -5, null, -1));
    ArrayList<String> periodStrList = new ArrayList<String>();
    for (DatePeriodUnit minute : DatePeriodUnit.values()) {
        periodStrList.add(minute.getLabel());
    }
    periodCombo.setItems(periodStrList.toArray(new String[DatePeriodUnit.values().length]));
    periodCombo.select(2);
    periodCombo.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (((Combo) e.widget).getSelectionIndex() == 0) {
                setStartEndDate(30);
            } else if (((Combo) e.widget).getSelectionIndex() == 1) {
                setStartEndDate(7);
            } else {
                setStartEndDate(1);
            }
        }

        private void setStartEndDate(int i) {
            long yesterday = TimeUtil.getCurrentTime(serverId) - DatePeriodUnit.A_DAY.getTime();
            long startDate = TimeUtil.getCurrentTime(serverId) - (DatePeriodUnit.A_DAY.getTime() * i);
            sDateText.setText(DateUtil.format(startDate, "yyyy-MM-dd"));
            eDateText.setText(DateUtil.format(yesterday, "yyyy-MM-dd"));
            sDate = DateUtil.format(startDate, "yyyyMMdd");
            eDate = DateUtil.format(yesterday, "yyyyMMdd");
            stime = DateUtil.getTime(sDate, "yyyyMMdd");
            etime = DateUtil.getTime(eDate, "yyyyMMdd") + DateUtil.MILLIS_PER_DAY;
        }
    });
    eDateText = new Label(headerComp, SWT.NONE);
    eDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, periodCombo, -5, null, -1));
    eDateText.setText(DateUtil.format(initialTime - 1, "yyyy-MM-dd"));
    Label windbarLabel = new Label(headerComp, SWT.NONE);
    windbarLabel.setLayoutData(UIUtil.formData(null, -1, 0, 7, eDateText, -5, null, -1));
    windbarLabel.setText("~");
    sDateText = new Label(headerComp, SWT.NONE);
    sDateText.setLayoutData(UIUtil.formData(null, -1, 0, 7, windbarLabel, -5, null, -1));
    sDateText.setText(DateUtil.format(initialTime, "yyyy-MM-dd"));
    serverText = new Label(headerComp, SWT.NONE | SWT.RIGHT);
    serverText.setLayoutData(UIUtil.formData(0, 0, 0, 7, sDateText, -5, null, -1));
    serverText.setText("?");
}

98. LabelNewsActionPresentation#create()

Project: RSSOwl
File: LabelNewsActionPresentation.java
/*
   * @see org.rssowl.ui.IFilterActionPresentation#create(org.eclipse.swt.widgets.Composite, java.lang.Object)
   */
public void create(Composite parent, Object data) {
    fContainer = new Composite(parent, SWT.NONE);
    fContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 0, false));
    ((GridLayout) fContainer.getLayout()).marginLeft = 5;
    fContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fLabelCombo = new Combo(fContainer, SWT.READ_ONLY | SWT.BORDER);
    fLabelCombo.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fLabelCombo.setVisibleItemCount(15);
    fViewer = new ComboViewer(fLabelCombo);
    fViewer.setContentProvider(new ArrayContentProvider());
    fViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            if (element == NEW_LABEL_MARKER)
                return Messages.LabelNewsActionPresentation_NEW_LABEL;
            return ((ILabel) element).getName();
        }
    });
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (NEW_LABEL_MARKER == selection.getFirstElement())
                onCreateLabel();
        }
    });
    /* Set Input */
    Collection<ILabel> labels = CoreUtils.loadSortedLabels();
    updateInput(labels);
    /* Set Selection */
    if (fLabelCombo.getItemCount() > 0) {
        if (data != null) {
            for (ILabel label : labels) {
                if (label.getId().equals(data)) {
                    fViewer.setSelection(new StructuredSelection(label));
                    break;
                }
            }
        }
        if (fLabelCombo.getSelectionIndex() == -1)
            fLabelCombo.select(0);
    }
}

99. FeedsPreferencePage#createGeneralGroup()

Project: RSSOwl
File: FeedsPreferencePage.java
private void createGeneralGroup(TabFolder parent) {
    Composite group = new Composite(parent, SWT.NONE);
    group.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    group.setLayout(LayoutUtils.createGridLayout(1, 10, 10));
    TabItem item = new TabItem(parent, SWT.None);
    item.setText(Messages.FeedsPreferencePage_GENERAL);
    item.setControl(group);
    /* Auto-Reload */
    Composite autoReloadContainer = new Composite(group, SWT.NONE);
    autoReloadContainer.setLayout(LayoutUtils.createGridLayout(3, 0, 0));
    autoReloadContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fUpdateCheck = new Button(autoReloadContainer, SWT.CHECK);
    fUpdateCheck.setText(Messages.FeedsPreferencePage_UPDATE_FEEDS);
    fUpdateCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.BM_UPDATE_INTERVAL_STATE));
    fUpdateCheck.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            fUpdateValueSpinner.setEnabled(fUpdateCheck.getSelection());
            fUpdateScopeCombo.setEnabled(fUpdateCheck.getSelection());
        }
    });
    fUpdateValueSpinner = new Spinner(autoReloadContainer, SWT.BORDER);
    fUpdateValueSpinner.setMinimum(1);
    fUpdateValueSpinner.setMaximum(999);
    fUpdateValueSpinner.setEnabled(fUpdateCheck.getSelection());
    long updateInterval = fGlobalScope.getLong(DefaultPreferences.BM_UPDATE_INTERVAL);
    int updateScope = getUpdateIntervalScope();
    if (updateScope == SECONDS_SCOPE)
        fUpdateValueSpinner.setSelection((int) (updateInterval));
    else if (updateScope == MINUTES_SCOPE)
        fUpdateValueSpinner.setSelection((int) (updateInterval / MINUTE_IN_SECONDS));
    else if (updateScope == HOURS_SCOPE)
        fUpdateValueSpinner.setSelection((int) (updateInterval / HOUR_IN_SECONDS));
    else if (updateScope == DAYS_SCOPE)
        fUpdateValueSpinner.setSelection((int) (updateInterval / DAY_IN_SECONDS));
    fUpdateScopeCombo = new Combo(autoReloadContainer, SWT.READ_ONLY);
    fUpdateScopeCombo.add(Messages.FeedsPreferencePage_INTERVAL_SECONDS);
    fUpdateScopeCombo.add(Messages.FeedsPreferencePage_MINUTES);
    fUpdateScopeCombo.add(Messages.FeedsPreferencePage_HOURS);
    fUpdateScopeCombo.add(Messages.FeedsPreferencePage_DAYS);
    fUpdateScopeCombo.select(updateScope);
    fUpdateScopeCombo.setEnabled(fUpdateCheck.getSelection());
    /* Reload Feeds on Startup */
    fReloadOnStartupCheck = new Button(group, SWT.CHECK);
    fReloadOnStartupCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fReloadOnStartupCheck.setText(Messages.FeedsPreferencePage_UPDATE_ON_STARTUP);
    fReloadOnStartupCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.BM_RELOAD_ON_STARTUP));
    /* Open on Startup */
    fOpenOnStartupCheck = new Button(group, SWT.CHECK);
    fOpenOnStartupCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    //Disabled due to performance issues opening 100 feeds at once
    ((GridData) fOpenOnStartupCheck.getLayoutData()).exclude = true;
    fOpenOnStartupCheck.setText(Messages.FeedsPreferencePage_DISPLAY_ON_STARTUP);
    fOpenOnStartupCheck.setSelection(fGlobalScope.getBoolean(DefaultPreferences.BM_OPEN_ON_STARTUP));
}

100. ImportSourcePage#createImportKeywordControls()

Project: RSSOwl
File: ImportSourcePage.java
private void createImportKeywordControls(Composite container) {
    fImportFromKeywordRadio = new Button(container, SWT.RADIO);
    fImportFromKeywordRadio.setSelection(fIsKewordSearch && !isWelcome());
    fImportFromKeywordRadio.setText(Messages.ImportSourcePage_IMPORT_BY_KEYWORD);
    fImportFromKeywordRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updatePageComplete();
            boolean importFromKeyword = fImportFromKeywordRadio.getSelection();
            fKeywordInput.setEnabled(importFromKeyword);
            fLocalizedFeedSearch.setEnabled(importFromKeyword);
            if (importFromKeyword) {
                hookKeywordAutocomplete(false);
                fKeywordInput.setFocus();
            }
        }
    });
    Composite keywordInputContainer = new Composite(container, SWT.NONE);
    keywordInputContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    ((GridLayout) keywordInputContainer.getLayout()).marginLeft = 15;
    ((GridLayout) keywordInputContainer.getLayout()).marginBottom = 10;
    keywordInputContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fKeywordInput = new Combo(keywordInputContainer, SWT.DROP_DOWN | SWT.BORDER);
    OwlUI.makeAccessible(fKeywordInput, fImportFromKeywordRadio);
    fKeywordInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    fKeywordInput.setEnabled(fImportFromKeywordRadio.getSelection());
    if (fImportFromKeywordRadio.getSelection()) {
        hookKeywordAutocomplete(true);
        fKeywordInput.setFocus();
    }
    String[] previousKeywords = fPreferences.getStrings(DefaultPreferences.IMPORT_KEYWORDS);
    if (previousKeywords != null) {
        fKeywordInput.setVisibleItemCount(previousKeywords.length);
        for (String keyword : previousKeywords) {
            fKeywordInput.add(keyword);
        }
    }
    fKeywordInput.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            updatePageComplete();
        }
    });
    fLocalizedFeedSearch = new Button(keywordInputContainer, SWT.CHECK);
    fLocalizedFeedSearch.setSelection(fPreferences.getBoolean(DefaultPreferences.LOCALIZED_FEED_SEARCH));
    fLocalizedFeedSearch.setEnabled(fImportFromKeywordRadio.getSelection());
    String clientLanguage = Locale.getDefault().getDisplayLanguage(Locale.ENGLISH);
    if (StringUtils.isSet(clientLanguage))
        fLocalizedFeedSearch.setText(NLS.bind(Messages.ImportSourcePage_MATCH_LANGUAGE_N, clientLanguage));
    else
        fLocalizedFeedSearch.setText(Messages.ImportSourcePage_MATCH_LANGUAGE);
}