Package com.iizigo.panel
Class PanelEditor
- 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.panel.PanelEditor
- All Implemented Interfaces:
IComplexOperationSelection
,IActivationListener
,IDraggingFix
,IWorkbenchPartIZ
,IPreviewThemeProvider
,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
public class PanelEditor extends PropEditorPart implements IComplexOperationSelection, IPreviewThemeProvider
The panel editor.- Author:
- Christopher Mindus
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PanelEditor.GridInfo
Class holding a grid layout and components or indexes for the grid operations.Nested classes/interfaces inherited from class com.iizigo.editor.PropEditorPart
PropEditorPart.DragSourceDelegator
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ID
The Part ID.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 PanelEditor()
The Eclipse constructor.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areStylesIncluded()
Returns if styles are displayed or not.static boolean
checkClearInternalBrowserCache(org.eclipse.jface.preference.IPreferenceStore store, boolean force)
Checks if clearing the browser cache is required due to a new iiziGo Build or a compression settings.static boolean
clearInternalBrowserCache(java.lang.String msg)
Clears the internal browser cache (IE under Windows).protected void
createEditorComposite(org.eclipse.swt.widgets.Composite parent)
Creates the Editor Main Composite.void
dispose()
Disposes of the Panel Editor.void
doComplexOperationSelection(GProp<?>[] props)
Performs the selection of the components.static void
doFlash(org.eclipse.swt.widgets.Composite composite, UIComp uiComp)
Performs flashing of a component in all open editors.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.java.lang.String
getCurrentLanguageCode()
Gets the current language code.int
getDropMode()
Gets the current drop mode: 0 = Horizontal insert, 1 = Vertical insert, 2 = Horizontal overwrite, 3 = Horizontal overwrite wrapping, 4 = Vertically overwrite.UIPanelBase
getEditedPanel()
Gets the edited panel.java.util.ArrayList<DesignerProp>
getMarkedComponents()
Gets the selection of marks for drag-drop.java.lang.String
getThemes()
Gets the theme information for the current editor used for the image preview.FilteredCommonViewer
getTreeViewer()
Returns the tree viewer for the panel editor.EditorVirtualSpace
getVirtualSpace()
Gets the VirtualSpace of the edited panel.protected void
initEditor(PropCnr cnr)
The initialize editor method.void
onClose()
Called when the part is being closed but is not yet disposed but hidden.protected void
onEditedPropertyChangedForVerify(GEvent event)
Called when verification listener gets called for verify, very commonly in a non-SWT thread.void
onFolderSettingsChanged()
Called when the folder settings are changed.void
onSetFocus()
Asks this part to take focus within the workbench.protected void
onUpdateStates()
Called just in the beginning of updateStates() before selections are processed.boolean
performClearCells(boolean useComponentSelection, boolean doit)
Clears cells in a grid.protected boolean
performCopyFullPath(boolean doPerform)
Copies the full path.protected boolean
performCopyReference(boolean doPerform)
Copies the reference.boolean
performDeleteColumn(boolean useComponentSelection, boolean doit)
Delete column.boolean
performDeleteRow(boolean useComponentSelection, boolean doit)
Delete row.boolean
performInsertColumn(boolean isAfter, boolean useComponentSelection, boolean doit)
Inserts a column before or after.boolean
performInsertRow(boolean isAfter, boolean useComponentSelection, boolean doit)
Inserts a row before or after.void
performPasteAfter()
Performs Paste Before.void
performPasteBefore()
Performs Paste Before.protected void
performPrint()
Print the window.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.void
setDevice(GSimpleDevice dev)
Sets the device to use in the panel editor without undo functionality.void
setFitNow()
Sets the fit-now zoom level.void
setIncludeStyles(boolean on)
Enables or disables viewing of styles.boolean
setTreeSelection(GProp<?> prop)
Sets the tree selection to the property in question.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.protected void
updateStatesEx()
Called to update the states.protected void
updateStatesPasteBeforeAfter()
Initializes the paste before/after validity.protected boolean
usePasteBeforeAfter()
Processing of paste before/after is enabled.void
waitForClientSideEditor()
Checks if the browser is internal, and if so waits for the ClientSideEditor to start.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, onEditorActivated, onEditorReady, onFileClosed, onPartRenamed, performCollapseAll, performCopy, performCut, performDelete, performExpandAll, performLink, performMove, performPaste, 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, updateAllStates, updateStates, 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.editor.complex.IComplexOperationSelection
getSelectionBefore, isDisposed, isReturningSelectionBeforeOperation
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, removePropertyListener
Methods inherited from interface com.iizigo.editor.IWorkbenchPartIZ
onComponentFocused
Method Detail
checkClearInternalBrowserCache
public static boolean checkClearInternalBrowserCache(org.eclipse.jface.preference.IPreferenceStore store, boolean force)
Checks if clearing the browser cache is required due to a new iiziGo Build or a compression settings.- Parameters:
store
- The preference store.force
- For clearing flag.- Returns:
- true if cache was cleared, false otherwise.
clearInternalBrowserCache
public static final boolean clearInternalBrowserCache(java.lang.String msg)
Clears the internal browser cache (IE under Windows).- Parameters:
msg
- Message to log in case of success.- Returns:
- true if cleared, false otherwise.
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.
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
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.
getEditedPanel
public UIPanelBase getEditedPanel()
Gets the edited panel.
dispose
public void dispose()
Disposes of the Panel Editor.- Specified by:
dispose
in interfaceorg.eclipse.ui.IWorkbenchPart
- Overrides:
dispose
in classPropEditorPart
onUpdateStates
protected void onUpdateStates()
Called just in the beginning of updateStates() before selections are processed. Override as required.- Overrides:
onUpdateStates
in classPropEditorPart
onSetFocus
public void onSetFocus()
Asks this part to take focus within the workbench. Parts must assign focus to one of the controls contained in the part's parent composite.- Overrides:
onSetFocus
in classPropEditorPart
usePasteBeforeAfter
protected boolean usePasteBeforeAfter()
Processing of paste before/after is enabled.- Overrides:
usePasteBeforeAfter
in classPropEditorPart
- Returns:
- true to handle before/after.
updateStatesPasteBeforeAfter
protected void updateStatesPasteBeforeAfter()
Initializes the paste before/after validity.- Overrides:
updateStatesPasteBeforeAfter
in classPropEditorPart
performPasteBefore
public void performPasteBefore()
Performs Paste Before.- Overrides:
performPasteBefore
in classPropEditorPart
performPasteAfter
public void performPasteAfter()
Performs Paste Before.- Overrides:
performPasteAfter
in classPropEditorPart
supportsCopyReference
protected boolean supportsCopyReference()
Returns if the Copy reference should be present or not.- Overrides:
supportsCopyReference
in classPropEditorPart
- 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.- Overrides:
supportsCopyFullPath
in classPropEditorPart
- Returns:
- false indicates no such item should be present, true for maybe, depending on selection.
performCopyReference
protected boolean performCopyReference(boolean doPerform)
Copies the reference.- Overrides:
performCopyReference
in classPropEditorPart
- 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.- Overrides:
performCopyFullPath
in classPropEditorPart
- Parameters:
doPerform
- Flag to perform the action or just testing it.- Returns:
- true for action enabled, false for disabled.
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.- Overrides:
onEditedPropertyChangedForVerify
in classPropEditorPart
onFolderSettingsChanged
public void onFolderSettingsChanged()
Called when the folder settings are changed. This may result in a change of themes.
getThemes
public java.lang.String getThemes()
Gets the theme information for the current editor used for the image preview. Currently this consists of the desktop and mobile themes separated by commas.- Specified by:
getThemes
in interfaceIPreviewThemeProvider
- Returns:
- String consisting of the themes separated by commas, empty string means no theme (e.g. no mobile theme).
setDevice
public void setDevice(GSimpleDevice dev)
Sets the device to use in the panel editor without undo functionality.- Parameters:
dev
- The device to use.
waitForClientSideEditor
public void waitForClientSideEditor()
Checks if the browser is internal, and if so waits for the ClientSideEditor to start. This operation should be done outside of the main UI thread. If the panel editor is external, no waiting is done. The maximum time to wait is 20 seconds.
setFitNow
public void setFitNow()
Sets the fit-now zoom level.
getDropMode
public int getDropMode()
Gets the current drop mode:- 0 = Horizontal insert,
- 1 = Vertical insert,
- 2 = Horizontal overwrite,
- 3 = Horizontal overwrite wrapping,
- 4 = Vertically overwrite.
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.
setIncludeStyles
public void setIncludeStyles(boolean on)
Enables or disables viewing of styles.
areStylesIncluded
public boolean areStylesIncluded()
Returns if styles are displayed or not.
getTreeViewer
public FilteredCommonViewer getTreeViewer()
Returns the tree viewer for the panel editor.
selectionChangedEx
protected void selectionChangedEx(org.eclipse.jface.viewers.SelectionChangedEvent event)
Selection changes in the tree.- Overrides:
selectionChangedEx
in classPropEditorPart
getMarkedComponents
public java.util.ArrayList<DesignerProp> getMarkedComponents()
Gets the selection of marks for drag-drop.
doComplexOperationSelection
public void doComplexOperationSelection(GProp<?>[] props)
Performs the selection of the components.- Specified by:
doComplexOperationSelection
in interfaceIComplexOperationSelection
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.- 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.
performPrint
protected void performPrint()
Print the window.- Specified by:
performPrint
in classPropEditorPart
performInsertRow
public boolean performInsertRow(boolean isAfter, boolean useComponentSelection, boolean doit)
Inserts a row before or after.
performInsertColumn
public boolean performInsertColumn(boolean isAfter, boolean useComponentSelection, boolean doit)
Inserts a column before or after.
performDeleteRow
public boolean performDeleteRow(boolean useComponentSelection, boolean doit)
Delete row.
performDeleteColumn
public boolean performDeleteColumn(boolean useComponentSelection, boolean doit)
Delete column.
performClearCells
public boolean performClearCells(boolean useComponentSelection, boolean doit)
Clears cells in a grid.
doFlash
public static void doFlash(org.eclipse.swt.widgets.Composite composite, UIComp uiComp)
Performs flashing of a component in all open editors.
setTreeSelection
public boolean setTreeSelection(GProp<?> prop)
Sets the tree selection to the property in question. The first DesignerProp instance found is used.Note that this must be called from the SWT thread.
- Parameters:
prop
- The property to select.- Returns:
- true For success, false for failure.
getVirtualSpace
public EditorVirtualSpace getVirtualSpace()
Gets the VirtualSpace of the edited panel. If not yet assigned, a question will be asked to create a new VirtualSpace or assign an existing VirtualSpace.- Returns:
- The VirtualSpace, or null for none (user canceled operation).
getCurrentLanguageCode
public java.lang.String getCurrentLanguageCode()
Gets the current language code.- Returns:
- The language code, or null for default.