本文整理匯總了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);
}
示例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 );
}
示例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 );
}
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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());
}
}
示例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;
}
示例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);
}