本文整理汇总了Java中com.intellij.ui.SimpleColoredRenderer类的典型用法代码示例。如果您正苦于以下问题:Java SimpleColoredRenderer类的具体用法?Java SimpleColoredRenderer怎么用?Java SimpleColoredRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleColoredRenderer类属于com.intellij.ui包,在下文中一共展示了SimpleColoredRenderer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: describe
import com.intellij.ui.SimpleColoredRenderer; //导入依赖的package包/类
private void describe(@NotNull SimpleColoredRenderer renderer,
@NotNull AttributeWrapper wrapper,
@NotNull RadComponent component,
boolean showSelected,
int depth) {
SimpleTextAttributes style = wrapper.getAttribute(SimpleTextAttributes.REGULAR_ATTRIBUTES);
for (int i = 0; i < depth; i++) {
renderer.append(" ", style);
}
if (showSelected && myPanel.getSurfaceArea().isSelected(component)) {
renderer.append("*");
}
myPanel.getTreeDecorator().decorate(component, renderer, wrapper, true);
renderer.append("\n", style);
for (RadComponent child : component.getChildren()) {
describe(renderer, wrapper, child, showSelected, depth + 1);
}
}
示例2: decorate
import com.intellij.ui.SimpleColoredRenderer; //导入依赖的package包/类
private static void decorate(StringBuilder sb, RadViewComponent component, int depth) {
for (int i = 0; i < depth; i++) {
sb.append(" ");
}
SimpleColoredRenderer renderer = new SimpleColoredRenderer();
AndroidTreeDecorator decorator = new AndroidTreeDecorator(RadModelBuilder.getProject(component));
decorator.decorate(component, renderer, AttributeWrapper.DEFAULT, true);
sb.append(renderer);
sb.append('\n');
for (RadViewComponent child : RadViewComponent.getViewComponents(component.getChildren())) {
decorate(sb, child, depth + 1);
}
}
示例3: describeComponents
import com.intellij.ui.SimpleColoredRenderer; //导入依赖的package包/类
/**
* Describes the current state of the components. This is similar to
* {@link #describeComponentTree(boolean)}, but this will unconditionally
* show all components, whereas {@link #describeComponentTree(boolean)} will
* not show nodes that have not been expanded/loaded.
*
* @param showSelected if true, mark selected items in the description
* @return a description of the components hierarchy
*/
public String describeComponents(final boolean showSelected) {
final StringBuilder sb = new StringBuilder(100);
final RadComponent root = myPanel.getRootComponent();
if (root != null) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
SimpleColoredRenderer renderer = new SimpleColoredRenderer();
AttributeWrapper wrapper = new AttributeWrapper() {
@Override
public SimpleTextAttributes getAttribute(SimpleTextAttributes attributes) {
return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}
};
describe(renderer, wrapper, root, showSelected, 0);
SimpleColoredComponent.ColoredIterator iterator = renderer.iterator();
while (iterator.hasNext()) {
iterator.next();
sb.append(iterator.getFragment());
}
}
});
}
return sb.toString();
}
示例4: describeComponentTree
import com.intellij.ui.SimpleColoredRenderer; //导入依赖的package包/类
/**
* Describes the current state of the component tree. Like {@link #describeComponents(boolean)}, but queries the actual UI tree widget
* rather than the internal component hierarchy. This means it won't include UI nodes that have not been created yet, such as nodes in
* unexpanded part of the tree.
*
* @param showSelected if true, mark selected items in the description
* @return a description of the component tree
*/
public String describeComponentTree(final boolean showSelected) {
final StringBuilder sb = new StringBuilder(100);
DesignerToolWindow toolWindow = myPanel.getToolWindow();
if (toolWindow != null) {
final ComponentTree componentTree = toolWindow.getComponentTree();
final TreeModel model = componentTree.getModel();
final Object root = model.getRoot();
if (root != null) {
execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
SimpleColoredRenderer renderer = new SimpleColoredRenderer();
AttributeWrapper wrapper = new AttributeWrapper() {
@Override
public SimpleTextAttributes getAttribute(SimpleTextAttributes attributes) {
return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}
};
if (componentTree.isRootVisible()) {
describe(renderer, wrapper, componentTree, model, root, showSelected, 0);
}
else {
for (int i = 0, n = model.getChildCount(root); i < n; i++) {
Object child = model.getChild(root, i);
describe(renderer, wrapper, componentTree, model, child, showSelected, 0);
}
}
SimpleColoredComponent.ColoredIterator iterator = renderer.iterator();
while (iterator.hasNext()) {
iterator.next();
sb.append(iterator.getFragment());
}
}
});
}
}
return sb.toString();
}