FlexUnit: in RunConfiguration it is impossible to select class or package (IDEADEV...
[fedora-idea.git] / lang-impl / src / com / intellij / execution / configuration / BrowseModuleValueActionListener.java
blobedc6a29fb05c50107cfc5ba8d6caac99668e4d95
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) {
15 myProject = project;
18 public void setField(final TextFieldWithBrowseButton field) {
19 myField = 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; }
35 @Nullable
36 protected abstract String showDialog();
38 public Project getProject() { return myProject; }
40 public void detach() {
41 if (myField != null) {
42 myField.removeActionListener(this);
43 myField = null;