org.eclipse.jface.viewers.TreeViewerFocusCellManager Java Examples
The following examples show how to use
org.eclipse.jface.viewers.TreeViewerFocusCellManager.
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: ContractInputTreeViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void initialize(final ContractInputController inputController, final IMessageManager messageManager, final EMFDataBindingContext emfDataBindingContext) { this.messageManager = messageManager; this.inputController = inputController; this.emfDataBindingContext = emfDataBindingContext; final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); propertySourceProvider = new ContractInputTypePropertyDescriptor(adapterFactory); adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory); getTree().setHeaderVisible(true); getTree().setLinesVisible(true); addFilter(new ComplexTypeChildrenViewerFilter()); final ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( new ContractInputObservableFactory(), new ContractInputTreeStructureAdvisor()); setContentProvider(contentProvider); final CellNavigationStrategy cellNavigationStrategy = new AddRowOnEnterCellNavigationStrategy(this, inputController); final TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(this, new FocusCellOwnerDrawHighlighter( this), cellNavigationStrategy); TreeViewerEditor.create(this, focusCellManager, new CharriageColumnViewerEditorActivationStrategy(this), ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION); ColumnViewerToolTipSupport.enableFor(this); createColumns(); configureTableLayout(); }
Example #2
Source File: LabResultEditingSupport.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
protected void setUpCellEditor(ColumnViewer viewer){ // set up validation of the cell editors textCellEditor = new TextCellEditor((Composite) viewer.getControl()); textCellEditor.addListener(new ICellEditorListener() { @Override public void editorValueChanged(boolean oldValidState, boolean newValidState){ if (newValidState) { textCellEditor.getControl() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); } else { textCellEditor.getControl() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); } } @Override public void cancelEditor(){ textCellEditor.getControl() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); } @Override public void applyEditorValue(){ textCellEditor.getControl() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); } }); focusCell = new TreeViewerFocusCellManager((TreeViewer) viewer, new FocusCellHighlighter(viewer) { }); ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) { @Override protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event){ return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.KEYPAD_CR) || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; } }; TreeViewerEditor.create((TreeViewer) viewer, focusCell, actSupport, ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION); }