本文整理汇总了Java中org.eclipse.emf.edit.provider.IItemLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java IItemLabelProvider类的具体用法?Java IItemLabelProvider怎么用?Java IItemLabelProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IItemLabelProvider类属于org.eclipse.emf.edit.provider包,在下文中一共展示了IItemLabelProvider类的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: getChildren
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
@Override
public Collection<?> getChildren(Object object)
{
if (object != null && object instanceof TreeNodeWrapper)
{
TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper) object;
if (treeNodeWrapper.getObject() != null && treeNodeWrapper.getObject() instanceof BTSConfig)
{
Object realItem = ((TreeNodeWrapper) object).getObject();
IItemLabelProvider realItemItemprovider = getRealItemItemProvider(treeNodeWrapper, realItem);
return ((IStructuredItemContentProvider) realItemItemprovider).getElements(realItem);
}
}
return super.getChildren(object);
}
示例5: hasChildren
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
@Override
public boolean hasChildren(Object object)
{
if (object != null && object instanceof TreeNodeWrapper)
{
TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper) object;
if (treeNodeWrapper.getObject() != null && treeNodeWrapper.getObject() instanceof BTSConfig)
{
Object realItem = ((TreeNodeWrapper) object).getObject();
IItemLabelProvider realItemItemprovider = getRealItemItemProvider(treeNodeWrapper, realItem);
return ((ItemProviderAdapter) realItemItemprovider).hasChildren(realItem);
}
}
return super.hasChildren(object);
}
示例6: getImage
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
/**
* This returns TreeNodeWrapper.gif. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @generatedNot
*/
@Override
public Object getImage(Object object)
{
TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper) object;
Object realItem = ((TreeNodeWrapper) object).getObject();
if (realItem == null) {
return overlayImage(object,
getResourceLocator().getImage("full/obj16/TreeNodeWrapper"));
}
IItemLabelProvider realItemItemprovider = getRealItemItemProvider(
treeNodeWrapper, realItem);
return realItemItemprovider.getImage(realItem);
}
示例7: 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;
}
示例8: getStyledText
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
/**
* This returns the label styled text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generatedNOT
*/
@Override
public Object getStyledText(Object object) {
StyledString styledLabel = new StyledString();
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() + ")" : " (?)";
if (realItemItemprovider instanceof IItemStyledLabelProvider)
{
styledLabel = (StyledString) ((IItemStyledLabelProvider) realItemItemprovider).getStyledText(realItem);
styledLabel.append(suffix, CHILDREN_NUM_STYLE);
}
else
{
styledLabel.append(realItemItemprovider.getText(realItem), StyledString.Style.NO_STYLE);
styledLabel.append(suffix, CHILDREN_NUM_STYLE);
}
return styledLabel;
}
示例9: 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);
}
示例10: 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();
}
示例11: getImage
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
@Override
public Image getImage(Object element) {
if (element instanceof DynamicActivityGroup) {
DynamicActivityGroup dag = (DynamicActivityGroup) element;
Object value = dag.getValue();
if (value instanceof EEnumLiteral) {
return null;
}
IItemLabelProvider lp = EMFUtils.adapt(value, IItemLabelProvider.class);
if (lp != null) {
Object image = lp.getImage(value);
return ExtendedImageRegistry.getInstance().getImage(image);
}
return null;
}
return delegate.getImage(element);
}
示例12: 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();
}
示例13: 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;
}
示例14: createSubSection
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
public static Composite createSubSection(FormToolkit toolkit, Composite parent, EObject eObject, boolean hasLabel) {
Composite subSection = null;
IItemLabelProvider labelProvider = EMFUtils.adapt(eObject, IItemLabelProvider.class);
if (labelProvider != null) {
String text = labelProvider.getText(eObject);
Image image = null;
Object imageURL = labelProvider.getImage(eObject);
if (imageURL != null) {
try {
image = ExtendedImageRegistry.getInstance().getImage(imageURL);
} catch (Exception e) {
Logger.getLogger(DetailFormToolkit.class).error("failed to get image", e);
}
}
Section section = createSection(toolkit, parent, text, image);
subSection = toolkit.createComposite(section);
GridLayout layout = new GridLayout((hasLabel) ? 2 : 1, false);
layout.verticalSpacing = 2;
layout.horizontalSpacing = 10;
subSection.setLayout(layout);
section.setClient(subSection);
}
return subSection;
}
示例15: buildPropertySection
import org.eclipse.emf.edit.provider.IItemLabelProvider; //导入依赖的package包/类
private void buildPropertySection(Composite parent, EObject target, List<IItemPropertyDescriptor> pds, IItemLabelProvider labeler) {
if (!hasVisibleDescriptors(target, pds))
return;
String text = null;
Image image = null;
if (labeler != null) {
text = labeler.getText(target);
Object imageURL = labeler.getImage(text);
if (imageURL != null) {
try {
image = ExtendedImageRegistry.getInstance().getImage(imageURL);
} catch (Exception e) {
LogUtil.error("failed to get image", e);
}
}
}
buildPropertySection(parent, target, pds, text, image);
}