git4idea: IDEA-22561: renamed OK buttons to appropriate names in dialogs
[fedora-idea.git] / plugins / git4idea / src / git4idea / rebase / GitRebaseActionDialog.java
blob7d8d8b85756921a3724355b266e65a7352e9be60
1 /*
2 * Copyright 2000-2008 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 git4idea.rebase;
18 import com.intellij.openapi.project.Project;
19 import com.intellij.openapi.ui.DialogWrapper;
20 import com.intellij.openapi.vfs.VirtualFile;
21 import git4idea.ui.GitUIUtil;
22 import org.jetbrains.annotations.Nullable;
24 import javax.swing.*;
25 import java.util.List;
27 /**
28 * The rebase action dialog
30 public class GitRebaseActionDialog extends DialogWrapper {
31 /**
32 * The root selector
34 private JComboBox myGitRootComboBox;
35 /**
36 * The root panel
38 private JPanel myPanel;
40 /**
41 * A constructor
43 * @param project the project to select
44 * @param title the dialog title
45 * @param roots the git repository roots for the project
46 * @param defaultRoot the guessed default root
48 public GitRebaseActionDialog(Project project, String title, List<VirtualFile> roots, VirtualFile defaultRoot) {
49 super(project, true);
50 GitUIUtil.setupRootChooser(project, roots, defaultRoot, myGitRootComboBox, null);
51 setTitle(title);
52 setOKButtonText(title);
53 init();
57 /**
58 * Show dialog and select root
60 * @return selected root or null if the dialog has been cancelled
62 @Nullable
63 public VirtualFile selectRoot() {
64 show();
65 return isOK() ? (VirtualFile)myGitRootComboBox.getSelectedItem() : null;
69 /**
70 * {@inheritDoc}
72 protected JComponent createCenterPanel() {
73 return myPanel;