mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
performance
This commit is contained in:
@@ -75,10 +75,12 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
private static final int EFFECT_BOLD_LINE = 4;
|
||||
private static final int EFFECT_BOLD_DOTTED_LINE = 5;
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
DefaultJDOMExternalizer.readExternal(this, element);
|
||||
if (FONT_TYPE < 0 || FONT_TYPE > 3) {
|
||||
@@ -87,6 +89,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
}
|
||||
@@ -138,11 +141,20 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
private AttributesFlyweight myAttrs;
|
||||
|
||||
public TextAttributes() {
|
||||
myAttrs = AttributesFlyweight.create(null, null, Font.PLAIN, null, EffectType.BOXED, null);
|
||||
this(null, null, null, EffectType.BOXED, Font.PLAIN);
|
||||
}
|
||||
|
||||
public TextAttributes(Color foregroundColor, Color backgroundColor, Color effectColor, EffectType effectType, @JdkConstants.FontStyle int fontType) {
|
||||
myAttrs = AttributesFlyweight.create(foregroundColor, backgroundColor, fontType, effectColor, effectType, null);
|
||||
setAttributes(foregroundColor, backgroundColor, effectColor, null, effectType, fontType);
|
||||
}
|
||||
|
||||
public void setAttributes(Color foregroundColor,
|
||||
Color backgroundColor,
|
||||
Color effectColor,
|
||||
Color errorStripeColor,
|
||||
EffectType effectType,
|
||||
@JdkConstants.FontStyle int fontType) {
|
||||
myAttrs = AttributesFlyweight.create(foregroundColor, backgroundColor, fontType, effectColor, effectType, errorStripeColor);
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
@@ -212,6 +224,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
myAttrs = myAttrs.withFontType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextAttributes clone() {
|
||||
TextAttributes cloned = new TextAttributes();
|
||||
cloned.myAttrs = myAttrs;
|
||||
@@ -230,6 +243,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
return myAttrs.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
Externalizable ext = new Externalizable();
|
||||
ext.readExternal(element);
|
||||
@@ -241,6 +255,7 @@ public class TextAttributes implements JDOMExternalizable, Cloneable {
|
||||
ext.ERROR_STRIPE_COLOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
Externalizable ext = new Externalizable();
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public final class IterationState {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.IterationState");
|
||||
|
||||
private static final Comparator<RangeHighlighterEx> HIGHLIGHTER_COMPARATOR = new Comparator<RangeHighlighterEx>() {
|
||||
@@ -90,7 +89,7 @@ public final class IterationState {
|
||||
private final int mySelectionStart;
|
||||
|
||||
private final int mySelectionEnd;
|
||||
private final List<RangeHighlighterEx> myCurrentHighlighters;
|
||||
private final List<RangeHighlighterEx> myCurrentHighlighters = new ArrayList<RangeHighlighterEx>();
|
||||
|
||||
private final FoldingModelEx myFoldingModel;
|
||||
|
||||
@@ -103,7 +102,7 @@ public final class IterationState {
|
||||
private final Color myDefaultForeground;
|
||||
private final int myCaretRowStart;
|
||||
private final int myCaretRowEnd;
|
||||
private final List<TextAttributes> myCachedAttributesList;
|
||||
private final List<TextAttributes> myCachedAttributesList = new ArrayList<TextAttributes>(5);
|
||||
private final DocumentEx myDocument;
|
||||
private final EditorEx myEditor;
|
||||
private final Color myReadOnlyColor;
|
||||
@@ -113,7 +112,7 @@ public final class IterationState {
|
||||
*/
|
||||
public IterationState(@NotNull EditorEx editor, int start, int end, boolean useCaretAndSelection) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
myDocument = (DocumentEx)editor.getDocument();
|
||||
myDocument = editor.getDocument();
|
||||
myStartOffset = start;
|
||||
|
||||
myEnd = end;
|
||||
@@ -139,9 +138,6 @@ public final class IterationState {
|
||||
|
||||
myCaretRowStart = caretModel.getVisualLineStart();
|
||||
myCaretRowEnd = caretModel.getVisualLineEnd();
|
||||
myCachedAttributesList = new ArrayList<TextAttributes>(5);
|
||||
|
||||
myCurrentHighlighters = new ArrayList<RangeHighlighterEx>();
|
||||
|
||||
MarkupModelEx editorMarkup = (MarkupModelEx)editor.getMarkupModel();
|
||||
myView = new HighlighterSweep(editorMarkup, start, myEnd);
|
||||
@@ -467,11 +463,7 @@ public final class IterationState {
|
||||
if (back == null) back = myDefaultBackground;
|
||||
if (effectType == null) effectType = EffectType.BOXED;
|
||||
|
||||
myMergedAttributes.setForegroundColor(fore);
|
||||
myMergedAttributes.setBackgroundColor(back);
|
||||
myMergedAttributes.setFontType(fontType);
|
||||
myMergedAttributes.setEffectColor(effect);
|
||||
myMergedAttributes.setEffectType(effectType);
|
||||
myMergedAttributes.setAttributes(fore, back, effect, null, effectType, fontType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -492,6 +484,7 @@ public final class IterationState {
|
||||
return myEndOffset;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TextAttributes getMergedAttributes() {
|
||||
return myMergedAttributes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user