Package com.iizigo.term
Class TerminalComposite
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
com.iizigo.term.TerminalComposite
- All Implemented Interfaces:
ITerminalListener
,HostSessionListener
,org.eclipse.swt.graphics.Drawable
public class TerminalComposite extends org.eclipse.swt.widgets.Composite implements ITerminalListener, HostSessionListener
The terminal composite.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionActions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.Actions.static final String
Memento variable, cursor position and insert mode: "terminalComposite.state".Fields inherited from class org.eclipse.swt.widgets.Control
handle
Constructor Summary
ConstructorDescriptionTerminalComposite
(org.eclipse.ui.IWorkbenchPart part, org.eclipse.swt.widgets.Composite parent) Constructor.Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ITerminalStateListener listener) Adds a listener.void
createActions
(IPartExtensionIZ extension) Creates the actions such as Copy/Paste/Select All, etc.static TerminalComposite
createComposite
(org.eclipse.swt.widgets.Composite parent, EditorTerminalProps props, int charPixelSizeX, int charPixelSizeY, boolean doConnect, boolean allowNonConnected, boolean doAntiAlias) Creates a composite for use with tooltips or previews.createTerminalAndWindow
(EditorActiveTerminalSession session, HostSessionProps hostSessionProps) Creates the Terminal and Terminal Window instance for a remote terminal session.createTerminalAndWindow
(HostSession _hostSession, EditorTerminalProps _properties, IScreenDesigner designer) Creates the Terminal and Terminal Window instance for local terminal use in the Designer.Object[]
Gets the contribution menu items as an Object [] where null is menu separator, the rest are IAction instances.org.eclipse.swt.widgets.Canvas
Gets the Canvas used for the terminal, used e.g.Gets the host session.Gets the terminal.boolean
Check for Capture enabled.boolean
Check for Clear enabled.boolean
Check for Capture enabled.boolean
Check for Connect enabled.boolean
Check for Cut enabled.boolean
Check for Cut enabled.boolean
Check for Disconnect enabled.boolean
Checks if new screen is enabled.boolean
Check for Cut enabled.boolean
Check for Print enabled.boolean
Check for Resume enabled.boolean
Check for Select All enabled.boolean
Check for Suspend enabled.boolean
onActivateMenu
(boolean isPopup) Handles display of the pop-up window or activation of the menu bar, called from the TerminalWindow.void
onConnectChange
(HostSessionPeer peer, boolean connected) Notifies the session of a connect state change.void
onCursorPositionChange
(HostSessionPeer peer, int x, int y) Notifies the session that the cursor position has changed.void
onFieldChange
(HostSessionPeer peer) Notifies the session that fields have changed.void
onHostDataStreamProcessing
(HostSessionPeer peer, boolean isEntering, int updates) Repaint listener.void
Called from the Status Bar to toggle Insert mode.void
Called from the Status Bar to Reset the host.void
Called when the mark changes, called from the TerminalWindow.boolean
onPopup
(int x, int y) Handles display of the pop-up window.void
onRemoteState
(int state) Updates the states in a discrete way for the remote terminal.void
onScreenChange
(HostSessionPeer peer, int beginPos, int endPos) Notifies the session of a screen change.void
onScreenSizeChange
(HostSessionPeer peer, int cx, int cy) Notifies the session that the screen size has changed.void
onSessionFailure
(HostSessionPeer peer, Throwable exception) Called when a session has had a failure.void
onStateChange
(HostSessionPeer peer) Notifies the session of a state change (such as insert mode, lock state, error state).void
Capture action.void
Performs Clear.void
Config action.void
Connect action.void
Performs Copy.void
Performs Cut.void
Disconnect action.void
Performs new screen.void
Performs Paste.void
Performs Terminal Preferences.void
Performs Print.void
Resume action.void
Performs Select All.void
Suspend action.void
removeListener
(ITerminalStateListener listener) Removes a listener.void
resizePreview
(int charPixelSizeX, int charPixelSizeY) Resizes a terminal composite for preview.void
restoreState
(org.eclipse.ui.IMemento memento) Restores the terminal composite state: the cursor position and insert mode.void
saveState
(org.eclipse.ui.IMemento memento) Saves the state: the cursor position and insert mode.void
setException
(Throwable exception) Sets an Exception in the status bar.boolean
setFocus()
Sets focus to the table.void
soundAlarm
(HostSessionPeer peer) Sound alarm on the client.void
switchSession
(HostSession _hostSession, EditorTerminalProps _properties) Switches session.void
Triggers updates of the states of the actions.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
Field Details
MEMENTO_STATE
Memento variable, cursor position and insert mode: "terminalComposite.state".- See Also:
actionNewScreen
Actions.actionTermCapture
Actions.actionCut
Actions.actionCopy
Actions.actionPaste
Actions.actionSelectAll
Actions.actionTermClear
Actions.actionPrint
Actions.actionTermConnect
Actions.actionTermSuspend
Actions.actionTermResume
Actions.actionTermDisconnect
Actions.actionTermConfig
Actions.actionTermPref
Actions.
Constructor Details
TerminalComposite
public TerminalComposite(org.eclipse.ui.IWorkbenchPart part, org.eclipse.swt.widgets.Composite parent) Constructor.
Method Details
createComposite
public static TerminalComposite createComposite(org.eclipse.swt.widgets.Composite parent, EditorTerminalProps props, int charPixelSizeX, int charPixelSizeY, boolean doConnect, boolean allowNonConnected, boolean doAntiAlias) throws IOException Creates a composite for use with tooltips or previews.- Throws:
IOException
resizePreview
public void resizePreview(int charPixelSizeX, int charPixelSizeY) Resizes a terminal composite for preview.createActions
Creates the actions such as Copy/Paste/Select All, etc.- Parameters:
extension
- The IIZI part.
getActions
Gets the contribution menu items as an Object [] where null is menu separator, the rest are IAction instances.getCanvas
public org.eclipse.swt.widgets.Canvas getCanvas()Gets the Canvas used for the terminal, used e.g. for context menus.getTerminal
Gets the terminal.- Returns:
- The terminal instance or null if not yet created.
getHostSession
Gets the host session.- Returns:
- The host session or null for none.
addListener
Adds a listener.removeListener
Removes a listener.createTerminalAndWindow
public Terminal createTerminalAndWindow(HostSession _hostSession, EditorTerminalProps _properties, IScreenDesigner designer) Creates the Terminal and Terminal Window instance for local terminal use in the Designer.createTerminalAndWindow
public Terminal createTerminalAndWindow(EditorActiveTerminalSession session, HostSessionProps hostSessionProps) Creates the Terminal and Terminal Window instance for a remote terminal session.switchSession
Switches session.setFocus
public boolean setFocus()Sets focus to the table.- Overrides:
setFocus
in classorg.eclipse.swt.widgets.Composite
triggerUpdateStates
public void triggerUpdateStates()Triggers updates of the states of the actions.onRemoteState
public void onRemoteState(int state) Updates the states in a discrete way for the remote terminal.isCutEnabled
public boolean isCutEnabled()Check for Cut enabled.isCopyEnabled
public boolean isCopyEnabled()Check for Cut enabled.isPasteEnabled
public boolean isPasteEnabled()Check for Cut enabled.isClearEnabled
public boolean isClearEnabled()Check for Clear enabled.isSelectAllEnabled
public boolean isSelectAllEnabled()Check for Select All enabled.isPrintEnabled
public boolean isPrintEnabled()Check for Print enabled.isConnectEnabled
public boolean isConnectEnabled()Check for Connect enabled.isSuspendEnabled
public boolean isSuspendEnabled()Check for Suspend enabled.isResumeEnabled
public boolean isResumeEnabled()Check for Resume enabled.isDisconnectEnabled
public boolean isDisconnectEnabled()Check for Disconnect enabled.isCaptureEnabled
public boolean isCaptureEnabled()Check for Capture enabled.isNewScreenEnabled
public boolean isNewScreenEnabled()Checks if new screen is enabled.isConfigEnabled
public boolean isConfigEnabled()Check for Capture enabled.performCut
public void performCut()Performs Cut.performCopy
public void performCopy()Performs Copy.performPaste
public void performPaste()Performs Paste.performClear
public void performClear()Performs Clear.performSelectAll
public void performSelectAll()Performs Select All.performPrint
public void performPrint()Performs Print.performConnect
public void performConnect()Connect action.performSuspend
public void performSuspend()Suspend action.performResume
public void performResume()Resume action.performDisconnect
public void performDisconnect()Disconnect action.performCapture
public void performCapture()Capture action.performNewScreen
public void performNewScreen()Performs new screen.performConfig
public void performConfig()Config action.performPref
public void performPref()Performs Terminal Preferences.onScreenChange
Notifies the session of a screen change.- Specified by:
onScreenChange
in interfaceHostSessionListener
onFieldChange
Notifies the session that fields have changed.- Specified by:
onFieldChange
in interfaceHostSessionListener
onScreenSizeChange
Notifies the session that the screen size has changed.- Specified by:
onScreenSizeChange
in interfaceHostSessionListener
onCursorPositionChange
Notifies the session that the cursor position has changed.- Specified by:
onCursorPositionChange
in interfaceHostSessionListener
onConnectChange
Notifies the session of a connect state change.- Specified by:
onConnectChange
in interfaceHostSessionListener
onStateChange
Notifies the session of a state change (such as insert mode, lock state, error state).- Specified by:
onStateChange
in interfaceHostSessionListener
onHostDataStreamProcessing
Repaint listener.- Specified by:
onHostDataStreamProcessing
in interfaceHostSessionListener
- Parameters:
peer
- The peer.isEntering
- The state of processing (true=before, false=after).updates
- What has been updated on screen (bit flag: 0x01=characters, 0x02=fields).
onSessionFailure
Called when a session has had a failure.- Specified by:
onSessionFailure
in interfaceHostSessionListener
soundAlarm
Sound alarm on the client.- Specified by:
soundAlarm
in interfaceHostSessionListener
onPopup
public boolean onPopup(int x, int y) Handles display of the pop-up window.- Specified by:
onPopup
in interfaceITerminalListener
- Parameters:
x
- The mouse position in X relative the terminal container.y
- The mouse position in Y relative the terminal container.- Returns:
- true if handled (i.e. menu is displayed).
onActivateMenu
public boolean onActivateMenu(boolean isPopup) Handles display of the pop-up window or activation of the menu bar, called from the TerminalWindow.- Specified by:
onActivateMenu
in interfaceITerminalListener
- Parameters:
isPopup
- Flag indicating it's a pop-up that should be activated, as opposed to the menu bar.- Returns:
- true if handled (i.e. menu is displayed).
onMarkChange
public void onMarkChange()Called when the mark changes, called from the TerminalWindow.- Specified by:
onMarkChange
in interfaceITerminalListener
onKeyboardReset
public void onKeyboardReset()Called from the Status Bar to Reset the host.onInsertModeToggle
public void onInsertModeToggle()Called from the Status Bar to toggle Insert mode.setException
Sets an Exception in the status bar.saveState
public void saveState(org.eclipse.ui.IMemento memento) Saves the state: the cursor position and insert mode.restoreState
public void restoreState(org.eclipse.ui.IMemento memento) Restores the terminal composite state: the cursor position and insert mode.