]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
755282e135bc026690f11b389039ebb0b3cf5cfb
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.wizards.functions;\r
2 \r
3 \r
4 import org.eclipse.jface.viewers.IStructuredSelection;\r
5 import org.eclipse.jface.wizard.Wizard;\r
6 import org.eclipse.ui.IImportWizard;\r
7 import org.eclipse.ui.IWorkbench;\r
8 import org.simantics.db.Resource;\r
9 import org.simantics.ui.utils.AdaptionUtils;\r
10 \r
11 \r
12 public class ExportWizardFunction extends Wizard implements IImportWizard {\r
13         \r
14         private WizardFunctionsExportPage mainPage;\r
15         private IStructuredSelection currentSelection = null;\r
16         private String initialPath = null;\r
17         public Resource selection;\r
18 \r
19     /**\r
20      * Constructor for ExternalProjectImportWizard.\r
21      */\r
22     public ExportWizardFunction() {\r
23         this(null);\r
24     }\r
25     \r
26     /**\r
27      * Constructor for ExternalProjectImportWizard.\r
28      */\r
29     public ExportWizardFunction(String initialPath)\r
30     {\r
31         super();\r
32         this.initialPath = initialPath;\r
33     }\r
34  \r
35     public void init(IWorkbench workbench, IStructuredSelection currentSelection) {\r
36         setWindowTitle("Export");\r
37         this.currentSelection = currentSelection;\r
38         selection = (Resource)AdaptionUtils.adaptToSingle(currentSelection, org.simantics.db.Resource.class);\r
39     }\r
40     \r
41     public void addPages() {\r
42         super.addPages();\r
43                 mainPage = new WizardFunctionsExportPage(\r
44                                 "wizardFunctionsExportPage", initialPath, currentSelection); //$NON-NLS-1$\r
45         addPage(mainPage);\r
46     }\r
47 \r
48         @Override\r
49         public boolean performFinish() {\r
50                 return mainPage.createProjects(selection);\r
51         }\r
52 \r
53 }