Skip to content

Commit 8614e60

Browse files
committed
Update SRM completion notification type and text
1 parent 61d6fb9 commit 8614e60

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

dev-assist/src/main/java/de/fraunhofer/iem/devassist/analysis/SwanBackgroundTask.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
import java.io.IOException;
2222
import java.time.LocalDateTime;
2323
import java.time.format.DateTimeFormatter;
24-
import java.util.HashMap;
25-
import java.util.List;
26-
import java.util.Objects;
24+
import java.util.*;
2725

2826
public class SwanBackgroundTask extends Task.Backgroundable {
2927

@@ -61,9 +59,8 @@ public void run(@NotNull ProgressIndicator indicator) {
6159
throw new RuntimeException(e);
6260
}
6361

64-
duration = System.currentTimeMillis() - start;
65-
int m = (int) (((duration / 1000) / 60) % 60);
66-
int s = (int) ((duration / 1000) % 60);
62+
duration = (int) ((System.currentTimeMillis() - start)/ 1000);
63+
6764

6865
indicator.setText("Exporting SRMs");
6966
String filename = Objects.requireNonNull(PropertiesComponent.getInstance(project).getValue(Constants.OUTPUT_DIRECTORY)) + File.separator + "srm-" + getCurrentTimestamp() + ".json";
@@ -80,8 +77,13 @@ public void run(@NotNull ProgressIndicator indicator) {
8077

8178
PropertiesComponent.getInstance(project).setValue(Constants.LAST_SRM_LIST, filename);
8279
results.put(Constants.OUTPUT_FILE, filename);
80+
File outputFile = new File(filename);
81+
8382
results.put(Constants.OUTPUT_LOG, "");
84-
results.put(Constants.ANALYSIS_RESULT, srmList.getMethods().size() + " methods found in " + m + " mins " + s + " secs");
83+
results.put(Constants.ANALYSIS_RESULT,
84+
srmList.getMethods().stream().filter(n -> !n.isKnown()).count()
85+
+ " SRMs found in " + duration + "s and exported to "
86+
+ outputFile.getName());
8587

8688
MessageBus messageBus = project.getMessageBus();
8789
SwanNotifier publisher = messageBus.syncPublisher(SwanNotifier.END_SWAN_PROCESS_TOPIC);

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,10 @@ public void launchSwan(HashMap<String, String> values) {
375375

376376
JSONFileLoader.setReloading(false);
377377

378-
String notificationContent = "SRM List updated";
379-
NotificationGroupManager.getInstance().getNotificationGroup("Process_Completed").createNotification(notificationContent, NotificationType.INFORMATION).notify(project);
378+
NotificationGroupManager.getInstance()
379+
.getNotificationGroup("SRM Notification")
380+
.createNotification(values.get(Constants.ANALYSIS_RESULT), NotificationType.INFORMATION)
381+
.notify(project);
380382

381383
ConfigurationFileNotifier fileNotifier = bus.syncPublisher(ConfigurationFileNotifier.FILE_NOTIFIER_TOPIC);
382384
fileNotifier.loadUpdatedFile(values.get(Constants.OUTPUT_FILE));
@@ -585,7 +587,7 @@ private void loadMethods() {
585587
if (method.getMethod().isKnown()) {
586588
method.setTrainingMethod(true);
587589
standardSrms.add(classNode);
588-
}else{
590+
} else {
589591
currentProject.add(classNode);
590592
}
591593
}
@@ -597,7 +599,7 @@ private void loadMethods() {
597599
currentProject.setUserObject("<html><b>" + project.getName() + "</b> <font color='gray'>(" + currentProject.getLeafCount() + " in " + currentProject.getChildCount() + " classes)</font></html>");
598600
root.add(currentProject);
599601

600-
standardSrms.setUserObject("<html><b>Known SRMs</b> <font color='gray'>(" + standardSrms.getLeafCount() + " in " + standardSrms.getChildCount()+ " classes)</font></html>");
602+
standardSrms.setUserObject("<html><b>Known SRMs</b> <font color='gray'>(" + standardSrms.getLeafCount() + " in " + standardSrms.getChildCount() + " classes)</font></html>");
601603
root.add(standardSrms);
602604

603605
treeModel.setRoot(root);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
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"/>
2525
<notificationGroup id="Process_Completed" displayType="TOOL_WINDOW"/>
26+
<notificationGroup id="SRM Notification" displayType="BALLOON"/>
2627
</extensions>
2728

2829
<actions>

0 commit comments

Comments
 (0)