Java Code Examples for org.eclipse.jface.viewers.ComboViewer#setSorter()
The following examples show how to use
org.eclipse.jface.viewers.ComboViewer#setSorter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ErrorsWarningsPage.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private void addProblemTypeRow(Composite categoryProblemsPanel, IGdtProblemType problemType) { GridData problemLabelLayout = new GridData(SWT.FILL, SWT.CENTER, true, false); Label problemLabel = new Label(categoryProblemsPanel, SWT.NONE); problemLabel.setLayoutData(problemLabelLayout); problemLabel.setText(problemType.getDescription()); ComboViewer severityCombo = new ComboViewer(categoryProblemsPanel, SWT.READ_ONLY); GridData severityComboLayout = new GridData(SWT.FILL, SWT.CENTER, false, false); severityCombo.getCombo().setLayoutData(severityComboLayout); severityCombo.setContentProvider(new ArrayContentProvider()); severityCombo.setLabelProvider(severityLabelProvider); severityCombo.setSorter(severityViewerSorter); severityCombo.setInput(GdtProblemSeverity.values()); // Save the association between the problem type and this combo problemSeverityCombos.put(problemType, severityCombo); }
Example 2
Source File: ScriptExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createReturnTypeComposite(final Composite parent) { final Composite typeComposite = new Composite(parent, SWT.NONE); typeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); final GridLayout gl = new GridLayout(3, false); gl.marginWidth = 0; gl.marginHeight = 0; typeComposite.setLayout(gl); final Label typeLabel = new Label(typeComposite, SWT.NONE); typeLabel.setText(Messages.returnType); typeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create()); typeCombo = new ComboViewer(typeComposite, SWT.BORDER); typeCombo.getCombo().setLayoutData( GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).indent(10, 0).create()); typeCombo.setContentProvider(new ExpressionReturnTypeContentProvider()); typeCombo.setLabelProvider(new LabelProvider()); typeCombo.setSorter(new ViewerSorter() { @Override public int compare(final Viewer viewer, final Object e1, final Object e2) { final String t1 = (String) e1; final String t2 = (String) e2; return t1.compareTo(t2); } }); typeCombo.getCombo().addModifyListener(e -> fireSelectionChanged()); browseClassesButton = new Button(typeComposite, SWT.PUSH); browseClassesButton.setText(Messages.browse); browseClassesButton.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create()); browseClassesButton.addListener(SWT.Selection, event -> openClassSelectionDialog()); }
Example 3
Source File: DataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void createTypeChooser(final Composite parent) { final Label typeLabel = new Label(parent, SWT.NONE); typeLabel.setText(Messages.datatypeLabel); typeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); typeCombo = new ComboViewer(parent, SWT.BORDER | SWT.READ_ONLY); typeCombo.setContentProvider(new ArrayContentProvider()); typeCombo.setLabelProvider(new DataTypeLabelProvider()); typeCombo.addFilter(typeViewerFilter); typeCombo.setSorter(new ViewerSorter()); typeCombo.getCombo().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).indent(10, 0).create()); typeDescriptionDecorator = new ControlDecoration(typeCombo.getCombo(), SWT.LEFT); typeDescriptionDecorator.setImage(Pics.getImage(PicsConstants.hint)); if (allowEnum) { final Button createOptionButton = new Button(parent, SWT.PUSH); createOptionButton.setText(Messages.listOfOptions); createOptionButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final EnumDataTypeDialog dialog = new EnumDataTypeDialog(Display.getDefault().getActiveShell(), ModelHelper.getMainProcess(container)); if (dialog.open() == Window.OK) { final EnumType type = dialog.getSelectedEnum(); updateDatabinding(); typeCombo.setSelection(new StructuredSelection(type)); } } }); } else { typeCombo.getCombo() .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).indent(10, 0).create()); } }
Example 4
Source File: IterationPropertySection.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private void createInputForDataGroup(final TabbedPropertySheetWidgetFactory widgetFactory, final Composite dataContent) { final Group inputGroup = widgetFactory.createGroup(dataContent, Messages.input); inputGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); inputGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).spacing(5, 3).create()); final Label inputListlabel = widgetFactory.createLabel(inputGroup, Messages.inputList + " *"); inputListlabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).create()); final ControlDecoration inputListlabelDecoration = new ControlDecoration(inputListlabel, SWT.RIGHT); inputListlabelDecoration.setMarginWidth(-3); inputListlabelDecoration.setDescriptionText(Messages.inputListHint); inputListlabelDecoration.setImage(Pics.getImage(PicsConstants.hint)); final ComboViewer inputListComboViewer = createComboViewer(widgetFactory, inputGroup, new ObservableListContentProviderWithProposalListenersForPool()); inputListComboViewer.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(200, SWT.DEFAULT).indent(5, 0).create()); inputListComboViewer.addFilter(new ListDataFilter()); inputListComboViewer.setSorter(new DataViewerSorter()); final IViewerObservableValue observeSingleSelection = ViewersObservables .observeSingleSelection(inputListComboViewer); final IObservableValue selectionObservable = ViewersObservables.observeSingleSelection(selectionProvider); final IObservableValue observeInputCollectionValue = CustomEMFEditObservables.observeDetailValue( Realm.getDefault(), selectionObservable, ProcessPackage.Literals.MULTI_INSTANTIABLE__COLLECTION_DATA_TO_MULTI_INSTANTIATE); selectionObservable.addValueChangeListener(createInputValueChanged(inputListComboViewer, observeSingleSelection, observeInputCollectionValue, false)); inputListComboViewer.addSelectionChangedListener(createComboSelectionListener(inputListComboViewer, false)); inputListComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent event) { updateReturnTypeFromSelectedInputCollection(inputListComboViewer); } }); context.bindValue(observeSingleSelection, observeInputCollectionValue); final Label label = widgetFactory.createLabel(inputGroup, ""); label.setImage(Pics.getImage("icon-arrow-down.png")); label.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).align(SWT.CENTER, SWT.CENTER).create()); createIteratorControl(widgetFactory, inputGroup); }