public boolean isBottomObject(Object object) {
   MappedObjectState mappedObjectState =
       (MappedObjectState) mappedObjectStateAdapterFactory.adapt(object, MappedObjectState.class);
   if (mappedObjectState != null)
     return !isTopToBottom() ? mappedObjectState.isInput() : mappedObjectState.isOutput();
   return false;
 }
 /**
  * Returns the image for the element
  *
  * @param editPart the edit part that displays the element
  * @return the image
  */
 public Image getImage(GraphicalEditPart editPart) {
   Element element = getUMLElement(editPart);
   String key = "";
   if (element instanceof NamedElement) {
     key = ((NamedElement) element).getName() + "::" + ((NamedElement) element).getVisibility();
   } else if (element != null) {
     key = element.getClass().getName();
   } else {
     return null;
   }
   ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
   Image image = imageRegistry.get(key);
   ImageDescriptor descriptor = null;
   if (image == null) {
     AdapterFactory factory = Activator.getDefault().getItemProvidersAdapterFactory();
     IItemLabelProvider labelProvider =
         (IItemLabelProvider) factory.adapt(getUMLElement(editPart), IItemLabelProvider.class);
     if (labelProvider != null) {
       descriptor =
           ExtendedImageRegistry.getInstance()
               .getImageDescriptor(labelProvider.getImage(getUMLElement(editPart)));
     }
     if (descriptor == null) {
       descriptor = ImageDescriptor.getMissingImageDescriptor();
     }
     imageRegistry.put(key, descriptor);
     image = imageRegistry.get(key);
   }
   return image;
 }
Example #3
0
 /**
  * Select the object <code>next</code> as a subnode of the <code>currentNode</code>.
  *
  * @param currentNode the currentNode
  * @param next the subnode to select
  * @return the selected node
  */
 private SWTBotTreeItem selectSubNode(SWTBotTreeItem currentNode, Object next) {
   final AdapterFactory adapterFactory = EEFRuntimePlugin.getDefault().getAdapterFactory();
   final IItemLabelProvider labelProvider =
       (IItemLabelProvider) adapterFactory.adapt(next, IItemLabelProvider.class);
   final String text = labelProvider.getText(next);
   final SWTBotTreeItem node2 = currentNode.getNode(text);
   node2.select();
   return node2;
 }
 private String getLabel(EObject eObject) {
   AdapterFactory adapterFactory = getAdapterFactory(eObject);
   if (adapterFactory == null) {
     return "";
   }
   IItemLabelProvider itemLabelProvider =
       (IItemLabelProvider) adapterFactory.adapt(eObject, IItemLabelProvider.class);
   return itemLabelProvider != null
       ? itemLabelProvider.getText(eObject)
       : eObject == null ? "" : eObject.toString();
 }
 /** @generated */
 public IPropertySource getPropertySource(Object object) {
   if (object instanceof IPropertySource) {
     return (IPropertySource) object;
   }
   AdapterFactory af = getAdapterFactory(object);
   if (af != null) {
     IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
     if (ips != null) {
       return new PropertySource(object, ips);
     }
   }
   if (object instanceof IAdaptable) {
     return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
   }
   return null;
 }
 private String toDisplayName(EObject eObject) {
   IItemLabelProvider labelAdapter =
       (IItemLabelProvider)
           EcoreUtil.getRegisteredAdapter(
               EcorePackage.eINSTANCE.getEAnnotation(), IItemLabelProvider.class);
   if (labelAdapter == null) {
     labelAdapter =
         (IItemLabelProvider) ecoreLabelProviderFactory.adapt(eObject, IItemLabelProvider.class);
   }
   String label = null;
   try {
     label = labelAdapter.getText(eObject);
   } catch (RuntimeException e) {
     // Ensure fault isolation of the item provider
     label = EcoreUtil.getIdentification(eObject);
   }
   return label;
 }
 /** @generated and Modified */
 public IPropertySource getPropertySource(Object object) {
   if (object instanceof IPropertySource) {
     return (IPropertySource) object;
   }
   AdapterFactory af = getAdapterFactory(object);
   if (af != null) {
     IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
     if (ips != null) {
       return new CustomizedPropertySource(
           object,
           ips); // Use the CustomizedPropertySource from net.sf.ictalive.psdeditor for editing
                 // PSD's as the properties
     }
   }
   if (object instanceof IAdaptable) {
     return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
   }
   return null;
 }
 /**
  * This uses the {@link #mappedObjectStateAdapterFactory} to get an adapter that implements this
  * interface.
  */
 public MappedObjectState getMappedObjectState(Object object) {
   return (MappedObjectState)
       mappedObjectStateAdapterFactory.adapt(object, MappedObjectState.class);
 }
 public boolean isOutputObject(Object object) {
   MappedObjectState mappedObjectState =
       (MappedObjectState) mappedObjectStateAdapterFactory.adapt(object, MappedObjectState.class);
   return mappedObjectState != null && mappedObjectState.isOutput();
 }