com.intellij.openapi.roots.FileIndexFacade Java Examples

The following examples show how to use com.intellij.openapi.roots.FileIndexFacade. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResolveRedSymbolsAction.java    From litho with Apache License 2.0 6 votes vote down vote up
@Override
public void update(AnActionEvent e) {
  super.update(e);
  final Project project = e.getProject();
  final VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
  final PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
  final Editor editor = e.getData(CommonDataKeys.EDITOR);
  final Presentation presentation = e.getPresentation();
  if (project == null
      || virtualFile == null
      || editor == null
      || !(psiFile instanceof PsiJavaFile)) {
    presentation.setEnabledAndVisible(false);
    return;
  }
  final Module currentModule = FileIndexFacade.getInstance(project).getModuleForFile(virtualFile);
  if (currentModule == null) {
    presentation.setEnabledAndVisible(false);
    return;
  }
  presentation.setEnabledAndVisible(true);
}
 
Example #2
Source File: BlazeGoPackage.java    From intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Override {@link GoPackage#processFiles(Processor, Predicate)} to work on specific files instead
 * of by directory.
 */
@Override
public boolean processFiles(
    Processor<? super PsiFile> processor, Predicate<VirtualFile> virtualFileFilter) {
  if (!isValid()) {
    return true;
  }
  FileIndexFacade fileIndexFacade = FileIndexFacade.getInstance(getProject());
  for (PsiFile file : files()) {
    ProgressIndicatorProvider.checkCanceled();
    VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile.isValid()
        && virtualFileFilter.test(virtualFile)
        && !fileIndexFacade.isExcludedFile(virtualFile)
        && !processor.process(file)) {
      return false;
    }
  }
  return true;
}
 
Example #3
Source File: FileManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public FileManagerImpl(@Nonnull PsiManagerImpl manager, @Nonnull Provider<FileIndexFacade> fileIndex) {
  myManager = manager;
  myFileIndex = fileIndex;
  myConnection = manager.getProject().getMessageBus().connect();

  Disposer.register(manager.getProject(), this);
  LowMemoryWatcher.register(this::processQueue, this);

  myConnection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
    @Override
    public void enteredDumbMode() {
      processFileTypesChanged(false);
    }

    @Override
    public void exitDumbMode() {
      processFileTypesChanged(false);
    }
  });
}
 
Example #4
Source File: VcsRootIterator.java    From consulo with Apache License 2.0 6 votes vote down vote up
private MyRootIterator(final Project project,
                       final VirtualFile root,
                       @Nullable final Processor<FilePath> pathProcessor,
                       @javax.annotation.Nullable final Processor<VirtualFile> fileProcessor,
                       @Nullable VirtualFileFilter directoryFilter) {
  myProject = project;
  myPathProcessor = pathProcessor;
  myFileProcessor = fileProcessor;
  myDirectoryFilter = directoryFilter;
  myRoot = root;

  final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
  final AbstractVcs vcs = plVcsManager.getVcsFor(root);
  myRootPresentFilter = (vcs == null) ? null : new MyRootFilter(root, vcs.getName());
  if (myRootPresentFilter != null) {
    myRootPresentFilter.init(ProjectLevelVcsManager.getInstance(myProject).getAllVcsRoots());
  }
  myExcludedFileIndex = ServiceManager.getService(project, FileIndexFacade.class);
}
 
Example #5
Source File: AbstractFileViewProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected boolean shouldCreatePsi() {
  if (isIgnored()) return false;

  VirtualFile vFile = getVirtualFile();
  if (isPhysical() && vFile.isInLocalFileSystem()) { // check directories consistency
    VirtualFile parent = vFile.getParent();
    if (parent == null) return false;

    PsiDirectory psiDir = getManager().findDirectory(parent);
    if (psiDir == null) {
      FileIndexFacade indexFacade = FileIndexFacade.getInstance(getManager().getProject());
      if (!indexFacade.isInLibrarySource(vFile) && !indexFacade.isInLibraryClasses(vFile)) {
        return false;
      }
    }
  }
  return true;
}
 
Example #6
Source File: PsiUtilCore.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to find PSI file for a virtual file and throws assertion error with debug info if it is null.
 */
@Nonnull
public static PsiFile getPsiFile(@Nonnull Project project, @Nonnull VirtualFile file) {
  PsiManager psiManager = PsiManager.getInstance(project);
  PsiFile psi = psiManager.findFile(file);
  if (psi != null) return psi;
  FileType fileType = file.getFileType();
  FileViewProvider viewProvider = psiManager.findViewProvider(file);
  Document document = FileDocumentManager.getInstance().getDocument(file);
  boolean ignored = !(file instanceof LightVirtualFile) && FileTypeRegistry.getInstance().isFileIgnored(file);
  VirtualFile vDir = file.getParent();
  PsiDirectory psiDir = vDir == null ? null : PsiManager.getInstance(project).findDirectory(vDir);
  FileIndexFacade indexFacade = FileIndexFacade.getInstance(project);
  StringBuilder sb = new StringBuilder();
  sb.append("valid=").append(file.isValid()).
          append(" isDirectory=").append(file.isDirectory()).
          append(" hasDocument=").append(document != null).
          append(" length=").append(file.getLength());
  sb.append("\nproject=").append(project.getName()).
          append(" default=").append(project.isDefault()).
          append(" open=").append(project.isOpen());;
  sb.append("\nfileType=").append(fileType.getName()).append("/").append(fileType.getClass().getName());
  sb.append("\nisIgnored=").append(ignored);
  sb.append(" underIgnored=").append(indexFacade.isUnderIgnored(file));
  sb.append(" inLibrary=").append(indexFacade.isInLibrarySource(file) || indexFacade.isInLibraryClasses(file));
  sb.append(" parentDir=").append(vDir == null ? "no-vfs" : vDir.isDirectory() ? "has-vfs-dir" : "has-vfs-file").
          append("/").append(psiDir == null ? "no-psi" : "has-psi");
  sb.append("\nviewProvider=").append(viewProvider == null ? "null" : viewProvider.getClass().getName());
  if (viewProvider != null) {
    List<PsiFile> files = viewProvider.getAllFiles();
    sb.append(" language=").append(viewProvider.getBaseLanguage().getID());
    sb.append(" physical=").append(viewProvider.isPhysical());
    sb.append(" rootCount=").append(files.size());
    for (PsiFile o : files) {
      sb.append("\n  root=").append(o.getLanguage().getID()).append("/").append(o.getClass().getName());
    }
  }
  LOG.error("no PSI for file '" + file.getName() + "'", new Attachment(file.getPresentableUrl(), sb.toString()));
  throw new AssertionError();
}
 
Example #7
Source File: CoreProjectEnvironment.java    From consulo with Apache License 2.0 5 votes vote down vote up
public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) {
  myParentDisposable = parentDisposable;
  myEnvironment = applicationEnvironment;
  myProject = new MockProject(myEnvironment.getApplication(), myParentDisposable);

  preregisterServices();

  myFileIndexFacade = createFileIndexFacade();
  myMessageBus = (MessageBusImpl)myProject.getMessageBus();

  PsiModificationTrackerImpl modificationTracker = new PsiModificationTrackerImpl(applicationEnvironment.getApplication(), myProject);
  myProject.registerService(PsiModificationTracker.class, modificationTracker);
  myProject.registerService(FileIndexFacade.class, myFileIndexFacade);
  myProject.registerService(ResolveCache.class, new ResolveCache(myProject));

  registerProjectExtensionPoint(PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class);
  myPsiManager = new PsiManagerImpl(myProject, () -> myFileIndexFacade, modificationTracker);
  ((FileManagerImpl)myPsiManager.getFileManager()).markInitialized();
  registerProjectComponent(PsiManager.class, myPsiManager);

  registerProjectComponent(PsiDocumentManager.class, new CorePsiDocumentManager(myProject, new MockDocumentCommitProcessor()));

  myProject.registerService(ResolveScopeManager.class, createResolveScopeManager(myPsiManager));

  myProject.registerService(PsiFileFactory.class, new PsiFileFactoryImpl(myPsiManager));
  myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
  myProject.registerService(ProjectScopeBuilder.class, createProjectScopeBuilder());
  myProject.registerService(DumbService.class, new MockDumbService(myProject));
}
 
Example #8
Source File: MappingsToRoots.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public VirtualFile[] getRootsUnderVcs(@Nonnull AbstractVcs vcs) {
  List<VirtualFile> result = myMappings.getMappingsAsFilesUnderVcs(vcs);

  final AbstractVcs.RootsConvertor convertor = vcs.getCustomConvertor();
  if (convertor != null) {
    result = convertor.convertRoots(result);
  }

  Collections.sort(result, FilePathComparator.getInstance());
  if (! vcs.allowsNestedRoots()) {
    final FileIndexFacade facade = ServiceManager.getService(myProject, FileIndexFacade.class);
    final List<VirtualFile> finalResult = result;
    ApplicationManager.getApplication().runReadAction(() -> {
      int i=1;
      while(i < finalResult.size()) {
        final VirtualFile previous = finalResult.get(i - 1);
        final VirtualFile current = finalResult.get(i);
        if (facade.isValidAncestor(previous, current)) {
          finalResult.remove(i);
        }
        else {
          i++;
        }
      }
    });
  }
  result.removeIf(file -> !file.isDirectory());
  return VfsUtilCore.toVirtualFileArray(result);
}
 
Example #9
Source File: MappingsToRoots.java    From consulo with Apache License 2.0 5 votes vote down vote up
public List<VirtualFile> getDetailedVcsMappings(final AbstractVcs vcs) {
  // same as above, but no compression
  final List<VirtualFile> result = myMappings.getMappingsAsFilesUnderVcs(vcs);

  boolean addInnerModules = true;
  final String vcsName = vcs.getName();
  final List<VcsDirectoryMapping> directoryMappings = myMappings.getDirectoryMappings(vcsName);
  for (VcsDirectoryMapping directoryMapping : directoryMappings) {
    if (directoryMapping.isDefaultMapping()) {
      addInnerModules = false;
      break;
    }
  }

  Collections.sort(result, FilePathComparator.getInstance());
  if (addInnerModules) {
    final FileIndexFacade facade = ServiceManager.getService(myProject, FileIndexFacade.class);
    final Collection<VirtualFile> modules = DefaultVcsRootPolicy.getInstance(myProject).getDefaultVcsRoots(myMappings, vcsName);
    ApplicationManager.getApplication().runReadAction(() -> {
      Iterator<VirtualFile> iterator = modules.iterator();
      while (iterator.hasNext()) {
        final VirtualFile module = iterator.next();
        boolean included = false;
        for (VirtualFile root : result) {
          if (facade.isValidAncestor(root, module)) {
            included = true;
            break;
          }
        }
        if (! included) {
          iterator.remove();
        }
      }
    });
    result.addAll(modules);
  }
  result.removeIf(file -> !file.isDirectory());
  return result;
}
 
Example #10
Source File: PsiManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public PsiManagerImpl(@Nonnull Project project, @Nonnull Provider<FileIndexFacade> fileIndexFacadeProvider, @Nonnull PsiModificationTracker modificationTracker) {
  // we need to initialize PsiBuilderFactory service so it won't initialize under PsiLock from ChameleonTransform
  PsiBuilderFactory.getInstance();

  myProject = project;
  myFileIndex = fileIndexFacadeProvider;
  myModificationTracker = modificationTracker;

  myFileManager = new FileManagerImpl(this, fileIndexFacadeProvider);

  myTreeChangePreprocessors.add((PsiTreeChangePreprocessor)myModificationTracker);

  Disposer.register(project, () -> myIsDisposed = true);
}
 
Example #11
Source File: PsiDocumentManagerBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
void handleCommitWithoutPsi(@Nonnull Document document) {
  final UncommittedInfo prevInfo = clearUncommittedInfo(document);
  if (prevInfo == null) {
    return;
  }

  myUncommittedDocuments.remove(document);

  if (!myProject.isInitialized() || myProject.isDisposed() || myProject.isDefault()) {
    return;
  }

  VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document);
  if (virtualFile != null) {
    FileManager fileManager = getFileManager();
    FileViewProvider viewProvider = fileManager.findCachedViewProvider(virtualFile);
    if (viewProvider != null) {
      // we can end up outside write action here if the document has forUseInNonAWTThread=true
      ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> ((AbstractFileViewProvider)viewProvider).onContentReload());
    }
    else if (FileIndexFacade.getInstance(myProject).isInContent(virtualFile)) {
      ApplicationManager.getApplication().runWriteAction((ExternalChangeAction)() -> ((FileManagerImpl)fileManager).firePropertyChangedForUnloadedPsi());
    }
  }

  runAfterCommitActions(document);
}
 
Example #12
Source File: ModuleDefaultVcsRootPolicy.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@javax.annotation.Nullable
public VirtualFile getVcsRootFor(@Nonnull VirtualFile file) {
  FileIndexFacade indexFacade = ServiceManager.getService(myProject, FileIndexFacade.class);
  if (myBaseDir != null && indexFacade.isValidAncestor(myBaseDir, file)) {
    LOG.debug("File " + file + " is under project base dir " + myBaseDir);
    return myBaseDir;
  }
  VirtualFile contentRoot = ProjectRootManager.getInstance(myProject).getFileIndex().getContentRootForFile(file, Registry.is("ide.hide.excluded.files"));
  if (contentRoot != null) {
    LOG.debug("Content root for file " + file + " is " + contentRoot);
    if (contentRoot.isDirectory()) {
      return contentRoot;
    }
    VirtualFile parent = contentRoot.getParent();
    LOG.debug("Content root is not a directory, using its parent " + parent);
    return parent;
  }
  if (ProjectKt.isDirectoryBased(myProject)) {
    VirtualFile ideaDir = ProjectKt.getDirectoryStoreFile(myProject);
    if (ideaDir != null && VfsUtilCore.isAncestor(ideaDir, file, false)) {
      LOG.debug("File " + file + " is under .idea");
      return ideaDir;
    }
  }
  LOG.debug("Couldn't find proper root for " + file);
  return null;
}
 
Example #13
Source File: IndexCacheManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean collectVirtualFilesWithWord(@Nonnull final Processor<VirtualFile> fileProcessor,
                                            @Nonnull final String word, final short occurrenceMask,
                                            @Nonnull final GlobalSearchScope scope, final boolean caseSensitively) {
  if (myProject.isDefault()) {
    return true;
  }

  try {
    return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
      @Override
      public Boolean compute() {
        return FileBasedIndex.getInstance().processValues(IdIndex.NAME, new IdIndexEntry(word, caseSensitively), null, new FileBasedIndex.ValueProcessor<Integer>() {
          final FileIndexFacade index = FileIndexFacade.getInstance(myProject);
          @Override
          public boolean process(final VirtualFile file, final Integer value) {
            ProgressIndicatorProvider.checkCanceled();
            final int mask = value.intValue();
            if ((mask & occurrenceMask) != 0 && index.shouldBeFound(scope, file)) {
              if (!fileProcessor.process(file)) return false;
            }
            return true;
          }
        }, scope);
      }
    });
  }
  catch (IndexNotReadyException e) {
    throw new ProcessCanceledException();
  }
}
 
Example #14
Source File: PsiSearchHelperImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean processFilesContainingAllKeys(@Nonnull Project project,
                                                     @Nonnull final GlobalSearchScope scope,
                                                     @Nullable final Condition<Integer> checker,
                                                     @Nonnull final Collection<IdIndexEntry> keys,
                                                     @Nonnull final Processor<VirtualFile> processor) {
  final FileIndexFacade index = FileIndexFacade.getInstance(project);
  return DumbService.getInstance(project).runReadActionInSmartMode(
          () -> FileBasedIndex.getInstance().processFilesContainingAllKeys(IdIndex.NAME, keys, scope, checker,
                                                                           file -> !index.shouldBeFound(scope, file) || processor.process(file)));
}
 
Example #15
Source File: GlobalSearchScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean hasFilesOutOfProjectRoots() {
  Boolean result = myHasFilesOutOfProjectRoots;
  if (result == null) {
    Project project = getProject();
    myHasFilesOutOfProjectRoots = result = project != null && !project.isDefault() && myFiles.stream().anyMatch(file -> FileIndexFacade.getInstance(project).getModuleForFile(file) == null);
  }
  return result;
}
 
Example #16
Source File: VcsRootIterator.java    From consulo with Apache License 2.0 5 votes vote down vote up
public VcsRootIterator(final Project project, final AbstractVcs vcs) {
  final ProjectLevelVcsManager plVcsManager = ProjectLevelVcsManager.getInstance(project);
  myOtherVcsFolders = new HashMap<String, MyRootFilter>();
  myExcludedFileIndex = ServiceManager.getService(project, FileIndexFacade.class);

  final VcsRoot[] allRoots = plVcsManager.getAllVcsRoots();
  final VirtualFile[] roots = plVcsManager.getRootsUnderVcs(vcs);
  for (VirtualFile root : roots) {
    final MyRootFilter rootPresentFilter = new MyRootFilter(root, vcs.getName());
    rootPresentFilter.init(allRoots);
    myOtherVcsFolders.put(root.getUrl(), rootPresentFilter);
  }
}
 
Example #17
Source File: VcsRootIterator.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static boolean isExcluded(final FileIndexFacade indexFacade, final VirtualFile file) {
  return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
    @Override
    public Boolean compute() {
      return indexFacade.isExcludedFile(file);
    }
  });
}
 
Example #18
Source File: LightProjectBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void registerServices(@Nonnull InjectingContainerBuilder builder) {
  builder.bind(PsiFileFactory.class).to(PsiFileFactoryImpl.class);
  builder.bind(PsiManager.class).to(PsiManagerImpl.class);
  builder.bind(FileIndexFacade.class).to(LightFileIndexFacade.class);
  builder.bind(PsiModificationTracker.class).to(PsiModificationTrackerImpl.class);
}
 
Example #19
Source File: ProjectScopeBuilderImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public GlobalSearchScope buildProjectScope() {
  final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(myProject);
  if (projectRootManager == null) {
    return new EverythingGlobalScope(myProject) {
      @Override
      public boolean isSearchInLibraries() {
        return false;
      }
    };
  }
  return new ProjectScopeImpl(myProject, FileIndexFacade.getInstance(myProject));
}
 
Example #20
Source File: ResolveRedSymbolsAction.java    From litho with Apache License 2.0 5 votes vote down vote up
private static GlobalSearchScope moduleWithDependenciesAndLibrariesScope(
    VirtualFile virtualFile, Project project) {
  final Module currentModule = FileIndexFacade.getInstance(project).getModuleForFile(virtualFile);
  if (currentModule == null) {
    return GlobalSearchScope.projectScope(project);
  }
  return GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(currentModule);
}
 
Example #21
Source File: ProjectScopeBuilderImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public GlobalSearchScope buildContentScope() {
  return new CoreProjectScopeBuilder.ContentSearchScope(myProject, FileIndexFacade.getInstance(myProject));
}
 
Example #22
Source File: CoreProjectEnvironment.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected FileIndexFacade createFileIndexFacade() {
  return new MockFileIndexFacade(myProject);
}
 
Example #23
Source File: FlutterReduxGen.java    From haystack with MIT License 4 votes vote down vote up
private void genStructure(PageModel pageModel) {
    Project project = directory.getProject();
    PsiFileFactory factory = PsiFileFactory.getInstance(project);
    PsiDirectoryFactory directoryFactory =
            PsiDirectoryFactory.getInstance(directory.getProject());
    String packageName = directoryFactory.getQualifiedName(directory, true);

    FileSaver fileSaver = new IDEFileSaver(factory, directory, DartFileType.INSTANCE);

    fileSaver.setListener(fileName -> {
        int ok = Messages.showOkCancelDialog(
                textResources.getReplaceDialogMessage(fileName),
                textResources.getReplaceDialogTitle(), "OK", "NO",
                UIUtil.getQuestionIcon());
        return ok == 0;
    });

    final String moduleName =
            FileIndexFacade.getInstance(project).getModuleForFile(directory.getVirtualFile()).getName();

    Map<String, Object> rootMap = new HashMap<String, Object>();
    rootMap.put("ProjectName", moduleName);
    rootMap.put("PageType", pageModel.pageType);
    if (pageModel.pageType.equals(CUSTOMSCROLLVIEW)) {
        rootMap.put("GenerateCustomScrollView", true);
    } else {
        rootMap.put("GenerateCustomScrollView", false);
    }
    rootMap.put("PageName", pageModel.pageName);
    rootMap.put("ModelEntryName", pageModel.modelName);
    rootMap.put("GenerateListView", pageModel.genListView);
    rootMap.put("GenerateBottomTabBar", pageModel.genBottomTabBar);
    rootMap.put("GenerateAppBar", pageModel.genAppBar);
    rootMap.put("GenerateDrawer", pageModel.genDrawer);
    rootMap.put("GenerateTopTabBar", pageModel.genTopTabBar);
    rootMap.put("GenerateWebView", pageModel.genWebView);
    rootMap.put("GenerateActionButton", pageModel.genActionButton);

    rootMap.put("viewModelQuery", pageModel.viewModelQuery);
    rootMap.put("viewModelGet", pageModel.viewModelGet);
    rootMap.put("viewModelCreate", pageModel.viewModelCreate);
    rootMap.put("viewModelUpdate", pageModel.viewModelUpdate);
    rootMap.put("viewModelDelete", pageModel.viewModelDelete);

    rootMap.put("GenSliverFixedExtentList", pageModel.genSliverFixedList);
    rootMap.put("GenSliverGrid", pageModel.genSliverGrid);
    rootMap.put("GenSliverToBoxAdapter", pageModel.genSliverToBoxAdapter);
    rootMap.put("FabInAppBar", pageModel.genSliverFab);
    rootMap.put("GenSliverTabBar", pageModel.genSliverTabBar);
    rootMap.put("GenSliverTabView", pageModel.genSliverTabView);
    rootMap.put("IsCustomWidget", pageModel.isCustomWidget);

    if (pageModel.genActionButton) {
        rootMap.put("HasActionSearch", pageModel.hasActionSearch);
        rootMap.put("ActionList", pageModel.actionList);
        rootMap.put("ActionBtnCount", pageModel.actionList.size());
    } else {
        rootMap.put("HasActionSearch", false);
        rootMap.put("ActionList", new ArrayList<String>());
        rootMap.put("ActionBtnCount", 0);
    }
    if (!pageModel.isUIOnly) {
        for (ClassModel classModel : pageModel.classModels) {
            if (classModel.getName().equals(pageModel.modelName)) {
                rootMap.put("genDatabase", classModel.isGenDBModule());

                if (classModel.getUniqueField() != null) {
                    rootMap.put("clsUNName", classModel.getUniqueField());
                    rootMap.put("clsUNNameType", classModel.getUniqueFieldType());
                }
            }
            generateModelEntry(classModel, rootMap);
        }

        generateRepository(rootMap);
        generateRedux(rootMap);
    }
    generateFeature(rootMap, pageModel.isCustomWidget, pageModel.genSliverTabView);
}
 
Example #24
Source File: CoreProjectScopeBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ContentSearchScope(Project project, FileIndexFacade fileIndexFacade) {
  super(project);
  myFileIndexFacade = fileIndexFacade;
}
 
Example #25
Source File: CoreProjectScopeBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
public CoreProjectScopeBuilder(Project project, FileIndexFacade fileIndexFacade) {
  myFileIndexFacade = fileIndexFacade;
  myProject = project;
  myLibrariesScope = new CoreLibrariesScope();
}
 
Example #26
Source File: FileManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private boolean isExcludedOrIgnored(@Nonnull VirtualFile vFile) {
  if (myManager.getProject().isDefault()) return false;
  FileIndexFacade fileIndexFacade = myFileIndex.get();
  return Registry.is("ide.hide.excluded.files") ? fileIndexFacade.isExcludedFile(vFile) : fileIndexFacade.isUnderIgnored(vFile);
}
 
Example #27
Source File: ProjectScopeImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ProjectScopeImpl(@Nonnull Project project, @Nonnull FileIndexFacade fileIndex) {
  super(project);
  myFileIndex = fileIndex;
}
 
Example #28
Source File: GlobalSearchScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
private FileScope(@Nonnull Project project, VirtualFile virtualFile) {
  super(project);
  myVirtualFile = virtualFile;
  myModule = virtualFile == null || project.isDefault() ? null : FileIndexFacade.getInstance(project).getModuleForFile(virtualFile);
}
 
Example #29
Source File: CompilerIconDescriptorUpdater.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Deprecated
public static boolean isExcluded(final VirtualFile vFile, final Project project) {
  return vFile != null &&
         FileIndexFacade.getInstance(project).isInSource(vFile) &&
         CompilerManager.getInstance(project).isExcludedFromCompilation(vFile);
}
 
Example #30
Source File: CompilerIconDescriptorUpdater.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Inject
public CompilerIconDescriptorUpdater(FileIndexFacade fileIndexFacade, CompilerManager compilerManager) {
  myFileIndexFacade = fileIndexFacade;
  myCompilerManager = compilerManager;
}