public Object getValue(Object element, String property) {
int columnIndex = Arrays.asList(tableViewer.getColumnProperties()).indexOf(property);
CellEditor[] cellEditors = tableViewer.getCellEditors();
CellEditor cellEditor = cellEditors[columnIndex];
boolean isComboBoxEditor = cellEditor instanceof ComboBoxCellEditor;
boolean isTextCellEditor = cellEditor instanceof TextCellEditor;
if (element instanceof Item) {
element = ((Item) element).getData();
}
TableEditorRow row = (TableEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
if (isTextCellEditor && (!(object instanceof String))) {
object = object.toString();
}
return object;
}
java类org.eclipse.jface.viewers.TextCellEditor的实例源码
TableEditorCellModifier.java 文件源码
项目:convertigo-eclipse
阅读 24
收藏 0
点赞 0
评论 0
HttpTransactionEditor.java 文件源码
项目:convertigo-eclipse
阅读 28
收藏 0
点赞 0
评论 0
static public CellEditor[] getColumnEditor(Composite parent) {
CellEditor[] columnEditors = new CellEditor[9];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new TextCellEditor(parent);
columnEditors[2] = new TextCellEditor(parent);
columnEditors[3] = new ComboBoxCellEditor(parent, new String[]{"true","false"});
columnEditors[4] = new ComboBoxCellEditor(parent, new String[]{"true","false"});
columnEditors[5] = new ComboBoxCellEditor(parent, new String[]{"true","false"});
columnEditors[6] = new ComboBoxCellEditor(parent, new String[]{"true","false"});
columnEditors[7] = new ComboBoxCellEditor(parent, new String[]{"","GET","POST"});
columnEditors[8] = new TextCellEditor(parent);
return columnEditors;
}
NameEditingSupport.java 文件源码
项目:scanning
阅读 37
收藏 0
点赞 0
评论 0
@Override
protected CellEditor getCellEditor(Object element) {
try {
if (element instanceof ControlNode) {
return factory.getDeviceEditor(DeviceType.SCANNABLE, (Composite)getViewer().getControl());
}
} catch (Exception ne) {
logger.error("Cannot get a proper scannable editor!", ne);
}
return new TextCellEditor((Composite)getViewer().getControl()) {
@Override
protected void doSetValue(Object value) {
if (value instanceof INamedNode) value = ((INamedNode)value).getDisplayName();
String string = value!=null ? value.toString() : "";
super.doSetValue(string);
}
};
}
AxesEditingSupport.java 文件源码
项目:scanning
阅读 30
收藏 0
点赞 0
评论 0
@Override
protected CellEditor getCellEditor(Object element) {
if (editor==null) {
try {
editor = new AxesCellEditor((Composite)getViewer().getControl(), delegatingSelectionProvider, cservice);
} catch (ScanningException e) {
logger.error("Problem reading scannable names", e);
return new TextCellEditor((Composite)getViewer().getControl()) {
@Override
protected void doSetValue(Object value) {
super.doSetValue("Problem reading scannable names");
}
};
}
}
return editor;
}
EventServiceComposite.java 文件源码
项目:Open_Source_ECOA_Toolset_AS5
阅读 22
收藏 0
点赞 0
评论 0
@Override
protected CellEditor getCellEditor(Object element) {
try {
util.setContainerName(containerName);
util.setFileName("");
types = util.getAllTypes();
String[] opts = new String[types.size()];
int i = 0;
for (String type : types) {
opts[i] = type;
i++;
}
return new ComboBoxCellEditor(viewer.getTable(), opts);
} catch (IOException | JAXBException e) {
return new TextCellEditor(viewer.getTable());
}
}
ReqResServiceComposite.java 文件源码
项目:Open_Source_ECOA_Toolset_AS5
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected CellEditor getCellEditor(Object element) {
try {
util.setContainerName(containerName);
util.setFileName("");
types = util.getAllTypes();
String[] opts = new String[types.size()];
int i = 0;
for (String type : types) {
opts[i] = type;
i++;
}
return new ComboBoxCellEditor(viewer.getTable(), opts);
} catch (IOException | JAXBException e) {
return new TextCellEditor(viewer.getTable());
}
}
EnumerationLiteralsEditPart.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 26
收藏 0
点赞 0
评论 0
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org.eclipse.gef.EditPart, int)
*/
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
super.addChildVisual(childEditPart, index);
if (!isCreated()) {
if (((AbstractNode) childEditPart.getModel()).getUmlModel().equals(getAdded())) {
DirectEditorManager dem = new DirectEditorManager((GraphicalEditPart) childEditPart,
TextCellEditor.class,
new DirectEditCellEditorLocator(((GraphicalEditPart) childEditPart).getFigure()));
dem.show();
setCreated(true);
}
}
}
NotationNameEditPart.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 22
收藏 0
点赞 0
评论 0
/**
* performDirectEdit void
*/
protected void performDirectEdit(Request req) {
if (getParent() != null && getParent() instanceof ScrollableEditPart) {
AbstractNode node = (AbstractNode) getParent().getModel();
Label label = (Label) getFigure();
if (((AbstractNode) node).getNodeType().equals(NodeType.PROVIDED_INTERFACES)) {
return;
} else if (((AbstractNode) node).getNodeType().equals(NodeType.REQUIRED_INTERFACES)) {
return;
}
setFigureLayout(label, GridData.BEGINNING);
} else if (getParent() != null && getParent() instanceof AbstractChildCompartmentEditPart) {
return;
}
if (directManager == null) {
directManager = new DirectEditorManager(this,
TextCellEditor.class,
new DirectEditCellEditorLocator(getFigure()));
}
directManager.show();
}
AbstractNotationNodeEditPart.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 30
收藏 0
点赞 0
评论 0
/**
*
* void
*/
private void getChildFigure(EditPart currentEditPart) {
List<EditPart> childrenEditPart = currentEditPart.getChildren();
for( EditPart child : childrenEditPart ) {
if( child instanceof NotationNameEditPart ) {
if( ((NotationNameEditPart)child).getFigure() instanceof org.eclipse.draw2d.Label ) {
GraphicalEditPart gEdit = (GraphicalEditPart) child;
setDirectManager(new DirectEditorManager((GraphicalEditPart) child,
TextCellEditor.class,
new DirectEditCellEditorLocator(gEdit.getFigure())));
directManager.show();
break;
} else {
getChildFigure(child);
}
}
}
}
AttributesEditPart.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 23
收藏 0
点赞 0
评论 0
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org.eclipse.gef.EditPart, int)
*/
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
super.addChildVisual(childEditPart, index);
if (!isCreated()) {
if (((AbstractNode) childEditPart.getModel()).getUmlModel().equals(getAdded())) {
DirectEditorManager dem = new DirectEditorManager((GraphicalEditPart) childEditPart,
TextCellEditor.class,
new DirectEditCellEditorLocator(((GraphicalEditPart) childEditPart).getFigure()));
dem.show();
setCreated(true);
}
}
}
OperationsEditPart.java 文件源码
项目:NEXCORE-UML-Modeler
阅读 27
收藏 0
点赞 0
评论 0
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#addChildVisual(org.eclipse.gef.EditPart, int)
*/
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
super.addChildVisual(childEditPart, index);
if (!isCreated()) {
if (((AbstractNode) childEditPart.getModel()).getUmlModel().equals(getAdded())) {
DirectEditorManager dem = new DirectEditorManager((GraphicalEditPart) childEditPart,
TextCellEditor.class,
new DirectEditCellEditorLocator(((GraphicalEditPart) childEditPart).getFigure()));
dem.show();
setCreated(true);
}
}
}
EntryCellEditingSupport.java 文件源码
项目:eavp
阅读 28
收藏 0
点赞 0
评论 0
/**
* The default constructor.
*
* @param viewer
* The viewer that is using this <code>EditingSupport</code>.
* <code>Control</code>s required by this class will be
* constructed under this viewer's <code>Control</code> (usually
* a <code>Table</code>).
* @param contentProvider
* The content provider. The methods required as an
* <code>EditingSupport</code> are passed to this content
* provider.
*/
public EntryCellEditingSupport(ColumnViewer viewer, EntryCellContentProvider contentProvider) {
super(viewer);
this.contentProvider = contentProvider;
// Get the viewer's Composite so we can create the CellEditors.
Composite parent = (Composite) viewer.getControl();
// Create the TextCellEditor.
textCell = new TextCellEditor(parent, SWT.LEFT);
// Create the ComboBoxCellEditor.
comboCell = new ComboBoxCellEditor(parent, new String[] {}, SWT.DROP_DOWN | SWT.READ_ONLY);
comboCell.getControl().setBackground(parent.getBackground());
// Create a HashMap to contain values for discrete Entry values.
valueMap = new HashMap<String, Integer>();
return;
}
IntegerEditingSupport.java 文件源码
项目:statecharts
阅读 21
收藏 0
点赞 0
评论 0
@Override
public CellEditor getCellEditor(Object element) {
TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
textCellEditor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
try {
Long.parseLong((String) value);
} catch (NumberFormatException e) {
return "No valid integer value!";
}
return null;
}
});
return textCellEditor;
}
RealEditingSupport.java 文件源码
项目:statecharts
阅读 27
收藏 0
点赞 0
评论 0
@Override
public CellEditor getCellEditor(Object element) {
TextCellEditor textCellEditor = new TextCellEditor((Composite) getViewer().getControl());
textCellEditor.setValidator(new ICellEditorValidator() {
public String isValid(Object value) {
String stringValue = (String) value;
try {
Double.parseDouble(stringValue);
} catch (NumberFormatException e) {
return "No valid real value!";
}
return null;
}
});
return textCellEditor;
}
MultiPageCSVEditor.java 文件源码
项目:gama
阅读 27
收藏 0
点赞 0
评论 0
/**
*
*/
void defineCellEditing() {
final String[] columnProperties = new String[model.getColumnCount()];
final CellEditor[] cellEditors = new CellEditor[model.getColumnCount()];
for (int i = 0; i < model.getColumnCount(); i++) {
columnProperties[i] = Integer.toString(i);
cellEditors[i] = new TextCellEditor(tableViewer.getTable());
}
tableViewer.setColumnProperties(columnProperties);
// XXX can be replaced by tableViewer.setEditingSupport()
tableViewer.setCellEditors(cellEditors);
tableViewer.setCellModifier(new CSVEditorCellModifier());
}
ListPromptViewer.java 文件源码
项目:vdt-plugin
阅读 24
收藏 0
点赞 0
评论 0
private TableViewer createTableViewer(Table table) {
TableViewer viewer = new TableViewer(table);
viewer.setUseHashlookup(true);
viewer.setColumnProperties(tableColumnNames);
CellEditor[] editors = new CellEditor[tableColumnNames.length];
// Column 1 : Name (Free text)
TextCellEditor textEditor = new TextCellEditor(table);
editors[0] = textEditor;
// Assign the cell editors to the viewer
viewer.setCellEditors(editors);
// Set the cell modifier for the viewer
viewer.setCellModifier(new CellModifier());
return viewer;
}
MenuStylesDialog.java 文件源码
项目:birt
阅读 28
收藏 0
点赞 0
评论 0
private CellEditor[] getCellEditors( Table table )
{
CellEditor[] editors = new CellEditor[COLUMNS.length];
editors[0] = new TextCellEditor( table ) {
@Override
protected void keyReleaseOccured( KeyEvent keyEvent )
{
super.keyReleaseOccured( keyEvent );
if ( keyEvent.character == '\r' )
{
fTableViewer.editElement( fTableViewer.getElementAt( fTable.getSelectionIndex( ) ),
1 );
}
}
};
editors[1] = new TextCellEditor( table );
return editors;
}
PropertiesEditingSupport.java 文件源码
项目:DynamicSpotter
阅读 36
收藏 0
点赞 0
评论 0
/**
* Creates an editing support for the given operating viewer.
*
* @param operatingViewer
* the viewer this editing support works for
* @param editor
* the editor which is operated in
* @param propertiesViewer
* the properties group viewer that contains the operating viewer
*/
public PropertiesEditingSupport(ColumnViewer operatingViewer, AbstractSpotterEditor editor,
PropertiesGroupViewer propertiesViewer) {
super(operatingViewer);
this.editor = editor;
this.propertiesViewer = propertiesViewer;
Composite parent = (Composite) getViewer().getControl();
cellDefaultTextEditor = new TextCellEditor(parent);
cellDefaultTextEditor.getControl().addTraverseListener(new ActivationTraverser(cellDefaultTextEditor));
cellNumberEditor = new TextCellEditor(parent);
ControlDecoration decor = new ControlDecoration(cellNumberEditor.getControl(), SWT.LEFT | SWT.TOP);
cellNumberEditor.addListener(new TextEditorErrorListener(cellNumberEditor, decor));
cellNumberEditor.getControl().addTraverseListener(new ActivationTraverser(cellNumberEditor));
cellBooleanEditor = new CustomComboBoxCellEditor(parent, BOOLEAN_VALUES, SWT.DROP_DOWN | SWT.READ_ONLY);
cellBooleanEditor.setActivationStyle(COMBO_ACTIVATION_STYLE);
cellBooleanEditor.getControl().addTraverseListener(new ComboActivationTraverser(cellBooleanEditor));
cellComboBoxEditor = new CustomComboBoxCellEditor(parent, new String[0], SWT.DROP_DOWN | SWT.READ_ONLY);
cellComboBoxEditor.setActivationStyle(COMBO_ACTIVATION_STYLE);
cellComboBoxEditor.getControl().addTraverseListener(new ComboActivationTraverser(cellComboBoxEditor));
cellCustomDialogEditor = new CustomDialogCellEditor(parent);
cellCustomDialogEditor.getControl().addTraverseListener(new ActivationTraverser(cellCustomDialogEditor));
}
BeanPropertyDescriptor.java 文件源码
项目:cuina
阅读 22
收藏 0
点赞 0
评论 0
@Override
public CellEditor createPropertyEditor(Composite parent)
{
final Class type = getter.getReturnType();
if (!type.isPrimitive() && type != String.class) return null;
if (type == boolean.class) return new CheckboxCellEditor(parent);
TextCellEditor editor = new TextCellEditor(parent);
if (type == String.class) return editor;
if (isNumeric(type))
{
editor.setValidator(new NumberValidator(type));
}
return editor;
}
ModifySupport.java 文件源码
项目:olca-app
阅读 85
收藏 0
点赞 0
评论 0
private void setEditor(ICellModifier<T> modifier, int index) {
switch (modifier.getCellEditingType()) {
case TEXTBOX:
if (modifier.getStyle() != SWT.NONE)
editors[index] = new TextCellEditor(getComponent(), modifier.getStyle());
else
editors[index] = new TextCellEditor(getComponent());
break;
case COMBOBOX:
editors[index] = new ComboEditor(getComponent(), new String[0]);
break;
case CHECKBOX:
if (modifier.getStyle() != SWT.NONE)
editors[index] = new CheckboxCellEditor(getComponent(), modifier.getStyle());
else
editors[index] = new CheckboxCellEditor(getComponent());
break;
default:
break;
}
}
ReplacementsEditor.java 文件源码
项目:convertigo-eclipse
阅读 34
收藏 0
点赞 0
评论 0
public ReplacementsEditor(Composite parent) {
super(parent);
dialogTitle = "String replacements";
templateData = new Object[] { "mime/type", "regex", "replaced by", "comment" };
columnNames = new String[] { "Mime type", "Find", "Replaced by", "Comment" };
columnSizes = new int[] { 200, 200, 200, 200 };
columnEditors = new CellEditor[] { new TextCellEditor(), new TextCellEditor(), new TextCellEditor(), new TextCellEditor() };
}
ArrayEditor.java 文件源码
项目:convertigo-eclipse
阅读 26
收藏 0
点赞 0
评论 0
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[columnNames.length];
for (int i = 0 ; i < columnNames.length ; i++) {
columnEditors[i] = new TextCellEditor(parent, getStyle());
}
return columnEditors;
}
CicsOutputMapEditor.java 文件源码
项目:convertigo-eclipse
阅读 35
收藏 0
点赞 0
评论 0
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[7];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new TextCellEditor(parent);
columnEditors[2] = new TextCellEditor(parent);
columnEditors[3] = new TextCellEditor(parent);
columnEditors[4] = new ComboBoxCellEditor(parent, new String[]{"","COMP","COMP-1","COMP-2","COMP-3","COMP-5","DISPLAY","POINTER"});
columnEditors[5] = new TextCellEditor(parent);
columnEditors[6] = new TextCellEditor(parent);
return columnEditors;
}
DomainsListingEditor.java 文件源码
项目:convertigo-eclipse
阅读 29
收藏 0
点赞 0
评论 0
@Override
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[2];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new ComboBoxCellEditor(parent, new String[]{Boolean.FALSE.toString(), Boolean.TRUE.toString()});
return columnEditors;
}
XMLRecordEditor.java 文件源码
项目:convertigo-eclipse
阅读 27
收藏 0
点赞 0
评论 0
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[3];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new TextCellEditor(parent);
columnEditors[2] = new ComboBoxCellEditor(parent, new String[]{"true","false"});
return columnEditors;
}
HttpHeaderForwardEditor.java 文件源码
项目:convertigo-eclipse
阅读 28
收藏 0
点赞 0
评论 0
@Override
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[2];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new ComboBoxCellEditor(parent, new String[] {
HttpConnector.HTTP_HEADER_FORWARD_POLICY_MERGE,
HttpConnector.HTTP_HEADER_FORWARD_POLICY_IGNORE,
HttpConnector.HTTP_HEADER_FORWARD_POLICY_REPLACE
});
return columnEditors;
}
TableEditor.java 文件源码
项目:convertigo-eclipse
阅读 30
收藏 0
点赞 0
评论 0
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[columnNames.length];
for (int i = 0 ; i < columnNames.length ; i++) {
columnEditors[i] = new TextCellEditor(parent);
}
return columnEditors;
}
BrowserDefinitionEditor.java 文件源码
项目:convertigo-eclipse
阅读 24
收藏 0
点赞 0
评论 0
public BrowserDefinitionEditor(Composite parent) {
super(parent);
dialogTitle = "Browsers definition";
templateData = new Object[] { "label", "keyword" };
columnNames = new String[] { "Label", "Keyword" };
columnSizes = new int[] { 200, 100 };
columnEditors = new CellEditor[] { new TextCellEditor(), new TextCellEditor() };
}
XMLTableEditor.java 文件源码
项目:convertigo-eclipse
阅读 25
收藏 0
点赞 0
评论 0
public CellEditor[] getColumnEditors(Composite parent) {
columnEditors = new CellEditor[3];
columnEditors[0] = new TextCellEditor(parent);
columnEditors[1] = new TextCellEditor(parent);
columnEditors[2] = new XMLTableColumnEditor(parent);
return columnEditors;
}
RemovableHeadersEditor.java 文件源码
项目:convertigo-eclipse
阅读 25
收藏 0
点赞 0
评论 0
public RemovableHeadersEditor(Composite parent) {
super(parent);
dialogTitle = "Removable headers";
templateData = new Object[] { "header name", "comment" };
columnNames = new String[] { "HEADER_TO_REMOVE", "Comment" };
columnSizes = new int[] { 200, 200};
columnEditors = new CellEditor[] { new TextCellEditor(), new TextCellEditor() };
}