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


Java ModuleBuilder类代码示例

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


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

示例1: createModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
private static Module createModule(
        ProjectDescriptor projectDescriptor,
        final ModuleDescriptor descriptor,
        final Map<LibraryDescriptor, Library> projectLibs,
        final ModifiableModuleModel moduleModel) {

    logger.info("Starting createModule in ProjectFromSourcesBuilderImplModified");
    final String moduleFilePath = descriptor.computeModuleFilePath();
    ModuleBuilder.deleteModuleFile(moduleFilePath);

    final Module module =
            moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId());
    final ModifiableRootModel modifiableModel =
            ModuleRootManager.getInstance(module).getModifiableModel();
    setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs);
    descriptor.updateModuleConfiguration(module, modifiableModel);
    modifiableModel.commit();
    logger.info("ending createModule in ProjectFromSourcesBuilderImplModified");
    return module;
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:21,代码来源:ProjectFromSourcesBuilderImplModified.java

示例2: FrameworkBasedOptionsStep

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
public FrameworkBasedOptionsStep(T provider, final B builder, WizardContext context) {
  myContext = context;
  LibrariesContainer container = LibrariesContainerFactory.createContainer(myContext.getProject());
  myBuilder = builder;
  myFrameworkSupportModel = new FrameworkSupportModelBase(context.getProject(), myBuilder, container) {
    @NotNull
    @Override
    public String getBaseDirectoryForLibrariesPath() {
      return StringUtil.notNullize(builder.getContentEntryPath());
    }
  };
  //noinspection AbstractMethodCallInConstructor
  myConfigurable = createConfigurable(provider, myFrameworkSupportModel);
  myFrameworkSupportModel.selectFramework(provider, true);

  builder.addModuleConfigurationUpdater(new ModuleBuilder.ModuleConfigurationUpdater() {
    @Override
    public void update(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
      myConfigurable.addSupport(module, rootModel, null);
    }
  });

  myPanel = new JPanel(new BorderLayout(0, 4));
  myPanel.add(myConfigurable.getComponent(), BorderLayout.CENTER);
  updateDataModel();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FrameworkBasedOptionsStep.java

示例3: createModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
private Module createModule(final ModuleBuilder builder) {
  final Exception[] ex = new Exception[]{null};
  final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
    @Override
    @SuppressWarnings({"ConstantConditions"})
    public Module compute() {
      try {
        return builder.createModule(myModuleModel);
      }
      catch (Exception e) {
        ex[0] = e;
        return null;
      }
    }
  });
  if (ex[0] != null) {
    Messages.showErrorDialog(ProjectBundle.message("module.add.error.message", ex[0].getMessage()),
                             ProjectBundle.message("module.add.error.title"));
  }
  return module;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ModulesConfigurator.java

示例4: createModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@RequiredDispatchThread
private Module createModule(final ModuleBuilder builder) {
  final Exception[] ex = new Exception[]{null};
  final Module module = ApplicationManager.getApplication().runWriteAction(new Computable<Module>() {
    @Override
    @SuppressWarnings({"ConstantConditions"})
    public Module compute() {
      try {
        return builder.createModule(myModuleModel);
      }
      catch (Exception e) {
        ex[0] = e;
        return null;
      }
    }
  });
  if (ex[0] != null) {
    Messages.showErrorDialog(ProjectBundle.message("module.add.error.message", ex[0].getMessage()), ProjectBundle.message("module.add.error.title"));
  }
  return module;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ModulesConfigurator.java

示例5: addModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@Nullable
@RequiredDispatchThread
public Module addModule(final ModuleBuilder moduleBuilder) {
  final Module module = createModule(moduleBuilder);
  if (module != null) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        getOrCreateModuleEditor(module);
        Collections.sort(myModuleEditors, myModuleEditorComparator);
      }
    });
    processModuleCountChanged();
  }
  return module;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ModulesConfigurator.java

示例6: createModuleFromWizard

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@Nullable
public Module createModuleFromWizard(Project project, @Nullable Object dataFromContext, AbstractProjectWizard wizard) {
  final ProjectBuilder builder = wizard.getProjectBuilder();
  if (builder instanceof ModuleBuilder) {
    final ModuleBuilder moduleBuilder = (ModuleBuilder)builder;
    if (moduleBuilder.getName() == null) {
      moduleBuilder.setName(wizard.getProjectName());
    }
    if (moduleBuilder.getModuleFilePath() == null) {
      moduleBuilder.setModuleFilePath(wizard.getModuleFilePath());
    }
  }
  if (!builder.validate(project, project)) {
    return null;
  }
  Module module;
  if (builder instanceof ModuleBuilder) {
    module = ((ModuleBuilder) builder).commitModule(project, null);
    if (module != null) {
      processCreatedModule(module, dataFromContext);
    }
    return module;
  }
  else {
    List<Module> modules = builder.commit(project, null, new DefaultModulesProvider(project));
    if (builder.isOpenProjectSettingsAfter()) {
      ModulesConfigurator.showDialog(project, null, null);
    }
    module = modules == null || modules.isEmpty() ? null : modules.get(0);
  }
  project.save();
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:NewModuleAction.java

示例7: createModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
private Module createModule(final ModuleBuilder builder) {
  try {
    return ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Module, Exception>() {
      @Override
      public Module compute() throws Exception {
        return builder.createModule(myModuleModel);
      }
    });
  }
  catch (Exception e) {
    Messages.showErrorDialog(ProjectBundle.message("module.add.error.message", e.getMessage()),
                             ProjectBundle.message("module.add.error.title"));
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ModulesConfigurator.java

示例8: addModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@Nullable
public Module addModule(final ModuleBuilder moduleBuilder) {
  final Module module = createModule(moduleBuilder);
  if (module != null) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        getOrCreateModuleEditor(module);
      }
    });
    processModuleCountChanged();
  }
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ModulesConfigurator.java

示例9: getProviders

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
public static List<FrameworkSupportInModuleProvider> getProviders(@NotNull ModuleBuilder builder) {
  List<FrameworkSupportInModuleProvider> result = new ArrayList<FrameworkSupportInModuleProvider>();
  for (FrameworkSupportInModuleProvider type : getAllProviders()) {
    if (type.isEnabledForModuleBuilder(builder)) {
      result.add(type);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FrameworkSupportUtil.java

示例10: TemplatesGroup

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
public TemplatesGroup(String name, String description, Icon icon, int weight, String parentGroup, String id, ModuleBuilder moduleBuilder) {
  myName = name;
  myDescription = description;
  myIcon = icon;
  myWeight = weight;
  myParentGroup = parentGroup;
  myId = id;
  myModuleBuilder = moduleBuilder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TemplatesGroup.java

示例11: SupportForFrameworksStep

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
public SupportForFrameworksStep(WizardContext context, final ModuleBuilder builder,
                                @NotNull LibrariesContainer librariesContainer) {
  myContext = context;
  myBuilder = builder;
  List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(builder);
  myFrameworkSupportModel = new FrameworkSupportModelInWizard(librariesContainer, builder);
  mySupportForFrameworksPanel = new AddSupportForFrameworksPanel(providers, myFrameworkSupportModel, false, null);
  myConfigurationUpdater = new ModuleBuilder.ModuleConfigurationUpdater() {
    public void update(@NotNull final Module module, @NotNull final ModifiableRootModel rootModel) {
      mySupportForFrameworksPanel.addSupport(module, rootModel);
    }
  };
  builder.addModuleConfigurationUpdater(myConfigurationUpdater);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:SupportForFrameworksStep.java

示例12: updateStep

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@Override
public void updateStep() {
  ProjectBuilder builder = myContext.getProjectBuilder();
  if (builder instanceof ModuleBuilder) {
    myBuilder.updateFrom((ModuleBuilder)builder);
    ((ModuleBuilder)builder).addModuleConfigurationUpdater(myConfigurationUpdater);
  }
  myFrameworkSupportModel.fireWizardStepUpdated();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SupportForFrameworksStep.java

示例13: createModule

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
@NotNull
private static Module createModule(ProjectDescriptor projectDescriptor, final ModuleDescriptor descriptor,
                                   final Map<LibraryDescriptor, Library> projectLibs, final ModifiableModuleModel moduleModel)
  throws InvalidDataException, IOException, ModuleWithNameAlreadyExists, JDOMException, ConfigurationException {

  final String moduleFilePath = descriptor.computeModuleFilePath();
  ModuleBuilder.deleteModuleFile(moduleFilePath);

  final Module module = moduleModel.newModule(moduleFilePath, descriptor.getModuleType().getId());
  final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
  setupRootModel(projectDescriptor, descriptor, modifiableModel, projectLibs);
  descriptor.updateModuleConfiguration(module, modifiableModel);
  modifiableModel.commit();
  return module;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ProjectFromSourcesBuilderImpl.java

示例14: preselectTargetAndBuildApi

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
private void preselectTargetAndBuildApi() {
  // In IntelliJ user chooses SDK entry, which also contains api level, in the first step,
  // so we preselect "compile with" and "target api" options.
  // This code shouldn't be executed in Android Studio: myWizardContext should be null.
  if (myWizardContext != null) {
    final ProjectBuilder builder = myWizardContext.getProjectBuilder();

    if (builder instanceof ModuleBuilder) {
      Sdk sdk = ((ModuleBuilder)builder).getModuleJdk();

      if (sdk == null) {
        sdk = myWizardContext.getProjectJdk();
      }
      if (sdk != null && sdk.getSdkType() instanceof AndroidSdkType) {
        final AndroidPlatform platform = AndroidPlatform.getInstance(sdk);

        if (platform != null) {
          AndroidVersion version = platform.getTarget().getVersion();
          final int apiLevel = version.getFeatureLevel();
          myTemplateState.put(ATTR_TARGET_API, apiLevel);
          myTemplateState.put(ATTR_TARGET_API_STRING, version.getApiString());
          myTemplateState.put(ATTR_BUILD_API, apiLevel);
          myTemplateState.put(ATTR_BUILD_API_STRING, TemplateMetadata.getBuildApiString(version));
          myCompileWith.setEnabled(false);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ConfigureAndroidModuleStep.java

示例15: GradleFrameworksWizardStep

import com.intellij.ide.util.projectWizard.ModuleBuilder; //导入依赖的package包/类
public GradleFrameworksWizardStep(WizardContext context, final GradleModuleBuilder builder) {

    Project project = context.getProject();
    final LibrariesContainer container = LibrariesContainerFactory.createContainer(context.getProject());
    FrameworkSupportModelBase model = new FrameworkSupportModelBase(project, null, container) {
      @NotNull
      @Override
      public String getBaseDirectoryForLibrariesPath() {
        return StringUtil.notNullize(builder.getContentEntryPath());
      }
    };

    myFrameworksPanel =
      new AddSupportForFrameworksPanel(Collections.<FrameworkSupportInModuleProvider>emptyList(), model, true, null);

    List<FrameworkSupportInModuleProvider> providers = ContainerUtil.newArrayList();
    Collections.addAll(providers, GradleFrameworkSupportProvider.EP_NAME.getExtensions());

    myFrameworksPanel.setProviders(providers, Collections.<String>emptySet(), Collections.singleton(GradleJavaFrameworkSupportProvider.ID));
    Disposer.register(this, myFrameworksPanel);
    myFrameworksPanelPlaceholder.add(myFrameworksPanel.getMainPanel());

    ModuleBuilder.ModuleConfigurationUpdater configurationUpdater = new ModuleBuilder.ModuleConfigurationUpdater() {
      @Override
      public void update(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
        myFrameworksPanel.addSupport(module, rootModel);
      }
    };
    builder.addModuleConfigurationUpdater(configurationUpdater);

    ((CardLayout)myOptionsPanel.getLayout()).show(myOptionsPanel, "frameworks card");
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:GradleFrameworksWizardStep.java


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