mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-21 05:51:25 +07:00
PY-78995: Provide API to put run configuration editor settings into resizableRow.
We need to centralize it vertically according to design. GitOrigin-RevId: bb5742bb0a094006d1879f67d742ba5083901ff7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
89b0fbb41e
commit
68be9e51c8
@@ -1,8 +1,9 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution.impl
|
||||
|
||||
import com.intellij.execution.ExecutionBundle
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.ui.dsl.builder.AlignX
|
||||
import com.intellij.ui.dsl.builder.CollapsibleRow
|
||||
import com.intellij.ui.dsl.builder.Placeholder
|
||||
@@ -15,8 +16,11 @@ import javax.swing.JPanel
|
||||
|
||||
private const val EXPAND_PROPERTY_KEY = "ExpandBeforeRunStepsPanel"
|
||||
|
||||
/**
|
||||
* @param maximizeEditorHeight see [com.intellij.openapi.options.SettingsEditor.isMaximizeEditorHeight]
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
class ConfigurationSettingsEditorPanel(rcStorage: JComponent?) {
|
||||
internal class ConfigurationSettingsEditorPanel @JvmOverloads constructor(rcStorage: JComponent?, maximizeEditorHeight: Boolean = false) {
|
||||
|
||||
lateinit var isAllowRunningInParallelCheckBox: JCheckBox
|
||||
lateinit var targetPanel: JPanel
|
||||
@@ -25,7 +29,7 @@ class ConfigurationSettingsEditorPanel(rcStorage: JComponent?) {
|
||||
lateinit var beforeRunStepsPlaceholder: Placeholder
|
||||
|
||||
@JvmField
|
||||
val panel = panel {
|
||||
val panel: DialogPanel = panel {
|
||||
row {
|
||||
isAllowRunningInParallelCheckBox = checkBox(ExecutionBundle.message("run.configuration.allow.running.parallel.tag"))
|
||||
.resizableColumn()
|
||||
@@ -47,6 +51,10 @@ class ConfigurationSettingsEditorPanel(rcStorage: JComponent?) {
|
||||
componentPlace = cell(JPanel())
|
||||
.align(AlignX.FILL)
|
||||
.component
|
||||
}.apply {
|
||||
if (maximizeEditorHeight) {
|
||||
resizableRow()
|
||||
}
|
||||
}
|
||||
|
||||
beforeRunStepsRow = collapsibleGroup("") {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.BeforeRunTask;
|
||||
@@ -49,12 +49,12 @@ public final class ConfigurationSettingsEditorWrapper extends SettingsEditor<Run
|
||||
// RunConfigurationStorageUi for non-template settings is managed by com.intellij.execution.impl.SingleConfigurationConfigurable
|
||||
if (!project.isDefault() && settings.isTemplate()) {
|
||||
myRCStorageUi = new RunConfigurationStorageUi(project, () -> fireEditorStateChanged());
|
||||
content = new ConfigurationSettingsEditorPanel(myRCStorageUi.createComponent());
|
||||
content = new ConfigurationSettingsEditorPanel(myRCStorageUi.createComponent(), configurationEditor.isMaximizeEditorHeight());
|
||||
myRunOnTargetPanel = new RunOnTargetPanel(settings, this);
|
||||
myRunOnTargetPanel.buildUi(content.targetPanel, null);
|
||||
}
|
||||
else {
|
||||
content = new ConfigurationSettingsEditorPanel(null);
|
||||
content = new ConfigurationSettingsEditorPanel(null, configurationEditor.isMaximizeEditorHeight());
|
||||
myRCStorageUi = null;
|
||||
myRunOnTargetPanel = null;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.options;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -25,12 +25,22 @@ public abstract class SettingsEditor<Settings> implements Disposable {
|
||||
private final Factory<? extends Settings> mySettingsFactory;
|
||||
private CompositeSettingsEditor<Settings> myOwner;
|
||||
private JComponent myEditorComponent;
|
||||
private final boolean myMaximizeEditorHeight;
|
||||
|
||||
/**
|
||||
* @see SettingsEditor#SettingsEditor(Factory, boolean)
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public final boolean isMaximizeEditorHeight() {
|
||||
return myMaximizeEditorHeight;
|
||||
}
|
||||
|
||||
protected abstract void resetEditorFrom(@NotNull Settings s);
|
||||
|
||||
protected abstract void applyEditorTo(@NotNull Settings s) throws ConfigurationException;
|
||||
|
||||
protected abstract @NotNull JComponent createEditor();
|
||||
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static @NotNull JComponent createEditorComponent(@NotNull SettingsEditor<?> editor) {
|
||||
return editor.createEditor();
|
||||
@@ -43,8 +53,20 @@ public abstract class SettingsEditor<Settings> implements Disposable {
|
||||
this(null);
|
||||
}
|
||||
|
||||
|
||||
public SettingsEditor(@Nullable Factory<? extends Settings> settingsFactory) {
|
||||
this(settingsFactory, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maximizeEditorHeight settings are edited in a view. This view might be configured to occupy max possible height, so
|
||||
* settings might be centralized vertically
|
||||
* @see #isMaximizeEditorHeight()
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
protected SettingsEditor(@Nullable Factory<? extends Settings> settingsFactory, boolean maximizeEditorHeight) {
|
||||
mySettingsFactory = settingsFactory;
|
||||
myMaximizeEditorHeight = maximizeEditorHeight;
|
||||
Disposer.register(this, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
|
||||
Reference in New Issue
Block a user