01: // The UMLet source code is distributed under the terms of the GPL; see license.txt
02: package com.umlet.plugin.wizards;
03:
04: import org.eclipse.core.resources.*;
05: import org.eclipse.jface.viewers.*;
06: import org.eclipse.jface.wizard.*;
07: import org.eclipse.ui.*;
08: import org.eclipse.ui.dialogs.*;
09:
10: public class NewWizard extends Wizard implements INewWizard {
11: private IStructuredSelection mSelection = null;
12: private WizardNewFileCreationPage firstPage = null; //[UB]:changed from default to private access
13:
14: public boolean performFinish() {
15: String fname = firstPage.getFileName();
16: if (!fname.toLowerCase().endsWith(".uxf")) {
17: firstPage.setFileName(fname + ".uxf");
18: }
19:
20: if (firstPage.getErrorMessage() != null)
21: return false;
22:
23: IFile file = firstPage.createNewFile();
24:
25: return true;
26: }
27:
28: public void init(IWorkbench workbench,
29: IStructuredSelection selection) {
30: this .mSelection = selection;
31: }
32:
33: public void addPages() {
34: firstPage = new WizardNewFileCreationPage("New Umlet Diagram",
35: mSelection);
36: firstPage.setTitle("New Umlet Diagram");
37: firstPage.setDescription("Enter file name.");
38:
39: addPage(firstPage);
40:
41: }
42: }
|