Class ElementChangeListenerContribution

    • Constructor Detail

      • ElementChangeListenerContribution

        public ElementChangeListenerContribution()
    • Method Detail

      • init

        public void init​(ICommonOutlinePage outlinePage)
        Initializes this contribution. This method is called after the outline page's tree viewer has been created.

        This method may be extended by subclasses. Subclasses must call the superclass implementation.

        ElementChangeListenerContribution extends this method to register an element change listener that invokes elementChanged(IElementChangeEvent) if the element change event affects the outline's input element.

        Specified by:
        init in interface IOutlineContribution
        Overrides:
        init in class OutlineContribution
        Parameters:
        outlinePage - the contribution's outline page (never null)
      • dispose

        public void dispose()
        Description copied from class: OutlineContribution
        Disposes of this contribution. Implementors should clean up any resources associated with this contribution. Note that there is no guarantee that init() has been called. This method has no effect if this contribution has already been disposed.

        This method may be extended by subclasses. Subclasses must call the superclass implementation.

        Specified by:
        dispose in interface IOutlineContribution
        Overrides:
        dispose in class OutlineContribution
      • affects

        protected boolean affects​(IElementChangeEvent event,
                                  java.lang.Object inputElement)
        Returns whether the given element change event affects the outline's input element.

        This implementation uses the content adapter to adapt the input element to an IElement. It then delegates to affects(IElementDelta, IElement).

        Parameters:
        event - never null
        inputElement - may be null
        Returns:
        true if the given element change event affects the outline's input element, and false otherwise
      • affects

        protected boolean affects​(IElementDelta delta,
                                  IElement element)
        Returns whether the given element delta affects the given element.

        This implementation checks whether the given element delta tree contains a delta that designates a structural change to the given element.

        Parameters:
        delta - never null
        element - never null
        Returns:
        true if the given delta affects the given element, and false otherwise
      • addElementChangeListener

        protected abstract void addElementChangeListener​(IElementChangeListener listener)
        Registers the given element change listener with the underlying model.
        Parameters:
        listener - never null
      • removeElementChangeListener

        protected abstract void removeElementChangeListener​(IElementChangeListener listener)
        Removes the given element change listener from the underlying model.
        Parameters:
        listener - never null
      • elementChanged

        protected abstract void elementChanged​(IElementChangeEvent event)
        Notifies that the outline page is affected in some way by the given element change event.

        Note: This method may be called in any thread. The event object (and the deltas within it) is valid only for the duration of the invocation of this method.

        Parameters:
        event - never null