mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
@@ -377,8 +377,8 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx {
|
||||
@Override
|
||||
public void moveText(int srcStart, int srcEnd, int dstOffset) {
|
||||
assertBounds(srcStart, srcEnd);
|
||||
ProperTextRange srcRange = new ProperTextRange(srcStart, srcEnd);
|
||||
if (dstOffset == srcEnd) return;
|
||||
ProperTextRange srcRange = new ProperTextRange(srcStart, srcEnd);
|
||||
assert !srcRange.containsOffset(dstOffset) :
|
||||
String.format("Can't perform text move from range [%d; %d) to offset %d", srcStart, srcEnd, dstOffset);
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ public class CompositeElement extends TreeElement {
|
||||
final int len = getTextLength();
|
||||
|
||||
if (startStamp != myModificationsCount) {
|
||||
throw new AssertionError("Tree changed while calculating text. startStamp:"+startStamp+"; current:"+myModificationsCount+"; myHC:"+myHC+"; assertThreading:"+ASSERT_THREADING+"; Thread.holdsLock(START_OFFSET_LOCK):"+Thread.holdsLock(START_OFFSET_LOCK)+"; Thread.holdsLock(PSI_LOCK):"+Thread.holdsLock(PsiLock.LOCK));
|
||||
throw new AssertionError("Tree changed while calculating text. startStamp:"+startStamp+"; current:"+myModificationsCount+"; myHC:"+myHC+"; assertThreading:"+ASSERT_THREADING+"; Thread.holdsLock(START_OFFSET_LOCK):"+Thread.holdsLock(START_OFFSET_LOCK)+"; Thread.holdsLock(PSI_LOCK):"+Thread.holdsLock(PsiLock.LOCK)+"; this: " + this);
|
||||
}
|
||||
|
||||
char[] buffer = new char[len];
|
||||
|
||||
+5
-4
@@ -68,12 +68,13 @@ public abstract class StatementUpDownMover {
|
||||
public void afterMove(@NotNull final Editor editor, @NotNull final PsiFile file, @NotNull final MoveInfo info, final boolean down) {
|
||||
}
|
||||
|
||||
public static int getLineStartSafeOffset(final Document document, int line) {
|
||||
public static int getLineStartSafeOffset(@NotNull Document document, int line) {
|
||||
if (line == document.getLineCount()) return document.getTextLength();
|
||||
return document.getLineStartOffset(line);
|
||||
}
|
||||
|
||||
protected static LineRange getLineRangeFromSelection(final Editor editor) {
|
||||
@NotNull
|
||||
protected static LineRange getLineRangeFromSelection(@NotNull Editor editor) {
|
||||
final int startLine;
|
||||
final int endLine;
|
||||
final SelectionModel selectionModel = editor.getSelectionModel();
|
||||
@@ -93,7 +94,7 @@ public abstract class StatementUpDownMover {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected static Pair<PsiElement, PsiElement> getElementRange(Editor editor, PsiFile file, final LineRange range) {
|
||||
protected static Pair<PsiElement, PsiElement> getElementRange(@NotNull Editor editor, @NotNull PsiFile file, @NotNull LineRange range) {
|
||||
final int startOffset = editor.logicalPositionToOffset(new LogicalPosition(range.startLine, 0));
|
||||
PsiElement startingElement = firstNonWhiteElement(startOffset, file, true);
|
||||
if (startingElement == null) return null;
|
||||
@@ -112,7 +113,7 @@ public abstract class StatementUpDownMover {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected static PsiElement firstNonWhiteElement(int offset, PsiFile file, final boolean lookRight) {
|
||||
protected static PsiElement firstNonWhiteElement(int offset, @NotNull PsiFile file, final boolean lookRight) {
|
||||
final ASTNode leafElement = file.getNode().findLeafElementAt(offset);
|
||||
return leafElement == null ? null : firstNonWhiteElement(leafElement.getPsi(), lookRight);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user