3 * Copyright 2000-2009 JetBrains s.r.o.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package com
.intellij
.refactoring
.ui
;
20 import java
.awt
.event
.ActionEvent
;
21 import java
.awt
.event
.ActionListener
;
24 import com
.intellij
.openapi
.ui
.DialogWrapper
;
25 import com
.intellij
.openapi
.project
.Project
;
26 import com
.intellij
.util
.ui
.UIUtil
;
27 import com
.intellij
.refactoring
.RefactoringBundle
;
29 public class InfoDialog
extends DialogWrapper
{
30 private JCheckBox myShowInFutureCheckBox
;
31 private JTextArea myTextArea
;
32 private final String myText
;
33 private boolean isToShowInFuture
;
35 public InfoDialog(String text
, Project project
) {
36 super(project
, false);
38 setButtonsAlignment(SwingUtilities
.CENTER
);
39 setTitle(RefactoringBundle
.message("information.title"));
40 setButtonsMargin(null);
42 setOKButtonText(RefactoringBundle
.message("ok.button"));
45 protected Action
[] createActions(){
46 return new Action
[]{getOKAction()};
49 protected JComponent
createCenterPanel() {
50 JPanel panel
= new JPanel();
51 panel
.setBorder(BorderFactory
.createEtchedBorder());
52 panel
.setLayout(new BorderLayout());
54 JPanel cbPanel
= new JPanel(new BorderLayout());
55 cbPanel
.setBorder(BorderFactory
.createEmptyBorder(5, 10, 10, 10));
56 myShowInFutureCheckBox
= new JCheckBox();
57 myShowInFutureCheckBox
.setText(RefactoringBundle
.message("do.not.show.this.message.in.the.future"));
58 panel
.add(cbPanel
, BorderLayout
.SOUTH
);
59 cbPanel
.add(myShowInFutureCheckBox
, BorderLayout
.WEST
);
61 JPanel textPanel
= new JPanel(new BorderLayout());
62 textPanel
.setBorder(BorderFactory
.createEmptyBorder(10, 10, 0, 10));
63 panel
.add(textPanel
, BorderLayout
.CENTER
);
65 myTextArea
= new JTextArea(myText
);
66 textPanel
.add(myTextArea
, BorderLayout
.CENTER
);
67 myTextArea
.setEditable(false);
68 myTextArea
.setBackground(UIUtil
.getPanelBackgound());
69 Font font
= myShowInFutureCheckBox
.getFont();
70 font
= new Font(font
.getName(), font
.getStyle(), font
.getSize() + 1);
71 myTextArea
.setFont(font
);
72 myShowInFutureCheckBox
.setFont(font
);
73 isToShowInFuture
= true;
74 myShowInFutureCheckBox
.addActionListener(
75 new ActionListener() {
76 public void actionPerformed(ActionEvent event
) {
77 isToShowInFuture
= !myShowInFutureCheckBox
.isSelected();
84 public boolean isToShowInFuture() {
85 return isToShowInFuture
;