1 package org.simantics.document.ui.wizard;
5 import org.eclipse.jface.wizard.IWizardPage;
6 import org.eclipse.jface.wizard.Wizard;
7 import org.simantics.db.Resource;
8 import org.simantics.document.FileDocumentUtil;
10 public abstract class FileDocumentImportWizard extends Wizard{
12 FileSelectionPage fileSelectionPage;
14 public FileDocumentImportWizard(Resource lib) {
15 setWindowTitle("Document File import");
16 setNeedsProgressMonitor(false);
19 public abstract Resource getLib();
21 public abstract Resource getRel();
24 public void addPage(IWizardPage page) {
25 addPage(fileSelectionPage = new FileSelectionPage());
29 public boolean performFinish() {
30 final String fileName = fileSelectionPage.getFileName();
31 if (fileName == null || fileName.length() == 0)
33 File file = new File(fileName);
34 if (!file.exists() || !file.canRead())
36 FileDocumentUtil.importFileAsync(fileName, getLib(), getRel());