public static class SurroundAutoCloseableAction.Template extends java.lang.Object implements SurroundDescriptor, Surrounder
EMPTY_ARRAY, myArrayFactory
Constructor and Description |
---|
Template() |
Modifier and Type | Method and Description |
---|---|
PsiElement [] |
getElementsToSurround(PsiFile file,
int startOffset,
int endOffset)
Returns the list of elements which will be included in the surrounded region for
the specified selection in the specified file, or an empty array if no surrounders
from this surround descriptor are applicable to the specified selection.
|
Surrounder [] |
getSurrounders()
Returns the list of surrounders (surround templates) which can be used for this
code fragment type.
|
java.lang.String |
getTemplateDescription()
Returns the user-visible name of the Surround With template.
|
boolean |
isApplicable(PsiElement [] elements)
Checks if the template can be used to surround the specified range of elements.
|
boolean |
isExclusive() |
TextRange |
surroundElements(Project project,
Editor editor,
PsiElement [] elements)
Performs the Surround With action on the specified range of elements.
|
public PsiElement [] getElementsToSurround(PsiFile file, int startOffset, int endOffset)
SurroundDescriptor
getElementsToSurround
in interface SurroundDescriptor
file
- the file where elements are to be surrounded.startOffset
- the selection start offset, with whitespaces skippedendOffset
- the selection end offset, with whitespaces skippedpublic Surrounder [] getSurrounders()
SurroundDescriptor
getSurrounders
in interface SurroundDescriptor
public boolean isExclusive()
isExclusive
in interface SurroundDescriptor
public java.lang.String getTemplateDescription()
Surrounder
getTemplateDescription
in interface Surrounder
public boolean isApplicable(PsiElement [] elements)
Surrounder
isApplicable
in interface Surrounder
elements
- the elements to be surroundedpublic TextRange surroundElements(Project project, Editor editor, PsiElement [] elements)
Surrounder
surroundElements
in interface Surrounder
project
- the project containing the elements.editor
- the editor in which the action is invoked.elements
- the elements to be surrounded.