combobox with browse button with path completion; recent manager to be used (IDEA...
[idea/community.git] / platform / platform-api / src / com / intellij / ui / TextFieldWithHistoryWithBrowseButton.java
1 /*
2  * Copyright 2000-2012 JetBrains s.r.o.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package com.intellij.ui;
17
18 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
19 import com.intellij.openapi.fileChooser.FileChooserFactory;
20 import com.intellij.openapi.project.Project;
21 import com.intellij.openapi.ui.ComponentWithBrowseButton;
22 import com.intellij.openapi.ui.TextComponentAccessor;
23 import org.jetbrains.annotations.Nullable;
24
25 /**
26  * User: anna
27  */
28 public class TextFieldWithHistoryWithBrowseButton extends ComponentWithBrowseButton<TextFieldWithHistory> {
29   public TextFieldWithHistoryWithBrowseButton() {
30     super(new TextFieldWithHistory(), null);
31   }
32
33   @Override
34   public void addBrowseFolderListener(@Nullable String title,
35                                       @Nullable String description,
36                                       @Nullable Project project,
37                                       FileChooserDescriptor fileChooserDescriptor,
38                                       TextComponentAccessor<TextFieldWithHistory> accessor) {
39     super.addBrowseFolderListener(title, description, project, fileChooserDescriptor, accessor);
40     FileChooserFactory.getInstance().installFileCompletion(getChildComponent().getTextEditor(), fileChooserDescriptor, false, project);
41   }
42
43   @Override
44   public void addBrowseFolderListener(@Nullable String title,
45                                       @Nullable String description,
46                                       @Nullable Project project,
47                                       FileChooserDescriptor fileChooserDescriptor,
48                                       TextComponentAccessor<TextFieldWithHistory> accessor,
49                                       boolean autoRemoveOnHide) {
50     super.addBrowseFolderListener(title, description, project, fileChooserDescriptor, accessor, autoRemoveOnHide);
51     FileChooserFactory.getInstance().installFileCompletion(getChildComponent().getTextEditor(), fileChooserDescriptor, false, project);
52   }
53 }