Class BslQuickFixUtil


  • public final class BslQuickFixUtil
    extends Object
    Bsl quick fix utility/helper methods
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createLinkedModeModelForMethod​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc, org.eclipse.jface.text.ITextViewer viewer, int posDec, int posUse, int length, org.eclipse.jface.text.link.LinkedPosition[] params)
      Creates linked mode model for Method
      static void createLinkedModeModelForVariable​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc, org.eclipse.jface.text.ITextViewer viewer, int posDec, int posUse, int length)
      Creates linked mode model for Variable
      static String createVariable​(String declarationKeyword, String varName, String indent, String lineSeparator)
      Creates the variable
      static String getFormatString​(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context, Method method)
      Provides the format string for the given IXtextDocument and Method
      static org.eclipse.jface.text.ITextViewer getTextViewer​(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context)
      Provides the ITextViewer for given IModificationContext
      static org.eclipse.xtext.ui.editor.model.IXtextDocument getXtextDocument​(org.eclipse.emf.common.util.URI uri, org.eclipse.xtext.ui.editor.IURIEditorOpener editorOpener)
      Tries to open xtext document by URI.
      static void writeToDoc​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc, int offset, String method)
      Writes the content into the document
    • Method Detail

      • getXtextDocument

        public static org.eclipse.xtext.ui.editor.model.IXtextDocument getXtextDocument​(org.eclipse.emf.common.util.URI uri,
                                                                                        org.eclipse.xtext.ui.editor.IURIEditorOpener editorOpener)
        Tries to open xtext document by URI. It does two trials to open the right document since e.g. for form modules the first opened document is form editor
        Parameters:
        uri - the URI, cannot be null
        editorOpener - the editor opener service, cannot be null
        Returns:
        the document, can be null
      • getFormatString

        public static String getFormatString​(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context,
                                             Method method)
                                      throws org.eclipse.jface.text.BadLocationException
        Provides the format string for the given IXtextDocument and Method
        Parameters:
        context - the modification context, cannot be null
        method - the method, cannot be null
        Returns:
        format string, never null
        Throws:
        org.eclipse.jface.text.BadLocationException
      • createVariable

        public static String createVariable​(String declarationKeyword,
                                            String varName,
                                            String indent,
                                            String lineSeparator)
        Creates the variable
        Parameters:
        declarationKeyword - the declaration keyword, cannot be null
        varName - the variable name, cannot be null
        indent - the indentation string, cannot be null
        lineSeparator - the line separator, cannot be null
        Returns:
        created variable name, nevr null
      • writeToDoc

        public static void writeToDoc​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc,
                                      int offset,
                                      String method)
        Writes the content into the document
        Parameters:
        doc - the document, cannot be null
        offset - the offset
        method - the method name, cannot be null
      • createLinkedModeModelForVariable

        public static void createLinkedModeModelForVariable​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc,
                                                            org.eclipse.jface.text.ITextViewer viewer,
                                                            int posDec,
                                                            int posUse,
                                                            int length)
        Creates linked mode model for Variable
        Parameters:
        doc - the document, cannot be null
        viewer - the viewer, cannot be null
        posDec - the declaration position
        posUse - the use position
        length - the variable length
      • createLinkedModeModelForMethod

        public static void createLinkedModeModelForMethod​(org.eclipse.xtext.ui.editor.model.IXtextDocument doc,
                                                          org.eclipse.jface.text.ITextViewer viewer,
                                                          int posDec,
                                                          int posUse,
                                                          int length,
                                                          org.eclipse.jface.text.link.LinkedPosition[] params)
        Creates linked mode model for Method
        Parameters:
        doc - the document, cannot be null
        viewer - the viewer, cannot be null
        posDec - the declaration position
        posUse - the use position
        length - the variable length
        params - the parameters, cannot be null
      • getTextViewer

        public static org.eclipse.jface.text.ITextViewer getTextViewer​(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context)
        Provides the ITextViewer for given IModificationContext
        Parameters:
        context - the modification context, cannot be null
        Returns:
        the ITextViewer, can be null