public class NewDTDDocumentWizard extends Wizard implements INewWizard { private static final String NEW_DTD_DOCUMENT = XMLEspressoActivator.getResourceString("newDTDDocument"); private static final String NEW_FILE_PAGE = XMLEspressoActivator.getResourceString("newFilePage"); private IStructuredSelection selection; private NewDTDFileCreationWizardPage newFilePage; public NewDTDDocumentWizard() { super(); } @Override public boolean performFinish() { IFile newFile = newFilePage.createNewFile(); try { FileEditorInput input = new FileEditorInput(newFile); String id = "com.nubean.xmlespresso.editors.dtdeditor"; XMLEspressoActivator.getDefault() .getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(input, id); } catch (Exception e) { } return true; } @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.selection = selection; setWindowTitle(NEW_DTD_DOCUMENT); } @Override public void addPages() { newFilePage = new NewDTDFileCreationWizardPage(NEW_FILE_PAGE, selection); addPage(newFilePage); } }
@Override public boolean performFinish() { IFile newFile = newFilePage.createNewFile(); try { FileEditorInput input = new FileEditorInput(newFile); String id = "com.nubean.xmlespresso.editors.dtdeditor"; XMLEspressoActivator.getDefault() .getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(input, id); } catch (Exception e) { } return true; }