Package runnables

Source Code of runnables.CreateMediatorRunnable

package runnables;

import com.intellij.lang.javascript.JavascriptLanguage;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiFileFactory;

/**
* User: John Lindquist
* Date: 6/9/11
* Time: 2:13 PM
*/
public class CreateMediatorRunnable implements Runnable, Computable<Object>
{
    private PsiDirectory directory;
    private String className;

    public CreateMediatorRunnable(PsiDirectory directory, String className)
    {
        this.directory = directory;
        this.className = className;
    }

    public Object compute()
    {
        return null//To change body of implemented methods use File | Settings | File Templates.
    }

    public void run()
    {
        PsiFileFactory fileFactory = PsiFileFactory.getInstance(directory.getProject());
        PsiFile psiFile = fileFactory.createFileFromText(className, JavascriptLanguage.INSTANCE, "");
        directory.add(psiFile);
    }
}
TOP

Related Classes of runnables.CreateMediatorRunnable

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.