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.wizards.newresource.BasicNewResourceWizard;
11 public class NewXarayaResourceWizard extends BasicNewResourceWizard {
13 private XarayaModuleContainerPage mainPage; //get where to place resource and module name
14 private XarayaModuleFilePage page1; //get first load of details author/email/which files
16 private XarayaVersionModel xvm = new XarayaVersionModel(); //holder for details
18 public NewXarayaResourceWizard() {
20 //initialize static classes that are required..
21 new XarayaModuleText();
22 new XarayaModuleMessages();
25 public void addPages() {
27 mainPage = new XarayaModuleContainerPage(XarayaModuleMessages.getString("Xaraya.label.container"), getSelection());
29 page1 = new XarayaModuleFilePage(XarayaModuleMessages.getString("Xaraya.label.container"));
33 public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
34 super.init(workbench, currentSelection);
35 setWindowTitle(XarayaModuleMessages.getString("Xaraya.label.container"));
36 setNeedsProgressMonitor(true);
39 public boolean performFinish() {
40 page1.saveDataToModel();
41 IFolder folder = mainPage.createNewModuleFolder(); //create the folder for the module
45 Object[] files = mainPage.createNewModuleFiles(); //create the files
47 selectAndReveal(folder);
49 // Open editor on new xaraya init file.
50 IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
52 IWorkbenchPage page = dw.getActivePage();
54 page.openEditor((IFile)files[0]);
55 } catch (Exception e) {