Class LinkData


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

      Constructors 
      ConstructorDescription
      LinkData​(org.eclipse.core.runtime.IAdaptable target, GProp<?>[] props)
      Creates the link data information.
      LinkData​(org.eclipse.core.runtime.IAdaptable target, java.util.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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      <T> Tadapt​(org.eclipse.core.runtime.IAdaptable adaptable, java.lang.Class<T> adaptToClass)
      Adapts an object if possible to the class.
      static ILinkCapableadaptLinkCapable​(java.lang.Object o)
      Gets or creates an adapter for an object.
      voidassignProcessed​(ILinkCapable linkCapable, java.util.Collection<org.eclipse.core.runtime.IAdaptable> sources)
      Assigns the set of sources that are processed by the link-capable processor.
      voidassignProcessed​(ILinkCapable linkCapable, org.eclipse.core.runtime.IAdaptable source)
      Assigns the set of sources that are processed by the link-capable processor.
      voidassignProcessed​(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.IStatuscanLink()
      Checks if the operation could link.
      PasteFeedbackdoLink​(boolean doPerform, org.eclipse.swt.widgets.Shell shell, boolean doDisplayDialog)
      Attempt to perform the link.
      java.util.List<ILinkCapable>getLinkSources()
      Returns the list of possible ILinkCapable sources.
      static java.util.List<UIComp>getLinkTargets​(UIPanelBase panel, java.util.List<ILinkCapable> linkCapableList)
      Finds the list of UI components that this link capable component can be linked to in a panel.
      java.util.List<GProp<?>>getSourceProperties()
      Returns the source properties.
      java.util.List<org.eclipse.core.runtime.IAdaptable>getSources()
      Returns the source.
      <T> java.util.ArrayList<T>getSources​(java.lang.Class<T> adaptedClass)
      Returns the source adapted to the requested class.
      org.eclipse.core.runtime.IAdaptablegetTarget()
      Gets the target adaptable.
      GProp<?>getTargetProperty()
      Gets the target property.
      static booleanisLinkable​(org.eclipse.jface.viewers.ISelection sel)
      Checks if a selection is linkable.
      static booleanisLinkCapableAdaptable​(java.lang.Object o)
      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 Detail

      • 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,
                        java.util.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 Detail

      • 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 java.util.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,
                           java.lang.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> java.util.ArrayList<T> getSources​(java.lang.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 java.util.List<GProp<?>> getSourceProperties()
        Returns the source properties.
        Returns:
        The unmodifiable list of the properties. The list may be empty.
      • getLinkSources

        public java.util.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,
                                    java.util.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​(java.lang.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​(java.lang.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 java.util.List<UIComp> getLinkTargets​(UIPanelBase panel,
                                                            java.util.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.