当前位置: 首页>>代码示例>>Java>>正文


Java JavaModuleType类代码示例

本文整理汇总了Java中com.intellij.openapi.module.JavaModuleType的典型用法代码示例。如果您正苦于以下问题:Java JavaModuleType类的具体用法?Java JavaModuleType怎么用?Java JavaModuleType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaModuleType类属于com.intellij.openapi.module包,在下文中一共展示了JavaModuleType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupModule

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
private Module setupModule(String moduleName, final String className) throws IOException {
  final VirtualFile root1 = myFixture.getTempDirFixture().findOrCreateDir(moduleName);
  final Module module = PsiTestUtil.addModule(getProject(), JavaModuleType.getModuleType(), moduleName, root1);
  PsiTestUtil.removeAllRoots(module, IdeaTestUtil.getMockJdk18());
  PsiTestUtil.addSourceRoot(module, root1, true);
  myFixture.addFileToProject(moduleName + "/p/" + className + ".java",
                             "package p;\n" +
                             "public class " + className + " extends junit.framework.TestCase {\n" +
                             "  public void testName1(){}" +
                             "}");
  final String pathForClass = PathUtil.getJarPathForClass(TestCase.class);
  PsiTestUtil.addLibrary(module,
                         "junit4",
                         StringUtil.getPackageName(pathForClass, File.separatorChar),
                         StringUtil.getShortName(pathForClass, File.separatorChar));
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JUnitClasspathTest.java

示例2: testGetSuitableModules_returnsNonAppEngineModules_whenSomeModulesHaveAppEngineFacet

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public void
    testGetSuitableModules_returnsNonAppEngineModules_whenSomeModulesHaveAppEngineFacet() {
  Project project = getProject();
  ModuleType moduleType = JavaModuleType.getModuleType();
  String path = project.getBaseDir().getPath();
  createModuleAt("module1", project, moduleType, path);
  Module module2 = createModuleAt("module2", project, moduleType, path);
  Module module3 = createModuleAt("module3", project, moduleType, path);

  new WriteAction() {
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      FacetType appEngineStandardFacet = AppEngineStandardFacet.getFacetType();
      FacetManager.getInstance(module2)
          .addFacet(appEngineStandardFacet, appEngineStandardFacet.getPresentableName(), null);

      FacetType appEngineFlexibleFacet = AppEngineFlexibleFacet.getFacetType();
      FacetManager.getInstance(module3)
          .addFacet(appEngineFlexibleFacet, appEngineFlexibleFacet.getPresentableName(), null);
    }
  }.execute();

  List<Module> suitableModules = getAction().getModulesWithoutAppEngineSupport(project);
  assertEquals(1, suitableModules.size());
  assertEquals("module1", suitableModules.get(0).getName());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:27,代码来源:AddAppEngineFrameworkSupportActionTest.java

示例3: setCurrentValuesToControls

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
private void setCurrentValuesToControls() {
    myModules.fillModules(config.getProject(), JavaModuleType.getModuleType());
    myVMParameters.getComponent().setText(configurationValues.getVmArgs());
    myModules.setSelectedModule(config.getModule());
    myEquinoxMainClass.setText(configurationValues.getMainClass());
    myApplicationName.setText(configurationValues.getApplicationName());
    for (JBCheckBox jb : launchConfigOptions) {
        if (configurationValues.getEnabledConfigs().contains(optionMapping.get(jb))) {
            jb.setSelected(true);
        }
    }

    myAutomaticDiagnostic.setSelected(configurationValues.isAutoDiagnostic());
    myUrl.setText(configurationValues.getDiagnosticUrl());
    myUser.setText(configurationValues.getDiagnosticUsername());
    myPassword.setText(configurationValues.getDiagnosticPassword());
}
 
开发者ID:mcmil,项目名称:wuff-intellij-plugin,代码行数:18,代码来源:WuffRunConfigurationEditor.java

示例4: saveDotProjectFile

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public static void saveDotProjectFile(Module module, String storageRoot) throws IOException {
  try {
    final 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"));
    }

    final Element nameElement = doc.getRootElement().getChild(EclipseXml.NAME_TAG);
    nameElement.setText(module.getName());

    final File projectFile = new File(storageRoot, EclipseXml.PROJECT_FILE);
    if (!FileUtil.createIfDoesntExist(projectFile)) return;
    EclipseJDOMUtil.output(doc, 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:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:DotProjectFileHelper.java

示例5: createEditors

import com.intellij.openapi.module.JavaModuleType; //导入依赖的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

示例6: saveDotProjectFile

import com.intellij.openapi.module.JavaModuleType; //导入依赖的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

示例7: GroovySdkForNewModuleWizardStep

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public GroovySdkForNewModuleWizardStep(ModuleBuilder moduleBuilder,
                                       WizardContext wizardContext,
                                       @Nullable MvcFramework framework,
                                       SettingsStep settingsStep) {
  super(framework, wizardContext, moduleBuilder.getContentEntryPath());
  moduleBuilder.addModuleConfigurationUpdater(createModuleConfigurationUpdater());
  if (settingsStep != null) {
    myJavaStep = JavaModuleType.getModuleType().modifyProjectTypeStep(settingsStep, moduleBuilder);
    settingsStep.addSettingsField("\u001B" + (framework == null ? "Groovy" : framework.getDisplayName()) + " library:", getPanel().getSimplePanel());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GroovySdkForNewModuleWizardStep.java

示例8: getNewArtifactTemplates

import com.intellij.openapi.module.JavaModuleType; //导入依赖的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

示例9: isEnabledForModuleType

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
@Override
public boolean isEnabledForModuleType(@NotNull ModuleType moduleType) {
  if (PlatformUtils.isIdeaUltimate()) {
    return moduleType instanceof JavaModuleType;
  } else {
    return false;
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:9,代码来源:AppEngineStandardSupportProvider.java

示例10: createModuleDeploymentSources

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
/**
 * Creates a list of module deployment sources available for deployment to App Engine:
 *
 * <p>Maven based deployment sources are included for both flexible and standard projects if
 * applicable.
 *
 * <p>User browsable jar/war deployment sources are included only if there are no App Engine
 * standard modules.
 *
 * @return a list of {@link ModuleDeploymentSource}'s
 */
public static List<ModuleDeploymentSource> createModuleDeploymentSources(
    @NotNull Project project) {
  AppEngineProjectService projectService = AppEngineProjectService.getInstance();

  List<ModuleDeploymentSource> moduleDeploymentSources = Lists.newArrayList();

  boolean hasStandardModules = false;

  for (Module module : ModuleManager.getInstance(project).getModules()) {
    FacetManager facetManager = FacetManager.getInstance(module);
    if (facetManager.getFacetByType(AppEngineStandardFacetType.ID) != null
        || facetManager.getFacetByType(AppEngineFlexibleFacetType.ID) != null) {
      AppEngineEnvironment environment =
          projectService
              .getModuleAppEngineEnvironment(module)
              .orElseThrow(() -> new RuntimeException("No environment."));

      if (ModuleType.is(module, JavaModuleType.getModuleType())
          && projectService.isJarOrWarMavenBuild(module)) {
        moduleDeploymentSources.add(
            createMavenBuildDeploymentSource(project, module, environment));
      }

      if (environment.isStandard() || environment.isFlexCompat()) {
        hasStandardModules = true;
      }
    }
  }

  if (!hasStandardModules) {
    moduleDeploymentSources.add(createUserSpecifiedPathDeploymentSource(project));
  }

  return moduleDeploymentSources;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:47,代码来源:AppEngineUtil.java

示例11: testGetSuitableModules_returnsAllModules_whenModulesHaveNoAppEngineFacet

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public void testGetSuitableModules_returnsAllModules_whenModulesHaveNoAppEngineFacet() {
  Project project = getProject();
  ModuleType moduleType = JavaModuleType.getModuleType();
  String path = project.getBaseDir().getPath();
  createModuleAt("module1", project, moduleType, path);
  createModuleAt("module2", project, moduleType, path);
  createModuleAt("module3", project, moduleType, path);

  List<Module> suitableModules = getAction().getModulesWithoutAppEngineSupport(project);
  assertEquals(3, suitableModules.size());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:12,代码来源:AddAppEngineFrameworkSupportActionTest.java

示例12: create

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IdeaProject create(final Module module,
                          final FileObject rootFolder,
                          @Nullable IProjectConfig config) {

    final ModuleType moduleType = ModuleType.get(module);
    if (moduleType != MetaborgModuleType.getModuleType() && moduleType != JavaModuleType.getModuleType()) {
        this.logger.info("Project is not a Language Specification or Java project: {}", module);
        return null;
    }

    final ConfigRequest<? extends IProjectConfig> configRequest = this.projectConfigService.get(rootFolder);
    if(!configRequest.valid()) {
        this.logger.error(
                "An error occurred while retrieving the configuration for the project at: {}", rootFolder);
        configRequest.reportErrors(new StreamMessagePrinter(this.sourceTextService, false, false, this.logger));
        return null;
    }

    if (config == null) {
        config = configRequest.config();
    }

    if(config == null) {
        this.logger.info("Project has no Metaborg configuration: {}", rootFolder);
        return null;
    }

    return new IdeaProject(module, rootFolder, config);
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:34,代码来源:IdeaProjectFactory.java

示例13: getPlatformIcon

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
@Nullable
private Icon getPlatformIcon(@NotNull final DefracPlatform platform) {
  //TODO(joa): need icons for iOS
  switch(platform) {
    case ANDROID:
      return DefracIcons.AndroidModule;
    case WEB:
      return PlatformIcons.WEB_ICON;
    default:
      return JavaModuleType.getModuleType().getIcon();
  }
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:13,代码来源:DefracViewPlatformNode.java

示例14: testPluginProject

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public void testPluginProject() throws Exception {
  createSdk("devkit", IdeaJdk.getInstance());
  Project project = createProjectFromTemplate(JavaModuleType.JAVA_GROUP, PluginModuleType.getInstance().getName(), null);
  VirtualFile baseDir = project.getBaseDir();
  VirtualFile virtualFile = VfsUtil.findRelativeFile("META-INF/plugin.xml", baseDir);
  assertNotNull(virtualFile);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:PluginProjectWizardTest.java

示例15: testProjectWithoutSdk

import com.intellij.openapi.module.JavaModuleType; //导入依赖的package包/类
public void testProjectWithoutSdk() throws Exception {
  try {
    createProjectFromTemplate(JavaModuleType.JAVA_GROUP, PluginModuleType.getInstance().getName(), null);
    fail("Exception should be thrown");
  }
  catch (Exception e) {
    assertEquals(IdeBundle.message("prompt.confirm.project.no.jdk"), e.getMessage());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:PluginProjectWizardTest.java


注:本文中的com.intellij.openapi.module.JavaModuleType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。