Skip to content

Commit 3b9f03e

Browse files
authored
Merge pull request #79 from rohithsh/develop
Replace deprecated NotificationGroup and ContentFactory methods
2 parents 79c8cf3 + ded2bc4 commit 3b9f03e

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

dev-assist/src/main/java/de/fraunhofer/iem/devassist/actions/ExportAction.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
*/
2929

3030
public class ExportAction extends AnAction {
31-
32-
private static final NotificationGroup TOOL_GROUP = new NotificationGroup(Constants.PLUGIN_GROUP_DISPLAY_ID,
33-
NotificationDisplayType.TOOL_WINDOW, true);
3431
/**
3532
* Obtains list of methods and creates new JSON file in the location specified by the user.
3633
*
@@ -72,8 +69,9 @@ public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
7269
try {
7370
exportFile.writeToJsonFile(JSONFileLoader.getMethods(), filePath);
7471

75-
Notification analysisCompleted = TOOL_GROUP.createNotification("", JSONFileLoader.getMethods().size() + " methods exported to: " + filePath, NotificationType.INFORMATION);
76-
Notifications.Bus.notify(analysisCompleted, project);
72+
String notificationContent = JSONFileLoader.getMethods().size() + " methods exported to: " + filePath;
73+
NotificationGroupManager.getInstance().getNotificationGroup("Process_Completed").createNotification(notificationContent, NotificationType.INFORMATION).notify(project);
74+
7775

7876
} catch (IOException e) {
7977
e.printStackTrace();

dev-assist/src/main/java/de/fraunhofer/iem/devassist/ui/MethodListTree.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ public class MethodListTree extends Tree {
7171
private ResourceBundle resource;
7272
public static boolean TREE_EXPANDED;
7373

74-
private static final NotificationGroup TOOL_GROUP = new NotificationGroup(Constants.PLUGIN_GROUP_DISPLAY_ID,
75-
NotificationDisplayType.TOOL_WINDOW, true);
7674

7775
/**
7876
* Initialises method list tree
@@ -377,8 +375,8 @@ public void launchSwan(HashMap<String, String> values) {
377375

378376
JSONFileLoader.setReloading(false);
379377

380-
Notification analysisCompleted = TOOL_GROUP.createNotification("", "SRM List updated", NotificationType.INFORMATION);
381-
Notifications.Bus.notify(analysisCompleted, project);
378+
String notificationContent = "SRM List updated";
379+
NotificationGroupManager.getInstance().getNotificationGroup("Process_Completed").createNotification(notificationContent, NotificationType.INFORMATION).notify(project);
382380

383381
ConfigurationFileNotifier fileNotifier = bus.syncPublisher(ConfigurationFileNotifier.FILE_NOTIFIER_TOPIC);
384382
fileNotifier.loadUpdatedFile(values.get(Constants.OUTPUT_FILE));
@@ -389,10 +387,8 @@ public void launchSwan(HashMap<String, String> values) {
389387
bus.connect().subscribe(SecucheckNotifier.END_SECUCHECK_PROCESS_TOPIC, new SecucheckNotifier() {
390388
@Override
391389
public void launchSecuCheck() {
392-
Notification analysisCompleted = TOOL_GROUP.createNotification("",
393-
"SecuCheck results exported to "+PropertiesComponent.getInstance(project).getValue(Constants.OUTPUT_DIRECTORY),
394-
NotificationType.INFORMATION);
395-
Notifications.Bus.notify(analysisCompleted, project);
390+
String notificationContent = "SecuCheck results exported to "+PropertiesComponent.getInstance(project).getValue(Constants.OUTPUT_DIRECTORY);
391+
NotificationGroupManager.getInstance().getNotificationGroup("Process_Completed").createNotification(notificationContent, NotificationType.INFORMATION).notify(project);
396392
}
397393
});
398394

dev-assist/src/main/java/de/fraunhofer/iem/devassist/ui/SummaryToolWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
6969
}
7070

7171
//Add Content to ToolWindow
72-
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
72+
ContentFactory contentFactory = ContentFactory.getInstance();
7373
Content toolContent = contentFactory.createContent(toolPanel, "", false);
7474
toolWindow.getContentManager().addContent(toolContent);
7575
}

dev-assist/src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<codeInsight.lineMarkerProvider language="JAVA"
2323
implementationClass="de.fraunhofer.iem.devassist.ui.markers.ErrorLineMarker"/>
2424
<toolWindow id="Dev-Assist" anchor="right" factoryClass="de.fraunhofer.iem.devassist.ui.SummaryToolWindow" icon="PluginIcons.DEV_ASSIST"/>
25+
<notificationGroup id="Process_Completed" displayType="TOOL_WINDOW"/>
2526
</extensions>
2627

2728
<actions>

0 commit comments

Comments
 (0)