Skip to content

Commit f685f91

Browse files
committed
Bug fixes
1 parent 1bf199b commit f685f91

File tree

8 files changed

+25
-163
lines changed

8 files changed

+25
-163
lines changed

swan_assist/resources/META-INF/plugin.xml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
<idea-plugin>
22
<id>de.fraunhofer.iem.swan.assist</id>
33
<name>SWAN_Assist</name>
4-
<version>1.0</version>
5-
<vendor email="support@yourcompany.com" url="https://www.iem.fraunhofer.de/">Fraunhofer IEM</vendor>
4+
<version>2.0</version>
5+
<vendor email="support@iem.fraunhofer.de" url="https://www.iem.fraunhofer.de/">Fraunhofer IEM</vendor>
66

7-
<description><![CDATA[
8-
IDE support for the identification of configured methods for static analyses<br>
9-
<em>most HTML tags may be used</em>
10-
]]></description>
7+
<description>IDE support for the identification of configured methods for static analyses</description>
118

12-
<change-notes><![CDATA[
13-
Add change notes here.<br>
14-
<em>most HTML tags may be used</em>
15-
]]>
16-
</change-notes>
9+
<change-notes>Initial release of the SWAN_Assist plugin.</change-notes>
1710

1811
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
1912
<idea-version since-build="145.0"/>
@@ -103,22 +96,22 @@
10396
text="View Methods List" >
10497
</action>
10598
<separator/>
106-
<action id="SWAN_Assist.ImportAction" class="de.fraunhofer.iem.swan.assist.actions.ImportAction"
99+
<action id="SWAN_Assist.Editor.ImportAction" class="de.fraunhofer.iem.swan.assist.actions.ImportAction"
107100
text="Import File" icon="PluginIcons.IMPORT_ACTION">
108101
</action>
109-
<action id="SWAN_Assist.ExportAction" class="de.fraunhofer.iem.swan.assist.actions.ExportAction"
110-
text="Export File" icon="PluginIcons.IMPORT_ACTION">
102+
<action id="SWAN_Assist.Editor.ExportAction" class="de.fraunhofer.iem.swan.assist.actions.ExportAction"
103+
text="Export File" icon="PluginIcons.EXPORT_ACTION">
111104
</action>
112105
<separator/>
113-
<action id="SWAN_Assist.LaunchSWANAction"
106+
<action id="SWAN_Assist.Editor.LaunchSWANAction"
114107
class="de.fraunhofer.iem.swan.assist.actions.LaunchSwanAction"
115108
icon="PluginIcons.REFRESH_SWAN"
116109
text="Run/Rerun SWAN">
117110
</action>
118111

119112
<separator/>
120113

121-
<action id="SWAN_Assist.HelpAction"
114+
<action id="SWAN_Assist.Editor.HelpAction"
122115
class="de.fraunhofer.iem.swan.assist.actions.HelpAction"
123116
text="Help" description="Resources" icon="PluginIcons.HELP_ACTION">
124117
</action>

swan_assist/src/de/fraunhofer/iem/swan/assist/comm/FilterNotifier.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package de.fraunhofer.iem.swan.assist.comm;
22

33
import com.intellij.util.messages.Topic;
4+
import javafx.util.Pair;
45

56
/**
67
* Notification events for filters.
@@ -11,5 +12,5 @@ public interface FilterNotifier {
1112

1213
Topic<FilterNotifier> FILTER_SELECTED_TOPIC = Topic.create("Filter Selected",FilterNotifier.class);
1314

14-
void updateFilter(String value);
15+
void updateFilter(Pair<String, String> value);
1516
}

swan_assist/src/de/fraunhofer/iem/swan/assist/data/JSONFileComparator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package de.fraunhofer.iem.swan.assist.data;
22

3+
import de.fraunhofer.iem.swan.assist.util.Constants;
4+
35
import java.util.HashMap;
46
import java.util.Set;
57
import java.util.stream.Collectors;
@@ -33,21 +35,21 @@ public HashMap<String, MethodWrapper> compareJSONFile() {
3335
.filter(method -> !updatedList.keySet().contains(method))
3436
.collect(Collectors.toSet());
3537

36-
//Determine methods that were deleted
38+
//Determine methods that were added
3739
Set<String> addedMethods = updatedList.keySet().stream()
3840
.filter(method -> !originalList.keySet().contains(method))
3941
.collect(Collectors.toSet());
4042

4143
for (String methodSignature : deletedMethods) {
4244

4345
MethodWrapper method = originalList.get(methodSignature);
44-
// method.setUpdateOperation(Constants.METHOD_DELETED);
46+
method.setUpdateOperation(Constants.METHOD_DELETED);
4547
updatedList.put(methodSignature, method);
4648
}
4749

4850
for (String methodSignature : addedMethods) {
4951
MethodWrapper method = updatedList.get(methodSignature);
50-
// method.setUpdateOperation(Constants.METHOD_ADDED);
52+
method.setUpdateOperation(Constants.METHOD_ADDED);
5153
updatedList.replace(methodSignature, method);
5254
}
5355

swan_assist/src/de/fraunhofer/iem/swan/assist/ui/CategoryRenderer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public Component getListCellRendererComponent(JList<? extends Category> list, Ca
2828
}
2929

3030
setIcon(IconUtils.getIcon(category.toString()));
31-
setText(Formatter.capitalizeFirstCharacter(category.toString()));
31+
setText(Formatter.toTitleCase(category.toString()));
3232
setBorder(BorderFactory.createEmptyBorder(3, 4, 2, 0));
3333
setOpaque(true);
3434

swan_assist/src/de/fraunhofer/iem/swan/assist/ui/MethodTreeRenderer.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
package de.fraunhofer.iem.swan.assist.ui;
22

33
import com.intellij.ui.JBColor;
4+
import de.fraunhofer.iem.swan.assist.data.InfoBank;
45
import de.fraunhofer.iem.swan.assist.data.MethodWrapper;
56
import de.fraunhofer.iem.swan.assist.util.Constants;
67
import de.fraunhofer.iem.swan.assist.util.Formatter;
8+
import de.fraunhofer.iem.swan.data.CWE;
79
import de.fraunhofer.iem.swan.data.Category;
810
import icons.IconUtils;
911

1012
import javax.swing.*;
1113
import javax.swing.tree.DefaultMutableTreeNode;
1214
import javax.swing.tree.TreeCellRenderer;
1315
import java.awt.*;
16+
import java.util.ArrayList;
1417

1518
/**
1619
* Rendering options for a method in the list.
@@ -30,7 +33,6 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
3033
else
3134
text.setForeground(JBColor.BLACK);
3235

33-
3436
if (value instanceof DefaultMutableTreeNode) {
3537
Object object = ((DefaultMutableTreeNode) value).getUserObject();
3638

@@ -40,9 +42,9 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, boolean
4042
text.setText("<html>" + Formatter.trimProperty(method.getMethodName(false)) + " ( ) <font color='gray'>" + Formatter.trimProperty(method.getReturnType(false)) + "</font></html>");
4143
text.setIcon(IconUtils.getNodeIcon(method.getTypesList(false)));
4244

43-
if (method.getUpdateOperation() != null && method.getUpdateOperation().equals(Constants.METHOD_ADDED))
45+
if (method.getUpdateOperation() != null && method.getUpdateOperation().equals(Constants.METHOD_ADDED) && !selected)
4446
text.setForeground(new JBColor(new Color(1, 128, 0), new Color(1, 128, 0)));
45-
else if (method.getUpdateOperation() != null && method.getUpdateOperation().equals(Constants.METHOD_DELETED))
47+
else if (method.getUpdateOperation() != null && method.getUpdateOperation().equals(Constants.METHOD_DELETED) && !selected)
4648
text.setForeground(new JBColor(new Color(178, 34, 34), new Color(178, 34, 34)));
4749

4850
text.setToolTipText(method.getMethodName(true));
@@ -59,9 +61,6 @@ else if (method.getUpdateOperation() != null && method.getUpdateOperation().equa
5961
text.setIcon(null);
6062
}
6163
}
62-
6364
return text;
6465
}
65-
66-
6766
}

swan_assist/src/de/fraunhofer/iem/swan/assist/ui/dialog/Summary.form

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

swan_assist/src/de/fraunhofer/iem/swan/assist/ui/dialog/Summary.java

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

swan_assist/src/de/fraunhofer/iem/swan/assist/util/Constants.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@ public class Constants {
1414
public final static ResourceBundle resource = ResourceBundle.getBundle("dialog_messages");
1515

1616
//TODO update link to point to online help resources that will be created
17-
public final static String HELP_LINK = "https://github.com/Sable/soot";
18-
17+
public final static String HELP_LINK = "https://github.com/secure-software-engineering/swan";
1918

2019
//SWAN arguments
2120
public final static String SWAN_TRAIN_DIR = "train_dir";
2221
public final static String SWAN_SOURCE_DIR = "source_dir"; //Test Library (or the project)
2322
public final static String SWAN_CONFIG_FILE = "configuration_file";
2423
public final static String SWAN_OUTPUT_DIR = "output_dir";
25-
public final static String SWAN_JAR_DIR = "swan_jar";
24+
public final static String SWAN_JAR_DIR = "swan_core.jar";
2625
public final static String SWAN_OUTPUT_FILE = "output_file";
2726
public final static String SWAN_OUTPUT_LOG = "output_logs";
2827
public final static String SWAN_OUTPUT_MESSAGE = "output_message";
@@ -38,28 +37,7 @@ public class Constants {
3837
//Update operations
3938
public final static String METHOD_DELETED = "deleted";
4039
public final static String METHOD_ADDED = "added";
41-
public final static String METHOD_CHANGED = "changed";
42-
public final static String MSG_METHOD_RESTORED = "The method was restored.";
43-
44-
public final static String NOTIFICATION_START_SWAN ="SWAN refresh started";
45-
public final static String NOTIFICATION_END_SWAN_SUCCESS ="SWAN execution completed";
46-
public final static String NOTIFICATION_END_SWAN_FAIL ="There was an error";
47-
public final static String NOTIFICATION_NONE ="No new notifications";
48-
public final static String NOTIFICATION_SWAN ="View results";
49-
50-
public final static String TREE_EMPTY = "Select a configuration file using the \"Import\" button";
51-
public final static String TREE_FILTERS_EMPTY = "No methods match the filters you've selected";
52-
public final static String SWAN_TRAIN_DIR_NAME = "training_libs";
53-
public final static String SWAN_JAR_NAME = "swan.jar";
54-
55-
public final static String LAUNCHER_PATH_NOT_SELECTED = "A path was not selected for one of the fields.";
56-
57-
//Dialog titles
58-
public final static String TITLE_ADD_METHOD = "Add Method";
59-
public final static String TITLE_UPDATE_METHOD = "Update Method";
60-
public final static String TITLE_DELETE_METHOD = "Delete Method";
61-
public final static String TITLE_METHOD_PROPERTIES = "Method Properties";
62-
public final static String TITLE_RESTORE_METHOD = "Restore Method";
40+
public final static String TRAINING_METHOD = "manual";
6341

6442
//Notification titles/strings
6543
public final static String PLUGIN_GROUP_DISPLAY_ID = "SWAN_Assist";

0 commit comments

Comments
 (0)