From 05d5e30cf43641cba91329d888f2702cf4acb5df Mon Sep 17 00:00:00 2001 From: "Natalia.Ukhorskaya" Date: Wed, 28 Aug 2013 14:11:55 +0400 Subject: [PATCH] Add notification to configure kotlin project --- idea/src/META-INF/plugin.xml | 3 ++ ...onConfiguredKotlinProjectNotification.java | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 idea/src/org/jetbrains/jet/plugin/configuration/ui/NonConfiguredKotlinProjectNotification.java diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 4c01187c2a2..7aeeb898dc2 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -26,6 +26,9 @@ org.jetbrains.jet.plugin.versions.OutdatedKotlinRuntimeNotification + + org.jetbrains.jet.plugin.configuration.ui.NonConfiguredKotlinProjectNotification + org.jetbrains.jet.plugin.ktSignature.KotlinSignatureInJavaMarkerUpdater diff --git a/idea/src/org/jetbrains/jet/plugin/configuration/ui/NonConfiguredKotlinProjectNotification.java b/idea/src/org/jetbrains/jet/plugin/configuration/ui/NonConfiguredKotlinProjectNotification.java new file mode 100644 index 00000000000..acb2cb690f8 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/configuration/ui/NonConfiguredKotlinProjectNotification.java @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2013 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.configuration.ui; + +import com.intellij.openapi.components.AbstractProjectComponent; +import com.intellij.openapi.project.DumbService; +import com.intellij.openapi.project.Project; +import com.intellij.util.messages.MessageBusConnection; +import org.jetbrains.jet.plugin.configuration.ConfigureKotlinInProjectUtils; + +public class NonConfiguredKotlinProjectNotification extends AbstractProjectComponent { + + protected NonConfiguredKotlinProjectNotification(Project project) { + super(project); + } + + @Override + public void projectOpened() { + super.projectOpened(); + MessageBusConnection connection = myProject.getMessageBus().connect(); + connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { + @Override + public void enteredDumbMode() { + } + + @Override + public void exitDumbMode() { + ConfigureKotlinInProjectUtils.showConfigureKotlinNotificationIfNeeded(myProject); + } + }); + } +}