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
.ui
;
19 import com
.intellij
.openapi
.project
.Project
;
20 import com
.intellij
.openapi
.ui
.DialogWrapper
;
21 import com
.intellij
.find
.FindManager
;
22 import com
.intellij
.openapi
.ui
.Messages
;
25 import java
.awt
.event
.ActionEvent
;
27 public class ReplacePromptDialog
extends DialogWrapper
{
29 private final boolean myIsMultiple
;
31 public ReplacePromptDialog(boolean isMultipleFiles
, String title
, Project project
) {
33 myIsMultiple
= isMultipleFiles
;
34 setButtonsAlignment(SwingUtilities
.CENTER
);
39 protected Action
[] createActions(){
40 DoAction replaceAction
= new DoAction(UIBundle
.message("replace.prompt.replace.button"), FindManager
.PromptResult
.OK
);
41 replaceAction
.putValue(DEFAULT_ACTION
,Boolean
.TRUE
);
45 new DoAction(UIBundle
.message("replace.prompt.skip.button"), FindManager
.PromptResult
.SKIP
),
46 new DoAction(UIBundle
.message("replace.prompt.all.in.this.file.button"), FindManager
.PromptResult
.ALL_IN_THIS_FILE
),
47 new DoAction(UIBundle
.message("replace.prompt.all.files.action"), FindManager
.PromptResult
.ALL_FILES
),
53 new DoAction(UIBundle
.message("replace.prompt.skip.button"), FindManager
.PromptResult
.SKIP
),
54 new DoAction(UIBundle
.message("replace.prompt.all.button"), FindManager
.PromptResult
.ALL
),
60 public JComponent
createNorthPanel() {
61 JPanel panel
= new JPanel(new BorderLayout());
62 panel
.setBorder(BorderFactory
.createEmptyBorder(5, 10, 5, 10));
63 Icon icon
= Messages
.getQuestionIcon();
65 JLabel iconLabel
= new JLabel(icon
);
66 panel
.add(iconLabel
, BorderLayout
.WEST
);
68 JLabel label
= new JLabel(UIBundle
.message("replace.propmt.replace.occurrence.label"));
69 label
.setBorder(BorderFactory
.createEmptyBorder(0, 20, 0, 10));
70 label
.setForeground(Color
.black
);
71 panel
.add(label
, BorderLayout
.CENTER
);
75 public JComponent
createCenterPanel() {
79 private class DoAction
extends AbstractAction
{
80 private final int myExitCode
;
82 public DoAction(String name
,int exitCode
) {
83 putValue(Action
.NAME
, name
);
84 myExitCode
= exitCode
;
87 public void actionPerformed(ActionEvent e
) {