本文整理汇总了Java中org.eclipse.jface.viewers.ColumnLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java ColumnLabelProvider类的具体用法?Java ColumnLabelProvider怎么用?Java ColumnLabelProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnLabelProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了ColumnLabelProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createColumn3
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createColumn3()
{
TreeColumn column = new TreeColumn(_viewer.getTree(), SWT.LEFT);
// column.setText("Step");
TreeViewerColumn viewerColumn = new TreeViewerColumn(_viewer, column);
viewerColumn.setLabelProvider(
new ColumnLabelProvider()
{
@Override
public String getText(Object element)
{
String result = "";
if (element instanceof IExecutionEngine)
{
IExecutionEngine engine = (IExecutionEngine)element;
result = String.format("%d", engine.getEngineStatus().getNbLogicalStepRun());
}
return result;
}
});
}
示例2: createColumns
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createColumns(TreeViewer viewer) {
viewer.setColumnProperties(new String[] { "Name", "Value"});
ColumnViewerToolTipSupport.enableFor(viewer);
TreeViewerColumn nameColumn = new TreeViewerColumn(viewer, SWT.LEFT, 0);
nameColumn.getColumn().setText("Name");
nameColumn.getColumn().setWidth(200);
nameColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
INamedNode node = (INamedNode)element;
return node.getDisplayName();
}
});
nameColumn.setEditingSupport(new NameEditingSupport(this));
TreeViewerColumn valueColumn = new TreeViewerColumn(viewer, SWT.LEFT, 1);
valueColumn.getColumn().setText("Value");
valueColumn.getColumn().setWidth(300);
valueColumn.setLabelProvider(new DelegatingStyledCellLabelProvider(new ControlValueLabelProvider(cservice, this)));
valueColumn.setEditingSupport(new ControlEditingSupport(viewer, cservice, controlViewerMode));
}
示例3: createSourceTable
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createSourceTable(SashForm sashForm) {
avaliableFieldTableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
table_1 = avaliableFieldTableViewer.getTable();
table_1.setLinesVisible(true);
table_1.setHeaderVisible(true);
avaliableFieldTableViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
return ((List) inputElement).toArray();
}
});
avaliableFieldTableViewer.setInput(schemaFields);
TableViewerColumn tableViewerColumn_2 = new TableViewerColumn(avaliableFieldTableViewer, SWT.NONE);
TableColumn tblclmnNewColumn_2 = tableViewerColumn_2.getColumn();
tblclmnNewColumn_2.setWidth(196);
tblclmnNewColumn_2.setText(Messages.AVAILABLE_FIELDS_HEADER);
tableViewerColumn_2.setLabelProvider(new ColumnLabelProvider());
attachDragListener();
}
示例4: createColumn
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createColumn(int idx, int align) {
TableViewerColumn viewerColumn = new TableViewerColumn(viewer, align, idx);
viewerColumn.setEditingSupport(new TableEditingSupport(viewer, idx));
viewerColumn.setLabelProvider(new ColumnLabelProvider() {
private int col = idx;
public String getText(Object element) {
if (element instanceof Row) {
return ((Row) element).data[col];
}
return super.getText(element);
}
});
TableColumn column = viewerColumn.getColumn();
column.setResizable(true);
column.setMoveable(true);
column.setText(tableModel.headers[idx]);
int width = convertWidthInCharsToPixels(tableModel.colWidths[idx]);
width = Math.max(width, 50);
column.setWidth(width);
}
示例5: addAliasColumn
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void addAliasColumn(String namespace) {
TreeViewerColumn aliasColumn = new TreeViewerColumn(commandsTreeTable, SWT.NONE);
aliasColumn.getColumn().setText(namespace);
aliasColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
CommandInfo cmd = (CommandInfo) element;
if (cmd.getAbstract()) {
// show a blank line if the command is abstract
return "";
}
List<NamedObjectId> aliases = cmd.getAliasList();
for (NamedObjectId aliase : aliases) {
if (aliase.getNamespace().equals(namespace))
return aliase.getName();
}
return "";
}
});
tcl.setColumnData(aliasColumn.getColumn(), new ColumnPixelData(COLUMN_WIDTH));
}
示例6: compareNormal
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
protected int compareNormal(Object e1, Object e2) {
try {
ColumnLabelProvider labelProvider = (ColumnLabelProvider) viewer.getLabelProvider(colIndex);
String t1 = labelProvider.getText(e1);
String t2 = labelProvider.getText(e2);
Boolean isNumber = (Boolean) this.col.getData("isNumber");
if (isNumber != null && isNumber.booleanValue()) {
t1 = numonly(t1);
t2 = numonly(t2);
double n1 = CastUtil.cdouble(t1);
double n2 = CastUtil.cdouble(t2);
return n1 == n2 ? 0 : (n1 > n2) ? 1 : -1;
} else {
if (t1 == null) t1 = "";
if (t2 == null) t2 = "";
}
return t1.compareTo(t2);
} catch(Throwable th) { }
return 0;
}
示例7: getColumnLabelProvider
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private ColumnLabelProvider getColumnLabelProvider(final String title) {
return new ColumnLabelProvider() {
@Override
public String getText(final Object element) {
final IAgent agent = (IAgent) element;
if (agent.dead() && !title.equals(ID_ATTRIBUTE)) { return "N/A"; }
if (title.equals(ID_ATTRIBUTE)) { return String.valueOf(agent.getIndex()); }
final Object value;
if (agent.getSpecies().hasVar(title))
return Cast.toGaml(getScope().getAgentVarValue(agent, title));
else
return Cast.toGaml(agent.getAttribute(title));
}
};
}
示例8: createTableViewer
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
/**
* This adds role column to table viewer. Using role column user can see and change role of a participant.
*
* @param parent parent
*/
@Override
protected void createTableViewer(Composite parent) {
super.createTableViewer(parent);
final TableViewerColumn roleColumnViewer = new TableViewerColumn(getTableViewer(), SWT.NONE);
roleColumnViewer.getColumn().setText("Role");
roleColumnViewer.getColumn().setWidth(120);
roleColumnViewer.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
final ACOrgUnit orgUnit = (ACOrgUnit) element;
final int roleIndex = getCurrentRoleIndex(orgUnit);
return roleNames[roleIndex];
}
});
roleColumnViewer.setEditingSupport(new RoleEditingSupport(getTableViewer()));
}
示例9: postConstruct
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
@PostConstruct
public void postConstruct(Composite parent) {
ResourceManager resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);
TreeViewer viewer = new TreeViewer(parent);
viewer.setContentProvider(new TreeContentProvider());
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
viewer.getTree().setFont(resourceManager.createFont(FontDescriptor.createFrom("Arial", 32, SWT.ITALIC)));
TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
viewerColumn.getColumn().setWidth(300);
viewerColumn.getColumn().setText("Names");
viewerColumn.setLabelProvider(new ColumnLabelProvider());
viewer.setInput(new String[] { "Simon Scholz", "Lars Vogel", "Dirk Fauth", "Wim Jongman", "Tom Schindl" });
GridLayoutFactory.fillDefaults().generateLayout(parent);
}
示例10: createTableViewerColumn
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private static TableViewerColumn createTableViewerColumn(final TableViewer viewer,
final int colNumber, final String title, final int bound, final int alignment,
final ColumnLabelProvider label)
{
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
column.setAlignment(alignment);
column.setText(title);
column.setWidth(bound);
column.setResizable(true);
column.setMoveable(true);
viewerColumn.setLabelProvider(label);
// if (viewer instanceof JiveTableViewer) {
// column
// .addSelectionListener(((JiveTableViewer) viewer).getSelectionAdapter(column, colNumber));
// }
return viewerColumn;
}
示例11: createColumns
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createColumns(final Composite parent, final TableViewer viewer, MessungTyp t){
// First column is for the measure date
TableViewerColumn col;
col =
createTableViewerColumn(viewer, Messages.MessungenUebersicht_Table_Datum,
DEFAULT_COL_WIDTH, 0);
col.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element){
Messung m = (Messung) element;
return m.getDatum();
}
});
int i = 0;
for (IMesswertTyp dft : t.getMesswertTypen()) {
String colTitle = dft.getTitle();
if (!dft.getUnit().equals("")) //$NON-NLS-1$
colTitle += " [" + dft.getUnit() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
col = createTableViewerColumn(viewer, colTitle, DEFAULT_COL_WIDTH, 0);
col.setLabelProvider(new CustomColumnLabelProvider(i, dft.getName()));
i++;
}
}
示例12: createColumns
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private void createColumns() {
String[] titles = { "Class/Interface", "Component", "Value", "Type" };
TableViewerColumn col;
ColumnLabelProvider emptyLabelProvider = new ColumnLabelProvider() {
public Image getImage(Object element) {
return null;
}};
// first column is for the first name
for (int i = 0; i < titles.length; i++) {
col = createTableViewerColumn(titles[i], 100, i);
col.setLabelProvider(emptyLabelProvider);
col.getColumn().setImage(null);
}
}
示例13: createTableViewerColumn
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
private TableViewerColumn createTableViewerColumn(String title, int bound, final int colNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setWidth(bound);
column.setResizable(true);
column.setMoveable(true);
viewerColumn.setLabelProvider(new ColumnLabelProvider(){
@Override
public String getToolTipText(Object element){
if( ! (element instanceof ConseaSearchResonse) ){
return "No Instance";
}
ConseaSearchResonse searchResponse = (ConseaSearchResonse)element;
return searchResponse.getDescript().isEmpty() ? "No Description available" : searchResponse.getDescript();
}
});
return viewerColumn;
}
示例14: LanguageSelectionTable
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
public LanguageSelectionTable(Composite parent, int style) {
super(parent, style);
// this.setLayout(new FillLayout());
this.setLayout(new GridLayout(1, false));
currentLanguages = new Text(this, SWT.READ_ONLY);
currentLanguages.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
currentLanguages.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
tv = CheckboxTableViewer.newCheckList(this, SWT.BORDER | SWT.V_SCROLL);
tv.setContentProvider(new ArrayContentProvider());
tv.getTable().setHeaderVisible(false);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint=80;
gd.widthHint=150;
tv.getTable().setLayoutData(gd);
TableViewerColumn tvc = new TableViewerColumn(tv, SWT.NONE);
tvc.getColumn().setWidth(gd.widthHint);
tvc.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return (String) element;
}
});
tv.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateCurrentLanguageLabel();
}
});
}
示例15: createMainColumn
import org.eclipse.jface.viewers.ColumnLabelProvider; //导入依赖的package包/类
protected void createMainColumn() {
TableViewerColumn c = createTableViewerColumn("Service", 200, SWT.LEFT, false);
ColumnLabelProvider labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof ServiceSummary) {
return TextProxy.service.getText(((ServiceSummary) element).hash);
}
return null;
}
};
c.setLabelProvider(labelProvider);
}