Package com._1c.g5.v8.dt.bsl.ui.quickfix
Class BslQuickFixUtil
java.lang.Object
com._1c.g5.v8.dt.bsl.ui.quickfix.BslQuickFixUtil
Bsl quick fix utility/helper methods
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuildercomputeFormatLine(org.eclipse.jface.text.IDocument doc, org.eclipse.jface.text.IRegion lineInformation) Computes format line for theIDocumentandIRegionstatic voidcreateLinkedModeModelForMethod(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 forMethodstatic voidcreateLinkedModeModelForVariable(org.eclipse.xtext.ui.editor.model.IXtextDocument doc, org.eclipse.jface.text.ITextViewer viewer, int posDec, int posUse, int length) Creates linked mode model forVariablestatic StringcreateVariable(String declarationKeyword, String varName, String indent, String lineSeparator) Creates the variablestatic StringgetFormatString(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context, Method method) Provides the format string for the givenIXtextDocumentandMethodstatic org.eclipse.jface.text.ITextViewergetTextViewer(org.eclipse.xtext.ui.editor.model.edit.IModificationContext context) Provides theITextViewerfor givenIModificationContextstatic org.eclipse.xtext.ui.editor.model.IXtextDocumentgetXtextDocument(org.eclipse.emf.common.util.URI uri, org.eclipse.xtext.ui.editor.IURIEditorOpener editorOpener) Tries to open xtext document by URI.static voidselectAndRevealForLinkedModeModel(org.eclipse.jface.text.ITextViewer viewer, int posStart, int length) Processes selection changed event within theITextViewerstatic voidwriteToDoc(org.eclipse.xtext.ui.editor.model.IXtextDocument doc, int offset, String method) Writes the content into the document
-
Method Details
-
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 benulleditorOpener- 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 givenIXtextDocumentandMethod- Parameters:
context- the modification context, cannot benullmethod- 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 benullvarName- the variable name, cannot benullindent- the indentation string, cannot benulllineSeparator- 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 benulloffset- 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 benullviewer- the viewer, cannot benullposDec- 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 benullviewer- the viewer, cannot benullposDec- 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 theITextViewerfor 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 theIDocumentandIRegion- Parameters:
doc- the document, cannot benulllineInformation- the line info region, cannot benull- Returns:
StringBuilderwith 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 benullposStart- the start position of the selectionlength- the length of the selection
-