update copyright
[fedora-idea.git] / java / idea-ui / src / com / intellij / ide / util / projectWizard / ProjectOutputPathsStep.java
blobe5426fe4492f29ba4e72596d28916a5593cfddbd
1 /*
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.
17 package com.intellij.ide.util.projectWizard;
19 import com.intellij.ide.IdeBundle;
20 import com.intellij.openapi.util.IconLoader;
21 import com.intellij.openapi.util.text.StringUtil;
22 import org.jetbrains.annotations.NonNls;
24 import javax.swing.*;
25 import java.awt.*;
26 import java.io.File;
28 /**
29 * @author Eugene Zhuravlev
30 * Date: Jan 22, 2004
32 public class ProjectOutputPathsStep extends ModuleWizardStep{
33 private static final Icon NEW_PROJECT_ICON = IconLoader.getIcon("/newprojectwizard.png");
34 private final JPanel myPanel;
35 private final NamePathComponent myNamePathComponent;
36 private final WizardContext myWizardContext;
38 public ProjectOutputPathsStep(WizardContext wizardContext) {
39 myWizardContext = wizardContext;
40 myNamePathComponent = new NamePathComponent("", IdeBundle.message("label.select.compiler.output.path"), IdeBundle.message("title.select.compiler.output.path"), "", false);
41 myNamePathComponent.setNameComponentVisible(false);
42 myPanel = new JPanel(new GridBagLayout());
43 myPanel.setBorder(BorderFactory.createEtchedBorder());
44 myPanel.add(myNamePathComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 6, 0, 6), 0, 0));
47 public JComponent getComponent() {
48 return myPanel;
51 public void updateDataModel() {
52 myWizardContext.setCompilerOutputDirectory(myNamePathComponent.getPath());
55 public void updateStep() {
56 if (!myNamePathComponent.isPathChangedByUser()) {
57 final String projectFilePath = myWizardContext.getProjectFileDirectory();
58 if (projectFilePath != null) {
59 @NonNls String path = myWizardContext.getCompilerOutputDirectory();
60 if (path == null) {
61 path = StringUtil.endsWithChar(projectFilePath, '/') ? projectFilePath + "classes" : projectFilePath + "/classes";
63 myNamePathComponent.setPath(path.replace('/', File.separatorChar));
64 myNamePathComponent.getPathComponent().selectAll();
69 public JComponent getPreferredFocusedComponent() {
70 return myNamePathComponent.getPathComponent();
73 public boolean isStepVisible() {
74 return myWizardContext.getProjectFileDirectory() != null;
77 public Icon getIcon() {
78 return NEW_PROJECT_ICON;
81 public String getHelpId() {
82 return null;
85 public String getCompileOutputPath() {
86 return myNamePathComponent.getPath();