fix: do not use GeneratorPeerImpl
This commit is contained in:
parent
ad33ee67b4
commit
bba1874840
1 changed files with 30 additions and 5 deletions
|
@ -16,34 +16,59 @@
|
||||||
|
|
||||||
package com.falsepattern.zigbrains.project.ide.newproject;
|
package com.falsepattern.zigbrains.project.ide.newproject;
|
||||||
|
|
||||||
|
import com.intellij.ide.util.projectWizard.SettingsStep;
|
||||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||||
|
import com.intellij.openapi.ui.ValidationInfo;
|
||||||
import com.intellij.openapi.util.Disposer;
|
import com.intellij.openapi.util.Disposer;
|
||||||
import com.intellij.platform.GeneratorPeerImpl;
|
import com.intellij.platform.ProjectGeneratorPeer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import static com.falsepattern.zigbrains.common.util.dsl.JavaPanel.newPanel;
|
import static com.falsepattern.zigbrains.common.util.dsl.JavaPanel.newPanel;
|
||||||
|
|
||||||
public class ZigProjectGeneratorPeer extends GeneratorPeerImpl<ZigProjectConfigurationData> {
|
public class ZigProjectGeneratorPeer implements ProjectGeneratorPeer<ZigProjectConfigurationData> {
|
||||||
private final ZigNewProjectPanel newProjectPanel;
|
private final ZigNewProjectPanel newProjectPanel;
|
||||||
|
private volatile JComponent myComponent;
|
||||||
|
|
||||||
public ZigProjectGeneratorPeer(boolean handleGit) {
|
public ZigProjectGeneratorPeer(boolean handleGit) {
|
||||||
newProjectPanel = new ZigNewProjectPanel(handleGit);
|
newProjectPanel = new ZigNewProjectPanel(handleGit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull JComponent getComponent(@NotNull TextFieldWithBrowseButton myLocationField, @NotNull Runnable checkValid) {
|
||||||
|
return createComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void buildUI(@NotNull SettingsStep settingsStep) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull ZigProjectConfigurationData getSettings() {
|
public @NotNull ZigProjectConfigurationData getSettings() {
|
||||||
return newProjectPanel.getData();
|
return newProjectPanel.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull JComponent getComponent(@NotNull TextFieldWithBrowseButton myLocationField, @NotNull Runnable checkValid) {
|
public @Nullable ValidationInfo validate() {
|
||||||
return createComponent();
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBackgroundJobRunning() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull JComponent createComponent() {
|
public @NotNull JComponent createComponent() {
|
||||||
return newPanel(newProjectPanel::attachPanelTo);
|
if (myComponent == null) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (myComponent == null) {
|
||||||
|
return myComponent = newPanel(newProjectPanel::attachPanelTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return myComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue