]> gerrit.simantics Code Review - simantics/platform.git/blob
ba5de128fc2fe8c14c0067c1fbedcc2d23a763d0
[simantics/platform.git] /
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.swt.widgets.Shell;
7 import org.simantics.scl.compiler.commands.CommandSessionImportEntry;
8 import org.simantics.scl.ui.imports.ImportModulesAction;
9
10 public class BasicImportModulesAction extends ImportModulesAction {
11     
12     public static final BasicImportModulesAction INSTANCE = new BasicImportModulesAction();
13             
14     public BasicImportModulesAction() {
15         super("Add modules", 0.0);
16     }
17
18     @Override
19     public boolean editImports(Shell shell, ArrayList<CommandSessionImportEntry> imports) {
20         SCLModuleSelectionDialog dialog = new SCLModuleSelectionDialog(shell);
21         if(dialog.open() == Dialog.OK) {
22             for(Object r : dialog.getResult()) {
23                 new CommandSessionImportEntry((String)r, "", true).addTo(imports);
24             }
25             return true;
26         }
27         else
28             return false;
29     }
30
31 }