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


Java IItemLabelProvider.getText方法代码示例

本文整理汇总了Java中org.eclipse.emf.edit.provider.IItemLabelProvider.getText方法的典型用法代码示例。如果您正苦于以下问题:Java IItemLabelProvider.getText方法的具体用法?Java IItemLabelProvider.getText怎么用?Java IItemLabelProvider.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.edit.provider.IItemLabelProvider的用法示例。


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

示例1: setMarkerAttibutes

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
/**
 * Sets attributes for the given {@link IMarker}.
 * 
 * @param marker
 *            the {@link IMarker}
 * @param resource
 *            the {@link IFile} containing the mode
 * @param instruction
 *            the {@link EObject} representing the instruction
 * @param persistent
 *            should be persisted
 * @throws CoreException
 *             if attributes can't be set
 */
protected void setMarkerAttibutes(final IMarker marker, IFile resource, EObject instruction,
		boolean persistent) throws CoreException {
	final IItemLabelProvider provider = (IItemLabelProvider)ADAPTER_FACTORY.adapt(instruction,
			IItemLabelProvider.class);
	marker.setAttribute(IBreakpoint.ENABLED, true);
	marker.setAttribute(IBreakpoint.PERSISTED, persistent);
	marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
	marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
	final String instructionText = provider.getText(instruction);
	marker.setAttribute(IMarker.MESSAGE, "DSL Breakpoint: " + resource.getFullPath() + " ["
			+ instructionText + "]");
	try {
		marker.setAttribute(IMAGE_ATTRIBUTE, toAttribute(provider.getImage(instruction)));
	} catch (IOException e) {
		Activator.getDefault().error(e);
	}
	marker.setAttribute(TEXT_ATTRIBUTE, instructionText);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:33,代码来源:DSLBreakpoint.java

示例2: getObjectLabel

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@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 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ProjectBuilder.java

示例3: getText

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@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 );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ComponentLabelProvider.java

示例4: getText

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
/**
 * This returns the label text for the adapted class. <!-- begin-user-doc
 * --> <!-- end-user-doc -->
 * 
 * @generatedNOT
 */
@Override
public String getText(Object object)
{
	TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper) object;
	Object realItem = ((TreeNodeWrapper) object).getObject();
	if (realItem == null)
	{
		return treeNodeWrapper.getLabel();
	}

	IItemLabelProvider realItemItemprovider = getRealItemItemProvider(treeNodeWrapper, realItem);
	String suffix = treeNodeWrapper.isChildrenLoaded() ? " (" + getChildren(object).size() + ")" : " (?)";
	String label = realItemItemprovider.getText(realItem) + suffix;
	return label;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:TreeNodeWrapperItemProvider.java

示例5: getDisplayString

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@Override
protected String getDisplayString(EObject element, String qualifiedNameAsString, String shortName) {
	if (element instanceof Type) {
		return super.getDisplayString(element, qualifiedNameAsString, shortName);
	}
	if (element instanceof State) {
		qualifiedNameAsString = getQualifiedNameConverter()
				.toString(getQualifiedNameConverter().toQualifiedName(qualifiedNameAsString).skipFirst(1));
		return super.getDisplayString(element, qualifiedNameAsString, shortName);
	}

	if (element == null || element.eIsProxy()) {
		return qualifiedNameAsString;
	}
	IItemLabelProvider adapter = (IItemLabelProvider) composedAdapterFactory.adapt(element,
			IItemLabelProvider.class);
	if (adapter != null) {
		return adapter.getText(element);
	}
	return super.getDisplayString(element, qualifiedNameAsString, shortName);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:STextProposalProvider.java

示例6: getName

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@Override
public String getName() {
	EActivity activity = getActivity();
	Effect effect = getEffect();
	IItemLabelProvider lp = EMFUtils.adapt(object, IItemLabelProvider.class);
	String objectName = "<object>";
	if (lp != null) {
		objectName = lp.getText(object);
	} else {
		EStructuralFeature f = object.eClass().getEStructuralFeature("name");
		if (f != null) {
			objectName = (String) object.eGet(f);
		}
	}
	return activity.getName()+"."+objectName+"."+effect.getDefinition().getName()+"."+getTimepoint();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:ReferencedObjectEffectDependency.java

示例7: getValueString

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
protected String getValueString(Object value) {
	if (value instanceof EEnumLiteral) {
		return ((EEnumLiteral)value).getLiteral();
	} else if (value instanceof EObject) {
		IItemLabelProvider labeler = EMFUtils.adapt(value, IItemLabelProvider.class);
		if (labeler != null) {
			String text = labeler.getText(value);
			if (text != null) {
				return text;
			}
		}
	} else if (NULL_VALUE == value) {
		return "";
	}
	return value.toString();
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:17,代码来源:GroupingTimelineContentProvider.java

示例8: getPrettyName

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
private String getPrettyName() {
	String result = null;
	if (profile instanceof StructuralFeatureProfile) {
		StructuralFeatureProfile sfProfile  = (StructuralFeatureProfile) profile;
		EObject object = sfProfile.getObject();
		IItemLabelProvider lp = EMFUtils.adapt(object, IItemLabelProvider.class);
		if (lp != null) {
			result = lp.getText(object);
		} else {
			EStructuralFeature f = object.eClass().getEStructuralFeature("name");
			if (f != null) {
				result = (String) object.eGet(f);
			}
		}
		if (result == null || result.trim().length() == 0) {
			return null;
		}
		result += " " + sfProfile.getFeature().getName();
	}
	return result;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:22,代码来源:ProfileReferenceViolation.java

示例9: getText

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public String getText() {
	if (text == null) {
		EStructuralFeature feature = getFeature();
		if(feature instanceof EReference) {
			IItemLabelProvider labeler = EMFUtils.adapt(value, IItemLabelProvider.class);
			if (labeler != null) {
				text = labeler.getText(value);
			}
		} else {
			IStringifier stringifier = EMFUtils.getStringifier((EAttribute)feature);
			if (stringifier != null) {
				text = stringifier.getDisplayString(value);
			}
		}
		if (text == null) {
			text = value.toString();
		}
	}
	return text;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:ValueAction.java

示例10: getText

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@Override
public String getText(ParameterFacet<T> facet) {
	if (facet == null) {
		return "-";
	}
	EStructuralFeature feature = facet.getFeature();
	EClassifier type = feature.getEType();
	if (isCheckboxType(type)) {
			return null;
	}
	
	if (feature instanceof EAttribute) {
		IStringifier<Object> stringifier = ParameterStringifierUtils.getStringifier((EAttribute)feature);
		return stringifier.getDisplayString(facet.getValue());
	}
	EObject object = facet.getObject();
	IItemLabelProvider labelProvider = EMFUtils.getItemLabelProvider(object, feature);
	return labelProvider == null ? "" : labelProvider.getText(facet.getValue());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:ParameterColumn.java

示例11: getObjectId

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
public static String getObjectId(EObject object) {
	String id = null;
	String objectId = EcoreUtil.getID(object);
	if (objectId != null) {
		id = objectId;
	} else {
		IItemLabelProvider lp = EMFUtils.adapt(object, IItemLabelProvider.class);
		if (lp != null) {
			id = lp.getText(object);
		} else {
			EStructuralFeature f = object.eClass().getEStructuralFeature("name");
			if (f != null) {
				id = (String) object.eGet(f);
			}
		}
	}
	if (id == null || id.trim().length() == 0) {
		id = "?";
	}
	return id;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:22,代码来源:ProfileUtil.java

示例12: getLabel

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@Override
public String getLabel(Generator<?> generator) {		
	if (generator != null && adapterFactory != null && !generator.eIsProxy()) {
		IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(generator,	IItemLabelProvider.class);
		if (itemLabelProvider != null) {
			return itemLabelProvider.getText(generator);
		}
	}
	
	return null;
}
 
开发者ID:Nasdanika,项目名称:codegen-ecore,代码行数:12,代码来源:GenerateAction.java

示例13: update

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
@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());
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:32,代码来源:CustomGenconfEditor.java

示例14: getLabel

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
/**
 * Gets the label of the given {@link EObject}.
 * 
 * @param eObj
 *            the {@link EObject}
 * @return the label of the given {@link EObject}
 */
private static String getLabel(EObject eObj) {
	final String res;
	final IItemLabelProvider itemProvider = (IItemLabelProvider)FACTORY.adapt(eObj,
			IItemLabelProvider.class);

	if (itemProvider == null) {
		res = eObj.toString();
	} else {
		res = itemProvider.getText(eObj);
	}

	return res;
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:21,代码来源:EObjectConnector.java

示例15: getText

import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入方法依赖的package包/类
/**
 * This returns the label text for the adapted class.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@Override
public String getText(Object object) {
	StructuralFeatureProfile p = (StructuralFeatureProfile) object;
	EObject profileObject = p.getObject();
	IItemLabelProvider lp = EMFUtils.adapt(profileObject, IItemLabelProvider.class);
	if (lp != null) {
		String text = lp.getText(profileObject);
		return text + "_" + p.getFeature().getName();
	}
	return super.getText(object);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:StructuralFeatureProfileItemProvider.java


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