diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeRequestImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeRequestImpl.java index 938c1ee7a42d..e8e17b3c6ed2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeRequestImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeRequestImpl.java @@ -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 diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeTool.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeTool.java index f8a025a3d2d7..489361e9067d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeTool.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/mergeTool/MergeTool.java @@ -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); } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java index b11fea49e374..d86b54d7c5c1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchAction.java @@ -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;