use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class XsltContextProviderExtensionBase method accepts.
public boolean accepts(XPathFile file) {
final PsiElement context = file.getContext();
if (!(context instanceof XmlElement))
return false;
final XmlAttribute att = PsiTreeUtil.getParentOfType(context, XmlAttribute.class);
if (att == null)
return false;
return XsltSupport.isXPathAttribute(att) ? acceptsLanguage(file.getLanguage()) : false;
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class MavenPluginConfigurationDomExtender method isInPluginManagement.
private static boolean isInPluginManagement(MavenDomConfiguration pluginNode) {
XmlElement xmlElement = pluginNode.getXmlElement();
if (xmlElement == null)
return false;
PsiElement pluginTag = xmlElement.getParent();
if (pluginTag == null)
return false;
PsiElement pluginsTag = pluginTag.getParent();
if (pluginsTag == null)
return false;
PsiElement pluginManagementTag = pluginsTag.getParent();
return pluginManagementTag instanceof XmlTag && "pluginManagement".equals(((XmlTag) pluginManagementTag).getName());
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class MavenPropertyResolver method resolve.
public static String resolve(String text, MavenDomProjectModel projectDom) {
XmlElement element = projectDom.getXmlElement();
if (element == null)
return text;
VirtualFile file = MavenDomUtil.getVirtualFile(element);
if (file == null)
return text;
MavenProjectsManager manager = MavenProjectsManager.getInstance(projectDom.getManager().getProject());
MavenProject mavenProject = manager.findProject(file);
if (mavenProject == null)
return text;
StringBuilder res = new StringBuilder();
try {
doFilterText(PATTERN, manager, mavenProject, text, collectPropertiesFromDOM(mavenProject, projectDom), null, false, null, res);
} catch (IOException e) {
// never thrown
throw new RuntimeException(e);
}
return res.toString();
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class MavenDomUtil method getCollectionIndex.
public static int getCollectionIndex(@NotNull final MavenDomDependencies dependencies, @Nullable final Editor editor) {
if (editor != null) {
int offset = editor.getCaretModel().getOffset();
List<MavenDomDependency> dependencyList = dependencies.getDependencies();
for (int i = 0; i < dependencyList.size(); i++) {
MavenDomDependency dependency = dependencyList.get(i);
XmlElement xmlElement = dependency.getXmlElement();
if (xmlElement != null && xmlElement.getTextRange().getStartOffset() >= offset) {
return i;
}
}
}
return -1;
}
use of com.intellij.psi.xml.XmlElement in project intellij-community by JetBrains.
the class MavenDomUtil method findProject.
@Nullable
public static MavenProject findProject(@NotNull MavenDomProjectModel projectDom) {
XmlElement element = projectDom.getXmlElement();
if (element == null)
return null;
VirtualFile file = getVirtualFile(element);
if (file == null)
return null;
MavenProjectsManager manager = MavenProjectsManager.getInstance(element.getProject());
return manager.findProject(file);
}
Aggregations