本文整理匯總了Java中org.eclipse.jface.viewers.ViewerCell.getItem方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewerCell.getItem方法的具體用法?Java ViewerCell.getItem怎麽用?Java ViewerCell.getItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.ViewerCell
的用法示例。
在下文中一共展示了ViewerCell.getItem方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
@Override
public void update(ViewerCell cell) {
TableItem item = (TableItem) cell.getItem();
Pattern pattern = Pattern.compile("^[a-zA-Z0-9 _]*$");
if (!pattern.matcher(((InputField)cell.getElement()).getFieldName()).matches()) {
item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
item.setForeground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should match regular expression- \"^[a-zA-Z0-9_]*$\" ");
((InputField)cell.getElement()).getErrorObject().setHasError(true);
}else{
if(((InputField)cell.getElement()).getFieldName().trim().equalsIgnoreCase("")){
item.setBackground(cell.getControl().getDisplay().getSystemColor(SWT.COLOR_RED));
((InputField)cell.getElement()).getErrorObject().setErrorMessage("Input field should not be empty");
((InputField)cell.getElement()).getErrorObject().setHasError(true);
}else{
((InputField)cell.getElement()).getErrorObject().setHasError(false);
}
}
super.update(cell);
}
示例2: addNativeCheckbox
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
protected static void addNativeCheckbox(ViewerCell cell, Object element, Object value,
TreeEditorDisposeListener listener) {
TreeItem currentItem = (TreeItem) cell.getItem();
ExecutionSlot execSlot = (ExecutionSlot) element;
String cellKey = ((CompositeSlot) execSlot.eContainer()).getName() + "." + execSlot.getName();
if (viewerCells.get(cellKey) == null || viewerCells.get(cellKey).isDisposed()
|| (viewerCells.get(cellKey).getSelection() != ((Boolean) value).booleanValue())) {
manageEditorDisposal(currentItem, listener);
TreeEditor editor = createEditor(currentItem);
Composite comp = createEditorComposite(currentItem);
final Button button = createNativeCheckboxCellWidget(element, comp);
editor.setEditor(comp, currentItem, cell.getColumnIndex()); // update editor content
viewerCells.put(cellKey, button);
}
}
示例3: getGroupCheckCellProvider
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private CellLabelProvider getGroupCheckCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList,
final Button btnAddGrp) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
// DO NOT REMOVE THIS CONDITION. The condition is return to
// prevent multiple updates on single item
if (item.getData("UPDATED3") == null) {
item.setData("UPDATED3", TRUE);
} else {
return;
}
addCheckButtonInTable(tableViewer, item, GROUP_CHECKBOX, GROUP_CHECKBOX_PANE, GROUP_EDITOR, cell.getColumnIndex(),
FilterHelper.INSTANCE.checkButtonListener(tableViewer, conditionsList,btnAddGrp));
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
Button groupButton = (Button) item.getData(GROUP_CHECKBOX);
((TableEditor)groupButton.getData(GROUP_EDITOR)).dispose();
groupButton.dispose();
Composite composite = (Composite)item.getData(GROUP_CHECKBOX_PANE);
composite.dispose();
}
});
}
};
}
示例4: getRemoveButtonCellProvider
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private CellLabelProvider getRemoveButtonCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList,
final Button btnAddGrp, final TreeMap<Integer, List<List<Integer>>> groupSelectionMap, final boolean isRemote) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
// DO NOT REMOVE THIS CONDITION. The condition is return to
// prevent multiple updates on single item
if (item.getData("UPDATED2") == null) {
item.setData("UPDATED2", TRUE);
} else {
return;
}
if(OSValidator.isMac()){
addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(),
removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote),
ImagePathConstant.MAC_DELETE_BUTTON);
}else{
addButtonInTable(tableViewer, item, REMOVE, REMOVE_BUTTON_PANE, REMOVE_EDITOR, cell.getColumnIndex(),
removeButtonListener(tableViewer, conditionsList, dummyList,groupSelectionMap, btnAddGrp,isRemote),
ImagePathConstant.DELETE_BUTTON);
}
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
Button removeButton = (Button) item.getData(REMOVE);
((TableEditor)removeButton.getData(REMOVE_EDITOR)).dispose();
removeButton.dispose();
Composite composite = (Composite)item.getData(REMOVE_BUTTON_PANE);
composite.dispose();
}
});
}
};
}
示例5: getDummyColumn
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private CellLabelProvider getDummyColumn(final TableViewer tableViewer, final List<Condition> conditionsList, final Integer columnIndex,final TreeMap<Integer, List<List<Integer>>> groupSelectionMap) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
List<List<Integer>> checkedGrpRowIndices = groupSelectionMap.get(columnIndex);
if (cell.getColumnIndex() == (columnIndex + 3)) {
if (null != checkedGrpRowIndices
&& !checkedGrpRowIndices.isEmpty()) {
List tempList = new ArrayList();
for (List<Integer> checkedIndex : checkedGrpRowIndices) {
tempList.addAll(checkedIndex);
}
int indexOf = tableViewer.getTable().indexOf(item);
if(tempList.contains(indexOf)){
for (int i = 0; i < checkedGrpRowIndices.size(); i++) {
if((checkedGrpRowIndices.get(i)).contains(indexOf)){
cell.setBackground(FilterHelper.INSTANCE.getColor(i));
break;
}
}
}
else{
cell.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255));
}
}
}
}
};
}
示例6: getRowIndex
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
public int getRowIndex(ViewerCell cell) {
if (cell==null)
return -1;
TableItem ti = (TableItem) cell.getItem();
for (int i = 0; i < tagsTable.getItemCount(); i++) {
if (tagsTable.getItem(i).equals(ti))
return i;
}
return -1;
}
示例7: updateValueCell
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private void updateValueCell(ViewerCell cell) {
Object element = cell.getElement();
if (element instanceof ReferenceSlot) {
ReferenceSlot refSlot = (ReferenceSlot) element;
String label = "";
if (refSlot.getReference() != null) {
String refFqn = refSlot.getReference().getFqName();
Object refValue = refSlot.getReference().getValue();
label = refValue != null ? refFqn + " = " + refValue : refFqn;
}
cell.setText(label);
} else if (element instanceof ExecutionSlot) {
Object value = ((ExecutionSlot) element).getValue();
if (value != null) {
if(isReadOnly) {
cell.setText(getCellTextValue(element, value));
}
else if (isPrimitiveType(element)) {
PrimitiveType primitiveType = (PrimitiveType) ((ExecutionSlot) element).getType().getOriginType();
if (isBooleanType(value, primitiveType)) {
TreeItem currentItem = (TreeItem) cell.getItem();
NativeCellWidgetUtil.addNativeCheckbox(cell, element, value,
new TreeEditorDisposeListener(currentItem));
// layout cells with checkbox widgets to update positions if tree contents have
// changed
cell.getControl().getParent().layout();
} else {
cell.setText(getCellTextValue(element, value));
}
}
} else {
cell.setText("");
}
}
}
示例8: getAddButtonCellProvider
import org.eclipse.jface.viewers.ViewerCell; //導入方法依賴的package包/類
private CellLabelProvider getAddButtonCellProvider(final TableViewer tableViewer, final List<Condition> conditionsList
,final TreeMap<Integer, List<List<Integer>>> groupSelectionMap) {
return new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
final TableItem item = (TableItem) cell.getItem();
// DO NOT REMOVE THIS CONDITION. The condition is return to
// prevent multiple updates on single item
if (item.getData("UPDATED1") == null) {
item.setData("UPDATED1", TRUE);
} else {
return;
}
if(OSValidator.isMac()){
addButtonInTable(tableViewer, item, ADD, ADD_BUTTON_PANE, ADD_EDITOR, cell.getColumnIndex(),
FilterHelper.INSTANCE.addButtonListener(tableViewer,conditionsList, dummyList,groupSelectionMap),
ImagePathConstant.MAC_ADD_BUTTON);
}else{
addButtonInTable(tableViewer, item, ADD, ADD_BUTTON_PANE, ADD_EDITOR, cell.getColumnIndex(),
FilterHelper.INSTANCE.addButtonListener(tableViewer,conditionsList, dummyList,groupSelectionMap),
ImagePathConstant.ADD_BUTTON);
}
item.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
Button addButton = (Button) item.getData(ADD);
((TableEditor)addButton.getData(ADD_EDITOR)).dispose();
addButton.dispose();
Composite composite = (Composite)item.getData(ADD_BUTTON_PANE);
composite.dispose();
}
});
}
};
}