Class LinkData

java.lang.Object
com.iizigo.link.LinkData

public class LinkData extends Object
Data for the link operation, i.e. the target and the sources of the operation.
Author:
Christopher Mindus
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinkData(org.eclipse.core.runtime.IAdaptable target, GProp<?>[] props)
    Creates the link data information.
    LinkData(org.eclipse.core.runtime.IAdaptable target, List<org.eclipse.core.runtime.IAdaptable> sources)
    Creates the link data information.
    LinkData(org.eclipse.core.runtime.IAdaptable target, org.eclipse.jface.viewers.IStructuredSelection selection)
    Creates the link data information.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    adapt(org.eclipse.core.runtime.IAdaptable adaptable, Class<T> adaptToClass)
    Adapts an object if possible to the class.
    Gets or creates an adapter for an object.
    void
    assignProcessed(ILinkCapable linkCapable, Collection<org.eclipse.core.runtime.IAdaptable> sources)
    Assigns the set of sources that are processed by the link-capable processor.
    void
    assignProcessed(ILinkCapable linkCapable, org.eclipse.core.runtime.IAdaptable source)
    Assigns the set of sources that are processed by the link-capable processor.
    void
    assignProcessed(ILinkCapable linkCapable, org.eclipse.core.runtime.IAdaptable... sources)
    Assigns the set of sources that are processed by the link-capable processor.
    org.eclipse.core.runtime.IStatus
    Checks if the operation could link.
    doLink(boolean doPerform, org.eclipse.swt.widgets.Shell shell, boolean doDisplayDialog)
    Attempt to perform the link.
    Returns the list of possible ILinkCapable sources.
    static List<UIComp>
    getLinkTargets(UIPanelBase panel, List<ILinkCapable> linkCapableList)
    Finds the list of UI components that this link capable component can be linked to in a panel.
    Returns the source properties.
    List<org.eclipse.core.runtime.IAdaptable>
    Returns the source.
    <T> ArrayList<T>
    getSources(Class<T> adaptedClass)
    Returns the source adapted to the requested class.
    org.eclipse.core.runtime.IAdaptable
    Gets the target adaptable.
    Gets the target property.
    static boolean
    isLinkable(org.eclipse.jface.viewers.ISelection sel)
    Checks if a selection is linkable.
    static boolean
    Gets or creates an adapter for an object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LinkData

      public LinkData(org.eclipse.core.runtime.IAdaptable target, GProp<?>[] props)
      Creates the link data information.
      Parameters:
      target - The target adaptable.
      props - The properties.
    • LinkData

      public LinkData(org.eclipse.core.runtime.IAdaptable target, org.eclipse.jface.viewers.IStructuredSelection selection)
      Creates the link data information.
      Parameters:
      target - The target adaptable.
      selection - The structured selection.
    • LinkData

      public LinkData(org.eclipse.core.runtime.IAdaptable target, List<org.eclipse.core.runtime.IAdaptable> sources)
      Creates the link data information.
      Parameters:
      target - The target adaptable.
      sources - The unmodifiable list of adaptable sources.
  • Method Details

    • getTarget

      public org.eclipse.core.runtime.IAdaptable getTarget()
      Gets the target adaptable.
      Returns:
      The target, never null.
    • getTargetProperty

      public GProp<?> getTargetProperty()
      Gets the target property.
      Returns:
      A cached target property, may be null.
    • getSources

      public List<org.eclipse.core.runtime.IAdaptable> getSources()
      Returns the source.
      Returns:
      The unmodifiable list of the properties. The list may be empty.
    • adapt

      public <T> T adapt(org.eclipse.core.runtime.IAdaptable adaptable, Class<T> adaptToClass)
      Adapts an object if possible to the class.
      Parameters:
      adaptable - The object.
      adaptToClass - The class to adapt to.
      Returns:
      The adapted instance, or null if it couldn't be adapted.
    • getSources

      public <T> ArrayList<T> getSources(Class<T> adaptedClass)
      Returns the source adapted to the requested class.
      Parameters:
      adaptedClass - The class to adapt to.
      Returns:
      A NEW list (that may be empty).
    • getSourceProperties

      public List<GProp<?>> getSourceProperties()
      Returns the source properties.
      Returns:
      The unmodifiable list of the properties. The list may be empty.
    • getLinkSources

      public List<ILinkCapable> getLinkSources()
      Returns the list of possible ILinkCapable sources.
      Returns:
      A cached unmodifiable list of the possible link capable sources.
    • assignProcessed

      public void assignProcessed(ILinkCapable linkCapable, org.eclipse.core.runtime.IAdaptable source)
      Assigns the set of sources that are processed by the link-capable processor. This makes it possible to verify that all sources are used once and not more, and that none are left out.

      This method can be called several times for the same link-capable processor, the list of sources will be increased.

      Parameters:
      linkCapable - The link-capable instance.
      source - The source processed.
    • assignProcessed

      public void assignProcessed(ILinkCapable linkCapable, org.eclipse.core.runtime.IAdaptable... sources)
      Assigns the set of sources that are processed by the link-capable processor. This makes it possible to verify that all sources are used once and not more, and that none are left out.

      This method can be called several times for the same link-capable processor, the list of sources will be increased.

      Parameters:
      linkCapable - The link-capable instance.
      sources - The sources processed.
    • assignProcessed

      public void assignProcessed(ILinkCapable linkCapable, Collection<org.eclipse.core.runtime.IAdaptable> sources)
      Assigns the set of sources that are processed by the link-capable processor. This makes it possible to verify that all sources are used once and not more, and that none are left out.

      This method can be called several times for the same link-capable processor, the list of sources will be increased.

      Parameters:
      linkCapable - The link-capable instance.
      sources - The sources processed.
    • canLink

      public org.eclipse.core.runtime.IStatus canLink()
      Checks if the operation could link.
      Returns:
      A status.
    • doLink

      public PasteFeedback doLink(boolean doPerform, org.eclipse.swt.widgets.Shell shell, boolean doDisplayDialog)
      Attempt to perform the link.
      Parameters:
      doPerform - The perform operation flag.
      shell - The shell is only needed when performing the operation.
      doDisplayDialog - Flag to always display dialog.
      Returns:
      The feedback.
    • adaptLinkCapable

      public static ILinkCapable adaptLinkCapable(Object o)
      Gets or creates an adapter for an object. Object types supported are: ILinkCapable, GProp, DesignerProp, IResource, IMethod, IAdaptable (IType).
      Parameters:
      o - The object.
      Returns:
      The link capable, or null if not link capable.
    • isLinkCapableAdaptable

      public static boolean isLinkCapableAdaptable(Object o)
      Gets or creates an adapter for an object. Object types supported are: ILinkCapable, GProp, DesignerProp, IResource, IMethod, IAdaptable (IType).
      Parameters:
      o - The object.
      Returns:
      true if it could potentially become an ILinkCapable object if adapted.
    • isLinkable

      public static boolean isLinkable(org.eclipse.jface.viewers.ISelection sel)
      Checks if a selection is linkable.
    • getLinkTargets

      public static List<UIComp> getLinkTargets(UIPanelBase panel, List<ILinkCapable> linkCapableList)
      Finds the list of UI components that this link capable component can be linked to in a panel.
      Parameters:
      panel - The target panel.