本文整理汇总了Java中com.intellij.ui.SimpleColoredComponent类的典型用法代码示例。如果您正苦于以下问题:Java SimpleColoredComponent类的具体用法?Java SimpleColoredComponent怎么用?Java SimpleColoredComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleColoredComponent类属于com.intellij.ui包,在下文中一共展示了SimpleColoredComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponent
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
@NotNull
@Override
public JComponent getComponent(@NotNull final DiffContext context) {
final SimpleColoredComponent label = new SimpleColoredComponent();
label.append("Can't show diff for unknown file type. ",
new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
if (myFileName != null) {
label.append("Associate", SimpleTextAttributes.LINK_ATTRIBUTES, new Runnable() {
@Override
public void run() {
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
@Override
public void run() {
FileType type = FileTypeChooser.associateFileType(myFileName);
if (type != null) onSuccess(context);
}
});
}
});
LinkMouseListenerBase.installSingleTagOn(label);
}
return DiffUtil.createMessagePanel(label);
}
示例2: appendFragmentsForSpeedSearch
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public static void appendFragmentsForSpeedSearch(@NotNull JComponent speedSearchEnabledComponent,
@NotNull String text,
@NotNull SimpleTextAttributes attributes,
boolean selected,
@NotNull SimpleColoredComponent simpleColoredComponent) {
final SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent);
if (speedSearch != null) {
final Iterable<TextRange> fragments = speedSearch.matchingFragments(text);
if (fragments != null) {
final Color fg = attributes.getFgColor();
final Color bg = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(simpleColoredComponent, text, fragments, plain, highlighted);
return;
}
}
simpleColoredComponent.append(text, attributes);
}
示例3: appendColoredFragmentForMatcher
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public static void appendColoredFragmentForMatcher(@NotNull String text,
SimpleColoredComponent component,
@NotNull final SimpleTextAttributes attributes,
Matcher matcher,
Color selectedBg,
boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
示例4: installSingleTagOn
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public static void installSingleTagOn(@NotNull SimpleColoredComponent component) {
new LinkMouseListenerBase<Object>() {
@Nullable
@Override
protected Object getTagAt(@NotNull MouseEvent e) {
//noinspection unchecked
return ((SimpleColoredComponent)e.getSource()).getFragmentTagAt(e.getX());
}
@Override
protected void handleTagClick(@Nullable Object tag, @NotNull MouseEvent event) {
if (tag != null) {
if (tag instanceof Consumer) {
//noinspection unchecked
((Consumer<MouseEvent>)tag).consume(event);
}
else {
((Runnable)tag).run();
}
}
}
}.installOn(component);
}
示例5: FixedHotfixGroupElement
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public FixedHotfixGroupElement(String name, Object data, VirtualFile file) {
super(name, data, file);
myCustomizeColoredTreeCellRenderer = new CustomizeColoredTreeCellRenderer() {
public void customizeCellRenderer(SimpleColoredComponent renderer,
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
renderer.setIcon(AllIcons.General.Information);
renderer.append("Fixed: ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
final String[] text = getText();
final String checkedText = ((text != null) && (text.length > 0)) ? text[0] : "";
renderer.append(checkedText, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
};
}
示例6: HotfixGroupElement
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public HotfixGroupElement(final String name, final Object data, final VirtualFile file, final Consumer<HotfixGate> hotfix,
final String fixDescription, final MutableErrorTreeView view) {
super(name, data, file);
myHotfix = hotfix;
myFixDescription = fixDescription;
myView = view;
myLeftTreeCellRenderer = new CustomizeColoredTreeCellRenderer() {
public void customizeCellRenderer(SimpleColoredComponent renderer,
JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
renderer.setIcon(AllIcons.General.Error);
final String[] text = getText();
final String errorText = ((text != null) && (text.length > 0)) ? text[0] : "";
renderer.append("Error: " + errorText, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
};
myRightTreeCellRenderer = new MyRightRenderer();
}
示例7: SetValueInplaceEditor
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
private SetValueInplaceEditor(final XValueNodeImpl node, @NotNull final String nodeName) {
super(node, "setValue");
myValueNode = node;
myModifier = myValueNode.getValueContainer().getModifier();
myEditorPanel = new JPanel();
myEditorPanel.setLayout(new BorderLayout(0, 0));
SimpleColoredComponent nameLabel = new SimpleColoredComponent();
nameLabel.setIcon(getNode().getIcon());
nameLabel.append(nodeName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
XValuePresentation presentation = node.getValuePresentation();
if (presentation != null) {
XValuePresentationUtil.appendSeparator(nameLabel, presentation.getSeparator());
}
myEditorPanel.add(nameLabel, BorderLayout.WEST);
myEditorPanel.add(myExpressionEditor.getComponent(), BorderLayout.CENTER);
}
示例8: appendGroupText
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
private void appendGroupText(final GroupNode node, JPanel panel, Color fileBgColor) {
UsageGroup group = node == null ? null : node.getGroup();
if (group == null) return;
GroupNode parentGroup = (GroupNode)node.getParent();
appendGroupText(parentGroup, panel, fileBgColor);
if (node.canNavigateToSource()) {
SimpleColoredComponent renderer = new SimpleColoredComponent();
renderer.setIcon(group.getIcon(false));
SimpleTextAttributes attributes = deriveAttributesWithColor(SimpleTextAttributes.REGULAR_ATTRIBUTES, fileBgColor);
renderer.append(group.getText(myUsageView), attributes);
renderer.append(" ", attributes);
renderer.setIpad(new Insets(0,0,0,0));
renderer.setBorder(null);
panel.add(renderer);
}
}
示例9: createNorthPanel
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
@Override
protected JComponent createNorthPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.insets = new Insets(0, 0, UIUtil.DEFAULT_VGAP, 0);
gbConstraints.fill = GridBagConstraints.NONE;
gbConstraints.weightx = 1;
gbConstraints.weighty = 1;
gbConstraints.anchor = GridBagConstraints.WEST;
final SimpleColoredComponent coloredComponent = new SimpleColoredComponent();
coloredComponent.setIpad(new Insets(0,0,0,0));
coloredComponent.setMyBorder(null);
configureLabelComponent(coloredComponent);
panel.add(coloredComponent, gbConstraints);
return panel;
}
示例10: getFindUsagesDialog
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
@NotNull
@Override
public AbstractFindUsagesDialog getFindUsagesDialog(boolean isSingleFile, boolean toShowInNewTab, boolean mustOpenInNewTab) {
return new CommonFindUsagesDialog(myElement,
getProject(),
getFindUsagesOptions(),
toShowInNewTab,
mustOpenInNewTab,
isSingleFile,
this) {
@Override
public void configureLabelComponent(@NotNull final SimpleColoredComponent coloredComponent) {
coloredComponent.append(myElement instanceof PsiDirectory ? "Package " : "Module ");
coloredComponent.append(myElement.getName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
};
}
示例11: decorateTree
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
@Override
public void decorateTree(SimpleColoredComponent renderer, AttributeWrapper wrapper) {
XmlTag tag = getTag();
StringBuilder value = new StringBuilder(" (");
String namespace = getGridLayoutNamespace(this);
String rowCount = tag.getAttributeValue(ATTR_ROW_COUNT, namespace);
value.append(StringUtil.isEmpty(rowCount) ? "?" : rowCount).append(", ");
String columnCount = tag.getAttributeValue(ATTR_COLUMN_COUNT, namespace);
value.append(StringUtil.isEmpty(columnCount) ? "?" : columnCount).append(", ");
value.append(isHorizontal() ? VALUE_HORIZONTAL : VALUE_VERTICAL);
renderer.append(value.append(")").toString(), wrapper.getAttribute(SimpleTextAttributes.REGULAR_ATTRIBUTES));
}
示例12: appendFragmentsForSpeedSearch
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public static void appendFragmentsForSpeedSearch(@NotNull final JComponent speedSearchEnabledComponent, @NotNull final String text,
@NotNull final SimpleTextAttributes attributes, final boolean selected,
@NotNull final SimpleColoredComponent simpleColoredComponent) {
final SpeedSearchSupply speedSearch = SpeedSearchSupply.getSupply(speedSearchEnabledComponent);
if (speedSearch != null) {
final Iterable<TextRange> fragments = speedSearch.matchingFragments(text);
if (fragments != null) {
final Color fg = attributes.getFgColor();
final Color bg = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(bg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(simpleColoredComponent, text, fragments, plain, highlighted);
return;
}
}
simpleColoredComponent.append(text, attributes);
}
示例13: appendColoredFragmentForMatcher
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public static void appendColoredFragmentForMatcher(@NotNull final String text,
final SimpleColoredComponent component,
@NotNull final SimpleTextAttributes attributes,
final Matcher matcher,
final Color selectedBg,
final boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
示例14: ArrangementStandardSettingsManager
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public ArrangementStandardSettingsManager(@NotNull ArrangementStandardSettingsAware delegate,
@NotNull ArrangementColorsProvider colorsProvider)
{
myDelegate = delegate;
myColorsProvider = colorsProvider;
myMutexes = delegate.getMutexes();
myDefaultSettings = delegate.getDefaultSettings();
SimpleColoredComponent renderer = new SimpleColoredComponent();
myGroupingTokens = delegate.getSupportedGroupingTokens();
if (myGroupingTokens != null) {
parseWidths(myGroupingTokens, renderer);
buildWeights(myGroupingTokens);
}
myMatchingTokens = delegate.getSupportedMatchingTokens();
if (myMatchingTokens != null) {
parseWidths(myMatchingTokens, renderer);
buildWeights(myMatchingTokens);
}
}
示例15: SetValueInplaceEditor
import com.intellij.ui.SimpleColoredComponent; //导入依赖的package包/类
public SetValueInplaceEditor(final XValueNodeImpl node, @NotNull final String nodeName) {
super(node, "setValue");
myValueNode = node;
myModifier = myValueNode.getValueContainer().getModifier();
myEditorPanel = new JPanel();
myEditorPanel.setLayout(new BorderLayout(0, 0));
SimpleColoredComponent nameLabel = new SimpleColoredComponent();
nameLabel.setIcon(getNode().getIcon());
nameLabel.append(nodeName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
final String separator = node.getSeparator();
if (separator != null) {
nameLabel.append(separator, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
myEditorPanel.add(nameLabel, BorderLayout.WEST);
myEditorPanel.add(myExpressionEditor.getComponent(), BorderLayout.CENTER);
final String value = myModifier != null ? myModifier.getInitialValueEditorText() : null;
myExpressionEditor.setText(value != null ? value : "");
myExpressionEditor.selectAll();
}