/** * 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); }
@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 ); }
@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 ); } }
@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); }
@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); }
/** * 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); }
/** * 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; }
/** * 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; }
@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); }
@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(); }
@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); }
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(); }
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; }
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; }
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); }
@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()); }
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; }
@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; }
@Override public Image getImage(Object object) { // Get the adapters from the factory. // IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(object, IItemLabelProvider.class); IItemColorProvider itemColorProvider = (IItemColorProvider) adapterFactory.adapt(object, IItemColorProvider.class); Image image = itemLabelProvider != null ? getImageFromObject(itemLabelProvider.getImage(object)) : getDefaultImage(object); if (itemColorProvider != null) { RGB rgb = (RGB) itemColorProvider.getBackground(object); if (rgb != null) { return getImageOverlay(image, rgb); } } return image; }
@Override public boolean isFactoryForType(Object object) { if (object instanceof EActivityDictionary) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() instanceof EActivityDictionary; } if (object instanceof EObject && DictionaryPackage.Literals.OBJECT_DEF.isSuperTypeOf(((EObject)object).eClass())) { return true; } if (IItemLabelProvider.class == object) { return true; } return super.isFactoryForType(object); }
/** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SmarthomeItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
/** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MetamodelItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
/** * This constructs an instance. * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public DebugItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
/** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TracingannotationsItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
/** * This constructs an instance. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EventItemProviderAdapterFactory() { supportedTypes.add(IEditingDomainItemProvider.class); supportedTypes.add(IStructuredItemContentProvider.class); supportedTypes.add(ITreeItemContentProvider.class); supportedTypes.add(IItemLabelProvider.class); supportedTypes.add(IItemPropertySource.class); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }
/** * 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 ); }