mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external validator for XmlElementDescriptor
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.intellij.codeInsight.daemon;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Maxim.Mossienko
|
||||
* Date: Jan 14, 2005
|
||||
* Time: 10:53:20 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public interface Validator {
|
||||
String validate(PsiElement context);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.intellij.codeInsight.daemon.impl.analysis;
|
||||
|
||||
import com.intellij.codeInsight.daemon.QuickFixProvider;
|
||||
import com.intellij.codeInsight.daemon.Validator;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
import com.intellij.codeInsight.daemon.impl.quickfix.FetchExtResourceAction;
|
||||
@@ -469,6 +470,11 @@ public class XmlHighlightVisitor extends PsiElementVisitor{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (elementDescriptor instanceof Validator) {
|
||||
final String s = ((Validator)elementDescriptor).validate(tag);
|
||||
myResult.add(HighlightInfo.createHighlightInfo(HighlightInfoType.WRONG_REF,tag,s));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkRootTag(XmlTag tag) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.j2ee.openapi.impl.ExternalResourceManagerImpl;
|
||||
import com.intellij.codeInsight.daemon.Validator;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -20,7 +21,7 @@ import com.intellij.j2ee.openapi.impl.ExternalResourceManagerImpl;
|
||||
* Time: 8:55:41 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class TldTagDescriptor implements XmlElementDescriptor {
|
||||
public class TldTagDescriptor implements XmlElementDescriptor,Validator {
|
||||
private XmlTag myTag;
|
||||
private String myName;
|
||||
private XmlAttributeDescriptor[] myAttributeDescriptors;
|
||||
@@ -144,4 +145,8 @@ public class TldTagDescriptor implements XmlElementDescriptor {
|
||||
public Object[] getDependences() {
|
||||
return new Object[]{myTag, ExternalResourceManagerImpl.getInstance()};
|
||||
}
|
||||
|
||||
public String validate(PsiElement context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user