Java Code Examples for org.eclipse.emf.edit.provider.IItemLabelProvider

The following examples show how to use org.eclipse.emf.edit.provider.IItemLabelProvider. These examples are extracted from open source projects.
Example 1
Project: neoscada   File: ProjectBuilder.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@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
Project: neoscada   File: ComponentLabelProvider.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@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
Project: neoscada   File: ProtocolItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ProtocolItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 4
Project: neoscada   File: ChartItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ChartItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 5
Project: neoscada   File: ChartItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ChartItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 6
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public VisualInterfaceItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 7
Project: neoscada   File: DetailViewItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public DetailViewItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 8
Project: neoscada   File: IEC60870ItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated NOT
 */
public IEC60870ItemProviderAdapterFactory ()
{
    this.supportedTypes.add ( IEditingDomainItemProvider.class );
    this.supportedTypes.add ( IStructuredItemContentProvider.class );
    this.supportedTypes.add ( ITreeItemContentProvider.class );
    this.supportedTypes.add ( IItemLabelProvider.class );
    this.supportedTypes.add ( IItemPropertySource.class );
    this.supportedTypes.add ( IPropertySource.class );
}
 
Example 9
Project: neoscada   File: GlobalizeItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public GlobalizeItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 10
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ExecComponentsItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 11
Project: neoscada   File: SecurityItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SecurityItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
}
 
Example 12
Project: neoscada   File: CommonItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public CommonItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 13
Project: neoscada   File: JdbcItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public JdbcItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 14
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public MemoryManagerItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 15
Project: neoscada   File: CommonItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public CommonItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 16
Project: neoscada   File: DeploymentItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public DeploymentItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 17
Project: neoscada   File: SetupItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public SetupItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 18
Project: neoscada   File: ProfileItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ProfileItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 19
Project: neoscada   File: OsgiItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public OsgiItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 20
Project: neoscada   File: WorldItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public WorldItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( ITableItemLabelProvider.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 21
Project: neoscada   File: ItemItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ItemItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 22
Project: neoscada   File: MemoryItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public MemoryItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 23
Project: neoscada   File: ModbusItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ModbusItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 24
Project: neoscada   File: ScriptItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ScriptItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 25
Project: neoscada   File: RecipeItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public RecipeItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 26
Project: neoscada   File: ParserItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ParserItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 27
Project: neoscada   File: DaveItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public DaveItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 28
Project: neoscada   File: ArduinoItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ArduinoItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 29
Project: neoscada   File: ComponentItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ComponentItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 30
Project: neoscada   File: ComponentLabelProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Image getImage ( final Object element )
{
    final IItemLabelProvider labelProvider = (IItemLabelProvider)this.adapterFactory.adapt ( element, IItemLabelProvider.class );
    if ( labelProvider != null )
    {
        return ExtendedImageRegistry.getInstance ().getImage ( labelProvider.getImage ( element ) );
    }
    else
    {
        return super.getImage ( element );
    }
}
 
Example 31
Project: neoscada   File: IEC62541ItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public IEC62541ItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 32
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public InfrastructureItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
    supportedTypes.add ( IItemStyledLabelProvider.class );
}
 
Example 33
Project: neoscada   File: ParserItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ParserItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 34
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ConfigurationItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 35
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public ConfigurationItemProviderAdapterFactory ()
{
    supportedTypes.add ( IEditingDomainItemProvider.class );
    supportedTypes.add ( IStructuredItemContentProvider.class );
    supportedTypes.add ( ITreeItemContentProvider.class );
    supportedTypes.add ( IItemLabelProvider.class );
    supportedTypes.add ( IItemPropertySource.class );
}
 
Example 36
Project: scava   File: CrossflowDiagramEditorPlugin.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
public ImageDescriptor getItemImageDescriptor(Object item) {
	IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
	if (labelProvider != null) {
		return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
	}
	return null;
}
 
Example 37
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public CrossflowItemProviderAdapterFactory() {
	supportedTypes.add(IEditingDomainItemProvider.class);
	supportedTypes.add(IStructuredItemContentProvider.class);
	supportedTypes.add(ITreeItemContentProvider.class);
	supportedTypes.add(IItemLabelProvider.class);
	supportedTypes.add(IItemPropertySource.class);
}
 
Example 38
Project: M2Doc   File: GenconfItemProviderAdapterFactory.java    License: Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
public GenconfItemProviderAdapterFactory() {
    supportedTypes.add(IEditingDomainItemProvider.class);
    supportedTypes.add(IStructuredItemContentProvider.class);
    supportedTypes.add(ITreeItemContentProvider.class);
    supportedTypes.add(IItemLabelProvider.class);
    supportedTypes.add(IItemPropertySource.class);
}
 
Example 39
Project: M2Doc   File: VariableValueCellLabelProvider.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@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 40
Project: xtext-eclipse   File: TypesItemProviderAdapterFactory.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This constructs an instance.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public TypesItemProviderAdapterFactory()
{
	supportedTypes.add(IEditingDomainItemProvider.class);
	supportedTypes.add(IStructuredItemContentProvider.class);
	supportedTypes.add(ITreeItemContentProvider.class);
	supportedTypes.add(IItemLabelProvider.class);
	supportedTypes.add(IItemPropertySource.class);
}