always use getIcon instead of findIcon
[fedora-idea.git] / platform / platform-api / src / com / intellij / ui / RawCommandLineEditor.java
blob293af243f24c6e8c903df4482ba77c591a78be27
1 /*
2 * Copyright 2000-2007 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.ui;
18 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
19 import com.intellij.openapi.ui.Messages;
20 import com.intellij.openapi.ui.TextFieldWithBrowseButton;
21 import com.intellij.openapi.util.IconLoader;
23 import javax.swing.*;
24 import javax.swing.text.Document;
25 import java.awt.*;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
29 public class RawCommandLineEditor extends JPanel {
30 private final TextFieldWithBrowseButton myTextField;
31 private String myDialogCaption = "";
33 public RawCommandLineEditor() {
34 super(new BorderLayout());
35 myTextField = new TextFieldWithBrowseButton(new ActionListener() {
36 public void actionPerformed(ActionEvent e) {
37 Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow");
39 });
40 myTextField.setButtonIcon(IconLoader.getIcon("/actions/showViewer.png"));
41 add(myTextField, BorderLayout.CENTER);
42 setDescriptor(null);
45 public void setDescriptor(FileChooserDescriptor descriptor) {
46 InsertPathAction.addTo(myTextField.getTextField(), descriptor);
49 public String getDialogCaption() {
50 return myDialogCaption;
53 public void setDialogCaption(String dialogCaption) {
54 myDialogCaption = dialogCaption != null ? dialogCaption : "";
57 public void setText(String text) {
58 myTextField.setText(text);
61 public String getText() {
62 return myTextField.getText();
65 public JTextField getTextField() {
66 return myTextField.getTextField();
69 public Document getDocument() {
70 return myTextField.getTextField().getDocument();
73 public void attachLabel(JLabel label) {
74 label.setLabelFor(myTextField.getTextField());
77 public void setEnabled(boolean enabled) {
78 super.setEnabled(enabled);
79 myTextField.setEnabled(enabled);