use of com.intellij.util.xml.GenericDomValue in project intellij-community by JetBrains.
the class PsiClassControl method initReferenceEditorWithBrowseButton.
protected static <T extends JPanel> T initReferenceEditorWithBrowseButton(final T boundedComponent, final ReferenceEditorWithBrowseButton editor, final EditorTextFieldControl control) {
boundedComponent.removeAll();
boundedComponent.add(editor);
final GlobalSearchScope resolveScope = control.getDomWrapper().getResolveScope();
editor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final DomElement domElement = control.getDomElement();
ExtendClass extend = domElement.getAnnotation(ExtendClass.class);
PsiClass baseClass = null;
ClassFilter filter = null;
if (extend != null) {
baseClass = JavaPsiFacade.getInstance(control.getProject()).findClass(extend.value(), resolveScope);
if (extend.instantiatable()) {
filter = ClassFilter.INSTANTIABLE;
}
}
PsiClass initialClass = null;
if (domElement instanceof GenericDomValue) {
final Object value = ((GenericDomValue) domElement).getValue();
if (value instanceof PsiClass)
initialClass = (PsiClass) value;
}
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(control.getProject()).createInheritanceClassChooser(UIBundle.message("choose.class"), resolveScope, baseClass, initialClass, filter);
chooser.showDialog();
final PsiClass psiClass = chooser.getSelected();
if (psiClass != null) {
control.setValue(psiClass.getQualifiedName());
}
}
});
return boundedComponent;
}
use of com.intellij.util.xml.GenericDomValue in project intellij-community by JetBrains.
the class AntResolveInspection method checkDomElement.
protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) {
if (element instanceof GenericDomValue) {
final XmlElement valueElement = DomUtil.getValueElement(((GenericDomValue) element));
if (valueElement != null) {
checkReferences(valueElement, holder, element);
}
} else if (element instanceof AntDomTypeDef) {
final AntDomTypeDef typeDef = (AntDomTypeDef) element;
final List<String> errors = typeDef.getErrorDescriptions();
if (!errors.isEmpty()) {
final StringBuilder builder = new StringBuilder();
builder.append(AntBundle.message("failed.to.load.types")).append(":");
for (String error : errors) {
builder.append("\n").append(error);
}
holder.createProblem(typeDef, builder.toString());
}
} else if (element instanceof AntDomCustomElement) {
final AntDomCustomElement custom = (AntDomCustomElement) element;
if (custom.getDefinitionClass() == null) {
final AntDomNamedElement declaringElement = custom.getDeclaringElement();
if (declaringElement instanceof AntDomTypeDef) {
String failedMessage = AntBundle.message("using.definition.which.type.failed.to.load");
final String error = custom.getLoadError();
if (error != null) {
failedMessage = failedMessage + ": " + error;
}
holder.createProblem(custom, failedMessage);
}
}
}
}
Aggregations