Package org.jetbrains.plugins.clojure.psi.api

Examples of org.jetbrains.plugins.clojure.psi.api.ClojureFile


    List<PsiClass> result = new ArrayList<PsiClass>();
    for (final PsiDirectory dir : psiPackage.getDirectories(scope)) {
      for (final PsiFile file : dir.getFiles()) {
        if (file instanceof ClojureFile) {
          ClojureFile clojureFile = (ClojureFile) file;
          if (clojureFile.isClassDefiningFile() && clojureFile.getPackageName().equals(psiPackage.getQualifiedName())) {
            result.add(clojureFile.getDefinedClass());
          }
        }
      }
    }
View Full Code Here


    final PsiFile file = position.getFile();
    if (!(file instanceof ClojureFile)) throw new NoDataException();

    final String query = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
      public String compute() {
        final ClojureFile clojureFile = (ClojureFile) file;
        PsiElement element = clojureFile.findElementAt(position.getOffset());

        String nsName = getNameSpaceName(element);
        final String nsPrefix = nsName != null ? nsName + "$" : "user$";

        final ClDef def = PsiTreeUtil.getParentOfType(element, ClDef.class);
View Full Code Here

  }

  public RunnerAndConfigurationSettings createConfigurationByLocation(Location location) {
    PsiFile file = location.getPsiElement().getContainingFile();
    if (file instanceof ClojureFile) {
      ClojureFile clojureFile = (ClojureFile) file;
      RunnerAndConfigurationSettings settings = RunManager.getInstance(location.getProject()).
          createRunConfiguration("", myConfigurationFactory);
      ClojureScriptRunConfiguration configuration = (ClojureScriptRunConfiguration) settings.getConfiguration();
      PsiDirectory dir = clojureFile.getContainingDirectory();
      assert dir != null;
      configuration.setWorkDir(dir.getVirtualFile().getPath());
      VirtualFile vFile = clojureFile.getVirtualFile();
      assert vFile != null;
      configuration.setScriptPath(vFile.getPath());
      configuration.setName(vFile.getNameWithoutExtension());
      configuration.setModule(ModuleUtil.findModuleForPsiElement(clojureFile));
      return settings;
View Full Code Here

  private static final String DUMMY = "DUMMY.";


  public ASTNode createSymbolNodeFromText(@NotNull String newName) {
    final String text = "(" + newName + ")";
    final ClojureFile dummyFile = createClojureFileFromText(text);
    return dummyFile.getFirstChild().getFirstChild().getNextSibling().getNode();
  }
View Full Code Here

    return dummyFile.getFirstChild().getFirstChild().getNextSibling().getNode();
  }

  @Override
  public boolean hasSyntacticalErrors(@NotNull String text) {
    final ClojureFile clojureFile = (ClojureFile) PsiFileFactory.getInstance(getProject()).createFileFromText(DUMMY + ClojureFileType.CLOJURE_FILE_TYPE.getDefaultExtension(), text);
    return hasErrorElement(clojureFile);
  }
View Full Code Here

    return hasErrorElement(clojureFile);
  }

  public String getErrorMessage(@NotNull String text) {
    if (!hasSyntacticalErrors(text)) return null;
    final ClojureFile clojureFile = (ClojureFile) PsiFileFactory.getInstance(getProject()).createFileFromText(DUMMY + ClojureFileType.CLOJURE_FILE_TYPE.getDefaultExtension(), text);
    return getErrorMessageInner(clojureFile);
  }
View Full Code Here

  public static boolean isValidClojureExpression(String text, @NotNull Project project) {
    if (text == null) return false;
    text = text.trim();
    final ClojurePsiFactory factory = ClojurePsiFactory.getInstance(project);
    final ClojureFile file = factory.createClojureFileFromText(text);
    final PsiElement[] children = file.getChildren();

    if (children.length == 0) return false;
    for (PsiElement child : children) {
      if (containsSyntaxErrors(child)) {
        return false;
View Full Code Here

TOP

Related Classes of org.jetbrains.plugins.clojure.psi.api.ClojureFile

Copyright © 2018 www.massapicom. 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.