use of com.intellij.ui.TextFieldWithHistoryWithBrowseButton in project intellij-plugins by JetBrains.
the class KarmaRunConfigurationEditor method createConfigurationFileTextField.
@NotNull
private static TextFieldWithHistoryWithBrowseButton createConfigurationFileTextField(@NotNull final Project project) {
TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton();
final TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent();
textFieldWithHistory.setHistorySize(-1);
textFieldWithHistory.setMinimumAndPreferredWidth(0);
SwingHelper.addHistoryOnExpansion(textFieldWithHistory, () -> {
List<VirtualFile> newFiles = KarmaUtil.listPossibleConfigFilesInProject(project);
List<String> newFilePaths = ContainerUtil.map(newFiles, file -> FileUtil.toSystemDependentName(file.getPath()));
Collections.sort(newFilePaths);
return newFilePaths;
});
SwingHelper.installFileCompletionAndBrowseDialog(project, textFieldWithHistoryWithBrowseButton, KarmaBundle.message("runConfiguration.config_file.browse_dialog.title"), FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
return textFieldWithHistoryWithBrowseButton;
}
use of com.intellij.ui.TextFieldWithHistoryWithBrowseButton in project intellij-plugins by JetBrains.
the class PhoneGapUtil method createPhoneGapExecutableTextField.
@NotNull
public static TextFieldWithHistoryWithBrowseButton createPhoneGapExecutableTextField(@Nullable Project project) {
TextFieldWithHistoryWithBrowseButton field = SwingHelper.createTextFieldWithHistoryWithBrowseButton(project, PhoneGapBundle.message("phonegap.conf.executable.name"), FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), () -> getDefaultExecutablePaths());
String executablePath = PhoneGapSettings.getInstance().getExecutablePath();
setDefaultValue(field, executablePath);
return field;
}
use of com.intellij.ui.TextFieldWithHistoryWithBrowseButton in project intellij-community by JetBrains.
the class CopyFilesOrDirectoriesDialog method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
myInformationLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
final FormBuilder formBuilder = FormBuilder.createFormBuilder().addComponent(myInformationLabel).addVerticalGap(UIUtil.LARGE_VGAP - UIUtil.DEFAULT_VGAP);
DocumentListener documentListener = new DocumentAdapter() {
@Override
public void textChanged(DocumentEvent event) {
validateOKButton();
}
};
if (myShowNewNameField) {
myNewNameField = new JBTextField();
myNewNameField.getDocument().addDocumentListener(documentListener);
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNewNameField);
}
if (myShowDirectoryField) {
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
myTargetDirectoryField.setTextFieldPreferredWidth(MAX_PATH_LENGTH);
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
if (recentEntries != null) {
getTargetDirectoryComponent().setHistory(recentEntries);
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.copied.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
getTargetDirectoryComponent().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateOKButton();
}
});
formBuilder.addLabeledComponent(RefactoringBundle.message("copy.files.to.directory.label"), myTargetDirectoryField);
String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
formBuilder.addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText));
}
final JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(myOpenFilesInEditor, BorderLayout.EAST);
formBuilder.addComponent(wrapper);
return formBuilder.getPanel();
}
use of com.intellij.ui.TextFieldWithHistoryWithBrowseButton in project intellij-community by JetBrains.
the class MoveFilesOrDirectoriesDialog method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
myNameLabel = JBLabelDecorator.createJBLabelDecorator().setBold(true);
myTargetDirectoryField = new TextFieldWithHistoryWithBrowseButton();
final List<String> recentEntries = RecentsManager.getInstance(myProject).getRecentEntries(RECENT_KEYS);
if (recentEntries != null) {
myTargetDirectoryField.getChildComponent().setHistory(recentEntries);
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("the.file.will.be.moved.to.this.directory"), myProject, descriptor, TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
final JTextField textField = myTargetDirectoryField.getChildComponent().getTextEditor();
FileChooserFactory.getInstance().installFileCompletion(textField, descriptor, true, getDisposable());
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
validateOKButton();
}
});
myTargetDirectoryField.setTextFieldPreferredWidth(CopyFilesOrDirectoriesDialog.MAX_PATH_LENGTH);
Disposer.register(getDisposable(), myTargetDirectoryField);
String shortcutText = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_CODE_COMPLETION));
myCbSearchForReferences = new NonFocusableCheckBox(RefactoringBundle.message("search.for.references"));
myCbSearchForReferences.setSelected(RefactoringSettings.getInstance().MOVE_SEARCH_FOR_REFERENCES_FOR_FILE);
myOpenInEditorCb = new NonFocusableCheckBox("Open moved files in editor");
myOpenInEditorCb.setSelected(isOpenInEditor());
return FormBuilder.createFormBuilder().addComponent(myNameLabel).addLabeledComponent(RefactoringBundle.message("move.files.to.directory.label"), myTargetDirectoryField, UIUtil.LARGE_VGAP).addTooltip(RefactoringBundle.message("path.completion.shortcut", shortcutText)).addComponentToRightColumn(myCbSearchForReferences, UIUtil.LARGE_VGAP).addComponentToRightColumn(myOpenInEditorCb, UIUtil.LARGE_VGAP).getPanel();
}
use of com.intellij.ui.TextFieldWithHistoryWithBrowseButton in project intellij-plugins by JetBrains.
the class PhoneGapUtil method createPhoneGapWorkingDirectoryField.
@NotNull
public static TextFieldWithHistoryWithBrowseButton createPhoneGapWorkingDirectoryField(@Nullable final Project project) {
TextFieldWithHistoryWithBrowseButton field = SwingHelper.createTextFieldWithHistoryWithBrowseButton(project, PhoneGapBundle.message("phonegap.conf.work.dir.name"), FileChooserDescriptorFactory.createSingleFolderDescriptor(), () -> getDefaultWorkingDirectory(project));
setDefaultValue(field, PhoneGapSettings.getInstance().getWorkingDirectory(project));
return field;
}
Aggregations