use of com.intellij.ide.util.BrowseFilesListener in project intellij-community by JetBrains.
the class ProjectConfigurable method createUIComponents.
private void createUIComponents() {
myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
@Override
protected LanguageLevel getDefaultLevel() {
Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
if (sdk == null)
return null;
JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
return version == null ? null : version.getMaxLanguageLevel();
}
};
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
outputPathsChooserDescriptor.setHideIgnored(false);
BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
use of com.intellij.ide.util.BrowseFilesListener in project intellij-community by JetBrains.
the class BuildElementsEditor method createOutputPathPanel.
private CommitableFieldPanel createOutputPathPanel(final String title, final CommitPathRunnable commitPathRunnable) {
final JTextField textField = new JTextField();
final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
outputPathsChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, getModel().getModule());
outputPathsChooserDescriptor.setHideIgnored(false);
InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
FileChooserFactory.getInstance().installFileCompletion(textField, outputPathsChooserDescriptor, true, null);
final Runnable commitRunnable = () -> {
if (!getModel().isWritable()) {
return;
}
final String path = textField.getText().trim();
if (path.length() == 0) {
commitPathRunnable.saveUrl(null);
} else {
// should set only absolute paths
String canonicalPath;
try {
canonicalPath = FileUtil.resolveShortWindowsName(path);
} catch (IOException e) {
canonicalPath = path;
}
commitPathRunnable.saveUrl(VfsUtilCore.pathToUrl(FileUtil.toSystemIndependentName(canonicalPath)));
}
};
final ActionListener listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
commitRunnable.run();
}
};
myPerModuleCompilerOutput.addActionListener(listener);
textField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
commitRunnable.run();
}
});
return new CommitableFieldPanel(textField, null, null, new BrowseFilesListener(textField, title, "", outputPathsChooserDescriptor) {
@Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
commitRunnable.run();
}
}, null, commitRunnable);
}
use of com.intellij.ide.util.BrowseFilesListener in project intellij-community by JetBrains.
the class PluginModuleBuildConfEditor method createComponent.
@Override
public JComponent createComponent() {
myPluginXML.addActionListener(new BrowseFilesListener(myPluginXML.getTextField(), DevKitBundle.message("deployment.directory.location", META_INF), DevKitBundle.message("saved.message.common", META_INF + File.separator + PLUGIN_XML), BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR));
myManifest.addActionListener(new BrowseFilesListener(myManifest.getTextField(), DevKitBundle.message("deployment.view.select", MANIFEST_MF), DevKitBundle.message("manifest.selection", MANIFEST_MF), BrowseFilesListener.SINGLE_FILE_DESCRIPTOR));
myManifest.setEnabled(myBuildProperties.isUseUserManifest());
myUseUserManifest.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final boolean selected = myUseUserManifest.isSelected();
myManifest.setEnabled(selected);
}
});
final GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(2), 0, 0);
myWholePanel.add(myPluginXMLLabel, gc);
myWholePanel.add(myPluginXML, gc);
JPanel manifestPanel = new JPanel(new GridBagLayout());
manifestPanel.setBorder(IdeBorderFactory.createTitledBorder(DevKitBundle.message("manifest.settings"), true));
gc.insets.left = 0;
manifestPanel.add(myUseUserManifest, gc);
gc.insets.left = 2;
gc.weighty = 1.0;
manifestPanel.add(myManifest, gc);
myWholePanel.add(manifestPanel, gc);
myWholePanel.setBorder(JBUI.Borders.empty(5));
return myWholePanel;
}
Aggregations