Skip to content

Commit 527deca

Browse files
authored
Update notification (#152)
* Update popup with new text. Deprecation warning fix * Activity instead of Component to avoid deprecation issues
1 parent 8ed8715 commit 527deca

File tree

5 files changed

+49
-73
lines changed

5 files changed

+49
-73
lines changed

graph-database-support-plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@
8282
<interface-class>com.neueda.jetbrains.plugin.graphdb.jetbrains.component.settings.SettingsComponent</interface-class>
8383
<implementation-class>com.neueda.jetbrains.plugin.graphdb.jetbrains.component.settings.SettingsComponentImpl</implementation-class>
8484
</component>
85-
<!-- Update notification -->
86-
<component>
87-
<interface-class>com.neueda.jetbrains.plugin.graphdb.jetbrains.component.updater.GraphDatabaseUpdaterComponent</interface-class>
88-
<implementation-class>com.neueda.jetbrains.plugin.graphdb.jetbrains.component.updater.GraphDatabaseUpdaterComponentImpl</implementation-class>
89-
</component>
9085
<!-- Google analytics component -->
9186
<component>
9287
<interface-class>com.neueda.jetbrains.plugin.graphdb.jetbrains.component.analytics.AnalyticsApplicationComponent</interface-class>
@@ -144,7 +139,8 @@
144139
<scratch.rootType implementation="com.neueda.jetbrains.plugin.graphdb.jetbrains.ui.console.params.ParameterRootType"/>
145140
<applicationConfigurable groupId="tools"
146141
instance="com.neueda.jetbrains.plugin.graphdb.jetbrains.configuration.GraphDatabaseSupportConfiguration"/>
147-
142+
<!-- Update notification -->
143+
<postStartupActivity implementation="com.neueda.jetbrains.plugin.graphdb.jetbrains.component.updater.PluginUpdateActivity" />
148144
<!-- Cypher -->
149145
<fileTypeFactory implementation="com.neueda.jetbrains.plugin.graphdb.language.cypher.file.CypherFileTypeFactory"/>
150146
<lang.parserDefinition

platform/src/main/resources/graphdb/messages/GraphBundle.properties

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
updater.title=Graph Database Support plugin updated to v{0}
2-
updater.notification=<br/>\
3-
<b>New:</b><br/>\
4-
- Now you can query TinkerPop Gremlin-enabled databases<br/>\
5-
like Cosmos DB, Neptune and JanusGraph using Cypher.<br/>\
2+
updater.notification=<b>New:</b> <br/>Now you can query TinkerPop Gremlin-enabled databases \
3+
like Cosmos DB, Neptune and JanusGraph using Cypher.<br/><br/>\
64
<b>Improvements:</b><br/>\
75
- Gremlin support<br/>\
86
- Faster startup when using a number of databases.<br/>\
97
- Graph metadata is refreshed in the background <br/>\
108
- DB connection testing is asynchronous <br/>\
119
- Improved UI <br/>\
12-
- More intuitive graph view zoom <br/>\
10+
- More intuitive graph view zoom <br/><br/>\
1311
<b>Bugfixes:</b><br/>\
1412
- Execute Query button in gutter<br/>\
1513
<br/>\

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/component/updater/GraphDatabaseUpdaterComponent.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

ui/jetbrains/src/main/java/com/neueda/jetbrains/plugin/graphdb/jetbrains/component/updater/GraphDatabaseUpdaterComponentImpl.java

Lines changed: 0 additions & 51 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.neueda.jetbrains.plugin.graphdb.jetbrains.component.updater;
2+
3+
import com.intellij.notification.*;
4+
import com.intellij.openapi.project.DumbAware;
5+
import com.intellij.openapi.project.Project;
6+
import com.intellij.openapi.startup.StartupActivity;
7+
import com.neueda.jetbrains.plugin.graphdb.jetbrains.component.settings.SettingsComponent;
8+
import com.neueda.jetbrains.plugin.graphdb.jetbrains.util.PluginUtil;
9+
import com.neueda.jetbrains.plugin.graphdb.platform.GraphBundle;
10+
import com.neueda.jetbrains.plugin.graphdb.platform.GraphConstants;
11+
import org.jetbrains.annotations.NotNull;
12+
13+
public class PluginUpdateActivity implements StartupActivity, DumbAware {
14+
15+
private static final String NOTIFICATION_ID = "GraphDatabaseSupportUpdateNotification";
16+
private boolean isUpdateNotificationShown = false;
17+
18+
@Override
19+
public void runActivity(@NotNull Project project) {
20+
String currentVersion = PluginUtil.getVersion();
21+
String knownVersion = SettingsComponent.getInstance().getKnownPluginVersion();
22+
23+
boolean isUpdated = !currentVersion.equals(knownVersion);
24+
if (isUpdated || GraphConstants.IS_DEVELOPMENT) {
25+
if (!isUpdateNotificationShown) {
26+
SettingsComponent.getInstance().setKnownPluginVersion(currentVersion);
27+
showNotification(project, currentVersion);
28+
isUpdateNotificationShown = true;
29+
}
30+
}
31+
}
32+
33+
private void showNotification(Project project, String currentVersion) {
34+
NotificationGroup group = new NotificationGroup(NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON, true);
35+
Notification notification = group.createNotification(
36+
GraphBundle.message("updater.title", currentVersion),
37+
GraphBundle.message("updater.notification"),
38+
NotificationType.INFORMATION,
39+
new NotificationListener.UrlOpeningListener(false)
40+
);
41+
Notifications.Bus.notify(notification, project);
42+
}
43+
44+
}

0 commit comments

Comments
 (0)