Class PanelEditor

All Implemented Interfaces:
IComplexOperationSelection, IActivationListener, IDraggingFix, IWorkbenchPartIZ, IPreviewThemeProvider, IPropertyEditorController, IPropUndoContext, IDisposedPart, IPropUndoRedo, IAdaptable, IExecutableExtension, ISelectionChangedListener, ISelectionProvider, IGotoMarker, IEditorPart, INavigationLocationProvider, IPersistable, IPersistableEditor, ISaveablePart, ISaveablesSource, IWorkbenchPart, IWorkbenchPart2, IWorkbenchPart3, IWorkbenchPartOrientation

public class PanelEditor extends PropEditorPart implements IComplexOperationSelection, IPreviewThemeProvider
The panel editor.
Author:
Christopher Mindus
  • Field Details

    • ID

      public static final String ID
      The Part ID.
  • Constructor Details

    • PanelEditor

      public PanelEditor()
      The Eclipse constructor.
  • Method Details

    • initEditor

      protected void initEditor(PropCnr cnr) throws PartInitException
      The initialize editor method.

      Subclasses may override this method.

      Overrides:
      initEditor in class PropEditorPart
      Parameters:
      cnr - The property container being edited. Note: the real name of the property is in the parent FilePropCnr Atom.
      Throws:
      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 interface IActivationListener
      Overrides:
      onClose in class PropEditorPart
    • saveStateImpl

      protected void saveStateImpl(IMemento memento)
      Saves the state.
      Overrides:
      saveStateImpl in class PropEditorPart
      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 interface IWorkbenchPart
      Overrides:
      dispose in class PropEditorPart
    • onUpdateStates

      protected void onUpdateStates()
      Called just in the beginning of updateStates() before selections are processed. Override as required.
      Overrides:
      onUpdateStates in class PropEditorPart
    • 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 class PropEditorPart
    • usePasteBeforeAfter

      protected boolean usePasteBeforeAfter()
      Processing of paste before/after is enabled.
      Overrides:
      usePasteBeforeAfter in class PropEditorPart
      Returns:
      true to handle before/after.
    • updateStatesPasteBeforeAfter

      protected void updateStatesPasteBeforeAfter()
      Initializes the paste before/after validity.
      Overrides:
      updateStatesPasteBeforeAfter in class PropEditorPart
    • performPasteBefore

      public void performPasteBefore()
      Performs Paste Before.
      Overrides:
      performPasteBefore in class PropEditorPart
    • performPasteAfter

      public void performPasteAfter()
      Performs Paste Before.
      Overrides:
      performPasteAfter in class PropEditorPart
    • supportsCopyReference

      protected boolean supportsCopyReference()
      Returns if the Copy reference should be present or not.
      Overrides:
      supportsCopyReference in class PropEditorPart
      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 class PropEditorPart
      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 class PropEditorPart
      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 class PropEditorPart
      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 class PropEditorPart
    • onFolderSettingsChanged

      public void onFolderSettingsChanged()
      Called when the folder settings are changed. This may result in a change of themes.
    • getScheme

      public String getScheme()
      Gets the theme scheme of the current editor: the shipped theme family and the mode the Designer pages preview.
      Returns:
      The scheme as "family/mode", e.g. "iizi/light".
    • getThemes

      public 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 interface IPreviewThemeProvider
      Returns:
      String consisting of the themes separated by commas, empty string means no theme (e.g. no mobile theme).
    • initialDesktopTheme

      public static String initialDesktopTheme(GThemes themes, String saved, String last)
      Gets the desktop theme a panel opens in (CC-FIX-DESIGNER-ISSUES-1025, row 8): the theme its editor properties saved; else the last theme used in an editor when the panel's themes allow it; else the panel's prioritized desktop theme. A panel never opened in the Designer (ServerAdmin's mailDesktop, written by hand) has saved no theme and opened in whatever the previous editor showed - dbootstrap after a details dialog - although its themes name flat alone: its header part drew in the wrong skin until the theme was switched by hand.
      Parameters:
      themes - The panel's themes (UIPanelBase.getThemes()), null for none configured.
      saved - The desktop theme the panel's editor properties saved, null for none.
      last - The last desktop theme used in an editor.
      Returns:
      The theme name to open the panel in.
    • 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.
    • coverDesigner

      public PanelEditor.DesignerCoverHandle coverDesigner(String message, int timeoutMs)
      Covers the design view with an opaque cover in the widget background colour showing a frozen, dimmed snapshot of the current page (when the page can be captured) and a message, for as long as Java needs the JavaScript designer to stay stable during longer processing. The cover blocks the USER, not the page: the Browser stays visible and full-size underneath, so its timers and transactions keep running. Mouse input is taken by the cover being on top; the keyboard focus is moved to the cover and given back to the previously focused control at the last uncover.

      Covers are counted: nested calls show the newest message, and the cover is removed when the last handle is released. Each handle has its own timeout; on expiry the cover is removed with a WARNING naming the message, so the user is never left looking at a covered designer. An external Browser cannot be covered: the call is then a no-op that logs FINE.

      Parameters:
      message - The message to show, e.g. "Refreshing Panel Designer...".
      timeoutMs - The time in milliseconds after which the cover is removed whatever happens.
      Returns:
      The handle to release with uncoverDesigner(DesignerCoverHandle), never null.
    • uncoverDesigner

      public void uncoverDesigner(PanelEditor.DesignerCoverHandle handle)
      Releases a designer cover handle. The cover is removed when the last handle is released. Releasing null, a released handle or a stale one is harmless.
      Parameters:
      handle - The handle from coverDesigner(String,int), or null.
    • createEditorComposite

      protected void createEditorComposite(Composite parent)
      Creates the Editor Main Composite.
      Specified by:
      createEditorComposite in class PropEditorPart
      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(SelectionChangedEvent event)
      Selection changes in the tree.
      Overrides:
      selectionChangedEx in class PropEditorPart
    • getMarkedComponents

      public 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 interface IComplexOperationSelection
    • updateStatesEx

      protected void updateStatesEx()
      Called to update the states.
      Overrides:
      updateStatesEx in class PropEditorPart
    • doOpen

      public boolean doOpen(GProp<?>[] props)
      Opens the property by selecting it in focus.
      Overrides:
      doOpen in class PropEditorPart
    • doOpen

      public boolean doOpen(GProp<?> prop, int index, String childName)
      Opens the property by selecting it in focus.
      Overrides:
      doOpen in class PropEditorPart
      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 class PropEditorPart
    • 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(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 String getCurrentLanguageCode()
      Gets the current language code.
      Returns:
      The language code, or null for default.