本文整理匯總了Java中org.eclipse.jface.viewers.ComboBoxCellEditor類的典型用法代碼示例。如果您正苦於以下問題:Java ComboBoxCellEditor類的具體用法?Java ComboBoxCellEditor怎麽用?Java ComboBoxCellEditor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComboBoxCellEditor類屬於org.eclipse.jface.viewers包,在下文中一共展示了ComboBoxCellEditor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createPropertyEditor
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
/**
* The <code>ComboBoxPropertyDescriptor</code> implementation of this
* <code>IPropertyDescriptor</code> method creates and returns a new
* <code>ComboBoxCellEditor</code>.
* <p>
* The editor is configured with the current validator if there is one.
* </p>
*/
public CellEditor createPropertyEditor(Composite parent) {
String[] tags = getTags();
editor = new ComboBoxCellEditor(parent, tags, SWT.READ_ONLY);
if (getValidator() != null) {
editor.setValidator(getValidator());
}
editor.addListener(new ICellEditorListener() {
@Override
public void editorValueChanged(boolean oldValidState, boolean newValidState) {
}
@Override
public void cancelEditor() {
}
@Override
public void applyEditorValue() {
last.set(editor);
}
});
return editor;
}
示例2: getValue
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
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;
if (element instanceof Item) {
element = ((Item) element).getData();
}
ArrayEditorRow row = (ArrayEditorRow) element;
Object object = row.getValue(columnIndex);
if (isComboBoxEditor) {
int index = Arrays.asList(((ComboBoxCellEditor)cellEditor).getItems()).indexOf(object.toString());
object = new Integer(index);
}
return object;
}
示例3: getValue
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
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;
}
示例4: getColumnEditor
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
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;
}
示例5: getCellEditor
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
@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());
}
}
示例6: getValueForComboBoxCellEditor
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
/**
* Computes an Integer value to give to a ComboBoxCellEditor. The value
* corresponds to an index into the cell editor's array of items. The item
* at that index is equal to the current value held in the model.
*/
private Integer getValueForComboBoxCellEditor(final String objectModelValue, final String property) {
propertyNameToComboText.remove(property);
if (objectModelValue == null) {
return new Integer(-1);
}
final ComboBoxCellEditor comboBoxCellEditor = (ComboBoxCellEditor) getCellEditorForProperty(property);
final String[] items = comboBoxCellEditor.getItems();
for (int i = 0; i < items.length; i++) {
if (objectModelValue.equalsIgnoreCase(items[i])) {
return new Integer(i);
}
}
return new Integer(-1);
}
示例7: createPropertyEditor
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
public CellEditor createPropertyEditor(Composite parent) {
if (!this.editable){
return null;
}
final ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(parent,
new String[]{DEFAULT, Boolean.TRUE.toString(),Boolean.FALSE.toString()},
SWT.READ_ONLY);
Control control = cellEditor.getControl();
control.addMouseListener(new MouseAdapter() {
private final Integer ONE = new Integer(1);
private final Integer TWO = new Integer(2);
@Override
public void mouseDoubleClick(MouseEvent e) {
if (ONE.equals(cellEditor.getValue())){//true
cellEditor.setValue(2);//false
} else if (TWO.equals(cellEditor.getValue())){//false
cellEditor.setValue(1);//true
}
super.mouseDoubleClick(e);
}
});
if (getValidator() != null) {
cellEditor.setValidator(getValidator());
}
return cellEditor;
}
示例8: EntryCellEditingSupport
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
/**
* 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;
}
示例9: setupCellEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
private void setupCellEditors(final Table table) {
final ComboBoxCellEditor editor= new ComboBoxCellEditor();
editor.setStyle(SWT.READ_ONLY);
fTableViewer.setCellEditors(new CellEditor[] { null, editor});
fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
if (editor.getControl() == null & !table.isDisposed())
editor.create(table);
final ISelection sel= event.getSelection();
if (!(sel instanceof IStructuredSelection))
return;
final IStructuredSelection structured= (IStructuredSelection) sel;
if (structured.size() != 1)
return;
final MemberActionInfo info= (MemberActionInfo) structured.getFirstElement();
editor.setItems(info.getAllowedLabels());
editor.setValue(new Integer(info.getAction()));
}
});
final ICellModifier cellModifier= new MemberActionCellModifier();
fTableViewer.setCellModifier(cellModifier);
fTableViewer.setColumnProperties(new String[] { MEMBER_PROPERTY, ACTION_PROPERTY});
}
示例10: setupCellEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
private void setupCellEditors(final Table table) {
final ComboBoxCellEditor comboBoxCellEditor= new ComboBoxCellEditor();
comboBoxCellEditor.setStyle(SWT.READ_ONLY);
fTableViewer.setCellEditors(new CellEditor[] { null, comboBoxCellEditor});
fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
if (comboBoxCellEditor.getControl() == null & !table.isDisposed())
comboBoxCellEditor.create(table);
Assert.isTrue(event.getSelection() instanceof IStructuredSelection);
final IStructuredSelection ss= (IStructuredSelection) event.getSelection();
if (ss.size() != 1)
return;
final MemberActionInfo mac= (MemberActionInfo) ss.getFirstElement();
comboBoxCellEditor.setItems(MemberActionInfoLabelProvider.getAvailableActionLabels(mac));
comboBoxCellEditor.setValue(new Integer(mac.getAction()));
}
});
final ICellModifier cellModifier= new PushDownCellModifier();
fTableViewer.setCellModifier(cellModifier);
fTableViewer.setColumnProperties(new String[] { MEMBER_PROPERTY, ACTION_PROPERTY});
}
示例11: getCellEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
public CellEditor[] getCellEditors( )
{
if ( cellEditor != null )
{
return cellEditor;
}
ComboBoxCellEditor comboCell = new ComboBoxCellEditor( viewer.getTable( ),
new String[0],
SWT.READ_ONLY );
ComboBoxCellEditor positionCell = new ComboBoxCellEditor( viewer.getTable( ),
positionItems,
SWT.READ_ONLY );
cellEditor = new CellEditor[]{
null, null, comboCell, positionCell
};
return cellEditor;
}
示例12: getColumnEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
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;
}
示例13: getColumnEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
@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;
}
示例14: getColumnEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
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;
}
示例15: getColumnEditors
import org.eclipse.jface.viewers.ComboBoxCellEditor; //導入依賴的package包/類
@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;
}