当前位置: 首页>>代码示例>>Java>>正文


Java EffectType.ROUNDED_BOX属性代码示例

本文整理汇总了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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:BorderEffect.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BorderEffect.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:BorderEffect.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BorderEffect.java

示例5: isBorder

private static boolean isBorder(TextAttributes textAttributes) {
  return textAttributes != null &&
         textAttributes.getEffectColor() != null &&
         (EffectType.BOXED == textAttributes.getEffectType() || EffectType.ROUNDED_BOX == textAttributes.getEffectType());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:BorderEffect.java

示例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);
	}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:54,代码来源:ProfilerPanel.java


注:本文中的com.intellij.openapi.editor.markup.EffectType.ROUNDED_BOX属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。