1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2006</p>
22 * <p>Company: OntoText Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.repository.ui.wizards;
26
27 import java.util.Iterator;
28
29 import org.eclipse.core.resources.IFile;
30 import org.eclipse.jface.viewers.IStructuredSelection;
31 import org.eclipse.jface.viewers.StructuredSelection;
32 import org.eclipse.jface.wizard.Wizard;
33 import org.eclipse.ui.IEditorPart;
34 import org.eclipse.ui.PlatformUI;
35 import org.wsmostudio.repository.ui.RepositoryEditor;
36
37 /***
38 * This wizard supports exporting wsml resources from the workspace to a certain
39 * repository.
40 *
41 * @author not attributable
42 * @version $Revision: 469 $ $Date: 2006-01-09 14:51:14 +0200 $
43 */
44
45 public class ExportEntitiesWizard extends Wizard {
46
47 ExportEntitiesWizardPage mainPage;
48
49 public ExportEntitiesWizard() {
50 super();
51 setWindowTitle("Import Resources in Repository");
52 }
53
54 public void addPages() {
55 mainPage = new ExportEntitiesWizardPage(new StructuredSelection());
56 addPage(mainPage);
57 }
58
59 public boolean performFinish() {
60 IStructuredSelection sel = mainPage.getFileSelection();
61 if (sel == null
62 || sel.size() == 0) {
63 return false;
64 }
65
66 IEditorPart part = PlatformUI.getWorkbench()
67 .getActiveWorkbenchWindow()
68 .getActivePage()
69 .getActiveEditor();
70 if (false == part instanceof RepositoryEditor) {
71 return false;
72 }
73 RepositoryEditor repEditor = (RepositoryEditor)part;
74 for (Iterator it = sel.iterator(); it.hasNext();) {
75 if (false == repEditor.addResourceFromFile((IFile)it.next())) {
76 return false;
77 }
78 }
79 return true;
80 }
81 }
82
83
84
85
86
87
88
89
90
91