本文整理汇总了Java中com.intellij.util.xml.highlighting.DomElementAnnotationsManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java DomElementAnnotationsManager.getInstance方法的具体用法?Java DomElementAnnotationsManager.getInstance怎么用?Java DomElementAnnotationsManager.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.xml.highlighting.DomElementAnnotationsManager
的用法示例。
在下文中一共展示了DomElementAnnotationsManager.getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doUpdate
import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; //导入方法依赖的package包/类
@Override
protected void doUpdate() {
if (!myDomElement.isValid()) return;
final Project project = myDomElement.getManager().getProject();
if (project.isDisposed()) return;
setUniformIcon(getNodeIcon());
clearColoredText();
final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project);
final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(myDomElement);
final List<DomElementProblemDescriptor> problems =
holder.getProblems(myDomElement, highlightIfChildrenHaveProblems(), HighlightSeverity.ERROR);
if (problems.size() > 0) {
final String toolTip = TooltipUtils.getTooltipText(problems);
addColoredFragment(getNodeName(), toolTip, getWavedAttributes(SimpleTextAttributes.STYLE_PLAIN));
if (isShowContainingFileInfo()) {
addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", toolTip, SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
else if (myDomElement.getXmlTag() == null && !(myDomElement instanceof DomFileElement)) {
addColoredFragment(getNodeName(), folder ? SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
else if (folder) {
addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
final int childrenCount = getChildren().length;
addColoredFragment(" (" + childrenCount + ')', SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (isShowContainingFileInfo()) {
addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
示例2: hasErrors
import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; //导入方法依赖的package包/类
private boolean hasErrors() {
if (!myParentElement.isValid()) return false;
for (DomElement domElement : myChildDescription.getStableValues(myParentElement)) {
final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(getProject());
final DomElementsProblemsHolder holder = annotationsManager.getCachedProblemHolder(domElement);
final List<DomElementProblemDescriptor> problems = holder.getProblems(domElement, true, HighlightSeverity.ERROR);
if (problems.size() > 0) return true;
}
return false;
}
示例3: doUpdate
import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; //导入方法依赖的package包/类
protected void doUpdate() {
if (!myDomElement.isValid()) return;
final Project project = myDomElement.getManager().getProject();
if (project.isDisposed()) return;
setUniformIcon(getNodeIcon());
clearColoredText();
final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project);
final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(myDomElement);
final List<DomElementProblemDescriptor> problems =
holder.getProblems(myDomElement, highlightIfChildrenHaveProblems(), HighlightSeverity.ERROR);
if (problems.size() > 0) {
final String toolTip = TooltipUtils.getTooltipText(problems);
addColoredFragment(getNodeName(), toolTip, getWavedAttributes(SimpleTextAttributes.STYLE_PLAIN));
if (isShowContainingFileInfo()) {
addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", toolTip, SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
else if (myDomElement.getXmlTag() == null && !(myDomElement instanceof DomFileElement)) {
addColoredFragment(getNodeName(), folder ? SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
else if (folder) {
addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
final int childrenCount = getChildren().length;
addColoredFragment(" (" + childrenCount + ')', SimpleTextAttributes.GRAY_ATTRIBUTES);
}
else {
addColoredFragment(getNodeName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (isShowContainingFileInfo()) {
addColoredFragment(" (" + DomUtil.getFile(myDomElement).getName() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
示例4: getTableCellRendererComponent
import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
final Component component = myRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (!myRoot.isValid()) {
return component;
}
final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(myRowDomElement.getManager().getProject());
final DomElementsProblemsHolder holder = annotationsManager.getCachedProblemHolder(myRoot);
final List<DomElementProblemDescriptor> errorProblems = holder.getProblems(myCellValueDomElement);
final List<DomElementProblemDescriptor> warningProblems = new ArrayList<DomElementProblemDescriptor>(holder.getProblems(myCellValueDomElement, true, HighlightSeverity.WARNING));
warningProblems.removeAll(errorProblems);
final boolean hasErrors = errorProblems.size() > 0;
if (hasErrors) {
component.setForeground(JBColor.RED);
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(TooltipUtils.getTooltipText(errorProblems));
}
}
else {
component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(null);
}
}
// highlight empty cell with errors
if (hasErrors && (value == null || value.toString().trim().length() == 0)) {
component.setBackground(BaseControl.ERROR_BACKGROUND);
}
else if (warningProblems.size() > 0) {
component.setBackground(BaseControl.WARNING_BACKGROUND);
if(isSelected) component.setForeground(JBColor.foreground());
}
final List<DomElementProblemDescriptor> errorDescriptors =
annotationsManager.getCachedProblemHolder(myRowDomElement).getProblems(myRowDomElement, true, true);
if (table.getModel().getColumnCount() - 1 == column) {
if (errorDescriptors.size() > 0) {
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(component, BorderLayout.CENTER);
wrapper.setBackground(component.getBackground());
final JLabel errorLabel = new JLabel(getErrorIcon());
wrapper.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors));
wrapper.add(errorLabel, BorderLayout.EAST);
if (component instanceof JComponent) {
final JComponent jComponent = (JComponent)component;
wrapper.setBorder(jComponent.getBorder());
jComponent.setBorder(BorderFactory.createEmptyBorder());
jComponent.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors));
}
return wrapper;
} else {
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(null);
}
}
}
return component;
}
示例5: getTableCellRendererComponent
import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
final Component component = myRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (!myRoot.isValid()) {
return component;
}
final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(myRowDomElement.getManager().getProject());
final DomElementsProblemsHolder holder = annotationsManager.getCachedProblemHolder(myRoot);
final List<DomElementProblemDescriptor> errorProblems = holder.getProblems(myCellValueDomElement);
final List<DomElementProblemDescriptor> warningProblems = new ArrayList<DomElementProblemDescriptor>(holder.getProblems(myCellValueDomElement, true, HighlightSeverity.WARNING));
warningProblems.removeAll(errorProblems);
final boolean hasErrors = errorProblems.size() > 0;
if (hasErrors) {
component.setForeground(JBColor.RED);
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(TooltipUtils.getTooltipText(errorProblems));
}
}
else {
component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(null);
}
}
// highlight empty cell with errors
if (hasErrors && (value == null || value.toString().trim().length() == 0)) {
component.setBackground(BaseControl.ERROR_BACKGROUND);
}
else if (warningProblems.size() > 0) {
component.setBackground(BaseControl.WARNING_BACKGROUND);
if(isSelected) component.setForeground(JBColor.foreground());
}
final List<DomElementProblemDescriptor> errorDescriptors =
annotationsManager.getCachedProblemHolder(myRowDomElement).getProblems(myRowDomElement, true, true);
if (table.getModel().getColumnCount() - 1 == column) {
if (errorDescriptors.size() > 0) {
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(component, BorderLayout.CENTER);
wrapper.setBackground(component.getBackground());
final JLabel errorLabel = new JLabel(getErrorIcon());
wrapper.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors));
wrapper.add(errorLabel, BorderLayout.EAST);
if (component instanceof JComponent) {
final JComponent jComponent = (JComponent)component;
wrapper.setBorder(jComponent.getBorder());
jComponent.setBorder(BorderFactory.createEmptyBorder());
jComponent.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors));
}
return wrapper;
} else {
if (component instanceof JComponent) {
((JComponent)component).setToolTipText(null);
}
}
}
return component;
}