X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java new file mode 100644 index 0000000..d57b268 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java @@ -0,0 +1,61 @@ +package com.xaraya.wizard; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; + +public class NewXarayaResourceWizard extends BasicNewResourceWizard { + + private XarayaModuleContainerPage mainPage; //get where to place resource and module name + private XarayaModuleFilePage page1; //get first load of details author/email/which files + + private XarayaVersionModel xvm = new XarayaVersionModel(); //holder for details + +public NewXarayaResourceWizard() { + super(); + //initialize static classes that are required.. + new XarayaModuleText(); + new XarayaModuleMessages(); +} + +public void addPages() { + super.addPages(); + mainPage = new XarayaModuleContainerPage(XarayaModuleMessages.getString("Xaraya.label.container"), getSelection()); + addPage(mainPage); + page1 = new XarayaModuleFilePage(XarayaModuleMessages.getString("Xaraya.label.container")); + addPage(page1); +} + +public void init(IWorkbench workbench, IStructuredSelection currentSelection) { + super.init(workbench, currentSelection); + setWindowTitle(XarayaModuleMessages.getString("Xaraya.label.container")); + setNeedsProgressMonitor(true); +} + +public boolean performFinish() { + page1.saveDataToModel(); + IFolder folder = mainPage.createNewModuleFolder(); //create the folder for the module + if (folder == null) + return false; + + Object[] files = mainPage.createNewModuleFiles(); //create the files + + selectAndReveal(folder); + + // Open editor on new xaraya init file. + IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow(); + try { + IWorkbenchPage page = dw.getActivePage(); + if (page != null) + page.openEditor((IFile)files[0]); + } catch (Exception e) { + } + + return true; +} + +}