Class BslCommentUiUtils

java.lang.Object
com._1c.g5.v8.dt.bsl.ui.contentassist.BslCommentUiUtils

public final class BslCommentUiUtils extends Object
Contains method for working with comment template in BSL
Restriction:
This class is not intended to be sub-classed by clients.
  • Method Details

    • createEmptyTemplate

      public static BslCommentUiUtils.TemplateDescription createEmptyTemplate(org.eclipse.jface.text.IDocument doc, int posInsert, Method method, boolean isFunc, String lineFormatter, String indent, ScriptVariant lang, IV8ProjectManager v8projectManager, boolean oldFormat)
      Create comment template for method in BSL.
      Parameters:
      doc - needs to create LinkedPosition, can't be null
      posInsert - supposed position of the template inserting
      method - method in BSL, may be null
      isFunc - true, if need template for function, false - for procedure
      lineFormatter - actual format string, can't be null
      indent - actual text editor indent, can't be null
      lang - actual script variant, can't be null
      v8projectManager - the IV8ProjectManager, can't be null
      oldFormat - true if comment should be in old format, false in new format
      Returns:
      description of created template BslCommentUiUtils.TemplateDescription, never null
    • createTemplateForMethod

      public static BslCommentUiUtils.TemplateDescription createTemplateForMethod(org.eclipse.jface.text.IDocument doc, int posInsert, Method method, String lineFormatter, String indent, TypesComputer typesComputer, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8projectManager, boolean oldFormat)
      Creates template based on Method.
      Parameters:
      doc - needs to create LinkedPosition, can't be null
      posInsert - supposed position of the template inserting
      method - method in BSL, can't be null
      lineFormatter - actual format string, can't be null
      indent - actual text editor indent, can't be null
      typesComputer - actual TypesComputer, cannot be null
      commentProvider - actual BslMultiLineCommentDocumentationProvider, can't be null
      v8projectManager - IV8ProjectManager, can't be null
      oldFormat - true if comment should be in old format, false in new format
      Returns:
      description of created template BslCommentUiUtils.TemplateDescription, never null
    • createOrUpdateTemplateForMethod

      public static BslCommentUiUtils.TemplateDescription createOrUpdateTemplateForMethod(org.eclipse.jface.text.IDocument doc, int posInsert, Method method, String lineFormatter, String indent, TypesComputer typesComputer, BslMultiLineCommentDocumentationProvider commentProvider, IV8ProjectManager v8projectManager, boolean oldFormat)
      Creates or update template based on Method.
      Parameters:
      doc - needs to create LinkedPosition, can't be null
      posInsert - supposed position of the template inserting
      method - method in BSL, can't be null
      lineFormatter - actual format string, can't be null
      indent - actual text editor indent, can't be null
      typesComputer - actual TypesComputer, cannot be null
      commentProvider - actual BslMultiLineCommentDocumentationProvider, can't be null
      v8projectManager - IV8ProjectManager, can't be null
      oldFormat - true if comment should be in old format, false in new format
      Returns:
      description of created template BslCommentUiUtils.TemplateDescription, never null
    • createTemplateTextForMethod

      public static String createTemplateTextForMethod(Method method, String descr, String lineFormatter, String indent, TypesComputer typesComputer, IV8ProjectManager v8projectManager, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormat, boolean isRussian)
      Creates template based on Method
      Parameters:
      method - method in BSL, can't be null
      descr - comment main description? cannot be null
      lineFormatter - actual format string, can't be null
      indent - actual text editor indent, can't be null
      typesComputer - actual TypesComputer, cannot be null
      v8projectManager - IV8ProjectManager, can't be null
      oldFormat - true if comment should be in old format, false in new format
      isRussian - true if keywords in comment should be in Russian language, false in English
      Returns:
      string content of the created comment, never null
    • parseParameterDocComment

      public static ParameterLikeBslDocumentationPage parseParameterDocComment(List<String> template, FormalParam formalParam, boolean oldFormat, Method method, BslDocumentationProvider docProvider, Version version, org.eclipse.emf.ecore.EObject modelObject, Integer offset, BslDocumentationLocale locale, String link)
      Parses documentation comment of the method parameter. Parses its description and types then returns its as ValueContent
      Parameters:
      template - list of comment strings. Never null
      formalParam - formal parameter model object. Never null
      oldFormat - true if used old doccumentation comments format, false otherwise
      method - method model object. Never null
      docProvider - Built-in language documentation provider. Never null
      version - version. Never null
      modelObject - context object whih contains right resource refer to module. Never null
      offset - offset of the param. May be null
      locale - Bult-in documentation locale. Never null
      link - link to the parameter page. May be null
      Returns:
      content of the comment, never null
    • parseTemplateComment

      public static MethodLikeBslDocumentationPage parseTemplateComment(List<String> template, Method method, BslDocumentationProvider documentation, boolean oldFormat, BslDocumentationLocale locale, Version version, TypesComputer computerTypes, org.eclipse.emf.ecore.EObject modelObject, String link)
      Parses comment for method.
      Parameters:
      template - comment content by lines, cannot be null
      method - corresponding Built-in language method, cannot be null
      documentation - , cannot be null
      oldFormat - true if comment should be in old format, false in new format
      locale - Built-in documentation locale, cannot be null
      version - version of the method project, cannot be null
      computerTypes - computer of types, cannot be null
      modelObject - context object whih contains right resource refer to module, cannot be null
      link - link to the page. Never null
      Returns:
      method page. Never null
    • computeCommentLocalPosition

      public static org.eclipse.xtext.util.Triple<Integer,Integer,String> computeCommentLocalPosition(org.eclipse.jface.text.IDocument document, int globalOffSet, org.eclipse.xtext.nodemodel.INode commentStartNode)
      Computes local offset on the comment line by global offset and start comment node
      Parameters:
      document - actual document, cannot be null
      globalOffSet - global offset of the position comment part in document
      firstDocumentNode - first node of the comment content, cannot be null
      Returns:
      • line number - current line number from the beginning comment content
      • local offset - offset on the line in comment
      • line content - whole line comment content
      can return null in case globalOffSet or position of commentStartNode is a non-existing position for document