當前位置: 首頁>>代碼示例>>Java>>正文


Java ModuleType類代碼示例

本文整理匯總了Java中com.intellij.openapi.module.ModuleType的典型用法代碼示例。如果您正苦於以下問題:Java ModuleType類的具體用法?Java ModuleType怎麽用?Java ModuleType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ModuleType類屬於com.intellij.openapi.module包,在下文中一共展示了ModuleType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isAvailable

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
protected boolean isAvailable(DataContext dataContext) {
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final Module module = LangDataKeys.MODULE.getData(dataContext);
    final ModuleType moduleType = module == null ? null : ModuleType.get(module);
    final boolean isGravModule = moduleType instanceof GravModuleType || moduleType instanceof WebModuleTypeBase;
    final boolean pluginEnabled = GravProjectComponent.isEnabled(project);
    if (!pluginEnabled) return false;
    if (dataContext.getData(PlatformDataKeys.NAVIGATABLE) instanceof PsiDirectory) {
        PsiDirectory psiDirectory = (PsiDirectory) dataContext.getData(PlatformDataKeys.NAVIGATABLE);
        String themeFolder = psiDirectory.getParent().getVirtualFile().getName();
        themeName = psiDirectory.getName();
        GravFileTypes.setModuleName(themeName);
        boolean isThemeFolder = themeFolder.equalsIgnoreCase("themes");
        return super.isAvailable(dataContext) && isGravModule && isThemeFolder;
    } else {
        return false;
    }
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:20,代碼來源:NewThemeConfigurationFileAction.java

示例2: createModule

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
public Module createModule(String moduleName, ModuleType moduleType) {
  Module module = moduleModel.findModuleByName(moduleName);
  if (module == null) {
    File imlFile = new File(imlDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
    removeImlFile(imlFile);
    module = moduleModel.newModule(imlFile.getPath(), moduleType.getId());
    module.setOption(EXTERNAL_SYSTEM_ID_KEY, EXTERNAL_SYSTEM_ID_VALUE);
  }
  module.setOption(Module.ELEMENT_TYPE, moduleType.getId());

  ModifiableRootModel modifiableModel =
      ModuleRootManager.getInstance(module).getModifiableModel();
  modules.put(module.getName(), modifiableModel);
  modifiableModel.clear();
  modifiableModel.inheritSdk();
  CompilerModuleExtension compilerSettings =
      modifiableModel.getModuleExtension(CompilerModuleExtension.class);
  if (compilerSettings != null) {
    compilerSettings.inheritCompilerOutputPath(false);
  }

  return module;
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:25,代碼來源:ModuleEditorImpl.java

示例3: createModuleFromTestData

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
protected Module createModuleFromTestData(final String dirInTestData, final String newModuleFileName, final ModuleType moduleType,
                                          final boolean addSourceRoot)
  throws IOException {
  final File dirInTestDataFile = new File(dirInTestData);
  assertTrue(dirInTestDataFile.isDirectory());
  final File moduleDir = createTempDirectory();
  FileUtil.copyDir(dirInTestDataFile, moduleDir);
  final Module module = createModule(moduleDir + "/" + newModuleFileName, moduleType);
  final VirtualFile root = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleDir);
  assertNotNull(root);
  new WriteCommandAction.Simple(module.getProject()) {
    @Override
    protected void run() throws Throwable {
      root.refresh(false, true);
    }
  }.execute().throwException();
  if (addSourceRoot) {
    PsiTestUtil.addSourceContentToRoots(module, root);
  }
  else {
    PsiTestUtil.addContentRoot(module, root);
  }
  return module;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:ModuleTestCase.java

示例4: postConfigFacets

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
public void postConfigFacets() {
  MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
    public void run() {
      if (myModule.isDisposed()) return;

      final ModuleType moduleType = ModuleType.get(myModule);

      for (final MavenImporter importer : getSuitableImporters()) {
        final MavenProjectChanges changes;
        if (myMavenProjectChanges == null) {
          if (importer.processChangedModulesOnly()) continue;
          changes = MavenProjectChanges.NONE;
        }
        else {
          changes = myMavenProjectChanges;
        }

        if (importer.getModuleType() == moduleType) {
          importer.postProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
        }
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:MavenModuleImporter.java

示例5: createGroupTemplates

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
private static List<ArchivedProjectTemplate> createGroupTemplates(Element groupElement) {
  return ContainerUtil.mapNotNull(groupElement.getChildren(TEMPLATE), new NullableFunction<Element, ArchivedProjectTemplate>() {
    @Override
    public ArchivedProjectTemplate fun(final Element element) {
      if (!checkRequiredPlugins(element)) {
        return null;
      }

      final ModuleType moduleType = ModuleTypeManager.getInstance().findByID(element.getChildText("moduleType"));
      final String path = element.getChildText("path");
      final String description = element.getChildTextTrim("description");
      String name = element.getChildTextTrim("name");
      RemoteProjectTemplate template = new RemoteProjectTemplate(name, element, moduleType, path, description);
      template.populateFromElement(element);
      return template;
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:RemoteTemplatesFactory.java

示例6: isVisible

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
public static boolean isVisible(FacetEditorFacade editor, final FacetType<?, ?> type) {
  final ModuleType moduleType = editor.getSelectedModuleType();
  if (moduleType == null || !type.isSuitableModuleType(moduleType)) {
    return false;
  }

  final FacetTypeId<?> underlyingTypeId = type.getUnderlyingFacetType();
  final FacetInfo selectedFacet = editor.getSelectedFacetInfo();
  if (selectedFacet == null) {
    return underlyingTypeId == null && canAddFacet(null, type, editor);
  }

  final FacetTypeId selectedFacetType = selectedFacet.getFacetType().getId();
  if (selectedFacetType == underlyingTypeId) {
    return canAddFacet(selectedFacet, type, editor);
  }

  final FacetInfo parent = editor.getParent(selectedFacet);
  if (!canAddFacet(parent, type, editor)) {
    return false;
  }
  return parent == null && underlyingTypeId == null || parent != null && parent.getFacetType().getId() == underlyingTypeId;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:AddFacetToModuleAction.java

示例7: preConfigFacets

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
public void preConfigFacets() {
  MavenUtil.invokeAndWaitWriteAction(myModule.getProject(), new Runnable() {
    public void run() {
      if (myModule.isDisposed()) return;

      final ModuleType moduleType = ModuleType.get(myModule);

      for (final MavenImporter importer : getSuitableImporters()) {
        final MavenProjectChanges changes;
        if (myMavenProjectChanges == null) {
          if (importer.processChangedModulesOnly()) continue;
          changes = MavenProjectChanges.NONE;
        }
        else {
          changes = myMavenProjectChanges;
        }

        if (importer.getModuleType() == moduleType) {
          importer.preProcess(myModule, myMavenProject, changes, myModifiableModelsProvider);
        }
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:MavenModuleImporter.java

示例8: isVisible

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
private boolean isVisible() {
  final Module module = getSelectedModule();
  if (module == null || !myProvider.isEnabledForModuleType(ModuleType.get(module))) {
    return false;
  }
  final ProjectFacetsConfigurator facetsProvider = myModuleStructureConfigurable.getFacetConfigurator();
  if (!myProvider.canAddSupport(module, facetsProvider)) {
    return false;
  }

  final String underlyingFrameworkTypeId = myFrameworkType.getUnderlyingFrameworkTypeId();
  if (underlyingFrameworkTypeId == null) return true;

  final FrameworkSupportInModuleProvider underlyingProvider = FrameworkSupportUtil.findProvider(underlyingFrameworkTypeId, FrameworkSupportUtil.getAllProviders());
  if (underlyingProvider == null) {
    LOG.error("framework not found by id " + underlyingFrameworkTypeId);
  }
  return underlyingProvider.isSupportAlreadyAdded(module, facetsProvider);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:AddFrameworkSupportInProjectStructureAction.java

示例9: doCreateRealModuleIn

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
protected static Module doCreateRealModuleIn(String moduleName, final Project project, final ModuleType moduleType) {
  final VirtualFile baseDir = project.getBaseDir();
  assertNotNull(baseDir);
  final File moduleFile = new File(FileUtil.toSystemDependentName(baseDir.getPath()), moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
  FileUtil.createIfDoesntExist(moduleFile);
  myFilesToDelete.add(moduleFile);
  return new WriteAction<Module>() {
    @Override
    protected void run(@NotNull Result<Module> result) throws Throwable {
      VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleFile);
      assertNotNull(virtualFile);
      Module module = ModuleManager.getInstance(project).newModule(virtualFile.getPath(), moduleType.getId());
      module.getModuleFile();
      result.setResult(module);
    }
  }.execute().getResultObject();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:PlatformTestCase.java

示例10: customizeCellRenderer

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
public void customizeCellRenderer(JTree tree, Object nodeValue, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  final Object value = ((DefaultMutableTreeNode)nodeValue).getUserObject();
  if (value instanceof DirectoryChooser.ItemWrapper) {
    DirectoryChooser.ItemWrapper wrapper = (DirectoryChooser.ItemWrapper)value;
    DirectoryChooser.PathFragment[] fragments = wrapper.getFragments();
    for (DirectoryChooser.PathFragment fragment : fragments) {
      append(fragment.getText(),
             fragment.isCommon() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    }
    setIcon(wrapper.getIcon(myFileIndex));
  }
  else if (value instanceof Module) {
    final Module module = (Module)value;
    append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(ModuleType.get(module).getIcon());
  } else if (value instanceof ModuleGroup) {
    append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(PlatformIcons.CLOSED_MODULE_GROUP_ICON);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:DirectoryChooserModuleTreeView.java

示例11: updatePythonFacet

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
private static void updatePythonFacet(
    BlazeContext context,
    BlazeProjectData blazeProjectData,
    Module workspaceModule,
    ModifiableRootModel workspaceModifiableModel) {
  if (!blazeProjectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.PYTHON)
      || blazeProjectData.workspaceLanguageSettings.isWorkspaceType(WorkspaceType.PYTHON)) {
    removeFacet(workspaceModule);
    return;
  }
  if (ModuleType.get(workspaceModule) instanceof PythonModuleTypeBase) {
    return;
  }
  LibraryContributingFacet<?> pythonFacet = getOrCreatePythonFacet(context, workspaceModule);
  if (pythonFacet == null) {
    return;
  }
  Library pythonLib = getFacetLibrary(pythonFacet);
  if (pythonLib != null) {
    workspaceModifiableModel.addLibraryEntry(pythonLib);
  }
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:23,代碼來源:BlazePythonSyncPlugin.java

示例12: doCreateRealModuleIn

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@NotNull
public static Module doCreateRealModuleIn(@NotNull String moduleName,
                                          @NotNull final Project project,
                                          @NotNull final ModuleType moduleType) {
  final VirtualFile baseDir = project.getBaseDir();
  assertNotNull(baseDir);
  final File moduleFile = new File(baseDir.getPath().replace('/', File.separatorChar),
                                   moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
  FileUtil.createIfDoesntExist(moduleFile);
  myFilesToDelete.add(moduleFile);
  return new WriteAction<Module>() {
    @Override
    protected void run(@NotNull Result<Module> result) throws Throwable {
      final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(moduleFile);
      assert virtualFile != null;
      Module module = ModuleManager.getInstance(project).newModule(virtualFile.getPath(), moduleType.getId());
      module.getModuleFile();
      result.setResult(module);
    }
  }.execute().getResultObject();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:VcsRootPlatformTest.java

示例13: isEnabled

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
protected boolean isEnabled(@NotNull RootsSelection selection, @NotNull Module module) {
  if (!ModuleType.get(module).isSupportedRootType(myRootType) || selection.myHaveSelectedFilesUnderSourceRoots
      || ModuleSourceRootEditHandler.getEditHandler(myRootType) == null) {
    return false;
  }

  if (!selection.mySelectedDirectories.isEmpty()) {
    return true;
  }

  for (SourceFolder root : selection.mySelectedRoots) {
    if (!myRootType.equals(root.getRootType())) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:MarkSourceRootAction.java

示例14: customizeCellRenderer

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
  public void customizeCellRenderer(
  JTree tree,
  Object value,
  boolean selected,
  boolean expanded,
  boolean leaf,
  int row,
  boolean hasFocus
){
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (!(userObject instanceof MyUserObject)){
      if (userObject != null){
        append(userObject.toString(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
      }
      return;
    }
    MyUserObject node = (MyUserObject)userObject;
    Module module = node.getModule();
    setIcon(ModuleType.get(module).getIcon());
    if (node.isInCycle()){
      append(module.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES);
    } else {
      append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    }
  }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:ModulesDependenciesPanel.java

示例15: configure

import com.intellij.openapi.module.ModuleType; //導入依賴的package包/類
@Override
public void configure(
    @NotNull final ModifiableFacetModel modifiableFacetModel,
    @NotNull final HybrisModuleDescriptor moduleDescriptor,
    @NotNull final Module javaModule,
    @NotNull final ModifiableRootModel modifiableRootModel
) {
    final File webRoot = moduleDescriptor.getWebRoot();
    if (null == webRoot) {
        return;
    }

    WebFacet webFacet = modifiableFacetModel.getFacetByType(WebFacet.ID);

    if (webFacet == null) {
        final FacetType<WebFacet, FacetConfiguration> webFacetType = FacetTypeRegistry.getInstance().findFacetType(
            WebFacet.ID
        );

        if (!webFacetType.isSuitableModuleType(ModuleType.get(javaModule))) {
            return;
        }

        webFacet = FacetManager.getInstance(javaModule).createFacet(
            webFacetType, webFacetType.getDefaultFacetName(), null
        );

        modifiableFacetModel.addFacet(webFacet);

    } else {
        webFacet.removeAllWebRoots();
        webFacet.getDescriptorsContainer().getConfiguration().removeConfigFiles(
            DeploymentDescriptorsConstants.WEB_XML_META_DATA
        );
    }

    webFacet.setWebSourceRoots(modifiableRootModel.getSourceRootUrls(false));
    webFacet.addWebRootNoFire(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(webRoot.getAbsolutePath())), "/");
    this.setupFacetDeploymentDescriptor(webFacet, moduleDescriptor);
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:41,代碼來源:WebFacetConfigurator.java


注:本文中的com.intellij.openapi.module.ModuleType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。