APISonar


com.intellij.openapi.module.ModuleType.JAVA

> com > intellij > openapi > module > ModuleType > JAVA
com APIs intellij APIs openapi APIs module APIs ModuleType APIs JAVA APIs

Example 1
public ModuleType findByID(String moduleTypeID) {
    if (JAVA_MODULE_ID_OLD.equals(moduleTypeID)) {
      return ModuleType.JAVA; // for compatibility with the previous ID that Java modules had
    }
    for (ModuleType type : myModuleTypes.keySet()) {
      if (type.getId().equals(moduleTypeID)) {
        return type;
      }
    }

    return new UnknownModuleType(moduleTypeID);
  }
Example 2
public void loadFromXml(Element root, String filePath) throws InvalidDataException {
    List attributes = root.getAttributes();
    for (Object attribute : attributes) {
      Attribute attr = (Attribute)attribute;
      setOption(attr.getName(), attr.getValue());
    }

    final String moduleTypeId = getOptionValue(ELEMENT_TYPE);
    final ModuleType moduleType = moduleTypeId == null ? ModuleType.JAVA : ModuleTypeManager.getInstance().findByID(moduleTypeId);
    setModuleType(moduleType);
    super.loadFromXml(root, filePath);
  }
Example 3
public void createLanguageModule(String namespace, final String path) {
    executeWriteAction(new Runnable() {
      public void run() {
        ModuleManager manager = ModuleManager.getInstance(myProject);
        final Module module = manager.newModule(path, ModuleType.JAVA);

        ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
        LocalFileSystem localFileSystem = LocalFileSystem.getInstance();

        rootManager.getModifiableModel().addContentEntry(localFileSystem.findFileByIoFile(new File(path, "source")));
        rootManager.getModifiableModel().addContentEntry(localFileSystem.findFileByIoFile(new File(path, "source_gen")));
      }
    });
  }
Example 4
public void load() throws IOException, StateStorage.StateStorageException {
    super.load();

    final ModuleStoreImpl.ModuleFileData storageData = getMainStorageData();
    final String moduleTypeId = storageData.myOptions.get(ModuleImpl.ELEMENT_TYPE);
    final ModuleType moduleType = moduleTypeId == null ? ModuleType.JAVA : ModuleTypeManager.getInstance().findByID(moduleTypeId);
    myModule.setModuleType(moduleType);
  }