Search in sources :

Example 1 with RawCommandLineEditor

use of com.intellij.ui.RawCommandLineEditor in project intellij-community by JetBrains.

the class ExternalSystemTaskSettingsControl method fillUi.

@Override
public void fillUi(@NotNull final PaintAwarePanel canvas, int indentLevel) {
    myProjectPathLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.project", myExternalSystemId.getReadableName()));
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
    FileChooserDescriptor projectPathChooserDescriptor = null;
    if (manager instanceof ExternalSystemUiAware) {
        projectPathChooserDescriptor = ((ExternalSystemUiAware) manager).getExternalProjectConfigDescriptor();
    }
    if (projectPathChooserDescriptor == null) {
        projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
    }
    String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName());
    myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) {

        @Override
        public Dimension getPreferredSize() {
            return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize();
        }
    };
    canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0));
    myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks"));
    myTasksTextField = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
    canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0);
    c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8;
    canvas.add(myTasksTextField, c);
    new TaskCompletionProvider(myProject, myExternalSystemId, myProjectPathField).apply(myTasksTextField);
    myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
    myVmOptionsEditor = new RawCommandLineEditor();
    myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
    canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
    myArgumentsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
    myArgumentsEditor = new RawCommandLineEditor();
    myArgumentsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
    canvas.add(myArgumentsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
    canvas.add(myArgumentsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
}
Also used : ExternalProjectPathField(com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField) JBLabel(com.intellij.ui.components.JBLabel) EditorTextField(com.intellij.ui.EditorTextField) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor) GridBag(com.intellij.util.ui.GridBag) ExternalSystemUiAware(com.intellij.openapi.externalSystem.ExternalSystemUiAware)

Example 2 with RawCommandLineEditor

use of com.intellij.ui.RawCommandLineEditor in project intellij-community by JetBrains.

the class CommonProgramParametersPanel method copyDialogCaption.

protected void copyDialogCaption(final LabeledComponent<RawCommandLineEditor> component) {
    final RawCommandLineEditor rawCommandLineEditor = component.getComponent();
    rawCommandLineEditor.setDialogCaption(component.getRawText());
    component.getLabel().setLabelFor(rawCommandLineEditor.getTextField());
}
Also used : RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor)

Example 3 with RawCommandLineEditor

use of com.intellij.ui.RawCommandLineEditor 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;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) CommonProgramParametersPanel(com.intellij.execution.ui.CommonProgramParametersPanel) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor) CollectionComboBoxModel(com.intellij.ui.CollectionComboBoxModel) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with RawCommandLineEditor

use of com.intellij.ui.RawCommandLineEditor in project moe-ide-integration by multi-os-engine.

the class ArgumentsPanel method initComponents.

protected void initComponents() {
    myVMParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM options:");
    copyDialogCaption(myVMParametersComponent);
    myVMParametersComponent.setLabelLocation(BorderLayout.CENTER);
    myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "Program arguments:");
    myEnvVariablesComponent = new EnvironmentVariablesComponent();
    myEnvVariablesComponent.setLabelLocation(BorderLayout.CENTER);
    myProgramParametersComponent.setLabelLocation(BorderLayout.CENTER);
    copyDialogCaption(myProgramParametersComponent);
    addComponents();
    setPreferredSize(new Dimension(10, 10));
    setAnchor(myEnvVariablesComponent.getLabel());
}
Also used : RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor) EnvironmentVariablesComponent(com.intellij.execution.configuration.EnvironmentVariablesComponent)

Example 5 with RawCommandLineEditor

use of com.intellij.ui.RawCommandLineEditor in project moe-ide-integration by multi-os-engine.

the class ArgumentsPanel method copyDialogCaption.

protected void copyDialogCaption(LabeledComponent<RawCommandLineEditor> component) {
    RawCommandLineEditor rawCommandLineEditor = (RawCommandLineEditor) component.getComponent();
    rawCommandLineEditor.setDialogCaption(component.getRawText());
    component.getLabel().setLabelFor(rawCommandLineEditor.getTextField());
}
Also used : RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor)

Aggregations

RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)13 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)4 ModulesComboBox (com.intellij.application.options.ModulesComboBox)3 EnvironmentVariablesComponent (com.intellij.execution.configuration.EnvironmentVariablesComponent)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 EditorTextField (com.intellij.ui.EditorTextField)2 CommonProgramParametersPanel (com.intellij.execution.ui.CommonProgramParametersPanel)1 ExternalSystemUiAware (com.intellij.openapi.externalSystem.ExternalSystemUiAware)1 ExternalProjectPathField (com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField)1 ExternalSystemJdkComboBox (com.intellij.openapi.externalSystem.service.ui.ExternalSystemJdkComboBox)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 CollectionComboBoxModel (com.intellij.ui.CollectionComboBoxModel)1 DocumentAdapter (com.intellij.ui.DocumentAdapter)1 MacroAwareTextBrowseFolderListener (com.intellij.ui.MacroAwareTextBrowseFolderListener)1 JBLabel (com.intellij.ui.components.JBLabel)1 GridBag (com.intellij.util.ui.GridBag)1 ActionEvent (java.awt.event.ActionEvent)1 DocumentEvent (javax.swing.event.DocumentEvent)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1