Class TerminalView

  • All Implemented Interfaces:
    IActivationListener, IWorkbenchPartIZ, ITerminalStateListener, 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 class TerminalView
    extends org.eclipse.ui.part.ViewPart
    implements ITerminalStateListener, IActivationListener, IWorkbenchPartIZ
    The Terminal View Part shows one terminal session.
    Author:
    Christopher Mindus
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringID
      The Terminal Sessions View Part ID "com.iizigo.term.TerminalView".
      • Fields inherited from interface org.eclipse.ui.IWorkbenchPart

        PROP_TITLE
    • Constructor Summary

      Constructors 
      ConstructorDescription
      TerminalView()
      Eclipse constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidcreateOrShow​(org.eclipse.swt.widgets.Shell shell, EditorTerminalProps props)
      Creates a TerminalView for properties, or shows an existing one.
      voidcreatePartControl​(org.eclipse.swt.widgets.Composite parent)
      Create contents of the view part.
      voiddispose()
      Disposes of the view part.
      IPartExtensionIZgetExtension()
      Gets the extensions framework.
      SelectionEnablergetSelectionEnabler()
      Gets the selection enabler instance.
      IPropUndoRedogetUndoRedo()
      Gets the undo context.
      booleanhasHostSession()
      Checks if a host session is created.
      voidinit​(org.eclipse.ui.IViewSite site)
      Initializes this view with the given view site.
      voidinit​(org.eclipse.ui.IViewSite site, org.eclipse.ui.IMemento memento)
      Initializes this view with the given view site.
      booleanisDisposed()
      Checks if the part is disposed of.
      voidonActivated​(boolean on)
      Called when activator or deactivated.
      voidonClose()
      Called when about to close, but SWT is still there.
      voidonTerminalFieldChanged​(HostSession hostSession, TerminalWindow tw)
      Called when the screen needs updates due to field change.
      voidonTerminalStateUpdate​(HostSession hostSession, TerminalWindow tw)
      Called when state probably needs update or check.
      voidsaveState​(org.eclipse.ui.IMemento memento)
      Saves the object state within a memento.
      voidsetFocus()
      Sets focus to the terminal.
      voidupdateStates()
      Called when states needs to be updated.
      • Methods inherited from class org.eclipse.ui.part.ViewPart

        checkSite, getViewSite, 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

      • ID

        public static final java.lang.String ID
        The Terminal Sessions View Part ID "com.iizigo.term.TerminalView".
    • Constructor Detail

      • TerminalView

        public TerminalView()
        Eclipse constructor.
    • Method Detail

      • createOrShow

        public static void createOrShow​(org.eclipse.swt.widgets.Shell shell,
                                        EditorTerminalProps props)
        Creates a TerminalView for properties, or shows an existing one.
        Parameters:
        shell - The shell.
        props - The terminal properties.
      • hasHostSession

        public boolean hasHostSession()
        Checks if a host session is created.
        Returns:
        true if there is a session created, false otherwise.
      • init

        public void init​(org.eclipse.ui.IViewSite site)
                  throws org.eclipse.ui.PartInitException
        Initializes this view with the given view site.

        This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's life cycle. Clients must not call this method.

        Specified by:
        init in interface org.eclipse.ui.IViewPart
        Overrides:
        init in class org.eclipse.ui.part.ViewPart
        Parameters:
        site - The view site.
        Throws:
        org.eclipse.ui.PartInitException - if this view was not initialized successfully.
      • init

        public void init​(org.eclipse.ui.IViewSite site,
                         org.eclipse.ui.IMemento memento)
                  throws org.eclipse.ui.PartInitException
        Initializes this view with the given view site. A memento is passed to the view which contains a snapshot of the views state from a previous session. Where possible, the view should try to recreate that state within the part controls.

        This method is automatically called by the workbench shortly after the part is instantiated. It marks the start of the views's life cycle. Clients must not call this method.

        Specified by:
        init in interface org.eclipse.ui.IViewPart
        Overrides:
        init in class org.eclipse.ui.part.ViewPart
        Parameters:
        site - The view site
        memento - The IViewPart state or null if there is no previous saved state.
        Throws:
        org.eclipse.ui.PartInitException - if this view was not initialized successfully.
      • saveState

        public void saveState​(org.eclipse.ui.IMemento memento)
        Saves the object state within a 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
        Parameters:
        memento - A memento to receive the object state.
      • createPartControl

        public void createPartControl​(org.eclipse.swt.widgets.Composite parent)
        Create contents of the view part.
        Specified by:
        createPartControl in interface org.eclipse.ui.IWorkbenchPart
        Specified by:
        createPartControl in class org.eclipse.ui.part.WorkbenchPart
        Parameters:
        parent - The parent composite.
      • dispose

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

        public void setFocus()
        Sets focus to the terminal.
        Specified by:
        setFocus in interface org.eclipse.ui.IWorkbenchPart
        Specified by:
        setFocus in class org.eclipse.ui.part.WorkbenchPart
      • onTerminalStateUpdate

        public void onTerminalStateUpdate​(HostSession hostSession,
                                          TerminalWindow tw)
        Called when state probably needs update or check.
        Specified by:
        onTerminalStateUpdate in interface ITerminalStateListener
        Parameters:
        hostSession - The host session, may be null.
        tw - The TerminalWindow, may be null when hostSession is null, not otherwise.
      • onTerminalFieldChanged

        public void onTerminalFieldChanged​(HostSession hostSession,
                                           TerminalWindow tw)
        Called when the screen needs updates due to field change.
        Specified by:
        onTerminalFieldChanged in interface ITerminalStateListener
        Parameters:
        hostSession - The host session, may be null.
        tw - The TerminalWindow, may be null when hostSession is null, not otherwise.
      • onClose

        public void onClose()
        Called when about to close, but SWT is still there.
        Specified by:
        onClose in interface IActivationListener