mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-55521 merge: add verbose logging
This commit is contained in:
+7
@@ -100,6 +100,13 @@ public class MergeRequestImpl extends MergeRequest {
|
||||
myDiffContents[0] = left;
|
||||
myDiffContents[1] = base;
|
||||
myDiffContents[2] = right;
|
||||
|
||||
if (MergeTool.LOG.isDebugEnabled()) {
|
||||
VirtualFile file = base.getFile();
|
||||
MergeTool.LOG.debug(new Throwable(base.getClass() + " - writable: " + base.getDocument().isWritable() + ", contentType: " +
|
||||
base.getContentType() + ", file: " + (file != null ? "valid - " + file.isValid() : "null") +
|
||||
", presentation: " + myOkButtonPresentation + "-" + myCancelButtonPresentation));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.diff.impl.mergeTool;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.DiffContent;
|
||||
import com.intellij.openapi.diff.DiffRequest;
|
||||
import com.intellij.openapi.diff.DiffTool;
|
||||
@@ -29,11 +30,16 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.awt.*;
|
||||
|
||||
public class MergeTool implements DiffTool {
|
||||
public static final Logger LOG = Logger.getInstance(MergeTool.class);
|
||||
|
||||
public void show(DiffRequest data) {
|
||||
if (data instanceof MergeRequestImpl) {
|
||||
showDialog((MergeRequestImpl)data);
|
||||
return;
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(new Throwable("MergeTool - frame"));
|
||||
}
|
||||
FrameWrapper frameWrapper = new FrameWrapper(data.getProject(), data.getGroupKey());
|
||||
DiffViewer mergePanel = createMergeComponent(data, null, frameWrapper);
|
||||
frameWrapper.setComponent(mergePanel.getComponent());
|
||||
@@ -51,6 +57,9 @@ public class MergeTool implements DiffTool {
|
||||
}
|
||||
|
||||
private static void showDialog(MergeRequestImpl data) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("MergeTool - dialog");
|
||||
}
|
||||
DialogBuilder builder = new DialogBuilder(data.getProject());
|
||||
builder.setDimensionServiceKey(data.getGroupKey());
|
||||
builder.setTitle(data.getWindowTitle());
|
||||
@@ -82,6 +91,9 @@ public class MergeTool implements DiffTool {
|
||||
|
||||
@Override
|
||||
public DiffViewer createComponent(String title, DiffRequest request, Window window, @NotNull Disposable parentDisposable) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug(new Throwable("MergeTool - component: " + request.getContents()[1].getDocument().isWritable()));
|
||||
}
|
||||
return createMergeComponent(request, null, parentDisposable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.*;
|
||||
import com.intellij.openapi.diff.impl.external.DiffManagerImpl;
|
||||
import com.intellij.openapi.diff.impl.mergeTool.MergeTool;
|
||||
import com.intellij.openapi.diff.impl.patch.*;
|
||||
import com.intellij.openapi.diff.impl.patch.apply.ApplyFilePatch;
|
||||
import com.intellij.openapi.diff.impl.patch.apply.ApplyFilePatchBase;
|
||||
@@ -286,8 +288,21 @@ public class ApplyPatchAction extends DumbAwareAction {
|
||||
if (fileContent == null || content == null) {
|
||||
return ApplyPatchStatus.FAILURE;
|
||||
}
|
||||
|
||||
if (MergeTool.LOG.isDebugEnabled()) {
|
||||
MergeTool.LOG.debug("ApplyPatch: project: " + project + ", document: " + document + ", file.valid: " + file.isValid() +
|
||||
", fileType: " + file.getFileType() + (document != null ? ", writable: " + document.isWritable() : ""));
|
||||
}
|
||||
|
||||
final MergeRequest request = mergeRequestFactory.createMergeRequest(fileContent.toString(), patchedContent, content.toString(), file,
|
||||
project, reverse, leftPanelTitle, rightPanelTitle);
|
||||
|
||||
if (MergeTool.LOG.isDebugEnabled()) {
|
||||
DiffContent baseContent = request.getContents()[1];
|
||||
MergeTool.LOG.debug("ApplyPatch: base content: " + baseContent.getClass() + ", writable: " + baseContent.getDocument().isWritable());
|
||||
MergeTool.LOG.debug("Custom DiffTools: " + DiffManagerImpl.getInstanceEx().getAdditionTools());
|
||||
}
|
||||
|
||||
DiffManager.getInstance().getDiffTool().show(request);
|
||||
if (request.getResult() == DialogWrapper.OK_EXIT_CODE) {
|
||||
return ApplyPatchStatus.SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user