moved plugin-specific project types to the different step

This commit is contained in:
Ekaterina Tuzova
2014-06-18 14:09:14 +04:00
parent cd7200cb60
commit 6cdf7e47e4
6 changed files with 62 additions and 7 deletions
@@ -53,7 +53,7 @@ public class PyCharmNewProjectDialog extends DialogWrapper {
@Override
public Dimension getMinimumSize() {
return new Dimension(800, 500);
return new Dimension(650, 350);
}
};
}
@@ -24,6 +24,7 @@ import com.intellij.platform.DirectoryProjectGenerator;
import com.intellij.platform.WebProjectGenerator;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.JBColor;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.NullableConsumer;
import com.intellij.util.ui.CenteredIcon;
import com.jetbrains.python.PythonSdkChooserCombo;
@@ -103,14 +104,20 @@ abstract public class AbstractProjectSettingsStep extends AbstractActionWithPane
@Override
public JPanel createPanel() {
final JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width, 450));
final JPanel scrollPanel = new JPanel(new BorderLayout());
mainPanel.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width, 300));
final JPanel panel = createBasePanel();
mainPanel.add(panel, BorderLayout.NORTH);
scrollPanel.add(panel, BorderLayout.NORTH);
final JPanel advancedSettings = createAdvancedSettings();
if (advancedSettings != null)
mainPanel.add(advancedSettings, BorderLayout.CENTER);
if (advancedSettings != null) {
scrollPanel.add(advancedSettings, BorderLayout.CENTER);
}
final JBScrollPane scrollPane = new JBScrollPane(scrollPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setBorder(null);
mainPanel.add(scrollPane, BorderLayout.CENTER);
final JPanel bottomPanel = new JPanel(new BorderLayout());
myCreateButton = new Button(myCreateAction, myCreateAction.getTemplatePresentation());
@@ -0,0 +1,37 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jetbrains.python.newProject.actions;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.project.DumbAware;
import com.intellij.platform.DirectoryProjectGenerator;
import com.intellij.util.NullableConsumer;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class PluginSpecificProjectsStep extends DefaultActionGroup implements DumbAware {
public PluginSpecificProjectsStep(@NotNull final NullableConsumer<AbstractProjectSettingsStep> callback,
@NotNull final List<DirectoryProjectGenerator> projectGenerators) {
super("Plugin-specific", true);
getTemplatePresentation().setIcon(AllIcons.Nodes.PluginLogo);
for (DirectoryProjectGenerator generator : projectGenerators) {
add(new ProjectSpecificAction(callback, generator));
}
}
}
@@ -15,6 +15,7 @@
*/
package com.jetbrains.python.newProject.actions;
import com.google.common.collect.Lists;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.util.projectWizard.WebProjectTemplate;
import com.intellij.internal.statistic.UsageTrigger;
@@ -172,8 +173,17 @@ public class PyCharmNewProjectStep extends DefaultActionGroup implements DumbAwa
return o1.getName().compareTo(o2.getName());
}
});
List<DirectoryProjectGenerator> pluginSpecificGenerators = Lists.newArrayList();
for (DirectoryProjectGenerator generator : generators) {
add(new ProjectSpecificAction(callback, generator));
if (generator instanceof PythonProjectGenerator)
add(new ProjectSpecificAction(callback, generator));
else
pluginSpecificGenerators.add(generator);
}
if (!pluginSpecificGenerators.isEmpty()) {
add(new PluginSpecificProjectsStep(callback, pluginSpecificGenerators));
}
}