Class TextEditorPositioner
- java.lang.Object
-
- com._1c.g5.v8.dt.common.ui.editors.TextEditorPositioner
-
public final class TextEditorPositioner extends Object
Utility methods to set position of givenIEditorPart
. Methods will extractITextEditor
from target givenIEditorPart
.- Restriction:
- This class is not intended to be sub-classed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber)
Positions the given editor to the given line number.static void
positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, boolean selectLine)
Positions the given editor to the given line number and, optionally, select a whole line.static void
positionEditor(org.eclipse.ui.IEditorPart editor, int offset, int length)
Positions the given editor to the given offset with the given length.static void
positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, String substring)
Positions the given editor to the given line number and select the given substring.static void
positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, String substring, int occurrenceIndex)
Positions the given editor to the given line number and select the given substring with the given occurrence index.
-
-
-
Method Detail
-
positionEditor
public static void positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber) throws org.eclipse.core.runtime.CoreException
Positions the given editor to the given line number.This is convenience method, fully equivalent to:
positionEditor(editor, lineNumber, true);
- Parameters:
editor
- the text editor to set position, cannot benull
lineNumber
- the line number to set position to, must be non-negative- Throws:
org.eclipse.core.runtime.CoreException
- if positioning fails for some reason
-
positionEditor
public static void positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, boolean selectLine) throws org.eclipse.core.runtime.CoreException
Positions the given editor to the given line number and, optionally, select a whole line.- Parameters:
editor
- the text editor to set position, cannot benull
lineNumber
- the line number to set position to, must be non-negativeselectLine
- whether need to select whole line- Throws:
org.eclipse.core.runtime.CoreException
- if positioning fails for some reason
-
positionEditor
public static void positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, String substring) throws org.eclipse.core.runtime.CoreException
Positions the given editor to the given line number and select the given substring. Does nothing if substring occurrence not found.This is convenience method, fully equivalent to:
positionEditor(editor, lineNumber, substring, 1);
- Parameters:
editor
- the text editor to set position, cannot benull
lineNumber
- the line number to set position tosubstring
- substring to select, cannot benull
- Throws:
org.eclipse.core.runtime.CoreException
- if positioning fails for some reason
-
positionEditor
public static void positionEditor(org.eclipse.ui.IEditorPart editor, int lineNumber, String substring, int occurrenceIndex) throws org.eclipse.core.runtime.CoreException
Positions the given editor to the given line number and select the given substring with the given occurrence index. Orrurrence indexes are1
-based.Does nothing, if occurrence occurencces not found or occurencces count less than
occurrenceIndex
.- Parameters:
editor
- the text editor to set position, cannot benull
lineNumber
- the line number to set position tosubstring
- substring to select, cannot benull
occurrenceIndex
- the index of the substring occurrence to select, must be positive- Throws:
org.eclipse.core.runtime.CoreException
- if positioning fails for some reason
-
positionEditor
public static void positionEditor(org.eclipse.ui.IEditorPart editor, int offset, int length)
Positions the given editor to the given offset with the given length.- Parameters:
editor
- the text editor to set position, cannot benull
offset
- the offset of the selectionlength
- the length of the selection
-
-