本文整理汇总了Java中com.intellij.application.options.colors.highlighting.HighlightData类的典型用法代码示例。如果您正苦于以下问题:Java HighlightData类的具体用法?Java HighlightData怎么用?Java HighlightData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HighlightData类属于com.intellij.application.options.colors.highlighting包,在下文中一共展示了HighlightData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navigate
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void navigate(boolean select, @Nonnull final LogicalPosition pos) {
int offset = myEditor.logicalPositionToOffset(pos);
final SyntaxHighlighter highlighter = myPage.getHighlighter();
String type;
HighlightData highlightData = getDataFromOffset(offset);
if (highlightData != null) {
// tag-based navigation first
type = RainbowHighlighter.isRainbowTempKey(highlightData.getHighlightKey())
? RainbowHighlighter.RAINBOW_TYPE
: highlightData.getHighlightType();
}
else {
// if failed, try the highlighter-based navigation
type = selectItem(myEditor.getHighlighter().createIterator(offset), highlighter);
}
setCursor(type == null ? Cursor.TEXT_CURSOR : Cursor.HAND_CURSOR);
if (select && type != null) {
myDispatcher.getMulticaster().selectionInPreviewChanged(type);
}
}
示例2: scrollHighlightInView
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
void scrollHighlightInView(@Nullable final List<HighlightData> highlightDatas) {
if (highlightDatas == null) return;
boolean needScroll = true;
int minOffset = Integer.MAX_VALUE;
for (HighlightData data : highlightDatas) {
if (isOffsetVisible(data.getStartOffset())) {
needScroll = false;
break;
}
minOffset = Math.min(minOffset, data.getStartOffset());
}
if (needScroll && minOffset != Integer.MAX_VALUE) {
LogicalPosition pos = myEditor.offsetToLogicalPosition(minOffset);
myEditor.getScrollingModel().scrollTo(pos, ScrollType.MAKE_VISIBLE);
}
}
示例3: addClickNavigator
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
public void addClickNavigator(final Editor view,
final SyntaxHighlighter highlighter,
final HighlightData[] data,
final boolean isBackgroundImportant) {
addMouseMotionListener(view, highlighter, data, isBackgroundImportant);
CaretListener listener = new CaretAdapter() {
@Override
public void caretPositionChanged(CaretEvent e) {
navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant);
}
};
view.getCaretModel().addCaretListener(listener);
}
示例4: addMouseMotionListener
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void addMouseMotionListener(final Editor view,
final SyntaxHighlighter highlighter,
final HighlightData[] data, final boolean isBackgroundImportant) {
view.getContentComponent().addMouseMotionListener(new MouseMotionAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
LogicalPosition pos = view.xyToLogicalPosition(new Point(e.getX(), e.getY()));
navigate(view, false, pos, highlighter, data, isBackgroundImportant);
}
});
}
示例5: navigate
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void navigate(final Editor editor, boolean select,
LogicalPosition pos,
final SyntaxHighlighter highlighter,
final HighlightData[] data, final boolean isBackgroundImportant) {
int offset = editor.logicalPositionToOffset(pos);
if (!isBackgroundImportant && editor.offsetToLogicalPosition(offset).column != pos.column) {
if (!select) {
setCursor(editor, Cursor.TEXT_CURSOR);
return;
}
}
if (data != null) {
for (HighlightData highlightData : data) {
if (highlightDataContainsOffset(highlightData, editor.logicalPositionToOffset(pos))) {
if (!select) setCursor(editor, Cursor.HAND_CURSOR);
setSelectedItem(highlightData.getHighlightType(), select);
return;
}
}
}
if (highlighter != null) {
HighlighterIterator itr = ((EditorEx)editor).getHighlighter().createIterator(offset);
boolean selection = selectItem(select, itr, highlighter);
if (!select && selection) {
setCursor(editor, Cursor.HAND_CURSOR);
}
else {
setCursor(editor, Cursor.TEXT_CURSOR);
}
}
}
示例6: SimpleEditorPreview
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page, final boolean navigatable) {
myOptions = options;
myPage = page;
String text = page.getDemoText();
HighlightsExtractor extractant2 = new HighlightsExtractor(page.getAdditionalHighlightingTagToDescriptorMap());
List<HighlightData> highlights = new ArrayList<HighlightData>();
String stripped = extractant2.extractHighlights(text, highlights);
myHighlightData = highlights.toArray(new HighlightData[highlights.size()]);
int selectedLine = -1;
myEditor = (EditorEx)FontEditorPreview.createPreviewEditor(stripped, 10, 3, selectedLine, myOptions, false);
FontEditorPreview.installTrafficLights(myEditor);
myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
if (navigatable) {
addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);
CaretListener listener = new CaretAdapter() {
@Override
public void caretPositionChanged(CaretEvent e) {
navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
}
};
myEditor.getCaretModel().addCaretListener(listener);
}
}
示例7: navigate
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void navigate(final Editor editor, boolean select,
LogicalPosition pos,
final SyntaxHighlighter highlighter,
final HighlightData[] data, final boolean isBackgroundImportant) {
int offset = editor.logicalPositionToOffset(pos);
if (!isBackgroundImportant && editor.offsetToLogicalPosition(offset).column != pos.column) {
if (!select) {
ClickNavigator.setCursor(editor, Cursor.TEXT_CURSOR);
return;
}
}
if (data != null) {
for (HighlightData highlightData : data) {
if (ClickNavigator.highlightDataContainsOffset(highlightData, editor.logicalPositionToOffset(pos))) {
if (!select) {
ClickNavigator.setCursor(editor, Cursor.HAND_CURSOR);
}
else {
myDispatcher.getMulticaster().selectionInPreviewChanged(highlightData.getHighlightType());
}
return;
}
}
}
if (highlighter != null) {
HighlighterIterator itr = ((EditorEx)editor).getHighlighter().createIterator(offset);
selectItem(itr, highlighter, select);
ClickNavigator.setCursor(editor, select ? Cursor.TEXT_CURSOR : Cursor.HAND_CURSOR);
}
}
示例8: updateHighlighters
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void updateHighlighters() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
if (myEditor.isDisposed()) return;
myEditor.getMarkupModel().removeAllHighlighters();
HighlightData[] datum = myHighlightData;
final Map<TextAttributesKey, String> displayText = ColorSettingsUtil.keyToDisplayTextMap(myPage);
for (final HighlightData data : datum) {
data.addHighlToView(myEditor, myOptions.getSelectedScheme(), displayText);
}
}
});
}
示例9: blinkSelectedHighlightType
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
@Override
public void blinkSelectedHighlightType(Object description) {
if (description instanceof EditorSchemeAttributeDescriptor){
String type = ((EditorSchemeAttributeDescriptor)description).getType();
List<HighlightData> highlights = startBlinkingHighlights(myEditor,
myHighlightData, type,
myPage.getHighlighter(), true,
myBlinkingAlarm, BLINK_COUNT, myPage);
scrollHighlightInView(highlights, myEditor);
}
}
示例10: scrollHighlightInView
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private static void scrollHighlightInView(final List<HighlightData> highlightDatas, final Editor editor) {
boolean needScroll = true;
int minOffset = Integer.MAX_VALUE;
for(HighlightData data: highlightDatas) {
if (isOffsetVisible(editor, data.getStartOffset())) {
needScroll = false;
break;
}
minOffset = Math.min(minOffset, data.getStartOffset());
}
if (needScroll && minOffset != Integer.MAX_VALUE) {
LogicalPosition pos = editor.offsetToLogicalPosition(minOffset);
editor.getScrollingModel().scrollTo(pos, ScrollType.MAKE_VISIBLE);
}
}
示例11: addClickNavigator
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
public void addClickNavigator(final Editor view,
final SyntaxHighlighter highlighter,
final HighlightData[] data,
final boolean isBackgroundImportant) {
addMouseMotionListener(view, highlighter, data, isBackgroundImportant);
CaretListener listener = new CaretListener() {
@Override
public void caretPositionChanged(CaretEvent e) {
navigate(view, true, e.getNewPosition(), highlighter, data, isBackgroundImportant);
}
};
view.getCaretModel().addCaretListener(listener);
}
示例12: navigate
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void navigate(final Editor editor, boolean select,
LogicalPosition pos,
final SyntaxHighlighter highlighter,
final HighlightData[] data, final boolean isBackgroundImportant) {
int offset = editor.logicalPositionToOffset(pos);
if (!isBackgroundImportant && editor.offsetToLogicalPosition(offset).column != pos.column) {
if (!select) {
ClickNavigator.setCursor(editor, Cursor.TEXT_CURSOR);
return;
}
}
if (data != null) {
for (HighlightData highlightData : data) {
if (ClickNavigator.highlightDataContainsOffset(highlightData, editor.logicalPositionToOffset(pos))) {
if (!select) {
ClickNavigator.setCursor(editor, Cursor.HAND_CURSOR);
}
else {
myDispatcher.getMulticaster().selectionInPreviewChanged(highlightData.getHighlightType());
}
return;
}
}
}
if (highlighter != null) {
HighlighterIterator itr = ((EditorEx)editor).getHighlighter().createIterator(offset);
selectItem(itr, highlighter, select);
if (!select) {
ClickNavigator.setCursor(editor, Cursor.HAND_CURSOR);
}
else {
ClickNavigator.setCursor(editor, Cursor.TEXT_CURSOR);
}
}
}
示例13: blinkSelectedHighlightType
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
@Override
public void blinkSelectedHighlightType(Object description) {
if (description instanceof EditorSchemeAttributeDescriptor){
String type = ((EditorSchemeAttributeDescriptor)description).getType();
List<HighlightData> highlights = startBlinkingHighlights(myEditor,
myHighlightData, type,
myPage.getHighlighter(), true,
myBlinkingAlarm, BLINK_COUNT, myPage);
scrollHighlightInView(highlights, myEditor);
}
}
示例14: getDataFromOffset
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
@Nullable
private HighlightData getDataFromOffset(int offset) {
for (HighlightData highlightData : myHighlightData) {
if (offset >= highlightData.getStartOffset() && offset <= highlightData.getEndOffset()) {
return highlightData;
}
}
return null;
}
示例15: updateHighlighters
import com.intellij.application.options.colors.highlighting.HighlightData; //导入依赖的package包/类
private void updateHighlighters() {
UIUtil.invokeLaterIfNeeded(() -> {
if (myEditor.isDisposed()) return;
removeDecorations(myEditor);
final Map<TextAttributesKey, String> displayText = ColorSettingsUtil.keyToDisplayTextMap(myPage);
for (final HighlightData data : myHighlightData) {
data.addHighlToView(myEditor, myOptions.getSelectedScheme(), displayText);
}
});
}