本文整理汇总了Java中com.intellij.openapi.editor.markup.EffectType.ROUNDED_BOX属性的典型用法代码示例。如果您正苦于以下问题:Java EffectType.ROUNDED_BOX属性的具体用法?Java EffectType.ROUNDED_BOX怎么用?Java EffectType.ROUNDED_BOX使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.editor.markup.EffectType
的用法示例。
在下文中一共展示了EffectType.ROUNDED_BOX属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintBorder
private static void paintBorder(Graphics g, EditorImpl editor, int startOffset, int endOffset, EffectType effectType) {
Point startPoint = offsetToXY(editor, startOffset);
Point endPoint = offsetToXY(editor, endOffset);
int height = endPoint.y - startPoint.y;
int startX = startPoint.x;
int startY = startPoint.y;
int endX = endPoint.x;
if (height == 0) {
int width = endX == startX ? 1 : endX - startX - 1;
if (effectType == EffectType.ROUNDED_BOX) {
UIUtil.drawRectPickedOut((Graphics2D)g, startX, startY, width, editor.getLineHeight() - 1);
} else {
g.drawRect(startX, startY, width, editor.getLineHeight() - 1);
}
return;
}
BorderGraphics border = new BorderGraphics(g, startX, startY, effectType);
border.horizontalTo(editor.getMaxWidthInRange(startOffset, endOffset) - 1);
border.verticalRel(height - 1);
border.horizontalTo(endX);
border.verticalRel(editor.getLineHeight());
border.horizontalTo(0);
border.verticalRel(-height + 1);
border.horizontalTo(startX);
border.verticalTo(startY);
}
示例2: equals
@Override
public boolean equals(final TextAttributes attributes1, final TextAttributes attributes2) {
Color effectColor = attributes1.getEffectColor();
EffectType effectType = attributes1.getEffectType();
return effectColor != null
&& effectColor.equals(attributes2.getEffectColor())
&& (EffectType.BOXED == effectType || EffectType.ROUNDED_BOX == effectType) &&
effectType == attributes2.getEffectType();
}
示例3: paintBorder
private void paintBorder(Graphics g, EditorImpl editor, int startOffset, int endOffset, EffectType effectType) {
if (!myClipDetector.rangeCanBeVisible(startOffset, endOffset)) return;
Point startPoint = offsetToXY(editor, startOffset);
Point endPoint = offsetToXY(editor, endOffset);
int height = endPoint.y - startPoint.y;
int startX = startPoint.x;
int startY = startPoint.y;
int endX = endPoint.x;
int lineHeight = editor.getLineHeight();
if (height == 0) {
int width = endX == startX ? 1 : endX - startX - 1;
if (effectType == EffectType.ROUNDED_BOX) {
UIUtil.drawRectPickedOut((Graphics2D)g, startX, startY, width, lineHeight - 1);
} else {
g.drawRect(startX, startY, width, lineHeight - 1);
}
return;
}
BorderGraphics border = new BorderGraphics(g, startX, startY, effectType);
border.horizontalTo(editor.getMaxWidthInRange(startOffset, endOffset) - 1);
border.verticalRel(height - 1);
border.horizontalTo(endX);
if (endX > 0) {
border.verticalRel(lineHeight);
border.horizontalTo(0);
border.verticalRel(-height + 1);
}
else if (height > lineHeight) {
border.verticalRel(-height + lineHeight + 1);
}
border.horizontalTo(startX);
border.verticalTo(startY);
}
示例4: lineTo
private void lineTo(int x, int y) {
if (myEffectType == EffectType.ROUNDED_BOX) {
UIUtil.drawLinePickedOut(myGraphics, myX, myY, x, y);
} else {
UIUtil.drawLine(myGraphics, myX, myY, x, y);
}
myX = x;
myY = y;
}
示例5: isBorder
private static boolean isBorder(TextAttributes textAttributes) {
return textAttributes != null &&
textAttributes.getEffectColor() != null &&
(EffectType.BOXED == textAttributes.getEffectType() || EffectType.ROUNDED_BOX == textAttributes.getEffectType());
}
示例6: selectDecisionInGrammar
public void selectDecisionInGrammar(PreviewState previewState, int decision) {
final ANTLRv4PluginController controller = ANTLRv4PluginController.getInstance(previewState.project);
if ( controller==null ) return;
final Editor grammarEditor = controller.getEditor(previewState.grammarFile);
if ( grammarEditor==null ) return;
DecisionState decisionState = previewState.g.atn.getDecisionState(decision);
Interval region = previewState.g.getStateToGrammarRegion(decisionState.stateNumber);
if ( region==null ) {
System.err.println("decision "+decision+" has state "+decisionState.stateNumber+" but no region");
return;
}
InputPanel.removeHighlighters(grammarEditor, ProfilerPanel.DECISION_INFO_KEY);
org.antlr.runtime.TokenStream tokens = previewState.g.tokenStream;
if ( region.a>=tokens.size() || region.b>=tokens.size() ) {
// System.out.println("out of range: " + region + " tokens.size()=" + tokens.size());
return;
}
CommonToken startToken = (CommonToken) tokens.get(region.a);
CommonToken stopToken = (CommonToken) tokens.get(region.b);
JBColor effectColor = JBColor.darkGray;
DecisionInfo decisionInfo = previewState.parsingResult.parser.getParseInfo().getDecisionInfo()[decision];
if ( decisionInfo.predicateEvals.size()>0 ) {
effectColor = new JBColor(PREDEVAL_COLOR, AMBIGUITY_COLOR);
}
if ( decisionInfo.contextSensitivities.size()>0 ) {
effectColor = new JBColor(FULLCTX_COLOR, AMBIGUITY_COLOR);
}
if ( decisionInfo.ambiguities.size()>0 ) {
effectColor = new JBColor(AMBIGUITY_COLOR, AMBIGUITY_COLOR);
}
TextAttributes attr =
new TextAttributes(JBColor.BLACK, JBColor.WHITE, effectColor,
EffectType.ROUNDED_BOX, Font.PLAIN);
MarkupModel markupModel = grammarEditor.getMarkupModel();
final RangeHighlighter rangeHighlighter = markupModel.addRangeHighlighter(
startToken.getStartIndex(),
stopToken.getStopIndex()+1,
HighlighterLayer.SELECTION, // layer
attr,
HighlighterTargetArea.EXACT_RANGE
);
rangeHighlighter.putUserData(DECISION_INFO_KEY, decisionInfo);
// System.out.println("dec " + decision + " from " + startToken + " to " + stopToken);
ScrollingModel scrollingModel = grammarEditor.getScrollingModel();
CaretModel caretModel = grammarEditor.getCaretModel();
caretModel.moveToOffset(startToken.getStartIndex());
scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE);
}