View | Details | Raw Unified | Return to bug 154708 | Differences between
and this patch

Collapse All | Expand All

(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/templates/editor/PluginProperties.java (-31 / +40 lines)
Lines 38-61 Link Here
38
  protected final String TEXT_21 = " Model Editor" + NL + "" + NL + "_UI_";
38
  protected final String TEXT_21 = " Model Editor" + NL + "" + NL + "_UI_";
39
  protected final String TEXT_22 = "FilenameDefaultBase = My" + NL + "_UI_";
39
  protected final String TEXT_22 = "FilenameDefaultBase = My" + NL + "_UI_";
40
  protected final String TEXT_23 = "FilenameExtension = ";
40
  protected final String TEXT_23 = "FilenameExtension = ";
41
  protected final String TEXT_24 = NL;
41
  protected final String TEXT_24 = NL + NL + "_UI_";
42
  protected final String TEXT_25 = NL + "_UI_Wizard_label = New" + NL + "" + NL + "_WARN_FilenameExtension = The file name must end in \".{0}\"" + NL + "" + NL + "_UI_ModelObject = Model Object" + NL + "_UI_XMLEncoding = XML Encoding" + NL + "_UI_XMLEncodingChoices = ";
42
  protected final String TEXT_25 = "_label = ";
43
  protected final String TEXT_26 = NL + "_UI_Wizard_initial_object_description = Specify a file name and select a model object to create";
43
  protected final String TEXT_26 = " Editor Preferences" + NL + "_UI_EditorPreference_description_ = ";
44
  protected final String TEXT_27 = NL + "_UI_Wizard_initial_object_description = Select a model object to create";
44
  protected final String TEXT_27 = " Editor XML saving preferences." + NL + "_UI_EditorPreferenceTypeInformation_label = Save type information" + NL + "_UI_EditorPreferenceSaveDoctype_label = Save doctype declaration" + NL + "_UI_EditorPreferenceFormatted_label = Output formatted XML" + NL + "_UI_EditorPreferenceLineWidth_label = XML file line width" + NL;
45
  protected final String TEXT_28 = NL + NL + "_UI_FileConflict_label = File Conflict" + NL + "_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor.  Do you wish to discard this editor's changes?" + NL;
45
  protected final String TEXT_28 = NL + "_UI_Wizard_label = New" + NL + "" + NL + "_WARN_FilenameExtension = The file name must end in \".{0}\"" + NL + "" + NL + "_UI_ModelObject = Model Object" + NL + "_UI_XMLEncoding = XML Encoding" + NL + "_UI_XMLEncodingChoices = ";
46
  protected final String TEXT_29 = NL + "_UI_";
46
  protected final String TEXT_29 = NL + "_UI_Wizard_initial_object_description = Specify a file name and select a model object to create";
47
  protected final String TEXT_30 = "_ActionSet_label = ";
47
  protected final String TEXT_30 = NL + "_UI_Wizard_initial_object_description = Select a model object to create";
48
  protected final String TEXT_31 = " Action Set" + NL + "_UI_Perspective_label = ";
48
  protected final String TEXT_31 = NL + NL + "_UI_FileConflict_label = File Conflict" + NL + "_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor.  Do you wish to discard this editor's changes?" + NL;
49
  protected final String TEXT_32 = NL + NL + "_UI_Browse_label = &Browse..." + NL + "_UI_File_label = &File" + NL + "_UI_Question_title = Question" + NL + "_WARN_FileConflict = The file \"{0}\" already exists.  Do you want to replace the existing file?" + NL + "_UI_Error_title = Error" + NL + "_WARN_No_Editor = There is no editor registered for the file \"{0}\"." + NL + "" + NL + "_UI_Application_title = ";
49
  protected final String TEXT_32 = NL + "_UI_";
50
  protected final String TEXT_33 = " Application" + NL + "_UI_Menu_File_label = &File" + NL + "_UI_Menu_New_label = &New" + NL + "_UI_Menu_Open_label = &Open..." + NL + "_UI_Menu_Open_description = Opens a model object file" + NL + "_UI_Menu_OpenURI_label = &Open URI..." + NL + "_UI_Menu_OpenURI_description = Opens a model object loading it from a URI" + NL + "_UI_Menu_Edit_label = &Edit" + NL + "_UI_Menu_Window_label = &Window" + NL + "_UI_Menu_Help_label = &Help" + NL + "_UI_Menu_About_label = ";
50
  protected final String TEXT_33 = "_ActionSet_label = ";
51
  protected final String TEXT_34 = " &About..." + NL + "_UI_About_title = ";
51
  protected final String TEXT_34 = " Action Set" + NL + "_UI_Perspective_label = ";
52
  protected final String TEXT_35 = " Application" + NL + "_UI_About_text = ";
52
  protected final String TEXT_35 = NL + NL + "_UI_Browse_label = &Browse..." + NL + "_UI_File_label = &File" + NL + "_UI_Question_title = Question" + NL + "_WARN_FileConflict = The file \"{0}\" already exists.  Do you want to replace the existing file?" + NL + "_UI_Error_title = Error" + NL + "_WARN_No_Editor = There is no editor registered for the file \"{0}\"." + NL + "" + NL + "_UI_Application_title = ";
53
  protected final String TEXT_36 = " Application about box goes here." + NL;
53
  protected final String TEXT_36 = " Application" + NL + "_UI_Menu_File_label = &File" + NL + "_UI_Menu_New_label = &New" + NL + "_UI_Menu_Open_label = &Open..." + NL + "_UI_Menu_Open_description = Opens a model object file" + NL + "_UI_Menu_OpenURI_label = &Open URI..." + NL + "_UI_Menu_OpenURI_description = Opens a model object loading it from a URI" + NL + "_UI_Menu_Edit_label = &Edit" + NL + "_UI_Menu_Window_label = &Window" + NL + "_UI_Menu_Help_label = &Help" + NL + "_UI_Menu_About_label = ";
54
  protected final String TEXT_37 = NL + "_UI_";
54
  protected final String TEXT_37 = " &About..." + NL + "_UI_About_title = ";
55
  protected final String TEXT_38 = "_ActionSet_label = ";
55
  protected final String TEXT_38 = " Application" + NL + "_UI_About_text = ";
56
  protected final String TEXT_39 = " Model Action Set";
56
  protected final String TEXT_39 = " Application about box goes here." + NL;
57
  protected final String TEXT_40 = NL;
57
  protected final String TEXT_40 = NL + "_UI_";
58
  protected final String TEXT_41 = NL;
58
  protected final String TEXT_41 = "_ActionSet_label = ";
59
  protected final String TEXT_42 = " Model Action Set";
60
  protected final String TEXT_43 = NL;
61
  protected final String TEXT_44 = NL;
59
62
60
  public String generate(Object argument)
63
  public String generate(Object argument)
61
  {
64
  {
Lines 125-148 Link Here
125
    stringBuffer.append(TEXT_23);
128
    stringBuffer.append(TEXT_23);
126
    stringBuffer.append(genPackage.getPrefix().toLowerCase());
129
    stringBuffer.append(genPackage.getPrefix().toLowerCase());
127
    stringBuffer.append(TEXT_24);
130
    stringBuffer.append(TEXT_24);
128
    }
131
    stringBuffer.append(genPackage.getEditorPreferencePageClassName());
129
    stringBuffer.append(TEXT_25);
132
    stringBuffer.append(TEXT_25);
130
    stringBuffer.append(genModel.getXMLEncodingChoices());
133
    stringBuffer.append(genPackage.getPrefix());
131
    if (genModel.isRichClientPlatform()) {
132
    stringBuffer.append(TEXT_26);
134
    stringBuffer.append(TEXT_26);
133
    } else {
135
    stringBuffer.append(genPackage.getPrefix());
134
    stringBuffer.append(TEXT_27);
136
    stringBuffer.append(TEXT_27);
135
    }
137
    }
136
    stringBuffer.append(TEXT_28);
138
    stringBuffer.append(TEXT_28);
139
    stringBuffer.append(genModel.getXMLEncodingChoices());
137
    if (genModel.isRichClientPlatform()) {
140
    if (genModel.isRichClientPlatform()) {
138
    stringBuffer.append(TEXT_29);
141
    stringBuffer.append(TEXT_29);
139
    stringBuffer.append(genModel.getEditorAdvisorClassName());
142
    } else {
140
    stringBuffer.append(TEXT_30);
143
    stringBuffer.append(TEXT_30);
141
    stringBuffer.append(genModel.getModelName());
144
    }
142
    stringBuffer.append(TEXT_31);
145
    stringBuffer.append(TEXT_31);
143
    stringBuffer.append(genModel.getModelName());
146
    if (genModel.isRichClientPlatform()) {
144
    stringBuffer.append(TEXT_32);
147
    stringBuffer.append(TEXT_32);
145
    stringBuffer.append(genModel.getModelName());
148
    stringBuffer.append(genModel.getEditorAdvisorClassName());
146
    stringBuffer.append(TEXT_33);
149
    stringBuffer.append(TEXT_33);
147
    stringBuffer.append(genModel.getModelName());
150
    stringBuffer.append(genModel.getModelName());
148
    stringBuffer.append(TEXT_34);
151
    stringBuffer.append(TEXT_34);
Lines 150-165 Link Here
150
    stringBuffer.append(TEXT_35);
153
    stringBuffer.append(TEXT_35);
151
    stringBuffer.append(genModel.getModelName());
154
    stringBuffer.append(genModel.getModelName());
152
    stringBuffer.append(TEXT_36);
155
    stringBuffer.append(TEXT_36);
153
    for (GenPackage genPackage : genModel.getAllGenPackagesWithClassifiers()) {if (genPackage.isGenerateModelWizard()) {
156
    stringBuffer.append(genModel.getModelName());
154
    stringBuffer.append(TEXT_37);
157
    stringBuffer.append(TEXT_37);
155
    stringBuffer.append(genPackage.getModelWizardClassName());
158
    stringBuffer.append(genModel.getModelName());
156
    stringBuffer.append(TEXT_38);
159
    stringBuffer.append(TEXT_38);
157
    stringBuffer.append(genPackage.getPrefix());
160
    stringBuffer.append(genModel.getModelName());
158
    stringBuffer.append(TEXT_39);
161
    stringBuffer.append(TEXT_39);
159
    }}
162
    for (GenPackage genPackage : genModel.getAllGenPackagesWithClassifiers()) {if (genPackage.isGenerateModelWizard()) {
160
    stringBuffer.append(TEXT_40);
163
    stringBuffer.append(TEXT_40);
161
    }
164
    stringBuffer.append(genPackage.getModelWizardClassName());
162
    stringBuffer.append(TEXT_41);
165
    stringBuffer.append(TEXT_41);
166
    stringBuffer.append(genPackage.getPrefix());
167
    stringBuffer.append(TEXT_42);
168
    }}
169
    stringBuffer.append(TEXT_43);
170
    }
171
    stringBuffer.append(TEXT_44);
163
    return stringBuffer.toString();
172
    return stringBuffer.toString();
164
  }
173
  }
165
}
174
}
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/templates/editor/PluginXML.java (-5 / +14 lines)
Lines 88-96 Link Here
88
  protected final String TEXT_71 = "ModelFile.gif\"" + NL + "        extensions = \"";
88
  protected final String TEXT_71 = "ModelFile.gif\"" + NL + "        extensions = \"";
89
  protected final String TEXT_72 = "\"" + NL + "        class = \"";
89
  protected final String TEXT_72 = "\"" + NL + "        class = \"";
90
  protected final String TEXT_73 = "\" " + NL + "        contributorClass=\"";
90
  protected final String TEXT_73 = "\" " + NL + "        contributorClass=\"";
91
  protected final String TEXT_74 = "\" >" + NL + "    </editor>" + NL + "  </extension>    ";
91
  protected final String TEXT_74 = "\" >" + NL + "    </editor>" + NL + "  </extension>   " + NL + "  " + NL + "  <extension" + NL + "    point=\"org.eclipse.ui.preferencePages\">" + NL + "    <page" + NL + "      id=\"";
92
  protected final String TEXT_75 = NL + "</plugin>";
92
  protected final String TEXT_75 = "ID\"" + NL + "      class=\"";
93
  protected final String TEXT_76 = NL;
93
  protected final String TEXT_76 = "\"" + NL + "      name=\"%_UI_";
94
  protected final String TEXT_77 = "_label\" >" + NL + "    </page>" + NL + "  </extension> ";
95
  protected final String TEXT_78 = NL + "</plugin>";
96
  protected final String TEXT_79 = NL;
94
97
95
  public String generate(Object argument)
98
  public String generate(Object argument)
96
  {
99
  {
Lines 270-279 Link Here
270
    stringBuffer.append(TEXT_73);
273
    stringBuffer.append(TEXT_73);
271
    stringBuffer.append(genPackage.getQualifiedActionBarContributorClassName());
274
    stringBuffer.append(genPackage.getQualifiedActionBarContributorClassName());
272
    stringBuffer.append(TEXT_74);
275
    stringBuffer.append(TEXT_74);
273
    }
276
    stringBuffer.append(genPackage.getQualifiedEditorPreferencePageClassName());
274
    }
275
    stringBuffer.append(TEXT_75);
277
    stringBuffer.append(TEXT_75);
278
    stringBuffer.append(genPackage.getQualifiedEditorPreferencePageClassName());
276
    stringBuffer.append(TEXT_76);
279
    stringBuffer.append(TEXT_76);
280
    stringBuffer.append(genPackage.getEditorPreferencePageClassName());
281
    stringBuffer.append(TEXT_77);
282
    }
283
    }
284
    stringBuffer.append(TEXT_78);
285
    stringBuffer.append(TEXT_79);
277
    return stringBuffer.toString();
286
    return stringBuffer.toString();
278
  }
287
  }
279
}
288
}
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/templates/editor/Editor.java (-4 / +4 lines)
Lines 23-29 Link Here
23
  protected final String TEXT_6 = NL + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.IMarker;" + NL + "import org.eclipse.core.resources.IResource;" + NL + "import org.eclipse.core.resources.IResourceChangeEvent;" + NL + "import org.eclipse.core.resources.IResourceChangeListener;" + NL + "import org.eclipse.core.resources.IResourceDelta;" + NL + "import org.eclipse.core.resources.IResourceDeltaVisitor;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;";
23
  protected final String TEXT_6 = NL + NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.IMarker;" + NL + "import org.eclipse.core.resources.IResource;" + NL + "import org.eclipse.core.resources.IResourceChangeEvent;" + NL + "import org.eclipse.core.resources.IResourceChangeListener;" + NL + "import org.eclipse.core.resources.IResourceDelta;" + NL + "import org.eclipse.core.resources.IResourceDeltaVisitor;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;";
24
  protected final String TEXT_7 = NL;
24
  protected final String TEXT_7 = NL;
25
  protected final String TEXT_8 = NL + "import org.eclipse.core.runtime.CoreException;" + NL + "import org.eclipse.core.runtime.IPath;";
25
  protected final String TEXT_8 = NL + "import org.eclipse.core.runtime.CoreException;" + NL + "import org.eclipse.core.runtime.IPath;";
26
  protected final String TEXT_9 = NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.core.runtime.NullProgressMonitor;" + NL + "" + NL + "import org.eclipse.jface.action.IMenuListener;" + NL + "import org.eclipse.jface.action.IMenuManager;" + NL + "import org.eclipse.jface.action.IStatusLineManager;" + NL + "import org.eclipse.jface.action.IToolBarManager;" + NL + "import org.eclipse.jface.action.MenuManager;" + NL + "import org.eclipse.jface.action.Separator;" + NL + "" + NL + "import org.eclipse.jface.dialogs.MessageDialog;" + NL + "import org.eclipse.jface.dialogs.ProgressMonitorDialog;" + NL;
26
  protected final String TEXT_9 = NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "import org.eclipse.core.runtime.NullProgressMonitor;" + NL + "" + NL + "import org.eclipse.jface.action.IMenuListener;" + NL + "import org.eclipse.jface.action.IMenuManager;" + NL + "import org.eclipse.jface.action.IStatusLineManager;" + NL + "import org.eclipse.jface.action.IToolBarManager;" + NL + "import org.eclipse.jface.action.MenuManager;" + NL + "import org.eclipse.jface.action.Separator;" + NL + "" + NL + "import org.eclipse.jface.dialogs.MessageDialog;" + NL + "import org.eclipse.jface.dialogs.ProgressMonitorDialog;" + NL + "" + NL + "import org.eclipse.jface.preference.IPreferenceStore;" + NL;
27
  protected final String TEXT_10 = NL + "import org.eclipse.jface.viewers.ColumnWeightData;";
27
  protected final String TEXT_10 = NL + "import org.eclipse.jface.viewers.ColumnWeightData;";
28
  protected final String TEXT_11 = NL + "import org.eclipse.jface.viewers.ISelection;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.ISelectionProvider;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;";
28
  protected final String TEXT_11 = NL + "import org.eclipse.jface.viewers.ISelection;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.ISelectionProvider;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;";
29
  protected final String TEXT_12 = NL + "import org.eclipse.jface.viewers.ListViewer;";
29
  protected final String TEXT_12 = NL + "import org.eclipse.jface.viewers.ListViewer;";
Lines 48-54 Link Here
48
  protected final String TEXT_31 = NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EValidator;";
48
  protected final String TEXT_31 = NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EValidator;";
49
  protected final String TEXT_32 = NL + NL + "import org.eclipse.emf.ecore.resource.Resource;";
49
  protected final String TEXT_32 = NL + NL + "import org.eclipse.emf.ecore.resource.Resource;";
50
  protected final String TEXT_33 = NL + "import org.eclipse.emf.ecore.resource.ResourceSet;";
50
  protected final String TEXT_33 = NL + "import org.eclipse.emf.ecore.resource.ResourceSet;";
51
  protected final String TEXT_34 = NL + NL + "import org.eclipse.emf.ecore.util.EContentAdapter;" + NL + "import org.eclipse.emf.ecore.util.EcoreUtil;" + NL + "" + NL + "import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;" + NL + "import org.eclipse.emf.edit.domain.EditingDomain;" + NL + "import org.eclipse.emf.edit.domain.IEditingDomainProvider;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;" + NL + "import org.eclipse.emf.edit.ui.dnd.LocalTransfer;" + NL + "import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;";
51
  protected final String TEXT_34 = NL + NL + "import org.eclipse.emf.ecore.util.EContentAdapter;" + NL + "import org.eclipse.emf.ecore.util.EcoreUtil;" + NL + "" + NL + "import org.eclipse.emf.ecore.xmi.XMLResource;" + NL + "" + NL + "import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;" + NL + "import org.eclipse.emf.edit.domain.EditingDomain;" + NL + "import org.eclipse.emf.edit.domain.IEditingDomainProvider;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;" + NL + "import org.eclipse.emf.edit.ui.dnd.LocalTransfer;" + NL + "import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;";
52
  protected final String TEXT_35 = NL + NL + "import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;";
52
  protected final String TEXT_35 = NL + NL + "import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;";
53
  protected final String TEXT_36 = NL + NL + "import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;" + NL + "" + NL + "import ";
53
  protected final String TEXT_36 = NL + NL + "import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;" + NL + "" + NL + "import ";
54
  protected final String TEXT_37 = ";" + NL;
54
  protected final String TEXT_37 = ";" + NL;
Lines 246-257 Link Here
246
  protected final String TEXT_229 = "()" + NL + "\t\t\t{" + NL + "\t\t\t\t// This is the method that gets invoked when the operation runs." + NL + "\t\t\t\t//";
246
  protected final String TEXT_229 = "()" + NL + "\t\t\t{" + NL + "\t\t\t\t// This is the method that gets invoked when the operation runs." + NL + "\t\t\t\t//";
247
  protected final String TEXT_230 = NL + "\t\t\t\t@Override";
247
  protected final String TEXT_230 = NL + "\t\t\t\t@Override";
248
  protected final String TEXT_231 = NL + "\t\t\t\tpublic void ";
248
  protected final String TEXT_231 = NL + "\t\t\t\tpublic void ";
249
  protected final String TEXT_232 = "(IProgressMonitor monitor)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\t// Save the resources to the file system." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tboolean first = true;";
249
  protected final String TEXT_232 = "(IProgressMonitor monitor)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\t// Save the resources to the file system." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tboolean first = true;" + NL + "\t\t\t\t\tMap<?, ?> options = getOptions();";
250
  protected final String TEXT_233 = NL + "\t\t\t\t\tfor (Resource resource : editingDomain.getResourceSet().getResources())";
250
  protected final String TEXT_233 = NL + "\t\t\t\t\tfor (Resource resource : editingDomain.getResourceSet().getResources())";
251
  protected final String TEXT_234 = NL + "\t\t\t\t\tfor (Iterator i = editingDomain.getResourceSet().getResources().iterator(); i.hasNext(); )";
251
  protected final String TEXT_234 = NL + "\t\t\t\t\tfor (Iterator i = editingDomain.getResourceSet().getResources().iterator(); i.hasNext(); )";
252
  protected final String TEXT_235 = NL + "\t\t\t\t\t{";
252
  protected final String TEXT_235 = NL + "\t\t\t\t\t{";
253
  protected final String TEXT_236 = NL + "\t\t\t\t\t\tResource resource = (Resource)i.next();";
253
  protected final String TEXT_236 = NL + "\t\t\t\t\t\tResource resource = (Resource)i.next();";
254
  protected final String TEXT_237 = NL + "\t\t\t\t\t\tif ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource))" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\ttry" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tsavedResources.add(resource);" + NL + "\t\t\t\t\t\t\t\tresource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\tcatch (Exception exception)" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tresourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\tfirst = false;" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "" + NL + "\t\tupdateProblemIndication = false;" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\t// This runs the options, and shows progress." + NL + "\t\t\t//" + NL + "\t\t\tnew ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);" + NL + "" + NL + "\t\t\t// Refresh the necessary state." + NL + "\t\t\t//" + NL + "\t\t\t((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t// Something went wrong that shouldn't." + NL + "\t\t\t//" + NL + "\t\t\t";
254
  protected final String TEXT_237 = NL + "\t\t\t\t\t\tif ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource))" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\ttry" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tsavedResources.add(resource);" + NL + "\t\t\t\t\t\t\t\tresource.save(options);" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\tcatch (Exception exception)" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tresourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\tfirst = false;" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\t" + NL + "\t\t\t\t// determine save options from properties" + NL + "\t\t\t\tprivate Map<?, ?> getOptions() {" + NL + "\t\t\t\t\tMap<String, Object> options = new HashMap<String, Object>();" + NL + "\t\t\t\t\tIPreferenceStore store = ModelEditorPlugin.getPlugin().getPreferenceStore();" + NL + "\t\t\t\t\tString key = XMLResource.OPTION_SAVE_TYPE_INFORMATION;" + NL + "\t\t\t\t\tif (store.contains(key)) {" + NL + "\t\t\t\t\t\toptions.put(key, store.getBoolean(key));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tkey = XMLResource.OPTION_SAVE_DOCTYPE;" + NL + "\t\t\t\t\tif (store.contains(key)) {" + NL + "\t\t\t\t\t\toptions.put(key, store.getBoolean(key));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tkey = XMLResource.OPTION_FORMATTED;" + NL + "\t\t\t\t\tif (store.contains(key)) {" + NL + "\t\t\t\t\t\toptions.put(key, store.getBoolean(key));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tkey = XMLResource.OPTION_LINE_WIDTH;" + NL + "\t\t\t\t\tif (store.contains(key)) {" + NL + "\t\t\t\t\t\toptions.put(key, store.getInt(key));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\t" + NL + "\t\t\t\t\treturn options;" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "" + NL + "\t\tupdateProblemIndication = false;" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\t// This runs the options, and shows progress." + NL + "\t\t\t//" + NL + "\t\t\tnew ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);" + NL + "" + NL + "\t\t\t// Refresh the necessary state." + NL + "\t\t\t//" + NL + "\t\t\t((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t// Something went wrong that shouldn't." + NL + "\t\t\t//" + NL + "\t\t\t";
255
  protected final String TEXT_238 = ".INSTANCE.log(exception);" + NL + "\t\t}" + NL + "\t\tupdateProblemIndication = true;" + NL + "\t\tupdateProblemIndication();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This returns wether something has been persisted to the URI of the specified resource." + NL + "\t * The implementation uses the URI converter from the editor's resource set to try to open an input stream. " + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isPersisted(Resource resource)" + NL + "\t{" + NL + "\t\tboolean result = false;" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\tInputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());" + NL + "\t\t\tif (stream != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tresult = true;" + NL + "\t\t\t\tstream.close();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (IOException e)" + NL + "\t\t{" + NL + "\t\t\t// Ignore" + NL + "\t\t}" + NL + "\t\treturn result;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This always returns true because it is not currently supported." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */";
255
  protected final String TEXT_238 = ".INSTANCE.log(exception);" + NL + "\t\t}" + NL + "\t\tupdateProblemIndication = true;" + NL + "\t\tupdateProblemIndication();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This returns wether something has been persisted to the URI of the specified resource." + NL + "\t * The implementation uses the URI converter from the editor's resource set to try to open an input stream. " + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isPersisted(Resource resource)" + NL + "\t{" + NL + "\t\tboolean result = false;" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\tInputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());" + NL + "\t\t\tif (stream != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tresult = true;" + NL + "\t\t\t\tstream.close();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (IOException e)" + NL + "\t\t{" + NL + "\t\t\t// Ignore" + NL + "\t\t}" + NL + "\t\treturn result;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This always returns true because it is not currently supported." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */";
256
  protected final String TEXT_239 = NL + "\t@Override";
256
  protected final String TEXT_239 = NL + "\t@Override";
257
  protected final String TEXT_240 = NL + "\tpublic boolean isSaveAsAllowed()" + NL + "\t{" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This also changes the editor's input." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */";
257
  protected final String TEXT_240 = NL + "\tpublic boolean isSaveAsAllowed()" + NL + "\t{" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This also changes the editor's input." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */";
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/GenModel.java (-1 / +1 lines)
Lines 1088-1094 Link Here
1088
   * @generated
1088
   * @generated
1089
   */
1089
   */
1090
  void setRichClientPlatform(boolean value);
1090
  void setRichClientPlatform(boolean value);
1091
1091
  
1092
  /**
1092
  /**
1093
   * Returns the value of the '<em><b>Reflective Delegation</b></em>' attribute.
1093
   * Returns the value of the '<em><b>Reflective Delegation</b></em>' attribute.
1094
   * <!-- begin-user-doc -->
1094
   * <!-- begin-user-doc -->
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/GenPackage.java (+2 lines)
Lines 832-837 Link Here
832
  String getActionBarContributorClassName();
832
  String getActionBarContributorClassName();
833
  String getQualifiedActionBarContributorClassName();
833
  String getQualifiedActionBarContributorClassName();
834
  String getImportedActionBarContributorClassName();
834
  String getImportedActionBarContributorClassName();
835
  String getEditorPreferencePageClassName();
836
  String getQualifiedEditorPreferencePageClassName();
835
837
836
  String getAdapterFactoryDelegateName(GenPackage genDelegate);
838
  String getAdapterFactoryDelegateName(GenPackage genDelegate);
837
  String getUncapAdapterFactoryDelegateName(GenPackage genDelegate);
839
  String getUncapAdapterFactoryDelegateName(GenPackage genDelegate);
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/impl/GenPackageImpl.java (+10 lines)
Lines 3150-3155 Link Here
3150
  {
3150
  {
3151
    return getGenModel().getImportedName(getQualifiedActionBarContributorClassName());
3151
    return getGenModel().getImportedName(getQualifiedActionBarContributorClassName());
3152
  }
3152
  }
3153
  
3154
  public String getEditorPreferencePageClassName()
3155
  {
3156
	return getPrefixedName("PreferencesPage");
3157
  }
3158
  
3159
  public String getQualifiedEditorPreferencePageClassName()
3160
  {
3161
	  return getPresentationPackageName() + "." + getEditorPreferencePageClassName();
3162
  }
3153
3163
3154
  public String getAdapterFactoryDelegateName(GenPackage genDelegate)
3164
  public String getAdapterFactoryDelegateName(GenPackage genDelegate)
3155
  {
3165
  {
(-)plugins/org.eclipse.emf.codegen.ecore/templates/editor/Editor.javajet (-1 / +30 lines)
Lines 76-81 Link Here
76
import org.eclipse.jface.dialogs.MessageDialog;
76
import org.eclipse.jface.dialogs.MessageDialog;
77
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
77
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
78
78
79
import org.eclipse.jface.preference.IPreferenceStore;
80
79
<%if (genPackage.isMultipleEditorPages()) {%>
81
<%if (genPackage.isMultipleEditorPages()) {%>
80
import org.eclipse.jface.viewers.ColumnWeightData;
82
import org.eclipse.jface.viewers.ColumnWeightData;
81
<%}%>
83
<%}%>
Lines 189-194 Link Here
189
import org.eclipse.emf.ecore.util.EContentAdapter;
191
import org.eclipse.emf.ecore.util.EContentAdapter;
190
import org.eclipse.emf.ecore.util.EcoreUtil;
192
import org.eclipse.emf.ecore.util.EcoreUtil;
191
193
194
import org.eclipse.emf.ecore.xmi.XMLResource;
195
192
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
196
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
193
import org.eclipse.emf.edit.domain.EditingDomain;
197
import org.eclipse.emf.edit.domain.EditingDomain;
194
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
198
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
Lines 1844-1849 Link Here
1844
					// Save the resources to the file system.
1848
					// Save the resources to the file system.
1845
					//
1849
					//
1846
					boolean first = true;
1850
					boolean first = true;
1851
					Map<?, ?> options = getOptions();
1847
<%if (genModel.useGenerics()) {%>
1852
<%if (genModel.useGenerics()) {%>
1848
					for (Resource resource : editingDomain.getResourceSet().getResources())
1853
					for (Resource resource : editingDomain.getResourceSet().getResources())
1849
<%} else {%>
1854
<%} else {%>
Lines 1858-1864 Link Here
1858
							try
1863
							try
1859
							{
1864
							{
1860
								savedResources.add(resource);
1865
								savedResources.add(resource);
1861
								resource.save(Collections.EMPTY_MAP);
1866
								resource.save(options);
1862
							}
1867
							}
1863
							catch (Exception exception)
1868
							catch (Exception exception)
1864
							{
1869
							{
Lines 1868-1873 Link Here
1868
						}
1873
						}
1869
					}
1874
					}
1870
				}
1875
				}
1876
				
1877
				// determine save options from properties
1878
				private Map<?, ?> getOptions() {
1879
					Map<String, Object> options = new HashMap<String, Object>();
1880
					IPreferenceStore store = ModelEditorPlugin.getPlugin().getPreferenceStore();
1881
					String key = XMLResource.OPTION_SAVE_TYPE_INFORMATION;
1882
					if (store.contains(key)) {
1883
						options.put(key, store.getBoolean(key));
1884
					}
1885
					key = XMLResource.OPTION_SAVE_DOCTYPE;
1886
					if (store.contains(key)) {
1887
						options.put(key, store.getBoolean(key));
1888
					}
1889
					key = XMLResource.OPTION_FORMATTED;
1890
					if (store.contains(key)) {
1891
						options.put(key, store.getBoolean(key));
1892
					}
1893
					key = XMLResource.OPTION_LINE_WIDTH;
1894
					if (store.contains(key)) {
1895
						options.put(key, store.getInt(key));
1896
					}
1897
					
1898
					return options;
1899
				}
1871
			};
1900
			};
1872
1901
1873
		updateProblemIndication = false;
1902
		updateProblemIndication = false;
(-)plugins/org.eclipse.emf.codegen.ecore/templates/editor/plugin.propertiesjet (+7 lines)
Lines 78-83 Link Here
78
_UI_<%=genPackage.getEditorClassName()%>FilenameDefaultBase = My
78
_UI_<%=genPackage.getEditorClassName()%>FilenameDefaultBase = My
79
_UI_<%=genPackage.getEditorClassName()%>FilenameExtension = <%=genPackage.getPrefix().toLowerCase()%>
79
_UI_<%=genPackage.getEditorClassName()%>FilenameExtension = <%=genPackage.getPrefix().toLowerCase()%>
80
80
81
_UI_<%=genPackage.getEditorPreferencePageClassName()%>_label = <%=genPackage.getPrefix()%> Editor Preferences
82
_UI_EditorPreference_description_ = <%=genPackage.getPrefix()%> Editor XML saving preferences.
83
_UI_EditorPreferenceTypeInformation_label = Save type information
84
_UI_EditorPreferenceSaveDoctype_label = Save doctype declaration
85
_UI_EditorPreferenceFormatted_label = Output formatted XML
86
_UI_EditorPreferenceLineWidth_label = XML file line width
87
81
<%}%>
88
<%}%>
82
_UI_Wizard_label = New
89
_UI_Wizard_label = New
83
90
(-)plugins/org.eclipse.emf.codegen.ecore/templates/editor/plugin.xmljet (-1 / +10 lines)
Lines 205-211 Link Here
205
        class = "<%=genPackage.getQualifiedEditorClassName()%>" 
205
        class = "<%=genPackage.getQualifiedEditorClassName()%>" 
206
        contributorClass="<%=genPackage.getQualifiedActionBarContributorClassName()%>" >
206
        contributorClass="<%=genPackage.getQualifiedActionBarContributorClassName()%>" >
207
    </editor>
207
    </editor>
208
  </extension>    
208
  </extension>   
209
  
210
  <extension
211
    point="org.eclipse.ui.preferencePages">
212
    <page
213
      id="<%=genPackage.getQualifiedEditorPreferencePageClassName()%>ID"
214
      class="<%=genPackage.getQualifiedEditorPreferencePageClassName()%>"
215
      name="%_UI_<%=genPackage.getEditorPreferencePageClassName()%>_label" >
216
    </page>
217
  </extension> 
209
  <%}%>
218
  <%}%>
210
<%}%>
219
<%}%>
211
</plugin>
220
</plugin>
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/genmodel/generator/GenPackageGeneratorAdapter.java (-2 / +26 lines)
Lines 67-73 Link Here
67
  protected static final int ACTION_BAR_CONTRIBUTOR_ID = 11;
67
  protected static final int ACTION_BAR_CONTRIBUTOR_ID = 11;
68
  protected static final int PACKAGE_TEST_SUITE_ID = 12;
68
  protected static final int PACKAGE_TEST_SUITE_ID = 12;
69
  protected static final int PACKAGE_EXAMPLE_ID = 13;
69
  protected static final int PACKAGE_EXAMPLE_ID = 13;
70
70
  protected static final int EDITOR_PREFERENCES_ID = 14;
71
  
71
  private static final JETEmitterDescriptor[] JET_EMITTER_DESCRIPTORS =
72
  private static final JETEmitterDescriptor[] JET_EMITTER_DESCRIPTORS =
72
  {
73
  {
73
    new JETEmitterDescriptor("model/PackageClass.javajet", "org.eclipse.emf.codegen.ecore.templates.model.PackageClass"),
74
    new JETEmitterDescriptor("model/PackageClass.javajet", "org.eclipse.emf.codegen.ecore.templates.model.PackageClass"),
Lines 83-89 Link Here
83
    new JETEmitterDescriptor("editor/ModelWizard.javajet", "org.eclipse.emf.codegen.ecore.templates.editor.ModelWizard"),
84
    new JETEmitterDescriptor("editor/ModelWizard.javajet", "org.eclipse.emf.codegen.ecore.templates.editor.ModelWizard"),
84
    new JETEmitterDescriptor("editor/ActionBarContributor.javajet", "org.eclipse.emf.codegen.ecore.templates.editor.ActionBarContributor"),
85
    new JETEmitterDescriptor("editor/ActionBarContributor.javajet", "org.eclipse.emf.codegen.ecore.templates.editor.ActionBarContributor"),
85
    new JETEmitterDescriptor("model.tests/PackageTestSuite.javajet", "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageTestSuite"),
86
    new JETEmitterDescriptor("model.tests/PackageTestSuite.javajet", "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageTestSuite"),
86
    new JETEmitterDescriptor("model.tests/PackageExample.javajet", "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageExample")
87
    new JETEmitterDescriptor("model.tests/PackageExample.javajet", "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageExample"),
88
    new JETEmitterDescriptor("editor/EditorPreferencesPage.javajet", "org.eclipse.emf.codegen.ecore.templates.editor.EditorPreferencesPage")
87
  };
89
  };
88
90
89
  /**
91
  /**
Lines 585-590 Link Here
585
    generateActionBarContributor(genPackage, monitor);
587
    generateActionBarContributor(genPackage, monitor);
586
    generateModelIcon(genPackage, monitor);
588
    generateModelIcon(genPackage, monitor);
587
    generateModelWizardIcon(genPackage, monitor);
589
    generateModelWizardIcon(genPackage, monitor);
590
    generateEditorPreferencesPage(genPackage, monitor);
588
591
589
    return Diagnostic.OK_INSTANCE;
592
    return Diagnostic.OK_INSTANCE;
590
  }
593
  }
Lines 609-614 Link Here
609
      monitor.worked(1);
612
      monitor.worked(1);
610
    }
613
    }
611
  }
614
  }
615
  
616
  protected void generateEditorPreferencesPage(GenPackage genPackage, Monitor monitor)
617
  {
618
    if (genPackage.hasConcreteClasses())
619
    {
620
      message = CodeGenEcorePlugin.INSTANCE.getString
621
        ("_UI_GeneratingJavaClass_message", new Object[] { genPackage.getQualifiedEditorPreferencePageClassName() });
622
      monitor.subTask(message);
623
      generateJava
624
        (genPackage.getGenModel().getEditorDirectory(),
625
         genPackage.getPresentationPackageName(),
626
         genPackage.getEditorPreferencePageClassName(),
627
         getJETEmitter(getJETEmitterDescriptors(), EDITOR_PREFERENCES_ID),
628
         null,
629
         createMonitor(monitor, 1)); 
630
    }
631
    else
632
    {
633
      monitor.worked(1);
634
    }
635
  }
612
636
613
  protected void generateModelWizard(GenPackage genPackage, Monitor monitor)
637
  protected void generateModelWizard(GenPackage genPackage, Monitor monitor)
614
  {
638
  {
(-)plugins/org.eclipse.emf.codegen.ecore/src/org/eclipse/emf/codegen/ecore/templates/editor/EditorPreferencesPage.java (+98 lines)
Added Link Here
1
package org.eclipse.emf.codegen.ecore.templates.editor;
2
3
import java.util.*;
4
import org.eclipse.emf.codegen.ecore.genmodel.*;
5
6
public class EditorPreferencesPage
7
{
8
  protected static String nl;
9
  public static synchronized EditorPreferencesPage create(String lineSeparator)
10
  {
11
    nl = lineSeparator;
12
    EditorPreferencesPage result = new EditorPreferencesPage();
13
    nl = null;
14
    return result;
15
  }
16
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * ";
20
  protected final String TEXT_3 = "Id";
21
  protected final String TEXT_4 = NL + " */" + NL + "package ";
22
  protected final String TEXT_5 = ";" + NL + "" + NL + "import org.eclipse.emf.ecore.xmi.XMLResource;" + NL + "import org.eclipse.jface.preference.BooleanFieldEditor;" + NL + "import org.eclipse.jface.preference.FieldEditor;" + NL + "import org.eclipse.jface.preference.FieldEditorPreferencePage;" + NL + "import org.eclipse.jface.preference.IPreferenceStore;" + NL + "import org.eclipse.jface.preference.IntegerFieldEditor;" + NL + "import org.eclipse.jface.resource.ImageDescriptor;" + NL + "import org.eclipse.ui.IWorkbench;" + NL + "import org.eclipse.ui.IWorkbenchPreferencePage;" + NL + "import org.eclipse.ui.internal.menus.SeparatorContributionItem;" + NL + "" + NL + "/**" + NL + " * This is an example of a ";
23
  protected final String TEXT_6 = " model editor preferences." + NL + " * <!-- begin-user-doc -->" + NL + " * <!-- end-user-doc -->" + NL + " * @generated" + NL + " */" + NL + "public class ";
24
  protected final String TEXT_7 = " extends FieldEditorPreferencePage implements" + NL + "\t\tIWorkbenchPreferencePage {";
25
  protected final String TEXT_8 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final ";
26
  protected final String TEXT_9 = " copyright = \"";
27
  protected final String TEXT_10 = "\";";
28
  protected final String TEXT_11 = NL;
29
  protected final String TEXT_12 = NL + "    /**" + NL + "\t * Create the instance." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
30
  protected final String TEXT_13 = "() {" + NL + "\t\tsuper(GRID);" + NL + "\t\tsetDescription(\"Cargarage Editor XML saving preferences.\");" + NL + "\t\tIPreferenceStore store = ";
31
  protected final String TEXT_14 = ".getPlugin().getPreferenceStore();" + NL + "\t\tsetPreferenceStore(store);" + NL + "\t}" + NL + "" + NL + "    /**" + NL + "\t * Create the preference page contents." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */\t" + NL + "\t@Override" + NL + "\tprotected void createFieldEditors() {" + NL + "\t\tFieldEditor saveTypeInformation = new BooleanFieldEditor(XMLResource.OPTION_SAVE_TYPE_INFORMATION, getString(\"_UI_EditorPreferenceTypeInformation_label\"), getFieldEditorParent());" + NL + "\t\taddField(saveTypeInformation);" + NL + "\t\t" + NL + "\t\tFieldEditor saveDoctype = new BooleanFieldEditor(XMLResource.OPTION_SAVE_DOCTYPE, getString(\"_UI_EditorPreferenceSaveDoctype_label\"), getFieldEditorParent());" + NL + "\t\taddField(saveDoctype);" + NL + "\t\t" + NL + "\t\tFieldEditor formatted = new BooleanFieldEditor(XMLResource.OPTION_FORMATTED, getString(\"_UI_EditorPreferenceFormatted_label\"), getFieldEditorParent());" + NL + "\t\taddField(formatted);" + NL + "\t\t" + NL + "\t\tIPreferenceStore store = ModelEditorPlugin.getPlugin().getPreferenceStore();" + NL + "\t\tif (! store.contains(XMLResource.OPTION_LINE_WIDTH)) {" + NL + "\t\t\tstore.setDefault(XMLResource.OPTION_LINE_WIDTH, 100);" + NL + "\t\t}" + NL + "\t\tIntegerFieldEditor lineWidth = new IntegerFieldEditor(XMLResource.OPTION_LINE_WIDTH, getString(\"_UI_EditorPreferenceLineWidth_label\"), getFieldEditorParent());" + NL + "\t\tlineWidth.setTextLimit(5);" + NL + "\t\taddField(lineWidth);" + NL + "\t}" + NL + "" + NL + "\tpublic void init(IWorkbench workbench) {" + NL + "\t\t// no init code" + NL + "\t}" + NL + "" + NL + "    /**" + NL + "\t * This looks up a string in the plugin's plugin.properties file." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static String getString(String key) {" + NL + "\t\treturn ModelEditorPlugin.INSTANCE.getString(key);" + NL + "\t}" + NL + "}";
32
  protected final String TEXT_15 = NL;
33
34
  public String generate(Object argument)
35
  {
36
    final StringBuffer stringBuffer = new StringBuffer();
37
    
38
/**
39
 * <copyright>
40
 *
41
 * Copyright (c) 2002-2006 IBM Corporation and others.
42
 * All rights reserved.   This program and the accompanying materials
43
 * are made available under the terms of the Eclipse Public License v1.0
44
 * which accompanies this distribution, and is available at
45
 * http://www.eclipse.org/legal/epl-v10.html
46
 *
47
 * Contributors:
48
 *   IBM - Initial API and implementation
49
 *
50
 * </copyright>
51
 */
52
53
    GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
54
String importedOperationClassName = genModel.getImportedName(genModel.isRichClientPlatform() ? "org.eclipse.jface.operation.IRunnableWithProgress" : "org.eclipse.ui.actions.WorkspaceModifyOperation");
55
String operationMethodName = genModel.isRichClientPlatform() ? "run" : "execute"; if (false) {/* Trick to import java.util.* without warnings */Iterator.class.getName();}
56
57
    String _ArrayListOfObject = "ArrayList" + (genModel.useGenerics() ? "<Object>" : "");
58
    String _ArrayListOfAdapterFactory = "ArrayList" + (genModel.useGenerics() ? "<AdapterFactory>" : "");
59
    String _ListOfAdapterFactory = "List" + (genModel.useGenerics() ? "<AdapterFactory>" : "");
60
    String _ArrayListOfSelectionChangedListener = "ArrayList" + (genModel.useGenerics() ? "<ISelectionChangedListener>" : "");
61
    String _CollectionOfSelectionChangedListener = "Collection" + (genModel.useGenerics() ? "<ISelectionChangedListener>" : "");
62
    String _ArrayListOfResource = "ArrayList" + (genModel.useGenerics() ? "<Resource>" : "");
63
    String _CollectionOfResource = "Collection" + (genModel.useGenerics() ? "<Resource>" : "");
64
    String _MapOfResourceToDiagnostic = "Map" + (genModel.useGenerics() ? "<Resource, Diagnostic>" : "");
65
    String _HashMapOfResourceToBoolean = "HashMap" + (genModel.useGenerics() ? "<Resource, Boolean>" : "");
66
    String _LinkedHashMapOfResourceToDiagnostic = "LinkedHashMap" + (genModel.useGenerics() ? "<Resource, Diagnostic>" : "");
67
    String _CollectionOfAnything = "Collection" + (genModel.useGenerics() ? "<?>" : "");
68
    String _ListOfAnything = "List" + (genModel.useGenerics() ? "<?>" : "");
69
    stringBuffer.append(TEXT_1);
70
    stringBuffer.append(TEXT_2);
71
    stringBuffer.append("$");
72
    stringBuffer.append(TEXT_3);
73
    stringBuffer.append("$");
74
    stringBuffer.append(TEXT_4);
75
    stringBuffer.append(genPackage.getPresentationPackageName());
76
    stringBuffer.append(TEXT_5);
77
    stringBuffer.append(genPackage.getPrefix());
78
    stringBuffer.append(TEXT_6);
79
    stringBuffer.append(genPackage.getEditorPreferencePageClassName());
80
    stringBuffer.append(TEXT_7);
81
    if (genModel.getCopyrightText() != null) {
82
    stringBuffer.append(TEXT_8);
83
    stringBuffer.append(genModel.getImportedName("java.lang.String"));
84
    stringBuffer.append(TEXT_9);
85
    stringBuffer.append(genModel.getCopyrightText());
86
    stringBuffer.append(TEXT_10);
87
    stringBuffer.append(genModel.getNonNLS());
88
    stringBuffer.append(TEXT_11);
89
    }
90
    stringBuffer.append(TEXT_12);
91
    stringBuffer.append(genPackage.getEditorPreferencePageClassName());
92
    stringBuffer.append(TEXT_13);
93
    stringBuffer.append(genModel.getEditorPluginClassName());
94
    stringBuffer.append(TEXT_14);
95
    stringBuffer.append(TEXT_15);
96
    return stringBuffer.toString();
97
  }
98
}
(-)plugins/org.eclipse.emf.codegen.ecore/templates/editor/EditorPreferencesPage.javajet (+117 lines)
Added Link Here
1
<%@ jet package="org.eclipse.emf.codegen.ecore.templates.editor" imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.*" class="EditorPreferencesPage" version="" %>
2
<%
3
/**
4
 * <copyright>
5
 *
6
 * Copyright (c) 2002-2006 IBM Corporation and others.
7
 * All rights reserved.   This program and the accompanying materials
8
 * are made available under the terms of the Eclipse Public License v1.0
9
 * which accompanies this distribution, and is available at
10
 * http://www.eclipse.org/legal/epl-v10.html
11
 *
12
 * Contributors:
13
 *   IBM - Initial API and implementation
14
 *
15
 * </copyright>
16
 */
17
%>
18
<%GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel();
19
String importedOperationClassName = genModel.getImportedName(genModel.isRichClientPlatform() ? "org.eclipse.jface.operation.IRunnableWithProgress" : "org.eclipse.ui.actions.WorkspaceModifyOperation");
20
String operationMethodName = genModel.isRichClientPlatform() ? "run" : "execute"; if (false) {/* Trick to import java.util.* without warnings */Iterator.class.getName();}
21
%>
22
<%String _ArrayListOfObject = "ArrayList" + (genModel.useGenerics() ? "<Object>" : "");%>
23
<%String _ArrayListOfAdapterFactory = "ArrayList" + (genModel.useGenerics() ? "<AdapterFactory>" : "");%>
24
<%String _ListOfAdapterFactory = "List" + (genModel.useGenerics() ? "<AdapterFactory>" : "");%>
25
<%String _ArrayListOfSelectionChangedListener = "ArrayList" + (genModel.useGenerics() ? "<ISelectionChangedListener>" : "");%>
26
<%String _CollectionOfSelectionChangedListener = "Collection" + (genModel.useGenerics() ? "<ISelectionChangedListener>" : "");%>
27
<%String _ArrayListOfResource = "ArrayList" + (genModel.useGenerics() ? "<Resource>" : "");%>
28
<%String _CollectionOfResource = "Collection" + (genModel.useGenerics() ? "<Resource>" : "");%>
29
<%String _MapOfResourceToDiagnostic = "Map" + (genModel.useGenerics() ? "<Resource, Diagnostic>" : "");%>
30
<%String _HashMapOfResourceToBoolean = "HashMap" + (genModel.useGenerics() ? "<Resource, Boolean>" : "");%>
31
<%String _LinkedHashMapOfResourceToDiagnostic = "LinkedHashMap" + (genModel.useGenerics() ? "<Resource, Diagnostic>" : "");%>
32
<%String _CollectionOfAnything = "Collection" + (genModel.useGenerics() ? "<?>" : "");%>
33
<%String _ListOfAnything = "List" + (genModel.useGenerics() ? "<?>" : "");%>
34
<%@ include file="../Header.javajetinc"%>
35
package <%=genPackage.getPresentationPackageName()%>;
36
37
import org.eclipse.emf.ecore.xmi.XMLResource;
38
import org.eclipse.jface.preference.BooleanFieldEditor;
39
import org.eclipse.jface.preference.FieldEditor;
40
import org.eclipse.jface.preference.FieldEditorPreferencePage;
41
import org.eclipse.jface.preference.IPreferenceStore;
42
import org.eclipse.jface.preference.IntegerFieldEditor;
43
import org.eclipse.jface.resource.ImageDescriptor;
44
import org.eclipse.ui.IWorkbench;
45
import org.eclipse.ui.IWorkbenchPreferencePage;
46
import org.eclipse.ui.internal.menus.SeparatorContributionItem;
47
48
/**
49
 * This is an example of a <%=genPackage.getPrefix()%> model editor preferences.
50
 * <!-- begin-user-doc -->
51
 * <!-- end-user-doc -->
52
 * @generated
53
 */
54
public class <%=genPackage.getEditorPreferencePageClassName()%> extends FieldEditorPreferencePage implements
55
		IWorkbenchPreferencePage {
56
<%if (genModel.getCopyrightText() != null) {%>
57
	/**
58
	 * <!-- begin-user-doc -->
59
	 * <!-- end-user-doc -->
60
	 * @generated
61
	 */
62
	public static final <%=genModel.getImportedName("java.lang.String")%> copyright = "<%=genModel.getCopyrightText()%>";<%=genModel.getNonNLS()%>
63
64
<%}%>
65
    /**
66
	 * Create the instance.
67
	 * <!-- begin-user-doc -->
68
	 * <!-- end-user-doc -->
69
	 * @generated
70
	 */
71
	public <%=genPackage.getEditorPreferencePageClassName()%>() {
72
		super(GRID);
73
		setDescription("Cargarage Editor XML saving preferences.");
74
		IPreferenceStore store = <%=genModel.getEditorPluginClassName()%>.getPlugin().getPreferenceStore();
75
		setPreferenceStore(store);
76
	}
77
78
    /**
79
	 * Create the preference page contents.
80
	 * <!-- begin-user-doc -->
81
	 * <!-- end-user-doc -->
82
	 * @generated
83
	 */	
84
	@Override
85
	protected void createFieldEditors() {
86
		FieldEditor saveTypeInformation = new BooleanFieldEditor(XMLResource.OPTION_SAVE_TYPE_INFORMATION, getString("_UI_EditorPreferenceTypeInformation_label"), getFieldEditorParent());
87
		addField(saveTypeInformation);
88
		
89
		FieldEditor saveDoctype = new BooleanFieldEditor(XMLResource.OPTION_SAVE_DOCTYPE, getString("_UI_EditorPreferenceSaveDoctype_label"), getFieldEditorParent());
90
		addField(saveDoctype);
91
		
92
		FieldEditor formatted = new BooleanFieldEditor(XMLResource.OPTION_FORMATTED, getString("_UI_EditorPreferenceFormatted_label"), getFieldEditorParent());
93
		addField(formatted);
94
		
95
		IPreferenceStore store = ModelEditorPlugin.getPlugin().getPreferenceStore();
96
		if (! store.contains(XMLResource.OPTION_LINE_WIDTH)) {
97
			store.setDefault(XMLResource.OPTION_LINE_WIDTH, 100);
98
		}
99
		IntegerFieldEditor lineWidth = new IntegerFieldEditor(XMLResource.OPTION_LINE_WIDTH, getString("_UI_EditorPreferenceLineWidth_label"), getFieldEditorParent());
100
		lineWidth.setTextLimit(5);
101
		addField(lineWidth);
102
	}
103
104
	public void init(IWorkbench workbench) {
105
		// no init code
106
	}
107
108
    /**
109
	 * This looks up a string in the plugin's plugin.properties file.
110
	 * <!-- begin-user-doc -->
111
	 * <!-- end-user-doc -->
112
	 * @generated
113
	 */
114
	private static String getString(String key) {
115
		return ModelEditorPlugin.INSTANCE.getString(key);
116
	}
117
}

Return to bug 154708