]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
d68f341ab0c60851d5f8a78e07d5db2b0de94771
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.wizards.models;\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 public class ExportWizardModel extends Wizard implements IImportWizard {\r
12         \r
13         private WizardModelsExportPage mainPage;\r
14         private IStructuredSelection currentSelection = null;\r
15         private String initialPath = null;\r
16         public Resource selection;\r
17 \r
18     /**\r
19      * Constructor for ExternalProjectImportWizard.\r
20      */\r
21     public ExportWizardModel() {\r
22         this(null);\r
23     }\r
24     \r
25     /**\r
26      * Constructor for ExternalProjectImportWizard.\r
27      */\r
28     public ExportWizardModel(String initialPath)\r
29     {\r
30         super();\r
31         this.initialPath = initialPath;\r
32     }\r
33  \r
34     public void init(IWorkbench workbench, IStructuredSelection currentSelection) {\r
35         setWindowTitle("Export");\r
36         this.currentSelection = currentSelection;\r
37         selection = (Resource)AdaptionUtils.adaptToSingle(currentSelection, org.simantics.db.Resource.class);\r
38     }\r
39     \r
40     public void addPages() {\r
41         super.addPages();\r
42                 mainPage = new WizardModelsExportPage(\r
43                                 "wizardModelsExportPage", initialPath, currentSelection); //$NON-NLS-1$\r
44         addPage(mainPage);\r
45     }\r
46 \r
47         @Override\r
48         public boolean performFinish() {\r
49                 return mainPage.createProjects();\r
50         }\r
51 \r
52 }