<idea-pluginversion="2"><id>com.your.company.unique.plugin.id</id><name>Plugin display name here</name><version>1.0</version><vendoremail="support@yourcompany.com"url="http://www.yourcompany.com">YourCompany</vendor><description><![CDATA[
Enter short description for your plugin here.<br>
<em>most html tags may be used</em>
]]></description><change-notes><![CDATA[
Add change notes here.<br>
<em>most HTML tags may be used</em>
]]></change-notes><!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description --><idea-versionsince-build="141.0"/><!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products --><!-- uncomment to enable plugin in all products
<depends>com.intellij.modules.lang</depends>
--><extensionsdefaultExtensionNs="com.intellij"><!-- Add your extensions here --></extensions><actions><!-- Add your actions here --></actions></idea-plugin>
From an action:
e.getData(LangDataKeys.PSI_FILE).
From a VirtualFile:
PsiManager.getInstance(project).findFile()
From a Document:
PsiDocumentManager.getInstance(project).getPsiFile()
From anelement inside thefile:
psiElement.getContainingFile()
To find fileswitha specific name anywhere inthe project, use :
FilenameIndex.getFilesByName(project, name, scope)
Most interesting modification operations are performed on the level of individual PSI elements, not files as a whole. To iterate over the elements in a file, use psiFile.accept(new PsiRecursiveElementWalkingVisitor()…);