Package com._1c.g5.v8.dt.bsl.ui.quickfix
Class BslQuickFixUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.ui.quickfix.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 StringBuilder
computeFormatLine(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.IRegion lineInformation)
Computes format line for theIDocument
andIRegion
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 forMethod
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 forVariable
static String
createVariable(String declarationKeyword, String varName, String indent, String lineSeparator)
Creates the variablestatic String
getFormatString(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context, Method method)
Provides the format string for the givenIXtextDocument
andMethod
static org.eclipse.jface.text.ITextViewer
getTextViewer(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context)
Provides theITextViewer
for givenIModificationContext
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
selectAndRevealForLinkedModeModel(org.eclipse.jface.text.ITextViewer viewer, int posStart, int length)
Processes selection changed event within theITextViewer
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 benull
editorOpener
- the editor opener service, cannot benull
- 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 givenIXtextDocument
andMethod
- Parameters:
context
- the modification context, cannot benull
method
- the method, cannot benull
- 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 benull
varName
- the variable name, cannot benull
indent
- the indentation string, cannot benull
lineSeparator
- the line separator, cannot benull
- 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 benull
offset
- the offsetmethod
- the method name, cannot benull
-
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 forVariable
- Parameters:
doc
- the document, cannot benull
viewer
- the viewer, cannot benull
posDec
- the declaration positionposUse
- the use positionlength
- 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 forMethod
- Parameters:
doc
- the document, cannot benull
viewer
- the viewer, cannot benull
posDec
- the declaration positionposUse
- the use positionlength
- the variable lengthparams
- the parameters, cannot benull
-
getTextViewer
public static org.eclipse.jface.text.ITextViewer getTextViewer(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context)
Provides theITextViewer
for givenIModificationContext
- Parameters:
context
- the modification context, cannot benull
- Returns:
- the
ITextViewer
, can benull
-
computeFormatLine
public static StringBuilder computeFormatLine(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.IRegion lineInformation) throws org.eclipse.jface.text.BadLocationException
Computes format line for theIDocument
andIRegion
- Parameters:
doc
- the document, cannot benull
lineInformation
- the line info region, cannot benull
- Returns:
StringBuilder
with contents of format line, nevernull
, can be empty- Throws:
org.eclipse.jface.text.BadLocationException
-
selectAndRevealForLinkedModeModel
public static void selectAndRevealForLinkedModeModel(org.eclipse.jface.text.ITextViewer viewer, int posStart, int length)
Processes selection changed event within theITextViewer
- Parameters:
viewer
- the viewer, cannot benull
posStart
- the start position of the selectionlength
- the length of the selection
-
-