mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
memory leak fixed
This commit is contained in:
@@ -22,6 +22,7 @@ import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.ide.wizard.AbstractWizard;
|
||||
import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -50,12 +51,12 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
|
||||
public AbstractProjectWizard(String title, Project project, String defaultPath) {
|
||||
super(title, project);
|
||||
myWizardContext = initContext(project, defaultPath);
|
||||
myWizardContext = initContext(project, defaultPath, getDisposable());
|
||||
}
|
||||
|
||||
public AbstractProjectWizard(String title, Project project, Component dialogParent) {
|
||||
super(title, dialogParent);
|
||||
myWizardContext = initContext(project, null);
|
||||
myWizardContext = initContext(project, null, getDisposable());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,8 +69,8 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
|
||||
public abstract StepSequence getSequence();
|
||||
|
||||
private static WizardContext initContext(@Nullable Project project, @Nullable String defaultPath) {
|
||||
WizardContext context = new WizardContext(project);
|
||||
private static WizardContext initContext(@Nullable Project project, @Nullable String defaultPath, Disposable parentDisposable) {
|
||||
WizardContext context = new WizardContext(project, parentDisposable);
|
||||
if (defaultPath != null) {
|
||||
context.setProjectFileDirectory(defaultPath);
|
||||
context.setProjectName(defaultPath.substring(FileUtil.toSystemIndependentName(defaultPath).lastIndexOf("/") + 1));
|
||||
|
||||
@@ -53,7 +53,7 @@ class ManageProjectTemplatesDialog extends DialogWrapper {
|
||||
super(false);
|
||||
setTitle("Manage Project Templates");
|
||||
final ProjectTemplate[] templates =
|
||||
new ArchivedTemplatesFactory().createTemplates(ProjectTemplatesFactory.CUSTOM_GROUP, new WizardContext(null));
|
||||
new ArchivedTemplatesFactory().createTemplates(ProjectTemplatesFactory.CUSTOM_GROUP, new WizardContext(null, getDisposable()));
|
||||
myTemplatesList = new JBList(new CollectionListModel<ProjectTemplate>(Arrays.asList(templates)) {
|
||||
@Override
|
||||
public void remove(int index) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ide.util.projectWizard;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.RecentProjectsManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -40,6 +41,7 @@ public class WizardContext extends UserDataHolderBase {
|
||||
*/
|
||||
@Nullable
|
||||
private final Project myProject;
|
||||
private final Disposable myDisposable;
|
||||
private String myProjectFileDirectory;
|
||||
private String myProjectName;
|
||||
private String myCompilerOutputDirectory;
|
||||
@@ -71,18 +73,31 @@ public class WizardContext extends UserDataHolderBase {
|
||||
myModulesProvider = modulesProvider;
|
||||
}
|
||||
|
||||
public Disposable getDisposable() {
|
||||
return myDisposable;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void buttonsUpdateRequested();
|
||||
void nextStepRequested();
|
||||
}
|
||||
|
||||
public WizardContext(@Nullable Project project) {
|
||||
public WizardContext(@Nullable Project project, Disposable parentDisposable) {
|
||||
myProject = project;
|
||||
myDisposable = parentDisposable;
|
||||
if (myProject != null){
|
||||
myProjectJdk = ProjectRootManager.getInstance(myProject).getProjectSdk();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link #WizardContext(Project, Disposable)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public WizardContext(@Nullable Project project) {
|
||||
this(project, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
|
||||
Reference in New Issue
Block a user