1 package com.xaraya.wizard;
3 import org.eclipse.core.resources.IFile;
4 import org.eclipse.core.resources.IFolder;
5 import org.eclipse.jface.viewers.IStructuredSelection;
6 import org.eclipse.ui.IWorkbench;
7 import org.eclipse.ui.IWorkbenchPage;
8 import org.eclipse.ui.IWorkbenchWindow;
9 import org.eclipse.ui.ide.IDE;
10 import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
12 public class NewXarayaResourceWizard extends BasicNewResourceWizard {
14 private XarayaModuleContainerPage mainPage; //get where to place resource and module name
15 private XarayaModuleFilePage page1; //get first load of details author/email/which files
17 private XarayaVersionModel xvm = new XarayaVersionModel(); //holder for details
19 public NewXarayaResourceWizard() {
21 //initialize static classes that are required..
22 new XarayaModuleText();
23 new XarayaModuleMessages();
26 public void addPages() {
28 mainPage = new XarayaModuleContainerPage(XarayaModuleMessages.getString("Xaraya.label.container"), getSelection());
30 page1 = new XarayaModuleFilePage(XarayaModuleMessages.getString("Xaraya.label.container"));
34 public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
35 super.init(workbench, currentSelection);
36 setWindowTitle(XarayaModuleMessages.getString("Xaraya.label.container"));
37 setNeedsProgressMonitor(true);
40 public boolean performFinish() {
41 page1.saveDataToModel();
42 IFolder folder = mainPage.createNewModuleFolder(); //create the folder for the module
46 Object[] files = mainPage.createNewModuleFiles(); //create the files
48 selectAndReveal(folder);
50 // Open editor on new xaraya init file.
51 IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
53 IWorkbenchPage page = dw.getActivePage();
55 IDE.openEditor(page, (IFile) files[0], true);
56 } catch (Exception e) {