public class DeclarationJoinLinesHandler extends java.lang.Object implements JoinLinesHandlerDelegate
CANNOT_JOIN, EP_NAME
Constructor and Description |
---|
DeclarationJoinLinesHandler() |
Modifier and Type | Method and Description |
---|---|
static PsiLocalVariable |
copyVarWithInitializer(PsiLocalVariable origVar,
PsiExpression initializer) |
static PsiExpression |
getInitializerExpression(PsiExpression initializer,
PsiAssignmentExpression assignment) |
static PsiExpression |
getInitializerExpression(PsiLocalVariable var,
PsiAssignmentExpression assignment)
Returns an updated initializer after joining with given assignment
|
static PsiLocalVariable |
joinDeclarationAndAssignment(PsiLocalVariable variable,
PsiAssignmentExpression assignment)
Join declaration and assignment
|
int |
tryJoinLines(Document document,
PsiFile file,
int start,
int end)
Tries to join lines at the specified position of the specified file.
|
public int tryJoinLines(Document document, PsiFile file, int start, int end)
JoinLinesHandlerDelegate
tryJoinLines
in interface JoinLinesHandlerDelegate
document
- where the lines arefile
- where the lines arestart
- offset where the whitespace between lines startsend
- offset where the whitespace between lines endsJoinLinesHandlerDelegate.CANNOT_JOIN
if this handler was not able
to perform the operation.public static PsiExpression getInitializerExpression(PsiLocalVariable var, PsiAssignmentExpression assignment)
var
- variable which initializer should be updatedassignment
- assignment to merge into the initializerpublic static PsiExpression getInitializerExpression(PsiExpression initializer, PsiAssignmentExpression assignment)
public static PsiLocalVariable copyVarWithInitializer(PsiLocalVariable origVar, PsiExpression initializer)
public static PsiLocalVariable joinDeclarationAndAssignment(PsiLocalVariable variable, PsiAssignmentExpression assignment)
variable
- variableassignment
- assignment (assuming its parent is expression statement)