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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BslCommentUiUtils.TemplateDescription
Contains information about created templates for comment in BSL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 nodestatic 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.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 onMethod
.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 onMethod
.static String
createTemplateTextForMethod(Method method, String descr, String lineFormatter, String indent, TypesComputer typesComputer, IV8ProjectManager v8projectManager, BslMultiLineCommentDocumentationProvider commentProvider, boolean oldFormat, boolean isRussian)
Creates template based onMethod
static BslDocumentationProvider.DocumentContent
parseTemplateComment(List<String> template, Method method, BslDocumentationProvider documentation, boolean oldFormat)
Parses comment for method.
-
-
-
Method Detail
-
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 createLinkedPosition
, can't benull
posInsert
- supposed position of the template insertingmethod
- method in BSL, may benull
isFunc
- true, if need template for function, false - for procedurelineFormatter
- actual format string, can't benull
indent
- actual text editor indent, can't benull
lang
- actual script variant, can't benull
v8projectManager
- theIV8ProjectManager
, can't benull
oldFormat
-true
if comment should be in old format,false
in new format- Returns:
- description of created template
BslCommentUiUtils.TemplateDescription
, nevernull
-
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 onMethod
.- Parameters:
doc
- needs to createLinkedPosition
, can't benull
posInsert
- supposed position of the template insertingmethod
- method in BSL, can't benull
lineFormatter
- actual format string, can't benull
indent
- actual text editor indent, can't benull
typesComputer
- actualTypesComputer
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
, can't benull
v8projectManager
-IV8ProjectManager
, can't benull
oldFormat
-true
if comment should be in old format,false
in new format- Returns:
- description of created template
BslCommentUiUtils.TemplateDescription
, nevernull
-
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 onMethod
.- Parameters:
doc
- needs to createLinkedPosition
, can't benull
posInsert
- supposed position of the template insertingmethod
- method in BSL, can't benull
lineFormatter
- actual format string, can't benull
indent
- actual text editor indent, can't benull
typesComputer
- actualTypesComputer
, cannot benull
commentProvider
- actualBslMultiLineCommentDocumentationProvider
, can't benull
v8projectManager
-IV8ProjectManager
, can't benull
oldFormat
-true
if comment should be in old format,false
in new format- Returns:
- description of created template
BslCommentUiUtils.TemplateDescription
, nevernull
-
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 onMethod
- Parameters:
method
- method in BSL, can't benull
descr
- comment main description? cannot benull
lineFormatter
- actual format string, can't benull
indent
- actual text editor indent, can't benull
typesComputer
- actualTypesComputer
, cannot benull
v8projectManager
-IV8ProjectManager
, can't benull
oldFormat
-true
if comment should be in old format,false
in new formatisRussian
-true
if keywords in comment should be in Russian language,false
in English- Returns:
- string content of the created comment, never
null
-
parseTemplateComment
public static BslDocumentationProvider.DocumentContent parseTemplateComment(List<String> template, Method method, BslDocumentationProvider documentation, boolean oldFormat)
Parses comment for method.- Parameters:
template
- comment content by lines, cannot benull
method
- corresponding Bsl method, cannot benull
documentation
- needs for getting English name ofTypes
, cannot benull
oldFormat
-true
if comment should be in old format,false
in new format- Returns:
- content of the comment, 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 benull
globalOffSet
- global offset of the position comment part in documentfirstDocumentNode
- first node of the comment content, cannot benull
- Returns:
- line number - current line number from the beginin comment content
- local offset - offset on the line in comment
- line content - whole line comment content
null
in caseglobalOffSet
or position ofcommentStartNode
is a non-existing position for document
-
-