Example usage for org.eclipse.jface.viewers ComboViewer ComboViewer

List of usage examples for org.eclipse.jface.viewers ComboViewer ComboViewer

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ComboViewer ComboViewer.

Prototype

public ComboViewer(Composite parent, int style) 

Source Link

Document

Creates a combo viewer on a newly-created combo control under the given parent.

Usage

From source file:com.testify.ecfeed.ui.dialogs.GeneratorSetupDialog.java

License:Open Source License

private void createTestSuiteComposite(Composite container) {
    Composite composite = new Composite(container, SWT.NONE);
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label testSuiteLabel = new Label(composite, SWT.NONE);
    testSuiteLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    testSuiteLabel.setText("Test suite");

    ComboViewer testSuiteViewer = new ComboViewer(composite, SWT.NONE);
    fTestSuiteCombo = testSuiteViewer.getCombo();
    fTestSuiteCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    fTestSuiteCombo.setItems(fMethod.getTestSuites().toArray(new String[] {}));
    fTestSuiteCombo.addModifyListener(new ModifyListener() {
        @Override/*from  www  .jav a 2  s.  c  o m*/
        public void modifyText(ModifyEvent e) {
            updateOkButton();
        }
    });
    fTestSuiteCombo.setText(Constants.DEFAULT_NEW_TEST_SUITE_NAME);
}

From source file:com.testify.ecfeed.ui.dialogs.GeneratorSetupDialog.java

License:Open Source License

private void createGeneratorViewer(final Composite parent) {
    final GeneratorFactory<ChoiceNode> generatorFactory = new GeneratorFactory<>();
    ComboViewer generatorViewer = new ComboViewer(parent, SWT.READ_ONLY);
    fGeneratorCombo = generatorViewer.getCombo();
    fGeneratorCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    fGeneratorCombo.addModifyListener(new ModifyListener() {
        @Override/*from   www  . j ava2 s. c om*/
        public void modifyText(ModifyEvent e) {
            try {
                fSelectedGenerator = generatorFactory.getGenerator(fGeneratorCombo.getText());
                createParametersComposite(parent, fSelectedGenerator.parameters());
                fMainContainer.layout();
            } catch (GeneratorException exception) {
                exception.printStackTrace();
                fGeneratorCombo.setText("");
            }
        }
    });
    if (fGeneratorFactory.availableGenerators().size() > 0) {
        String[] availableGenerators = generatorFactory.availableGenerators().toArray(new String[] {});
        for (String generator : availableGenerators) {
            fGeneratorCombo.add(generator);
        }
        fGeneratorCombo.select(0);
        setOkButton(true);
    }
}

From source file:com.testify.ecfeed.ui.editor.ChoiceDetailsPage.java

License:Open Source License

private void refreshValueEditor() {
    String type = fChoiceIf.getParameter().getType();
    if (fValueCombo != null && fValueCombo.isDisposed() == false) {
        fValueCombo.dispose();/*from   ww w  .j  a v a 2  s.  c  o m*/
    }
    int style = SWT.DROP_DOWN;
    if (AbstractParameterInterface.isBoolean(type)) {
        style |= SWT.READ_ONLY;
    }
    fValueCombo = new ComboViewer(fAttributesComposite, style).getCombo();
    fValueCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    Set<String> items = new LinkedHashSet<String>(AbstractParameterInterface.getSpecialValues(type));
    if (JavaUtils.isUserType(type)) {
        Set<String> usedValues = fChoiceIf.getParameter().getLeafChoiceValues();
        usedValues.removeAll(items);
        items.addAll(usedValues);
    }
    items.add(fChoiceIf.getValue());
    fValueCombo.setItems(items.toArray(new String[] {}));
    fValueCombo.setText(fChoiceIf.getValue());
    fValueCombo.addSelectionListener(new ValueComboListener());
    fAttributesComposite.layout();
}

From source file:com.testify.ecfeed.ui.editor.TestCaseDetailsPage.java

License:Open Source License

private void createTestSuiteEdit(Composite parent) {
    Composite composite = getToolkit().createComposite(parent);
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    getToolkit().createLabel(composite, "Test suite: ");

    fTestSuiteNameCombo = new ComboViewer(composite, SWT.NONE).getCombo();
    fTestSuiteNameCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    fTestSuiteNameCombo.addSelectionListener(new RenameTestCaseAdapter());

    fExecuteButton = getToolkit().createButton(composite, "Execute", SWT.NONE);
    fExecuteButton.addSelectionListener(new SelectionAdapter() {
        @Override/*  w w w. java2 s  .  co  m*/
        public void widgetSelected(SelectionEvent e) {
            fTestCaseIf.execute();
        }
    });
    getToolkit().paintBordersFor(fTestSuiteNameCombo);
}

From source file:com.trivadis.loganalysis.ui.ChartCustomizationPanel.java

License:Open Source License

private ComboViewer comboAxisSelection(final Composite right, final String label) {
    final ComboViewer cboXAxis = new ComboViewer(right, SWT.DROP_DOWN | SWT.READ_ONLY);
    final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
    cboXAxis.setContentProvider(contentProvider);
    cboXAxis.setLabelProvider(new LabelProvider() {
        @Override//from  www  .j a v  a  2  s .c  o  m
        public String getText(final Object element) {
            final String retVal;
            if (element instanceof IValueProvider) {
                final IValueProvider vp = (IValueProvider) element;
                retVal = vp.getLabel() + " (" + vp.getUnit() + ")";
            } else {
                retVal = super.getText(element);
            }
            return retVal;
        }
    });
    cboXAxis.setInput(new WritableList(valueProviders, IValueProvider.class));
    return cboXAxis;
}

From source file:com.xored.af.ui.forms.parts.ComboFormPart.java

License:Open Source License

public ComboFormPart(final FormToolkit toolkit, final Composite parent, final FeatureUIDescriptor ui,
        final IValueProperty property) {

    super(ui, property);

    if (ui.label != null) {
        label = toolkit.createLabel(parent, ui.label + ":");
        label.setToolTipText(ui.tooltip);
        GridDataFactory.swtDefaults().applyTo(label);
    } else {/*from w w  w. j  ava 2  s.  c o m*/
        label = null;
    }

    viewer = new ComboViewer(parent, SWT.READ_ONLY);
    viewer.getControl().setToolTipText(ui.tooltip);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(viewer.getControl());

    final ComboControl descriptor = (ComboControl) ui.control;
    viewer.setContentProvider(descriptor.createContentProvider());
    viewer.setLabelProvider(descriptor.createLabelProvider());
}

From source file:com.xse.eclipseui.widgets.ComboBoxWidget.java

License:Open Source License

protected ComboViewer createViewer() {
    return new ComboViewer(this, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
}

From source file:de.bht.fpa.mail.s000000.common.filter.FilterDialog.java

License:Open Source License

private void addUnionIntersection() {
    Composite unionIntersectionComponent = new Composite(container, SWT.NONE);
    unionIntersectionComponent.setLayout(new GridLayout(NR_OF_COLUMNS, false));

    Label lblBeiErfllen = new Label(unionIntersectionComponent, SWT.NONE);
    lblBeiErfllen.setText("If");

    groupFilterComboViewer = new ComboViewer(unionIntersectionComponent, SWT.READ_ONLY);
    groupFilterComboViewer.setContentProvider(ArrayContentProvider.getInstance());
    groupFilterComboViewer.setLabelProvider(new LabelProvider() {
        @Override//from w  w  w  . j a  va2s .c om
        public String getText(Object element) {
            return ((FilterGroupType) element).value();
        }
    });
    groupFilterComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            filterGroupType = SelectionHelper.handleStructuredSelectionEvent(event, FilterGroupType.class);
        }
    });
    groupFilterComboViewer.setInput(FilterGroupType.values());
    groupFilterComboViewer.setSelection(new StructuredSelection(FilterGroupType.UNION));

    Label lblDerFolgendenBedingungen = new Label(unionIntersectionComponent, SWT.NONE);
    lblDerFolgendenBedingungen.setText("of the following conditions are met:");
}

From source file:de.bht.fpa.mail.s000000.common.filter.operator.BooleanFilterOperatorComposite.java

License:Open Source License

public BooleanFilterOperatorComposite(Composite parent) {
    super(parent, SWT.NONE);
    setLayout(new GridLayout(2, false));

    Combo comboOperation = new Combo(this, SWT.READ_ONLY);
    comboOperation.setItems(new String[] { FilterOperator.IS.value() });
    comboOperation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    comboOperation.select(0);/*  ww w .  j a v  a  2s .c o  m*/

    comboViewer = new ComboViewer(this, SWT.READ_ONLY);
    Combo comboValue = comboViewer.getCombo();
    comboValue.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    comboViewer.setContentProvider(ArrayContentProvider.getInstance());
    comboViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return String.valueOf(element);
        }
    });
    comboViewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE });

    // default
    comboViewer.setSelection(new StructuredSelection(Boolean.TRUE));

    operator = FilterOperator.IS;
}

From source file:de.bht.fpa.mail.s000000.common.filter.operator.DefaultFilterOperatorComposite.java

License:Open Source License

public DefaultFilterOperatorComposite(Composite parent) {
    super(parent, SWT.NONE);
    setLayout(new GridLayout(2, false));

    ComboViewer comboViewer = new ComboViewer(this, SWT.READ_ONLY);
    Combo combo = comboViewer.getCombo();
    combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    comboViewer.setContentProvider(ArrayContentProvider.getInstance());
    comboViewer.setLabelProvider(new LabelProvider() {
        @Override//from   ww  w.  j  av a 2s.  com
        public String getText(Object element) {
            if (!(element instanceof FilterOperator)) {
                throw new IllegalArgumentException();
            }
            return ((FilterOperator) element).value();
        }
    });
    comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            operator = SelectionHelper.handleStructuredSelectionEvent(event, FilterOperator.class);
        }
    });
    comboViewer.setInput(FilterOperator.values());

    // default
    comboViewer.setSelection(new StructuredSelection(FilterOperator.CONTAINS));

    text = new Text(this, SWT.BORDER);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
}