diff: add general extension point for diff viewers
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 18 Jun 2015 14:31:49 +0000 (17:31 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 3 Sep 2015 16:28:04 +0000 (19:28 +0300)
platform/diff-api/src/com/intellij/diff/DiffExtension.java [new file with mode: 0644]
platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java
platform/platform-resources/src/META-INF/PlatformExtensionPoints.xml

diff --git a/platform/diff-api/src/com/intellij/diff/DiffExtension.java b/platform/diff-api/src/com/intellij/diff/DiffExtension.java
new file mode 100644 (file)
index 0000000..0c99cbb
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2015 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.
+ */
+package com.intellij.diff;
+
+import com.intellij.diff.requests.DiffRequest;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.CalledInAwt;
+import org.jetbrains.annotations.NotNull;
+
+public abstract class DiffExtension {
+  public static final ExtensionPointName<DiffExtension> EP_NAME = ExtensionPointName.create("com.intellij.diff.DiffExtension");
+
+  @CalledInAwt
+  public abstract void onViewerCreated(@NotNull FrameDiffTool.DiffViewer viewer,
+                                       @NotNull DiffContext context,
+                                       @NotNull DiffRequest request);
+}
index ba9f21e02cfe4a472f00be38f6f71006ef97ce44..56ebb04b01e56e9e5257441e1be1fe556e629187 100644 (file)
@@ -232,6 +232,10 @@ public abstract class DiffRequestProcessor implements Disposable {
 
     DiffViewer viewer = frameTool.createComponent(myContext, myActiveRequest);
 
+    for (DiffExtension extension : DiffExtension.EP_NAME.getExtensions()) {
+      extension.onViewerCreated(viewer, myContext, myActiveRequest);
+    }
+
     DiffViewerWrapper wrapper = myActiveRequest.getUserData(DiffViewerWrapper.KEY);
     if (wrapper == null) {
       return new DefaultState(viewer, frameTool);
index 7de0a299fe52fd7e648a0b4b9b86d8eccdda2c0e..70609a231b33837564257af32fb0fc5418eb55c4 100644 (file)
 
     <extensionPoint qualifiedName="com.intellij.diff.DiffTool" interface="com.intellij.diff.DiffTool"/>
     <extensionPoint qualifiedName="com.intellij.diff.merge.MergeTool" interface="com.intellij.diff.merge.MergeTool"/>
+    <extensionPoint qualifiedName="com.intellij.diff.DiffExtension" interface="com.intellij.diff.DiffExtension"/>
     <extensionPoint name="testStatusListener" interface="com.intellij.execution.testframework.TestStatusListener"/>
 
     <extensionPoint name="runConfigurationBeforeRunProviderDelegate" interface="com.intellij.execution.impl.RunConfigurationBeforeRunProviderDelegate"/>