1 package com
.intellij
.execution
.configuration
;
3 import com
.intellij
.openapi
.project
.Project
;
4 import com
.intellij
.openapi
.ui
.TextFieldWithBrowseButton
;
5 import org
.jetbrains
.annotations
.Nullable
;
7 import java
.awt
.event
.ActionEvent
;
8 import java
.awt
.event
.ActionListener
;
10 public abstract class BrowseModuleValueActionListener
implements ActionListener
{
11 private TextFieldWithBrowseButton myField
;
12 private final Project myProject
;
14 protected BrowseModuleValueActionListener(final Project project
) {
18 public void setField(final TextFieldWithBrowseButton field
) {
20 myField
.addActionListener(this);
21 myField
.setButtonEnabled(!myProject
.isDefault());
24 public void actionPerformed(final ActionEvent e
) {
25 final String text
= showDialog();
26 if (text
!= null) myField
.getTextField().setText(text
);
29 public String
getText() {
30 return myField
.getText();
33 public TextFieldWithBrowseButton
getField() { return myField
; }
36 protected abstract String
showDialog();
38 public Project
getProject() { return myProject
; }
40 public void detach() {
41 if (myField
!= null) {
42 myField
.removeActionListener(this);