Class QlEditor

  • All Implemented Interfaces:
    org.eclipse.core.runtime.IAdaptable

    public class QlEditor
    extends Object
    implements org.eclipse.core.runtime.IAdaptable
    QL text editor
    • Constructor Detail

      • QlEditor

        public QlEditor​(org.eclipse.core.resources.IProject project,
                        org.eclipse.swt.widgets.Composite parent,
                        ExpressionEditingType editingType,
                        boolean dcsMode,
                        boolean formatOnInit)
        Parameters:
        project - context project
        parent - parent composite
        editingType - - editing type
        dcsMode - - ql editor for dcs
    • Method Detail

      • getAdapter

        public Object getAdapter​(Class adapter)
        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
      • getContextProject

        public org.eclipse.core.resources.IProject getContextProject()
        Get context project
        Returns:
        the contextProject
      • getEmbeddedQlEditor

        public org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor getEmbeddedQlEditor()
        Get QL editor
        Returns:
        the embeddedQlEditor
      • setEditableExpression

        public void setEditableExpression​(org.eclipse.core.resources.IProject context,
                                          QuerySchemaOperator operator,
                                          Object editedObject,
                                          QueryWizardSource source)
        Initialization editor by edited object
        Parameters:
        context - project
        operator - operator
        editedObject - - edited object
        source - - query wizard source
      • isTextChanged

        public boolean isTextChanged()
        Was text change?
        Returns:
        true if yes
      • setInitCaretPosition

        public void setInitCaretPosition​(int position)
        Set caret position on editor init
        Parameters:
        init - caret position
      • setFullText

        public void setFullText​(String queryText)
        Initialization editor by edited text
        Parameters:
        queryText - text for editing
      • insertText

        public void insertText​(String text)
        Insert text into text editor
        Parameters:
        pos - position for insert. If -1, text will be insert in current cursor position
        text - inserting text
      • getSelectedText

        public String getSelectedText()
        Get selected text
        Returns:
        text
      • setEditable

        public void setEditable​(boolean isEditable)
        Sets the editable state.
        Parameters:
        isEditable - - is editable
      • isEditable

        public boolean isEditable()
        Is editable
        Returns:
        is editable
      • getText

        public String getText()
        Get editable text
        Returns:
        query text
      • getEditableObject

        public org.eclipse.emf.ecore.EObject getEditableObject()
        Get an editable object
        Returns:
        editable object. Can return null if EObject not found
      • getParent

        public org.eclipse.swt.widgets.Composite getParent()
        Get parent
        Returns:
        parent composite
      • validate

        public String validate()
        Receive errors in editable text
        Returns:
        text with errors
      • validate

        public String validate​(boolean onlyCritical,
                               boolean addLinesNumbers)
        Receive errors in editable text
        Parameters:
        onlyCritical - - check only critical errors
        addLinesNumbers - - add line numbers with errors into error message
        Returns:
        message with errors or null
      • format

        public void format()
        Format text
      • addFocusLostListener

        public void addFocusLostListener​(org.eclipse.jface.action.Action action)
        Add focus lost listener. Run given action after focus lost
        Parameters:
        action - - action for running after focus lost
      • addFocusGainedListener

        public void addFocusGainedListener​(org.eclipse.jface.action.Action action)
        Add focus gained listener. Run given action after focus gained
        Parameters:
        action - - action for running after focus gained
      • setIgnoreFocusListeners

        public void setIgnoreFocusListeners​(boolean isIgnore)
        Set ignore for focus listeners
        Parameters:
        isIgnore - - is need ignore focus listeners
      • getSelectedQueryText

        public String getSelectedQueryText()
      • getCaretOffsetFromSelectionBegin

        public int getCaretOffsetFromSelectionBegin()