// Path: src/com/aopphp/go/GoAopFileType.java
// public class GoAopFileType extends LanguageFileType {
//     public static final GoAopFileType INSTANCE = new GoAopFileType();
// 
//     private GoAopFileType() {
//         super(PointcutQueryLanguage.INSTANCE);
//     }
// 
//     @NotNull
//     @Override
//     public String getName() {
//         return "Go! AOP Pointcut";
//     }
// 
//     @NotNull
//     @Override
//     public String getDescription() {
//         return "Go! AOP Pointcut Expression Syntax";
//     }
// 
//     @NotNull
//     @Override
//     public String getDefaultExtension() {
//         return ".goaop";
//     }
// 
//     @Nullable
//     @Override
//     public Icon getIcon() {
//         return GoAopIcons.FILE;
//     }
// }


import com.aopphp.go.GoAopFileType;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFileFactory;
import org.jetbrains.annotations.NotNull;
package com.aopphp.go.psi;


/**
 * Factory for pointcut elements
 */
public class PointcutElementFactory {

    /**
     * Creates a pointcut expression from string expression
     *
     * @param project Instance of current project
     * @param expression Literal expression of pointcut
     *
     * @return PointcutExpression instance if Ok or null
     */
    public static PointcutExpression createPointcut(Project project, String expression) {
        final PointcutFile file = createFile(project, expression);
        PsiElement firstChild = file.getFirstChild();

        boolean isPointcut = (firstChild instanceof PointcutExpression);

        return isPointcut ? (PointcutExpression)firstChild : null;
    }

    @NotNull
    public static PointcutFile createFile(Project project, String text) {
        String name = "dummy.goaop";

        PsiFileFactory fileFactory = PsiFileFactory.getInstance(project);

// Path: src/com/aopphp/go/GoAopFileType.java
// public class GoAopFileType extends LanguageFileType {
//     public static final GoAopFileType INSTANCE = new GoAopFileType();
// 
//     private GoAopFileType() {
//         super(PointcutQueryLanguage.INSTANCE);
//     }
// 
//     @NotNull
//     @Override
//     public String getName() {
//         return "Go! AOP Pointcut";
//     }
// 
//     @NotNull
//     @Override
//     public String getDescription() {
//         return "Go! AOP Pointcut Expression Syntax";
//     }
// 
//     @NotNull
//     @Override
//     public String getDefaultExtension() {
//         return ".goaop";
//     }
// 
//     @Nullable
//     @Override
//     public Icon getIcon() {
//         return GoAopIcons.FILE;
//     }
// }


// Path: src/com/aopphp/go/psi/PointcutElementFactory.java
import com.aopphp.go.GoAopFileType;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFileFactory;
import org.jetbrains.annotations.NotNull;

package com.aopphp.go.psi;


/**
 * Factory for pointcut elements
 */
public class PointcutElementFactory {

    /**
     * Creates a pointcut expression from string expression
     *
     * @param project Instance of current project
     * @param expression Literal expression of pointcut
     *
     * @return PointcutExpression instance if Ok or null
     */
    public static PointcutExpression createPointcut(Project project, String expression) {
        final PointcutFile file = createFile(project, expression);
        PsiElement firstChild = file.getFirstChild();

        boolean isPointcut = (firstChild instanceof PointcutExpression);

        return isPointcut ? (PointcutExpression)firstChild : null;
    }

    @NotNull
    public static PointcutFile createFile(Project project, String text) {
        String name = "dummy.goaop";

        PsiFileFactory fileFactory = PsiFileFactory.getInstance(project);

        return (PointcutFile) fileFactory.createFileFromText(name, GoAopFileType.INSTANCE, text);