Package com.iizigo.term.screen
Class ScreenEditor
- java.lang.Object
- org.eclipse.core.commands.common.EventManager
- org.eclipse.ui.part.WorkbenchPart
- org.eclipse.ui.part.EditorPart
- com.iizigo.editor.PropEditorPart
- com.iizigo.term.screen.ScreenEditor
- All Implemented Interfaces:
IActivationListener
,IDraggingFix
,IWorkbenchPartIZ
,IPropertyEditorController
,IPropUndoContext
,ITermEditor
,ITerminalStateListener
,IPropUndoRedo
,org.eclipse.core.runtime.IAdaptable
,org.eclipse.core.runtime.IExecutableExtension
,org.eclipse.jface.viewers.ISelectionChangedListener
,org.eclipse.jface.viewers.ISelectionProvider
,org.eclipse.ui.ide.IGotoMarker
,org.eclipse.ui.IEditorPart
,org.eclipse.ui.INavigationLocationProvider
,org.eclipse.ui.IPersistable
,org.eclipse.ui.IPersistableEditor
,org.eclipse.ui.ISaveablePart
,org.eclipse.ui.ISaveablesSource
,org.eclipse.ui.IWorkbenchPart
,org.eclipse.ui.IWorkbenchPart2
,org.eclipse.ui.IWorkbenchPart3
,org.eclipse.ui.part.IWorkbenchPartOrientation
public class ScreenEditor extends PropEditorPart implements ITerminalStateListener, ITermEditor
The Terminal Screen Editor part.- Author:
- Christopher Mindus
Nested Class Summary
Nested classes/interfaces inherited from class com.iizigo.editor.PropEditorPart
PropEditorPart.DragSourceDelegator
Field Summary
Fields Modifier and Type Field Description HostSession
hostSession
The host session.static java.lang.String
ID
The Part ID.static org.eclipse.core.runtime.QualifiedName
sessionNameQualifier
The Session Name Qualifier for files.int
xPopupOffset
The popup offset in X.int
yPopupOffset
The popup offset in Y.Fields inherited from class com.iizigo.editor.PropEditorPart
appUI, copyAction, copyFullPathAction, copyReferenceAction, cutAction, deleteAction, dslPaste, editedPropCnr, EMPTY, filePropCnr, fileResource, globalActionBars, ir, linkAction, moveAction, partSelection, pasteAction, pasteAfterAction, pasteBeforeAction, pasteLinkAction, printAction, propEventListener, redoAction, renameAction, restoreMemento, revertAction, rootPropCnr, saveAction, selectAllAction, selectionEnabler, tiPaste, toolBar, toolBar2, undoAction, updateSelectionAndStatesRunner
Constructor Summary
Constructors Constructor Description ScreenEditor()
Eclipse constructor.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createEditorComposite(org.eclipse.swt.widgets.Composite parent)
Creates the Editor Main Composite.void
dispose()
Dispose of the editor.boolean
doOpen(GProp<?>[] props)
Opens the property by selecting it in focus.boolean
doOpen(GProp<?> prop, int index, java.lang.String childName)
Opens the property by selecting it in focus.HostSession
getHostSession()
Gets the HostSession.org.eclipse.swt.graphics.Rectangle
getMarkingConstraints()
Gets the rectangle marking constraints.TerminalComposite
getTerminalComposite()
Gets the terminal composite.org.eclipse.jface.viewers.TreeViewer
getViewer()
Gets the viewer.protected void
initEditor(PropCnr cnr)
The initialize editor method.boolean
isCursorPresent()
Cursor present (and blinking)?boolean
isHotSpotEnabled()
Check for hotspot enabled.boolean
isTooltipTextShown()
If tool tips are shown.void
onClose()
Called when the part is being closed but is not yet disposed but hidden.void
onDoubleClick(int x, int y)
Marks the host field.protected void
onEditorActivated(boolean on)
Called when editor is activated.void
onTerminalFieldChanged(HostSession hostSession, TerminalWindow tw)
Called when the screen needs updates due to field change.void
onTerminalStateUpdate(HostSession hostSession, TerminalWindow tw)
Called when state probably needs update or check.void
paint(java.awt.Graphics2D g, int leftMargin, int topMargin, int cxFont, int cyFont, int cxFontReal, int cyFontReal, int cxScreen, int cyScreen, org.eclipse.swt.graphics.Rectangle clipRect)
Paints the Graphics once the screen is drawn, before the cursor.protected void
performPrint()
Performs Print.protected void
saveStateImpl(org.eclipse.ui.IMemento memento)
Saves the state.protected void
selectionChangedEx(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.protected void
updateStatesEx()
Called to update the states.void
updateToolStates()
Updates tool states.protected boolean
usePasteBeforeAfter()
Override to return how paste before/after are processed.Methods inherited from class com.iizigo.editor.PropEditorPart
addForDisposalAtDispose, addListener, addOpenFile, addSelectionChangedListener, addToolbar2PushButton, addToolbar2PushButton, addToolbar2Separator, addToolbarPushButton, addToolbarPushButton, addToolbarPushButton, addToolbarPushButton, addToolbarPushButton, addToolbarPushButton, addToolbarPushButton, addToolbarSeparator, addToolbarSeparator, closeFile, createCommonViewer, createEmptyNavigationLocation, createFilteredCommonViewer, createFilteredCommonViewer, createLicenseExceptionComposite, createMenu, createMenu, createNavigationLocation, createPartControl, doSave, doSaveAs, fireSelectionAndStates, getActiveEditor, getActiveEditor, getActivePart, getActiveSaveables, getAdapter, getCurrentTreeViewer, getEditors, getExtension, getLicenseException, getModuleModel, getMultiSelectionProvider, getPartComposite, getPartName, getRedoAction, getSaveables, getSelection, getSelectionEnabler, getShell, getSyntClipboardSelection, getTargetViewer, getTitleImage, getTitleToolTip, getTitleToolTip, getTopmostEditor, getUndoAction, getUndoContext, getUndoRedo, gotoMarker, hasInitError, init, invalidLicense, isDirty, isDisposed, isDragging, isSaveAsAllowed, isSaveOnCloseNeeded, onActivated, onCloseProject, onComponentFocus, onDragBegin, onDragEnd, onEditedPropertyChangedForVerify, onEditorReady, onFileClosed, onPartRenamed, onSetFocus, onUpdateStates, performCollapseAll, performCopy, performCopyFullPath, performCopyReference, performCut, performDelete, performExpandAll, performLink, performMove, performPaste, performPasteAfter, performPasteBefore, performPasteLink, performRedo, performRename, performRevert, performSave, performSelectAll, performUndo, postAsyncUpdateStates, proceedInit, proceedInitProperty, refreshViewers, registerFormControl, registerViewer, registerViewer, removeListener, removePropertyValue, removeSelectionChangedListener, restoreMemento, restoreState, saveState, selectionChanged, setActionsUndoContext, setBlockViewerFocus, setFocus, setFocus, setInput, setPropertyAttrFlag, setPropertyError, setPropertyValue, setSelection, setTargetViewer, supportsCopyFullPath, supportsCopyReference, updateAllStates, updateStates, updateStatesPasteBeforeAfter, updateTitle, verifyDirtyStateChanged
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, setContentDescription, setInitializationData, setInputWithNotify, setPartName
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, firePropertyChange, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, 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 com.iizigo.prop.IPropertyEditorController
getModuleModel, getMultiSelectionProvider, getUndoContext, getUndoRedo, isDisposed, removePropertyValue, setBlockViewerFocus, setPropertyAttrFlag, setPropertyError, setPropertyValue
Methods inherited from interface com.iizigo.prop.IPropUndoContext
getUndoContext
Methods inherited from interface com.iizix.prop.IPropUndoRedo
getShell, getTargetViewer, getUndoContext, setTargetViewer, updateStates
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, removePropertyListener
Methods inherited from interface com.iizigo.editor.IWorkbenchPartIZ
onComponentFocused
Field Detail
ID
public static final java.lang.String ID
The Part ID.
sessionNameQualifier
public static final org.eclipse.core.runtime.QualifiedName sessionNameQualifier
The Session Name Qualifier for files.
hostSession
public HostSession hostSession
The host session.
xPopupOffset
public int xPopupOffset
The popup offset in X.
yPopupOffset
public int yPopupOffset
The popup offset in Y.
Method Detail
initEditor
protected void initEditor(PropCnr cnr) throws org.eclipse.ui.PartInitException
The initialize editor method.Subclasses may override this method.
- Overrides:
initEditor
in classPropEditorPart
- Parameters:
cnr
- The property container being edited. Note: the real name of the property is in the parent FilePropCnr Atom.- Throws:
org.eclipse.ui.PartInitException
- For initialization failures.
onEditorActivated
protected void onEditorActivated(boolean on)
Called when editor is activated. The time is stored so that focus events can check if they should be processed or not (marking in Terminal).- Overrides:
onEditorActivated
in classPropEditorPart
usePasteBeforeAfter
protected boolean usePasteBeforeAfter()
Override to return how paste before/after are processed.- Overrides:
usePasteBeforeAfter
in classPropEditorPart
- Returns:
- true to handle before/after.
isTooltipTextShown
public boolean isTooltipTextShown()
If tool tips are shown.- Specified by:
isTooltipTextShown
in interfaceITermEditor
isHotSpotEnabled
public boolean isHotSpotEnabled()
Check for hotspot enabled.- Specified by:
isHotSpotEnabled
in interfaceITermEditor
isCursorPresent
public boolean isCursorPresent()
Cursor present (and blinking)?- Specified by:
isCursorPresent
in interfaceITermEditor
getViewer
public org.eclipse.jface.viewers.TreeViewer getViewer()
Gets the viewer.- Specified by:
getViewer
in interfaceITermEditor
getHostSession
public HostSession getHostSession()
Gets the HostSession.- Specified by:
getHostSession
in interfaceITermEditor
onClose
public void onClose()
Called when the part is being closed but is not yet disposed but hidden.- Specified by:
onClose
in interfaceIActivationListener
- Overrides:
onClose
in classPropEditorPart
dispose
public void dispose()
Dispose of the editor.- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classPropEditorPart
createEditorComposite
protected void createEditorComposite(org.eclipse.swt.widgets.Composite parent)
Creates the Editor Main Composite.- Specified by:
createEditorComposite
in classPropEditorPart
- Parameters:
parent
- The empty parent composite without initialized layout, with the widget background color.
getMarkingConstraints
public org.eclipse.swt.graphics.Rectangle getMarkingConstraints()
Gets the rectangle marking constraints. This is used for pop-up windows.- Specified by:
getMarkingConstraints
in interfaceITermEditor
- Returns:
- null If no constrains are present.
performPrint
protected void performPrint()
Performs Print.- Specified by:
performPrint
in classPropEditorPart
onTerminalStateUpdate
public void onTerminalStateUpdate(HostSession hostSession, TerminalWindow tw)
Called when state probably needs update or check.- Specified by:
onTerminalStateUpdate
in interfaceITerminalStateListener
- 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 interfaceITerminalStateListener
- Parameters:
hostSession
- The host session, may be null.tw
- The TerminalWindow, may be null when hostSession is null, not otherwise.
updateToolStates
public void updateToolStates()
Updates tool states.- Specified by:
updateToolStates
in interfaceITermEditor
saveStateImpl
protected void saveStateImpl(org.eclipse.ui.IMemento memento)
Saves the state.- Overrides:
saveStateImpl
in classPropEditorPart
- Parameters:
memento
- The storage area for object's state.
getTerminalComposite
public TerminalComposite getTerminalComposite()
Gets the terminal composite.- Specified by:
getTerminalComposite
in interfaceITermEditor
selectionChangedEx
protected void selectionChangedEx(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.- Overrides:
selectionChangedEx
in classPropEditorPart
updateStatesEx
protected void updateStatesEx()
Called to update the states.- Overrides:
updateStatesEx
in classPropEditorPart
doOpen
public boolean doOpen(GProp<?>[] props)
Opens the property by selecting it in focus.- Overrides:
doOpen
in classPropEditorPart
doOpen
public boolean doOpen(GProp<?> prop, int index, java.lang.String childName)
Opens the property by selecting it in focus. This method must be overridden.- Overrides:
doOpen
in classPropEditorPart
- Parameters:
prop
- The property to focus.index
- The index in a multi-property.childName
- Name of child property or null.- Returns:
- true for success, false for failure.
onDoubleClick
public void onDoubleClick(int x, int y)
Marks the host field.- Specified by:
onDoubleClick
in interfaceITermEditor
paint
public void paint(java.awt.Graphics2D g, int leftMargin, int topMargin, int cxFont, int cyFont, int cxFontReal, int cyFontReal, int cxScreen, int cyScreen, org.eclipse.swt.graphics.Rectangle clipRect)
Paints the Graphics once the screen is drawn, before the cursor.- Specified by:
paint
in interfaceITermEditor