org.eclipse.jface.viewers.TableViewerFocusCellManager Java Examples

The following examples show how to use org.eclipse.jface.viewers.TableViewerFocusCellManager. 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: ContractConstraintsTableViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void initialize(final IViewerController constraintController, final IMessageManager messageManager,
        final EMFDataBindingContext emfDataBindingContext) {
    this.messageManager = messageManager;
    this.constraintController = constraintController;
    this.emfDataBindingContext = emfDataBindingContext;
    final ProcessItemProviderAdapterFactory adapterFactory = new ProcessItemProviderAdapterFactory();
    propertySourceProvider = new AdapterFactoryContentProvider(adapterFactory);
    adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
    getTable().setHeaderVisible(true);
    getTable().setLinesVisible(true);
    setContentProvider(new ObservableListContentProvider());

    final CellNavigationStrategy cellNavigationStrategy = new AddRowOnEnterCellNavigationStrategy(this, constraintController);
    final TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(this, new FocusCellOwnerDrawHighlighter(
            this), cellNavigationStrategy);

    TableViewerEditor.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: LabOrderEditingSupport.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
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 TableViewerFocusCellManager((TableViewer) 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;
			}
		};
	
	TableViewerEditor.create((TableViewer) viewer, focusCell, actSupport,
		ColumnViewerEditor.TABBING_VERTICAL
			| ColumnViewerEditor.KEYBOARD_ACTIVATION);
}