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


Java ModuleType.get方法代碼示例

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


在下文中一共展示了ModuleType.get方法的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: 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

示例3: isAvailable

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
private boolean isAvailable(DataContext dataContext) {
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final Module module = LangDataKeys.MODULE.getData(dataContext);
    if(module == null) return false;
    final ModuleType moduleType = ModuleType.get(module);

    final boolean pluginEnabled = GravProjectComponent.isEnabled(project);
    final boolean isGravModule = moduleType instanceof GravModuleType || moduleType instanceof WebModuleTypeBase;

    final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    boolean check2 = project != null && view != null && view.getDirectories().length != 0;
    return pluginEnabled && isGravModule && check2;
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:14,代碼來源:CreateNewThemeAction.java

示例4: createEditors

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
  ModifiableRootModel rootModel = state.getRootModel();
  Module module = rootModel.getModule();
  if (!(ModuleType.get(module) instanceof JavaModuleType)) {
    return ModuleConfigurationEditor.EMPTY;
  }

  String moduleName = module.getName();
  List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>();
  editors.add(new ContentEntriesEditor(moduleName, state));
  editors.add(new OutputEditor(state));
  editors.add(new ClasspathEditor(state));
  return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:DefaultModuleEditorsProvider.java

示例5: createEditors

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
public ModuleConfigurationEditor[] createEditors(final ModuleConfigurationState state) {
  final Module module = state.getRootModel().getModule();
  if (!(ModuleType.get(module) instanceof PythonModuleType)) return ModuleConfigurationEditor.EMPTY;
  final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
  final List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>();
  editors.add(new PyContentEntriesEditor(module, state, JavaSourceRootType.SOURCE));
  editors.add(editorFactory.createClasspathEditor(state));
  return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PythonModuleConfigurationEditorProvider.java

示例6: isPythonModule

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
private static boolean isPythonModule(@NotNull final Module module) {
  final ModuleType moduleType = ModuleType.get(module);
  if (moduleType instanceof PythonModuleTypeBase) return true;
  final Facet[] allFacets = FacetManager.getInstance(module).getAllFacets();
  for (Facet facet : allFacets) {
    if (facet.getConfiguration() instanceof PythonFacetSettings) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:PythonLanguageLevelPusher.java

示例7: isPythonModule

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
protected static boolean isPythonModule(Module module) {
  if (module == null) {
    return false;
  }
  if (ModuleType.get(module) instanceof PythonModuleTypeBase) {
    return true;
  }
  final Facet[] allFacets = FacetManager.getInstance(module).getAllFacets();
  for (Facet facet : allFacets) {
    if (facet.getConfiguration() instanceof PythonFacetSettings) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:PythonTestConfigurationProducer.java

示例8: configureProject

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
@Override
public void configureProject(Project project, @NotNull VirtualFile baseDir, Ref<Module> moduleRef) {
  final Application application = ApplicationManager.getApplication();
  if (application.isUnitTestMode()) {
    return;
  }

  for (Module m: ModuleManager.getInstance(project).getModules()) {
    if (ModuleType.get(m) instanceof PythonModuleTypeBase) {
      updateIntegratedTools(m, 10000);
      break;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:PyIntegratedToolsProjectConfigurator.java

示例9: saveDotProjectFile

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
public static void saveDotProjectFile(@NotNull Module module, @NotNull String storageRoot) throws IOException {
  try {
    Document doc;
    if (ModuleType.get(module) instanceof JavaModuleType) {
      doc = JDOMUtil.loadDocument(DotProjectFileHelper.class.getResource("template.project.xml"));
    }
    else {
      doc = JDOMUtil.loadDocument(DotProjectFileHelper.class.getResource("template.empty.project.xml"));
    }

    doc.getRootElement().getChild(EclipseXml.NAME_TAG).setText(module.getName());

    final File projectFile = new File(storageRoot, EclipseXml.PROJECT_FILE);
    if (!FileUtil.createIfDoesntExist(projectFile)) {
      return;
    }

    EclipseJDOMUtil.output(doc.getRootElement(), projectFile, module.getProject());
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      public void run() {
        LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(projectFile.getPath()));
      }
    });
  }
  catch (JDOMException e) {
    LOG.error(e);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:DotProjectFileHelper.java

示例10: createEditors

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
  final Module module = state.getRootModel().getModule();
  if (ModuleType.get(module) != PluginModuleType.getInstance()) return ModuleConfigurationEditor.EMPTY;

  final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
  List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>();
  editors.add(editorFactory.createModuleContentRootsEditor(state));
  editors.add(editorFactory.createOutputEditor(state));
  editors.add(editorFactory.createClasspathEditor(state));
  editors.add(new PluginModuleBuildConfEditor(state));
  return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:PluginModuleEditorsProvider.java

示例11: getNewArtifactTemplates

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
@NotNull
@Override
public List<? extends ArtifactTemplate> getNewArtifactTemplates(@NotNull PackagingElementResolvingContext context) {
  final List<Module> modules = new ArrayList<Module>();
  for (Module module : context.getModulesProvider().getModules()) {
    if (ModuleType.get(module) instanceof JavaModuleType) {
      modules.add(module);
    }
  }
  if (modules.isEmpty()) {
    return Collections.emptyList();
  }
  return Collections.singletonList(new JavaFxArtifactTemplate(modules));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:JavaFxApplicationArtifactType.java

示例12: isJavaModule

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
private static boolean isJavaModule(Module module) {
  ModuleType moduleType = ModuleType.get(module);
  //this additional check can be removed when we get rid of PluginModuleType
  return moduleType instanceof JavaModuleType || moduleType != null && "PLUGIN_MODULE".equals(moduleType.getId());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:MarkGeneratedSourceRootAction.java

示例13: getSelectedModuleType

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
@Override
@Nullable
public ModuleType getSelectedModuleType() {
  final Module module = getSelectedModule();
  return module != null ? ModuleType.get(module) : null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:FacetEditorFacadeImpl.java

示例14: isUnknownModuleType

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
@Override
protected boolean isUnknownModuleType(@NotNull Module module) {
  return ModuleType.get(module) instanceof UnknownModuleType;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:ModuleManagerComponent.java

示例15: addFacets

import com.intellij.openapi.module.ModuleType; //導入方法依賴的package包/類
private void addFacets(final List<FacetState> facetStates, final Facet underlyingFacet, ModifiableFacetModel model) {

    FacetTypeRegistry registry = FacetTypeRegistry.getInstance();
    for (FacetState child : facetStates) {
      final String typeId = child.getFacetType();
      if (typeId == null) {
        addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.facet.type.isn.t.specified"));
        continue;
      }

      final FacetType<?,?> type = registry.findFacetType(typeId);
      if (type == null) {
        addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.unknown.facet.type.0", typeId), typeId);
        continue;
      }

      ModuleType moduleType = ModuleType.get(myModule);
      if (!type.isSuitableModuleType(moduleType)) {
        addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.0.facets.are.not.allowed.in.1",
                                                                      type.getPresentableName(), moduleType.getName()));
        continue;
      }

      FacetType<?,?> expectedUnderlyingType = null;
      FacetTypeId<?> underlyingTypeId = type.getUnderlyingFacetType();
      if (underlyingTypeId != null) {
        expectedUnderlyingType = registry.findFacetType(underlyingTypeId);
      }
      FacetType actualUnderlyingType = underlyingFacet != null ? underlyingFacet.getType() : null;
      if (expectedUnderlyingType != null) {
        if (!expectedUnderlyingType.equals(actualUnderlyingType)) {
          addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.0.facet.must.be.placed.under.1.facet",
                                                                        type.getPresentableName(),
                                                                        expectedUnderlyingType.getPresentableName()));
          continue;
        }
      }
      else if (actualUnderlyingType != null) {
        addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.0.cannot.be.placed.under.1",
                                                                      type.getPresentableName(), actualUnderlyingType.getPresentableName()));
        continue;
      }

      try {
        addFacet(type, child, underlyingFacet, model);
      }
      catch (InvalidDataException e) {
        LOG.info(e);
        addInvalidFacet(child, model, underlyingFacet, ProjectBundle.message("error.message.cannot.load.facet.configuration.0", e.getMessage()));
      }
    }
  }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:53,代碼來源:FacetManagerImpl.java


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