[project] follow-up to FileChooserDescriptor usages cleanup (IJ-CR-144236)

GitOrigin-RevId: 8ab0181554033d1d68fc681d2f66b32f0765261a
This commit is contained in:
Roman Shevchenko
2024-09-09 10:57:17 +02:00
committed by intellij-monorepo-bot
parent 4269e27cb3
commit 2587292720
3 changed files with 33 additions and 29 deletions

View File

@@ -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
- <init>():V
- <init>(Z):V
- <init>(Z,com.intellij.openapi.fileChooser.FileChooserDescriptor):V
- b:<init>(Z,com.intellij.openapi.fileChooser.FileChooserDescriptor,I,kotlin.jvm.internal.DefaultConstructorMarker):V

View File

@@ -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 <T extends Component> ActionListener createBrowser(@NotNull Project project,
default @NotNull <T extends Component> ActionListener createBrowser(
@NotNull Project project,
@NlsContexts.DialogTitle String title,
@NotNull TextComponentAccessor<T> textComponentAccessor,
@NotNull T component,
@NotNull Supplier<? extends TargetEnvironmentConfiguration> configurationSupplier) {
@NotNull Supplier<? extends TargetEnvironmentConfiguration> 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 <T extends Component> ActionListener createBrowser(@NotNull Project project,
default @NotNull <T extends Component> ActionListener createBrowser(
@NotNull Project project,
@NlsContexts.DialogTitle String title,
@NotNull TextComponentAccessor<T> textComponentAccessor,
@NotNull T component,
@NotNull Supplier<? extends TargetEnvironmentConfiguration> configurationSupplier,
@NotNull TargetBrowserHints targetBrowserHints) {
@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()}.
* <p>
* 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();
}
}

View File

@@ -4,15 +4,16 @@ package com.intellij.execution.target
import com.intellij.openapi.fileChooser.FileChooserDescriptor
/**
* Hints for [BrowsableTargetEnvironmentType.createBrowser]
* 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).
* 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.
* [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,
)