Java Code Examples for org.eclipse.jface.viewers.ComboBoxCellEditor#setStyle()

The following examples show how to use org.eclipse.jface.viewers.ComboBoxCellEditor#setStyle() . 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: PullUpMemberPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 2
Source File: PushDownWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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});
}