Package com.intellij.psi

Examples of com.intellij.psi.PsiManager.findFile()


     */

    public void navigateToSpecification(DBSchemaObject parentObject, DBObjectType objectType, String objectName) {
        DatabaseEditableObjectFile databaseFile = parentObject.getVirtualFile();
        PsiManager psiManager = PsiManager.getInstance(parentObject.getProject());
        PSQLFile file = (PSQLFile) psiManager.findFile(databaseFile.getContentFile(DBContentType.CODE_SPEC));
        if (file != null) {
            BasePsiElement basePsiElement = file.lookupObjectSpecification(objectType, objectName);
            if (basePsiElement != null) {
                BasicTextEditor textEditor = EditorUtil.getFileEditor(databaseFile, file.getVirtualFile());
                EditorUtil.selectEditor(databaseFile, textEditor);
View Full Code Here


     * @deprecated
     */
    public void navigateToDeclaration(DBSchemaObject parentObject, DBObjectType objectType, String objectName) {
        DatabaseEditableObjectFile databaseFile = parentObject.getVirtualFile();
        PsiManager psiManager = PsiManager.getInstance(parentObject.getProject());
        PSQLFile file = (PSQLFile) psiManager.findFile(databaseFile.getContentFile(DBContentType.CODE_BODY));
        if (file != null) {
            BasePsiElement basePsiElement = file.lookupObjectDeclaration(objectType, objectName);
            if (basePsiElement != null) {
                BasicTextEditor textEditor = EditorUtil.getFileEditor(databaseFile, file.getVirtualFile());
                EditorUtil.selectEditor(databaseFile, textEditor);
View Full Code Here

    public BasePsiElement getObjectNavigationElement(DBSchemaObject parentObject, DBContentType contentType, DBObjectType objectType, CharSequence objectName) {
        DatabaseEditableObjectFile databaseFile = parentObject.getVirtualFile();
        PsiManager psiManager = PsiManager.getInstance(parentObject.getProject());
        DatabaseContentFile contentFile = databaseFile.getContentFile(contentType);
        if (contentFile != null) {
            PSQLFile file = (PSQLFile) psiManager.findFile(contentFile);
            if (file != null) {
                return
                    contentType == DBContentType.CODE_BODY ? file.lookupObjectDeclaration(objectType, objectName) :
                    contentType == DBContentType.CODE_SPEC ? file.lookupObjectSpecification(objectType, objectName) : null;
            }
View Full Code Here

        Set<String> fullPathsForName = names.get(name);
        if (fullPathsForName != null) {
            for (String s : fullPathsForName) {
                VirtualFile vfile = localFileSystem.findFileByPath(s);
                if (vfile != null) {
                    result.add(psiManager.findFile(vfile));
                }
            }
        }
        return result.toArray(new NavigationItem[result.size()]);
View Full Code Here

        }
        List<PsiFile> result = new ArrayList<PsiFile>();
        PsiManager manager = PsiManager.getInstance(psiClass.getProject());
        for (VirtualFile file : files) {
            if (file.isValid()) {
                PsiFile psiFile = manager.findFile(file);
                if (psiFile != null) {
                    result.add(psiFile);
                }
            }
        }
View Full Code Here

    if (project == null || files == null) return Collections.emptyList();
    final PsiManager manager = PsiManager.getInstance(project);
    return ContainerUtil.mapNotNull(files, new Function<VirtualFile, BnfFile>() {
      @Override
      public BnfFile fun(VirtualFile file) {
        PsiFile psiFile = manager.findFile(file);
        return psiFile instanceof BnfFile ? (BnfFile)psiFile : null;
      }
    });
  }
View Full Code Here

  public static void insertImport(@NotNull PsiFile context, @Nls String componentName, @NotNull String urlToImport) {
    final PsiManager psiManager = context.getManager();
    libraryRootLoop:
    for (VirtualFile libraryRoot : DartResolveUtil.findLibrary(context)) {
      final PsiFile file = psiManager.findFile(libraryRoot);
      if (file == null) {
        continue;
      }
      final DartImportStatement[] importStatements = PsiTreeUtil.getChildrenOfType(file, DartImportStatement.class);
      if (importStatements != null) {
View Full Code Here

      path = LocalFileSystem.getInstance().findFileByPath(directoryName);
    }
    if (path != null) {
      PsiManager psiManager = PsiManager.getInstance(project);
      if (!path.isDirectory()) {
        return psiManager.findFile(path);
      }
    }
    return null;
  }
View Full Code Here

    final Set<VirtualFile> files = new THashSet<VirtualFile>();
    for (final VirtualFile file : context.getCompileScope().getFiles(StdFileTypes.XML, false)) {
      final Module module = context.getModuleByFile(file);
      if (module != null &&
          enabledForModule.get(module)) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (psiFile instanceof XmlFile) {
          final StrutsModel model = strutsManager.getModelByFile((XmlFile) psiFile);
          if (model != null) {
            for (final XmlFile configFile : model.getConfigFiles()) {
              ContainerUtil.addIfNotNull(configFile.getVirtualFile(), files);
View Full Code Here

    // collect all validation.xml files located in sources of S2-modules
    final Set<VirtualFile> files = new THashSet<VirtualFile>();
    for (final VirtualFile file : context.getProjectCompileScope().getFiles(StdFileTypes.XML, true)) {
      if (StringUtil.endsWith(file.getName(), FILENAME_EXTENSION_VALIDATION_XML)) {
        final PsiFile psiFile = psiManager.findFile(file);
        if (psiFile instanceof XmlFile &&
            validatorManager.isValidatorsFile((XmlFile) psiFile)) {
          final Module module = ModuleUtilCore.findModuleForFile(file, project);
          if (module != null &&
              enabledForModule.get(module)) {
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.