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


Java StackFrameDescriptorImpl.getLabel方法代码示例

本文整理汇总了Java中com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl.getLabel方法的典型用法代码示例。如果您正苦于以下问题:Java StackFrameDescriptorImpl.getLabel方法的具体用法?Java StackFrameDescriptorImpl.getLabel怎么用?Java StackFrameDescriptorImpl.getLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl的用法示例。


在下文中一共展示了StackFrameDescriptorImpl.getLabel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customizePresentation

import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl; //导入方法依赖的package包/类
public void customizePresentation(StackFrameDescriptorImpl descriptor, @NotNull ColoredTextContainer component, StackFrameDescriptorImpl selectedDescriptor) {
  component.setIcon(descriptor.getIcon());
    //final Object selectedValue = list.getSelectedValue();

    final boolean shouldHighlightAsRecursive = isOccurrenceOfSelectedFrame(selectedDescriptor, descriptor);

    final ValueMarkup markup = descriptor.getValueMarkup();
    if (markup != null) {
      component.append("["+ markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
    }

    boolean needSeparator = false;
    //if (index > 0) {
    //  final int currentFrameIndex = descriptor.getUiIndex();
    //  final Object elementAt = list.getModel().getElementAt(index - 1);
    //  if (elementAt instanceof StackFrameDescriptorImpl) {
    //    StackFrameDescriptorImpl previousDescriptor = (StackFrameDescriptorImpl)elementAt;
    //    final int previousFrameIndex = previousDescriptor.getUiIndex();
    //    needSeparator = (currentFrameIndex - previousFrameIndex != 1);
    //  }
    //}

    //if (selected) {
    //  setBackground(UIUtil.getListSelectionBackground());
    //}
    //else {
    //  Color bg = descriptor.getBackgroundColor();
    //  if (bg == null) bg = UIUtil.getListBackground();
    //  if (shouldHighlightAsRecursive) bg = myColorScheme.getColor(DebuggerColors.RECURSIVE_CALL_ATTRIBUTES);
    //  setBackground(bg);
    //}
    //
    //if (needSeparator) {
    //  final MatteBorder border = BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.GRAY);
    //  setBorder(border);
    //}
    //else {
    //  setBorder(null);
    //}
    
    final String label = descriptor.getLabel();
    final int openingBrace = label.indexOf("{");
    final int closingBrace = (openingBrace < 0) ? -1 : label.indexOf("}");
    final SimpleTextAttributes attributes = getAttributes(descriptor);
    if (openingBrace < 0 || closingBrace < 0) {
      component.append(label, attributes);
    }
    else {
      component.append(label.substring(0, openingBrace - 1), attributes);
      component.append(" (" + label.substring(openingBrace + 1, closingBrace) + ")", SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);

      component.append(label.substring(closingBrace + 1, label.length()), attributes);
      if (shouldHighlightAsRecursive && descriptor.isRecursiveCall()) {
        component.append(" [" + descriptor.getOccurrenceIndex() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
      }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:58,代码来源:JavaFramesListRenderer.java

示例2: customizeCellRenderer

import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl; //导入方法依赖的package包/类
protected void customizeCellRenderer(final JList list, final Object item, final int index, final boolean selected, final boolean hasFocus) {
  if (!(item instanceof StackFrameDescriptorImpl)) {
    append(item.toString(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
  }
  else {
    final StackFrameDescriptorImpl descriptor = (StackFrameDescriptorImpl)item;
    setIcon(descriptor.getIcon());
    final Object selectedValue = list.getSelectedValue();
    final boolean shouldHighlightAsRecursive = (selectedValue instanceof StackFrameDescriptorImpl) && 
                                               isOccurrenceOfSelectedFrame((StackFrameDescriptorImpl)selectedValue, descriptor);

    final ValueMarkup markup = descriptor.getValueMarkup();
    if (markup != null) {
      append("["+ markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
    }

    boolean needSeparator = false;
    if (index > 0) {
      final int currentFrameIndex = descriptor.getUiIndex();
      final Object elementAt = list.getModel().getElementAt(index - 1);
      if (elementAt instanceof StackFrameDescriptorImpl) {
        StackFrameDescriptorImpl previousDescriptor = (StackFrameDescriptorImpl)elementAt;
        final int previousFrameIndex = previousDescriptor.getUiIndex();
        needSeparator = (currentFrameIndex - previousFrameIndex != 1);
      }
    }

    if (selected) {
      setBackground(UIUtil.getListSelectionBackground());
    }
    else {
      Color bg = descriptor.getBackgroundColor();
      if (bg == null) bg = UIUtil.getListBackground();
      if (shouldHighlightAsRecursive) bg = myColorScheme.getColor(DebuggerColors.RECURSIVE_CALL_ATTRIBUTES);
      setBackground(bg);
    }

    if (needSeparator) {
      final MatteBorder border = BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.GRAY);
      setBorder(border);
    }
    else {
      setBorder(null);
    }
    
    final String label = descriptor.getLabel();
    final int openingBrace = label.indexOf("{");
    final int closingBrace = (openingBrace < 0) ? -1 : label.indexOf("}");
    final SimpleTextAttributes attributes = getAttributes(descriptor);
    if (openingBrace < 0 || closingBrace < 0) {
      append(label, attributes);
    }
    else {
      append(label.substring(0, openingBrace - 1), attributes);
      append(" (" + label.substring(openingBrace + 1, closingBrace) + ")", SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);

      append(label.substring(closingBrace + 1, label.length()), attributes);
      if (shouldHighlightAsRecursive && descriptor.isRecursiveCall()) {
        append(" [" + descriptor.getOccurrenceIndex() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:64,代码来源:FramesListRenderer.java

示例3: customizePresentation

import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl; //导入方法依赖的package包/类
public void customizePresentation(StackFrameDescriptorImpl descriptor, @NotNull ColoredTextContainer component, StackFrameDescriptorImpl selectedDescriptor)
{
	component.setIcon(descriptor.getIcon());
	//final Object selectedValue = list.getSelectedValue();

	final boolean shouldHighlightAsRecursive = isOccurrenceOfSelectedFrame(selectedDescriptor, descriptor);

	final ValueMarkup markup = descriptor.getValueMarkup();
	if(markup != null)
	{
		component.append("[" + markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
	}

	boolean needSeparator = false;
	//if (index > 0) {
	//  final int currentFrameIndex = descriptor.getUiIndex();
	//  final Object elementAt = list.getModel().getElementAt(index - 1);
	//  if (elementAt instanceof StackFrameDescriptorImpl) {
	//    StackFrameDescriptorImpl previousDescriptor = (StackFrameDescriptorImpl)elementAt;
	//    final int previousFrameIndex = previousDescriptor.getUiIndex();
	//    needSeparator = (currentFrameIndex - previousFrameIndex != 1);
	//  }
	//}

	//if (selected) {
	//  setBackground(UIUtil.getListSelectionBackground());
	//}
	//else {
	//  Color bg = descriptor.getBackgroundColor();
	//  if (bg == null) bg = UIUtil.getListBackground();
	//  if (shouldHighlightAsRecursive) bg = myColorScheme.getColor(DebuggerColors.RECURSIVE_CALL_ATTRIBUTES);
	//  setBackground(bg);
	//}
	//
	//if (needSeparator) {
	//  final MatteBorder border = BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.GRAY);
	//  setBorder(border);
	//}
	//else {
	//  setBorder(null);
	//}

	final String label = descriptor.getLabel();
	final int openingBrace = label.indexOf("{");
	final int closingBrace = (openingBrace < 0) ? -1 : label.indexOf("}");
	final SimpleTextAttributes attributes = getAttributes(descriptor);
	if(openingBrace < 0 || closingBrace < 0)
	{
		component.append(label, attributes);
	}
	else
	{
		component.append(label.substring(0, openingBrace - 1), attributes);
		component.append(" (" + label.substring(openingBrace + 1, closingBrace) + ")", SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);

		component.append(label.substring(closingBrace + 1, label.length()), attributes);
		if(shouldHighlightAsRecursive && descriptor.isRecursiveCall())
		{
			component.append(" [" + descriptor.getOccurrenceIndex() + "]", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:63,代码来源:JavaFramesListRenderer.java


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