本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
}
}
}
}
示例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");
}