org.eclipse.jface.viewers.TableViewerEditor Java Examples

The following examples show how to use org.eclipse.jface.viewers.TableViewerEditor. 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: GenerericTableViewer.java    From offspring with MIT License 4 votes vote down vote up
@Override
public void setGenericTable(IGenericTable table) {
  this.table = table;

  setUseHashlookup(true);
  setContentProvider(table.getContentProvider());
  if (!(table.getContentProvider() instanceof IPageableStructeredContentProvider)) {
    this.comparator = new GenericComparator(table);
    setComparator(comparator);
  }

  ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
      this) {

    @Override
    protected boolean isEditorActivationEvent(
        ColumnViewerEditorActivationEvent event) {
      return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
          || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
          || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
    }
  };

  TableViewerEditor.create(this, actSupport,
      ColumnViewerEditor.TABBING_HORIZONTAL
          | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
          | ColumnViewerEditor.TABBING_VERTICAL
          | ColumnViewerEditor.KEYBOARD_ACTIVATION);

  createColumns();
  // try {
  // getTable().setRedraw(false);
  // calculateSizes();
  // }
  // finally {
  // getTable().setRedraw(true);
  // }

  // setInput(null);
  getTable().setHeaderVisible(true);
  getTable().setLinesVisible(true);
  getTable().layout();

  for (final IGenericTableColumn c : table.getColumns()) {
    if (c.getCellActivateHandler() != null) {
      getTable().addMouseMoveListener(mouseMoveListener);
      getTable().addMouseListener(mouseListener);
      break;
    }
  }
}
 
Example #3
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);
}