本文整理匯總了Java中com.intellij.openapi.ui.TextFieldWithBrowseButton類的典型用法代碼示例。如果您正苦於以下問題:Java TextFieldWithBrowseButton類的具體用法?Java TextFieldWithBrowseButton怎麽用?Java TextFieldWithBrowseButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TextFieldWithBrowseButton類屬於com.intellij.openapi.ui包,在下文中一共展示了TextFieldWithBrowseButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: GoalSettingsEditor
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
/**
* Creates a new GOAL MAS configuration editor.
*
* @param project the project this editor is for
*/
public GoalSettingsEditor(final @NotNull Project project) {
this.project = project;
this.ui = new JPanel();
this.fileChooser = this.rebuildChooser(project);
final JLabel fileLabel = new JLabel("File to run:");
this.fileBox = new TextFieldWithBrowseButton.NoPathCompletion();
this.fileBox.addActionListener(event -> this.fileChooser.showDialog());
this.fileBox.setEditable(false);
this.fileBox.setAlignmentX(0);
this.fileBox.setAlignmentY(0);
//this.fileBox.setEditable(true);
this.ui.add(fileLabel);
this.ui.add(this.fileBox);
}
示例2: AddFileSelectorHandler
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void AddFileSelectorHandler(TextFieldWithBrowseButton textFieldWithBrowseButton, Project project, String label, String description) {
textFieldWithBrowseButton.addActionListener(
e -> {
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(new FileSaverDescriptor(label, description), myPanel);
final String path = FileUtil.toSystemIndependentName(getFileName(textFieldWithBrowseButton));
final int idx = path.lastIndexOf("/");
VirtualFile baseDir = idx == -1 ? project.getBaseDir() :
(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx))));
baseDir = baseDir == null ? project.getBaseDir() : baseDir;
final String name = idx == -1 ? path : path.substring(idx + 1);
final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name);
if (fileWrapper != null) {
textFieldWithBrowseButton.setText(fileWrapper.getFile().getPath());
}
}
);
}
示例3: createUIComponents
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void createUIComponents() {
defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension"));
defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"});
bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile"));
bootstrapFileField = new TextFieldWithBrowseButton();
bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));
namespaceMappingTable = new NamespaceMappingTable(project);
namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() {
@Override
public TesterNamespaceMapping createElement() {
return new TesterNamespaceMapping();
}
@Override
public boolean canCreateElement() {
return true;
}
}).createPanel();
namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title")));
}
示例4: createUIComponents
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void createUIComponents() {
phpInterpreter = new PhpInterpreterComboBox(project, null);
phpInterpreter.setModel(PhpInterpretersManagerImpl.getInstance(project).getInterpreters(), null);
phpInterpreter.setNoItemText("<default project interpreter>");
interpreterOptions = new PhpConfigurationOptionsComponent();
phpIniPath = new TextFieldWithBrowseButton();
phpIniPath.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("ini"));
useSystemPhpIniCheckbox = new JBCheckBox(TesterBundle.message("runConfiguration.editor.testEnv.useSystemPhpIni"));
interpreterLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreter"));
interpreterOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreterOptions"));
pathToPhpIniLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.phpIni"));
}
示例5: createUIComponents
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void createUIComponents() {
testScope = new TextFieldWithBrowseButton();
testScope.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());
testerExecutable = new TextFieldWithBrowseButton();
testerExecutable.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());
testerOptions = new RawCommandLineEditor();
testerOptions.setDialogCaption("Options");
userSetupScript = new TextFieldWithBrowseButton();
userSetupScript.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));
testScopeLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testScope"));
testerExecutableLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerExecutable"));
testerOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerOptions"));
setupScriptLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.setupScript"));
}
示例6: makePathButton
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void makePathButton() {
btnPath = new TextFieldWithBrowseButton();
btnPath.setText(PackageTemplateHelper.getRootDirPath());
btnPath.addBrowseFolderListener(Localizer.get("SelectPackageTemplate"), "", project, FileReaderUtil.getPackageTemplatesDescriptor());
// panel.add(new SeparatorComponent(), new CC().growX().spanX().wrap());
panel.add(btnPath, new CC().pushX().growX().spanX());
addPathButtons();
rbFromPath = new JBRadioButton(Localizer.get("label.FromPath"));
rbFromPath.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
toggleSourcePath(
TemplateSourceType.PATH,
null,
btnPath
);
}
});
panel.add(rbFromPath, new CC().growX().spanX().wrap());
}
示例7: createUIComponents
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void createUIComponents() {
tfArmaToolsDir = new JTextField(40);
{
panelForTfArmaToolsDir = new TextFieldWithBrowseButton(tfArmaToolsDir, e -> {
JFileChooser fc = new JFileChooser();
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
fc.showDialog(panelRoot, getBundle().getString("ApplicationSettings.ArmaToolsConfig.select"));
File file = fc.getSelectedFile();
if (file == null) {
return;
}
tfArmaToolsDir.setText(file.getAbsolutePath());
});
}
}
示例8: DeviceDriverForm
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
public DeviceDriverForm() {
author.setText(System.getProperty("user.name"));
license.addItem(new ComboItem(DriverLicenseType.GPL.name(), DriverLicenseType.GPL.name()));
license.addItem(new ComboItem(DriverLicenseType.BSD.name(), DriverLicenseType.BSD.name()));
license.addItem(new ComboItem(DriverLicenseType.DUAL.name(), DriverLicenseType.DUAL.name()));
kernelVersion.setText(KernelBundle.getString("kernel.version") + " " + System.getProperty("os.version"));
useHostKernelCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
kernelSourcePath.setEnabled(!useHostKernelCheckBox.isSelected());
}
});
TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
textFieldWithBrowseButton.addBrowseFolderListener(KernelBundle.getString("choose.kernel.sources"), null, null,
new FileChooserDescriptor(false, true, false, false, false, false));
kernelSourcePath.setComponent(textFieldWithBrowseButton);
kernelSourcePath.setEnabled(false);
kernelSourcePath.getComponent().setText("/usr/src/linux-headers-" + System.getProperty("os.version"));
}
示例9: testCustomIconButtonShouldBeEnabledWhenSelectedItemIsCustomIconOnly
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
public void testCustomIconButtonShouldBeEnabledWhenSelectedItemIsCustomIconOnly() {
TextFieldWithBrowseButton button = editorSettingsPage.getCustomIconButton();
JComboBox<String> comboBox = editorSettingsPage.getCamelIconsComboBox();
assertNotNull(comboBox.getSelectedItem());
assertEquals("Camel Icon", comboBox.getSelectedItem().toString());
assertEquals(false, button.isEnabled());
comboBox.setSelectedIndex(1);
assertNotNull(comboBox.getSelectedItem());
assertEquals("Camel Badge Icon", comboBox.getSelectedItem().toString());
assertEquals(false, button.isEnabled());
comboBox.setSelectedIndex(2);
assertNotNull(comboBox.getSelectedItem());
assertEquals("Custom Icon", comboBox.getSelectedItem().toString());
assertEquals(true, button.isEnabled());
comboBox.setSelectedIndex(1);
assertNotNull(comboBox.getSelectedItem());
assertEquals("Camel Badge Icon", comboBox.getSelectedItem().toString());
assertEquals(false, button.isEnabled());
}
示例10: getAdditionalSettings
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
public JComponent getAdditionalSettings(final WizardContext wizardContext) {
JTextField tfModuleFilePath = new JTextField();
final String productName = ApplicationNamesInfo.getInstance().getProductName();
final String message = IdeBundle.message("prompt.select.module.file.to.import", productName);
final BrowseFilesListener listener = new BrowseFilesListener(tfModuleFilePath, message, null, new ModuleFileChooserDescriptor()) {
@Override
protected VirtualFile getFileToSelect() {
final VirtualFile fileToSelect = super.getFileToSelect();
if (fileToSelect != null) {
return fileToSelect;
}
final Project project = wizardContext.getProject();
return project != null ? project.getBaseDir() : null;
}
};
myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, listener);
onChosen(false);
return myModulePathFieldPanel;
}
示例11: createUIComponents
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void createUIComponents() {
mySourceDirField = new TextFieldWithBrowseButton(null, this);
myTargetDirField = new TextFieldWithBrowseButton(null, this);
final AtomicBoolean callUpdate = new AtomicBoolean(true);
myRootPanel = new JPanel(new BorderLayout()) {
@Override
protected void paintChildren(Graphics g) {
super.paintChildren(g);
if (callUpdate.get()) {
callUpdate.set(false);
myModel.reloadModel(false);
}
}
};
}
示例12: createComponent
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
public void createComponent() {
super.createComponent();
TextFieldWithBrowseButton.MyDoClickAction doClickAction = getDoClickAction();
if (doClickAction != null) {
doClickAction.registerShortcut(myComboBox);
}
myComboBox.setMaximumRowCount(8);
myComboBox.setEditable(true);
final JTextField editorComponent = (JTextField)myComboBox.getEditor().getEditorComponent();
editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(DocumentEvent e) {
final String text = getText();
if (!Comparing.equal(text, oldText, true)) {
oldText = text;
final Runnable changeListener = getChangeListener();
if (changeListener != null) {
changeListener.run();
}
}
}
});
}
示例13: RawCommandLineEditor
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
public RawCommandLineEditor(final Function<String, List<String>> lineParser, final Function<List<String>, String> lineJoiner) {
super(new BorderLayout());
myTextField = new TextFieldWithBrowseButton(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (myDialogCaption == null) {
Container parent = getParent();
if (parent instanceof LabeledComponent) {
parent = parent.getParent();
}
LOG.error("Did not call RawCommandLineEditor.setDialogCaption() in " + parent);
myDialogCaption = "Parameters";
}
Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow", lineParser, lineJoiner);
}
});
myTextField.setButtonIcon(AllIcons.Actions.ShowViewer);
add(myTextField, BorderLayout.CENTER);
setDescriptor(null);
}
示例14: createBrowseField
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private static TextFieldWithBrowseButton createBrowseField(){
TextFieldWithBrowseButton textField = new TextFieldWithBrowseButton();
textField.setPreferredSize(new Dimension(200, textField.getPreferredSize().height));
textField.setMinimumSize(new Dimension(200, textField.getPreferredSize().height));
final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
//noinspection HardCodedStringLiteral
return file.getName().endsWith(".png");
}
};
textField.addBrowseFolderListener(IdeBundle.message("title.browse.icon"), IdeBundle.message("prompt.browse.icon.for.selected.action"), null,
fileChooserDescriptor);
InsertPathAction.addTo(textField.getTextField(), fileChooserDescriptor);
return textField;
}
示例15: initMainPanel
import com.intellij.openapi.ui.TextFieldWithBrowseButton; //導入依賴的package包/類
private void initMainPanel() {
myFileNameField = new TextFieldWithBrowseButton();
myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox"));
myEncoding = new ComboBox();
myIncludeBaseRevisionTextCheckBox = new JCheckBox(VcsBundle.message("create.patch.base.revision", 0));
myIncludeBaseRevisionTextCheckBox.setToolTipText(VcsBundle.message("create.patch.base.revision.tooltip"));
myErrorLabel = new JLabel();
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField)
.addComponent(myReversePatchCheckbox)
.addComponent(myIncludeBaseRevisionTextCheckBox)
.addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding)
.addComponent(myErrorLabel)
.getPanel();
}