]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/imports/internal/ManualImportModulesAction.java
(refs #7524) Set Refresh automatically as default in SCLConsole
[simantics/platform.git] / bundles / org.simantics.scl.ui / src / org / simantics / scl / ui / imports / internal / ManualImportModulesAction.java
1 package org.simantics.scl.ui.imports.internal;
2
3 import java.util.ArrayList;
4
5 import org.eclipse.jface.dialogs.Dialog;
6 import org.eclipse.jface.dialogs.InputDialog;
7 import org.eclipse.swt.widgets.Shell;
8 import org.simantics.scl.compiler.commands.CommandSessionImportEntry;
9 import org.simantics.scl.ui.imports.ImportModulesAction;
10
11 public class ManualImportModulesAction extends ImportModulesAction {
12     
13     public static final ManualImportModulesAction INSTANCE = new ManualImportModulesAction();
14             
15     public ManualImportModulesAction() {
16         super("Add freeform module", 100.0);
17     }
18
19     @Override
20     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
21         InputDialog dialog = new InputDialog(shell, "Select module", "Write the full name of the module",
22                 "", null);
23         if(dialog.open() == Dialog.OK) {
24             new CommandSessionImportEntry(dialog.getValue(), "", true).addTo(imports);
25             return true;
26         }
27         else
28             return false;
29     }
30
31 }