use of com.intellij.execution.ui.CommonProgramParametersPanel in project Perl5-IDEA by Camelcade.
the class PerlConfigurationEditor method getGeneralComponent.
@Nullable
@Override
protected JComponent getGeneralComponent() {
myScriptField = new TextFieldWithBrowseButton();
myScriptField.addBrowseFolderListener(PerlBundle.message("perl.run.config.select.script.header"), PerlBundle.message("perl.run.config.select.script.prompt"), myProject, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withFileFilter(PerlConfigurationProducer::isExecutableFile), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
myConsoleCharset = new ComboBox(new CollectionComboBoxModel(new ArrayList<>(Charset.availableCharsets().keySet())));
myScriptField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent documentEvent) {
VirtualFile file = LocalFileSystem.getInstance().findFileByPath(myScriptField.getText());
if (file != null) {
myConsoleCharset.setSelectedItem(file.getCharset().displayName());
} else {
myConsoleCharset.setSelectedItem(null);
}
}
});
myAlternativeSdkPanel = new PerlAlternativeSdkPanel();
myParametersPanel = new CommonProgramParametersPanel() {
@Override
protected void addComponents() {
LabeledComponent<?> scriptLabel = LabeledComponent.create(myScriptField, PerlBundle.message("perl.run.option.script"));
scriptLabel.setLabelLocation(BorderLayout.WEST);
add(scriptLabel);
LabeledComponent<?> consoleEncoding = LabeledComponent.create(myConsoleCharset, PerlBundle.message("perl.run.option.output.encoding"));
consoleEncoding.setLabelLocation(BorderLayout.WEST);
add(consoleEncoding);
myPerlParametersPanel = new RawCommandLineEditor();
LabeledComponent<RawCommandLineEditor> perlParametersPanel = LabeledComponent.create(myPerlParametersPanel, PerlBundle.message("perl.run.option.perl.parameters"));
perlParametersPanel.setLabelLocation(BorderLayout.WEST);
copyDialogCaption(perlParametersPanel);
add(perlParametersPanel);
super.addComponents();
add(myAlternativeSdkPanel);
setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
}
};
myParametersPanel.setProgramParametersLabel(PerlBundle.message("perl.run.option.script.parameters"));
return myParametersPanel;
}
Aggregations