com.intellij.psi.util.PsiElementFilter#com.intellij.util.containers.HashMap源码实例Demo

下面列出了com.intellij.psi.util.PsiElementFilter#com.intellij.util.containers.HashMap 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CleanArchitecturePlugin   文件: EntityAdapter.java
/**
 * Create EntityAdapter.class
 */
public static void create() {
    PsiDirectory adapterDirectory = createDirectory(getViewPackage(), ADAPTER.toLowerCase());

    String className = getEntityConfig().getEntityName() + ADAPTER;

    HashMap<String, String> varTemplate = new HashMap<>();
    varTemplate.put("PACKAGE_PROJECT", getPackageNameProject(getProjectDirectory()));
    varTemplate.put("LAYOUT_NAME", getEntityConfig().getEntityName().toLowerCase());


    Runnable runnable = () -> {
        JavaDirectoryService.getInstance().createClass(adapterDirectory, className, ADAPTER_TEMPLATE, false, varTemplate);
        try {
            createLayout(getPackageNameProject(adapterDirectory), className, ADAPTER);
        } catch (Exception e) {
            e.printStackTrace();
        }
    };
    WriteCommandAction.runWriteCommandAction(getProject(), runnable);


}
 
源代码2 项目: CleanArchitecturePlugin   文件: EntityPresenter.java
/**
 * Create EntityPresenter.class
 */
public static void create() {

    // Create presenter directory
    presenterDirectory = createDirectory(getViewPackage(), PRESENTER.toLowerCase());

    // Create presenter class
    String className = getEntityConfig().getEntityName() + PRESENTER;

    HashMap<String, String> varTemplate = new HashMap<>();
    varTemplate.put("PACKAGE_PRESENTER_IMPL", getPackageNameProject(Presenter.getPresenterDirectory()));
    varTemplate.put("PRESENTER_IMPL", PRESENTER_IMPL);

    Runnable runnable = () -> JavaDirectoryService.getInstance().createClass(presenterDirectory, className, PRESENTER_TEMPLATE, false, varTemplate);
    WriteCommandAction.runWriteCommandAction(getProject(), runnable);
}
 
@Override
public void build(@NotNull Project project, @NotNull Collection<FileObject> fileObjects) {
    Map<String, Route> routeMap = new HashMap<>();

    for (FileObject file : fileObjects) {

        String content;
        try {
            content = StreamUtil.readText(file.getContent().getInputStream(), "UTF-8");
        } catch (IOException e) {
            continue;
        }

        if(StringUtils.isBlank(content)) {
            continue;
        }

        routeMap.putAll(RouteHelper.getRoutesInsideUrlGeneratorFile(
            PhpPsiElementFactory.createPsiFileFromText(project, content)
        ));
    }

    this.routeMap = routeMap;
}
 
源代码4 项目: consulo   文件: AbstractColorsScheme.java
public void copyTo(AbstractColorsScheme newScheme) {
  myFontPreferences.copyTo(newScheme.myFontPreferences);
  newScheme.myLineSpacing = myLineSpacing;
  newScheme.myQuickDocFontSize = myQuickDocFontSize;
  myConsoleFontPreferences.copyTo(newScheme.myConsoleFontPreferences);
  newScheme.myConsoleLineSpacing = myConsoleLineSpacing;

  final Set<EditorFontType> types = myFonts.keySet();
  for (EditorFontType type : types) {
    Font font = myFonts.get(type);
    newScheme.setFont(type, font);
  }

  newScheme.myAttributesMap = new HashMap<TextAttributesKey, TextAttributes>(myAttributesMap);
  newScheme.myColorsMap = new HashMap<ColorKey, Color>(myColorsMap);
  newScheme.myVersion = myVersion;
}
 
源代码5 项目: consulo   文件: DFSTBuilderTest.java
public void testTNumberingSimple () {
  final TestNode nA = new TestNode("A");
  final TestNode nB = new TestNode("B");
  final TestNode nC = new TestNode("C");
  final TestNode nD = new TestNode("D");
  final TestNode[] allNodes = new TestNode[]{nA, nB, nC, nD};
  final Map<TestNode, TestNode[]> map = new HashMap<TestNode, TestNode[]>();
  map.put(nA, new TestNode[]{nC});
  map.put(nB, new TestNode[]{nA});
  map.put(nC, new TestNode[]{nB});
  map.put(nD, new TestNode[]{nB});
  GraphGenerator<TestNode> graph = graphByNodes(allNodes, map);
  final DFSTBuilder<TestNode> dfstBuilder = new DFSTBuilder<TestNode>(graph);
  assertTrue (!dfstBuilder.isAcyclic());
  Comparator<TestNode> comparator = dfstBuilder.comparator();
  assertTrue(comparator.compare(nA, nD) < 0);
  assertTrue(comparator.compare(nB, nD) < 0);
  assertTrue(comparator.compare(nC, nD) < 0);
}
 
源代码6 项目: consulo   文件: AnnotateCurrentRevisionAction.java
public AnnotateCurrentRevisionAction(@Nonnull FileAnnotation annotation, @Nonnull AbstractVcs vcs) {
  super("Annotate Revision", "Annotate selected revision in new tab", AllIcons.Actions.Annotate,
        annotation, vcs);
  List<VcsFileRevision> revisions = annotation.getRevisions();
  if (revisions == null) {
    myRevisions = null;
    return;
  }

  Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<VcsRevisionNumber, VcsFileRevision>();
  for (VcsFileRevision revision : revisions) {
    map.put(revision.getRevisionNumber(), revision);
  }

  myRevisions = new ArrayList<VcsFileRevision>(annotation.getLineCount());
  for (int i = 0; i < annotation.getLineCount(); i++) {
    myRevisions.add(map.get(annotation.getLineRevisionNumber(i)));
  }
}
 
源代码7 项目: consulo   文件: AnnotatePreviousRevisionAction.java
public AnnotatePreviousRevisionAction(@Nonnull FileAnnotation annotation, @Nonnull AbstractVcs vcs) {
  super("Annotate Previous Revision", "Annotate successor of selected revision in new tab", AllIcons.Actions.Annotate,
        annotation, vcs);
  List<VcsFileRevision> revisions = annotation.getRevisions();
  if (revisions == null) {
    myRevisions = null;
    return;
  }

  Map<VcsRevisionNumber, VcsFileRevision> map = new HashMap<VcsRevisionNumber, VcsFileRevision>();
  for (int i = 0; i < revisions.size(); i++) {
    VcsFileRevision revision = revisions.get(i);
    VcsFileRevision previousRevision = i + 1 < revisions.size() ? revisions.get(i + 1) : null;
    map.put(revision.getRevisionNumber(), previousRevision);
  }

  myRevisions = new ArrayList<VcsFileRevision>(annotation.getLineCount());
  for (int i = 0; i < annotation.getLineCount(); i++) {
    myRevisions.add(map.get(annotation.getLineRevisionNumber(i)));
  }
}
 
源代码8 项目: consulo   文件: CopyrightProfilesPanel.java
public Map<String, CopyrightProfile> getAllProfiles() {
  final Map<String, CopyrightProfile> profiles = new HashMap<String, CopyrightProfile>();
  if (!myInitialized.get()) {
    for (CopyrightProfile profile : myManager.getCopyrights()) {
      profiles.put(profile.getName(), profile);
    }
  }
  else {
    for (int i = 0; i < myRoot.getChildCount(); i++) {
      MyNode node = (MyNode)myRoot.getChildAt(i);
      final CopyrightProfile copyrightProfile = ((CopyrightConfigurable)node.getConfigurable()).getEditableObject();
      profiles.put(copyrightProfile.getName(), copyrightProfile);
    }
  }
  return profiles;
}
 
源代码9 项目: consulo   文件: TemplateManagerImpl.java
public void startTemplateWithPrefix(final Editor editor,
                                    final TemplateImpl template,
                                    final int templateStart,
                                    @Nullable final PairProcessor<String, String> processor,
                                    @Nullable final String argument) {
  final int caretOffset = editor.getCaretModel().getOffset();
  final TemplateState templateState = initTemplateState(editor);
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, () -> {
    editor.getDocument().deleteString(templateStart, caretOffset);
    editor.getCaretModel().moveToOffset(templateStart);
    editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
    editor.getSelectionModel().removeSelection();
    Map<String, String> predefinedVarValues = null;
    if (argument != null) {
      predefinedVarValues = new HashMap<>();
      predefinedVarValues.put(TemplateImpl.ARG, argument);
    }
    templateState.start(template, processor, predefinedVarValues);
  }, CodeInsightBundle.message("insert.code.template.command"), null);
}
 
源代码10 项目: consulo   文件: PsiPackageBase.java
@Nonnull
public PsiPackage[] getSubPackages(@Nonnull PsiPackage psiPackage, @Nonnull GlobalSearchScope scope) {
  final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
  final String qualifiedName = psiPackage.getQualifiedName();
  for (PsiDirectory dir : psiPackage.getDirectories(scope)) {
    PsiDirectory[] subDirs = dir.getSubdirectories();
    for (PsiDirectory subDir : subDirs) {
      final PsiPackage aPackage = myPackageManager.findPackage(subDir, myExtensionClass);
      if (aPackage != null) {
        final String subQualifiedName = aPackage.getQualifiedName();
        if (subQualifiedName.startsWith(qualifiedName) && !packagesMap.containsKey(subQualifiedName)) {
          packagesMap.put(aPackage.getQualifiedName(), aPackage);
        }
      }
    }
  }

  packagesMap.remove(qualifiedName);    // avoid SOE caused by returning a package as a subpackage of itself
  return ContainerUtil.toArray(packagesMap.values(), getPackageArrayFactory());
}
 
源代码11 项目: consulo   文件: UsedByMemberDependencyGraph.java
@Override
public Set<? extends T> getDependent() {
  if(myDependencies == null) {
    myDependencies = new HashSet<T>();
    myDependenciesToDependent = new HashMap<T, HashSet<T>>();
    for (T member : myMembers) {
      Set<T> dependent = myMemberDependenciesStorage.getMemberDependencies(member);
      if (dependent != null) {
        for (final T aDependent : dependent) {
          if (mySelectedNormal.contains(aDependent) && !mySelectedAbstract.contains(aDependent)) {
            myDependencies.add(member);
            HashSet<T> deps = myDependenciesToDependent.get(member);
            if (deps == null) {
              deps = new HashSet<T>();
              myDependenciesToDependent.put(member, deps);
            }
            deps.add(aDependent);
          }
        }
      }
    }
  }

  return myDependencies;
}
 
源代码12 项目: consulo   文件: GenericInlineHandler.java
public static Map<Language, InlineHandler.Inliner> initializeInliners(PsiElement element,
                                                                      InlineHandler.Settings settings,
                                                                      Collection<? extends PsiReference> allReferences) {
  final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
  for (PsiReference ref : allReferences) {
    if (ref == null) {
      LOG.error("element: " + element.getClass()+ ", allReferences contains null!");
      continue;
    }
    PsiElement refElement = ref.getElement();
    LOG.assertTrue(refElement != null, ref.getClass().getName());

    final Language language = refElement.getLanguage();
    if (inliners.containsKey(language)) continue;

    final List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
    for (InlineHandler handler : handlers) {
      InlineHandler.Inliner inliner = handler.createInliner(element, settings);
      if (inliner != null) {
        inliners.put(language, inliner);
        break;
      }
    }
  }
  return inliners;
}
 
源代码13 项目: flutter-intellij   文件: ChoseProjectTypeStep.java
@NotNull
@Override
public Collection<? extends ModelWizardStep> createDependentSteps() {
  List<ModelWizardStep> allSteps = Lists.newArrayList();
  myModuleDescriptionToStepMap = new HashMap<>();
  for (ModuleGalleryEntry moduleGalleryEntry : myModuleGalleryEntryList) {
    FlutterProjectStep step = ((FlutterGalleryEntry)moduleGalleryEntry).createFlutterStep(getModel());
    allSteps.add(step);
    myModuleDescriptionToStepMap.put(moduleGalleryEntry, step);
  }

  return allSteps;
}
 
源代码14 项目: flutter-intellij   文件: ChoseProjectTypeStep.java
@NotNull
@Override
public Collection<? extends ModelWizardStep> createDependentSteps() {
  List<ModelWizardStep> allSteps = Lists.newArrayList();
  myModuleDescriptionToStepMap = new HashMap<>();
  for (ModuleGalleryEntry moduleGalleryEntry : myModuleGalleryEntryList) {
    FlutterProjectStep step = ((FlutterGalleryEntry)moduleGalleryEntry).createFlutterStep(getModel());
    allSteps.add(step);
    myModuleDescriptionToStepMap.put(moduleGalleryEntry, step);
  }

  return allSteps;
}
 
源代码15 项目: CleanArchitecturePlugin   文件: EntityFragment.java
/**
 * Create package fragment and EntityFragment.class
 */
public static void create() {

    // Create fragment directory
    PsiDirectory fragmentDirectory = createDirectory(getViewPackage(), FRAGMENT.toLowerCase());

    // Create fragment class
    String className = getEntityConfig().getEntityName() + FRAGMENT;

    HashMap<String, String> varTemplate = new HashMap<>();
    varTemplate.put("PACKAGE_PROJECT", getPackageNameProject(getProjectDirectory()));
    varTemplate.put("LAYOUT_NAME", getEntityConfig().getEntityName().toLowerCase());
    varTemplate.put("PACKAGE_BASE_FRAGMENT", getPackageNameProject(ParentFragment.getFragmentDirectory()));
    varTemplate.put("BASE_FRAGMENT", PARENT_FRAGMENT);
    varTemplate.put("PACKAGE_BASE_PRESENTER", getPackageNameProject(Presenter.getPresenterDirectory()));
    varTemplate.put("BASE_PRESENTER", PRESENTER);

    if (EntityPresenter.getPresenterDirectory() != null && getEntityConfig().isContainsPresenter()) {  // With presenter or not
        varTemplate.put("PACKAGE_PRESENTER", getPackageNameProject(EntityPresenter.getPresenterDirectory()));
        varTemplate.put("PRESENTER", getEntityConfig().getEntityName() + PRESENTER);
    }

    Runnable runnable = () -> {
        JavaDirectoryService.getInstance().createClass(fragmentDirectory, className, FRAGMENT_TEMPLATE, false, varTemplate);
        try {
            createLayout(getPackageNameProject(fragmentDirectory), className, FRAGMENT);
        } catch (Exception e) {
            e.printStackTrace();
        }
    };
    WriteCommandAction.runWriteCommandAction(getProject(), runnable);

}
 
private static Map<String, Object> createProperties(final ServerContext serverContext, final String initialPath, final boolean foldersOnly, final boolean canCreateVirtualFolders) {
    final Map<String, Object> properties = new HashMap<String, Object>(4);
    properties.put(PROP_SERVER_CONTEXT, serverContext);
    properties.put(PROP_INITIAL_PATH, initialPath);
    properties.put(PROP_FOLDERS_ONLY, foldersOnly);
    properties.put(PROP_CAN_CREATE_VIRTUAL_FOLDERS, canCreateVirtualFolders);
    return properties;
}
 
源代码17 项目: intellij-haxe   文件: HaxePullUpHelper.java
@Override
public void moveFieldInitializations(LinkedHashSet<PsiField> movedFields) {
  PsiMethod[] constructors = myTargetSuperClass.getConstructors();

  if (constructors.length == 0) {
    constructors = new PsiMethod[]{null};
  }

  HashMap<PsiMethod,HashSet<PsiMethod>> constructorsToSubConstructors = buildConstructorsToSubConstructorsMap(constructors);
  for (PsiMethod constructor : constructors) {
    HashSet<PsiMethod> subConstructors = constructorsToSubConstructors.get(constructor);
    tryToMoveInitializers(constructor, subConstructors, movedFields);
  }
}
 
源代码18 项目: consulo   文件: SourceScope.java
public static Map<Module, Collection<Module>> buildAllDependencies(final Project project) {
  Graph<Module> graph = ModuleManager.getInstance(project).moduleGraph();
  Map<Module, Collection<Module>> result = new HashMap<Module, Collection<Module>>();
  for (final Module module : graph.getNodes()) {
    buildDependenciesForModule(module, graph, result);
  }
  return result;
}
 
源代码19 项目: consulo   文件: CoverageSuiteChooserDialog.java
private static void groupSuites(final HashMap<CoverageRunner, Map<String, List<CoverageSuite>>> grouped,
                                final CoverageSuite[] suites,
                                final CoverageEngine engine) {
  for (CoverageSuite suite : suites) {
    if (engine != null && suite.getCoverageEngine() != engine) continue;
    final CoverageFileProvider provider = suite.getCoverageDataFileProvider();
    if (provider instanceof DefaultCoverageFileProvider &&
        Comparing.strEqual(((DefaultCoverageFileProvider)provider).getSourceProvider(), DefaultCoverageFileProvider.class.getName())) {
      if (!provider.ensureFileExists()) continue;
    }
    final CoverageRunner runner = suite.getRunner();
    Map<String, List<CoverageSuite>> byProviders = grouped.get(runner);
    if (byProviders == null) {
      byProviders = new HashMap<String, List<CoverageSuite>>();
      grouped.put(runner, byProviders);
    }
    final String sourceProvider = provider instanceof DefaultCoverageFileProvider
                                  ? ((DefaultCoverageFileProvider)provider).getSourceProvider()
                                  : provider.getClass().getName();
    List<CoverageSuite> list = byProviders.get(sourceProvider);
    if (list == null) {
      list = new ArrayList<CoverageSuite>();
      byProviders.put(sourceProvider, list);
    }
    list.add(suite);
  }
}
 
源代码20 项目: consulo   文件: ThreadInvocationHandler.java
public ThreadInvocationHandler(SequentialTaskExecutor taskExecutor, ClassLoader callerClassLoader, Object target,
                               @javax.annotation.Nullable ChildWrapperCreator preWrapperCreator) {
  myTaskExecutor = taskExecutor;
  myCallerClassLoader = callerClassLoader;
  myTarget = target;
  myPreWrapperFactory = preWrapperCreator;
  myChild2Wrapped = new HashMap<Object, Object>();
}
 
源代码21 项目: consulo   文件: PlatformTestUtil.java
private static HashMap<String, VirtualFile> buildNameToFileMap(VirtualFile[] files, @javax.annotation.Nullable VirtualFileFilter filter) {
  HashMap<String, VirtualFile> map = new HashMap<String, VirtualFile>();
  for (VirtualFile file : files) {
    if (filter != null && !filter.accept(file)) continue;
    map.put(file.getName(), file);
  }
  return map;
}
 
源代码22 项目: consulo   文件: PlatformTestUtil.java
@SuppressWarnings("UnsafeVfsRecursion")
public static void assertDirectoriesEqual(VirtualFile dirAfter, VirtualFile dirBefore, @Nullable VirtualFileFilter fileFilter) throws IOException {
  FileDocumentManager.getInstance().saveAllDocuments();

  VirtualFile[] childrenAfter = dirAfter.getChildren();
  if (dirAfter.isInLocalFileSystem()) {
    File[] ioAfter = new File(dirAfter.getPath()).listFiles();
    shallowCompare(childrenAfter, ioAfter);
  }

  VirtualFile[] childrenBefore = dirBefore.getChildren();
  if (dirBefore.isInLocalFileSystem()) {
    File[] ioBefore = new File(dirBefore.getPath()).listFiles();
    shallowCompare(childrenBefore, ioBefore);
  }

  HashMap<String, VirtualFile> mapAfter = buildNameToFileMap(childrenAfter, fileFilter);
  HashMap<String, VirtualFile> mapBefore = buildNameToFileMap(childrenBefore, fileFilter);

  Set<String> keySetAfter = mapAfter.keySet();
  Set<String> keySetBefore = mapBefore.keySet();
  assertEquals(dirAfter.getPath(), keySetAfter, keySetBefore);

  for (String name : keySetAfter) {
    VirtualFile fileAfter = mapAfter.get(name);
    VirtualFile fileBefore = mapBefore.get(name);
    if (fileAfter.isDirectory()) {
      assertDirectoriesEqual(fileAfter, fileBefore, fileFilter);
    }
    else {
      assertFilesEqual(fileAfter, fileBefore);
    }
  }
}
 
源代码23 项目: consulo   文件: CertificateWrapper.java
private static Map<String, String> extractFields(X500Principal principal) {
  Map<String, String> fields = new HashMap<String, String>();
  for (String field : principal.getName().split("(?<!\\\\),")) {
    String[] parts = field.trim().split("=", 2);
    if (parts.length != 2) {
      continue;
    }
    fields.put(parts[0], parts[1].replaceAll("\\\\,", ","));
  }
  return Collections.unmodifiableMap(fields);
}
 
源代码24 项目: consulo   文件: DFSTBuilderTest.java
public void testGraph() {
  final TestNode nA = new TestNode("A");
  final TestNode nB = new TestNode("B");
  final TestNode nC = new TestNode("C");
  final TestNode nD = new TestNode("D");
  final TestNode nE = new TestNode("E");
  final TestNode nF = new TestNode("F");
  final TestNode[] allNodes = new TestNode[]{nA, nB, nC, nD, nE, nF};
  final Map<TestNode, TestNode[]> map = new HashMap<TestNode, TestNode[]>();
  map.put(nA, new TestNode[0]);
  map.put(nB, new TestNode[0]);
  map.put(nC, new TestNode[]{nA, nB});
  map.put(nD, new TestNode[]{nA, nC});
  map.put(nE, new TestNode[]{nC});
  map.put(nF, new TestNode[]{nB});
  GraphGenerator<TestNode> graph = graphByNodes(allNodes, map);
  final DFSTBuilder<TestNode> dfstBuilder = new DFSTBuilder<TestNode>(graph);
  if (!dfstBuilder.isAcyclic()) {
    fail("Acyclic graph expected");
    return;
  }
  final Comparator<TestNode> comparator = dfstBuilder.comparator();
  assertTrue(comparator.compare(nA, nC) < 0);
  assertTrue(comparator.compare(nB, nC) < 0);
  assertTrue(comparator.compare(nA, nD) < 0);
  assertTrue(comparator.compare(nC, nD) < 0);
  assertTrue(comparator.compare(nC, nE) < 0);
  assertTrue(comparator.compare(nB, nF) < 0);
}
 
源代码25 项目: consulo   文件: DFSTBuilderTest.java
public void testCircularDependency() {
  final TestNode nA = new TestNode("A");
  final TestNode nB = new TestNode("B");
  final TestNode nC = new TestNode("C");
  final TestNode nD = new TestNode("D");
  final TestNode[] allNodes = new TestNode[]{nA, nB, nC, nD};
  final Map<TestNode, TestNode[]> map = new HashMap<TestNode, TestNode[]>();
  map.put(nA, new TestNode[0]);
  map.put(nB, new TestNode[0]);
  map.put(nC, new TestNode[]{nA, nB, nD});
  map.put(nD, new TestNode[]{nC, nB});
  checkCircularDependecyDetected(allNodes, map);
}
 
源代码26 项目: consulo   文件: DFSTBuilderTest.java
public void testCircularDependency2() {
  final TestNode nA = new TestNode("A");
  final TestNode nB = new TestNode("B");
  final TestNode[] allNodes = new TestNode[]{nA, nB};
  final Map<TestNode, TestNode[]> map = new HashMap<TestNode, TestNode[]>();
  map.put(nA, new TestNode[]{nB});
  map.put(nB, new TestNode[]{nA});
  checkCircularDependecyDetected(allNodes, map);
}
 
源代码27 项目: consulo   文件: DFSTBuilderTest.java
public void testCircularDependency3() {
  final TestNode nA = new TestNode("A");
  final TestNode nB = new TestNode("B");
  final TestNode nC = new TestNode("C");
  final TestNode[] allNodes = new TestNode[]{nA, nB, nC};
  final Map<TestNode, TestNode[]> map = new HashMap<TestNode, TestNode[]>();
  map.put(nA, new TestNode[]{nB});
  map.put(nB, new TestNode[]{nA});
  map.put(nC, new TestNode[0]);
  checkCircularDependecyDetected(allNodes, map);
}
 
源代码28 项目: consulo   文件: CompileDriver.java
public CompileDriver(Project project) {
  myProject = project;
  myCachesDirectoryPath = CompilerPaths.getCacheStoreDirectory(myProject).getPath().replace('/', File.separatorChar);
  myShouldClearOutputDirectory = CompilerWorkspaceConfiguration.getInstance(myProject).CLEAR_OUTPUT_DIRECTORY;

  myGenerationCompilerModuleToOutputDirMap = new HashMap<>();

  final LocalFileSystem lfs = LocalFileSystem.getInstance();
  final IntermediateOutputCompiler[] generatingCompilers = CompilerManager.getInstance(myProject).getCompilers(IntermediateOutputCompiler.class, myCompilerFilter);
  final Module[] allModules = ModuleManager.getInstance(myProject).getModules();

  for (Module module : allModules) {
    for (IntermediateOutputCompiler compiler : generatingCompilers) {
      final VirtualFile productionOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, false));
      final VirtualFile testOutput = lookupVFile(lfs, CompilerPaths.getGenerationOutputPath(compiler, module, true));
      final Pair<IntermediateOutputCompiler, Module> pair = new Pair<>(compiler, module);
      final Pair<VirtualFile, VirtualFile> outputs = new Pair<>(productionOutput, testOutput);
      myGenerationCompilerModuleToOutputDirMap.put(pair, outputs);
    }

    for (AdditionalOutputDirectoriesProvider provider : AdditionalOutputDirectoriesProvider.EP_NAME.getExtensionList()) {
      final String[] outputDirectories = provider.getOutputDirectories(project, module);
      if (outputDirectories.length > 0) {
        for (String path : outputDirectories) {
          lookupVFile(lfs, path);
        }
      }
    }
  }
}
 
源代码29 项目: consulo   文件: CompileDriver.java
private static Map<Module, Set<GeneratingCompiler.GenerationItem>> buildModuleToGenerationItemMap(GeneratingCompiler.GenerationItem[] items) {
  final Map<Module, Set<GeneratingCompiler.GenerationItem>> map = new HashMap<>();
  for (GeneratingCompiler.GenerationItem item : items) {
    Module module = item.getModule();
    LOG.assertTrue(module != null);
    Set<GeneratingCompiler.GenerationItem> itemSet = map.get(module);
    if (itemSet == null) {
      itemSet = new HashSet<>();
      map.put(module, itemSet);
    }
    itemSet.add(item);
  }
  return map;
}
 
源代码30 项目: consulo   文件: CompileDriver.java
private String getModuleOutputPath(final Module module, ContentFolderTypeProvider contentFolderType) {
  Map<Module, String> map = myOutputs.get(contentFolderType);
  if (map == null) {
    myOutputs.put(contentFolderType, map = new HashMap<>());
  }

  String path = map.get(module);
  if (path == null) {
    path = CompilerPathsImpl.getModuleOutputPath(module, contentFolderType);
    map.put(module, path);
  }

  return path;
}