Java Code Examples for org.eclipse.jface.viewers.ComboViewer#setContentProvider()
The following examples show how to use
org.eclipse.jface.viewers.ComboViewer#setContentProvider() .
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: MapChoiceControl.java From depan with Apache License 2.0 | 6 votes |
public MapChoiceControl(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT); viewer.setContentProvider(new ControlContentProvider()); viewer.setLabelProvider(CONTROL_LABEL_PROVIDER); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override public String getString(Object object) { return CONTROL_LABEL_PROVIDER.getText(object); } })); listener = new ControlSelectionChangedListener(); viewer.addSelectionChangedListener(listener); }
Example 2
Source File: ComposeModeControl.java From depan with Apache License 2.0 | 6 votes |
public ComposeModeControl(Composite parent) { super(parent, SWT.NONE); setLayout(new FillLayout()); viewer = new ComboViewer(this, SWT.READ_ONLY | SWT.FLAT); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(CONTROL_LABEL_PROVIDER); viewer.setComparator(new AlphabeticSorter(new ViewerObjectToString() { @Override public String getString(Object object) { return CONTROL_LABEL_PROVIDER.getText(object); } })); viewer.setInput(ComposeMode.values()); listener = new ControlSelectionChangedListener(); viewer.addSelectionChangedListener(listener); }
Example 3
Source File: StatechartPropertySection.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected void createDomainCombo(Composite leftColumn) { Label label = getToolkit().createLabel(leftColumn, "Statechart domain"); GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label); domainCombo = new ComboViewer(leftColumn); GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo()); Label spacer = getToolkit().createLabel(leftColumn, ""); GridDataFactory.fillDefaults().applyTo(spacer); domainCombo.setContentProvider(new ArrayContentProvider()); domainCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((IDomain) element).getName(); } }); List<IDomain> domains = DomainRegistry.getDomains(); for (IDomain domainDescriptor : domains) { domainCombo.add(domainDescriptor); } if (domains.size() <= 1) { domainCombo.getControl().setEnabled(false); } }
Example 4
Source File: SectionList.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createComponentViewer(Composite composite) { UI.formLabel(composite, toolkit, M.Component); componentViewer = new ComboViewer(composite); UI.gridData(componentViewer.getControl(), false, false).widthHint = 250; componentViewer.setContentProvider(ArrayContentProvider .getInstance()); componentViewer.setLabelProvider(new ComponentLabel()); componentViewer.setInput(ReportComponent.values()); componentViewer.addSelectionChangedListener((evt) -> { ReportComponent c = Viewers.getFirst(evt.getSelection()); if (c == null || c == ReportComponent.NONE) model.componentId = null; else model.componentId = c.getId(); editor.setDirty(true); }); if (model.componentId != null) componentViewer.setSelection(new StructuredSelection( ReportComponent.getForId(model.componentId))); }
Example 5
Source File: DbImportPage.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createExistingSection(Composite body) { Button existingCheck = new Button(body, SWT.RADIO); existingCheck.setText("Existing database"); existingCheck.setSelection(true); Controls.onSelect(existingCheck, (e) -> { setSelection(config.EXISTING_MODE); }); Composite composite = new Composite(body, SWT.NONE); UI.gridLayout(composite, 1); UI.gridData(composite, true, false); existingViewer = new ComboViewer(composite); UI.gridData(existingViewer.getControl(), true, false); existingViewer.setLabelProvider(new DbLabel()); existingViewer.setContentProvider(ArrayContentProvider.getInstance()); existingViewer.addSelectionChangedListener(e -> selectDatabase()); fillExistingViewer(); }
Example 6
Source File: XPathExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 6 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(2, 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 | SWT.READ_ONLY); typeCombo.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create()); typeCombo.setContentProvider(new ArrayContentProvider()); typeCombo.setInput(XPathReturnType.getAvailableReturnTypes()); typeCombo.setSelection(new StructuredSelection(XPathReturnType.XPATH_STRING)); }
Example 7
Source File: QueryExpressionEditor.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createBusinessObjectComboViewer(final Composite composite, final IObservableList observeBoList) { final Composite boComposite = new Composite(composite, SWT.NONE); boComposite.setLayoutData(GridDataFactory.fillDefaults().create()); boComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 2).create()); final Label boLabel = new Label(boComposite, SWT.NONE); boLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).create()); boLabel.setText(Messages.businessObject); final ComboViewer boCombo = new ComboViewer(boComposite, SWT.READ_ONLY | SWT.BORDER); boCombo.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, false).minSize(100, SWT.DEFAULT).create()); boCombo.setLabelProvider(new LabelProvider() { @Override public String getText(final Object element) { if (element instanceof BusinessObjectExpressionQuery) { return ((BusinessObjectExpressionQuery) element).getQualifiedName(); } return super.getText(element); } }); boCombo.setContentProvider(new ObservableListContentProvider()); boCombo.setInput(observeBoList); observeBOSingleSelection = ViewersObservables.observeSingleSelection(boCombo); }
Example 8
Source File: EntryPropertySection.java From statecharts with Eclipse Public License 1.0 | 5 votes |
private void createEntryKindControl(Composite parent) { Label kindLabel = getToolkit().createLabel(parent, "Entry Kind: "); GridDataFactory.fillDefaults().applyTo(kindLabel); entryKindViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE); entryKindViewer.setContentProvider(new ArrayContentProvider()); entryKindViewer.setLabelProvider(new LabelProvider()); entryKindViewer.setInput(EntryKind.values()); GridDataFactory.fillDefaults().grab(true, false) .applyTo(entryKindViewer.getControl()); }
Example 9
Source File: RelationFieldDetailsControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void createRelationKindCombo() { ComboViewer relationComboViewer = new ComboViewer(this, SWT.BORDER | SWT.READ_ONLY); relationComboViewer.getControl() .setLayoutData(GridDataFactory.fillDefaults().hint(400, SWT.DEFAULT).indent(0, -5).create()); relationComboViewer.setContentProvider(ArrayContentProvider.getInstance()); relationComboViewer.setLabelProvider(new LabelProviderBuilder<RelationType>() .withTextProvider(type -> Objects.equals(type, RelationType.AGGREGATION) ? Messages.aggregation : Messages.composition) .createLabelProvider()); relationComboViewer.setInput(RelationType.values()); IObservableValue<RelationType> selection = ViewersObservables.observeSingleSelection(relationComboViewer); IObservableValue<RelationType> relationTypeObservable = EMFObservables.observeDetailValue(Realm.getDefault(), selectedFieldObservable, BusinessDataModelPackage.Literals.RELATION_FIELD__TYPE); relationTypeObservable.addValueChangeListener(e -> { if (selectedFieldObservable.getValue() != null && e.diff.getOldValue() != null && e.diff.getNewValue() != null) { RelationField oldValue = (RelationField) EcoreUtil.copy(selectedFieldObservable.getValue()); oldValue.setType(e.diff.getOldValue()); DiffElement diffElement = new DiffElement(Event.UPDATE_ATTRIBUTE_TYPE, oldValue, selectedFieldObservable.getValue()); diffElement.addProperty(AttributeEditionControl.PARENT_QUALIFIED_NAME, formPage.observeBusinessObjectSelected().getValue().getQualifiedName()); formPage.refactorAccessControl(diffElement); } }); ctx.bindValue(selection, relationTypeObservable); }
Example 10
Source File: ConverterUtil.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 对下拉列表和转换器列表进行绑定 * @param context * @param comboViewer * @param model * ; */ public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) { // ViewerSupport.bind(comboViewer, BeansObservables.observeList( // model, "supportTypes", String.class), // Properties.selfValue(String.class)); // // // context.bindValue(ViewersObservables // .observeSingleSelection(comboViewer), BeansObservables // .observeValue(model, // "selectedType")); // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setComparator(new ViewerComparator()); // IObservableMap[] attributeMaps = BeansObservables.observeMaps( // viewerContentProvider.getKnownElements(), // ConverterBean.class, new String[] { "description" }); // comboViewer.setLabelProvider(new ObservableMapLabelProvider( // attributeMaps)); // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); comboViewer.setInput(model.getSupportTypes()); IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer); IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null); context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE)); }
Example 11
Source File: JointDataSetPage.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * create right composite for page * * @param composite */ private void createRightGroup( Composite composite ) { rightGroup = new Group( composite, SWT.NONE ); rightGroup.setLayout( new FormLayout( ) ); rightGroup.setLayoutData( new GridData( GridData.FILL_BOTH ) ); FormData data = new FormData( ); data.top = new FormAttachment( 0, 5 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 10, -5 ); rightDataSetChooser = new ComboViewer( rightGroup, SWT.DROP_DOWN | SWT.READ_ONLY ); rightDataSetChooser.getControl( ).setLayoutData( data ); DataSetComboProvider provider = new DataSetComboProvider( ); rightDataSetChooser.setContentProvider( provider ); rightDataSetChooser.setLabelProvider( provider ); rightDataSetChooser.setInput( dataSetList ); rightDataSetChooser.addSelectionChangedListener( this ); data = new FormData( ); data.top = new FormAttachment( rightDataSetChooser.getControl( ), 10 ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 100, -5 ); data.bottom = new FormAttachment( 100, -5 ); rightColumnList = new ListViewer( rightGroup, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER ); rightColumnList.getControl( ).setLayoutData( data ); ColumnProvider colProvider = new ColumnProvider( ); rightColumnList.setContentProvider( colProvider ); rightColumnList.setLabelProvider( colProvider ); rightColumnList.addSelectionChangedListener( this ); }
Example 12
Source File: ConverterUtil.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 对下拉列表和转换器列表进行绑定 * @param context * @param comboViewer * @param model * ; */ public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) { // ViewerSupport.bind(comboViewer, BeansObservables.observeList( // model, "supportTypes", String.class), // Properties.selfValue(String.class)); // // // context.bindValue(ViewersObservables // .observeSingleSelection(comboViewer), BeansObservables // .observeValue(model, // "selectedType")); // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setComparator(new ViewerComparator()); // IObservableMap[] attributeMaps = BeansObservables.observeMaps( // viewerContentProvider.getKnownElements(), // ConverterBean.class, new String[] { "description" }); // comboViewer.setLabelProvider(new ObservableMapLabelProvider( // attributeMaps)); // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); comboViewer.setInput(model.getSupportTypes()); IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer); IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null); context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE)); }
Example 13
Source File: ConverterUtil.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public static void bindValue(DataBindingContext context,ComboViewer comboViewer, ConverterViewModel model) { // ViewerSupport.bind(comboViewer, BeansObservables.observeList( // model, "supportTypes", String.class), // Properties.selfValue(String.class)); // // // context.bindValue(ViewersObservables // .observeSingleSelection(comboViewer), BeansObservables // .observeValue(model, // "selectedType")); // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); comboViewer.setContentProvider(new ArrayContentProvider()); comboViewer.setComparator(new ViewerComparator()); // IObservableMap[] attributeMaps = BeansObservables.observeMaps( // viewerContentProvider.getKnownElements(), // ConverterBean.class, new String[] { "description" }); // comboViewer.setLabelProvider(new ObservableMapLabelProvider( // attributeMaps)); // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); comboViewer.setInput(model.getSupportTypes()); IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer); IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class); context.bindValue(observableValue, BeansObservables .observeValue(model, "selectedType")); }
Example 14
Source File: CompilerBlock.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public CompilerBlock(Composite root, int style) { super(root, style); setLayout(new FillLayout(SWT.HORIZONTAL)); Composite parent = new Composite(this, SWT.NONE); parent.setLayout(new GridLayout(1, false)); groupDevMode = SWTFactory.createGroup(parent, GROUP_COMPILER_TITLE, 2, 1, GridData.FILL_HORIZONTAL); // Log level Label label = SWTFactory.createLabel(groupDevMode, "Log level:", 1); GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); gd_label.widthHint = 101; label.setLayoutData(gd_label); logLevelComboViewer = new ComboViewer(groupDevMode, SWT.READ_ONLY); new Label(groupDevMode, SWT.NONE); logLevelComboViewer.setContentProvider(new ArrayContentProvider()); logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider()); logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS); logLevelComboViewer.addPostSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { updateLaunchConfigHandler.updateLaunchConfig(); } }); }
Example 15
Source File: RuleConfigurationEditDialog.java From eclipse-cs with GNU Lesser General Public License v2.1 | 5 votes |
private Composite createGeneralSection() { Composite generalSettings = new Composite(mMainTab, SWT.NULL); generalSettings.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(2, false); generalSettings.setLayout(layout); // Build severity Label lblSeverity = new Label(generalSettings, SWT.NULL); lblSeverity.setText(Messages.RuleConfigurationEditDialog_lblSeverity); lblSeverity.setLayoutData(new GridData()); mSeverityCombo = new ComboViewer(generalSettings); mSeverityCombo.setContentProvider(new ArrayContentProvider()); mSeverityCombo.setLabelProvider(new LabelProvider() { /** * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) */ @Override public String getText(Object element) { return ((Severity) element).name(); } }); mSeverityCombo.getControl().setLayoutData(new GridData()); Group properties = new Group(generalSettings, SWT.NULL); properties.setLayout(new GridLayout(3, false)); properties.setText(Messages.RuleConfigurationEditDialog_lblProperties); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; properties.setLayoutData(gd); createConfigPropertyEntries(properties); if (mConfigPropertyWidgets == null || mConfigPropertyWidgets.length == 0) { properties.dispose(); } return generalSettings; }
Example 16
Source File: OverrideMethodsPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private ComboViewer createComboViewer(Composite comboComp) { ComboViewer v = new ComboViewer(comboComp); v.setContentProvider(this.strategyProvider); v.setLabelProvider(new LabelProvider()); v.setInput(""); return v; }
Example 17
Source File: JSEditor.java From birt with Eclipse Public License 1.0 | 4 votes |
public void createPartControl( Composite parent ) { Composite child = this.initEditorLayout( parent ); // Script combo cmbExprListViewer = new ComboViewer( cmbExpList ); JSExpListProvider provider = new JSExpListProvider( ); cmbExprListViewer.setContentProvider( provider ); cmbExprListViewer.setLabelProvider( provider ); cmbExprListViewer.setData( VIEWER_CATEGORY_KEY, VIEWER_CATEGORY_CONTEXT ); // SubFunctions combo JSSubFunctionListProvider subProvider = new JSSubFunctionListProvider( this ); // also add subProvider as listener of expr viewer. cmbExprListViewer.addSelectionChangedListener( subProvider ); cmbSubFunctions.addListener( CustomChooserComposite.DROPDOWN_EVENT, new Listener( ) { public void handleEvent( Event event ) { cmbSubFunctions.deselectAll( ); ScriptParser parser = new ScriptParser( getEditorText( ) ); Collection<IScriptMethodInfo> coll = parser.getAllMethodInfo( ); for ( Iterator<IScriptMethodInfo> itr = coll.iterator( ); itr.hasNext( ); ) { IScriptMethodInfo mtd = itr.next( ); cmbSubFunctions.markSelection( METHOD_DISPLAY_INDENT + mtd.getName( ) ); } } } ); cmbSubFunctionsViewer = new TextComboViewer( cmbSubFunctions ); cmbSubFunctionsViewer.setContentProvider( subProvider ); cmbSubFunctionsViewer.setLabelProvider( subProvider ); cmbSubFunctionsViewer.addSelectionChangedListener( subProvider ); cmbSubFunctionsViewer.addSelectionChangedListener( propertyDefnChangeListener ); // Initialize the model for the document. Object model = getModel( ); if ( model != null ) { cmbExpList.setVisible( true ); cmbSubFunctions.setVisible( true ); setComboViewerInput( model ); } else { setComboViewerInput( Messages.getString( "JSEditor.Input.trial" ) ); //$NON-NLS-1$ } cmbExprListViewer.addSelectionChangedListener( palettePage.getSupport( ) ); cmbExprListViewer.addSelectionChangedListener( propertyDefnChangeListener ); scriptEditor.createPartControl( child ); scriptValidator = new ScriptValidator( getViewer( ) ); disableEditor( ); SourceViewer viewer = getViewer( ); IDocument document = viewer == null ? null : viewer.getDocument( ); if ( document != null ) { IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager( document ); if ( undoManager != null ) { undoManager.addDocumentUndoListener( undoListener ); } document.addDocumentListener( documentListener ); } }
Example 18
Source File: N4JSNewProjectWizardCreationPage.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void createControl(final Composite parent) { super.createControl(parent); // We need to create the UI controls from the parent class. final Composite control = (Composite) getControl(); control.setLayout(GridLayoutFactory.fillDefaults().create()); control.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); final DataBindingContext dbc = new DataBindingContext(); control.addDisposeListener(e -> dbc.dispose()); createVendorIdControls(dbc, control); ComboViewer projectTypeCombo = new ComboViewer(control, READ_ONLY); projectTypeCombo.setLabelProvider(new ProjectTypeLabelProvider()); projectTypeCombo.setContentProvider(ArrayContentProvider.getInstance()); projectTypeCombo.getControl().setLayoutData(fillDefaults().grab(true, false).create()); projectTypeCombo.setInput(ProjectType.values()); Composite projectTypePropertyControls = new Composite(control, NONE); StackLayout changingStackLayout = new StackLayout(); projectTypePropertyControls.setLayout(changingStackLayout); projectTypePropertyControls.setLayoutData(fillDefaults().align(FILL, FILL).grab(true, true).create()); Composite defaultOptions = initDefaultOptionsUI(dbc, projectTypePropertyControls); Composite libraryProjectOptionsGroup = initLibraryOptionsUI(dbc, projectTypePropertyControls); Composite testProjectOptionsGroup = initTestProjectUI(dbc, projectTypePropertyControls); initProjectTypeBinding(dbc, projectTypeCombo); // Configure stack layout to show advanced options projectTypeCombo.addPostSelectionChangedListener(e -> { switch (projectInfo.getProjectType()) { case LIBRARY: changingStackLayout.topControl = libraryProjectOptionsGroup; break; case TEST: changingStackLayout.topControl = testProjectOptionsGroup; break; default: changingStackLayout.topControl = defaultOptions; } projectTypePropertyControls.layout(true); setPageComplete(validatePage()); }); // IDs from: org.eclipse.jdt.internal.ui.workingsets.IWorkingSetIDs.class createWorkingSetGroup( (Composite) getControl(), null, new String[] { "org.eclipse.ui.resourceWorkingSetPage", "org.eclipse.jdt.ui.JavaWorkingSetPage", "org.eclipse.jdt.internal.ui.OthersWorkingSet" }); // $NON-NLS-1$ Dialog.applyDialogFont(getControl()); dbc.updateTargets(); setControl(control); }
Example 19
Source File: CatchEventEventSelectionContribution.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void createControl(final Composite composite, final TabbedPropertySheetWidgetFactory widgetFactory, final ExtensibleGridPropertySection extensibleGridPropertySection) { combo = new ComboViewer(composite, SWT.NONE); combo.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); combo.setLabelProvider(new EventLabelProvider()); combo.setContentProvider(ArrayContentProvider.getInstance()); combo.addFilter(new ViewerFilter() { @Override public boolean select(final Viewer viewer, final Object parentElement, final Object element) { if (element instanceof EventObject) { final ThrowMessageEvent source = ((Message) element).getSource(); if (eObject != null) { if (source != null) { final AbstractProcess parentProcessOfSourceMessage = ModelHelper.getParentProcess(source); if (parentProcessOfSourceMessage != null && parentProcessOfSourceMessage.equals(ModelHelper.getParentProcess(eObject))) { return false; } } } } return true; } }); final List<Message> events = retrievePossibleMessageEvents(); combo.setInput(events); if (eObject.getEvent() != null) { combo.getCombo().setText(eObject.getEvent()); oldEventName = combo.getCombo().getText(); } combo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(final SelectionChangedEvent arg0) { handleSelectionChanged(); } }); combo.getCombo().addListener(SWT.Modify, new Listener() { @Override public void handleEvent(final Event event) { handleSelectionChanged(); } }); }
Example 20
Source File: SimpleFileSetsEditor.java From eclipse-cs with GNU Lesser General Public License v2.1 | 4 votes |
/** * {@inheritDoc} */ @Override public Control createContents(Composite parent) throws CheckstylePluginException { mController = new Controller(); // group composite containing the config settings Group configArea = new Group(parent, SWT.NULL); configArea.setText(Messages.SimpleFileSetsEditor_titleSimpleConfig); configArea.setLayout(new FormLayout()); this.mBtnManageConfigs = new Button(configArea, SWT.PUSH); this.mBtnManageConfigs.setText(Messages.SimpleFileSetsEditor_btnManageConfigs); this.mBtnManageConfigs.addSelectionListener(mController); FormData fd = new FormData(); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(100, -3); this.mBtnManageConfigs.setLayoutData(fd); mComboViewer = new ComboViewer(configArea); mComboViewer.getCombo().setVisibleItemCount(10); mComboViewer.setContentProvider(new CheckConfigurationContentProvider()); mComboViewer.setLabelProvider(new CheckConfigurationLabelProvider()); mComboViewer.setComparator(new CheckConfigurationViewerSorter()); mComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); mComboViewer.addSelectionChangedListener(mController); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(0, 3); fd.right = new FormAttachment(mBtnManageConfigs, -3, SWT.LEFT); // fd.right = new FormAttachment(100, -3); mComboViewer.getCombo().setLayoutData(fd); // Description Label lblConfigDesc = new Label(configArea, SWT.LEFT); lblConfigDesc.setText(Messages.SimpleFileSetsEditor_lblDescription); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(mComboViewer.getCombo(), 3, SWT.BOTTOM); fd.right = new FormAttachment(100, -3); lblConfigDesc.setLayoutData(fd); this.mTxtConfigDescription = new Text(configArea, SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.VERTICAL); fd = new FormData(); fd.left = new FormAttachment(0, 3); fd.top = new FormAttachment(lblConfigDesc, 0, SWT.BOTTOM); fd.right = new FormAttachment(100, -3); fd.bottom = new FormAttachment(100, -3); this.mTxtConfigDescription.setLayoutData(fd); // init the check configuration combo mComboViewer.setInput(mPropertyPage.getProjectConfigurationWorkingCopy()); if (mDefaultFileSet.getCheckConfig() != null) { mComboViewer.setSelection(new StructuredSelection(mDefaultFileSet.getCheckConfig())); } return configArea; }