當前位置: 首頁>>代碼示例>>Java>>正文


Java IItemLabelProvider類代碼示例

本文整理匯總了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);
}
 
開發者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: 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);
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:17,代碼來源:TreeNodeWrapperItemProvider.java

示例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);
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:17,代碼來源:TreeNodeWrapperItemProvider.java

示例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);

}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:22,代碼來源:TreeNodeWrapperItemProvider.java

示例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;
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:22,代碼來源:TreeNodeWrapperItemProvider.java

示例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;
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:32,代碼來源:TreeNodeWrapperItemProvider.java

示例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);
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:22,代碼來源:STextProposalProvider.java

示例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();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:17,代碼來源:ReferencedObjectEffectDependency.java

示例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);
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:18,代碼來源:PlanElementRowHeaderEditPart.java

示例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();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:17,代碼來源:GroupingTimelineContentProvider.java

示例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;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:22,代碼來源:ProfileReferenceViolation.java

示例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;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:25,代碼來源:DetailFormToolkit.java

示例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);
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:20,代碼來源:EMFDetailFormPart.java


注:本文中的org.eclipse.emf.edit.provider.IItemLabelProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。