mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs]: IDEA-154192 improve ok action enabled status for Unshelve Changes dialog; cleanUp;
This commit is contained in:
committed by
Nadya Zabrodina
parent
55da3bcd9a
commit
e9bcb80a39
+12
-5
@@ -60,7 +60,6 @@ import com.intellij.ui.*;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -196,7 +195,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
myReset = myCanChangePatchFile ? this::reset : EmptyRunnable.getInstance();
|
||||
|
||||
myChangeListChooser = new ChangeListChooserPanel(project, errorMessage -> {
|
||||
setOKActionEnabled(errorMessage == null);
|
||||
setOKActionEnabled(errorMessage == null && isChangeTreeEnabled());
|
||||
setErrorText(errorMessage);
|
||||
});
|
||||
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
|
||||
@@ -244,7 +243,15 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
private void updateOkActions() {
|
||||
setOKActionEnabled(!myChangesTreeList.getIncludedChanges().isEmpty());
|
||||
boolean changeTreeEnabled = isChangeTreeEnabled();
|
||||
setOKActionEnabled(changeTreeEnabled);
|
||||
if (changeTreeEnabled) {
|
||||
myChangeListChooser.updateEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isChangeTreeEnabled() {
|
||||
return !myChangesTreeList.getIncludedChanges().isEmpty();
|
||||
}
|
||||
|
||||
private void queueRequest() {
|
||||
@@ -371,6 +378,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
myReader = patchReader;
|
||||
updateTree(true);
|
||||
paintBusy(false);
|
||||
updateOkActions();
|
||||
}, ModalityState.stateForComponent(myCenterPanel));
|
||||
}
|
||||
}
|
||||
@@ -519,8 +527,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
|
||||
protected DefaultTreeModel buildTreeModel(List<AbstractFilePatchInProgress.PatchChange> changes,
|
||||
ChangeNodeDecorator changeNodeDecorator) {
|
||||
TreeModelBuilder builder = new TreeModelBuilder(myProject, isShowFlatten());
|
||||
return builder.buildModel(ObjectsConvertor.convert(changes,
|
||||
(Convertor<AbstractFilePatchInProgress.PatchChange, Change>)o -> o), changeNodeDecorator);
|
||||
return builder.buildModel(ObjectsConvertor.convert(changes, o -> o), changeNodeDecorator);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ public class ChangeListChooserPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateEnabledItems() {
|
||||
public void updateEnabled() {
|
||||
if (myProject != null) {
|
||||
myListPanel.nameChangedImpl(myProject, null);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class ChangeListChooserPanel extends JPanel {
|
||||
myExistingListsCombo.setSelectedItem(defaultSelection.getName());
|
||||
}
|
||||
updateDescription();
|
||||
updateEnabledItems();
|
||||
updateEnabled();
|
||||
}
|
||||
|
||||
private void updateDescription() {
|
||||
|
||||
Reference in New Issue
Block a user