TextFieldWithHistoryWithBrowseButton#setTextAndAddToHistory method added to simplify...
[idea/community.git] / platform / platform-api / src / com / intellij / ui / TextFieldWithHistoryWithBrowseButton.java
index 72f378172589aac14af94d8adc3d0e3352d6c2a0..7cb8f8c7e70239dc9b22338e31087c53b5c60ab5 100644 (file)
@@ -20,16 +20,13 @@ import com.intellij.openapi.fileChooser.FileChooserFactory;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.ComponentWithBrowseButton;
 import com.intellij.openapi.ui.TextComponentAccessor;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import javax.swing.*;
-
 /**
  * User: anna
  */
 public class TextFieldWithHistoryWithBrowseButton extends ComponentWithBrowseButton<TextFieldWithHistory> {
-  private String myText;
-
   public TextFieldWithHistoryWithBrowseButton() {
     super(new TextFieldWithHistory(), null);
   }
@@ -59,9 +56,11 @@ public class TextFieldWithHistoryWithBrowseButton extends ComponentWithBrowseBut
     return getChildComponent().getText();
   }
 
-  public void setText(String text) {
-    final ComboBoxModel model = getChildComponent().getModel();
-    model.setSelectedItem(text);
-    myText = text;
+  public void setText(@NotNull String text) {
+    getChildComponent().setText(text);
+  }
+
+  public void setTextAndAddToHistory(@NotNull String text) {
+    getChildComponent().setTextAndAddToHistory(text);
   }
 }