Search in sources :

Example 1 with ExternalProjectPathField

use of com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField 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 ExternalProjectPathField

use of com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField in project intellij-community by JetBrains.

the class GradleRunTaskDialog method setUpDialog.

private void setUpDialog() {
    JComponent commandLineComponent;
    if (myHistory == null) {
        commandLineEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
        commandLineComponent = commandLineEditor;
        commandLineLabel.setLabelFor(commandLineEditor);
    } else {
        commandLineComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
        commandLineComponent = commandLineComboBox;
        commandLineLabel.setLabelFor(commandLineComboBox);
        commandLineComboBox.setLightWeightPopupEnabled(false);
        EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, commandLineComboBox);
        //noinspection GtkPreferredJComboBoxRenderer
        commandLineComboBox.setRenderer(new EditorComboBoxRenderer(editor));
        commandLineComboBox.setEditable(true);
        commandLineComboBox.setEditor(editor);
        commandLineComboBox.setFocusable(true);
        commandLineEditor = editor.getEditorComponent();
    }
    commandLinePanel.add(commandLineComponent);
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
    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", GradleConstants.SYSTEM_ID.getReadableName());
    myProjectPathField = new ExternalProjectPathField(myProject, GradleConstants.SYSTEM_ID, projectPathChooserDescriptor, title) {

        @Override
        public Dimension getPreferredSize() {
            return commandLinePanel == null ? super.getPreferredSize() : commandLinePanel.getPreferredSize();
        }
    };
    projectPathFieldPanel.add(myProjectPathField);
    new GradleArgumentsCompletionProvider(myProject, myProjectPathField).apply(commandLineEditor);
}
Also used : EditorComboBoxEditor(com.intellij.ui.EditorComboBoxEditor) GradleArgumentsCompletionProvider(org.jetbrains.plugins.gradle.service.execution.GradleArgumentsCompletionProvider) StringComboboxEditor(com.intellij.ui.StringComboboxEditor) ExternalProjectPathField(com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField) ComboBox(com.intellij.openapi.ui.ComboBox) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) ExternalSystemUiAware(com.intellij.openapi.externalSystem.ExternalSystemUiAware) EditorTextField(com.intellij.ui.EditorTextField) EditorComboBoxRenderer(com.intellij.ui.EditorComboBoxRenderer)

Aggregations

ExternalSystemUiAware (com.intellij.openapi.externalSystem.ExternalSystemUiAware)2 ExternalProjectPathField (com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField)2 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 EditorTextField (com.intellij.ui.EditorTextField)2 ComboBox (com.intellij.openapi.ui.ComboBox)1 EditorComboBoxEditor (com.intellij.ui.EditorComboBoxEditor)1 EditorComboBoxRenderer (com.intellij.ui.EditorComboBoxRenderer)1 RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)1 StringComboboxEditor (com.intellij.ui.StringComboboxEditor)1 JBLabel (com.intellij.ui.components.JBLabel)1 GridBag (com.intellij.util.ui.GridBag)1 GradleArgumentsCompletionProvider (org.jetbrains.plugins.gradle.service.execution.GradleArgumentsCompletionProvider)1