Class FormattedTextEditableView

  • All Implemented Interfaces:
    org.eclipse.ui.services.IDisposable

    public class FormattedTextEditableView
    extends FormattedTextViewFx
    View of formatted text where editing is allowed.
    • Constructor Detail

      • FormattedTextEditableView

        public FormattedTextEditableView​(javafx.embed.swt.FXCanvas canvas,
                                         String content,
                                         boolean makeActive,
                                         Runnable onContentLoaded,
                                         Consumer<String> onContentChanged,
                                         Runnable onSelectionChanged,
                                         IV8ProjectManager v8projectManager,
                                         IMdObjectByTypeProvider objectByTypeProvider,
                                         org.eclipse.emf.ecore.EObject context,
                                         Version version,
                                         IColorProvider colorProvider,
                                         IFontProvider fontProvider)
        Creates new editable view of formatted text.
        Parameters:
        canvas - the FXCanvas instance to which to attach this view, cannot be null
        content - initial formatted text content
        makeActive - flag to make the view active
        onContentLoaded - callback to be called when content has been loaded
        onContentChanged - callback to be called when editor content changed
        onSelectionChanged - callback to be called when editor selection changed
        v8projectManager - V8 project manager, cannot be null
        objectByTypeProvider - object by type provider, cannot be null
        context - context object which value to be edited, cannot be null
        version - current project version, cannot be null
        colorProvider - the color provider, cannot be null
        fontProvider - the font provider, cannot be null
    • Method Detail

      • setBold

        public void setBold()
        Sets bold font.
      • setContent

        public void setContent​(String content)
        Sets content.
        Parameters:
        content - the content.
      • setItalic

        public void setItalic()
        Sets italic font.
      • setUnderline

        public void setUnderline()
        Sets underline font.
      • isCurrentSelectionBold

        public boolean isCurrentSelectionBold()
        Returns whether current selection is bold.
        Returns:
        true if font under current selection is bold, false otherwise
      • isCurrentSelectionItalic

        public boolean isCurrentSelectionItalic()
        Returns whether current selection is italic.
        Returns:
        true if font under current selection is italic, false otherwise
      • isCurrentSelectionUnderline

        public boolean isCurrentSelectionUnderline()
        Returns whether current selection is bold.
        Returns:
        true if font under current selection is underlined, false otherwise
      • setFont

        public void setFont​(Font font)
        Sets specified font.
        Parameters:
        font - the font to set
      • getCurrentSelectionFont

        public Font getCurrentSelectionFont()
        Returns font under current selection.
        Returns:
        the font
      • increaseFontSize

        public void increaseFontSize()
        Increases font size.
      • decreaseFontSize

        public void decreaseFontSize()
        Decreases font size.
      • setBackgroundColor

        public void setBackgroundColor​(Color color)
        Sets background color.
        Parameters:
        color - the color to set
      • getCurrentSelectionBackgroundColor

        public Color getCurrentSelectionBackgroundColor()
        Returns background color under current selection.
        Returns:
        the background color
      • setTextColor

        public void setTextColor​(Color color)
        Sets text color.
        Parameters:
        color - the color to set
      • getCurrentSelectionTextColor

        public Color getCurrentSelectionTextColor()
        Returns text color under current selection.
        Returns:
        the text color
      • setHyperlink

        public void setHyperlink​(String hyperlink)
        Sets hyperlink.
        Parameters:
        hyperlink - the hyperlink to set
      • getCurrentSelectionHyperlink

        public String getCurrentSelectionHyperlink()
        Returns hyperlink under current selection.
        Returns:
        the hyperlink found or empty string if not
      • insertPicture

        public void insertPicture​(Picture picture)
        Inserts picture.
        Parameters:
        picture - the picture to insert
      • insertSymbol

        public void insertSymbol​(int symbolCodePoint)
        Inserts special symbol.
        Parameters:
        symbolCodePoint - the symbol's code point
      • insertSymbol

        public void insertSymbol​(String symbols)
        Inserts symbols.
        Parameters:
        symbols - the symbols for inserting, cannot be null
      • getContent

        public String getContent()
        Gets content of formatted string.
        Returns:
        content of formatted string, never null
      • setInitialContent

        protected void setInitialContent​(String html,
                                         Runnable onContentLoaded)
        Description copied from class: FormattedTextViewFx
        Sets HTML content to the view.
        Overrides:
        setInitialContent in class FormattedTextViewFx
        Parameters:
        html - the content to set
        onContentLoaded - the callback to be called when initial content has been loaded