本文整理汇总了Java中com.intellij.openapi.editor.ex.util.LexerEditorHighlighter类的典型用法代码示例。如果您正苦于以下问题:Java LexerEditorHighlighter类的具体用法?Java LexerEditorHighlighter怎么用?Java LexerEditorHighlighter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LexerEditorHighlighter类属于com.intellij.openapi.editor.ex.util包,在下文中一共展示了LexerEditorHighlighter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getEditorHighlighterForCachesBuilding
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Nullable
public static EditorHighlighter getEditorHighlighterForCachesBuilding(Document document) {
if (document == null) {
return null;
}
final WeakReference<EditorHighlighter> editorHighlighterWeakReference = document.getUserData(ourSomeEditorSyntaxHighlighter);
final EditorHighlighter someEditorHighlighter = SoftReference.dereference(editorHighlighterWeakReference);
if (someEditorHighlighter instanceof LexerEditorHighlighter &&
((LexerEditorHighlighter)someEditorHighlighter).isValid()
) {
return someEditorHighlighter;
}
document.putUserData(ourSomeEditorSyntaxHighlighter, null);
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:EditorHighlighterCache.java
示例2: showFormSource
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
public void showFormSource() {
EditorFactory editorFactory = EditorFactory.getInstance();
Editor editor = editorFactory.createViewer(myDocument, myProject);
try {
((EditorEx)editor).setHighlighter(
new LexerEditorHighlighter(new XmlFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme()));
JComponent component = editor.getComponent();
component.setPreferredSize(new Dimension(640, 480));
DialogBuilder dialog = new DialogBuilder(myProject);
dialog.title("Form - " + myFile.getPresentableName()).dimensionKey("GuiDesigner.FormSource.Dialog");
dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent());
dialog.addOkAction();
dialog.show();
}
finally {
editorFactory.releaseEditor(editor);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GuiEditor.java
示例3: getEditorHighlighterForCachesBuilding
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Nullable
public static EditorHighlighter getEditorHighlighterForCachesBuilding(Document document) {
if (document == null) {
return null;
}
final WeakReference<EditorHighlighter> editorHighlighterWeakReference = document.getUserData(ourSomeEditorSyntaxHighlighter);
final EditorHighlighter someEditorHighlighter = editorHighlighterWeakReference != null ? editorHighlighterWeakReference.get() : null;
if (someEditorHighlighter instanceof LexerEditorHighlighter &&
((LexerEditorHighlighter)someEditorHighlighter).isValid()
) {
return someEditorHighlighter;
}
document.putUserData(ourSomeEditorSyntaxHighlighter, null);
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:EditorHighlighterCache.java
示例4: createHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private EditorHighlighter createHighlighter() {
if (myTemplate != null && myProject != null && myVelocityFileType != FileTypes.UNKNOWN) {
return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
}
FileType fileType = null;
if (myTemplate != null) {
fileType = FileTypeManager.getInstance().getFileTypeByExtension(myTemplate.getExtension());
}
if (fileType == null) {
fileType = FileTypes.PLAIN_TEXT;
}
SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
if (originalHighlighter == null) originalHighlighter = new PlainSyntaxHighlighter();
return new LexerEditorHighlighter(new TemplateHighlighter(originalHighlighter), EditorColorsManager.getInstance().getGlobalScheme());
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:FileTemplateConfigurable.java
示例5: reinitSettings
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private static void reinitSettings(final EditorEx editor) {
EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
editor.setColorsScheme(scheme);
EditorSettings settings = editor.getSettings();
settings.setLineNumbersShown(false);
settings.setWhitespacesShown(false);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
settings.setFoldingOutlineShown(false);
settings.setAdditionalColumnsCount(0);
settings.setAdditionalLinesCount(0);
settings.setRightMarginShown(true);
settings.setRightMargin(60);
editor.setHighlighter(new LexerEditorHighlighter(new PropertiesValueHighlighter(), scheme));
editor.setVerticalScrollbarVisible(true);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ResourceBundleEditor.java
示例6: getEditorHighlighterForCachesBuilding
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Nullable
public static EditorHighlighter getEditorHighlighterForCachesBuilding(Document document) {
if (document == null) {
return null;
}
final WeakReference<EditorHighlighter> editorHighlighterWeakReference = document.getUserData(ourSomeEditorSyntaxHighlighter);
final EditorHighlighter someEditorHighlighter = SoftReference.dereference(editorHighlighterWeakReference);
if (someEditorHighlighter instanceof LexerEditorHighlighter &&
((LexerEditorHighlighter)someEditorHighlighter).isValid()
) {
return someEditorHighlighter;
}
document.putUserData(ourSomeEditorSyntaxHighlighter, null);
return null;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:EditorHighlighterCache.java
示例7: printWithHighlighting
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
public static String printWithHighlighting(@Nonnull LanguageConsoleView console, @Nonnull Editor inputEditor, @Nonnull TextRange textRange) {
String text;
EditorHighlighter highlighter;
if (inputEditor instanceof EditorWindow) {
PsiFile file = ((EditorWindow)inputEditor).getInjectedFile();
highlighter = HighlighterFactory.createHighlighter(file.getVirtualFile(), EditorColorsManager.getInstance().getGlobalScheme(), console.getProject());
String fullText = InjectedLanguageUtil.getUnescapedText(file, null, null);
highlighter.setText(fullText);
text = textRange.substring(fullText);
}
else {
text = inputEditor.getDocument().getText(textRange);
highlighter = ((EditorEx)inputEditor).getHighlighter();
}
SyntaxHighlighter syntax = highlighter instanceof LexerEditorHighlighter ? ((LexerEditorHighlighter)highlighter).getSyntaxHighlighter() : null;
((LanguageConsoleImpl)console).doAddPromptToHistory();
if (syntax != null) {
ConsoleViewUtil.printWithHighlighting(console, text, syntax);
}
else {
console.print(text, ConsoleViewContentType.USER_INPUT);
}
console.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
return text;
}
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:LanguageConsoleImpl.java
示例8: canPaintImmediately
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private boolean canPaintImmediately(char c) {
return getDocument() instanceof DocumentImpl &&
getHighlighter() instanceof LexerEditorHighlighter &&
!getSelectionModel().hasSelection() &&
arePositionsWithinDocument(getCaretModel().getAllCarets()) &&
areVisualLinesUnique(getCaretModel().getAllCarets()) &&
!isInplaceRenamerActive() &&
!KEY_CHARS_TO_SKIP.contains(c);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ImmediatePainter.java
示例9: printWithHighlighting
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
public static String printWithHighlighting(@NotNull LanguageConsoleView console, @NotNull Editor inputEditor, @NotNull TextRange textRange) {
String text;
EditorHighlighter highlighter;
if (inputEditor instanceof EditorWindow) {
PsiFile file = ((EditorWindow)inputEditor).getInjectedFile();
highlighter =
HighlighterFactory.createHighlighter(file.getVirtualFile(), EditorColorsManager.getInstance().getGlobalScheme(), console.getProject());
String fullText = InjectedLanguageUtil.getUnescapedText(file, null, null);
highlighter.setText(fullText);
text = textRange.substring(fullText);
}
else {
text = inputEditor.getDocument().getText(textRange);
highlighter = ((EditorEx)inputEditor).getHighlighter();
}
SyntaxHighlighter syntax =
highlighter instanceof LexerEditorHighlighter ? ((LexerEditorHighlighter)highlighter).getSyntaxHighlighter() : null;
((LanguageConsoleImpl)console).doAddPromptToHistory();
if (syntax != null) {
ConsoleViewUtil.printWithHighlighting(console, text, syntax);
}
else {
console.print(text, ConsoleViewContentType.USER_INPUT);
}
console.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
return text;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:LanguageConsoleImpl.java
示例10: buildBraceMatcherBasedFolding
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
public static void buildBraceMatcherBasedFolding(List<FoldingDescriptor> descriptors,
PsiElement root,
Document document,
SyntaxHighlighter highlighter) {
LexerEditorHighlighter editorHighlighter = new LexerEditorHighlighter(highlighter, EditorColorsManager.getInstance().getGlobalScheme());
editorHighlighter.setText(document.getText());
FileType fileType = root.getContainingFile().getFileType();
BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, root.getLanguage());
TextRange totalRange = root.getTextRange();
final HighlighterIterator iterator = editorHighlighter.createIterator(totalRange.getStartOffset());
final LinkedList<Trinity<Integer, Integer, IElementType>> stack = new LinkedList<Trinity<Integer, Integer, IElementType>>();
String editorText = document.getText();
while (!iterator.atEnd() && iterator.getStart() < totalRange.getEndOffset()) {
final Trinity<Integer, Integer, IElementType> last;
if (braceMatcher.isLBraceToken(iterator, editorText, fileType) &&
braceMatcher.isStructuralBrace(iterator, editorText, fileType)) {
stack.addLast(Trinity.create(iterator.getStart(), iterator.getEnd(), iterator.getTokenType()));
}
else if (braceMatcher.isRBraceToken(iterator, editorText, fileType) &&
braceMatcher.isStructuralBrace(iterator, editorText, fileType)
&& !stack.isEmpty() && braceMatcher.isPairBraces((last = stack.getLast()).third, iterator.getTokenType())) {
stack.removeLast();
TextRange range = new TextRange(last.first, iterator.getEnd());
if (StringUtil.countChars(document.getText(range), '\n') >= 3) {
descriptors.add(new FoldingDescriptor(root, range));
}
}
iterator.advance();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:CustomFileTypeFoldingBuilder.java
示例11: createEditorHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Override
public EditorHighlighter createEditorHighlighter(@NotNull VirtualFile vFile, @NotNull EditorColorsScheme settings, @Nullable Project project) {
FileType fileType = vFile.getFileType();
if (fileType instanceof LanguageFileType) {
LanguageFileType substFileType = substituteFileType(((LanguageFileType)fileType).getLanguage(), vFile, project);
if (substFileType != null) {
EditorHighlighterProvider provider = FileTypeEditorHighlighterProviders.INSTANCE.forFileType(substFileType);
EditorHighlighter editorHighlighter = provider.getEditorHighlighter(project, fileType, vFile, settings);
boolean isPlain = editorHighlighter.getClass() == LexerEditorHighlighter.class &&
((LexerEditorHighlighter) editorHighlighter).isPlain();
if (!isPlain) {
return editorHighlighter;
}
}
return FileTypeEditorHighlighterProviders.INSTANCE.forFileType(fileType).getEditorHighlighter(project, fileType, vFile, settings);
}
SyntaxHighlighter highlighter = null;
for (ContentBasedFileSubstitutor processor : Extensions.getExtensions(ContentBasedFileSubstitutor.EP_NAME)) {
boolean applicable;
try {
applicable = processor.isApplicable(project, vFile);
}
catch (Exception e) {
LOG.error(e);
continue;
}
if (applicable && processor instanceof ContentBasedClassFileProcessor) {
highlighter = ((ContentBasedClassFileProcessor)processor).createHighlighter(project, vFile);
}
}
if (highlighter == null) {
highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, vFile);
}
return createEditorHighlighter(highlighter, settings);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:EditorHighlighterFactoryImpl.java
示例12: createHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private EditorHighlighter createHighlighter(EditorColorsScheme settings) {
Language language = Language.findLanguageByID("JSON");
if (language == null) {
language = Language.ANY;
}
return new LexerEditorHighlighter(PlainTextSyntaxHighlighterFactory.getSyntaxHighlighter(language, null, null), settings);
}
开发者ID:dboissier,项目名称:nosql4idea,代码行数:8,代码来源:QueryPanel.java
示例13: showFormSource
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
public void showFormSource()
{
EditorFactory editorFactory = EditorFactory.getInstance();
Editor editor = editorFactory.createViewer(myDocument, myProject);
try
{
((EditorEx) editor).setHighlighter(new LexerEditorHighlighter(new XmlFileHighlighter(),
EditorColorsManager.getInstance().getGlobalScheme()));
JComponent component = editor.getComponent();
component.setPreferredSize(new Dimension(640, 480));
DialogBuilder dialog = new DialogBuilder(myProject);
dialog.title("Form - " + myFile.getPresentableName()).dimensionKey("GuiDesigner.FormSource.Dialog");
dialog.centerPanel(component).setPreferredFocusComponent(editor.getContentComponent());
dialog.addOkAction();
dialog.show();
}
finally
{
editorFactory.releaseEditor(editor);
}
}
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:28,代码来源:GuiEditor.java
示例14: canPaintImmediately
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private static boolean canPaintImmediately(final EditorImpl editor) {
final CaretModel caretModel = editor.getCaretModel();
final Caret caret = caretModel.getPrimaryCaret();
final Document document = editor.getDocument();
return !(editor.getComponent().getParent() instanceof EditorTextField) &&
document instanceof DocumentImpl &&
editor.getHighlighter() instanceof LexerEditorHighlighter &&
!editor.getSelectionModel().hasSelection() &&
caretModel.getCaretCount() == 1 &&
!isInVirtualSpace(editor, caret) &&
!isInsertion(document, caret.getOffset()) &&
!caret.isAtRtlLocation() &&
!caret.isAtBidiRunBoundary();
}
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:ImmediatePainter.java
示例15: getLazyParsableHighlighterIfAny
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Nonnull
static EditorHighlighter getLazyParsableHighlighterIfAny(Project project, Editor editor, PsiFile psiFile) {
if (!PsiDocumentManager.getInstance(project).isCommitted(editor.getDocument())) {
return ((EditorEx)editor).getHighlighter();
}
PsiElement elementAt = psiFile.findElementAt(editor.getCaretModel().getOffset());
for (PsiElement e : SyntaxTraverser.psiApi().parents(elementAt).takeWhile(Conditions.notEqualTo(psiFile))) {
if (!(PsiUtilCore.getElementType(e) instanceof ILazyParseableElementType)) continue;
Language language = ILazyParseableElementType.LANGUAGE_KEY.get(e.getNode());
if (language == null) continue;
TextRange range = e.getTextRange();
final int offset = range.getStartOffset();
SyntaxHighlighter syntaxHighlighter =
SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, psiFile.getVirtualFile());
LexerEditorHighlighter highlighter = new LexerEditorHighlighter(syntaxHighlighter, editor.getColorsScheme()) {
@Nonnull
@Override
public HighlighterIterator createIterator(int startOffset) {
return new HighlighterIteratorWrapper(super.createIterator(Math.max(startOffset - offset, 0))) {
@Override
public int getStart() {
return super.getStart() + offset;
}
@Override
public int getEnd() {
return super.getEnd() + offset;
}
};
}
};
highlighter.setText(editor.getDocument().getText(range));
return highlighter;
}
return ((EditorEx)editor).getHighlighter();
}
开发者ID:consulo,项目名称:consulo,代码行数:37,代码来源:BraceHighlightingHandler.java
示例16: createEditorHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@NotNull
@Override
public EditorHighlighter createEditorHighlighter(SyntaxHighlighter highlighter, @NotNull final EditorColorsScheme colors) {
if (highlighter == null) highlighter = new PlainSyntaxHighlighter();
return new LexerEditorHighlighter(highlighter, colors);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:EditorHighlighterFactoryImpl.java
示例17: paintImmediately
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private void paintImmediately(Graphics g, int offset, char c, boolean insert) {
if (g == null) return; // editor component is currently not displayable
TextAttributes attributes = ((LexerEditorHighlighter)getHighlighter()).getAttributes((DocumentImpl)getDocument(), offset, c);
int fontType = attributes.getFontType();
FontInfo fontInfo = EditorUtil.fontForChar(c, attributes.getFontType(), myEditor);
Font font = fontInfo.getFont();
// it's more reliable to query actual font metrics
FontMetrics fontMetrics = myEditor.getFontMetrics(fontType);
int charWidth = fontMetrics.charWidth(c);
int delta = charWidth;
if (!insert && offset < getDocument().getTextLength()) {
delta -= fontMetrics.charWidth(getDocument().getCharsSequence().charAt(offset));
}
Rectangle tailArea = lineRectangleBetween(offset, getDocument().getLineEndOffset(myEditor.offsetToLogicalLine(offset)));
if (tailArea.isEmpty()) {
tailArea.width += EditorUtil.getSpaceWidth(fontType, myEditor); // include caret
}
Color background = attributes.getBackgroundColor() == null ? getCaretRowBackground() : attributes.getBackgroundColor();
Rectangle newArea = lineRectangleBetween(offset, offset);
newArea.width += charWidth;
String newText = Character.toString(c);
Point point = newArea.getLocation();
int ascent = myEditor.getAscent();
Color foreground = attributes.getForegroundColor() == null ? myEditor.getForegroundColor() : attributes.getForegroundColor();
EditorUIUtil.setupAntialiasing(g);
// pre-compute all the arguments beforehand to minimize delays between the calls (as there's no double-buffering)
if (delta != 0) {
shift(g, tailArea, delta);
}
fill(g, newArea, background);
print(g, newText, point, ascent, font, foreground);
// flush changes (there can be batching / buffering in video driver)
Toolkit.getDefaultToolkit().sync();
if (isZeroLatencyTypingDebugEnabled()) {
pause();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:ImmediatePainter.java
示例18: getEditorHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private LexerEditorHighlighter getEditorHighlighter() {
return new LexerEditorHighlighter(new JavaFileHighlighter(), EditorColorsManager.getInstance().getGlobalScheme());
}
开发者ID:cooliean,项目名称:android-codegenerator-plugin-intellij,代码行数:4,代码来源:TemplateConfigurable.java
示例19: createEditorHighlighter
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
@Nonnull
@Override
public EditorHighlighter createEditorHighlighter(SyntaxHighlighter highlighter, @Nonnull final EditorColorsScheme colors) {
if (highlighter == null) highlighter = new PlainSyntaxHighlighter();
return new LexerEditorHighlighter(highlighter, colors);
}
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:EditorHighlighterFactoryImpl.java
示例20: paintImmediately
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter; //导入依赖的package包/类
private void paintImmediately(final Graphics g, final int offset, final char c2) {
final EditorImpl editor = myEditor;
final Document document = editor.getDocument();
final LexerEditorHighlighter highlighter = (LexerEditorHighlighter)myEditor.getHighlighter();
final EditorSettings settings = editor.getSettings();
final boolean isBlockCursor = editor.isInsertMode() == settings.isBlockCursor();
final int lineHeight = editor.getLineHeight();
final int ascent = editor.getAscent();
final int topOverhang = editor.myView.getTopOverhang();
final int bottomOverhang = editor.myView.getBottomOverhang();
final char c1 = offset == 0 ? ' ' : document.getCharsSequence().charAt(offset - 1);
final List<TextAttributes> attributes = highlighter.getAttributesForPreviousAndTypedChars(document, offset, c2);
updateAttributes(editor, offset, attributes);
final TextAttributes attributes1 = attributes.get(0);
final TextAttributes attributes2 = attributes.get(1);
if (!(canRender(attributes1) && canRender(attributes2))) {
return;
}
FontLayoutService fontLayoutService = FontLayoutService.getInstance();
final float width1 = fontLayoutService.charWidth2D(editor.getFontMetrics(attributes1.getFontType()), c1);
final float width2 = fontLayoutService.charWidth2D(editor.getFontMetrics(attributes2.getFontType()), c2);
final Font font1 = EditorUtil.fontForChar(c1, attributes1.getFontType(), editor).getFont();
final Font font2 = EditorUtil.fontForChar(c1, attributes2.getFontType(), editor).getFont();
final Point2D p2 = editor.offsetToXY(offset, false);
float p2x = (float)p2.getX();
int p2y = (int)p2.getY();
int width1i = (int)(p2x) - (int)(p2x - width1);
int width2i = (int)(p2x + width2) - (int)p2x;
Caret caret = editor.getCaretModel().getPrimaryCaret();
//noinspection ConstantConditions
final int caretWidth = isBlockCursor ? editor.getCaretLocations(false)[0].myWidth
: JBUI.scale(caret.getVisualAttributes().getWidth(settings.getLineCursorWidth()));
final float caretShift = isBlockCursor ? 0 : caretWidth == 1 ? 0 : 1 / JBUI.sysScale((Graphics2D)g);
final Rectangle2D caretRectangle = new Rectangle2D.Float((int)(p2x + width2) - caretShift, p2y - topOverhang,
caretWidth, lineHeight + topOverhang + bottomOverhang + (isBlockCursor ? -1 : 0));
final Rectangle rectangle1 = new Rectangle((int)(p2x - width1), p2y, width1i, lineHeight);
final Rectangle rectangle2 = new Rectangle((int)p2x, p2y, (int)(width2i + caretWidth - caretShift), lineHeight);
final Consumer<Graphics> painter = graphics -> {
EditorUIUtil.setupAntialiasing(graphics);
fillRect(graphics, rectangle2, attributes2.getBackgroundColor());
drawChar(graphics, c2, p2x, p2y + ascent, font2, attributes2.getForegroundColor());
fillRect(graphics, caretRectangle, getCaretColor(editor));
fillRect(graphics, rectangle1, attributes1.getBackgroundColor());
drawChar(graphics, c1, p2x - width1, p2y + ascent, font1, attributes1.getForegroundColor());
};
final Shape originalClip = g.getClip();
g.setClip(new Rectangle2D.Float((int)p2x - caretShift, p2y, width2i + caretWidth, lineHeight));
if (DOUBLE_BUFFERING.asBoolean()) {
paintWithDoubleBuffering(g, painter);
}
else {
painter.consume(g);
}
g.setClip(originalClip);
if (PIPELINE_FLUSH.asBoolean()) {
Toolkit.getDefaultToolkit().sync();
}
if (DEBUG.asBoolean()) {
pause();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:82,代码来源:ImmediatePainter.java
注:本文中的com.intellij.openapi.editor.ex.util.LexerEditorHighlighter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论