use of org.jdesktop.swingx.combobox.MapComboBoxModel in project Perl5-IDEA by Camelcade.
the class PerlRemoteDebuggingConfigurationEditor method getDebuggingComponent.
@Nullable
@Override
protected JComponent getDebuggingComponent() {
JComponent debugPanel = super.getDebuggingComponent();
if (debugPanel == null) {
return null;
}
myWorkingDirectoryComponent = new JTextField();
LabeledComponent<JTextField> workingDirectory = LabeledComponent.create(myWorkingDirectoryComponent, PerlBundle.message("perl.run.option.remote.root"));
workingDirectory.setLabelLocation(BorderLayout.WEST);
debugPanel.add(workingDirectory);
// noinspection Since15
myPerlRole = new ComboBox(new MapComboBoxModel<>(PerlDebugOptionsSets.ROLE_OPTIONS)) {
@Override
public void setRenderer(ListCellRenderer renderer) {
super.setRenderer(new ColoredListCellRenderer<String>() {
@Override
protected void customizeCellRenderer(JList list, String value, int index, boolean selected, boolean hasFocus) {
append(PerlDebugOptionsSets.ROLE_OPTIONS.get(value));
}
});
}
};
LabeledComponent<?> perlRole = LabeledComponent.create(myPerlRole, PerlBundle.message("perl.run.option.debugger.connection.mode"));
perlRole.setLabelLocation(BorderLayout.WEST);
debugPanel.add(perlRole);
myDebuggingHost = new JTextField();
LabeledComponent<JTextField> debuggingHost = LabeledComponent.create(myDebuggingHost, PerlBundle.message("perl.run.option.debugger.host"));
debuggingHost.setLabelLocation(BorderLayout.WEST);
debugPanel.add(debuggingHost);
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumIntegerDigits(6);
numberFormat.setGroupingUsed(false);
NumberFormatter formatter = new NumberFormatter(numberFormat);
formatter.setAllowsInvalid(false);
formatter.setMaximum(65535);
formatter.setMinimum(0);
myDebuggingPort = new JFormattedTextField(formatter);
LabeledComponent<JFormattedTextField> debuggingPort = LabeledComponent.create(myDebuggingPort, PerlBundle.message("perl.run.option.debugger.port"));
debuggingPort.setLabelLocation(BorderLayout.WEST);
debugPanel.add(debuggingPort);
return debugPanel;
}
use of org.jdesktop.swingx.combobox.MapComboBoxModel in project Perl5-IDEA by Camelcade.
the class PerlConfigurationEditorBase method getDebuggingComponent.
@Nullable
protected JComponent getDebuggingComponent() {
JPanel panel = new JPanel();
panel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
myScriptCharset = new JTextField();
LabeledComponent<JTextField> scriptCharset = LabeledComponent.create(myScriptCharset, PerlBundle.message("perl.run.option.script.encoding"));
scriptCharset.setLabelLocation(BorderLayout.WEST);
panel.add(scriptCharset);
myStartMode = new ComboBox(new MapComboBoxModel<>(PerlDebugOptionsSets.STARTUP_OPTIONS)) {
@Override
public void setRenderer(ListCellRenderer renderer) {
super.setRenderer(new ColoredListCellRenderer<String>() {
@Override
protected void customizeCellRenderer(@NotNull JList list, String value, int index, boolean selected, boolean hasFocus) {
append(PerlDebugOptionsSets.STARTUP_OPTIONS.get(value));
}
});
}
};
LabeledComponent<?> startMode = LabeledComponent.create(myStartMode, PerlBundle.message("perl.run.option.debugger.startup.mode"));
startMode.setLabelLocation(BorderLayout.WEST);
panel.add(startMode);
myIsNonInteractiveModeEnabled = new JCheckBox(PerlBundle.message("perl.run.option.debugger.noninteractive.mode"));
panel.add(myIsNonInteractiveModeEnabled);
myIsCompileTimeBreakpointsEnabled = new JCheckBox(PerlBundle.message("perl.run.option.debugger.compile.time.breakpoints"));
panel.add(myIsCompileTimeBreakpointsEnabled);
PsiFile fileFromText = PsiFileFactory.getInstance(myProject).createFileFromText("file.dummy", PerlFileTypeScript.INSTANCE, "", 0, true);
Document document = PsiDocumentManager.getInstance(myProject).getDocument(fileFromText);
myInitCodeTextField = new EditorTextField(document, myProject, PerlFileTypeScript.INSTANCE);
myInitCodeTextField.setOneLineMode(false);
myInitCodeTextField.setPreferredSize(new Dimension(0, 100));
LabeledComponent<EditorTextField> initCode = LabeledComponent.create(myInitCodeTextField, PerlBundle.message("perl.run.option.debugger.init.code"));
initCode.setLabelLocation(BorderLayout.NORTH);
panel.add(initCode);
return panel;
}
Aggregations