本文整理汇总了Java中com.intellij.ide.util.projectWizard.WizardContext.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java WizardContext.getProject方法的具体用法?Java WizardContext.getProject怎么用?Java WizardContext.getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.util.projectWizard.WizardContext
的用法示例。
在下文中一共展示了WizardContext.getProject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdditionalSettings
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public JComponent getAdditionalSettings(final WizardContext wizardContext) {
JTextField tfModuleFilePath = new JTextField();
final String productName = ApplicationNamesInfo.getInstance().getProductName();
final String message = IdeBundle.message("prompt.select.module.file.to.import", productName);
final BrowseFilesListener listener = new BrowseFilesListener(tfModuleFilePath, message, null, new ModuleFileChooserDescriptor()) {
@Override
protected VirtualFile getFileToSelect() {
final VirtualFile fileToSelect = super.getFileToSelect();
if (fileToSelect != null) {
return fileToSelect;
}
final Project project = wizardContext.getProject();
return project != null ? project.getBaseDir() : null;
}
};
myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, listener);
onChosen(false);
return myModulePathFieldPanel;
}
示例2: FrameworkBasedOptionsStep
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的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: createTemplates
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
Project project = context.getProject();
if (project != null && !Projects.isGradleProject(project)) {
return EMPTY_PROJECT_TEMPLATES;
}
TemplateManager manager = TemplateManager.getInstance();
List<File> templates = manager.getTemplates(Template.CATEGORY_PROJECTS);
List<ProjectTemplate> tt = new ArrayList<ProjectTemplate>();
for (File template : templates) {
final String templateName = template.getName();
if (NewProjectWizardState.PROJECT_TEMPLATE_NAME.equals(templateName) ||
NewProjectWizardState.IMPORT_EXISTING_PROJECT_TEMPLATE_NAME.equals(templateName) ||
project == null && !NewProjectWizardState.MODULE_TEMPLATE_NAME.equals(templateName)) {
continue;
}
TemplateMetadata metadata = manager.getTemplate(template);
if (metadata == null || !metadata.isSupported()) {
continue;
}
tt.add(new AndroidProjectTemplate(template, metadata, project, context.getDisposable()));
}
return tt.toArray(new ProjectTemplate[tt.size()]);
}
示例4: getMostRecentSuitableSdk
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
@Nullable
public static Sdk getMostRecentSuitableSdk(final WizardContext context) {
if (context.getProject() == null) {
@Nullable final ProjectBuilder projectBuilder = context.getProjectBuilder();
return ProjectJdkTable.getInstance().findMostRecentSdk(new Condition<Sdk>() {
public boolean value(Sdk sdk) {
return projectBuilder == null || projectBuilder.isSuitableSdkType(sdk.getSdkType());
}
});
}
return null;
}
示例5: getProjectSdkByDefault
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public static Sdk getProjectSdkByDefault(WizardContext context) {
final Project project = context.getProject() == null ? ProjectManager.getInstance().getDefaultProject() : context.getProject();
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (projectJdk != null) {
return projectJdk;
}
return null;
}
示例6: getProject
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
/**
* Allows to get {@link Project} instance to use. Basically, there are two alternatives -
* {@link WizardContext#getProject() project from the current wizard context} and
* {@link ProjectManager#getDefaultProject() default project}.
*
* @param wizardContext current wizard context
* @return {@link Project} instance to use
*/
@NotNull
public Project getProject(@NotNull WizardContext wizardContext) {
Project result = wizardContext.getProject();
if (result == null) {
result = ProjectManager.getInstance().getDefaultProject();
}
return result;
}
示例7: GradleModuleWizardStep
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public GradleModuleWizardStep(@NotNull GradleModuleBuilder builder, @NotNull WizardContext context) {
myProjectOrNull = context.getProject();
myBuilder = builder;
myContext = context;
myParentProjectForm = new GradleParentProjectForm(context, new NullableConsumer<ProjectData>() {
@Override
public void consume(@Nullable ProjectData data) {
myParent = data;
updateComponents();
}
});
initComponents();
loadSettings();
}
示例8: GradleFrameworksWizardStep
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的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");
}
示例9: MavenModuleWizardStep
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public MavenModuleWizardStep(MavenModuleBuilder builder, WizardContext context, boolean includeArtifacts) {
myProjectOrNull = context.getProject();
myBuilder = builder;
myContext = context;
if (includeArtifacts) {
myArchetypes = new MavenArchetypesStep(builder, this);
myArchetypesPanel.add(myArchetypes.getMainPanel(), BorderLayout.CENTER);
}
else {
myArchetypes = null;
}
initComponents();
loadSettings();
}
示例10: getCustomOptionsStep
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
@Nullable
@Override
public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
myProject = context.getProject();
return new CloudModuleWizardStep(this, myProject, parentDisposable);
}
示例11: isAvailable
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public boolean isAvailable(WizardContext context) {
return context.getProject() != null;
}
示例12: createTemplates
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
Project project = context.getProject();
if (project != null && Projects.isGradleProject(project)) {
return EMPTY_PROJECT_TEMPLATES;
}
ProjectTemplate[] templates = {
new BuilderBasedTemplate(new AndroidModuleBuilder()),
new AndroidProjectTemplate(EMPTY_MODULE,
"Simple Android module with configured Android SDK and without any pre-defined structure",
new AndroidModuleBuilder(null) {
@Override
public String getBuilderId() {
return "android.empty";
}
@Override
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext,
@NotNull ModulesProvider modulesProvider) {
return ModuleWizardStep.EMPTY_ARRAY;
}
}),
new AndroidProjectTemplate(LIBRARY_MODULE,
"Android library modules hold shared Android source code and resources " +
"that can be referenced by other Android modules",
new AndroidModuleBuilder.Library())
};
if (project == null) {
return templates;
}
else {
AndroidProjectTemplate test = new AndroidProjectTemplate(TEST_MODULE,
"Android test modules contain Android applications that you write using " +
"the <a href='http://developer.android.com/tools/testing/index.html'>" +
"Testing and Instrumentation framework</a>",
new AndroidModuleBuilder.Test());
return ArrayUtil.append(templates, test);
}
}
示例13: GradleModuleImporter
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public GradleModuleImporter(@NotNull WizardContext context) {
this(context.getProject(), true);
}
示例14: GradleParentProjectForm
import com.intellij.ide.util.projectWizard.WizardContext; //导入方法依赖的package包/类
public GradleParentProjectForm(WizardContext context, @Nullable NullableConsumer<ProjectData> consumer) {
myProjectOrNull = context.getProject();
myConsumer = consumer == null ? EmptyConsumer.<ProjectData>getInstance() : consumer;
myIsVisible = !context.isCreatingNewProject() && myProjectOrNull != null && isGradleModuleExist(context);
initComponents();
}