public void actionPerformed(AnActionEvent e)
{
PsiFile psiFile = e.getData(DataKeys.PSI_FILE);
if (psiFile instanceof JSFile)
{
JSFile jsFile = (JSFile) psiFile;
JSClass jsClass = JSPsiImplUtils.findClass(jsFile);
//Are there null object patterns in place, or just a lot of null checks when searching the psi?
if (jsClass != null)
{
//What's the easiest way to check if the class "is a flash.display.DisplayObjectContainer"?
if (isDisplayObjectContainer(jsClass))
{
String className = jsClass.getName() + "Mediator.as";
PsiDirectory directory = jsFile.getContainingDirectory();
//This works, but throws "Assertion failed: Write access is allowed inside write-action only (see com.intellij.openapi.application.Application.runWriteAction()) "?
PsiFile file = directory.createFile(className);
//TODO: How do a I create a psi from scratch? Or should I just use a template?
}