This commit is contained in:
Alexey Kudravtsev
2012-12-19 13:41:07 +04:00
parent 50fe0ec58d
commit 2c74eadae3
3 changed files with 16 additions and 15 deletions
@@ -88,6 +88,7 @@ import gnu.trove.TIntArrayList;
import gnu.trove.TIntHashSet;
import gnu.trove.TIntIntHashMap;
import org.intellij.lang.annotations.JdkConstants;
import org.intellij.lang.annotations.MagicConstant;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -200,6 +201,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
private EditorHighlighter myHighlighter;
private final TextDrawingCallback myTextDrawingCallback = new MyTextDrawingCallback();
@MagicConstant(intValues = {VERTICAL_SCROLLBAR_LEFT, VERTICAL_SCROLLBAR_RIGHT})
private int myScrollBarOrientation;
private boolean myMousePressedInsideSelection;
private FontMetrics myPlainFontMetrics;
@@ -2695,6 +2697,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
myPaintSelection = paintSelection;
}
@Override
@NotNull
@NonNls
public String dumpState() {
@@ -4699,24 +4702,15 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
@Override
public void setVerticalScrollbarVisible(boolean b) {
if (b) {
myScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
}
else {
myScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
}
myScrollPane.setVerticalScrollBarPolicy(b ? ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS : ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
}
@Override
public void setHorizontalScrollbarVisible(boolean b) {
if (b) {
myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
else {
myScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
myScrollPane.setHorizontalScrollBarPolicy(b ? ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED : ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
}
@Override
public int getVerticalScrollbarOrientation() {
return myScrollBarOrientation;
}
@@ -33,6 +33,7 @@ public class HashMap<K, V> extends java.util.HashMap<K, V> {
super(map);
}
@Override
public void clear() {
if (size() == 0) return; // optimization
super.clear();
@@ -15,6 +15,8 @@
*/
package com.intellij.util.text;
import org.jetbrains.annotations.NotNull;
import java.io.Reader;
/**
@@ -24,17 +26,20 @@ public class CharSequenceReader extends Reader {
private final CharSequence myText;
private int myCurPos;
public CharSequenceReader(final CharSequence text) {
public CharSequenceReader(@NotNull CharSequence text) {
myText = text;
myCurPos = 0;
}
@Override
public void close() {}
@Override
public int read(char[] cbuf, int off, int len) {
if (off < 0 || off > cbuf.length || len < 0 || off + len > cbuf.length || off + len < 0) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
throw new IndexOutOfBoundsException("cbuf.length="+cbuf.length+"; off="+off+"; len="+len);
}
if (len == 0) {
return 0;
}
@@ -56,6 +61,7 @@ public class CharSequenceReader extends Reader {
return charsToCopy;
}
@Override
public int read() {
if (myCurPos >= myText.length()) return -1;
return myText.charAt(myCurPos++);