List of usage examples for org.eclipse.jface.viewers ColumnViewer getCellEditors
public CellEditor[] getCellEditors()
null if no cell editors are set. From source file:org.eclipse.rcptt.tesla.internal.ui.player.viewers.Viewers.java
License:Open Source License
public static Point getSafeToClickPoint(TreeItem item) { Rectangle bounds = item.getBounds(); final Point DEFAULT_POINT = new Point(bounds.x + bounds.width - 1, bounds.y + bounds.height / 2); Tree tree = item.getParent();//from w w w. j av a 2 s . c o m Viewer viewer = TeslaSWTAccess.getViewer(tree); if (!(viewer instanceof ColumnViewer)) return DEFAULT_POINT; ColumnViewer columnViewer = (ColumnViewer) viewer; CellEditor[] editors = columnViewer.getCellEditors(); TreeColumn[] columns = tree.getColumns(); if (columns == null || columns.length == 0) return DEFAULT_POINT; for (int i : tree.getColumnOrder()) { TreeColumn c = columns[i]; if (getCellEditor(editors, i) != null) continue; Object data = c.getData("org.eclipse.jface.columnViewer"); if (data == null) return makeColumnClickPoint(item, i); if (!(data instanceof ViewerColumn)) continue; ViewerColumn viewerColumn = (ViewerColumn) data; EditingSupport editingSupport = TeslaSWTAccess.getField(EditingSupport.class, viewerColumn, "editingSupport"); if (editingSupport == null) return makeColumnClickPoint(item, i); } return UNSAFE_CLICK_POINT; }
From source file:org.eclipse.rcptt.tesla.recording.core.swt.rap.SWTEventRecorder.java
License:Open Source License
private void processMouseUp(Widget widget, Event event, RecordedEvent toRecording) { if (widget instanceof Table || widget instanceof Tree) { Viewer viewer = TeslaSWTAccess.getViewer((Control) widget); if (viewer != null && viewer instanceof ColumnViewer) { ColumnViewer cview = (ColumnViewer) viewer; CellEditor[] editors = cview.getCellEditors(); // Collect click column ViewerCell cell = cview.getCell(new Point(event.x, event.y)); if (cell != null && editors != null) { int index = cell.getColumnIndex(); if (editors[index] != null && editors[index] instanceof CheckboxCellEditor) { recordCellAccess(widget, event, RecordCellAccessSource.MouseUp); return; }//from w w w . j a v a2 s. com } } Listener[] listenersUp = widget.getListeners(SWT.MouseUp); if ((listenersUp != null && hasNonPlatformListeners(listenersUp, SWT.MouseUp)) || mouseDownRecorded) { mouseDownRecorded = false; recordCellAccess(widget, event, RecordCellAccessSource.MouseUp); } } // Listener[] listenersDown = widget.getListeners(SWT.MouseDown); // if ((listenersDown != null && containsNonPlatform(listenersDown, // SWT.MouseDown))) { recordTextSetFocus(widget, event.button); // } if (isMacOS()) { if (widget instanceof Button) { if ((widget.getStyle() & SWT.CHECK) != 0) { FindResult result = getLocator().findElement(widget, false, false, true); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.check(((Button) widget).getSelection()); } } else if ((widget.getStyle() & SWT.RADIO) != 0) { FindResult result = getLocator().findElement(widget, false, false, true); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.clickAndWait(); } } } } // click on FilteredTree or Q7 SearchControl clear button if (widget instanceof Label && isSearchControlLabel((Label) widget) && lastEvents.checkType(widget, SWT.MouseDown)) { FindResult result = getLocator().findElement(widget, true, false, false); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.clickAndWait(); beforeTextState = ""; } } lastEvents.add(toRecording); }
From source file:org.eclipse.rcptt.tesla.recording.core.swt.SWTEventRecorder.java
License:Open Source License
private void processMouseUp(Widget widget, Event event, RecordedEvent toRecording) { if (widget instanceof Table || widget instanceof Tree) { Viewer viewer = TeslaSWTAccess.getViewer((Control) widget); if (viewer != null && viewer instanceof ColumnViewer) { ColumnViewer cview = (ColumnViewer) viewer; CellEditor[] editors = cview.getCellEditors(); // Collect click column ViewerCell cell = cview.getCell(new Point(event.x, event.y)); if (cell != null && editors != null) { int index = cell.getColumnIndex(); if (editors[index] != null && editors[index] instanceof CheckboxCellEditor) { recordCellAccess(widget, event, RecordCellAccessSource.MouseUp); return; }/*from w w w. jav a 2 s . c om*/ } } Listener[] listenersUp = widget.getListeners(SWT.MouseUp); if ((listenersUp != null && hasNonPlatformListeners(listenersUp, SWT.MouseUp)) || mouseDownRecorded) { mouseDownRecorded = false; recordCellAccess(widget, event, RecordCellAccessSource.MouseUp); } } // Listener[] listenersDown = widget.getListeners(SWT.MouseDown); // if ((listenersDown != null && containsNonPlatform(listenersDown, // SWT.MouseDown))) { recordTextSetFocus(widget, event.button); // } if (Platform.getOS().equals(Platform.OS_MACOSX)) { if (widget instanceof Button) { if ((widget.getStyle() & SWT.CHECK) != 0) { FindResult result = getLocator().findElement(widget, false, false, true); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.check(((Button) widget).getSelection()); } } else if ((widget.getStyle() & SWT.RADIO) != 0) { FindResult result = getLocator().findElement(widget, false, false, true); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.clickAndWait(); } } } } // click on FilteredTree or Q7 SearchControl clear button if (widget instanceof Label && isSearchControlLabel((Label) widget) && lastEvents.checkType(widget, SWT.MouseDown)) { FindResult result = getLocator().findElement(widget, true, false, false); if (result != null) { ControlUIElement e = new ControlUIElement(result.element, getRecorder()); e.clickAndWait(); beforeTextState = ""; } } lastEvents.add(toRecording); }