Class CallHierarchyViewPart

  • All Implemented Interfaces:
    org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IPersistable, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.IWorkbenchPart3, org.eclipse.ui.part.IWorkbenchPartOrientation

    public abstract class CallHierarchyViewPart
    extends org.eclipse.ui.part.ViewPart
    An abstract base implementation of a call hierarchy view.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  CallHierarchyViewPart.HistoryEntry
      Represents an entry of the call hierarchy view history list.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String GROUP_FOCUS
      Pop-up menu: name of group for focus actions (value "group.focus").
      • Fields inherited from interface org.eclipse.ui.IWorkbenchPart

        PROP_TITLE
    • Constructor Summary

      Constructors 
      Constructor Description
      CallHierarchyViewPart()
      Constructs a call hierarchy view that supports all of the call hierarchy kinds.
      CallHierarchyViewPart​(java.util.EnumSet<CallHierarchyKind> supportedHierarchyKinds)
      Constructs a call hierarchy view that supports the given call hierarchy kinds.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addHistoryDropDownAction​(org.eclipse.jface.action.IAction action)
      Contributes the 'show history list' action to this view.
      protected void addPinAction​(org.eclipse.jface.action.IAction action)
      Contributes the 'pin' action to this view.
      protected void addRefreshAction​(org.eclipse.jface.action.IAction action)
      Contributes the 'refresh' action to this view.
      protected void addSetHierarchyKindAction​(org.eclipse.jface.action.IAction action, CallHierarchyKind kind)
      Contributes a 'set hierarchy kind' action to this view.
      protected void addSetOrientationAction​(org.eclipse.jface.action.IAction action, int orientation)
      Contributes a 'set orientation' action to this view.
      boolean arePossibleInputElements​(java.lang.Object[] elements)
      Returns whether the given elements are possible input elements for this view.
      protected abstract java.lang.String computeContentDescription()
      Computes the content description for this view.
      protected void configureHierarchyViewer​(org.eclipse.jface.viewers.TreeViewer viewer)
      Configures the newly created hierarchy viewer.
      protected void configureLocationViewer​(org.eclipse.jface.viewers.TableViewer viewer)
      Configures the newly created location viewer.
      protected EditorOpener createEditorOpener()
      Creates and returns an editor opener for this view.
      protected abstract ICallHierarchyNode[] createHierarchyRoots​(java.lang.Object[] inputElements)
      Creates and returns the root nodes for a call hierarchy based on the given input elements and the current hierarchy kind.
      protected org.eclipse.jface.viewers.TreeViewer createHierarchyViewer​(org.eclipse.swt.widgets.Composite parent)
      Creates and returns a tree viewer control that will be used for displaying the call hierarchy.
      protected void createHierarchyViewerMenuGroups​(org.eclipse.jface.action.IMenuManager manager)
      Creates the menu groups for the hierarchy viewer's pop-up menu.
      protected HistoryDropDownAction<CallHierarchyViewPart.HistoryEntry> createHistoryDropDownAction​(HistoryDropDownAction.History<CallHierarchyViewPart.HistoryEntry> history)
      Creates and returns a 'show history list' action for this view.
      protected abstract CallHierarchyViewPart.HistoryEntry createHistoryEntry​(java.lang.Object[] inputElements)
      Creates and returns a history entry for the given input elements.
      protected void createLocationColumns​(org.eclipse.swt.widgets.Table table)
      Creates the table columns in the location viewer.
      protected org.eclipse.jface.viewers.TableViewer createLocationViewer​(org.eclipse.swt.widgets.Composite parent)
      Creates and returns a table viewer control that will be used for displaying the call locations.
      protected void createLocationViewerMenuGroups​(org.eclipse.jface.action.IMenuManager manager)
      Creates the menu groups for the location viewer's pop-up menu.
      protected org.eclipse.swt.widgets.Control createNoHierarchyPage​(org.eclipse.swt.widgets.Composite parent)
      Creates and returns a control for the 'no hierarchy' page.
      void createPartControl​(org.eclipse.swt.widgets.Composite parent)  
      protected org.eclipse.swt.custom.SashForm createSashForm​(org.eclipse.swt.widgets.Composite parent)
      Creates and returns a SashForm that will be used as the parent control for the hierarchy and location viewers.
      void dispose()  
      protected void doRefresh​(IContext context)
      Refreshes the content of this view according to options specified in the given context.
      protected void fillHierarchyViewerMenu​(org.eclipse.jface.action.IMenuManager manager)
      Fills the pop-menu for the hierarchy viewer using the menu groups created by createHierarchyViewerMenuGroups(IMenuManager).
      protected void fillLocationViewerMenu​(org.eclipse.jface.action.IMenuManager manager)
      Fills the pop-menu for the location viewer using the menu groups created by createLocationViewerMenuGroups(IMenuManager).
      protected EditorOpener getEditorOpener()
      Returns the editor opener used by this view.
      protected org.eclipse.jface.action.IAction getFocusOnSelectionAction()
      Returns the 'focus on selection' action used by this view.
      protected org.eclipse.jface.viewers.ViewerComparator getHierarchyComparator()
      Returns a comparator for the hierarchy viewer.
      CallHierarchyKind getHierarchyKind()
      Returns the current hierarchy kind for this view.
      protected ICallHierarchyNode[] getHierarchyRoots()
      Returns the root nodes for the current call hierarchy.
      protected org.eclipse.jface.viewers.TreeViewer getHierarchyViewer()
      Returns the hierarchy tree viewer.
      protected java.util.List<CallHierarchyViewPart.HistoryEntry> getHistory()
      Returns the history used by this view; the history is represented by a "live" list of history entries.
      java.lang.Object[] getInputElements()
      Returns the current input elements for this view.
      protected ColumnDescription[] getLocationColumnDescriptions()
      Returns the column descriptions for the call location table.
      protected org.eclipse.jface.viewers.TableViewer getLocationViewer()
      Returns the location table viewer.
      protected org.eclipse.jface.action.IAction getRefreshElementAction()
      Returns the 'refresh element' action used by this view.
      protected org.eclipse.jface.action.IAction getRemoveFromViewAction()
      Returns the 'remove from view' action used by this view.
      protected org.eclipse.swt.custom.SashForm getSashForm()
      Returns the parent SashForm for the hierarchy and location viewers.
      protected abstract CallHierarchyViewManager getViewManager()
      Returns a CallHierarchyViewManager for this view.
      protected void handleCannotRevealCallLocation​(org.eclipse.ui.IEditorPart editor, ICallLocation callLocation, IContext context)
      Handles the case when a call location cannot be revealed in the editor.
      protected void hierarchySelectionChanged​(org.eclipse.jface.viewers.ISelection selection)
      This method is called on each selection change in the hierarchy viewer.
      protected void historyUpdated()
      A callback that is invoked when the history has been updated.
      void init​(org.eclipse.ui.IViewSite site, org.eclipse.ui.IMemento memento)  
      boolean isPinned()
      Returns whether this view is pinned.
      protected abstract boolean isPossibleInputElement​(java.lang.Object element)
      Returns whether the given element is a possible input element for this view.
      protected void locationSelectionChanged​(org.eclipse.jface.viewers.ISelection selection)
      This method is called on each selection change in the location viewer.
      protected void notifyHistoryUpdated()
      Notifies that the history has been updated by this view.
      void refresh()
      Performs a full refresh of the content of this view.
      protected void refresh​(IContext context)
      Performs a refresh of the content of this view according to options specified in the given context.
      protected void revealCallLocation​(org.eclipse.ui.IEditorPart editor, ICallLocation callLocation, IContext context)
      Attempts to reveal the given call location in the given editor.
      protected void revealInEditor​(java.lang.Object element, boolean activate, boolean mayOpenNewEditor)
      Reveals the given element in an appropriate editor on a best effort basis.
      void saveState​(org.eclipse.ui.IMemento memento)  
      void setFocus()  
      void setHierarchyKind​(CallHierarchyKind kind)
      Sets the current hierarchy kind for this view.
      void setInputElements​(java.lang.Object[] elements)
      Sets the current input elements for this view.
      void setOrientation​(int orientation)
      Sets the orientation of this view, which may be one of the constants SWT.HORIZONTAL or SWT.VERTICAL; this method may also be called with SWT.HORIZONTAL|SWT.VERTICAL for automatic orientation.
      void setPinned​(boolean pinned)
      Marks this view as pinned.
      boolean supportsHierarchyKind​(CallHierarchyKind kind)
      Returns whether this view supports the given hierarchy kind.
      protected void updateStatusLine​(org.eclipse.jface.action.IStatusLineManager manager, org.eclipse.jface.viewers.IStructuredSelection selection)
      Updates the status line based on the given selection in this view.
      • Methods inherited from class org.eclipse.ui.part.ViewPart

        checkSite, getViewSite, init, setContentDescription, setInitializationData, setPartName
      • Methods inherited from class org.eclipse.ui.part.WorkbenchPart

        addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, getTitleToolTip, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
      • Methods inherited from class org.eclipse.core.commands.common.EventManager

        addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.eclipse.core.runtime.IAdaptable

        getAdapter
      • Methods inherited from interface org.eclipse.ui.IWorkbenchPart

        addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
    • Field Detail

      • GROUP_FOCUS

        protected static final java.lang.String GROUP_FOCUS
        Pop-up menu: name of group for focus actions (value "group.focus").
        See Also:
        Constant Field Values
    • Constructor Detail

      • CallHierarchyViewPart

        public CallHierarchyViewPart​(java.util.EnumSet<CallHierarchyKind> supportedHierarchyKinds)
        Constructs a call hierarchy view that supports the given call hierarchy kinds.
        Parameters:
        supportedHierarchyKinds - not null and not empty
    • Method Detail

      • arePossibleInputElements

        public final boolean arePossibleInputElements​(java.lang.Object[] elements)
        Returns whether the given elements are possible input elements for this view. This method invokes isPossibleInputElement(Object) for each of the given elements until false is returned for an element (in which case this method will return false) or all elements have been checked (in which case it will return true).
        Parameters:
        elements - may be null or may contain null elements, in which case false will be returned; may be empty, in which case true will be returned
        Returns:
        true if the given elements are possible input elements for this view, and false otherwise
      • isPossibleInputElement

        protected abstract boolean isPossibleInputElement​(java.lang.Object element)
        Returns whether the given element is a possible input element for this view.
        Parameters:
        element - may be null, in which case false will be returned
        Returns:
        true if the given element is a possible input element for this view, and false otherwise
        See Also:
        arePossibleInputElements(Object[])
      • setInputElements

        public void setInputElements​(java.lang.Object[] elements)
        Sets the current input elements for this view. Clients must not modify the given array afterwards.

        Default implementation invokes refresh() after the input elements have been set.

        Parameters:
        elements - not null, must not contain null elements; may be empty
        Throws:
        java.lang.IllegalArgumentException - if arePossibleInputElements(Object[]) returns false for the given elements
      • getInputElements

        public final java.lang.Object[] getInputElements()
        Returns the current input elements for this view.
        Returns:
        the current input elements (never null, may be empty). Clients must not modify the returned array.
      • getHierarchyKind

        public final CallHierarchyKind getHierarchyKind()
        Returns the current hierarchy kind for this view. If the hierarchy kind has not been explicitly set, returns the first of the supported hierarchy kinds.
        Returns:
        the current hierarchy kind (never null)
        See Also:
        setHierarchyKind(CallHierarchyKind)
      • setHierarchyKind

        public void setHierarchyKind​(CallHierarchyKind kind)
        Sets the current hierarchy kind for this view.

        Default implementation invokes refresh() if the view hierarchy kind has changed; it also adjusts the checked state of the 'set hierarchy kind' actions accordingly.

        Parameters:
        kind - not null
        Throws:
        java.lang.IllegalArgumentException - if the given kind is not supported by this view
      • supportsHierarchyKind

        public final boolean supportsHierarchyKind​(CallHierarchyKind kind)
        Returns whether this view supports the given hierarchy kind.
        Parameters:
        kind - may be null, in which case false will be returned
        Returns:
        true if this view supports the given kind, and false otherwise
      • setOrientation

        public void setOrientation​(int orientation)
        Sets the orientation of this view, which may be one of the constants SWT.HORIZONTAL or SWT.VERTICAL; this method may also be called with SWT.HORIZONTAL|SWT.VERTICAL for automatic orientation.
        Parameters:
        orientation - new orientation
        Throws:
        java.lang.IllegalArgumentException - if the value of orientation is invalid
      • setPinned

        public void setPinned​(boolean pinned)
        Marks this view as pinned.
        Parameters:
        pinned - whether the view is pinned
      • isPinned

        public final boolean isPinned()
        Returns whether this view is pinned.
        Returns:
        true if the view is pinned, and false otherwise
      • refresh

        public final void refresh()
        Performs a full refresh of the content of this view. This method invokes refresh(IContext) with an empty context.
      • refresh

        protected final void refresh​(IContext context)
        Performs a refresh of the content of this view according to options specified in the given context. This method does nothing if the SWT controls for this view have not been created or have been disposed. Otherwise, it invokes doRefresh(IContext).
        Parameters:
        context - the operation context (never null)
      • init

        public void init​(org.eclipse.ui.IViewSite site,
                         org.eclipse.ui.IMemento memento)
                  throws org.eclipse.ui.PartInitException
        Specified by:
        init in interface org.eclipse.ui.IViewPart
        Overrides:
        init in class org.eclipse.ui.part.ViewPart
        Throws:
        org.eclipse.ui.PartInitException
      • saveState

        public void saveState​(org.eclipse.ui.IMemento memento)
        Specified by:
        saveState in interface org.eclipse.ui.IPersistable
        Specified by:
        saveState in interface org.eclipse.ui.IViewPart
        Overrides:
        saveState in class org.eclipse.ui.part.ViewPart
      • createPartControl

        public void createPartControl​(org.eclipse.swt.widgets.Composite parent)
        Specified by:
        createPartControl in interface org.eclipse.ui.IWorkbenchPart
        Specified by:
        createPartControl in class org.eclipse.ui.part.WorkbenchPart
      • dispose

        public void dispose()
        Specified by:
        dispose in interface org.eclipse.ui.IWorkbenchPart
        Overrides:
        dispose in class org.eclipse.ui.part.WorkbenchPart
      • setFocus

        public void setFocus()
        Specified by:
        setFocus in interface org.eclipse.ui.IWorkbenchPart
        Specified by:
        setFocus in class org.eclipse.ui.part.WorkbenchPart
      • getHierarchyRoots

        protected ICallHierarchyNode[] getHierarchyRoots()
        Returns the root nodes for the current call hierarchy.

        Default implementation invokes createHierarchyRoots(Object[]) with the current input elements.

        Returns:
        the root nodes for the current call hierarchy (never null, may be empty)
      • createHierarchyRoots

        protected abstract ICallHierarchyNode[] createHierarchyRoots​(java.lang.Object[] inputElements)
        Creates and returns the root nodes for a call hierarchy based on the given input elements and the current hierarchy kind.
        Parameters:
        inputElements - never null, may be empty
        Returns:
        the created nodes (not null, may be empty)
      • getHierarchyComparator

        protected org.eclipse.jface.viewers.ViewerComparator getHierarchyComparator()
        Returns a comparator for the hierarchy viewer.

        Default implementation returns a LabelComparator if the current hierarchy kind is CallHierarchyKind.CALLER, and null otherwise.

        Returns:
        a ViewerComparator, or null for no sorting
      • computeContentDescription

        protected abstract java.lang.String computeContentDescription()
        Computes the content description for this view.
        Returns:
        the computed content description (not null)
        See Also:
        WorkbenchPart.getContentDescription()
      • updateStatusLine

        protected void updateStatusLine​(org.eclipse.jface.action.IStatusLineManager manager,
                                        org.eclipse.jface.viewers.IStructuredSelection selection)
        Updates the status line based on the given selection in this view.

        Default implementation clears the status line message if the selection is empty or if exactly one element is selected; sets a generic message of the form "(x) items selected" otherwise. It always clears the error message.

        Parameters:
        manager - the status line manager (never null)
        selection - the current selection (never null)
      • doRefresh

        protected void doRefresh​(IContext context)
        Refreshes the content of this view according to options specified in the given context. This method may only be called after the SWT controls for this view have been created and before they have been disposed.
        Parameters:
        context - the operation context (never null)
      • createNoHierarchyPage

        protected org.eclipse.swt.widgets.Control createNoHierarchyPage​(org.eclipse.swt.widgets.Composite parent)
        Creates and returns a control for the 'no hierarchy' page. This method is called once, when the part's control is created.

        Default implementation returns a Label telling, in general terms, that there is no call hierarchy to display. Subclasses may override this method (e.g., to give details on what the user needs to do to display a call hierarchy).

        Parameters:
        parent - the parent composite (never null)
        Returns:
        the created control (not null)
      • getSashForm

        protected final org.eclipse.swt.custom.SashForm getSashForm()
        Returns the parent SashForm for the hierarchy and location viewers.
        Returns:
        the SashForm, or null if it has yet to be created
        See Also:
        createSashForm(Composite)
      • createSashForm

        protected org.eclipse.swt.custom.SashForm createSashForm​(org.eclipse.swt.widgets.Composite parent)
        Creates and returns a SashForm that will be used as the parent control for the hierarchy and location viewers. This method only creates the control; it does not configure it. This method is called once, when the part's control is created.
        Parameters:
        parent - the parent composite (never null)
        Returns:
        the created control (not null)
      • getHierarchyViewer

        protected final org.eclipse.jface.viewers.TreeViewer getHierarchyViewer()
        Returns the hierarchy tree viewer.
        Returns:
        the hierarchy tree viewer, or null if it has yet to be created
        See Also:
        createHierarchyViewer(Composite)
      • createHierarchyViewer

        protected org.eclipse.jface.viewers.TreeViewer createHierarchyViewer​(org.eclipse.swt.widgets.Composite parent)
        Creates and returns a tree viewer control that will be used for displaying the call hierarchy. This method only creates the control; it does not configure it. This method is called once, when the part's control is created.
        Parameters:
        parent - the parent composite (never null)
        Returns:
        the created control (not null)
        See Also:
        configureHierarchyViewer(TreeViewer)
      • configureHierarchyViewer

        protected void configureHierarchyViewer​(org.eclipse.jface.viewers.TreeViewer viewer)
        Configures the newly created hierarchy viewer. This method has to set as least a content provider and a label provider. This method is called once, just after the viewer is created.

        Default implementation sets a CallHierarchyContentProvider as the content provider, and a CallHierarchyLabelProvider backed by a WorkbenchLabelProvider as the label provider. Subclasses usually need to extend this method and replace the default label provider; they may also override this method completely, but there is usually no need to.

        Parameters:
        viewer - the viewer to configure (never null)
      • createHierarchyViewerMenuGroups

        protected void createHierarchyViewerMenuGroups​(org.eclipse.jface.action.IMenuManager manager)
        Creates the menu groups for the hierarchy viewer's pop-up menu. This method is called each time the pop-up menu is about to show, just before fillHierarchyViewerMenu(IMenuManager) is called.

        Default implementation adds groups named GROUP_FOCUS and IWorkbenchActionConstants.MB_ADDITIONS. Subclasses may extend or override this method, but should usually keep the default groups.

        Parameters:
        manager - the menu manager (never null)
      • fillHierarchyViewerMenu

        protected void fillHierarchyViewerMenu​(org.eclipse.jface.action.IMenuManager manager)
        Fills the pop-menu for the hierarchy viewer using the menu groups created by createHierarchyViewerMenuGroups(IMenuManager). This method is called each time the pop-up menu is about to show.

        Default implementation adds generic actions such as 'focus on selection', 'refresh element', and 'remove from view'. Subclasses may extend or override this method.

        Parameters:
        manager - the menu manager (never null)
      • hierarchySelectionChanged

        protected void hierarchySelectionChanged​(org.eclipse.jface.viewers.ISelection selection)
        This method is called on each selection change in the hierarchy viewer.

        Default implementation changes the input of the location viewer accordingly and tries to reveal the selected hierarchy node in an open editor with revealInEditor. Subclasses may extend or even override this method, but there is usually no need to.

        Parameters:
        selection - the new selection (never null)
      • getLocationViewer

        protected final org.eclipse.jface.viewers.TableViewer getLocationViewer()
        Returns the location table viewer.
        Returns:
        the location table viewer, or null if it has yet to be created
        See Also:
        createLocationViewer(Composite)
      • createLocationViewer

        protected org.eclipse.jface.viewers.TableViewer createLocationViewer​(org.eclipse.swt.widgets.Composite parent)
        Creates and returns a table viewer control that will be used for displaying the call locations. This method only creates the control; it does not configure it. This method is called once, when the part's control is created.
        Parameters:
        parent - the parent composite (never null)
        Returns:
        the created control (not null)
        See Also:
        configureLocationViewer(TableViewer)
      • configureLocationViewer

        protected void configureLocationViewer​(org.eclipse.jface.viewers.TableViewer viewer)
        Configures the newly created location viewer. This method has to set as least a content provider and a label provider. This method is called once, just after the viewer is created.

        Default implementation sets an ArrayContentProvider as the content provider, and a LocationTableLabelProvider as the label provider. Also, it invokes createLocationColumns(Table). Subclasses may extend or even override this method, but there is usually no need to.

        Parameters:
        viewer - the viewer to configure (never null)
      • createLocationColumns

        protected void createLocationColumns​(org.eclipse.swt.widgets.Table table)
        Creates the table columns in the location viewer.

        Default implementation creates the columns based on descriptions returned by getLocationColumnDescriptions(). Subclasses may override this method, but there is usually no need to.

        Parameters:
        table - the table to create columns in (never null)
      • getLocationColumnDescriptions

        protected ColumnDescription[] getLocationColumnDescriptions()
        Returns the column descriptions for the call location table.

        Default implementation returns descriptions for the 'icon' column, the 'line number' column, and the 'call info' column. Subclasses may override this method, but there is usually no need to.

        Returns:
        the column descriptions (not null)
      • createLocationViewerMenuGroups

        protected void createLocationViewerMenuGroups​(org.eclipse.jface.action.IMenuManager manager)
        Creates the menu groups for the location viewer's pop-up menu. This method is called each time the pop-up menu is about to show, just before fillLocationViewerMenu(IMenuManager) is called.

        Default implementation adds a group named IWorkbenchActionConstants.MB_ADDITIONS. Subclasses may extend or override this method.

        Parameters:
        manager - the menu manager (never null)
      • fillLocationViewerMenu

        protected void fillLocationViewerMenu​(org.eclipse.jface.action.IMenuManager manager)
        Fills the pop-menu for the location viewer using the menu groups created by createLocationViewerMenuGroups(IMenuManager). This method is called each time the pop-up menu is about to show.

        Default implementation does nothing. Subclasses may extend or override this method.

        Parameters:
        manager - the menu manager (never null)
      • locationSelectionChanged

        protected void locationSelectionChanged​(org.eclipse.jface.viewers.ISelection selection)
        This method is called on each selection change in the location viewer.

        Default implementation tries to reveal the selected call location in an open editor with revealInEditor. Subclasses may extend or even override this method, but there is usually no need to.

        Parameters:
        selection - the new selection (never null)
      • revealInEditor

        protected void revealInEditor​(java.lang.Object element,
                                      boolean activate,
                                      boolean mayOpenNewEditor)
                               throws org.eclipse.ui.PartInitException
        Reveals the given element in an appropriate editor on a best effort basis.

        Default implementation uses the editor opener and specifically supports revealing an ICallLocation and an ICallHierarchyNode (other elements are handled generically). To reveal a call location in an open editor, it invokes revealCallLocation.

        Parameters:
        element - not null
        activate - whether to activate the editor
        mayOpenNewEditor - whether a new editor may be opened when the element cannot be revealed in an existing editor
        Throws:
        org.eclipse.ui.PartInitException - if a new editor could not be created or initialized
      • revealCallLocation

        protected void revealCallLocation​(org.eclipse.ui.IEditorPart editor,
                                          ICallLocation callLocation,
                                          IContext context)
        Attempts to reveal the given call location in the given editor.

        Default implementation uses the editor utility of the editor opener for revealing the call range in the given editor and invokes handleCannotRevealCallLocation if the call location cannot be revealed for whatever reason.

        Parameters:
        editor - never null
        callLocation - never null
        context - never null
      • handleCannotRevealCallLocation

        protected void handleCannotRevealCallLocation​(org.eclipse.ui.IEditorPart editor,
                                                      ICallLocation callLocation,
                                                      IContext context)
        Handles the case when a call location cannot be revealed in the editor.

        Default implementation displays a generic error message on the status line and attempts to reveal the caller element in the given editor.

        Parameters:
        editor - never null
        callLocation - never null
        context - never null
      • getEditorOpener

        protected final EditorOpener getEditorOpener()
        Returns the editor opener used by this view.
        Returns:
        the editor opener, or null if it has yet to be created
        See Also:
        createEditorOpener()
      • createEditorOpener

        protected EditorOpener createEditorOpener()
        Creates and returns an editor opener for this view. This method is called once, when the part's control is created.

        Subclasses may override this method if they require a specific editor opener.

        Returns:
        the created editor opener (not null)
      • getFocusOnSelectionAction

        protected final org.eclipse.jface.action.IAction getFocusOnSelectionAction()
        Returns the 'focus on selection' action used by this view.
        Returns:
        the 'focus on selection' action
      • getRefreshElementAction

        protected final org.eclipse.jface.action.IAction getRefreshElementAction()
        Returns the 'refresh element' action used by this view.
        Returns:
        the 'refresh element' action
      • getRemoveFromViewAction

        protected final org.eclipse.jface.action.IAction getRemoveFromViewAction()
        Returns the 'remove from view' action used by this view.
        Returns:
        the 'remove from view' action
      • addRefreshAction

        protected void addRefreshAction​(org.eclipse.jface.action.IAction action)
        Contributes the 'refresh' action to this view. This method is called once, when the part's control is created.

        Default implementation adds the given action to the view tool bar. Subclasses may extend or override this method.

        Parameters:
        action - the 'refresh' action (never null)
      • addSetHierarchyKindAction

        protected void addSetHierarchyKindAction​(org.eclipse.jface.action.IAction action,
                                                 CallHierarchyKind kind)
        Contributes a 'set hierarchy kind' action to this view. This method is called once for each of the 'set hierarchy kind' actions, when the part's control is created. If this view supports only one hierarchy kind, no 'set hierarchy kind' action is created and this method is not called.

        Default implementation adds the given action to the view tool bar as well as to the view menu. Subclasses may extend or override this method.

        Parameters:
        action - a 'set hierarchy kind' action (never null)
        kind - the hierarchy kind set by the given action (never null)
      • addSetOrientationAction

        protected void addSetOrientationAction​(org.eclipse.jface.action.IAction action,
                                               int orientation)
        Contributes a 'set orientation' action to this view. This method is called once for each of the 'set orientation' actions, when the part's control is created.

        Default implementation adds the given action to the 'Layout' sub-menu of the view menu. The sub-menu is created if necessary. Subclasses may extend or override this method.

        Parameters:
        action - a 'set orientation' action (never null)
        orientation - the orientation set by the given action
      • addHistoryDropDownAction

        protected void addHistoryDropDownAction​(org.eclipse.jface.action.IAction action)
        Contributes the 'show history list' action to this view. This method is called once, when the part's control is created.

        Default implementation adds the given action to the view tool bar. Subclasses may extend or override this method.

        Parameters:
        action - the 'show history list' action (never null)
      • addPinAction

        protected void addPinAction​(org.eclipse.jface.action.IAction action)
        Contributes the 'pin' action to this view. This method is called once, when the part's control is created.

        Default implementation adds the given action to the view tool bar. Subclasses may extend or override this method.

        Parameters:
        action - the 'pin' action (never null)
      • getHistory

        protected java.util.List<CallHierarchyViewPart.HistoryEntry> getHistory()
        Returns the history used by this view; the history is represented by a "live" list of history entries.

        Default implementation returns a history that is shared between all views managed by the same view manager.

        Returns:
        the view history (never null)
      • createHistoryEntry

        protected abstract CallHierarchyViewPart.HistoryEntry createHistoryEntry​(java.lang.Object[] inputElements)
        Creates and returns a history entry for the given input elements.
        Parameters:
        inputElements - never null; never empty
        Returns:
        the created history entry (not null)
      • notifyHistoryUpdated

        protected void notifyHistoryUpdated()
        Notifies that the history has been updated by this view.

        Default implementation calls historyUpdated() for each view managed by the same view manager.

        See Also:
        getHistory()
      • historyUpdated

        protected void historyUpdated()
        A callback that is invoked when the history has been updated.

        Default implementation sets the enabled state of the 'show history list' action according to whether the history is empty and, if the history is empty, clears the view input.

        See Also:
        getHistory(), notifyHistoryUpdated()