本文整理汇总了Java中com.intellij.ui.TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的典型用法代码示例。如果您正苦于以下问题:Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的具体用法?Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth怎么用?Java TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.TextFieldWithHistoryWithBrowseButton
的用法示例。
在下文中一共展示了TextFieldWithHistoryWithBrowseButton.setTextFieldPreferredWidth方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNorthPanel
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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);
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).getPanel();
}
示例2: createNorthPanel
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}
示例3: createNorthPanel
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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) {
myTargetDirectoryField.getChildComponent().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);
myTargetDirectoryField.getChildComponent().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();
}
示例4: createNorthPanel
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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 JTextField();
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) {
myTargetDirectoryField.getChildComponent().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);
myTargetDirectoryField.getChildComponent().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();
}
示例5: createNorthPanel
import com.intellij.ui.TextFieldWithHistoryWithBrowseButton; //导入方法依赖的package包/类
@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();
}