本文整理汇总了Java中org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter类的典型用法代码示例。如果您正苦于以下问题:Java FocusCellOwnerDrawHighlighter类的具体用法?Java FocusCellOwnerDrawHighlighter怎么用?Java FocusCellOwnerDrawHighlighter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FocusCellOwnerDrawHighlighter类属于org.eclipse.jface.viewers包,在下文中一共展示了FocusCellOwnerDrawHighlighter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEditOnDoubleClick
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
private void initEditOnDoubleClick() {
TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(treeViewer, new FocusCellOwnerDrawHighlighter(treeViewer));
ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
@Override
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
// Enable editor only with mouse double click
if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
EventObject source = event.sourceEvent;
if (source instanceof MouseEvent && ((MouseEvent) source).button == 3)
return false;
return true;
}
return false;
}
};
TreeViewerEditor.create(treeViewer, focusCellManager, activationSupport,
// ColumnViewerEditor.TABBING_HORIZONTAL |
ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);
}
示例2: initEditBehaviour
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
private void initEditBehaviour(final int type) {
TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(tableViewer, new FocusCellOwnerDrawHighlighter(tableViewer));
ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(tableViewer) {
@Override
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
logger.debug(event.toString());
boolean singleSelect = ((IStructuredSelection)tableViewer.getSelection()).size() == 1;
int mouseActivationType=
type == 0 ? ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION : ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION;
boolean isLeftMouseSelect = event.eventType == mouseActivationType && ((MouseEvent)event.sourceEvent).button == 1;
return singleSelect && (isLeftMouseSelect
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
|| event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL);
// Enable editor only with mouse double click
// if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
// EventObject source = event.sourceEvent;
// if (source instanceof MouseEvent && ((MouseEvent)source).button == 3)
// return false;
//
// return true;
// }
//
// return false;
}
};
TableViewerEditor.create(tableViewer, focusCellManager, activationSupport, ColumnViewerEditor.TABBING_HORIZONTAL |
ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
ColumnViewerEditor.TABBING_VERTICAL |
ColumnViewerEditor.KEYBOARD_ACTIVATION);
}
示例3: setCellEditSupport
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
/**
* Initialize cell editing.
*
* @param viewer
*/
public static void setCellEditSupport(final TableViewer viewer) {
final TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(
viewer,
new FocusCellOwnerDrawHighlighter(viewer));
final ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(viewer) {
@Override
protected boolean isEditorActivationEvent(final ColumnViewerEditorActivationEvent event) {
return (event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL)
|| (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION)
|| ((event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED)
&& (event.keyCode == SWT.CR))
|| (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC);
}
};
TableViewerEditor.create(//
viewer,
focusCellManager,
actSupport,
ColumnViewerEditor.TABBING_HORIZONTAL //
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR //
| ColumnViewerEditor.TABBING_VERTICAL
| ColumnViewerEditor.KEYBOARD_ACTIVATION);
}
示例4: createCustomArea
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
@Override
protected Control createCustomArea(final Composite parent) {
Composite body = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(body);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(body);
ToolBar bar = new ToolBar(body, SWT.HORIZONTAL);
ToolBarManager barMgr = new ToolBarManager(bar);
barMgr.add(new AlignLeftAction());
barMgr.add(new AlignCenterAction());
barMgr.add(new AlignRightAction());
barMgr.add(new InsColBeforeAction());
barMgr.add(new InsColAfterAction());
barMgr.add(new RmvColAction());
barMgr.add(new InsRowAboveAction());
barMgr.add(new InsRowBelowAction());
barMgr.add(new RmvRowAction());
barMgr.update(true);
bar.pack();
viewer = new TableViewer(body, style);
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(viewer.getControl());
table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
cellMgr = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer));
ColumnViewerEditorActivationStrategy activator = 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.PROGRAMMATIC;
}
};
TableViewerEditor.create(viewer, cellMgr, activator, features);
MenuManager mgr = new MenuManager();
mgr.add(new InsColBeforeAction());
mgr.add(new InsColAfterAction());
mgr.add(new RmvColAction());
mgr.add(new Separator());
mgr.add(new InsRowAboveAction());
mgr.add(new InsRowBelowAction());
mgr.add(new RmvRowAction());
viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl()));
tableModel = new TableModel();
setInput(part);
return body;
}
示例5: createViewer
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
private void createViewer(Composite parent) {
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer,
new FocusCellOwnerDrawHighlighter(viewer));
ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) {
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
// Enable editor only with mouse double click
if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
EventObject source = event.sourceEvent;
if (source instanceof MouseEvent && ((MouseEvent) source).button == 3)
return false;
return true;
}
return false;
}
};
TableViewerEditor.create(viewer, focusCellManager, activationSupport,
ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
| ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);
createColumns(parent, viewer);
final Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent arg0) {
if (null != viewer.getTable() && viewer.getTable().getSelectionIndex() > 0) {
setPageComplete(true);
}
}
});
// get the content for the viewer, setInput will call getElements in the
// contentProvider
viewer.setInput(commits);
// make the selection available to other views
// define layout for the viewer
GridData gridData = new GridData();
gridData.verticalAlignment = GridData.FILL;
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
viewer.getControl().setLayoutData(gridData);
}
示例6: customizeViewer
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; //导入依赖的package包/类
private void customizeViewer(TableViewer viewer) {
// Name Id column
TableViewerColumn idNameColViewer = new TableViewerColumn(viewer, SWT.NONE);
idNameColViewer.setLabelProvider(new USLabelProvider(ID_NAME_COL_US_INDEX));
idNameColViewer.setEditingSupport(new TextCellEditingSupport(viewer, ID_NAME_COL_US_INDEX));
TableColumn idNameTblCol = idNameColViewer.getColumn();
idNameTblCol.setWidth(80);
idNameTblCol.setText(ID_NAME_COL_US_LABEL);
// Name column
TableViewerColumn nameCol = new TableViewerColumn(viewer, SWT.NONE);
nameCol.setLabelProvider(new USLabelProvider(NAME_COL_US_INDEX));
nameCol.setEditingSupport(new TextCellEditingSupport(viewer, NAME_COL_US_INDEX));
TableColumn nameTblCol = nameCol.getColumn();
nameTblCol.setWidth(280);
nameTblCol.setText(NAME_COL_US_LABEL);
// Plan Estimation column
TableViewerColumn estimationColViewer = new TableViewerColumn(viewer, SWT.NONE);
estimationColViewer.setLabelProvider(new USLabelProvider(ESTIMATION_COL_US_INDEX));
estimationColViewer.setEditingSupport(new TextCellEditingSupport(viewer, ESTIMATION_COL_US_INDEX));
TableColumn estimationTblCol = estimationColViewer.getColumn();
estimationTblCol.setWidth(80);
estimationTblCol.setText(ESTIMATION_COL_US_LABEL);
// State column
TableViewerColumn stateColViewer = new TableViewerColumn(viewer, SWT.NONE);
stateColViewer.setLabelProvider(new USLabelProvider(STATE_COL_US_INDEX));
stateColViewer.setEditingSupport(new ComboCellEditingSupport(viewer, userStoriesStates));
TableColumn stateTblCol = stateColViewer.getColumn();
stateTblCol.setWidth(140);
stateTblCol.setText(STATE_COL_US_LABEL);
//
TableViewerEditor.create(viewer,
new TableViewerFocusCellManager(viewer,
new FocusCellOwnerDrawHighlighter(viewer)),
new EditorActivationStrategy(viewer),
ColumnViewerEditor.TABBING_HORIZONTAL
| ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR);
}