2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.ide
.util
.projectWizard
;
18 import com
.intellij
.openapi
.ui
.MultiLineLabelUI
;
19 import com
.intellij
.openapi
.util
.IconLoader
;
20 import com
.intellij
.openapi
.application
.ApplicationNamesInfo
;
21 import com
.intellij
.ide
.IdeBundle
;
25 import java
.awt
.event
.ItemListener
;
28 * @author Eugene Zhuravlev
31 public class ModuleCreationPromptStep
extends ModuleWizardStep
{
32 private static final Icon NEW_PROJECT_ICON
= IconLoader
.getIcon("/newprojectwizard.png");
33 private final JPanel myPanel
;
34 private final JRadioButton myRbCreateSingle
;
35 private final JRadioButton myRbCreateMultiple
;
37 public ModuleCreationPromptStep() {
38 myPanel
= new JPanel(new GridBagLayout());
39 myPanel
.setBorder(BorderFactory
.createEtchedBorder());
40 final String promptText
=
41 IdeBundle
.message("prompt.single.or.multi.module.project", ApplicationNamesInfo
.getInstance().getProductName());
42 final JLabel promptLabel
= new JLabel(promptText
);
43 promptLabel
.setUI(new MultiLineLabelUI());
44 myPanel
.add(promptLabel
, new GridBagConstraints(0, GridBagConstraints
.RELATIVE
, 1, 1, 1.0, 0.0, GridBagConstraints
.NORTHWEST
, GridBagConstraints
.HORIZONTAL
, new Insets(8, 10, 8, 10), 0, 0));
46 myRbCreateSingle
= new JRadioButton(IdeBundle
.message("radio.create.&single.module.project"), true);
47 myRbCreateMultiple
= new JRadioButton(IdeBundle
.message("radio.create.configure.&multi.module.project"));
48 myPanel
.add(myRbCreateSingle
, new GridBagConstraints(0, GridBagConstraints
.RELATIVE
, 1, 1, 1.0, 0.0, GridBagConstraints
.NORTHWEST
, GridBagConstraints
.NONE
, new Insets(8, 6, 0, 6), 0, 0));
49 myPanel
.add(myRbCreateMultiple
, new GridBagConstraints(0, GridBagConstraints
.RELATIVE
, 1, 1, 1.0, 1.0, GridBagConstraints
.NORTHWEST
, GridBagConstraints
.NONE
, new Insets(5, 6, 0, 6), 0, 0));
51 ButtonGroup group
= new ButtonGroup();
52 group
.add(myRbCreateSingle
);
53 group
.add(myRbCreateMultiple
);
57 public JComponent
getPreferredFocusedComponent() {
58 return myRbCreateSingle
;
61 public String
getHelpId() {
62 return "project.new.page3";
65 public JComponent
getComponent() {
69 public void updateDataModel() {
72 public Icon
getIcon() {
73 return NEW_PROJECT_ICON
;
76 public boolean isCreateModule() {
77 return myRbCreateSingle
.isSelected();
80 public void addCreateModuleChoiceListener(ItemListener listener
) {
81 myRbCreateSingle
.addItemListener(listener
);