mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: Add splitter between changes tree and commit panel in "Local Changes" (IDEA-212227)
GitOrigin-RevId: bc9b3a020b11648f5a7e43767c2da636633c4e98
This commit is contained in:
committed by
intellij-monorepo-bot
parent
989faf6663
commit
7a069d9127
+34
@@ -0,0 +1,34 @@
|
||||
// Copyright 2000-2019 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.
|
||||
package com.intellij.openapi.vcs.changes
|
||||
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.ui.OnePixelSplitter
|
||||
import com.intellij.util.ui.update.UiNotifyConnector
|
||||
import javax.swing.JComponent
|
||||
|
||||
private const val CHANGES_VIEW_COMMIT_SPLITTER_PROPORTION = "ChangesViewManager.COMMIT_SPLITTER_PROPORTION"
|
||||
|
||||
private class ChangesViewCommitPanelSplitter : OnePixelSplitter(true, CHANGES_VIEW_COMMIT_SPLITTER_PROPORTION, 1.0f) {
|
||||
private var isDefaultProportionSet = false
|
||||
|
||||
override fun setSecondComponent(component: JComponent?) {
|
||||
if (component != null && !isDefaultProportionSet) {
|
||||
UiNotifyConnector.doWhenFirstShown(this) {
|
||||
isDefaultProportionSet = true
|
||||
proportion = 1.0f - (component.preferredSize.getHeight().toFloat() / height).coerceIn(0.05f, 0.95f)
|
||||
}
|
||||
}
|
||||
super.setSecondComponent(component)
|
||||
}
|
||||
|
||||
override fun loadProportion() {
|
||||
val key = splitterProportionKey
|
||||
isDefaultProportionSet = key != null && PropertiesComponent.getInstance().isValueSet(key)
|
||||
|
||||
if (isDefaultProportionSet) super.loadProportion()
|
||||
}
|
||||
|
||||
override fun saveProportion() {
|
||||
if (isDefaultProportionSet) super.saveProportion()
|
||||
}
|
||||
}
|
||||
@@ -92,6 +92,7 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi
|
||||
@NotNull private final ChangesListView myView;
|
||||
private ChangesViewCommitPanel myCommitPanel;
|
||||
private BorderLayoutPanel myContentPanel;
|
||||
private ChangesViewCommitPanelSplitter myCommitPanelSplitter;
|
||||
private SimpleToolWindowPanel myToolWindowPanel;
|
||||
private ChangesViewCommitWorkflowHandler myCommitWorkflowHandler;
|
||||
private final VcsConfiguration myVcsConfiguration;
|
||||
@@ -202,14 +203,12 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi
|
||||
myCommitWorkflowHandler = new ChangesViewCommitWorkflowHandler(new ChangesViewCommitWorkflow(myProject), myCommitPanel);
|
||||
Disposer.register(myContent, myCommitPanel);
|
||||
|
||||
myContentPanel.addToBottom(myCommitPanel);
|
||||
myContentPanel.validate();
|
||||
myCommitPanelSplitter.setSecondComponent(myCommitPanel);
|
||||
myCommitPanel.setupShortcuts(myToolWindowPanel);
|
||||
}
|
||||
}
|
||||
else if (myCommitPanel != null) {
|
||||
myContentPanel.remove(myCommitPanel);
|
||||
myContentPanel.validate();
|
||||
myCommitPanelSplitter.setSecondComponent(null);
|
||||
Disposer.dispose(myCommitPanel);
|
||||
|
||||
myCommitPanel = null;
|
||||
@@ -223,13 +222,15 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi
|
||||
addBorder(changesToolbar.getComponent(), createBorder(JBColor.border(), SideBorder.RIGHT));
|
||||
BorderLayoutPanel changesPanel = simplePanel(createScrollPane(myView)).addToLeft(changesToolbar.getComponent());
|
||||
|
||||
myCommitPanelSplitter = new ChangesViewCommitPanelSplitter();
|
||||
myCommitPanelSplitter.setFirstComponent(changesPanel);
|
||||
myContentPanel = new BorderLayoutPanel() {
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return isMinimumSizeSet() ? super.getMinimumSize() : changesToolbar.getComponent().getPreferredSize();
|
||||
}
|
||||
};
|
||||
myContentPanel.addToCenter(changesPanel);
|
||||
myContentPanel.addToCenter(myCommitPanelSplitter);
|
||||
|
||||
MyChangeProcessor changeProcessor = new MyChangeProcessor(myProject);
|
||||
mySplitterComponent = new PreviewDiffSplitterComponent(myContentPanel, changeProcessor, CHANGES_VIEW_PREVIEW_SPLITTER_PROPORTION,
|
||||
|
||||
@@ -126,7 +126,7 @@ class ChangesViewCommitPanel(private val changesView: ChangesListView) : BorderL
|
||||
}.withBackground(BACKGROUND_COLOR)
|
||||
val centerPanel = simplePanel(commitMessage).addToBottom(buttonPanel)
|
||||
|
||||
addToCenter(centerPanel).addToLeft(toolbar.component).withBorder(createBorder(JBColor.border(), SideBorder.TOP))
|
||||
addToCenter(centerPanel).addToLeft(toolbar.component)
|
||||
withPreferredHeight(85)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user