Class PropEditorPart
- java.lang.Object
- org.eclipse.core.commands.common.EventManager
- org.eclipse.ui.part.WorkbenchPart
- org.eclipse.ui.part.EditorPart
- com.iizigo.editor.PropEditorPart
- All Implemented Interfaces:
IActivationListener
,IDraggingFix
,IWorkbenchPartIZ
,IPropertyEditorController
,IPropUndoContext
,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
- Direct Known Subclasses:
CaptureEditor
,ContextMenuEditor
,DatabaseEditor
,FontFacesEditor
,ImageDefinitionEditor
,PanelEditor
,RecordingEditor
,ScreenEditor
,SelectorEditor
,StyleEditor
,TextTableEditor
,VirtualSpaceEditor
,WebServiceEditor
public abstract class PropEditorPart extends org.eclipse.ui.part.EditorPart implements org.eclipse.jface.viewers.ISelectionChangedListener, IPropertyEditorController, IPropUndoRedo, org.eclipse.ui.IPersistableEditor, org.eclipse.ui.ISaveablesSource, org.eclipse.ui.INavigationLocationProvider, org.eclipse.ui.ide.IGotoMarker, IPropUndoContext, IDraggingFix, IActivationListener, IWorkbenchPartIZ, org.eclipse.jface.viewers.ISelectionProvider
The abstract Property Editor part used by the Editors in iiziGo.- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PropEditorPart.DragSourceDelegator
Class used to delegate DragSource events to the listener, making it possible to know when drag-drop is in effect.
Field Summary
Fields Modifier and Type Field Description protected ApplicationUI
appUI
The Application UI.protected PartAction
copyAction
Menu actions.protected PartAction
copyFullPathAction
protected PartAction
copyReferenceAction
Menu actions that MAY be null in case they are not supported.protected PartAction
cutAction
Menu actions.protected PartAction
deleteAction
Menu actions.protected DropdownSelectionListener
dslPaste
protected PropCnr
editedPropCnr
The edited property inside thefilePropCnr
.static PropEditorPart[]
EMPTY
Empty array.protected FilePropCnr
filePropCnr
The File Property being edited, null for none.protected org.eclipse.core.resources.IFile
fileResource
The file resource for the editor.protected org.eclipse.ui.IActionBars
globalActionBars
The global action bars.protected ImageRegistry
ir
The Image Registry.protected PartAction
linkAction
Menu actions.protected PartAction
moveAction
Menu actions.protected org.eclipse.jface.viewers.IStructuredSelection
partSelection
This part's current selection.protected PartAction
pasteAction
Menu actions.protected PartAction
pasteAfterAction
Menu actions.protected PartAction
pasteBeforeAction
Menu actions.protected PartAction
pasteLinkAction
Menu actions.protected PartAction
printAction
Menu actions.protected EventListener
propEventListener
Property event listener.protected org.eclipse.ui.operations.RedoActionHandler
redoAction
protected PartAction
renameAction
Menu actions.protected org.eclipse.ui.IMemento
restoreMemento
The restored memento.protected PartAction
revertAction
Menu actions.protected PropCnr
rootPropCnr
The (Module) root container used to listen to events, null when not used.protected PartAction
saveAction
Menu actions.protected PartAction
selectAllAction
Menu actions.protected SelectionEnabler
selectionEnabler
The last selection states.protected org.eclipse.swt.widgets.ToolItem
tiPaste
Paste items.protected org.eclipse.swt.widgets.ToolBar
toolBar
The tool bar.protected org.eclipse.swt.widgets.ToolBar
toolBar2
The tool bar.protected org.eclipse.ui.operations.UndoActionHandler
undoAction
java.lang.Runnable
updateSelectionAndStatesRunner
The update states runnable.
Constructor Summary
Constructors Constructor Description PropEditorPart(java.lang.Class<? extends PropCnr> propertyClass)
Constructor.
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addForDisposalAtDispose(java.lang.Object disposable)
Adds an action that is disposed when the editor is disposed of.static boolean
addListener(ILicenseSystemError listener)
Adds a dispose listener for the client session.protected void
addOpenFile(FilePropCnr fpc)
Adds an open file.void
addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Adds a listener for selection changes in this selection provider.protected org.eclipse.swt.widgets.ToolItem
addToolbar2PushButton(java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.protected void
addToolbar2PushButton(org.eclipse.jface.action.IAction action)
Adds a push button to the second tool bar from an action.protected void
addToolbar2Separator()
Adds a separator to the second tool bar.protected org.eclipse.swt.widgets.ToolItem
addToolbarPushButton(java.lang.String tooltip, java.lang.String icon, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.protected org.eclipse.swt.widgets.ToolItem
addToolbarPushButton(java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.protected void
addToolbarPushButton(org.eclipse.jface.action.IAction action)
Adds a tool bar push button from an action.static org.eclipse.swt.widgets.ToolItem
addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, java.lang.String icon, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.static org.eclipse.swt.widgets.ToolItem
addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, org.eclipse.swt.graphics.Image image, int style, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.static org.eclipse.swt.widgets.ToolItem
addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.void
addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, org.eclipse.jface.action.IAction action)
Adds a tool bar push button from an action.protected void
addToolbarSeparator()
Adds a separator to the tool bar.static void
addToolbarSeparator(org.eclipse.swt.widgets.ToolBar toolBar)
Adds a separator to the tool bar.protected void
closeFile(FilePropCnr fpc)
Closed an open file.CommonViewerEx
createCommonViewer(org.eclipse.swt.widgets.Composite parent)
Creates the CommonViewer with extra support for Drag-and-Drop.protected abstract void
createEditorComposite(org.eclipse.swt.widgets.Composite parent)
Creates the Editor Main Composite.org.eclipse.ui.INavigationLocation
createEmptyNavigationLocation()
Creates an empty navigation location.FilteredCommonViewer
createFilteredCommonViewer(org.eclipse.swt.widgets.Composite parent, int style, IzFilter filter)
Creates the Filtered CommonViewer with extra support for Drag-and-Drop.FilteredCommonViewer
createFilteredCommonViewer(org.eclipse.swt.widgets.Composite parent, IzFilter filter)
Creates the Filtered CommonViewer with extra support for Drag-and-Drop.static org.eclipse.swt.widgets.Composite
createLicenseExceptionComposite(org.eclipse.swt.widgets.Composite parent, java.lang.String errorText)
Creates an error composite from the license exception.protected void
createMenu(org.eclipse.jface.viewers.Viewer viewer, IContextMenuContributor contributor)
Creates a menu that is used as a pop-up menu.protected void
createMenu(org.eclipse.swt.widgets.Control control, IContextMenuContributorFormControl<org.eclipse.swt.widgets.Control> contributor)
Creates a menu that is used as a pop-up menu.org.eclipse.ui.INavigationLocation
createNavigationLocation()
Creates a navigation location describing the current state.void
createPartControl(org.eclipse.swt.widgets.Composite parent)
Create contents of the editor part.void
dispose()
Disposes 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.void
doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Saves the contents of this part.void
doSaveAs()
Saves the contents of this part to another object.void
fireSelectionAndStates()
Fires a new selection event that also updates the states.static PropEditorPart
getActiveEditor()
Gets the active editor part.static PropEditorPart
getActiveEditor(GProp<?> prop)
Gets the active or topmost editor from a property.static PropEditorPart
getActivePart()
Gets the active part, differs fromgetActiveEditor()
because it check if e.g.org.eclipse.ui.Saveable[]
getActiveSaveables()
<T> T
getAdapter(java.lang.Class<T> adapter)
protected org.eclipse.jface.viewers.TreeViewer
getCurrentTreeViewer()
Gets the current tree viewer.static PropEditorPart[]
getEditors()
Gets a snapshot of the editor parts.PartExtensionIZ
getExtension()
The extensions framework.static LicenseException
getLicenseException()
Gets the potential license exception that occurred when loading it.ModuleModel
getModuleModel()
Gets the ModuleModel instance of the project.MultiSelectionProvider
getMultiSelectionProvider()
Gets the multi-property selection provider.org.eclipse.swt.widgets.Composite
getPartComposite()
Gets the part composite created.protected java.lang.String
getPartName(java.lang.String title)
Gets the part name that is about to be set.org.eclipse.ui.operations.RedoActionHandler
getRedoAction()
Gets the undo action.org.eclipse.ui.Saveable[]
getSaveables()
org.eclipse.jface.viewers.ISelection
getSelection()
Returns the current selection for this provider.SelectionEnabler
getSelectionEnabler()
Gets the selection enabler instance.org.eclipse.swt.widgets.Shell
getShell()
Gets the shell.IClipboardSelection
getSyntClipboardSelection()
Gets the current IClipboardSelection implementor.java.lang.Object
getTargetViewer()
Gets the structured viewer (common, tree or table) used for the property operation (add, delete, etc).org.eclipse.swt.graphics.Image
getTitleImage()
Returns the workbench part image.java.lang.String
getTitleToolTip()
Returns the title tooltip.protected java.lang.String
getTitleToolTip(java.lang.String title)
Gets the part name that is about to be set.static PropEditorPart
getTopmostEditor(PropEditorPart[] editors)
Gets the topmost editor part from an array of editors.org.eclipse.ui.operations.UndoActionHandler
getUndoAction()
Gets the undo action.org.eclipse.core.commands.operations.IUndoContext
getUndoContext()
Gets the undo context.IPropUndoRedo
getUndoRedo()
Gets the undo/redo interface.void
gotoMarker(org.eclipse.core.resources.IMarker marker)
Sets the cursor and selection state for an editor to reveal the position of the given marker.boolean
hasInitError()
Flag for initialize error, i.e.void
init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
Initializes this editor with the given editor site and input.protected void
initEditor(PropCnr cnr)
The initialize editor method.static void
invalidLicense(LicenseException e)
Called from the SWT thread if the license is not valid.boolean
isDirty()
Returns whether the contents of this part have changed since the last save operation.boolean
isDisposed()
Checks if the part is disposed of.boolean
isDragging()
Flag for dragging to postpone selection events until drag completes.boolean
isSaveAsAllowed()
Returns whether the "Save As" operation is supported by this part.boolean
isSaveOnCloseNeeded()
Returns whether the contents of this editor should be saved when the editor is closed.void
onActivated(boolean on)
Called when activator or deactivated.void
onClose()
Called when the part is being closed but is not yet disposed but hidden.static void
onCloseProject(org.eclipse.core.resources.IProject project)
Called when a project is closed or unregistered from being a Module project.void
onComponentFocus(org.eclipse.swt.widgets.Control c)
Called by the workbench extension when focus is received.protected void
onDragBegin()
Drag started.protected void
onDragEnd()
Drag finished.protected void
onEditedPropertyChangedForVerify(GEvent event)
Called when verification listener gets called for verify, very commonly in a non-SWT thread.protected void
onEditorActivated(boolean on)
Called when the editor is activated or deactivated.protected void
onEditorReady()
Function called once the Editor has been initialized and fully created, should be overridden by Editor parts that need such functionality.protected void
onFileClosed(FilePropCnr fpc)
Called when an open file in the editor has been closed and needs to be removed.protected void
onPartRenamed(GEvent e)
Called when the part has been renamed.protected void
onSetFocus()
Called when set focus is called to override default processing.protected void
onUpdateStates()
Called just in the beginning of updateStates() before selections are processed.protected void
performCollapseAll()
Performs move up.void
performCopy()
Performs Copy.protected boolean
performCopyFullPath(boolean doPerform)
Copies the full path.protected boolean
performCopyReference(boolean doPerform)
Copies the reference.void
performCut()
Performs Cut.void
performDelete()
Performs Delete.protected void
performExpandAll()
Performs move down.void
performLink()
Performs Link.void
performMove()
Performs Move.void
performPaste()
Performs Paste.void
performPasteAfter()
Performs Paste Before.void
performPasteBefore()
Performs Paste Before.void
performPasteLink()
Performs Paste-link.protected abstract void
performPrint()
Performs Print.void
performRedo()
Performs Redo.protected void
performRename()
Performs Rename.protected void
performRevert()
Performs Revert.protected void
performSave()
Performs Save.void
performSelectAll()
Performs Select All.void
performUndo()
Performs Undo.protected void
postAsyncUpdateStates()
Post an async updateStates event (once only in one "SWT cycle").protected void
proceedInit()
Continues the "init".protected void
proceedInitProperty(PropCnr pc)
Proceeds initializing the editor with the property.void
refreshViewers()
Refreshes all registered viewers before e.g.void
registerFormControl(org.eclipse.swt.widgets.Control control)
Registers a form entry capable control in the Editor part.protected void
registerViewer(org.eclipse.jface.viewers.StructuredViewer viewer, int index)
Registers a viewer for selection changes.void
registerViewer(org.eclipse.jface.viewers.StructuredViewer viewer, int index, IContextMenuContributor contributor)
Registers a viewer for selection changes.static boolean
removeListener(ILicenseSystemError listener)
Removes a dispose listener for the client session.void
removePropertyValue(GProp<?> property)
Removes a property when undefined in the editors.void
removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Removes the given selection change listener from this selection provider.protected void
restoreMemento()
Called to perform the restoring of the Memento state.void
restoreState(org.eclipse.ui.IMemento memento)
Called with a memento for this editor.void
saveState(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.protected void
saveStateImpl(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.void
selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.protected void
selectionChangedEx(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.void
setActionsUndoContext(org.eclipse.core.commands.operations.IUndoContext undoContext)
Assigns another undo context to the undo/redo actions.void
setBlockViewerFocus(boolean block)
Blocks the target viewer from focus.void
setFocus()
Sets focus to the Editor.protected int
setFocus(PropCnr container, org.eclipse.jface.viewers.StructuredViewer viewer, IzFilter filter, PropertyEditor propertyEditor, GProp<?> property, int index, java.lang.String childName)
Attempts to set focus to the property in question based on a container, a viewer and a property editor.void
setInput(org.eclipse.ui.IEditorInput input)
Sets the input to this editor.void
setPropertyAttrFlag(GProp<?> property, int attr, boolean flag)
Sets a property attribute flag.void
setPropertyError(GProp<?> property, java.lang.String errorID, IPropErrorItem item)
Sets a property error.void
setPropertyValue(PropCnr parent, GProp<?> property, java.lang.Object value)
Sets a property value.void
setSelection(org.eclipse.jface.viewers.ISelection selection)
Sets the current selection for this selection provider.void
setTargetViewer(java.lang.Object viewer)
Sets the target viewer for e.g.protected boolean
supportsCopyFullPath()
Returns if the Copy path should be present or not.protected boolean
supportsCopyReference()
Returns if the Copy reference should be present or not.static void
updateAllStates()
Updates the states of all created editors.void
updateStates()
Update states of the menu and tool bars, both global and part-local ones.protected void
updateStatesEx()
Update states of the menu and tool bars, both global and part-local ones.protected void
updateStatesPasteBeforeAfter()
Process update states for pasteBeforeAction and pasteAfterAction.protected void
updateTitle()
Updates the title and tooltip when file name/contents changes.protected boolean
usePasteBeforeAfter()
Override to return how paste before/after are processed.void
verifyDirtyStateChanged()
Verifies the dirty and fires state changed as required.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 org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, removePropertyListener
Methods inherited from interface com.iizigo.editor.IWorkbenchPartIZ
onComponentFocused
Field Detail
EMPTY
public static final PropEditorPart[] EMPTY
Empty array.
rootPropCnr
protected PropCnr rootPropCnr
The (Module) root container used to listen to events, null when not used.
fileResource
protected org.eclipse.core.resources.IFile fileResource
The file resource for the editor.
filePropCnr
protected FilePropCnr filePropCnr
The File Property being edited, null for none.
editedPropCnr
protected PropCnr editedPropCnr
The edited property inside thefilePropCnr
.
toolBar
protected org.eclipse.swt.widgets.ToolBar toolBar
The tool bar.
toolBar2
protected org.eclipse.swt.widgets.ToolBar toolBar2
The tool bar.
partSelection
protected org.eclipse.jface.viewers.IStructuredSelection partSelection
This part's current selection.
selectionEnabler
protected SelectionEnabler selectionEnabler
The last selection states.
cutAction
protected PartAction cutAction
Menu actions.
copyAction
protected PartAction copyAction
Menu actions.
pasteAction
protected PartAction pasteAction
Menu actions.
pasteBeforeAction
protected PartAction pasteBeforeAction
Menu actions.
pasteAfterAction
protected PartAction pasteAfterAction
Menu actions.
pasteLinkAction
protected PartAction pasteLinkAction
Menu actions.
deleteAction
protected PartAction deleteAction
Menu actions.
selectAllAction
protected PartAction selectAllAction
Menu actions.
revertAction
protected PartAction revertAction
Menu actions.
saveAction
protected PartAction saveAction
Menu actions.
renameAction
protected PartAction renameAction
Menu actions.
moveAction
protected PartAction moveAction
Menu actions.
linkAction
protected PartAction linkAction
Menu actions.
printAction
protected PartAction printAction
Menu actions.
copyReferenceAction
protected PartAction copyReferenceAction
Menu actions that MAY be null in case they are not supported.
copyFullPathAction
protected PartAction copyFullPathAction
undoAction
protected org.eclipse.ui.operations.UndoActionHandler undoAction
redoAction
protected org.eclipse.ui.operations.RedoActionHandler redoAction
tiPaste
protected org.eclipse.swt.widgets.ToolItem tiPaste
Paste items.
dslPaste
protected DropdownSelectionListener dslPaste
globalActionBars
protected org.eclipse.ui.IActionBars globalActionBars
The global action bars.
ir
protected final ImageRegistry ir
The Image Registry.
appUI
protected ApplicationUI appUI
The Application UI.
restoreMemento
protected org.eclipse.ui.IMemento restoreMemento
The restored memento.Note that
restoreMemento
may benull
.
propEventListener
protected final EventListener propEventListener
Property event listener.
updateSelectionAndStatesRunner
public final java.lang.Runnable updateSelectionAndStatesRunner
The update states runnable.
Constructor Detail
PropEditorPart
public PropEditorPart(java.lang.Class<? extends PropCnr> propertyClass)
Constructor.- Parameters:
propertyClass
- The property class in files.
Method Detail
getEditors
public static PropEditorPart[] getEditors()
Gets a snapshot of the editor parts.
updateAllStates
public static void updateAllStates()
Updates the states of all created editors.
getActiveEditor
public static PropEditorPart getActiveEditor()
Gets the active editor part.- Returns:
- The active editor part, or null for none.
getActiveEditor
public static PropEditorPart getActiveEditor(GProp<?> prop)
Gets the active or topmost editor from a property.- Returns:
- null if none is found.
getTopmostEditor
public static PropEditorPart getTopmostEditor(PropEditorPart[] editors)
Gets the topmost editor part from an array of editors.- Parameters:
editors
- Selection of editors to choose from, in the order of first created editor.- Returns:
- The topmost editor, or null if no editor is found (editors array is empty).
getActivePart
public static PropEditorPart getActivePart()
Gets the active part, differs fromgetActiveEditor()
because it check if e.g. a Common Navigator is active...- Returns:
- The active editor part, or null for none.
onCloseProject
public static void onCloseProject(org.eclipse.core.resources.IProject project)
Called when a project is closed or unregistered from being a Module project. This closes the editors for it!
addListener
public static boolean addListener(ILicenseSystemError listener)
Adds a dispose listener for the client session. Calling this method multiple times with the same listener will have no effect (but to return false).- Parameters:
listener
- The listener to add.- Returns:
- true if the listener was added, false otherwise.
- Throws:
java.lang.NullPointerException
- If the listener isnull
.
removeListener
public static boolean removeListener(ILicenseSystemError listener)
Removes a dispose listener for the client session.- Parameters:
listener
- The listener to remove.- Returns:
- true if listener is successfully removed, false otherwise.
invalidLicense
public static void invalidLicense(LicenseException e)
Called from the SWT thread if the license is not valid.- Parameters:
e
- The license exception.
getLicenseException
public static LicenseException getLicenseException()
Gets the potential license exception that occurred when loading it.- Returns:
- The license exception, or null for OK (or License System not yet loaded).
createLicenseExceptionComposite
public static org.eclipse.swt.widgets.Composite createLicenseExceptionComposite(org.eclipse.swt.widgets.Composite parent, java.lang.String errorText)
Creates an error composite from the license exception.- Parameters:
parent
- The parent composite.errorText
- The error text to use if there is no license exception.- Returns:
- The error composite, or null for no exception and no error text.
addForDisposalAtDispose
protected void addForDisposalAtDispose(java.lang.Object disposable)
Adds an action that is disposed when the editor is disposed of.
getMultiSelectionProvider
public final MultiSelectionProvider getMultiSelectionProvider()
Gets the multi-property selection provider.- Specified by:
getMultiSelectionProvider
in interfaceIPropertyEditorController
getExtension
public PartExtensionIZ getExtension()
The extensions framework.- Specified by:
getExtension
in interfaceIWorkbenchPartIZ
getSelectionEnabler
public SelectionEnabler getSelectionEnabler()
Gets the selection enabler instance.- Specified by:
getSelectionEnabler
in interfaceIWorkbenchPartIZ
onEditorActivated
protected void onEditorActivated(boolean on)
Called when the editor is activated or deactivated.
addOpenFile
protected void addOpenFile(FilePropCnr fpc)
Adds an open file. This method should be called when e.g. the text table editor opens a parallel text table for editing.
closeFile
protected void closeFile(FilePropCnr fpc)
Closed an open file. This method should be called when e.g. the text table editor opens a parallel text table for editing.
init
public final void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
Initializes this editor with the given editor site and input.This method is automatically called shortly after the part is instantiated. It marks the start of the part's life cycle. The IWorkbenchPart.dispose method will be called automatically at the end of the life cycle. Clients must not call this method.
Implementors of this method must examine the editor input object type to determine if it is understood. If not, the implementor must throw a PartInitException.
The initEditor method is called once initialized.
- Specified by:
init
in interfaceorg.eclipse.ui.IEditorPart
- Specified by:
init
in classorg.eclipse.ui.part.EditorPart
- Throws:
org.eclipse.ui.PartInitException
- For initialization failures.
hasInitError
public boolean hasInitError()
Flag for initialize error, i.e. if there is a PartInitException in the postponed call.
onEditorReady
protected void onEditorReady()
Function called once the Editor has been initialized and fully created, should be overridden by Editor parts that need such functionality. By default nothing is done in this method.
proceedInit
protected void proceedInit() throws org.eclipse.ui.PartInitException
Continues the "init". This method can be overridden by editors that are not file property based such as the capture editor.- Throws:
org.eclipse.ui.PartInitException
proceedInitProperty
protected void proceedInitProperty(PropCnr pc) throws org.eclipse.ui.PartInitException
Proceeds initializing the editor with the property.- Throws:
org.eclipse.ui.PartInitException
getPartComposite
public org.eclipse.swt.widgets.Composite getPartComposite()
Gets the part composite created.- Returns:
- The part composite, null if not yet created.
updateTitle
protected void updateTitle()
Updates the title and tooltip when file name/contents changes.
getTitleToolTip
public java.lang.String getTitleToolTip()
Returns the title tooltip.- Specified by:
getTitleToolTip
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
getTitleToolTip
in classorg.eclipse.ui.part.EditorPart
getTitleImage
public org.eclipse.swt.graphics.Image getTitleImage()
Returns the workbench part image.- Specified by:
getTitleImage
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
getTitleImage
in classorg.eclipse.ui.part.WorkbenchPart
getPartName
protected java.lang.String getPartName(java.lang.String title)
Gets the part name that is about to be set. Override to provide an other title.
getTitleToolTip
protected java.lang.String getTitleToolTip(java.lang.String title)
Gets the part name that is about to be set. Override to provide an other title.
setInput
public void setInput(org.eclipse.ui.IEditorInput input)
Sets the input to this editor.Note: Clients must fire the
IEditorPart.PROP_INPUT
property change within their implementation ofsetInput()
.- Overrides:
setInput
in classorg.eclipse.ui.part.EditorPart
- Parameters:
input
- The editor input.
getModuleModel
public ModuleModel getModuleModel()
Gets the ModuleModel instance of the project.- Specified by:
getModuleModel
in interfaceIPropertyEditorController
- Returns:
- The ModuleModel of the project, null if not yet loaded.
onFileClosed
protected void onFileClosed(FilePropCnr fpc)
Called when an open file in the editor has been closed and needs to be removed. This is called in the SWT thread. This call is not done for the main file of this editor, but secondary files. For the main file, the editor is closed directory.Subclasses with multiple files override this method.
- Parameters:
fpc
- The file closed.
onPartRenamed
protected void onPartRenamed(GEvent e)
Called when the part has been renamed. Subclasses override this method to handle changes in property names if the property e.g. is in a tree.
initEditor
protected void initEditor(PropCnr cnr) throws org.eclipse.ui.PartInitException
The initialize editor method.Subclasses may override this method.
- 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.
onClose
public void onClose()
Called when the part is being closed but is not yet disposed but hidden.- Specified by:
onClose
in interfaceIActivationListener
isSaveOnCloseNeeded
public boolean isSaveOnCloseNeeded()
Returns whether the contents of this editor should be saved when the editor is closed.This method always returns
false
because the iizi saveables mechanism is somewhat different and saves when workspace exits.- Specified by:
isSaveOnCloseNeeded
in interfaceorg.eclipse.ui.ISaveablePart
- Overrides:
isSaveOnCloseNeeded
in classorg.eclipse.ui.part.EditorPart
dispose
public void dispose()
Disposes of the Editor.- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classorg.eclipse.ui.part.WorkbenchPart
isDisposed
public boolean isDisposed()
Checks if the part is disposed of.- Specified by:
isDisposed
in interfaceIActivationListener
- Specified by:
isDisposed
in interfaceIPropertyEditorController
- Specified by:
isDisposed
in interfaceIWorkbenchPartIZ
- Returns:
- true if disposed of, false otherwise.
restoreState
public final void restoreState(org.eclipse.ui.IMemento memento)
Called with a memento for this editor. The editor can parse the data or save the memento. This method may not be called.- Specified by:
restoreState
in interfaceorg.eclipse.ui.IPersistableEditor
- Parameters:
memento
- the saved state for this editor. May benull
.
restoreMemento
protected void restoreMemento()
Called to perform the restoring of the Memento state. When this method is called, the subclass can get the memento using the protected variablerestoreMemento
.Note that
restoreMemento
may benull
.
saveState
public final void saveState(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.Subclasses may extend this method.
- Specified by:
saveState
in interfaceorg.eclipse.ui.IPersistable
- Parameters:
memento
- The storage area for object's state.
saveStateImpl
protected void saveStateImpl(org.eclipse.ui.IMemento memento)
Saves the state of the object in the given memento.Subclasses should override this method to provide support.
- Parameters:
memento
- The storage area for object's state.
addSelectionChangedListener
public void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Adds a listener for selection changes in this selection provider. Has no effect if an identical listener is already registered.- Specified by:
addSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
- Parameters:
listener
- a selection changed listener
removeSelectionChangedListener
public void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener listener)
Removes the given selection change listener from this selection provider. Has no effect if an identical listener is not registered.- Specified by:
removeSelectionChangedListener
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
- Parameters:
listener
- a selection changed listener
getSelection
public org.eclipse.jface.viewers.ISelection getSelection()
Returns the current selection for this provider.- Specified by:
getSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
- Returns:
- the current selection
setSelection
public void setSelection(org.eclipse.jface.viewers.ISelection selection)
Sets the current selection for this selection provider.- Specified by:
setSelection
in interfaceorg.eclipse.jface.viewers.ISelectionProvider
- Parameters:
selection
- the new selection
addToolbarPushButton
public static org.eclipse.swt.widgets.ToolItem addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, org.eclipse.swt.graphics.Image image, int style, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.- Parameters:
toolBar
- The tool bar.tooltip
- The tool-tip text of the tool bar button.image
- The image to use for the tool bar button.style
- The style: SWT.PUSH, SWT.CHECK, etc...listener
- The listener for the tool bar button.
addToolbarPushButton
public static org.eclipse.swt.widgets.ToolItem addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.- Parameters:
toolBar
- The tool bar.tooltip
- The tool-tip text of the tool bar button.image
- The image to use for the tool bar button.listener
- The listener for the tool bar button.
addToolbarPushButton
public static org.eclipse.swt.widgets.ToolItem addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, java.lang.String tooltip, java.lang.String icon, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.- Parameters:
toolBar
- The tool bar.tooltip
- The tool-tip text of the tool bar item.icon
- The workbench predefined image name.listener
- The listener for the tool bar button.- Returns:
- The newly created tool bar button.
addToolbarPushButton
protected org.eclipse.swt.widgets.ToolItem addToolbarPushButton(java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.- Parameters:
tooltip
- The tool-tip text of the tool bar button.image
- The image to use for the tool bar button.listener
- The listener for the tool bar button.
addToolbarPushButton
protected org.eclipse.swt.widgets.ToolItem addToolbarPushButton(java.lang.String tooltip, java.lang.String icon, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button.- Parameters:
tooltip
- The tool-tip text of the tool bar item.icon
- The workbench predefined image name.listener
- The listener for the tool bar button.- Returns:
- The newly created tool bar button.
addToolbarPushButton
public void addToolbarPushButton(org.eclipse.swt.widgets.ToolBar toolBar, org.eclipse.jface.action.IAction action)
Adds a tool bar push button from an action.- Parameters:
toolBar
- The tool bar.action
- The action.
addToolbarPushButton
protected void addToolbarPushButton(org.eclipse.jface.action.IAction action)
Adds a tool bar push button from an action.- Parameters:
action
- The action.
addToolbar2PushButton
protected void addToolbar2PushButton(org.eclipse.jface.action.IAction action)
Adds a push button to the second tool bar from an action.- Parameters:
action
- The action.
addToolbar2PushButton
protected org.eclipse.swt.widgets.ToolItem addToolbar2PushButton(java.lang.String tooltip, org.eclipse.swt.graphics.Image image, org.eclipse.swt.widgets.Listener listener)
Adds a tool bar push button to the second tool bar.- Parameters:
tooltip
- The tool-tip text of the tool bar button.image
- The image to use for the tool bar button.listener
- The listener for the tool bar button.
addToolbarSeparator
public static void addToolbarSeparator(org.eclipse.swt.widgets.ToolBar toolBar)
Adds a separator to the tool bar.- Parameters:
toolBar
- The tool bar.
addToolbarSeparator
protected void addToolbarSeparator()
Adds a separator to the tool bar.
addToolbar2Separator
protected void addToolbar2Separator()
Adds a separator to the second tool bar.
createPartControl
public final void createPartControl(org.eclipse.swt.widgets.Composite parent)
Create contents of the editor part.This method calls .
- Specified by:
createPartControl
in interfaceorg.eclipse.ui.IWorkbenchPart
- Specified by:
createPartControl
in classorg.eclipse.ui.part.WorkbenchPart
- Parameters:
parent
- The parent composite.
supportsCopyReference
protected boolean supportsCopyReference()
Returns if the Copy reference should be present or not.- Returns:
- false indicates no such item should be present, true for maybe, depending on selection.
supportsCopyFullPath
protected boolean supportsCopyFullPath()
Returns if the Copy path should be present or not.- Returns:
- false indicates no such item should be present, true for maybe, depending on selection.
usePasteBeforeAfter
protected boolean usePasteBeforeAfter()
Override to return how paste before/after are processed.- Returns:
- true to handle before/after.
createEditorComposite
protected abstract void createEditorComposite(org.eclipse.swt.widgets.Composite parent)
Creates the Editor Main Composite.- Parameters:
parent
- The empty parent composite without initialized layout, with the widget background color.
performCopyReference
protected boolean performCopyReference(boolean doPerform)
Copies the reference.- Parameters:
doPerform
- Flag to perform the action or just testing it.- Returns:
- true for action enabled, false for disabled.
performCopyFullPath
protected boolean performCopyFullPath(boolean doPerform)
Copies the full path.- Parameters:
doPerform
- Flag to perform the action or just testing it.- Returns:
- true for action enabled, false for disabled.
setActionsUndoContext
public void setActionsUndoContext(org.eclipse.core.commands.operations.IUndoContext undoContext)
Assigns another undo context to the undo/redo actions.- Parameters:
undoContext
- The new undo context, or null to restore to the original one.
getUndoAction
public org.eclipse.ui.operations.UndoActionHandler getUndoAction()
Gets the undo action.
getRedoAction
public org.eclipse.ui.operations.RedoActionHandler getRedoAction()
Gets the undo action.
registerFormControl
public void registerFormControl(org.eclipse.swt.widgets.Control control)
Registers a form entry capable control in the Editor part.- Parameters:
control
- The control can be Text, Combo, CCombo, StyledText, Spinner.
getShell
public final org.eclipse.swt.widgets.Shell getShell()
Gets the shell.- Specified by:
getShell
in interfaceIPropUndoRedo
- Returns:
- An object castable to org.eclipse.swt.widgets.Shell.
getUndoContext
public final org.eclipse.core.commands.operations.IUndoContext getUndoContext()
Gets the undo context.- Specified by:
getUndoContext
in interfaceIPropertyEditorController
- Specified by:
getUndoContext
in interfaceIPropUndoContext
- Specified by:
getUndoContext
in interfaceIPropUndoRedo
- Returns:
- An object castable to org.eclipse.core.commands.operations.IUndoContext.
getUndoRedo
public final IPropUndoRedo getUndoRedo()
Gets the undo/redo interface.- Specified by:
getUndoRedo
in interfaceIPropertyEditorController
- Specified by:
getUndoRedo
in interfaceIWorkbenchPartIZ
isDirty
public boolean isDirty()
Returns whether the contents of this part have changed since the last save operation. If this value changes the part must fire a property listener event with PROP_DIRTY.- Specified by:
isDirty
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isDirty
in classorg.eclipse.ui.part.EditorPart
verifyDirtyStateChanged
public void verifyDirtyStateChanged()
Verifies the dirty and fires state changed as required.
refreshViewers
public void refreshViewers()
Refreshes all registered viewers before e.g. a "doOpen" call to show a property when they have just been added.
doOpen
public boolean doOpen(GProp<?>[] props)
Opens the property by selecting it in focus. This method must be overridden.
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.- Parameters:
prop
- The property to focus.index
- The index in a multi-property.childName
- The child property name or null.- Returns:
- true for success, false for failure.
doSave
public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Saves the contents of this part.If the save is successful, the part should fire a property changed event reflecting the new dirty state (PROP_DIRTY property). If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.
- Specified by:
doSave
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSave
in classorg.eclipse.ui.part.EditorPart
doSaveAs
public final void doSaveAs()
Saves the contents of this part to another object.This is not supported.
- Specified by:
doSaveAs
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
doSaveAs
in classorg.eclipse.ui.part.EditorPart
isSaveAsAllowed
public final boolean isSaveAsAllowed()
Returns whether the "Save As" operation is supported by this part.- Specified by:
isSaveAsAllowed
in interfaceorg.eclipse.ui.ISaveablePart
- Specified by:
isSaveAsAllowed
in classorg.eclipse.ui.part.EditorPart
- Returns:
- false, always.
performUndo
public void performUndo()
Performs Undo.
performRedo
public void performRedo()
Performs Redo.
getSyntClipboardSelection
public IClipboardSelection getSyntClipboardSelection()
Gets the current IClipboardSelection implementor.- Returns:
- null For none.
performCopy
public void performCopy()
Performs Copy.
performCut
public void performCut()
Performs Cut.
performPaste
public void performPaste()
Performs Paste.
performPasteBefore
public void performPasteBefore()
Performs Paste Before.
performPasteAfter
public void performPasteAfter()
Performs Paste Before.
performPasteLink
public void performPasteLink()
Performs Paste-link.
performDelete
public void performDelete()
Performs Delete.
performSelectAll
public final void performSelectAll()
Performs Select All.
performMove
public void performMove()
Performs Move.
performLink
public void performLink()
Performs Link.
performPrint
protected abstract void performPrint()
Performs Print.
performRevert
protected void performRevert()
Performs Revert.
performSave
protected void performSave()
Performs Save.
performRename
protected void performRename()
Performs Rename.
getCurrentTreeViewer
protected org.eclipse.jface.viewers.TreeViewer getCurrentTreeViewer()
Gets the current tree viewer.- Returns:
- null for none.
performCollapseAll
protected void performCollapseAll()
Performs move up.
performExpandAll
protected void performExpandAll()
Performs move down.
selectionChanged
public final void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree. Once the selection has been processed, theselectChangedEx(event)
method is called.- Specified by:
selectionChanged
in interfaceorg.eclipse.jface.viewers.ISelectionChangedListener
fireSelectionAndStates
public void fireSelectionAndStates()
Fires a new selection event that also updates the states.
selectionChangedEx
protected void selectionChangedEx(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.Subclasses should override this method to process selection changes.
updateStates
public final void updateStates()
Update states of the menu and tool bars, both global and part-local ones. The states are set according to theselectionStates
member variable class instance. To fine-tune the states in theselectionStates
and further process other states, override theupdateStatesEx()
method.- Specified by:
updateStates
in interfaceIActivationListener
- Specified by:
updateStates
in interfaceIPropUndoRedo
onUpdateStates
protected void onUpdateStates()
Called just in the beginning of updateStates() before selections are processed. Override as required.
updateStatesPasteBeforeAfter
protected void updateStatesPasteBeforeAfter()
Process update states for pasteBeforeAction and pasteAfterAction. Override if other processing that the default is required, such as in the Panel Editor.
postAsyncUpdateStates
protected final void postAsyncUpdateStates()
Post an async updateStates event (once only in one "SWT cycle").
onEditedPropertyChangedForVerify
protected void onEditedPropertyChangedForVerify(GEvent event)
Called when verification listener gets called for verify, very commonly in a non-SWT thread. This method does nothing by default and can be overridden to process the edited property container changes events.
updateStatesEx
protected void updateStatesEx()
Update states of the menu and tool bars, both global and part-local ones. The states are set according to theselectionStates
member variable class instance.To fine-tune the states in the
selectionStates
and further process other states, override this method.
setPropertyValue
public void setPropertyValue(PropCnr parent, GProp<?> property, java.lang.Object value)
Sets a property value. The undo/redo functionality will wrap an undo/redo action for this function. This method handles setting a property value that is extended in the parent and the new property is to replace it in the parent.- Specified by:
setPropertyValue
in interfaceIPropertyEditorController
setPropertyError
public void setPropertyError(GProp<?> property, java.lang.String errorID, IPropErrorItem item)
Sets a property error. The undo/redo functionality will wrap an undo/redo action for this function.- Specified by:
setPropertyError
in interfaceIPropertyEditorController
setPropertyAttrFlag
public void setPropertyAttrFlag(GProp<?> property, int attr, boolean flag)
Sets a property attribute flag. The undo/redo functionality will wrap an undo/redo action for this function.- Specified by:
setPropertyAttrFlag
in interfaceIPropertyEditorController
removePropertyValue
public void removePropertyValue(GProp<?> property)
Removes a property when undefined in the editors. The undo/redo functionality will wrap an undo/redo action for this function.- Specified by:
removePropertyValue
in interfaceIPropertyEditorController
getAdapter
public <T> T getAdapter(java.lang.Class<T> adapter)
- Specified by:
getAdapter
in interfaceorg.eclipse.core.runtime.IAdaptable
- Overrides:
getAdapter
in classorg.eclipse.ui.part.WorkbenchPart
getSaveables
public org.eclipse.ui.Saveable[] getSaveables()
- Specified by:
getSaveables
in interfaceorg.eclipse.ui.ISaveablesSource
getActiveSaveables
public org.eclipse.ui.Saveable[] getActiveSaveables()
- Specified by:
getActiveSaveables
in interfaceorg.eclipse.ui.ISaveablesSource
createEmptyNavigationLocation
public org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()
Creates an empty navigation location. The messagerestoreState
will be sent to the location to restore its state.- Specified by:
createEmptyNavigationLocation
in interfaceorg.eclipse.ui.INavigationLocationProvider
- Returns:
- INavigationLocation
createNavigationLocation
public org.eclipse.ui.INavigationLocation createNavigationLocation()
Creates a navigation location describing the current state.- Specified by:
createNavigationLocation
in interfaceorg.eclipse.ui.INavigationLocationProvider
- Returns:
- INavigationLocation
onActivated
public final void onActivated(boolean on)
Called when activator or deactivated.- Specified by:
onActivated
in interfaceIActivationListener
createCommonViewer
public final CommonViewerEx createCommonViewer(org.eclipse.swt.widgets.Composite parent)
Creates the CommonViewer with extra support for Drag-and-Drop. The Tree Control gets an added focus listener to this instance as well as the viewer getting a post-selection listener.- Parameters:
parent
- The parent.- Returns:
- The common viewer registered as "com.iizigo.navigator".
createFilteredCommonViewer
public final FilteredCommonViewer createFilteredCommonViewer(org.eclipse.swt.widgets.Composite parent, IzFilter filter)
Creates the Filtered CommonViewer with extra support for Drag-and-Drop. The Tree Control gets an added focus listener to this instance as well as the viewer getting a post-selection listener.The tree is created with SWT.MULTI style.
- Parameters:
parent
- The parent.filter
- Filter.- Returns:
- The common viewer registered as "com.iizigo.navigator".
createFilteredCommonViewer
public final FilteredCommonViewer createFilteredCommonViewer(org.eclipse.swt.widgets.Composite parent, int style, IzFilter filter)
Creates the Filtered CommonViewer with extra support for Drag-and-Drop. The Tree Control gets an added focus listener to this instance as well as the viewer getting a post-selection listener.- Parameters:
parent
- The parent.style
- Tree SWT styles.filter
- Filter.- Returns:
- The common viewer registered as "com.iizigo.navigator".
onDragBegin
protected void onDragBegin()
Drag started.
onDragEnd
protected void onDragEnd()
Drag finished.
isDragging
public boolean isDragging()
Flag for dragging to postpone selection events until drag completes.- Specified by:
isDragging
in interfaceIDraggingFix
createMenu
protected void createMenu(org.eclipse.jface.viewers.Viewer viewer, IContextMenuContributor contributor)
Creates a menu that is used as a pop-up menu.
createMenu
protected void createMenu(org.eclipse.swt.widgets.Control control, IContextMenuContributorFormControl<org.eclipse.swt.widgets.Control> contributor)
Creates a menu that is used as a pop-up menu.
setFocus
public final void setFocus()
Sets focus to the Editor. Subclasses should extend this method.- Specified by:
setFocus
in interfaceorg.eclipse.ui.IWorkbenchPart
- Specified by:
setFocus
in classorg.eclipse.ui.part.WorkbenchPart
onSetFocus
protected void onSetFocus()
Called when set focus is called to override default processing. Override this method instead of the "final" setFocus method that can't be overridden (due to process of initialization errors, PartInitException, etc).
registerViewer
protected void registerViewer(org.eclipse.jface.viewers.StructuredViewer viewer, int index)
Registers a viewer for selection changes. This will cause a focus listener to this class as well as a post-selection-listener. This method is required to set fulfill the contract of the editor's SelectionProvider contract.- Parameters:
viewer
- The viewer.index
- The control index.
registerViewer
public void registerViewer(org.eclipse.jface.viewers.StructuredViewer viewer, int index, IContextMenuContributor contributor)
Registers a viewer for selection changes. This will cause a focus listener to this class as well as a post-selection-listener. This method is required to set fulfill the contract of the editor's SelectionProvider contract.- Parameters:
viewer
- The viewer.index
- The control index.contributor
- The context menu contributor, null for none.
setTargetViewer
public final void setTargetViewer(java.lang.Object viewer)
Sets the target viewer for e.g. add operations in order to make selection of the added properties at add, undo or redo.- Specified by:
setTargetViewer
in interfaceIPropUndoRedo
- Parameters:
viewer
- The CommonViewer, TreeViewer or TableViewer, or null for none.
getTargetViewer
public java.lang.Object getTargetViewer()
Gets the structured viewer (common, tree or table) used for the property operation (add, delete, etc).- Specified by:
getTargetViewer
in interfaceIPropUndoRedo
- Returns:
- The CommonViewer, TreeViewer or TableViewer, or null for none.
setBlockViewerFocus
public void setBlockViewerFocus(boolean block)
Blocks the target viewer from focus.- Specified by:
setBlockViewerFocus
in interfaceIPropertyEditorController
onComponentFocus
public void onComponentFocus(org.eclipse.swt.widgets.Control c)
Called by the workbench extension when focus is received.
gotoMarker
public void gotoMarker(org.eclipse.core.resources.IMarker marker)
Sets the cursor and selection state for an editor to reveal the position of the given marker.- Specified by:
gotoMarker
in interfaceorg.eclipse.ui.ide.IGotoMarker
- Parameters:
marker
- the marker
setFocus
protected int setFocus(PropCnr container, org.eclipse.jface.viewers.StructuredViewer viewer, IzFilter filter, PropertyEditor propertyEditor, GProp<?> property, int index, java.lang.String childName)
Attempts to set focus to the property in question based on a container, a viewer and a property editor. If successful, the viewer selects the property or its ancestor, the property editor has the focus to the edited property.This call should be made from the SWT thread.
- Parameters:
container
- The container.viewer
- A viewer.filter
- A filter instance for the viewer, null for none.propertyEditor
- The property editor.property
- The property to focus.index
- Index in multi-property, -1 for none.childName
- Name of child property or null.- Returns:
- -1=failed, 0=selection only, 1=selection+property.