ComponentWithBrowseButton - optional remove listener on hide
[fedora-idea.git] / platform / vcs-impl / src / com / intellij / openapi / vcs / changes / ui / NewChangelistDialog.java
blob04a0744c05b5695c21887f2a61b60f056ed06218
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.
16 package com.intellij.openapi.vcs.changes.ui;
18 import com.intellij.openapi.project.Project;
19 import com.intellij.openapi.ui.DialogWrapper;
20 import com.intellij.openapi.vcs.VcsBundle;
21 import com.intellij.openapi.vcs.VcsConfiguration;
23 import javax.swing.*;
25 /**
26 * @author max
28 public class NewChangelistDialog extends DialogWrapper {
30 private EditChangelistPanel myPanel;
31 private JPanel myTopPanel;
32 private JLabel myErrorLabel;
33 private final Project myProject;
35 public NewChangelistDialog(Project project) {
36 super(project, true);
37 myProject = project;
38 setTitle(VcsBundle.message("changes.dialog.newchangelist.title"));
40 myPanel.init(project, null);
42 init();
45 @Override
46 protected void doOKAction() {
47 super.doOKAction();
48 VcsConfiguration.getInstance(myProject).MAKE_NEW_CHANGELIST_ACTIVE = isNewChangelistActive();
51 protected JComponent createCenterPanel() {
52 return myTopPanel;
55 public String getName() {
56 return myPanel.getName();
59 public String getDescription() {
60 return myPanel.getDescription();
63 public JComponent getPreferredFocusedComponent() {
64 return myPanel.getPrefferedFocusedComponent();
67 protected String getDimensionServiceKey() {
68 return "VCS.NewChangelistDialog";
71 public boolean isNewChangelistActive() {
72 return myPanel.getMakeActiveCheckBox().isSelected();
75 public EditChangelistPanel getPanel() {
76 return myPanel;
79 private void createUIComponents() {
80 myPanel = new EditChangelistPanel(null) {
81 @Override
82 protected void nameChanged(String errorMessage) {
83 setOKActionEnabled(errorMessage == null);
84 myErrorLabel.setText(errorMessage == null ? " " : errorMessage);
89 @Override
90 protected String getHelpId() {
91 return "new_changelist_dialog";