コード例 #1
0
    @Override
    public MultiMap<JpsModuleSourceRootType<?>, String> getSourceFolders() {
      MultiMap<JpsModuleSourceRootType<?>, String> res =
          new MultiMap<JpsModuleSourceRootType<?>, String>();

      for (VirtualFile root : ModuleRootManager.getInstance(myModule).getContentRoots()) {
        VirtualFile srcDir = root.findChild("src");
        if (srcDir != null) {
          for (String child : SRC_DIR_SUBFOLDER) {
            if (srcDir.findChild(child) != null) {
              res.putValue(JavaSourceRootType.SOURCE, "src/" + child);
            }
          }
        }

        VirtualFile griffonApp = root.findChild("griffon-app");
        if (griffonApp != null) {
          for (String child : GRIFFON_APP_SOURCE_ROOTS) {
            if (griffonApp.findChild(child) != null) {
              res.putValue(JavaSourceRootType.SOURCE, "griffon-app/" + child);
            }
          }

          for (VirtualFile child : root.getChildren()) {
            if (child.getNameWithoutExtension().endsWith("GriffonAddon")) {
              res.putValue(JavaSourceRootType.SOURCE, "");
              break;
            }
          }
        }

        List<GriffonSourceInspector.GriffonSource> sources =
            GriffonSourceInspector.processModuleMetadata(myModule);
        for (GriffonSourceInspector.GriffonSource source : sources) {
          res.putValue(JavaSourceRootType.SOURCE, source.getPath());
        }

        VirtualFile testDir = root.findChild("test");
        if (testDir != null) {
          for (String child : TEST_DIRS) {
            if (testDir.findChild(child) != null) {
              res.putValue(JavaSourceRootType.TEST_SOURCE, "test/" + child);
            }
          }
        }
      }

      return res;
    }
コード例 #2
0
    public String[] getSourceFolders() {
      List<String> sourceFolders = new ArrayList<String>();

      for (VirtualFile file : ModuleRootManager.getInstance(myModule).getContentRoots()) {
        handleSrc(file.findChild("src"), sourceFolders);
        VirtualFile griffonApp = file.findChild("griffon-app");
        handleGriffonApp(griffonApp, sourceFolders);
        List<GriffonSourceInspector.GriffonSource> sources =
            GriffonSourceInspector.processModuleMetadata(myModule);
        for (GriffonSourceInspector.GriffonSource source : sources) {
          sourceFolders.add(source.getPath());
        }
        if (griffonApp != null) {
          for (VirtualFile child : file.getChildren()) {
            if (child.getNameWithoutExtension().endsWith("GriffonAddon")) {
              sourceFolders.add("");
              break;
            }
          }
        }
      }
      return sourceFolders.toArray(new String[sourceFolders.size()]);
    }