KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > templates > editor > ModelWizard


1 package org.eclipse.emf.codegen.ecore.templates.editor;
2
3 import org.eclipse.emf.codegen.ecore.genmodel.*;
4
5 public class ModelWizard
6 {
7   protected static String JavaDoc nl;
8   public static synchronized ModelWizard create(String JavaDoc lineSeparator)
9   {
10     nl = lineSeparator;
11     ModelWizard result = new ModelWizard();
12     nl = null;
13     return result;
14   }
15
16   protected final String JavaDoc NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
17   protected final String JavaDoc TEXT_1 = "";
18   protected final String JavaDoc TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * ";
19   protected final String JavaDoc TEXT_3 = "Id";
20   protected final String JavaDoc TEXT_4 = NL + " */" + NL + "package ";
21   protected final String JavaDoc TEXT_5 = ";" + NL + "" + NL + "" + NL + "import java.util.ArrayList;" + NL + "import java.util.Collection;" + NL + "import java.util.Collections;" + NL + "import java.util.HashMap;" + NL + "import java.util.Iterator;" + NL + "import java.util.List;" + NL + "import java.util.Map;" + NL + "import java.util.MissingResourceException;" + NL + "import java.util.StringTokenizer;" + NL + "" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "" + NL + "import org.eclipse.emf.ecore.EClass;" + NL + "import org.eclipse.emf.ecore.EClassifier;" + NL + "" + NL + "import org.eclipse.emf.ecore.resource.Resource;" + NL + "import org.eclipse.emf.ecore.resource.ResourceSet;" + NL + "" + NL + "import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;" + NL + "" + NL + "import org.eclipse.emf.ecore.EObject;" + NL + "" + NL + "import org.eclipse.emf.ecore.xmi.XMLResource;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;" + NL;
22   protected final String JavaDoc TEXT_6 = NL + "import org.eclipse.core.resources.IContainer;" + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.IFolder;" + NL + "import org.eclipse.core.resources.IProject;" + NL + "import org.eclipse.core.resources.IResource;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;" + NL;
23   protected final String JavaDoc TEXT_7 = NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "" + NL + "import org.eclipse.jface.dialogs.MessageDialog;" + NL + "" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "" + NL + "import org.eclipse.jface.wizard.Wizard;" + NL + "import org.eclipse.jface.wizard.WizardPage;" + NL + "" + NL + "import org.eclipse.swt.SWT;" + NL + "" + NL + "import org.eclipse.swt.events.ModifyListener;" + NL + "import org.eclipse.swt.events.ModifyEvent;" + NL + "" + NL + "import org.eclipse.swt.layout.GridData;" + NL + "import org.eclipse.swt.layout.GridLayout;" + NL + "" + NL + "import org.eclipse.swt.widgets.Combo;" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.Label;" + NL + "" + NL + "import org.eclipse.ui.INewWizard;" + NL + "import org.eclipse.ui.IWorkbench;" + NL;
24   protected final String JavaDoc TEXT_8 = NL + "import org.eclipse.ui.actions.WorkspaceModifyOperation;" + NL + "" + NL + "import org.eclipse.ui.dialogs.WizardNewFileCreationPage;" + NL + "" + NL + "import org.eclipse.ui.part.FileEditorInput;" + NL + "import org.eclipse.ui.part.ISetSelectionTarget;" + NL;
25   protected final String JavaDoc TEXT_9 = NL + "import ";
26   protected final String JavaDoc TEXT_10 = ";" + NL + "import ";
27   protected final String JavaDoc TEXT_11 = ";" + NL + "import ";
28   protected final String JavaDoc TEXT_12 = ";" + NL + NL;
29   protected final String JavaDoc TEXT_13 = NL + NL + NL + "/**" + NL + " * This is a simple wizard for creating a new model file." + NL + " * <!-- begin-user-doc -->" + NL + " * <!-- end-user-doc -->" + NL + " * @generated" + NL + " */" + NL + "public class ";
30   protected final String JavaDoc TEXT_14 = " extends Wizard implements INewWizard" + NL + "{";
31   protected final String JavaDoc TEXT_15 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
32   protected final String JavaDoc TEXT_16 = " copyright = \"";
33   protected final String JavaDoc TEXT_17 = "\";";
34   protected final String JavaDoc TEXT_18 = NL;
35   protected final String JavaDoc TEXT_19 = NL + "\t/**" + NL + "\t * This caches an instance of the model package." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
36   protected final String JavaDoc TEXT_20 = " ";
37   protected final String JavaDoc TEXT_21 = " = ";
38   protected final String JavaDoc TEXT_22 = ".eINSTANCE;" + NL + "" + NL + "\t/**" + NL + "\t * This caches an instance of the model factory." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
39   protected final String JavaDoc TEXT_23 = " ";
40   protected final String JavaDoc TEXT_24 = " = ";
41   protected final String JavaDoc TEXT_25 = ".get";
42   protected final String JavaDoc TEXT_26 = "();" + NL;
43   protected final String JavaDoc TEXT_27 = NL + "\t/**" + NL + "\t * This is the file creation page." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
44   protected final String JavaDoc TEXT_28 = "NewFileCreationPage newFileCreationPage;" + NL;
45   protected final String JavaDoc TEXT_29 = NL + "\t/**" + NL + "\t * This is the initial object creation page." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ";
46   protected final String JavaDoc TEXT_30 = "InitialObjectCreationPage initialObjectCreationPage;" + NL + "" + NL + "\t/**" + NL + "\t * Remember the selection during initialization for populating the default container." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IStructuredSelection selection;" + NL + "" + NL + "\t/**" + NL + "\t * Remember the workbench during initialization." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IWorkbench workbench;" + NL + "" + NL + "\t/**";
47   protected final String JavaDoc TEXT_31 = NL + "\t * Caches the names of the types that can be created as the root object.";
48   protected final String JavaDoc TEXT_32 = NL + "\t * Caches the names of the features representing global elements.";
49   protected final String JavaDoc TEXT_33 = NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected List initialObjectNames;" + NL + "" + NL + "\t/**" + NL + "\t * This just records the information." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IWorkbench workbench, IStructuredSelection selection)" + NL + "\t{" + NL + "\t\tthis.workbench = workbench;" + NL + "\t\tthis.selection = selection;" + NL + "\t\tsetWindowTitle(";
50   protected final String JavaDoc TEXT_34 = ".INSTANCE.getString(\"_UI_Wizard_label\"));";
51   protected final String JavaDoc TEXT_35 = NL + "\t\tsetDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(";
52   protected final String JavaDoc TEXT_36 = ".INSTANCE.getImage(\"full/wizban/New";
53   protected final String JavaDoc TEXT_37 = "\")));";
54   protected final String JavaDoc TEXT_38 = NL + "\t}" + NL + "" + NL + "\t/**";
55   protected final String JavaDoc TEXT_39 = NL + "\t * Returns the names of the types that can be created as the root object.";
56   protected final String JavaDoc TEXT_40 = NL + "\t * Returns the names of the features representing global elements.";
57   protected final String JavaDoc TEXT_41 = NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Collection getInitialObjectNames()" + NL + "\t{" + NL + "\t\tif (initialObjectNames == null)" + NL + "\t\t{" + NL + "\t\t\tinitialObjectNames = new ArrayList();";
58   protected final String JavaDoc TEXT_42 = NL + "\t\t\tfor (Iterator classifiers = ";
59   protected final String JavaDoc TEXT_43 = ".getEClassifiers().iterator(); classifiers.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\tEClassifier eClassifier = (EClassifier)classifiers.next();" + NL + "\t\t\t\tif (eClassifier instanceof EClass)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tEClass eClass = (EClass)eClassifier;" + NL + "\t\t\t\t\tif (!eClass.isAbstract())" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tinitialObjectNames.add(eClass.getName());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}";
60   protected final String JavaDoc TEXT_44 = NL + "\t\t\tfor (Iterator elements = ";
61   protected final String JavaDoc TEXT_45 = ".INSTANCE.getAllElements(";
62   protected final String JavaDoc TEXT_46 = ".INSTANCE.getDocumentRoot(";
63   protected final String JavaDoc TEXT_47 = ")).iterator(); elements.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\t";
64   protected final String JavaDoc TEXT_48 = " eStructuralFeature = (";
65   protected final String JavaDoc TEXT_49 = ")elements.next();" + NL + "\t\t\t\tEClassifier eClassifier = eStructuralFeature.getEType();" + NL + "\t\t\t\tif (eClassifier instanceof EClass)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tEClass eClass = (EClass)eClassifier;" + NL + "\t\t\t\t\tif (!eClass.isAbstract())" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tinitialObjectNames.add(eStructuralFeature.getName());" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}";
66   protected final String JavaDoc TEXT_50 = NL + "\t\t\tCollections.sort(initialObjectNames, java.text.Collator.getInstance());" + NL + "\t\t}" + NL + "\t\treturn initialObjectNames;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Create a new model." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EObject createInitialModel()" + NL + "\t{";
67   protected final String JavaDoc TEXT_51 = NL + "\t\tEClass eClass = (EClass)";
68   protected final String JavaDoc TEXT_52 = ".getEClassifier(initialObjectCreationPage.getInitialObjectName());" + NL + "\t\tEObject rootObject = ";
69   protected final String JavaDoc TEXT_53 = ".create(eClass);";
70   protected final String JavaDoc TEXT_54 = NL + "\t\tEClass eClass = ";
71   protected final String JavaDoc TEXT_55 = ".INSTANCE.getDocumentRoot(";
72   protected final String JavaDoc TEXT_56 = ");" + NL + "\t\tEStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(initialObjectCreationPage.getInitialObjectName());" + NL + "\t\tEObject rootObject = ";
73   protected final String JavaDoc TEXT_57 = ".create(eClass);" + NL + "\t\trootObject.eSet(eStructuralFeature, ";
74   protected final String JavaDoc TEXT_58 = ".create((EClass)eStructuralFeature.getEType()));";
75   protected final String JavaDoc TEXT_59 = NL + "\t\treturn rootObject;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Do the work after everything is specified." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish()" + NL + "\t{" + NL + "\t\ttry" + NL + "\t\t{";
76   protected final String JavaDoc TEXT_60 = NL + "\t\t\t// Get the URI of the model file." + NL + "\t\t\t//" + NL + "\t\t\tfinal URI fileURI = getModelURI();" + NL + "\t\t\tif (new ";
77   protected final String JavaDoc TEXT_61 = "(fileURI.toFileString()).exists())" + NL + "\t\t\t{" + NL + "\t\t\t\tif (!MessageDialog.openQuestion" + NL + "\t\t\t\t\t\t(getShell()," + NL + "\t\t\t\t\t\t ";
78   protected final String JavaDoc TEXT_62 = ".INSTANCE.getString(\"_UI_Question_title\"),";
79   protected final String JavaDoc TEXT_63 = NL + "\t\t\t\t\t\t ";
80   protected final String JavaDoc TEXT_64 = ".INSTANCE.getString(\"_WARN_FileConflict\", new String []{ fileURI.toFileString() })))";
81   protected final String JavaDoc TEXT_65 = NL + "\t\t\t\t{" + NL + "\t\t\t\t\tinitialObjectCreationPage.selectFileField();" + NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\t" + NL + "\t\t\t// Do the work within an operation." + NL + "\t\t\t//" + NL + "\t\t\t";
82   protected final String JavaDoc TEXT_66 = " operation = new ";
83   protected final String JavaDoc TEXT_67 = "()" + NL + "\t\t\t{" + NL + "\t\t\t\tpublic void run(IProgressMonitor progressMonitor)";
84   protected final String JavaDoc TEXT_68 = NL + "\t\t\t// Remember the file." + NL + "\t\t\t//" + NL + "\t\t\tfinal IFile modelFile = getModelFile();" + NL + "" + NL + "\t\t\t// Do the work within an operation." + NL + "\t\t\t//" + NL + "\t\t\tWorkspaceModifyOperation operation =" + NL + "\t\t\t\tnew WorkspaceModifyOperation()" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tprotected void execute(IProgressMonitor progressMonitor)";
85   protected final String JavaDoc TEXT_69 = NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\ttry" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t// Create a resource set" + NL + "\t\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\t\tResourceSet resourceSet = new ResourceSetImpl();" + NL;
86   protected final String JavaDoc TEXT_70 = NL + "\t\t\t\t\t\t\t// Get the URI of the model file." + NL + "\t\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\t\tURI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString());" + NL;
87   protected final String JavaDoc TEXT_71 = NL + "\t\t\t\t\t\t\t// Create a resource for this file." + NL + "\t\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\t\tResource resource = resourceSet.createResource(fileURI);" + NL + "" + NL + "\t\t\t\t\t\t\t// Add the initial model object to the contents." + NL + "\t\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\t\tEObject rootObject = createInitialModel();" + NL + "\t\t\t\t\t\t\tif (rootObject != null)" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tresource.getContents().add(rootObject);" + NL + "\t\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\t\t// Save the contents of the resource to the file system." + NL + "\t\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\t\tMap options = new HashMap();" + NL + "\t\t\t\t\t\t\toptions.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());" + NL + "\t\t\t\t\t\t\tresource.save(options);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tcatch (Exception exception)" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t";
88   protected final String JavaDoc TEXT_72 = ".INSTANCE.log(exception);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\tfinally" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tprogressMonitor.done();" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "" + NL + "\t\t\tgetContainer().run(false, false, operation);" + NL;
89   protected final String JavaDoc TEXT_73 = NL + "\t\t\treturn ";
90   protected final String JavaDoc TEXT_74 = ".openEditor(workbench, fileURI);\t\t\t";
91   protected final String JavaDoc TEXT_75 = NL + "\t\t\t// Select the new file resource in the current view." + NL + "\t\t\t//" + NL + "\t\t\t";
92   protected final String JavaDoc TEXT_76 = " workbenchWindow = workbench.getActiveWorkbenchWindow();" + NL + "\t\t\t";
93   protected final String JavaDoc TEXT_77 = " page = workbenchWindow.getActivePage();" + NL + "\t\t\tfinal ";
94   protected final String JavaDoc TEXT_78 = " activePart = page.getActivePart();" + NL + "\t\t\tif (activePart instanceof ISetSelectionTarget)" + NL + "\t\t\t{" + NL + "\t\t\t\tfinal ";
95   protected final String JavaDoc TEXT_79 = " targetSelection = new ";
96   protected final String JavaDoc TEXT_80 = "(modelFile);" + NL + "\t\t\t\tgetShell().getDisplay().asyncExec" + NL + "\t\t\t\t\t(new Runnable()" + NL + "\t\t\t\t\t {" + NL + "\t\t\t\t\t\t public void run()" + NL + "\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t ((ISetSelectionTarget)activePart).selectReveal(targetSelection);" + NL + "\t\t\t\t\t\t }" + NL + "\t\t\t\t\t });" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t// Open an editor on the new file." + NL + "\t\t\t//" + NL + "\t\t\ttry" + NL + "\t\t\t{" + NL + "\t\t\t\tpage.openEditor" + NL + "\t\t\t\t\t(new FileEditorInput(modelFile)," + NL + "\t\t\t\t\t workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());" + NL + "\t\t\t}" + NL + "\t\t\tcatch (";
97   protected final String JavaDoc TEXT_81 = " exception)" + NL + "\t\t\t{" + NL + "\t\t\t\tMessageDialog.openError(workbenchWindow.getShell(), ";
98   protected final String JavaDoc TEXT_82 = ".INSTANCE.getString(\"_UI_OpenEditorError_label\"), exception.getMessage());";
99   protected final String JavaDoc TEXT_83 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\treturn true;";
100   protected final String JavaDoc TEXT_84 = NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t";
101   protected final String JavaDoc TEXT_85 = ".INSTANCE.log(exception);" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t}" + NL;
102   protected final String JavaDoc TEXT_86 = NL + "\t/**" + NL + "\t * This is the one page of the wizard." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic class ";
103   protected final String JavaDoc TEXT_87 = "NewFileCreationPage extends WizardNewFileCreationPage" + NL + "\t{" + NL + "\t\t/**" + NL + "\t\t * Pass in the selection." + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
104   protected final String JavaDoc TEXT_88 = "NewFileCreationPage(String pageId, IStructuredSelection selection)" + NL + "\t\t{" + NL + "\t\t\tsuper(pageId, selection);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * The framework calls this to see if the file is correct." + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage()" + NL + "\t\t{" + NL + "\t\t\tif (super.validatePage())" + NL + "\t\t\t{" + NL + "\t\t\t\t// Make sure the file ends in \".";
105   protected final String JavaDoc TEXT_89 = "\"." + NL + "\t\t\t\t//" + NL + "\t\t\t\tString requiredExt = ";
106   protected final String JavaDoc TEXT_90 = ".INSTANCE.getString(\"_UI_";
107   protected final String JavaDoc TEXT_91 = "FilenameExtension\");";
108   protected final String JavaDoc TEXT_92 = NL + "\t\t\t\tString enteredExt = new ";
109   protected final String JavaDoc TEXT_93 = "(getFileName()).getFileExtension();" + NL + "\t\t\t\tif (enteredExt == null || !enteredExt.equals(requiredExt))" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsetErrorMessage(";
110   protected final String JavaDoc TEXT_94 = ".INSTANCE.getString(\"_WARN_FilenameExtension\", new Object [] { requiredExt }));";
111   protected final String JavaDoc TEXT_95 = NL + "\t\t\t\t\treturn false;" + NL + "\t\t\t\t}" + NL + "\t\t\t\telse" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\treturn true;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\telse" + NL + "\t\t\t{" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic IFile getModelFile()" + NL + "\t\t{" + NL + "\t\t\treturn ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));" + NL + "\t\t}" + NL + "\t}" + NL;
112   protected final String JavaDoc TEXT_96 = NL + "\t/**" + NL + "\t * This is the page where the type of object to create is selected." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic class ";
113   protected final String JavaDoc TEXT_97 = "InitialObjectCreationPage extends WizardPage" + NL + "\t{";
114   protected final String JavaDoc TEXT_98 = NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ";
115   protected final String JavaDoc TEXT_99 = " fileField;" + NL;
116   protected final String JavaDoc TEXT_100 = NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected Combo initialObjectField;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t */" + NL + "\t\tprotected List encodings;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected Combo encodingField;" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Pass in the selection." + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
117   protected final String JavaDoc TEXT_101 = "InitialObjectCreationPage(String pageId)" + NL + "\t\t{" + NL + "\t\t\tsuper(pageId);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createControl(Composite parent)" + NL + "\t\t{" + NL + "\t\t\tComposite composite = new Composite(parent, SWT.NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\t\tlayout.numColumns = 1;" + NL + "\t\t\t\tlayout.verticalSpacing = 12;" + NL + "\t\t\t\tcomposite.setLayout(layout);" + NL + "" + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.verticalAlignment = GridData.FILL;" + NL + "\t\t\t\tdata.grabExcessVerticalSpace = true;" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tcomposite.setLayoutData(data);" + NL + "\t\t\t}" + NL;
118   protected final String JavaDoc TEXT_102 = "\t\t\t" + NL + "\t\t\tLabel resourceURILabel = new Label(composite, SWT.LEFT);" + NL + "\t\t\t{" + NL + "\t\t\t\tresourceURILabel.setText(";
119   protected final String JavaDoc TEXT_103 = ".INSTANCE.getString(\"_UI_File_label\"));";
120   protected final String JavaDoc TEXT_104 = NL + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tresourceURILabel.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tComposite fileComposite = new Composite(composite, SWT.NONE);" + NL + "\t\t\t{" + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.END;" + NL + "\t\t\t\tfileComposite.setLayoutData(data);" + NL + "" + NL + "\t\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tlayout.marginHeight = 0;" + NL + "\t\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\t\tlayout.numColumns = 2;" + NL + "\t\t\t\tfileComposite.setLayout(layout);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField = new ";
121   protected final String JavaDoc TEXT_105 = "(fileComposite, SWT.BORDER);" + NL + "\t\t\t{" + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tdata.horizontalSpan = 1;" + NL + "\t\t\t\tfileField.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfileField.addModifyListener(validator);" + NL + "" + NL + "\t\t\t";
122   protected final String JavaDoc TEXT_106 = " resourceURIBrowseFileSystemButton = new ";
123   protected final String JavaDoc TEXT_107 = "(fileComposite, SWT.PUSH);" + NL + "\t\t\tresourceURIBrowseFileSystemButton.setText(";
124   protected final String JavaDoc TEXT_108 = ".INSTANCE.getString(\"_UI_Browse_label\"));";
125   protected final String JavaDoc TEXT_109 = NL + NL + "\t\t\tresourceURIBrowseFileSystemButton.addSelectionListener" + NL + "\t\t\t\t(new ";
126   protected final String JavaDoc TEXT_110 = "()" + NL + "\t\t\t\t {" + NL + "\t\t\t\t\t public void widgetSelected(";
127   protected final String JavaDoc TEXT_111 = " event)" + NL + "\t\t\t\t\t {" + NL + "\t\t\t\t\t\t String fileExtension = ";
128   protected final String JavaDoc TEXT_112 = ".INSTANCE.getString(\"";
129   protected final String JavaDoc TEXT_113 = "\");";
130   protected final String JavaDoc TEXT_114 = NL + "\t\t\t\t\t\t String filePath = ";
131   protected final String JavaDoc TEXT_115 = ".openFilePathDialog(getShell(), \"*.\" + fileExtension, ";
132   protected final String JavaDoc TEXT_116 = ".OPEN);";
133   protected final String JavaDoc TEXT_117 = NL + "\t\t\t\t\t\t if (filePath != null)" + NL + "\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t if (!filePath.endsWith(\".\" + fileExtension))";
134   protected final String JavaDoc TEXT_118 = NL + "\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t filePath = filePath + \".\" + fileExtension;";
135   protected final String JavaDoc TEXT_119 = NL + "\t\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t\t fileField.setText(filePath);" + NL + "\t\t\t\t\t\t }" + NL + "\t\t\t\t\t }" + NL + "\t\t\t\t });";
136   protected final String JavaDoc TEXT_120 = NL + "\t\t\tLabel containerLabel = new Label(composite, SWT.LEFT);" + NL + "\t\t\t{" + NL + "\t\t\t\tcontainerLabel.setText(";
137   protected final String JavaDoc TEXT_121 = ".INSTANCE.getString(\"_UI_ModelObject\"));";
138   protected final String JavaDoc TEXT_122 = NL + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tcontainerLabel.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tinitialObjectField = new Combo(composite, SWT.BORDER);" + NL + "\t\t\t{" + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tinitialObjectField.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfor (Iterator i = getInitialObjectNames().iterator(); i.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\tinitialObjectField.add(getLabel((String)i.next()));" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tif (initialObjectField.getItemCount() == 1)" + NL + "\t\t\t{" + NL + "\t\t\t\tinitialObjectField.select(0);" + NL + "\t\t\t}" + NL + "\t\t\tinitialObjectField.addModifyListener(validator);" + NL + "" + NL + "\t\t\tLabel encodingLabel = new Label(composite, SWT.LEFT);" + NL + "\t\t\t{" + NL + "\t\t\t\tencodingLabel.setText(";
139   protected final String JavaDoc TEXT_123 = ".INSTANCE.getString(\"_UI_XMLEncoding\"));";
140   protected final String JavaDoc TEXT_124 = NL + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tencodingLabel.setLayoutData(data);" + NL + "\t\t\t}" + NL + "\t\t\tencodingField = new Combo(composite, SWT.BORDER);" + NL + "\t\t\t{" + NL + "\t\t\t\tGridData data = new GridData();" + NL + "\t\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\t\tencodingField.setLayoutData(data);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tfor (Iterator i = getEncodings().iterator(); i.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\tencodingField.add((String)i.next());" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tencodingField.select(0);" + NL + "\t\t\tencodingField.addModifyListener(validator);" + NL + "" + NL + "\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\tsetControl(composite);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected ModifyListener validator =" + NL + "\t\t\tnew ModifyListener()" + NL + "\t\t\t{" + NL + "\t\t\t\tpublic void modifyText(ModifyEvent e)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected boolean validatePage()" + NL + "\t\t{";
141   protected final String JavaDoc TEXT_125 = NL + "\t\t\tURI fileURI = getFileURI();" + NL + "\t\t\tif (fileURI == null || fileURI.isEmpty())" + NL + "\t\t\t{" + NL + "\t\t\t\tsetErrorMessage(null);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tString requiredExt = ";
142   protected final String JavaDoc TEXT_126 = ".INSTANCE.getString(\"_UI_";
143   protected final String JavaDoc TEXT_127 = "FilenameExtension\");";
144   protected final String JavaDoc TEXT_128 = NL + "\t\t\tString enteredExt = fileURI.fileExtension();" + NL + "\t\t\tif (enteredExt == null || !enteredExt.equals(requiredExt))" + NL + "\t\t\t{" + NL + "\t\t\t\tsetErrorMessage(";
145   protected final String JavaDoc TEXT_129 = ".INSTANCE.getString(\"_WARN_FilenameExtension\", new Object [] { requiredExt }));";
146   protected final String JavaDoc TEXT_130 = NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tsetErrorMessage(null);";
147   protected final String JavaDoc TEXT_131 = NL + "\t\t\treturn getInitialObjectName() != null && getEncodings().contains(encodingField.getText());" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void setVisible(boolean visible)" + NL + "\t\t{" + NL + "\t\t\tsuper.setVisible(visible);" + NL + "\t\t\tif (visible)" + NL + "\t\t\t{";
148   protected final String JavaDoc TEXT_132 = NL + "\t\t\t\tif (initialObjectField.getItemCount() == 1)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tinitialObjectField.clearSelection();" + NL + "\t\t\t\t\tencodingField.setFocus();" + NL + "\t\t\t\t}" + NL + "\t\t\t\telse" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tencodingField.clearSelection();" + NL + "\t\t\t\t\tinitialObjectField.setFocus();" + NL + "\t\t\t\t}";
149   protected final String JavaDoc TEXT_133 = NL + "\t\t\t\tinitialObjectField.clearSelection();" + NL + "\t\t\t\tencodingField.clearSelection();" + NL + "\t\t\t\tfileField.setFocus();";
150   protected final String JavaDoc TEXT_134 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getInitialObjectName()" + NL + "\t\t{" + NL + "\t\t\tString label = initialObjectField.getText();" + NL + "" + NL + "\t\t\tfor (Iterator i = getInitialObjectNames().iterator(); i.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\tString name = (String)i.next();" + NL + "\t\t\t\tif (getLabel(name).equals(label))" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\treturn name;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getEncoding()" + NL + "\t\t{" + NL + "\t\t\treturn encodingField.getText();" + NL + "\t\t}";
151   protected final String JavaDoc TEXT_135 = NL + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic URI getFileURI()" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{" + NL + "\t\t\t\treturn URI.createFileURI(fileField.getText());" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception exception)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void selectFileField()" + NL + "\t\t{" + NL + "\t\t\t\tinitialObjectField.clearSelection();" + NL + "\t\t\t\tencodingField.clearSelection();" + NL + "\t\t\t\tfileField.selectAll();" + NL + "\t\t\t\tfileField.setFocus();" + NL + "\t\t}\t\t";
152   protected final String JavaDoc TEXT_136 = NL + NL + "\t\t/**" + NL + "\t\t * Returns the label for the specified ";
153   protected final String JavaDoc TEXT_137 = " name." + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected String getLabel(String ";
154   protected final String JavaDoc TEXT_138 = "Name)" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{" + NL + "\t\t\t\treturn ";
155   protected final String JavaDoc TEXT_139 = ".INSTANCE.getString(\"";
156   protected final String JavaDoc TEXT_140 = "\" + ";
157   protected final String JavaDoc TEXT_141 = "Name + \"_";
158   protected final String JavaDoc TEXT_142 = "\");";
159   protected final String JavaDoc TEXT_143 = NL + "\t\t\t}" + NL + "\t\t\tcatch(MissingResourceException mre)" + NL + "\t\t\t{" + NL + "\t\t\t\t";
160   protected final String JavaDoc TEXT_144 = ".INSTANCE.log(mre);" + NL + "\t\t\t}" + NL + "\t\t\treturn ";
161   protected final String JavaDoc TEXT_145 = "Name;" + NL + "\t\t}";
162   protected final String JavaDoc TEXT_146 = NL + NL + "\t\t/**" + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected Collection getEncodings()" + NL + "\t\t{" + NL + "\t\t\tif (encodings == null)" + NL + "\t\t\t{" + NL + "\t\t\t\tencodings = new ArrayList();" + NL + "\t\t\t\tfor (StringTokenizer stringTokenizer = new StringTokenizer(";
163   protected final String JavaDoc TEXT_147 = ".INSTANCE.getString(\"_UI_XMLEncodingChoices\")); stringTokenizer.hasMoreTokens(); )";
164   protected final String JavaDoc TEXT_148 = NL + "\t\t\t\t{" + NL + "\t\t\t\t\tencodings.add(stringTokenizer.nextToken());" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\treturn encodings;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * The framework calls this to create the contents of the wizard." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages()" + NL + "\t{";
165   protected final String JavaDoc TEXT_149 = NL + "\t\t// Create a page, set the title, and the initial model file name." + NL + "\t\t//" + NL + "\t\tnewFileCreationPage = new ";
166   protected final String JavaDoc TEXT_150 = "NewFileCreationPage(\"Whatever\", selection);";
167   protected final String JavaDoc TEXT_151 = NL + "\t\tnewFileCreationPage.setTitle(";
168   protected final String JavaDoc TEXT_152 = ".INSTANCE.getString(\"_UI_";
169   protected final String JavaDoc TEXT_153 = "_label\"));";
170   protected final String JavaDoc TEXT_154 = NL + "\t\tnewFileCreationPage.setDescription(";
171   protected final String JavaDoc TEXT_155 = ".INSTANCE.getString(\"_UI_";
172   protected final String JavaDoc TEXT_156 = "_description\"));";
173   protected final String JavaDoc TEXT_157 = NL + "\t\tnewFileCreationPage.setFileName(";
174   protected final String JavaDoc TEXT_158 = ".INSTANCE.getString(\"_UI_";
175   protected final String JavaDoc TEXT_159 = "FilenameDefaultBase\") + \".\" + ";
176   protected final String JavaDoc TEXT_160 = ".INSTANCE.getString(\"_UI_";
177   protected final String JavaDoc TEXT_161 = "FilenameExtension\"));";
178   protected final String JavaDoc TEXT_162 = NL + "\t\taddPage(newFileCreationPage);" + NL + "" + NL + "\t\t// Try and get the resource selection to determine a current directory for the file dialog." + NL + "\t\t//" + NL + "\t\tif (selection != null && !selection.isEmpty())" + NL + "\t\t{" + NL + "\t\t\t// Get the resource..." + NL + "\t\t\t//" + NL + "\t\t\tObject selectedElement = selection.iterator().next();" + NL + "\t\t\tif (selectedElement instanceof IResource)" + NL + "\t\t\t{" + NL + "\t\t\t\t// Get the resource parent, if its a file." + NL + "\t\t\t\t//" + NL + "\t\t\t\tIResource selectedResource = (IResource)selectedElement;" + NL + "\t\t\t\tif (selectedResource.getType() == IResource.FILE)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tselectedResource = selectedResource.getParent();" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\t// This gives us a directory..." + NL + "\t\t\t\t//" + NL + "\t\t\t\tif (selectedResource instanceof IFolder || selectedResource instanceof IProject)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\t// Set this for the container." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tnewFileCreationPage.setContainerFullPath(selectedResource.getFullPath());" + NL + "" + NL + "\t\t\t\t\t// Make up a unique new name here." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tString defaultModelBaseFilename = ";
179   protected final String JavaDoc TEXT_163 = ".INSTANCE.getString(\"_UI_";
180   protected final String JavaDoc TEXT_164 = "FilenameDefaultBase\");";
181   protected final String JavaDoc TEXT_165 = NL + "\t\t\t\t\tString defaultModelFilenameExtension = ";
182   protected final String JavaDoc TEXT_166 = ".INSTANCE.getString(\"_UI_";
183   protected final String JavaDoc TEXT_167 = "FilenameExtension\");";
184   protected final String JavaDoc TEXT_168 = NL + "\t\t\t\t\tString modelFilename = defaultModelBaseFilename + \".\" + defaultModelFilenameExtension;";
185   protected final String JavaDoc TEXT_169 = NL + "\t\t\t\t\tfor (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tmodelFilename = defaultModelBaseFilename + i + \".\" + defaultModelFilenameExtension;";
186   protected final String JavaDoc TEXT_170 = NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tnewFileCreationPage.setFileName(modelFilename);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}";
187   protected final String JavaDoc TEXT_171 = NL + "\t\tinitialObjectCreationPage = new ";
188   protected final String JavaDoc TEXT_172 = "InitialObjectCreationPage(\"Whatever2\");";
189   protected final String JavaDoc TEXT_173 = NL + "\t\tinitialObjectCreationPage.setTitle(";
190   protected final String JavaDoc TEXT_174 = ".INSTANCE.getString(\"_UI_";
191   protected final String JavaDoc TEXT_175 = "_label\"));";
192   protected final String JavaDoc TEXT_176 = NL + "\t\tinitialObjectCreationPage.setDescription(";
193   protected final String JavaDoc TEXT_177 = ".INSTANCE.getString(\"_UI_Wizard_initial_object_description\"));";
194   protected final String JavaDoc TEXT_178 = NL + "\t\taddPage(initialObjectCreationPage);" + NL + "\t}" + NL;
195   protected final String JavaDoc TEXT_179 = NL + "\t\t/**" + NL + "\t\t * Get the URI from the page." + NL + "\t\t * <!-- begin-user-doc -->" + NL + "\t\t * <!-- end-user-doc -->" + NL + "\t\t * @generated" + NL + "\t\t*/" + NL + "\t\tpublic URI getModelURI()" + NL + "\t\t{" + NL + "\t\t\treturn initialObjectCreationPage.getFileURI();" + NL + "\t\t}" + NL;
196   protected final String JavaDoc TEXT_180 = NL + "\t/**" + NL + "\t * Get the file from the page." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFile getModelFile()" + NL + "\t{" + NL + "\t\treturn newFileCreationPage.getModelFile();" + NL + "\t}" + NL;
197   protected final String JavaDoc TEXT_181 = NL + "}";
198   protected final String JavaDoc TEXT_182 = NL;
199
200   public String JavaDoc generate(Object JavaDoc argument)
201   {
202     StringBuffer JavaDoc stringBuffer = new StringBuffer JavaDoc();
203     
204 /**
205  * <copyright>
206  *
207  * Copyright (c) 2002-2005 IBM Corporation and others.
208  * All rights reserved. This program and the accompanying materials
209  * are made available under the terms of the Eclipse Public License v1.0
210  * which accompanies this distribution, and is available at
211  * http://www.eclipse.org/legal/epl-v10.html
212  *
213  * Contributors:
214  * IBM - Initial API and implementation
215  *
216  * </copyright>
217  */

218
219     GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
220     stringBuffer.append(TEXT_1);
221     stringBuffer.append(TEXT_2);
222     stringBuffer.append("$");
223     stringBuffer.append(TEXT_3);
224     stringBuffer.append("$");
225     stringBuffer.append(TEXT_4);
226     stringBuffer.append(genPackage.getPresentationPackageName());
227     stringBuffer.append(TEXT_5);
228     if (!genModel.isRichClientPlatform()) {
229     stringBuffer.append(TEXT_6);
230     }
231     stringBuffer.append(TEXT_7);
232     if (!genModel.isRichClientPlatform()) {
233     stringBuffer.append(TEXT_8);
234     }
235     stringBuffer.append(TEXT_9);
236     stringBuffer.append(genPackage.getQualifiedFactoryInterfaceName());
237     stringBuffer.append(TEXT_10);
238     stringBuffer.append(genPackage.getQualifiedPackageInterfaceName());
239     stringBuffer.append(TEXT_11);
240     stringBuffer.append(genPackage.getQualifiedEditPluginClassName());
241     stringBuffer.append(TEXT_12);
242     genModel.markImportLocation(stringBuffer);
243     stringBuffer.append(TEXT_13);
244     stringBuffer.append(genPackage.getModelWizardClassName());
245     stringBuffer.append(TEXT_14);
246     if (genModel.getCopyrightText() != null) {
247     stringBuffer.append(TEXT_15);
248     stringBuffer.append(genModel.getImportedName("java.lang.String"));
249     stringBuffer.append(TEXT_16);
250     stringBuffer.append(genModel.getCopyrightText());
251     stringBuffer.append(TEXT_17);
252     stringBuffer.append(genModel.getNonNLS());
253     stringBuffer.append(TEXT_18);
254     }
255     stringBuffer.append(TEXT_19);
256     stringBuffer.append(genPackage.getPackageInterfaceName());
257     stringBuffer.append(TEXT_20);
258     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
259     stringBuffer.append(TEXT_21);
260     stringBuffer.append(genPackage.getPackageInterfaceName());
261     stringBuffer.append(TEXT_22);
262     stringBuffer.append(genPackage.getFactoryInterfaceName());
263     stringBuffer.append(TEXT_23);
264     stringBuffer.append(genPackage.getUncapFactoryInterfaceName());
265     stringBuffer.append(TEXT_24);
266     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
267     stringBuffer.append(TEXT_25);
268     stringBuffer.append(genPackage.getFactoryInterfaceName());
269     stringBuffer.append(TEXT_26);
270     if (!genModel.isRichClientPlatform()) {
271     stringBuffer.append(TEXT_27);
272     stringBuffer.append(genPackage.getModelWizardClassName());
273     stringBuffer.append(TEXT_28);
274     }
275     stringBuffer.append(TEXT_29);
276     stringBuffer.append(genPackage.getModelWizardClassName());
277     stringBuffer.append(TEXT_30);
278     if (!genPackage.hasDocumentRoot()) {
279     stringBuffer.append(TEXT_31);
280     } else {
281     stringBuffer.append(TEXT_32);
282     }
283     stringBuffer.append(TEXT_33);
284     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
285     stringBuffer.append(TEXT_34);
286     stringBuffer.append(genModel.getNonNLS());
287     stringBuffer.append(TEXT_35);
288     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
289     stringBuffer.append(TEXT_36);
290     stringBuffer.append(genPackage.getPrefix());
291     stringBuffer.append(TEXT_37);
292     stringBuffer.append(genModel.getNonNLS());
293     stringBuffer.append(TEXT_38);
294     if (!genPackage.hasDocumentRoot()) {
295     stringBuffer.append(TEXT_39);
296     } else {
297     stringBuffer.append(TEXT_40);
298     }
299     stringBuffer.append(TEXT_41);
300     if (!genPackage.hasDocumentRoot()) {
301     stringBuffer.append(TEXT_42);
302     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
303     stringBuffer.append(TEXT_43);
304     } else {
305     stringBuffer.append(TEXT_44);
306     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.ExtendedMetaData"));
307     stringBuffer.append(TEXT_45);
308     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.ExtendedMetaData"));
309     stringBuffer.append(TEXT_46);
310     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
311     stringBuffer.append(TEXT_47);
312     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
313     stringBuffer.append(TEXT_48);
314     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.EStructuralFeature"));
315     stringBuffer.append(TEXT_49);
316     }
317     stringBuffer.append(TEXT_50);
318     if (!genPackage.hasDocumentRoot()) {
319     stringBuffer.append(TEXT_51);
320     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
321     stringBuffer.append(TEXT_52);
322     stringBuffer.append(genPackage.getUncapFactoryInterfaceName());
323     stringBuffer.append(TEXT_53);
324     } else {
325     stringBuffer.append(TEXT_54);
326     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.ExtendedMetaData"));
327     stringBuffer.append(TEXT_55);
328     stringBuffer.append(genPackage.getUncapPackageInterfaceName());
329     stringBuffer.append(TEXT_56);
330     stringBuffer.append(genPackage.getUncapFactoryInterfaceName());
331     stringBuffer.append(TEXT_57);
332     stringBuffer.append(genModel.getImportedName("org.eclipse.emf.ecore.util.EcoreUtil"));
333     stringBuffer.append(TEXT_58);
334     }
335     stringBuffer.append(TEXT_59);
336     if (genModel.isRichClientPlatform()) {
337     stringBuffer.append(TEXT_60);
338     stringBuffer.append(genModel.getImportedName("java.io.File"));
339     stringBuffer.append(TEXT_61);
340     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
341     stringBuffer.append(TEXT_62);
342     stringBuffer.append(genModel.getNonNLS());
343     stringBuffer.append(TEXT_63);
344     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
345     stringBuffer.append(TEXT_64);
346     stringBuffer.append(genModel.getNonNLS());
347     stringBuffer.append(TEXT_65);
348     stringBuffer.append(genModel.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress"));
349     stringBuffer.append(TEXT_66);
350     stringBuffer.append(genModel.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress"));
351     stringBuffer.append(TEXT_67);
352     } else {
353     stringBuffer.append(TEXT_68);
354     }
355     stringBuffer.append(TEXT_69);
356     if (!genModel.isRichClientPlatform()) {
357     stringBuffer.append(TEXT_70);
358     }
359     stringBuffer.append(TEXT_71);
360     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
361     stringBuffer.append(TEXT_72);
362     if (genModel.isRichClientPlatform()) {
363     stringBuffer.append(TEXT_73);
364     stringBuffer.append(genModel.getImportedName(genModel.getQualifiedEditorAdvisorClassName()));
365     stringBuffer.append(TEXT_74);
366     } else {
367     stringBuffer.append(TEXT_75);
368     stringBuffer.append(genModel.getImportedName("org.eclipse.ui.IWorkbenchWindow"));
369     stringBuffer.append(TEXT_76);
370     stringBuffer.append(genModel.getImportedName("org.eclipse.ui.IWorkbenchPage"));
371     stringBuffer.append(TEXT_77);
372     stringBuffer.append(genModel.getImportedName("org.eclipse.ui.IWorkbenchPart"));
373     stringBuffer.append(TEXT_78);
374     stringBuffer.append(genModel.getImportedName("org.eclipse.jface.viewers.ISelection"));
375     stringBuffer.append(TEXT_79);
376     stringBuffer.append(genModel.getImportedName("org.eclipse.jface.viewers.StructuredSelection"));
377     stringBuffer.append(TEXT_80);
378     stringBuffer.append(genModel.getImportedName("org.eclipse.ui.PartInitException"));
379     stringBuffer.append(TEXT_81);
380     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
381     stringBuffer.append(TEXT_82);
382     stringBuffer.append(genModel.getNonNLS());
383     stringBuffer.append(TEXT_83);
384     }
385     stringBuffer.append(TEXT_84);
386     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
387     stringBuffer.append(TEXT_85);
388     if (!genModel.isRichClientPlatform()) {
389     stringBuffer.append(TEXT_86);
390     stringBuffer.append(genPackage.getModelWizardClassName());
391     stringBuffer.append(TEXT_87);
392     stringBuffer.append(genPackage.getModelWizardClassName());
393     stringBuffer.append(TEXT_88);
394     stringBuffer.append(genPackage.getPrefix().toLowerCase());
395     stringBuffer.append(TEXT_89);
396     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
397     stringBuffer.append(TEXT_90);
398     stringBuffer.append(genPackage.getEditorClassName());
399     stringBuffer.append(TEXT_91);
400     stringBuffer.append(genModel.getNonNLS());
401     stringBuffer.append(TEXT_92);
402     stringBuffer.append(genModel.getImportedName("org.eclipse.core.runtime.Path"));
403     stringBuffer.append(TEXT_93);
404     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
405     stringBuffer.append(TEXT_94);
406     stringBuffer.append(genModel.getNonNLS());
407     stringBuffer.append(TEXT_95);
408     }
409     stringBuffer.append(TEXT_96);
410     stringBuffer.append(genPackage.getModelWizardClassName());
411     stringBuffer.append(TEXT_97);
412     if (genModel.isRichClientPlatform()) {
413     stringBuffer.append(TEXT_98);
414     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.widgets.Text"));
415     stringBuffer.append(TEXT_99);
416     }
417     stringBuffer.append(TEXT_100);
418     stringBuffer.append(genPackage.getModelWizardClassName());
419     stringBuffer.append(TEXT_101);
420     if (genModel.isRichClientPlatform()) {
421     stringBuffer.append(TEXT_102);
422     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
423     stringBuffer.append(TEXT_103);
424     stringBuffer.append(genModel.getNonNLS());
425     stringBuffer.append(TEXT_104);
426     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.widgets.Text"));
427     stringBuffer.append(TEXT_105);
428     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.widgets.Button"));
429     stringBuffer.append(TEXT_106);
430     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.widgets.Button"));
431     stringBuffer.append(TEXT_107);
432     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
433     stringBuffer.append(TEXT_108);
434     stringBuffer.append(genModel.getNonNLS());
435     stringBuffer.append(TEXT_109);
436     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.events.SelectionAdapter"));
437     stringBuffer.append(TEXT_110);
438     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.events.SelectionEvent"));
439     stringBuffer.append(TEXT_111);
440     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
441     stringBuffer.append(TEXT_112);
442     stringBuffer.append("_UI_" + genPackage.getEditorClassName() + "FilenameExtension");
443     stringBuffer.append(TEXT_113);
444     stringBuffer.append(genModel.getNonNLS());
445     stringBuffer.append(TEXT_114);
446     stringBuffer.append(genModel.getImportedName(genModel.getQualifiedEditorAdvisorClassName()));
447     stringBuffer.append(TEXT_115);
448     stringBuffer.append(genModel.getImportedName("org.eclipse.swt.SWT"));
449     stringBuffer.append(TEXT_116);
450     stringBuffer.append(genModel.getNonNLS());
451     stringBuffer.append(TEXT_117);
452     stringBuffer.append(genModel.getNonNLS());
453     stringBuffer.append(TEXT_118);
454     stringBuffer.append(genModel.getNonNLS());
455     stringBuffer.append(TEXT_119);
456     }
457     stringBuffer.append(TEXT_120);
458     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
459     stringBuffer.append(TEXT_121);
460     stringBuffer.append(genModel.getNonNLS());
461     stringBuffer.append(TEXT_122);
462     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
463     stringBuffer.append(TEXT_123);
464     stringBuffer.append(genModel.getNonNLS());
465     stringBuffer.append(TEXT_124);
466     if (genModel.isRichClientPlatform()) {
467     stringBuffer.append(TEXT_125);
468     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
469     stringBuffer.append(TEXT_126);
470     stringBuffer.append(genPackage.getEditorClassName());
471     stringBuffer.append(TEXT_127);
472     stringBuffer.append(genModel.getNonNLS());
473     stringBuffer.append(TEXT_128);
474     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
475     stringBuffer.append(TEXT_129);
476     stringBuffer.append(genModel.getNonNLS());
477     stringBuffer.append(TEXT_130);
478     }
479     stringBuffer.append(TEXT_131);
480     if (!genModel.isRichClientPlatform()) {
481     stringBuffer.append(TEXT_132);
482     } else {
483     stringBuffer.append(TEXT_133);
484     }
485     stringBuffer.append(TEXT_134);
486     if (genModel.isRichClientPlatform()) {
487     stringBuffer.append(TEXT_135);
488     }
489     { String JavaDoc type = genPackage.hasDocumentRoot() ? "feature" : "type"; String JavaDoc prefix = genPackage.hasDocumentRoot() ? "_UI_DocumentRoot_" : "_UI_";
490     stringBuffer.append(TEXT_136);
491     stringBuffer.append(type);
492     stringBuffer.append(TEXT_137);
493     stringBuffer.append(type);
494     stringBuffer.append(TEXT_138);
495     stringBuffer.append(genPackage.getEditPluginClassName());
496     stringBuffer.append(TEXT_139);
497     stringBuffer.append(prefix);
498     stringBuffer.append(TEXT_140);
499     stringBuffer.append(type);
500     stringBuffer.append(TEXT_141);
501     stringBuffer.append(type);
502     stringBuffer.append(TEXT_142);
503     stringBuffer.append(genModel.getNonNLS());
504     stringBuffer.append(TEXT_143);
505     stringBuffer.append(genModel.getImportedName(genModel.getQualifiedEditorPluginClassName()));
506     stringBuffer.append(TEXT_144);
507     stringBuffer.append(type);
508     stringBuffer.append(TEXT_145);
509     }
510     stringBuffer.append(TEXT_146);
511     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
512     stringBuffer.append(TEXT_147);
513     stringBuffer.append(genModel.getNonNLS());
514     stringBuffer.append(TEXT_148);
515     if (!genModel.isRichClientPlatform()) {
516     stringBuffer.append(TEXT_149);
517     stringBuffer.append(genPackage.getModelWizardClassName());
518     stringBuffer.append(TEXT_150);
519     stringBuffer.append(genModel.getNonNLS());
520     stringBuffer.append(TEXT_151);
521     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
522     stringBuffer.append(TEXT_152);
523     stringBuffer.append(genPackage.getModelWizardClassName());
524     stringBuffer.append(TEXT_153);
525     stringBuffer.append(genModel.getNonNLS());
526     stringBuffer.append(TEXT_154);
527     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
528     stringBuffer.append(TEXT_155);
529     stringBuffer.append(genPackage.getModelWizardClassName());
530     stringBuffer.append(TEXT_156);
531     stringBuffer.append(genModel.getNonNLS());
532     stringBuffer.append(TEXT_157);
533     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
534     stringBuffer.append(TEXT_158);
535     stringBuffer.append(genPackage.getEditorClassName());
536     stringBuffer.append(TEXT_159);
537     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
538     stringBuffer.append(TEXT_160);
539     stringBuffer.append(genPackage.getEditorClassName());
540     stringBuffer.append(TEXT_161);
541     stringBuffer.append(genModel.getNonNLS());
542     stringBuffer.append(genModel.getNonNLS(2));
543     stringBuffer.append(genModel.getNonNLS(3));
544     stringBuffer.append(TEXT_162);
545     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
546     stringBuffer.append(TEXT_163);
547     stringBuffer.append(genPackage.getEditorClassName());
548     stringBuffer.append(TEXT_164);
549     stringBuffer.append(genModel.getNonNLS());
550     stringBuffer.append(TEXT_165);
551     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
552     stringBuffer.append(TEXT_166);
553     stringBuffer.append(genPackage.getEditorClassName());
554     stringBuffer.append(TEXT_167);
555     stringBuffer.append(genModel.getNonNLS());
556     stringBuffer.append(TEXT_168);
557     stringBuffer.append(genModel.getNonNLS());
558     stringBuffer.append(TEXT_169);
559     stringBuffer.append(genModel.getNonNLS());
560     stringBuffer.append(TEXT_170);
561     }
562     stringBuffer.append(TEXT_171);
563     stringBuffer.append(genPackage.getModelWizardClassName());
564     stringBuffer.append(TEXT_172);
565     stringBuffer.append(genModel.getNonNLS());
566     stringBuffer.append(TEXT_173);
567     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
568     stringBuffer.append(TEXT_174);
569     stringBuffer.append(genPackage.getModelWizardClassName());
570     stringBuffer.append(TEXT_175);
571     stringBuffer.append(genModel.getNonNLS());
572     stringBuffer.append(TEXT_176);
573     stringBuffer.append(genPackage.getImportedEditorPluginClassName());
574     stringBuffer.append(TEXT_177);
575     stringBuffer.append(genModel.getNonNLS());
576     stringBuffer.append(TEXT_178);
577     if (genModel.isRichClientPlatform()) {
578     stringBuffer.append(TEXT_179);
579     } else {
580     stringBuffer.append(TEXT_180);
581     }
582     stringBuffer.append(TEXT_181);
583     genModel.emitSortedImports();
584     stringBuffer.append(TEXT_182);
585     return stringBuffer.toString();
586   }
587 }
588
Popular Tags