org.eclipse.jface.viewers.ComboBoxCellEditor Java Examples
The following examples show how to use
org.eclipse.jface.viewers.ComboBoxCellEditor.
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: SubTotalProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
public CellEditor[] getCellEditors( ) { if ( cellEditor != null ) { return cellEditor; } ComboBoxCellEditor comboCell = new ComboBoxCellEditor( viewer.getTable( ), new String[0], SWT.READ_ONLY ); ComboBoxCellEditor positionCell = new ComboBoxCellEditor( viewer.getTable( ), positionItems, SWT.READ_ONLY ); cellEditor = new CellEditor[]{ null, null, comboCell, positionCell }; return cellEditor; }
Example #2
Source File: PullUpMemberPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void setupCellEditors(final Table table) { final ComboBoxCellEditor editor= new ComboBoxCellEditor(); editor.setStyle(SWT.READ_ONLY); fTableViewer.setCellEditors(new CellEditor[] { null, editor}); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { if (editor.getControl() == null & !table.isDisposed()) editor.create(table); final ISelection sel= event.getSelection(); if (!(sel instanceof IStructuredSelection)) return; final IStructuredSelection structured= (IStructuredSelection) sel; if (structured.size() != 1) return; final MemberActionInfo info= (MemberActionInfo) structured.getFirstElement(); editor.setItems(info.getAllowedLabels()); editor.setValue(new Integer(info.getAction())); } }); final ICellModifier cellModifier= new MemberActionCellModifier(); fTableViewer.setCellModifier(cellModifier); fTableViewer.setColumnProperties(new String[] { MEMBER_PROPERTY, ACTION_PROPERTY}); }
Example #3
Source File: PushDownWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void setupCellEditors(final Table table) { final ComboBoxCellEditor comboBoxCellEditor= new ComboBoxCellEditor(); comboBoxCellEditor.setStyle(SWT.READ_ONLY); fTableViewer.setCellEditors(new CellEditor[] { null, comboBoxCellEditor}); fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(final SelectionChangedEvent event) { if (comboBoxCellEditor.getControl() == null & !table.isDisposed()) comboBoxCellEditor.create(table); Assert.isTrue(event.getSelection() instanceof IStructuredSelection); final IStructuredSelection ss= (IStructuredSelection) event.getSelection(); if (ss.size() != 1) return; final MemberActionInfo mac= (MemberActionInfo) ss.getFirstElement(); comboBoxCellEditor.setItems(MemberActionInfoLabelProvider.getAvailableActionLabels(mac)); comboBoxCellEditor.setValue(new Integer(mac.getAction())); } }); final ICellModifier cellModifier= new PushDownCellModifier(); fTableViewer.setCellModifier(cellModifier); fTableViewer.setColumnProperties(new String[] { MEMBER_PROPERTY, ACTION_PROPERTY}); }
Example #4
Source File: GrandTotalProvider.java From birt with Eclipse Public License 1.0 | 6 votes |
public CellEditor[] getCellEditors( ) { if ( cellEditor != null ) { return cellEditor; } ComboBoxCellEditor comboCell = new ComboBoxCellEditor( viewer.getTable( ), new String[0], SWT.READ_ONLY ); ComboBoxCellEditor positionCell = new ComboBoxCellEditor( viewer.getTable( ), positionItems, SWT.READ_ONLY ); cellEditor = new CellEditor[]{ null, null, comboCell, positionCell }; return cellEditor; }
Example #5
Source File: TextTemplateView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override protected CellEditor getCellEditor(Object element){ Query<Mandant> qbe = new Query<Mandant>(Mandant.class); mandants = qbe.execute(); String[] mandantArray = new String[mandants.size() + 1]; mandantArray[0] = TextTemplate.DEFAULT_MANDANT; for (int i = 0; i < mandants.size(); i++) { mandantArray[i + 1] = mandants.get(i).getLabel(); } return new ComboBoxCellEditor(tableViewer.getTable(), mandantArray, SWT.READ_ONLY); }
Example #6
Source File: OutputTypeEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CellEditor getCellEditor(final Object element) { final ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(), defaultTypes) ; editor.getControl().addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { CCombo combo = (CCombo) editor.getControl() ; if(Messages.browse.equals(combo.getText())){ openClassSelectionDialog() ; } } }) ; return editor; }
Example #7
Source File: WidgetInputNameEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CellEditor getCellEditor(final Object element) { List<String> inputs = new ArrayList<String>() ; for(Input input : definition.getInput()){ inputs.add(input.getName()) ; } ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(),inputs.toArray(new String[0]), SWT.READ_ONLY) ; return editor; }
Example #8
Source File: SubTotalProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object getValue( Object element, String property ) { // TODO Auto-generated method stub if ( element instanceof Item ) { element = ( (Item) element ).getData( ); } Object value = null; int index = Arrays.asList( columnNames ).indexOf( property ); switch ( index ) { case 1 : break; case 2 : initializeItems( (SubTotalInfo) element ); ( (ComboBoxCellEditor) cellEditor[2] ).setItems( comboItems ); String expectedView = ( (SubTotalInfo) ( element ) ).getExpectedView( ); if ( expectedView == null || expectedView.length( ) == 0 ) { return Integer.valueOf( 0 ); } int sel = Arrays.asList( viewNames ).indexOf( expectedView ); value = sel <= 0 ? Integer.valueOf( 0 ) : Integer.valueOf( sel ); break; case 3 : String pos = ( (SubTotalInfo) ( element ) ).getPosition( ); if ( pos == null || pos.length( ) == 0 ) { return Integer.valueOf( 0 ); } int posIndex = Arrays.asList( positionValues ).indexOf( pos ); value = posIndex <= 0 ? Integer.valueOf( 0 ) : Integer.valueOf( posIndex ); default : } return value; }
Example #9
Source File: InputTypeEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected CellEditor getCellEditor(final Object element) { final ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(), defaultTypes) ; editor.getControl().addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { CCombo combo = (CCombo) editor.getControl() ; if(Messages.browse.equals(combo.getText())){ openClassSelectionDialog() ; } } }) ; return editor; }
Example #10
Source File: GrandTotalProvider.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object getValue( Object element, String property ) { // TODO Auto-generated method stub if ( element instanceof Item ) { element = ( (Item) element ).getData( ); } Object value = null; int index = Arrays.asList( columnNames ).indexOf( property ); switch ( index ) { case 1 : break; case 2 : initializeItems( (GrandTotalInfo) element ); ( (ComboBoxCellEditor) cellEditor[2] ).setItems( comboItems ); String expectedView = ( (GrandTotalInfo) ( element ) ).getExpectedView( ); if ( expectedView == null || expectedView.length( ) == 0 ) { return Integer.valueOf( 0 ); } int sel = Arrays.asList( viewNames ).indexOf( expectedView ); value = sel <= 0 ? Integer.valueOf( 0 ) : Integer.valueOf( sel ); break; case 3 : String pos = ( (GrandTotalInfo) ( element ) ).getPosition( ); if ( pos == null || pos.length( ) == 0 ) { return Integer.valueOf( 0 ); } int posIndex = Arrays.asList( positionValues ).indexOf( pos ); value = posIndex <= 0 ? Integer.valueOf( 0 ) : Integer.valueOf( posIndex ); break; default : } return value; }
Example #11
Source File: FilterConfigurationDialog.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 5 votes |
private SeverityEditingSupport(TableViewer viewer) { super(viewer); this.viewer = viewer; displayValues = ArrayUtils.toArray("Any", "Style", "Low", "Medium", "High", "Critical"); severityValues = ArrayUtils.toArray(Severity.ANY, Severity.STYLE, Severity.LOW, Severity.MEDIUM, Severity.HIGH, Severity.CRITICAL); this.editor = new ComboBoxCellEditor(viewer.getTable(), displayValues, SWT.DROP_DOWN | SWT.READ_ONLY); }
Example #12
Source File: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
public String getColumnText( Object element, int columnIndex ) { if ( element instanceof MeasureInfo ) { if ( columnIndex == 0 ) { return ( (MeasureInfo) element ).getMeasureDisplayName( ) == null ? "" //$NON-NLS-1$ : ( (MeasureInfo) element ).getMeasureDisplayName( ); } else { initializeItems( (MeasureInfo) element ); ( (ComboBoxCellEditor) cellEditor[1] ).setItems( comboItems ); String expectedView = ( (MeasureInfo) element ).getExpectedView( ); if ( expectedView == null ) { return comboItems[0]; } else { int index = Arrays.asList( viewNames ) .indexOf( expectedView ); if ( index < 0 ) { index = 0; ( (MeasureInfo) element ).setExpectedView( viewNames[index] ); } return comboItems[index]; } } } return ""; //$NON-NLS-1$ }
Example #13
Source File: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object getValue( Object element, String property ) { if ( element instanceof Item ) { element = ( (Item) element ).getData( ); } Object value = null; // TODO Auto-generated method stub int index = Arrays.asList( columnNames ).indexOf( property ); switch ( index ) { case 0 : value = "Measure"; //$NON-NLS-1$ break; case 1 : initializeItems( (MeasureInfo) element ); ( (ComboBoxCellEditor) cellEditor[1] ).setItems( comboItems ); String expectedView = ( (MeasureInfo) ( element ) ).getExpectedView( ); if ( expectedView == null ) { expectedView = ""; } int sel = Arrays.asList( viewNames ).indexOf( expectedView ); value = sel <= 0 ? Integer.valueOf( 0 ) :Integer.valueOf( sel ); break; default : } return value; }
Example #14
Source File: UnitMappingPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void createCellEditors() { String[] flowPropertyNames = new String[flowProperties.size()]; for (int i = 0; i < flowProperties.size(); i++) flowPropertyNames[i] = flowProperties.get(i).name; flowPropertyCellEditor = new ComboBoxCellEditor(tableViewer.getTable(), flowPropertyNames, SWT.READ_ONLY); final CellEditor[] editors = new CellEditor[] { new TextCellEditor(tableViewer.getTable()), flowPropertyCellEditor, new TextCellEditor(tableViewer.getTable()), new TextCellEditor(tableViewer.getTable()), new TextCellEditor(tableViewer.getTable()) }; tableViewer.setCellEditors(editors); }
Example #15
Source File: RelationDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public RelationDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Relations Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_SOURCE] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); // TODO: Add column sorters, filters? configSorters(propTable); // Configure content last: use updateTable() to render relations propViewer.setContentProvider(ArrayContentProvider.getInstance()); }
Example #16
Source File: EdgeDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
public EdgeDisplayTableControl(Composite parent) { super(parent, SWT.NONE); setLayout(Widgets.buildContainerLayout(1)); propViewer = new TableViewer(this, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); // Layout embedded table Table propTable = propViewer.getTable(); propTable.setLayoutData(Widgets.buildGrabFillData()); // initialize the table propTable.setHeaderVisible(true); propTable.setToolTipText("Edge Display Properties"); EditColTableDef.setupTable(TABLE_DEF, propTable); // Configure cell editing CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_HEAD] = null; cellEditors[INDEX_TAIL] = null; cellEditors[INDEX_COLOR] = new ColorCellEditor(propTable); cellEditors[INDEX_STYLE] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.LineStyle.values(), true)); cellEditors[INDEX_ARROWHEAD] = new ComboBoxCellEditor(propTable, toString(EdgeDisplayProperty.ArrowheadStyle.values(), true)); propViewer.setCellEditors(cellEditors); propViewer.setLabelProvider(new EdgeDisplayLabelProvider()); propViewer.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); propViewer.setCellModifier(new EdgeDisplayCellModifier()); propViewer.setContentProvider(ArrayContentProvider.getInstance()); configSorters(propTable); }
Example #17
Source File: NodeDisplayTableControl.java From depan with Apache License 2.0 | 5 votes |
@Override protected TreeViewer createTreeViewer(Composite parent) { TreeViewer result = super.createTreeViewer(parent); // Initialize the table. Tree tree = result.getTree(); tree.setHeaderVisible(true); tree.setToolTipText("Node Display Properties"); EditColTableDef.setupTree(TABLE_DEF, tree); // Configure cell editing. CellEditor[] cellEditors = new CellEditor[TABLE_DEF.length]; cellEditors[INDEX_NAME] = null; cellEditors[INDEX_SELECTED] = new CheckboxCellEditor(tree); cellEditors[INDEX_XPOS] = new TextCellEditor(tree); cellEditors[INDEX_YPOS] = new TextCellEditor(tree); cellEditors[INDEX_VISIBLE] = new CheckboxCellEditor(tree); cellEditors[INDEX_SIZE] = new ComboBoxCellEditor( tree, buildSizeOptions()); cellEditors[INDEX_COLOR] = new ColorCellEditor(tree); result.setCellEditors(cellEditors); result.setLabelProvider(new PartLabelProvider()); result.setColumnProperties(EditColTableDef.getProperties(TABLE_DEF)); result.setCellModifier(new PartCellModifier()); return result; }
Example #18
Source File: EnumerationEditingSupport.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public CellEditor getCellEditor(Object element) { if (element instanceof ExecutionSlot) { EnumerationType e = getEnumerationType((ExecutionSlot) element); List<String> enumeratorNames = new ArrayList<String>(); for (Enumerator enumerator : e.getEnumerator()) { enumeratorNames.add(enumerator.getName()); } return new ComboBoxCellEditor((Composite) getViewer().getControl(), enumeratorNames.toArray(new String[] {}), SWT.READ_ONLY); } return null; }
Example #19
Source File: ModifySupport.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void refresh(T value) { for (String property : cellModifiers.keySet()) { ICellModifier<T> modifier = cellModifiers.get(property); if (modifier.getCellEditingType() == CellEditingType.COMBOBOX) { ((ComboBoxCellEditor) getCellEditor(property)) .setItems(modifier.getStringValues(value)); } } }
Example #20
Source File: GrandTotalProvider.java From birt with Eclipse Public License 1.0 | 4 votes |
public String getColumnText( Object element, int columnIndex ) { GrandTotalInfo info = (GrandTotalInfo) element; switch ( columnIndex ) { case 0 : return ""; //$NON-NLS-1$ case 1 : return info.getMeasureDisplayName( ) == null ? "" : info.getMeasureDisplayName( ); case 2 : initializeItems( info ); ( (ComboBoxCellEditor) cellEditor[2] ).setItems( comboItems ); String expectedView = info.getExpectedView( ); if ( expectedView == null ) { expectedView = ""; } int index = Arrays.asList( viewNames ).indexOf( expectedView ); if ( index <= 0 ) { index = 0; info.setExpectedView( viewNames[index] ); } return comboItems[index]; case 3 : String position = info.getPosition( ); if ( position == null ) { position = ""; } int posIndex = Arrays.asList( positionValues ) .indexOf( position ); if ( posIndex < 0 ) { info.setPosition( positionValues[0] ); } return positionItems[posIndex]; default : break; } return ""; //$NON-NLS-1$ }
Example #21
Source File: InputMandatoryEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override protected CellEditor getCellEditor(final Object element) { ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(), mandatoryChoices, SWT.READ_ONLY); return editor; }
Example #22
Source File: ComboCellEditingSupport.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * Override the default behavior to provide the {@link #comboCell} instead * of the default <code>TextCellEditor</code> when the * {@link #contentProvider} requires a <code>Combo</code>. */ @Override protected CellEditor getCellEditor(Object element) { // If all else fails, we should return null. CellEditor editor = null; // For elements that need a Combo, use the ComboBoxCellEditor. if (contentProvider.requiresCombo(element)) { TreeProperty property = (TreeProperty) element; boolean isFile = property.getEntry() instanceof FileEntry; if (isFile) { comboCell = new FileComboBoxCellEditor(parent, new String[] {}, SWT.DROP_DOWN | SWT.READ_ONLY, this, property); } else { // Create the ComboBoxCellEditor. comboCell = new ComboBoxCellEditor(parent, new String[] {}, SWT.DROP_DOWN | SWT.READ_ONLY); } comboCell.getControl().setBackground(parent.getBackground()); editor = comboCell; // Update the Combo's items. List<String> allowedValues = contentProvider.getAllowedValues(element); String[] items = new String[allowedValues.size()]; comboCell.setItems(allowedValues.toArray(items)); // Update the Map so that we can convert from the text value to its // index in the allowed values (the Combo widget uses integers!). valueMap.clear(); for (int i = 0; i < items.length; i++) { valueMap.put(items[i], i); } } // Resort to the default TextCellEditor for all other elements. else { editor = super.getCellEditor(element); } return editor; }
Example #23
Source File: SubTotalProvider.java From birt with Eclipse Public License 1.0 | 4 votes |
public String getColumnText( Object element, int columnIndex ) { SubTotalInfo info = (SubTotalInfo) element; switch ( columnIndex ) { case 0 : return ""; //$NON-NLS-1$ case 1 : return info.getLevel( ).getName( ) + "- " + ( info.getAggregateOnMeasureDisplayName( ) == null ? "" //$NON-NLS-1$ //$NON-NLS-2$ : info.getAggregateOnMeasureDisplayName( ) ); case 2 : initializeItems( info ); ( (ComboBoxCellEditor) cellEditor[2] ).setItems( comboItems ); String expectedView = info.getExpectedView( ); if ( expectedView == null ) { expectedView = ""; } int index = Arrays.asList( viewNames ).indexOf( expectedView ); if ( index < 0 ) { index = 0; info.setExpectedView( viewNames[index] ); } return comboItems[index]; case 3 : String position = info.getPosition( ); if ( position == null ) { position = ""; } int posIndex = Arrays.asList( positionValues ) .indexOf( position ); if ( posIndex < 0 ) { info.setPosition( positionValues[0] ); } return positionItems[posIndex]; default : break; } return ""; //$NON-NLS-1$ }
Example #24
Source File: ShowSummaryFieldDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
private void createSummaryFiledViewer( Composite dialogArea ) { Table table = new Table( dialogArea, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.CHECK ); table.setLinesVisible( true ); table.setHeaderVisible( true ); GridData gd = new GridData( GridData.FILL_BOTH ); gd.heightHint = 250; table.setLayoutData( gd ); summaryFieldViewer = new CheckboxTableViewer( table ); SummaryFieldProvider provider = new SummaryFieldProvider( ); for ( int i = 0; i < columnNames.length; i++ ) { TableColumn column = new TableColumn( table, SWT.LEFT ); column.setText( columnNames[i] ); column.setWidth( columnWidth[i] ); } ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table, new String[0], SWT.READ_ONLY ); // TextCellEditor textCell = new TextCellEditor(table, SWT.NONE); cellEditor = new CellEditor[]{ null, comboCell }; summaryFieldViewer.setColumnProperties( columnNames ); summaryFieldViewer.setCellEditors( cellEditor ); summaryFieldViewer.setCellModifier( cellModifier ); summaryFieldViewer.setUseHashlookup( true ); summaryFieldViewer.setContentProvider( provider ); summaryFieldViewer.setLabelProvider( provider ); summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) { public void checkStateChanged( CheckStateChangedEvent event ) { MeasureInfo info = (MeasureInfo) event.getElement( ); if ( event.getChecked( ) ) { info.setShow( true ); } else { info.setShow( false ); } checkOKButtonStatus( ); } } ); }
Example #25
Source File: CvwRestPage.java From XPagesExtensionLibrary with Apache License 2.0 | 4 votes |
@Override protected CellEditor getCellEditor(Object element) { ComboBoxCellEditor ce = new ComboBoxCellEditor(_tableViewer.getTable(), _viewColumns[1], SWT.READ_ONLY); ((CCombo)ce.getControl()).setVisibleItemCount(10); return ce; }
Example #26
Source File: FilterConfigurationDialog.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 4 votes |
private SuppressedEditingSupport(TableViewer viewer) { super(viewer); this.viewer = viewer; this.editor = new ComboBoxCellEditor(viewer.getTable(), ArrayUtils.toArray("yes", "no"), SWT.DROP_DOWN | SWT.READ_ONLY); }