Java Code Examples for org.eclipse.emf.edit.provider.IItemLabelProvider#getText()
The following examples show how to use
org.eclipse.emf.edit.provider.IItemLabelProvider#getText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectBuilder.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public String getObjectLabel ( final EObject eObject ) { if ( eObject.eIsProxy () ) { return super.getObjectLabel ( eObject ); } final IItemLabelProvider itemLabelProvider = (IItemLabelProvider)this.adapterFactory.adapt ( eObject, IItemLabelProvider.class ); logger.debug ( "Label provider: {} - for {}", itemLabelProvider, eObject ); if ( itemLabelProvider != null ) { return itemLabelProvider.getText ( eObject ); } return super.getObjectLabel ( eObject ); }
Example 2
Source File: ComponentLabelProvider.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public String getText ( final Object element ) { final IItemLabelProvider labelProvider = (IItemLabelProvider)this.adapterFactory.adapt ( element, IItemLabelProvider.class ); if ( labelProvider != null ) { final String label = labelProvider.getText ( element ); final String parents = makeParents ( element ); if ( parents != null && !parents.isEmpty () ) { return label + " - " + parents; } else { return label; } } else { return super.getText ( element ); } }
Example 3
Source File: VariableValueCellLabelProvider.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
@Override public void update(ViewerCell cell) { final Definition definition = (Definition) cell.getElement(); if (definition instanceof StringDefinition) { cell.setText(((StringDefinition) definition).getValue()); } else if (definition instanceof IntegerDefinition) { cell.setText(String.valueOf(((IntegerDefinition) definition).getValue())); } else if (definition instanceof RealDefinition) { cell.setText(String.valueOf(((RealDefinition) definition).getValue())); } else if (definition instanceof BooleanDefinition) { cell.setText(String.valueOf(((BooleanDefinition) definition).isValue())); } else if (definition instanceof ModelDefinition) { final String text; final EObject eObj = ((ModelDefinition) definition).getValue(); if (eObj != null) { final IItemLabelProvider itemProvider = (IItemLabelProvider) adapterFactory.adapt(eObj, IItemLabelProvider.class); if (itemProvider == null) { text = eObj.toString(); } else { text = itemProvider.getText(eObj); } cell.setText(text); } else { cell.setText(""); } } else { cell.setText(DON_T_KNOW_WHAT_TO_DO_WITH + definition.getClass().getCanonicalName()); } }
Example 4
Source File: InjectableAdapterFactoryLabelProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public String getText(Object object) { IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); return itemLabelProvider != null ? itemLabelProvider.getText(object) : null; }