List of usage examples for org.eclipse.jface.viewers ViewerCell equals
@Override public boolean equals(Object obj)
From source file:com.netxforge.screens.editing.base.tables.SWTFocusBlockManager.java
License:Open Source License
/** * Handle mouse down event. The {@link #getFocusCell() focus cell} because * the {@link ViewerCell cell} at the {@link Event} coordinates. </p>The * state is set to 'dragging'.//from w ww . j a v a 2 s . co m * * @param event */ private void handleMouseDown(Event event) { ViewerCell cell = viewer.getCell(new Point(event.x, event.y)); if (cell != null) { if (!cell.equals(focusCell)) { setFocusCell(cell, event); } } cleanFocusBlock(focusCell, event); cellDragging = true; setCursorAccelerator(isAccelarating(event)); // System.out // .println(" moving down, activate cell dragging, block size = " // + focusBlock.size()); }
From source file:com.netxforge.screens.editing.base.tables.SWTFocusBlockManager.java
License:Open Source License
/** * Handle mouse dragging./*from ww w .j a v a2 s.co m*/ * * @param event */ private void handleCellDragging(Event event) { // in the new position, look if we are the focus cell, // if not, add to our cell blow only if we are the below neighbour... ViewerCell cell = viewer.getCell(new Point(event.x, event.y)); if (cell != null) { if (!lastInFocusBlock(cell)) { // if we are not the last cell, but we are in the block, we // should get the position // to remove other cells.. if (inFocusBlock(cell)) { cleanFocusBlock(cell, event); // System.out.println("Dragging....removing cell in column:" // + cell.getVisualIndex() + " size of block = " // + focusBlock.size()); } else { // we can add it now. // do this for the last cell, not last focus cell. ViewerCell belowNeighborCell = lastCellInBlock().getNeighbor(ViewerCell.BELOW, false); if (cell.equals(belowNeighborCell)) { addCellToBlock(cell, event); // System.out.println("Dragging....Adding cell in column:" // + cell.getVisualIndex() + " size of block = " // + focusBlock.size()); } } } else { // last cell in the block do nothing... } } }
From source file:com.netxforge.screens.editing.base.tables.SWTFocusBlockManager.java
License:Open Source License
private void handleKeyDown(Event event) { ViewerCell tmp = null; if (navigationStrategy.isCollapseEvent(viewer, focusCell, event)) { navigationStrategy.collapse(viewer, focusCell, event); } else if (navigationStrategy.isExpandEvent(viewer, focusCell, event)) { navigationStrategy.expand(viewer, focusCell, event); } else if (navigationStrategy.isNavigationEvent(viewer, event)) { tmp = navigationStrategy.findSelectedCell(viewer, focusCell, event); if (tmp != null) { if (!tmp.equals(focusCell)) { setFocusCell(tmp, event); }/*from w ww. j av a2s . co m*/ } } if (navigationStrategy.shouldCancelEvent(viewer, event)) { event.doit = false; } }
From source file:net.certiv.fluentmark.tables.FocusBorderCellHighlighter.java
License:Open Source License
private void hookListener(final ColumnViewer viewer) { Listener listener = new Listener() { @Override//from www .j a va 2 s . c o m public void handleEvent(Event event) { if ((event.detail & SWT.SELECTED) > 0) { ViewerCell focusCell = getFocusCell(); ViewerRow row = focusCell.getViewerRow(); Assert.isNotNull(row, "Internal structure invalid. Item without associated row is not possible."); //$NON-NLS-1$ ViewerCell cell = row.getCell(event.index); if (focusCell == null || !cell.equals(focusCell)) { removeSelectionInformation(event, cell); } else { markFocusedCell(event, cell); } } } }; viewer.getControl().addListener(SWT.EraseItem, listener); }
From source file:org.eclipse.e4mf.common.ui.viewer.ColumnViewerInformationControlToolTipSupport.java
License:Open Source License
protected boolean shouldCreateToolTip(Event event) { ViewerCell cell = getToolTipArea(event); if (cell != null && !cell.equals(currentCell)) { control.setToolTipText(""); currentCell = cell;//from w w w.j a v a 2 s . c o m ViewerRow row = cell.getViewerRow(); if (row != null) { Object element = row.getItem().getData(); CellLabelProvider labelProvider = viewer.getLabelProvider(cell.getColumnIndex()); text = labelProvider.getToolTipText(element); boolean useNative = labelProvider.useNativeToolTip(element); if (useNative || text == null) { control.setToolTipText(text); } else { foregroundColor = labelProvider.getToolTipForegroundColor(element); backgroundColor = labelProvider.getToolTipBackgroundColor(element); font = labelProvider.getToolTipFont(element); return text != null; } } } else { currentCell = cell; } return false; }
From source file:org.eclipse.emf.examples.library.databinding.common.FocusCellOwnerDrawHighlighter.java
License:Open Source License
private void hookListener(final ColumnViewer viewer) { try {/*from ww w. j av a 2 s .c o m*/ final Method m = ColumnViewer.class.getDeclaredMethod("getViewerRowFromItem", Widget.class); m.setAccessible(true); Listener listener = new Listener() { public void handleEvent(Event event) { if ((event.detail & SWT.SELECTED) > 0) { try { ViewerCell focusCell = getFocusCell(); ViewerRow row = (ViewerRow) m.invoke(viewer, event.item); Assert.isNotNull(row, "Internal structure invalid. Item without associated row is not possible."); //$NON-NLS-1$ ViewerCell cell = row.getCell(event.index); if (focusCell == null || !cell.equals(focusCell)) { removeSelectionInformation(event, cell); } else { markFocusedCell(event, cell); } } catch (Exception e) { // TODO: handle exception } } } }; viewer.getControl().addListener(SWT.EraseItem, listener); } catch (Exception e) { // TODO: handle exception } }
From source file:org.eclipse.jface.snippets.viewers.FocusBorderCellHighlighter.java
License:Open Source License
private void hookListener(final ColumnViewer viewer) { Listener listener = event -> {/*from w w w.ja v a 2s .c o m*/ if ((event.detail & SWT.SELECTED) > 0) { ViewerCell focusCell = getFocusCell(); ViewerRow row = focusCell.getViewerRow(); Assert.isNotNull(row, "Internal structure invalid. Item without associated row is not possible."); //$NON-NLS-1$ ViewerCell cell = row.getCell(event.index); if (focusCell == null || !cell.equals(focusCell)) { removeSelectionInformation(event, cell); } else { markFocusedCell(event, cell); } } }; viewer.getControl().addListener(SWT.EraseItem, listener); }