当前位置: 首页>>代码示例>>Java>>正文


Java TextCellEditor类代码示例

本文整理汇总了Java中org.eclipse.jface.viewers.TextCellEditor的典型用法代码示例。如果您正苦于以下问题:Java TextCellEditor类的具体用法?Java TextCellEditor怎么用?Java TextCellEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextCellEditor类属于org.eclipse.jface.viewers包,在下文中一共展示了TextCellEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValue

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的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;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:26,代码来源:TableEditorCellModifier.java

示例2: getColumnEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的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;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:14,代码来源:HttpTransactionEditor.java

示例3: getCellEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
@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);
		}
	};
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:19,代码来源:NameEditingSupport.java

示例4: getCellEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
@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;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:18,代码来源:AxesEditingSupport.java

示例5: getCellEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的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());
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:18,代码来源:EventServiceComposite.java

示例6: addChildVisual

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
/**
 * @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);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:EnumerationLiteralsEditPart.java

示例7: performDirectEdit

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:NotationNameEditPart.java

示例8: getChildFigure

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
/**
 * 
 *   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);
            }
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:AbstractNotationNodeEditPart.java

示例9: EntryCellEditingSupport

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:33,代码来源:EntryCellEditingSupport.java

示例10: getCellEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
@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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:IntegerEditingSupport.java

示例11: getCellEditor

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
@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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:RealEditingSupport.java

示例12: defineCellEditing

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
/**
 *
 */
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());

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:20,代码来源:MultiPageCSVEditor.java

示例13: createTableViewer

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
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;
}
 
开发者ID:Elphel,项目名称:vdt-plugin,代码行数:19,代码来源:ListPromptViewer.java

示例14: getCellEditors

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:21,代码来源:MenuStylesDialog.java

示例15: PropertiesEditingSupport

import org.eclipse.jface.viewers.TextCellEditor; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:sopeco,项目名称:DynamicSpotter,代码行数:35,代码来源:PropertiesEditingSupport.java


注:本文中的org.eclipse.jface.viewers.TextCellEditor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。