Call MergeProvider.mergeDone() at a better time; use spaceAndThinSpace

IDEA-CR-32440
This commit is contained in:
Dmitry Jemerov
2018-05-09 17:28:53 +02:00
parent bca0f74cc7
commit cfd37b980a
3 changed files with 12 additions and 17 deletions
@@ -5,6 +5,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.AbstractVcsHelper
import com.intellij.openapi.vcs.changes.ChangesUtil
import com.intellij.ui.SimpleTextAttributes
import com.intellij.util.FontUtil
import java.util.stream.Collectors
/**
@@ -12,7 +13,8 @@ import java.util.stream.Collectors
*/
class ChangesBrowserConflictsNode(val project: Project) : ChangesBrowserNode<Unit>(Unit) {
override fun render(renderer: ChangesBrowserNodeRenderer, selected: Boolean, expanded: Boolean, hasFocus: Boolean) {
renderer.append("Merge Conflicts ", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES)
renderer.append("Merge Conflicts", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES)
renderer.append(FontUtil.spaceAndThinSpace(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES)
renderer.append("Resolve", SimpleTextAttributes.LINK_BOLD_ATTRIBUTES, Runnable { showResolveConflictsDialog() })
}
@@ -497,7 +497,6 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
final MultipleFileMergeDialog fileMergeDialog = new MultipleFileMergeDialog(myProject, files, provider, mergeDialogCustomizer);
AppIcon.getInstance().requestAttention(myProject, true);
fileMergeDialog.show();
provider.mergeDone(files);
return fileMergeDialog.getProcessedFiles();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 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.merge;
@@ -199,6 +185,14 @@ public class MultipleFileMergeDialog extends DialogWrapper {
});
}
@Override
public void doCancelAction() {
if (!myProcessedFiles.isEmpty()) {
myProvider.mergeDone(myProcessedFiles);
}
super.doCancelAction();
}
private void updateButtonState() {
boolean haveSelection = myTable.getSelectedRowCount() > 0;
boolean haveUnmergeableFiles = false;