Skip to content

Commit df39caa

Browse files
committed
Add toolkit option
1 parent 33b9aa0 commit df39caa

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

swan-assist/src/main/java/de/fraunhofer/iem/swan/assist/actions/RunSwanAnalysisImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void run(@NotNull ProgressIndicator indicator) {
8585
SwanOptions options = new CliRunner().initializeOptions();
8686
options.setTestDataDir(parameters.get(Constants.SOURCE_DIRECTORY));
8787
options.setOutputDir( parameters.get(Constants.OUTPUT_DIRECTORY));
88-
options.setToolkit("meka");
88+
options.setToolkit(parameters.get(Constants.TOOLKIT).toLowerCase());
8989
options.setPhase("predict");
9090
options.setTrainDataDir("");
9191

swan-assist/src/main/java/de/fraunhofer/iem/swan/assist/ui/dialog/RunAnalysisDialog.form

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,46 @@
148148
</component>
149149
</children>
150150
</grid>
151+
<grid id="7ce0b" binding="toolkitPanel" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
152+
<margin top="0" left="0" bottom="0" right="0"/>
153+
<constraints>
154+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
155+
</constraints>
156+
<properties/>
157+
<border type="none"/>
158+
<children>
159+
<component id="c3485" class="javax.swing.JLabel">
160+
<constraints>
161+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
162+
</constraints>
163+
<properties>
164+
<text resource-bundle="dialog_messages" key="Launcher.Toolkit"/>
165+
</properties>
166+
</component>
167+
<component id="d7cdd" class="javax.swing.JRadioButton" binding="WEKARadioButton" default-binding="true">
168+
<constraints>
169+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
170+
</constraints>
171+
<properties>
172+
<text resource-bundle="dialog_messages" key="Launcher.wekaRadioButton"/>
173+
</properties>
174+
</component>
175+
<component id="7d7a5" class="javax.swing.JRadioButton" binding="MEKARadioButton" default-binding="true">
176+
<constraints>
177+
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
178+
</constraints>
179+
<properties>
180+
<text resource-bundle="dialog_messages" key="Launcher.mekaRadioButton"/>
181+
</properties>
182+
</component>
183+
</children>
184+
</grid>
151185
</children>
152186
</grid>
187+
<buttonGroups>
188+
<group name="toolkit">
189+
<member id="d7cdd"/>
190+
<member id="7d7a5"/>
191+
</group>
192+
</buttonGroups>
153193
</form>

swan-assist/src/main/java/de/fraunhofer/iem/swan/assist/ui/dialog/RunAnalysisDialog.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class RunAnalysisDialog extends DialogWrapper {
4545
private JButton trainButton;
4646
private JPanel trainingPanel;
4747
private JCheckBox trainingPathCheckbox;
48+
private JRadioButton WEKARadioButton;
49+
private JRadioButton MEKARadioButton;
50+
private JPanel toolkitPanel;
4851
private HashMap<String, String> parameters = new HashMap<String, String>();
4952
private ResourceBundle resourceBundle;
5053
private Properties config;
@@ -223,6 +226,11 @@ private void setParameters() {
223226
//set the configuration file to default
224227
parameters.put(Constants.CONFIGURATION_FILE, config.getProperty("swan_default_param_value"));
225228

229+
if(!MEKARadioButton.isSelected()){
230+
parameters.put(Constants.TOOLKIT, MEKARadioButton.getText());
231+
}else{
232+
parameters.put(Constants.TOOLKIT, WEKARadioButton.getText());
233+
}
226234
parameters.put(Constants.SOURCE_DIRECTORY, sourceDirTextbox.getText());
227235
parameters.put(Constants.OUTPUT_DIRECTORY, outputDir.getText());
228236
parameters.put(Constants.OUTPUT_LOG, config.getProperty("log_suffix"));

swan-assist/src/main/java/de/fraunhofer/iem/swan/assist/util/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public class Constants {
3232
public final static String ANALYSIS_RESULT = PLUGIN_ID + "analysisResult";
3333
public final static String TRAIN_FILE_SUGGESTED = PLUGIN_ID + "file_suggested_methods";
3434

35+
public final static String TOOLKIT = "toolkit";
3536
public final static String DEFAULT_TRAINING_PATH = PLUGIN_ID + "defaultTrainingPath";
3637
public final static String PROJECT_CONFIGURATION_FILE = PLUGIN_ID + "defaultConfigurationFile";
3738

swan-assist/src/main/resources/dialog_messages.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,8 @@ CWE601.FullName= URL Redirection to Untrusted Site ('Open Redirect')
116116
CWE862.FullName= Missing Authorization
117117
CWE863.FullName= Incorrect Authorization
118118

119+
Launcher.Toolkit=Toolkit
120+
Launcher.mekaRadioButton=MEKA
121+
Launcher.wekaRadioButton=WEKA
122+
119123

0 commit comments

Comments
 (0)