From 2587292720f3e9bfe138bb8a5051d590db4590fb Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 9 Sep 2024 10:57:17 +0200 Subject: [PATCH] [project] follow-up to `FileChooserDescriptor` usages cleanup (IJ-CR-144236) GitOrigin-RevId: 8ab0181554033d1d68fc681d2f66b32f0765261a --- platform/execution/api-dump-unreviewed.txt | 1 + .../BrowsableTargetEnvironmentType.java | 44 ++++++++++--------- .../execution/target/TargetBrowserHints.kt | 17 +++---- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/platform/execution/api-dump-unreviewed.txt b/platform/execution/api-dump-unreviewed.txt index 4cf33f460f13..f2c274818440 100644 --- a/platform/execution/api-dump-unreviewed.txt +++ b/platform/execution/api-dump-unreviewed.txt @@ -1440,6 +1440,7 @@ f:com.intellij.execution.target.TargetBasedSdks - sf:saveTargetBasedSdkAdditionalData(org.jdom.Element,com.intellij.execution.target.ContributedConfigurationsList$ContributedStateBase):V - sf:saveTargetConfiguration(org.jdom.Element,com.intellij.execution.target.TargetEnvironmentConfiguration):V f:com.intellij.execution.target.TargetBrowserHints +- ():V - (Z):V - (Z,com.intellij.openapi.fileChooser.FileChooserDescriptor):V - b:(Z,com.intellij.openapi.fileChooser.FileChooserDescriptor,I,kotlin.jvm.internal.DefaultConstructorMarker):V diff --git a/platform/execution/src/com/intellij/execution/target/BrowsableTargetEnvironmentType.java b/platform/execution/src/com/intellij/execution/target/BrowsableTargetEnvironmentType.java index e2d90fada53b..403033ab11e3 100644 --- a/platform/execution/src/com/intellij/execution/target/BrowsableTargetEnvironmentType.java +++ b/platform/execution/src/com/intellij/execution/target/BrowsableTargetEnvironmentType.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.target; import com.intellij.openapi.project.Project; @@ -15,44 +15,46 @@ import java.util.function.Supplier; * So you can browse (possibly remote) target. */ public interface BrowsableTargetEnvironmentType { - /** * @deprecated Implement and use {@link BrowsableTargetEnvironmentType#createBrowser(Project, String, TextComponentAccessor, Component, Supplier, TargetBrowserHints)} */ @SuppressWarnings("unused") @Deprecated(forRemoval = true) - default @NotNull ActionListener createBrowser(@NotNull Project project, - @NlsContexts.DialogTitle String title, - @NotNull TextComponentAccessor textComponentAccessor, - @NotNull T component, - @NotNull Supplier configurationSupplier) { + default @NotNull ActionListener createBrowser( + @NotNull Project project, + @NlsContexts.DialogTitle String title, + @NotNull TextComponentAccessor textComponentAccessor, + @NotNull T component, + @NotNull Supplier configurationSupplier + ) { throw new UnsupportedOperationException("Please, call the other createBrowser that accepts TargetBrowserHints"); } /** - * @param textComponentAccessor where path should be set. See {@link TextComponentAccessor#TEXT_FIELD_WHOLE_TEXT} + * @param textComponentAccessor where a path should be set. See {@link TextComponentAccessor#TEXT_FIELD_WHOLE_TEXT}. * @param component text field component - * @param configurationSupplier returns environment configuration that must be supported by this configuration type - * @param targetBrowserHints various hints target may or may not obey - * @return Action listener should be installed on "browse" button you want to show target FS browser. + * @param configurationSupplier returns an environment configuration that must be supported by this configuration type + * @param targetBrowserHints various hints the target may or may not take into account + * @return Action listener should be installed on "browse" button you want to show the target FS browser. */ - default @NotNull ActionListener createBrowser(@NotNull Project project, - @NlsContexts.DialogTitle String title, - @NotNull TextComponentAccessor textComponentAccessor, - @NotNull T component, - @NotNull Supplier configurationSupplier, - @NotNull TargetBrowserHints targetBrowserHints) { + default @NotNull ActionListener createBrowser( + @NotNull Project project, + @NlsContexts.DialogTitle String title, + @NotNull TextComponentAccessor textComponentAccessor, + @NotNull T component, + @NotNull Supplier configurationSupplier, + @NotNull TargetBrowserHints targetBrowserHints + ) { return createBrowser(project, title, textComponentAccessor, component, configurationSupplier); } /** * When configurable contains both connection parameters and components using them (text fields with browsing in this case), - * those components need to have current connection settings available, not the last applied to with [Configurable.apply]. + * those components need to have current connection settings available, not the last applied to with {@code Configurable.apply()}. *

- * This interface displays ability and provides API to get connection settings, which are shown in UI. See IDEA-255466. + * This interface displays ability and provides an API to get connection settings, which are shown in the UI (see IDEA-255466). */ interface ConfigurableCurrentConfigurationProvider { - @NotNull - TargetEnvironmentConfiguration getCurrentConfiguration(); + @NotNull TargetEnvironmentConfiguration getCurrentConfiguration(); } } diff --git a/platform/execution/src/com/intellij/execution/target/TargetBrowserHints.kt b/platform/execution/src/com/intellij/execution/target/TargetBrowserHints.kt index 256cc11fe6cf..d4d8f0aa0cfd 100644 --- a/platform/execution/src/com/intellij/execution/target/TargetBrowserHints.kt +++ b/platform/execution/src/com/intellij/execution/target/TargetBrowserHints.kt @@ -4,15 +4,16 @@ package com.intellij.execution.target import com.intellij.openapi.fileChooser.FileChooserDescriptor /** - * Hints for [BrowsableTargetEnvironmentType.createBrowser] - * [showLocalFsInBrowser]: some targets (WSL is the only known for now) may provide access to the local filesystem. - * This flag allows such access, hence user could choose local path on target (like ``/mnt/c`` for WSL). - * For other targets this flag might be ignored. + * Hints for [BrowsableTargetEnvironmentType.createBrowser]. * - * [customFileChooserDescriptor] to browse files. It also might be ignored by some targets. + * [showLocalFsInBrowser]: some targets (WSL is the only known for now) may provide access to the local filesystem. + * This flag allows such access, hence user could choose a local path on the target (like ``/mnt/c`` for WSL). + * For other targets this flag might be ignored. + * + * [customFileChooserDescriptor] to browse files; it also might be ignored by some targets. **/ - +@Suppress("removal") data class TargetBrowserHints @JvmOverloads constructor( - val showLocalFsInBrowser: Boolean, - val customFileChooserDescriptor: FileChooserDescriptor? = null + val showLocalFsInBrowser: Boolean = true, + val customFileChooserDescriptor: FileChooserDescriptor? = null, )