當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。