org.eclipse.jface.viewers.ColumnViewerEditor Java Examples

The following examples show how to use org.eclipse.jface.viewers.ColumnViewerEditor. 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: ContractInputTreeViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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 #3
Source File: GridViewerShortTextPerformance.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public GridViewerShortTextPerformance(Shell shell)
{
	final GridTableViewer v = new GridTableViewer(shell, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	v.setLabelProvider(new MyLabelProvider());
	v.setContentProvider(new MyContentProvider());
	v.getGrid().setCellSelectionEnabled(true);

	v.setCellEditors(new CellEditor[] { new TextCellEditor(v.getGrid()), new TextCellEditor(v.getGrid()) });

	v.setColumnProperties(new String[] { "1", "2" });

	ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v)
	{

		@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);
		}
	};

	GridViewerEditor.create(v, actSupport,
			ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
					| ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);

	for (int i = 0; i < NUM_COLUMNS; i++)
	{
		createColumn(v, "Column " + i);
	}

	MyModel[] model = createModel();
	v.setInput(model);
	v.getGrid().setLinesVisible(true);
	v.getGrid().setHeaderVisible(true);
}
 
Example #4
Source File: TableComboViewer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected ColumnViewerEditor createViewerEditor() {
	return null;
}
 
Example #5
Source File: LabResultEditingSupport.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 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);
}
 
Example #6
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);
}
 
Example #7
Source File: TableComboViewer.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected ColumnViewerEditor createViewerEditor() {
    return null;
}
 
Example #8
Source File: TableComboViewer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected ColumnViewerEditor createViewerEditor() {
	return null;
}
 
Example #9
Source File: GridTableViewer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #10
Source File: GridTreeViewer.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #11
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 #12
Source File: GenerericTreeViewer.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;
    }
  };

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

  createColumns();

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

  for (final IGenericTableColumn c : table.getColumns()) {
    if (c.getCellActivateHandler() != null) {
      getTree().addMouseMoveListener(mouseMoveListener);
      getTree().addMouseListener(mouseListener);
      break;
    }
  }
}
 
Example #13
Source File: GridTableViewer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #14
Source File: GridTreeViewer.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #15
Source File: XViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected ColumnViewerEditor createViewerEditor() {
   return super.createViewerEditor();
}
 
Example #16
Source File: CTreeComboViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @see org.eclipse.jface.viewers.AbstractTreeViewer#createViewerEditor()
 */
protected ColumnViewerEditor createViewerEditor() {
	return null;
}
 
Example #17
Source File: TableComboViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected ColumnViewerEditor createViewerEditor() {
	return null;
}
 
Example #18
Source File: GridTableViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #19
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #20
Source File: GridTableViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
protected ColumnViewerEditor createViewerEditor() {
    return new GridViewerEditor(this, new ColumnViewerEditorActivationStrategy(this), ColumnViewerEditor.DEFAULT);
}
 
Example #21
Source File: GridTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
protected ColumnViewerEditor createViewerEditor() {
	return new GridViewerEditor(this,
			new ColumnViewerEditorActivationStrategy(this),
			ColumnViewerEditor.DEFAULT);
}
 
Example #22
Source File: GalleryTreeViewer.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
protected ColumnViewerEditor createViewerEditor() {
	// TODO: implement editing support
	return null;
}