本文整理汇总了Java中com.intellij.util.xml.highlighting.DomElementAnnotationHolder类的典型用法代码示例。如果您正苦于以下问题:Java DomElementAnnotationHolder类的具体用法?Java DomElementAnnotationHolder怎么用?Java DomElementAnnotationHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DomElementAnnotationHolder类属于com.intellij.util.xml.highlighting包,在下文中一共展示了DomElementAnnotationHolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkForProblems
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
public List<DomElementProblemDescriptor> checkForProblems(@NotNull final ExtendClass extend, @NotNull final DomElement _element, @NotNull final DomElementAnnotationHolder holder,
@NotNull final DomHighlightingHelper helper) {
if (!(_element instanceof GenericDomValue)) return Collections.emptyList();
GenericDomValue element = (GenericDomValue)_element;
if (!isPsiClassType(element)) return Collections.emptyList();
final Object valueObject = element.getValue();
PsiClass psiClass = null;
if (valueObject instanceof PsiClass) {
psiClass = (PsiClass)valueObject;
} else if (valueObject instanceof PsiClassType) {
psiClass = ((PsiClassType)valueObject).resolve();
}
if (psiClass != null) {
return checkExtendClass(element, psiClass, extend.value(),
extend.instantiatable(), extend.canBeDecorator(), extend.allowInterface(),
extend.allowNonPublic(), extend.allowAbstract(), extend.allowEnum(), holder);
}
return Collections.emptyList();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExtendsClassChecker.java
示例2: addProblems
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void addProblems(DomElement element, MavenDomProjectModel model, DomElementAnnotationHolder holder,
MavenProjectProblem.ProblemType... types) {
MavenProject mavenProject = MavenDomUtil.findProject(model);
if (mavenProject != null) {
for (MavenProjectProblem each : mavenProject.getProblems()) {
MavenProjectProblem.ProblemType type = each.getType();
if (!Arrays.asList(types).contains(type)) continue;
VirtualFile problemFile = LocalFileSystem.getInstance().findFileByPath(each.getPath());
LocalQuickFix[] fixes = LocalQuickFix.EMPTY_ARRAY;
if (problemFile != null && !Comparing.equal(mavenProject.getFile(), problemFile)) {
fixes = new LocalQuickFix[]{new OpenProblemFileFix(problemFile)};
}
holder.createProblem(element, HighlightSeverity.ERROR, each.getDescription(), fixes);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MavenDomAnnotator.java
示例3: addProblem
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void addProblem(@NotNull MavenDomDependency dependency,
@NotNull Collection<MavenDomDependency> dependencies,
@NotNull DomElementAnnotationHolder holder) {
StringBuilder sb = new StringBuilder();
Set<MavenDomProjectModel> processed = new HashSet<MavenDomProjectModel>();
for (MavenDomDependency domDependency : dependencies) {
if (dependency.equals(domDependency)) continue;
MavenDomProjectModel model = domDependency.getParentOfType(MavenDomProjectModel.class, false);
if (model != null && !processed.contains(model)) {
if (processed.size() > 0) sb.append(", ");
sb.append(createLinkText(model, domDependency));
processed.add(model);
}
}
holder.createProblem(dependency, HighlightSeverity.WARNING,
MavenDomBundle.message("MavenDuplicateDependenciesInspection.has.duplicates", sb.toString()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenDuplicateDependenciesInspection.java
示例4: checkDomElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
if (element instanceof AntDomProperty) {
final AntDomProperty property = (AntDomProperty)element;
final GenericAttributeValue<PsiFileSystemItem> fileValue = property.getFile();
final String fileName = fileValue.getStringValue();
if (fileName != null) {
final PropertiesFile propertiesFile = property.getPropertiesFile();
if (propertiesFile == null) {
final PsiFileSystemItem file = fileValue.getValue();
if (file instanceof XmlFile) {
holder.createProblem(fileValue, AntBundle.message("file.type.xml.not.supported", fileName));
}
else if (file instanceof PsiFile) {
holder.createProblem(fileValue, AntBundle.message("file.type.not.supported", fileName));
}
else {
holder.createProblem(fileValue, AntBundle.message("file.doesnt.exist", fileName));
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntMissingPropertiesFileInspection.java
示例5: addProblems
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private void addProblems(DomElement element, MavenDomProjectModel model, DomElementAnnotationHolder holder,
MavenProjectProblem.ProblemType... types) {
MavenProject mavenProject = MavenDomUtil.findProject(model);
if (mavenProject != null) {
for (MavenProjectProblem each : mavenProject.getProblems()) {
MavenProjectProblem.ProblemType type = each.getType();
if (!Arrays.asList(types).contains(type)) continue;
VirtualFile problemFile = LocalFileSystem.getInstance().findFileByPath(each.getPath());
LocalQuickFix[] fixes = LocalQuickFix.EMPTY_ARRAY;
if (problemFile != null && !Comparing.equal(mavenProject.getFile(), problemFile)) {
fixes = new LocalQuickFix[]{new OpenProblemFileFix(problemFile)};
}
holder.createProblem(element, HighlightSeverity.ERROR, each.getDescription(), fixes);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:MavenDomAnnotator.java
示例6: checkSymbol
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
protected void checkSymbol(IbatisSqlMapModel sqlMapModel, SqlMap sqlMap, DomElement domElement, DomElementAnnotationHolder holder, PsiClass parameterClass) {
if (parameterClass == null) return;
Set<String> inlineParameters = new HashSet<String>();
String[] words = getAllTextInTag(domElement.getXmlTag()).trim().split("\\s+");
if (words != null) {
for (String word : words) {
if (word.startsWith("#") && word.endsWith("#")) // symbol
{
String parameterName = getParameterRealName(word);
inlineParameters.add(parameterName);
}
}
}
//domain class validation
if (IbatisClassShortcutsReferenceProvider.isDomain(parameterClass.getName())) {
for (String inlineParameter : inlineParameters) {
if (!isFieldOfPsiClass(parameterClass, inlineParameter.split("\\."))) { //not a valid field for domain class
holder.createProblem(domElement, HighlightSeverity.WARNING, IbatisBundle.message("ibatis.sqlmap.inspection.symbolinsql.error", inlineParameter));
}
}
}
}
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:23,代码来源:SymbolInSQLInspection.java
示例7: checkExtendsClassInReferences
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
public static List<DomElementProblemDescriptor> checkExtendsClassInReferences(final GenericDomValue element, final DomElementAnnotationHolder holder) {
if (!isPsiClassType(element)) {
return Collections.emptyList();
}
final Object valueObject = element.getValue();
if (!(valueObject instanceof PsiClass)) return Collections.emptyList();
final XmlElement valueElement = DomUtil.getValueElement(element);
if (valueElement == null) return Collections.emptyList();
final PsiReference[] references = ourProvider.getReferencesByElement(valueElement, new ProcessingContext());
for (PsiReference reference : references) {
if (reference instanceof JavaClassReference) {
final PsiReferenceProvider psiReferenceProvider = ((JavaClassReference)reference).getProvider();
final String[] value = psiReferenceProvider instanceof JavaClassReferenceProvider ? JavaClassReferenceProvider.EXTEND_CLASS_NAMES
.getValue(((JavaClassReferenceProvider)psiReferenceProvider).getOptions()) : null;
if (value != null && value.length != 0) {
for (String className : value) {
final List<DomElementProblemDescriptor> problemDescriptors =
checkExtendClass(element, ((PsiClass)valueObject), className, false, false, true, false, true, true, holder);
if (!problemDescriptors.isEmpty()) {
return problemDescriptors;
}
}
}
}
}
return Collections.emptyList();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ExtendsClassChecker.java
示例8: annotate
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
public void annotate(DomElement element, DomElementAnnotationHolder holder) {
if (element instanceof MavenDomProjectModel) {
addProblems(element, (MavenDomProjectModel)element, holder,
MavenProjectProblem.ProblemType.STRUCTURE,
MavenProjectProblem.ProblemType.SETTINGS_OR_PROFILES);
}
else if (element instanceof MavenDomParent) {
addProblems(element, DomUtil.getParentOfType(element, MavenDomProjectModel.class, true), holder,
MavenProjectProblem.ProblemType.PARENT);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MavenDomAnnotator.java
示例9: checkFileElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
@Override
public void checkFileElement(DomFileElement<MavenDomProjectModel> domFileElement,
DomElementAnnotationHolder holder) {
MavenDomProjectModel projectModel = domFileElement.getRootElement();
MultiMap<Pair<String,String>, MavenDomPlugin> duplicates = MultiMap.createSet();
for (MavenDomPlugin plugin : projectModel.getBuild().getPlugins().getPlugins()) {
String groupId = plugin.getGroupId().getStringValue();
String artifactId = plugin.getArtifactId().getStringValue();
if (StringUtil.isEmptyOrSpaces(artifactId)) continue;
if ("".equals(groupId) || "org.apache.maven.plugins".equals(groupId) || "org.codehaus.mojo".equals(groupId)) {
groupId = null;
}
duplicates.putValue(Pair.create(groupId, artifactId), plugin);
}
for (Map.Entry<Pair<String,String>, Collection<MavenDomPlugin>> entry : duplicates.entrySet()) {
Collection<MavenDomPlugin> set = entry.getValue();
if (set.size() <= 1) continue;
for (MavenDomPlugin dependency : set) {
holder.createProblem(dependency, HighlightSeverity.WARNING, "Duplicated plugin declaration");
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MavenDuplicatePluginInspection.java
示例10: checkFileElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
@Override
public void checkFileElement(DomFileElement<MavenDomProjectModel> domFileElement,
DomElementAnnotationHolder holder) {
MavenDomProjectModel projectModel = domFileElement.getRootElement();
checkManagedDependencies(projectModel, holder);
checkDependencies(projectModel, holder);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MavenDuplicateDependenciesInspection.java
示例11: checkDependencies
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void checkDependencies(@NotNull MavenDomProjectModel projectModel,
@NotNull DomElementAnnotationHolder holder) {
MultiMap<DependencyConflictId, MavenDomDependency> allDuplicates = getDuplicateDependenciesMap(projectModel);
for (MavenDomDependency dependency : projectModel.getDependencies().getDependencies()) {
DependencyConflictId id = DependencyConflictId.create(dependency);
if (id != null) {
Collection<MavenDomDependency> dependencies = allDuplicates.get(id);
if (dependencies.size() > 1) {
List<MavenDomDependency> duplicatedDependencies = new ArrayList<MavenDomDependency>();
for (MavenDomDependency d : dependencies) {
if (d == dependency) continue;
if (d.getParent() == dependency.getParent()) {
duplicatedDependencies.add(d); // Dependencies in the same file must be unique by groupId:artifactId:type:classifier
}
else {
if (scope(d).equals(scope(dependency))
&& Comparing.equal(d.getVersion().getStringValue(), dependency.getVersion().getStringValue())) {
duplicatedDependencies.add(d); // Dependencies in different files must not have same groupId:artifactId:VERSION:type:classifier:SCOPE
}
}
}
if (duplicatedDependencies.size() > 0) {
addProblem(dependency, duplicatedDependencies, holder);
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:MavenDuplicateDependenciesInspection.java
示例12: checkManagedDependencies
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void checkManagedDependencies(@NotNull MavenDomProjectModel projectModel,
@NotNull DomElementAnnotationHolder holder) {
MultiMap<DependencyConflictId, MavenDomDependency> duplicates = MultiMap.createSet();
collect(duplicates, projectModel.getDependencyManagement().getDependencies());
for (Map.Entry<DependencyConflictId, Collection<MavenDomDependency>> entry : duplicates.entrySet()) {
Collection<MavenDomDependency> set = entry.getValue();
if (set.size() <= 1) continue;
for (MavenDomDependency dependency : set) {
holder.createProblem(dependency, HighlightSeverity.WARNING, "Duplicated dependency");
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MavenDuplicateDependenciesInspection.java
示例13: createAnnotationOnTag
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void createAnnotationOnTag(AntDomElement custom, String failedMessage, DomElementAnnotationHolder holder) {
final XmlTag tag = custom.getXmlTag();
if (tag == null) {
return;
}
final String name = custom.getXmlElementName();
final TextRange absoluteRange = new TextRange(0, name.length()).shiftRight(tag.getTextRange().getStartOffset() + 1);
holder.createProblem(custom, failedMessage);
//holder.createErrorAnnotation(absoluteRange, failedMessage);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AntAnnotator.java
示例14: checkDomElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
@Override
protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
if (element instanceof ExtensionPoint) {
ExtensionPoint extensionPoint = (ExtensionPoint)element;
if (extensionPoint.getWithElements().isEmpty() && !collectMissingWithTags(extensionPoint).isEmpty()) {
holder.createProblem(extensionPoint,
"<extensionPoint> does not have <with> tags to specify the types of class fields",
new AddWithTagFix());
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ExtensionPointBeanClassInspection.java
示例15: checkExtendsClassInReferences
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
public static List<DomElementProblemDescriptor> checkExtendsClassInReferences(final GenericDomValue element, final DomElementAnnotationHolder holder) {
if (!isPsiClassType(element)) {
return Collections.emptyList();
}
final Object valueObject = element.getValue();
if (!(valueObject instanceof PsiClass)) return Collections.emptyList();
final PsiReference[] references = ourProvider.getReferencesByElement(DomUtil.getValueElement(element), new ProcessingContext());
for (PsiReference reference : references) {
if (reference instanceof JavaClassReference) {
final PsiReferenceProvider psiReferenceProvider = ((JavaClassReference)reference).getProvider();
final String[] value = psiReferenceProvider instanceof JavaClassReferenceProvider ? JavaClassReferenceProvider.EXTEND_CLASS_NAMES
.getValue(((JavaClassReferenceProvider)psiReferenceProvider).getOptions()) : null;
if (value != null && value.length != 0) {
for (String className : value) {
final List<DomElementProblemDescriptor> problemDescriptors =
checkExtendClass(element, ((PsiClass)valueObject), className, false, false, true, false, true, true, holder);
if (!problemDescriptors.isEmpty()) {
return problemDescriptors;
}
}
}
}
}
return Collections.emptyList();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:ExtendsClassChecker.java
示例16: checkDependencies
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void checkDependencies(@NotNull MavenDomProjectModel projectModel,
@NotNull DomElementAnnotationHolder holder) {
final Map<DependencyConflictId, Set<MavenDomDependency>> allDuplicates = getDuplicateDependenciesMap(projectModel);
for (MavenDomDependency dependency : projectModel.getDependencies().getDependencies()) {
DependencyConflictId id = DependencyConflictId.create(dependency);
if (id != null) {
Set<MavenDomDependency> dependencies = allDuplicates.get(id);
if (dependencies != null && dependencies.size() > 1) {
List<MavenDomDependency> duplicatedDependencies = new ArrayList<MavenDomDependency>();
for (MavenDomDependency d : dependencies) {
if (d == dependency) continue;
if (d.getParent() == dependency.getParent()) {
duplicatedDependencies.add(d); // Dependencies in the same file must be unique by groupId:artifactId:type:classifier
}
else {
if (scope(d).equals(scope(dependency))
&& Comparing.equal(d.getVersion().getStringValue(), dependency.getVersion().getStringValue())) {
duplicatedDependencies.add(d); // Dependencies in different files must not have same groupId:artifactId:VERSION:type:classifier:SCOPE
}
}
}
if (duplicatedDependencies.size() > 0) {
addProblem(dependency, duplicatedDependencies, holder);
}
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:34,代码来源:MavenDuplicateDependenciesInspection.java
示例17: checkManagedDependencies
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void checkManagedDependencies(@NotNull MavenDomProjectModel projectModel,
@NotNull DomElementAnnotationHolder holder) {
final Map<DependencyConflictId, Set<MavenDomDependency>> duplicates = new THashMap<DependencyConflictId, Set<MavenDomDependency>>();
collect(duplicates, projectModel.getDependencyManagement().getDependencies());
for (Map.Entry<DependencyConflictId, Set<MavenDomDependency>> entry : duplicates.entrySet()) {
Set<MavenDomDependency> set = entry.getValue();
if (set.size() <= 1) continue;
for (MavenDomDependency dependency : set) {
holder.createProblem(dependency, HighlightSeverity.WARNING, "Duplicated dependency");
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:MavenDuplicateDependenciesInspection.java
示例18: checkDomElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
if (element instanceof AntDomProperty) {
final AntDomProperty property = (AntDomProperty)element;
final String fileName = property.getFile().getStringValue();
if (fileName != null) {
final PsiFileSystemItem file = property.getFile().getValue();
if (!(file instanceof PropertiesFile)) {
holder.createProblem(property.getFile(), AntBundle.message("file.doesnt.exist", fileName));
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:AntMissingPropertiesFileInspection.java
示例19: checkReferences
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
private static void checkReferences(final XmlElement xmlElement, final @NonNls DomElementAnnotationHolder holder, DomElement domElement) {
if (xmlElement == null) {
return;
}
Set<PsiReference> processed = null;
for (final PsiReference ref : xmlElement.getReferences()) {
if (!(ref instanceof AntDomReference)) {
continue;
}
final AntDomReference antDomRef = (AntDomReference)ref;
if (antDomRef.shouldBeSkippedByAnnotator()) {
continue;
}
if (processed != null && processed.contains(ref)) {
continue;
}
if (!isResolvable(ref)) {
holder.createProblem(domElement, ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, antDomRef.getUnresolvedMessagePattern(), ref.getRangeInElement(), new AntChangeContextLocalFix());
if (ref instanceof AntDomFileReference) {
if (processed == null) {
processed = new HashSet<PsiReference>();
}
ContainerUtil.addAll(processed, ((AntDomFileReference)ref).getFileReferenceSet().getAllReferences());
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:AntResolveInspection.java
示例20: checkFileElement
import com.intellij.util.xml.highlighting.DomElementAnnotationHolder; //导入依赖的package包/类
@SuppressWarnings({"ConstantConditions", "SuspiciousMethodCalls"})
public void checkFileElement(DomFileElement<SqlMap> fileElement, DomElementAnnotationHolder holder) {
SqlMap sqlMap = fileElement.getRootElement();
Module module = ModuleUtil.findModuleForPsiElement(fileElement.getXmlElement());
IbatisConfigurationModel configurationModel = IbatisManager.getInstance().getConfigurationModel(module);
if (configurationModel != null) {
Set<XmlFile> sqlMapFiles = configurationModel.getSqlMapFiles();
if (!sqlMapFiles.contains(sqlMap.getContainingFile())) {
SqlMapConfig sqlMapConfig = configurationModel.getMergedModel();
holder.createProblem(sqlMap, HighlightSeverity.WARNING, IbatisBundle.message("ibatis.sqlmap.inspection.notinconfiguration.error"), new InsertSqlMapIntoConfigurationQuickFix(sqlMapConfig, sqlMap));
}
}
}
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:14,代码来源:SqlMapFileInConfigurationInspection.java
注:本文中的com.intellij.util.xml.highlighting.DomElementAnnotationHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论