From 91b15fe85e1ef7dbc8b254476715c5a8d9b41fa5 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Fri, 31 Aug 2012 15:05:43 +0400 Subject: [PATCH] Refreshing icons on receiving externalAnnotationsChangedExternally event. --- idea/src/META-INF/plugin.xml | 3 ++ .../KotlinSignatureInJavaMarkerUpdater.java | 42 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 idea/src/org/jetbrains/jet/plugin/codeInsight/ktSignature/KotlinSignatureInJavaMarkerUpdater.java diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index daacc07ec9c..ea3bdc60522 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -29,6 +29,9 @@ org.jetbrains.jet.plugin.OutdatedKotlinRuntimeNotification + + org.jetbrains.jet.plugin.codeInsight.ktSignature.KotlinSignatureInJavaMarkerUpdater + diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/ktSignature/KotlinSignatureInJavaMarkerUpdater.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/ktSignature/KotlinSignatureInJavaMarkerUpdater.java new file mode 100644 index 00000000000..e67a8cc12c8 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/ktSignature/KotlinSignatureInJavaMarkerUpdater.java @@ -0,0 +1,42 @@ +/* + * 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.ktSignature; + +import com.intellij.codeInsight.ExternalAnnotationsListener; +import com.intellij.codeInsight.ExternalAnnotationsManager; +import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.project.Project; + +/** + * @author Evgeny Gerashchenko + * @since 31 August 2012 + */ +public class KotlinSignatureInJavaMarkerUpdater extends AbstractProjectComponent { + protected KotlinSignatureInJavaMarkerUpdater(Project project) { + super(project); + } + + @Override + public void initComponent() { + myProject.getMessageBus().connect().subscribe(ExternalAnnotationsManager.TOPIC, new ExternalAnnotationsListener.Adapter() { + @Override + public void externalAnnotationsChangedExternally() { + KotlinSignatureUtil.refreshMarkers(myProject); + } + }); + } +}