Examples of PsiFileFactory


Examples of com.intellij.psi.PsiFileFactory

        String condition = filter.getCondition();
        boolean isValidCondition = StringUtil.isNotEmptyOrSpaces(condition);
        selectStatement.append(isValidCondition ? condition : COMMENT);

        PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);
        SQLFile selectStatementFile = (SQLFile)
                psiFileFactory.createFileFromText(
                    "filter.sql",
                    dataset.getLanguageDialect(SQLLanguage.INSTANCE),
                    selectStatement.toString());
        selectStatementFile.setParseRootId("subquery");
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

                variableValueForm.hideErrorLabel(); else
                variableValueForm.showErrorLabel(errorText);
        }

        if (previewDocument == null) {
            PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(project);

            SQLFile selectStatementFile = (SQLFile)
                psiFileFactory.createFileFromText(
                    "filter.sql",
                    connectionHandler.getLanguageDialect(SQLLanguage.INSTANCE),
                    previewText);

            selectStatementFile.setActiveConnection(connectionHandler);
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

                    condition.appendConditionString(selectStatement, dataset);
                }
            }

            if (previewDocument == null) {
                PsiFileFactory psiFileFactory = PsiFileFactory.getInstance(dataset.getProject());

                SQLFile selectStatementFile = (SQLFile)
                        psiFileFactory.createFileFromText(
                                "filter.sql",
                                dataset.getLanguageDialect(SQLLanguage.INSTANCE),
                                selectStatement.toString());

                selectStatementFile.setActiveConnection(dataset.getConnectionHandler());
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

    final PsiFile file = createDummyFile(myProject, text);
    return file.getFirstChild();
  }

  public static PsiFile createDummyFile(Project myProject, String text) {
    final PsiFileFactory factory = PsiFileFactory.getInstance(myProject);
    final String name = "dummy." + DartFileType.INSTANCE.getDefaultExtension();
    final LightVirtualFile virtualFile = new LightVirtualFile(name, DartFileType.INSTANCE, text);
    final PsiFile psiFile = ((PsiFileFactoryImpl)factory).trySetupPsiForFile(virtualFile, DartLanguage.INSTANCE, false, true);
    assert psiFile != null;
    return psiFile;
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

        }
        catch (Exception e) {
            throw new RuntimeException("Unable to load template for " + template.getFile(), e);
        }

        final PsiFileFactory factory = PsiFileFactory.getInstance(directory.getProject());

        if ((new File(fileName)).exists()) {
            throw new RuntimeException("File already exists");
        }

        final PsiFile file = factory.createFileFromText(fileName, GoFileType.INSTANCE, text);

        return directory.add(file);
    }
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

import java.util.List;

public class GoPsiElementFactory {
    @Nullable
    public static GoFile createGoFile(@NotNull GoFile originalFile, @NonNls @NotNull String text) {
        PsiFileFactory pff = PsiFileFactory.getInstance(originalFile.getProject());
        GoFile newFile = (GoFile) pff.createFileFromText("dummy.go", GoLanguage.INSTANCE, text);
        newFile.putUserData(PsiFileFactory.ORIGINAL_FILE, originalFile);
        return newFile;
    }
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

        } catch (IOException e) {
            e.printStackTrace();
            return;
        }

        final PsiFileFactory factory = PsiFileFactory.getInstance(project);

        String bundleName = "Acme\\DemoBundle";

        SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil(project);
        SymfonyBundle symfonyBundle = symfonyBundleUtil.getContainingBundle(initialBaseDir);

        if(symfonyBundle != null) {
            bundleName = StringUtils.strip(symfonyBundle.getNamespaceName(), "\\");
            String path = symfonyBundle.getRelative(initialBaseDir.getVirtualFile());
            if(path != null) {
                bundleName = bundleName.concat("\\" + path);
            }
        }

        content = content.replace("{{ Namespace }}", bundleName).replace("{{ ControllerName }}", fileName);

        fileName = fileName.concat("Controller.php");

        if(initialBaseDir.findFile(fileName) != null) {
            Messages.showInfoMessage("File exists", "Error");
            return;
        }

        final PsiFile file = factory.createFileFromText(fileName, PhpFileType.INSTANCE, content);

        ApplicationManager.getApplication().runWriteAction(new Runnable() {
            @Override
            public void run() {
                CodeStyleManager.getInstance(project).reformat(file);
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

        } catch (IOException e) {
            e.printStackTrace();
            return;
        }

        final PsiFileFactory factory = PsiFileFactory.getInstance(project);

        String bundleName = "Acme\\DemoBundle";

        SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil(project);
        SymfonyBundle symfonyBundle = symfonyBundleUtil.getContainingBundle(initialBaseDir);

        if(symfonyBundle != null) {
            bundleName = StringUtils.strip(symfonyBundle.getNamespaceName(), "\\");
        }

        String underscoreBundle = bundleName.replace("\\", ".").toLowerCase();
        if(underscoreBundle.endsWith("bundle")) {
            underscoreBundle = underscoreBundle.substring(0, underscoreBundle.length() - 6);
        }

        content = content.replace("{{ BundleName }}", bundleName).replace("{{ BundleNameUnderscore }}", underscoreBundle);

        final PsiFile file = factory.createFileFromText(fileName, fileType, content);

        ApplicationManager.getApplication().runWriteAction(new Runnable() {
            @Override
            public void run() {
                CodeStyleManager.getInstance(project).reformat(file);
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

        } catch (Exception e) {
            throw new RuntimeException("Unable to load template for " + FileTemplateManager.getInstance().internalTemplateToSubject(templateName),
                    e);
        }

        final PsiFileFactory factory = PsiFileFactory.getInstance(directory.getProject());
        final PsiFile file = factory.createFileFromText(fileName, text);

        return (PsiFile) directory.add(file);
    }
View Full Code Here

Examples of com.intellij.psi.PsiFileFactory

    }
    catch (Exception e) {
      throw new RuntimeException("Unable to load template for " + FileTemplateManager.getInstance().internalTemplateToSubject(templateName), e);
    }

    final PsiFileFactory factory = PsiFileFactory.getInstance(directory.getProject());
    final PsiFile file = factory.createFileFromText(fileName, text);
    return (PsiFile) directory.add(file);
  }
View Full Code Here
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.