Search in sources :

Example 1 with GradleArgumentsCompletionProvider

use of org.jetbrains.plugins.gradle.service.execution.GradleArgumentsCompletionProvider 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)1 ExternalProjectPathField (com.intellij.openapi.externalSystem.service.ui.ExternalProjectPathField)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 ComboBox (com.intellij.openapi.ui.ComboBox)1 EditorComboBoxEditor (com.intellij.ui.EditorComboBoxEditor)1 EditorComboBoxRenderer (com.intellij.ui.EditorComboBoxRenderer)1 EditorTextField (com.intellij.ui.EditorTextField)1 StringComboboxEditor (com.intellij.ui.StringComboboxEditor)1 GradleArgumentsCompletionProvider (org.jetbrains.plugins.gradle.service.execution.GradleArgumentsCompletionProvider)1