org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy Java Examples

The following examples show how to use org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy. 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: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
GridViewerEditor(ColumnViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	super(viewer, editorActivationStrategy, feature);
	this.selectionFollowsEditor = (feature & SELECTION_FOLLOWS_EDITOR) == SELECTION_FOLLOWS_EDITOR;
	this.gridEditor = new GridEditor((Grid) viewer.getControl());
}
 
Example #2
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
GridViewerEditor(ColumnViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	super(viewer, editorActivationStrategy, feature);
	this.selectionFollowsEditor = (feature & SELECTION_FOLLOWS_EDITOR) == SELECTION_FOLLOWS_EDITOR;
	this.gridEditor = new GridEditor((Grid) viewer.getControl());
}
 
Example #3
Source File: GridViewerEditor.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
GridViewerEditor(ColumnViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	super(viewer, editorActivationStrategy, feature);
	this.selectionFollowsEditor = (feature & SELECTION_FOLLOWS_EDITOR) == SELECTION_FOLLOWS_EDITOR;
	this.gridEditor = new GridEditor((Grid) viewer.getControl());
}
 
Example #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
Source File: TaxonomyCheckboxListView.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This is a callback that will allow us to create the viewer and initialize
 * it.
 */
@Override
public void createPartControl(Composite parent) {
	Optional<Model> m = ModelRegistryPlugin.getModelRegistry().getActiveTaxonomy();
	contentProvider = new TermContentProvider(viewer);
	viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	viewer.setContentProvider(contentProvider);
	DecoratingLabelProvider p = new DecoratingLabelProvider(new DefaultEObjectLabelProvider(), new TaxonomyLabelDecorator());
	viewer.setLabelProvider(p);
	viewer.addCheckStateListener(this);
	viewer.setSorter(null);

	cellEditor = new MyTextCellEditor(viewer.getTree());

	TreeViewerEditor.create(
			viewer,
			new ColumnViewerEditorActivationStrategy(viewer){
				protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
					return event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION ||
							(event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.F2);
				}
			},
			TreeViewerEditor.DEFAULT
	);
	enableEditing();

	if(m.isPresent()){
		viewer.setInput(m.get());
	}
	viewer.expandAll();

	//Create right-click menu
       MenuManager menuManager = new MenuManager();
       Menu menu = menuManager.createContextMenu(viewer.getTree());
       viewer.getTree().setMenu(menu);
       getSite().registerContextMenu(menuManager, viewer);
	getSite().setSelectionProvider(viewer);
	// Create the help context id for the viewer's control
	PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "de.tudresden.slr.model.taxonomy.ui.viewer");
	getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
}
 
Example #14
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void create(GridTreeViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #15
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public static void create(GridTableViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #16
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
GridViewerEditor(ColumnViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	super(viewer, editorActivationStrategy, feature);
	this.gridEditor = new GridEditor((Grid) viewer.getControl());
}
 
Example #17
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 #18
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 #19
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 #20
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 #21
Source File: GridViewerEditor.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTableViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #22
Source File: GridViewerEditor.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTreeViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #23
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTreeViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #24
Source File: GridViewerEditor.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTableViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #25
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTableViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}
 
Example #26
Source File: GridViewerEditor.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * FIXME
 * @param viewer
 * @param editorActivationStrategy
 * @param feature
 */
public static void create(GridTreeViewer viewer,
		ColumnViewerEditorActivationStrategy editorActivationStrategy,
		int feature) {
	viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature));
}