diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 6d0d3331f2f..434b3f38bd4 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -63,7 +63,10 @@
-
+
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/KotlinSignatureInJavaMarkerProvider.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/KotlinSignatureInJavaMarkerProvider.java
index 08c1220e165..53a3cde389d 100644
--- a/idea/src/org/jetbrains/jet/plugin/codeInsight/KotlinSignatureInJavaMarkerProvider.java
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/KotlinSignatureInJavaMarkerProvider.java
@@ -17,11 +17,14 @@
package org.jetbrains.jet.plugin.codeInsight;
import com.intellij.codeHighlighting.Pass;
+import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProvider;
import com.intellij.codeInsight.navigation.NavigationUtil;
+import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.util.Function;
@@ -40,6 +43,8 @@ import java.util.List;
* @since 3 August 2012
*/
public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
+ private static final String SHOW_MARKERS_PROPERTY = "kotlin.signature.markers.enabled";
+
private static final Function TOOLTIP_PROVIDER = new Function() {
@Override
public String fun(PsiElement element) {
@@ -112,7 +117,7 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
@Override
@Nullable
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) {
- if (findKotlinSignatureAnnotation(element) != null) {
+ if (isMarkersEnabled(element.getProject()) && findKotlinSignatureAnnotation(element) != null) {
return new LineMarkerInfo((PsiMethod) element, element.getTextOffset(), JetIcons.SMALL_LOGO, Pass.UPDATE_ALL,
TOOLTIP_PROVIDER, NAVIGATION_HANDLER);
}
@@ -122,4 +127,13 @@ public class KotlinSignatureInJavaMarkerProvider implements LineMarkerProvider {
@Override
public void collectSlowLineMarkers(@NotNull List elements, @NotNull Collection result) {
}
+
+ public static boolean isMarkersEnabled(@NotNull Project project) {
+ return PropertiesComponent.getInstance(project).getBoolean(SHOW_MARKERS_PROPERTY, true);
+ }
+
+ public static void setMarkersEnabled(@NotNull Project project, boolean value) {
+ PropertiesComponent.getInstance(project).setValue(SHOW_MARKERS_PROPERTY, Boolean.toString(value));
+ DaemonCodeAnalyzer.getInstance(project).restart();
+ }
}
diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/ShowKotlinSignaturesAction.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/ShowKotlinSignaturesAction.java
new file mode 100644
index 00000000000..62cf12b342c
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/ShowKotlinSignaturesAction.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2012 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 org.jetbrains.jet.plugin.codeInsight;
+
+import com.intellij.lang.java.JavaLanguage;
+import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.LangDataKeys;
+import com.intellij.openapi.actionSystem.ToggleAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiFile;
+
+public class ShowKotlinSignaturesAction extends ToggleAction {
+ public ShowKotlinSignaturesAction() {
+ super("Show Kotlin Signatures");
+ }
+
+ @Override
+ public boolean isSelected(AnActionEvent e) {
+ Project project = e.getProject();
+ return project != null && KotlinSignatureInJavaMarkerProvider.isMarkersEnabled(project);
+ }
+
+ @Override
+ public void update(AnActionEvent e) {
+ super.update(e);
+ e.getPresentation().setVisible(false);
+ PsiFile psiFile = e.getData(LangDataKeys.PSI_FILE);
+ if (psiFile != null && psiFile.getLanguage() == JavaLanguage.INSTANCE) {
+ e.getPresentation().setVisible(true);
+ }
+ }
+
+ @Override
+ public void setSelected(AnActionEvent e, boolean state) {
+ Project project = e.getProject();
+ assert project != null;
+ KotlinSignatureInJavaMarkerProvider.setMarkersEnabled(project, state);
+ }
+}