mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[settingsDialog] IJPL-176500 – top toolbar
GitOrigin-RevId: 36780130731e6a93d0a9e64b2aa155d546271eaa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ec666232a2
commit
0e82cdc08c
+9
-19
@@ -8,13 +8,14 @@ import com.intellij.ide.plugins.newui.EventHandler;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.DataSink;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.openapi.actionSystem.UiCompatibleDataProvider;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.actionSystem.toolbarLayout.ToolbarLayoutStrategy;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogPanel;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.options.advanced.AdvancedSettings;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
@@ -25,6 +26,7 @@ import com.intellij.ui.SearchTextField.FindAction;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
import com.intellij.ui.components.panels.VerticalLayout;
|
||||
import com.intellij.util.ui.*;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.functions.Function1;
|
||||
@@ -45,6 +47,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.openapi.actionSystem.IdeActions.ACTION_FIND;
|
||||
import static com.intellij.openapi.options.newEditor.SettingsDialogExtensionsKt.createEditorToolbar;
|
||||
|
||||
public class SettingsDialog extends DialogWrapper implements UiCompatibleDataProvider {
|
||||
public static final String DIMENSION_KEY = "SettingsEditor";
|
||||
@@ -116,26 +119,13 @@ public class SettingsDialog extends DialogWrapper implements UiCompatibleDataPro
|
||||
protected @Nullable JComponent createTitlePane() {
|
||||
if (!isNonModal())
|
||||
return null;
|
||||
|
||||
ApplyActionWrapper applyActionWrapper = new ApplyActionWrapper(editor.getApplyAction());
|
||||
applyActionWrapper.putValue(DEFAULT_ACTION, "true");
|
||||
Action resetAction = editor.getResetAction();
|
||||
|
||||
|
||||
JPanel panel = new NonOpaquePanel(new GridBagLayout());
|
||||
Insets insets = JBInsets.create(new Insets(8, 16, 8, 16));
|
||||
panel.setBorder(JBUI.Borders.customLineBottom(JBColor.border()));
|
||||
|
||||
|
||||
GridBag bag = new GridBag().setDefaultInsets(insets);
|
||||
panel.add(Box.createHorizontalGlue(), bag.next().weightx(1).fillCellHorizontally()); // left strut
|
||||
JPanel buttonsPanel = createButtonsPanel(List.of(
|
||||
createJButtonForAction(resetAction),
|
||||
createJButtonForAction(applyActionWrapper)
|
||||
));
|
||||
panel.add(buttonsPanel, bag.next());
|
||||
|
||||
return panel;
|
||||
List<Action> actions = List.of(resetAction, applyActionWrapper);
|
||||
DialogPanel toolbar = createEditorToolbar(this, actions);
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
private void init(@Nullable Configurable configurable, @Nullable Project project) {
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// 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.newEditor
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil.getActionGroup
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.openapi.ui.DialogWrapper
|
||||
import com.intellij.ui.dsl.builder.AlignX
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.ui.dsl.gridLayout.UnscaledGaps
|
||||
import java.awt.Dimension
|
||||
import javax.swing.Action
|
||||
|
||||
internal fun SettingsDialog.createEditorToolbar(actions: List<Action>): DialogPanel {
|
||||
val actionGroup = getActionGroup("Back", "Forward");
|
||||
val toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.SETTINGS_HISTORY, actionGroup!!, true)
|
||||
val search = (editor as SettingsEditor).getSearch()
|
||||
search.preferredSize = Dimension(400, search.preferredSize.height)
|
||||
|
||||
return panel {
|
||||
row {
|
||||
cell(toolbar.component)
|
||||
cell(search).resizableColumn()
|
||||
for (i in 0..actions.size-1) {
|
||||
val button = DialogWrapper.createJButtonForAction(actions[i], rootPane)
|
||||
val gaps = if (i==actions.size-1) UnscaledGaps(right = 16) else UnscaledGaps(right = 8)
|
||||
cell(button).align(AlignX.RIGHT).customize(gaps)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -133,7 +133,9 @@ public final class SettingsEditor extends AbstractEditor implements UiDataProvid
|
||||
};
|
||||
|
||||
JPanel searchPanel = new JPanel(new VerticalLayout(0));
|
||||
searchPanel.add(VerticalLayout.CENTER, search);
|
||||
if (!SettingsDialog.isNonModal()) {
|
||||
searchPanel.add(VerticalLayout.CENTER, search);
|
||||
}
|
||||
this.filter = new SettingsFilter(project, groups, search, coroutineScope) {
|
||||
@Override
|
||||
protected Configurable getConfigurable(SimpleNode node) {
|
||||
@@ -318,6 +320,10 @@ public final class SettingsEditor extends AbstractEditor implements UiDataProvid
|
||||
return treeView;
|
||||
}
|
||||
|
||||
SettingsSearch getSearch() {
|
||||
return search;
|
||||
}
|
||||
|
||||
private @NotNull MutableConfigurableGroup.Listener createReloadListener(List<? extends ConfigurableGroup> groups) {
|
||||
return new MutableConfigurableGroup.Listener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user