Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 38918 Details for
Bug 114200
[req] Provide an option to generate RCP application
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fixes the subj for the Lite Generator case
114200.patch (text/plain), 239.48 KB, created by
Boris Blajer
on 2006-04-19 07:01:29 EDT
(
hide
)
Description:
Fixes the subj for the Lite Generator case
Filename:
MIME Type:
Creator:
Boris Blajer
Created:
2006-04-19 07:01:29 EDT
Size:
239.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.codegen.lite >Index: templates/editor/Editor.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/Editor.javajet,v >retrieving revision 1.1 >diff -u -r1.1 Editor.javajet >--- templates/editor/Editor.javajet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/Editor.javajet 19 Apr 2006 10:45:49 -0000 >@@ -4,6 +4,7 @@ > final GenEditorView genEditor = (GenEditorView) ((Object[]) argument)[0]; > final GenDiagram genDiagram = genEditor.getEditorGen().getDiagram(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer);%> >@@ -24,7 +25,6 @@ > importManager.addImport("org.eclipse.core.runtime.Status"); > importManager.addImport("org.eclipse.draw2d.PositionConstants"); > importManager.addImport("org.eclipse.emf.common.command.BasicCommandStack"); >-importManager.addImport("org.eclipse.emf.common.ui.URIEditorInput"); > importManager.addImport("org.eclipse.emf.common.util.URI"); > importManager.addImport("org.eclipse.emf.ecore.resource.Resource"); > importManager.addImport("org.eclipse.emf.ecore.resource.ResourceSet"); >@@ -76,7 +76,6 @@ > importManager.addImport("org.eclipse.ui.IEditorPart"); > importManager.addImport("org.eclipse.ui.IEditorInput"); > importManager.addImport("org.eclipse.ui.IEditorSite"); >-importManager.addImport("org.eclipse.ui.IPathEditorInput"); > importManager.addImport("org.eclipse.ui.ISelectionListener"); > importManager.addImport("org.eclipse.ui.IWorkbenchPart"); > importManager.addImport("org.eclipse.ui.PartInitException"); >@@ -93,6 +92,75 @@ > * @generated > */ > public class <%=genEditor.getClassName()%> extends GraphicalEditorWithFlyoutPalette { >+<% >+if (!isRichClientPlatform) { >+%> >+ /** >+ * This class listens to changes to the file system in the workspace, and >+ * makes the following changes: >+ * <ul><li>If an open, saved file gets deleted, the editor is closed.</li> >+ * <li>If an open file gets renamed or moved, the editor's >+ * input is changed accordingly.</li></ul> >+ * >+ * @generated >+ */ >+ private class ResourceTracker implements <%=importManager.getImportedName("org.eclipse.core.resources.IResourceChangeListener")%> { >+ /** >+ * @generated >+ */ >+ public void resourceChanged(<%=importManager.getImportedName("org.eclipse.core.resources.IResourceChangeEvent")%> event) { >+ <%=importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")%> delta = event.getDelta(); >+ if (delta != null) { >+ <%=importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")%> fileDelta = delta.findMember(((<%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) getEditorInput()).getFile().getFullPath()); >+ if (fileDelta != null) { >+ processFileDelta(fileDelta); >+ } >+ } >+ } >+ >+ /** >+ * @generated >+ */ >+ private void processFileDelta(<%=importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")%> delta) { >+ assert (delta != null && delta.getResource().equals(((<%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) getEditorInput()).getFile())); >+ if (delta.getKind() == <%=importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")%>.REMOVED) { >+ if ((<%=importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")%>.MOVED_TO & delta.getFlags()) == 0) { >+ <%/*XXX: make sure unsaved deleted file is handled correctly*/%> >+ if (!isDirty()) { >+ closeEditor(); >+ } >+ } else { >+ // else if it was moved or renamed >+ final <%=importManager.getImportedName("org.eclipse.core.resources.IFile")%> newFile = <%=importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")%>.getWorkspace().getRoot().getFile(delta.getMovedToPath()); >+ <%=importManager.getImportedName("org.eclipse.swt.widgets.Display")%> display = getSite().getShell().getDisplay(); >+ display.asyncExec(new Runnable() { >+ public void run() { >+ setInput(new <%=importManager.getImportedName("org.eclipse.ui.part.FileEditorInput")%>(newFile)); >+ } >+ }); >+ } >+ } >+ } >+ } >+ >+ /** >+ * @generated >+ */ >+ private ResourceTracker resourceTracker; >+ >+ /** >+ * @generated >+ */ >+ private ResourceTracker getResourceTracker() { >+ if (resourceTracker == null) { >+ resourceTracker = new ResourceTracker(); >+ } >+ return resourceTracker; >+ } >+ >+<% >+} >+%> > /** > * @generated > */ >@@ -294,6 +362,22 @@ > getSite().getKeyBindingService().registerAction(zoomOut); > } > >+<% >+if (!isRichClientPlatform) { >+%> >+ /** >+ * @generated >+ */ >+ void closeEditor() { >+ getSite().getShell().getDisplay().syncExec(new Runnable() { >+ public void run() { >+ getSite().getPage().closeEditor(<%=genEditor.getClassName()%>.this, false); >+ } >+ }); >+ } >+<% >+} >+%> > /** > * @generated > */ >@@ -494,23 +578,48 @@ > * @generated > */ > protected void setInput(IEditorInput input) { >+<% >+if (!isRichClientPlatform) { >+%> >+ if (getEditorInput() instanceof <%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) { >+ <%=importManager.getImportedName("org.eclipse.core.resources.IFile")%> resource = ((<%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) getEditorInput()).getFile(); >+ resource.getWorkspace().removeResourceChangeListener(getResourceTracker()); >+ } >+<% >+} >+%> > URI file = getURIFromInput(input); > load(file); > setPartName(file.lastSegment()); >- setContentDescription(file.toFileString()); > super.setInput(input); >+<% >+if (!isRichClientPlatform) { >+%> >+ if (getEditorInput() instanceof <%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) { >+ <%=importManager.getImportedName("org.eclipse.core.resources.IFile")%> resource = ((<%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) getEditorInput()).getFile(); >+ resource.getWorkspace().addResourceChangeListener(getResourceTracker()); >+ } >+<% >+} >+%> > } > > /** > * @generated > */ > private URI getURIFromInput(IEditorInput input) { >- if (input instanceof URIEditorInput) { >- return ((URIEditorInput) input).getURI(); >+<%if (isRichClientPlatform) {%> >+ if (input instanceof <%=importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")%>) { >+ return ((<%=importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")%>) input).getURI(); > } >- if (input instanceof IPathEditorInput) { >+ if (input instanceof <%=importManager.getImportedName("org.eclipse.ui.IPathEditorInput")%>) { > return URI.createFileURI(((IPathEditorInput)input).getPath().toOSString()); > } >+<%} else {%> >+ if (input instanceof <%=importManager.getImportedName("org.eclipse.ui.IFileEditorInput")%>) { >+ return URI.createPlatformResourceURI(((IFileEditorInput)input).getFile().getFullPath().toString()); >+ } >+<%}%> > return null; > } > >@@ -592,6 +701,8 @@ > return; > } > } >+ <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) diagram.getElement(); >+ if (<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> == null) { > <% > { > %> >@@ -600,32 +711,33 @@ > String resourceToUse; > if (!sameFile) { > %> >- URI modelFile = <%=genDiagram.getDiagramEditorUtilClassName()%>.getModelFileURI(diagramFile); >- Resource modelResource = resourceSet.getResource(modelFile, true); >- if (modelResource == null) { >- modelResource = resourceSet.createResource(modelFile); >- } >+ URI modelFile = <%=genDiagram.getDiagramEditorUtilClassName()%>.getModelFileURI(diagramFile); >+ Resource modelResource = resourceSet.getResource(modelFile, true); >+ if (modelResource == null) { >+ modelResource = resourceSet.createResource(modelFile); >+ } > <% > resourceToUse = "modelResource"; > } else { > resourceToUse = "diagramResource"; > } > %> >- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) findInResource(<%=resourceToUse%>, <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>.class); >- if (<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> == null) { >- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())%>.eINSTANCE.create<%=genDiagram.getDomainDiagramElement().getClassifierAccessorName()%>(); >- <%=resourceToUse%>.getContents().add(0, <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>); >- //We don't want this auxiliary creation to be undoable. >- try { >- <%=resourceToUse%>.save(Collections.EMPTY_MAP); >- } catch (IOException e) { >- diagram = null; >- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = null; >- return; >+ <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) findInResource(<%=resourceToUse%>, <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>.class); >+ if (<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> == null) { >+ <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())%>.eINSTANCE.create<%=genDiagram.getDomainDiagramElement().getClassifierAccessorName()%>(); >+ <%=resourceToUse%>.getContents().add(0, <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>); >+ //We don't want this auxiliary creation to be undoable. >+ try { >+ <%=resourceToUse%>.save(Collections.EMPTY_MAP); >+ } catch (IOException e) { >+ diagram = null; >+ <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = null; >+ return; >+ } >+ } >+ if (!diagram.isSetElement()) { >+ diagram.setElement(<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>); > } >- } >- if (!diagram.isSetElement()) { >- diagram.setElement(<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>); > } > } > <% >Index: templates/editor/manifest.mfjet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/manifest.mfjet,v >retrieving revision 1.1 >diff -u -r1.1 manifest.mfjet >--- templates/editor/manifest.mfjet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/manifest.mfjet 19 Apr 2006 10:45:49 -0000 >@@ -29,6 +29,8 @@ > Bundle-Localization: plugin > Export-Package: <%=genPlugin.getEditorGen().getEditor().getPackageName()%> > Require-Bundle: org.eclipse.core.runtime, >+ <%if (!genModel.isRichClientPlatform()) {%>org.eclipse.core.resources, >+ org.eclipse.ui.ide,<%}%> > org.eclipse.jface, > org.eclipse.ui.views, > org.eclipse.ui.workbench, >Index: templates/editor/DiagramEditorUtil.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/DiagramEditorUtil.javajet,v >retrieving revision 1.1 >diff -u -r1.1 DiagramEditorUtil.javajet >--- templates/editor/DiagramEditorUtil.javajet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/DiagramEditorUtil.javajet 19 Apr 2006 10:45:49 -0000 >@@ -1,9 +1,12 @@ > <%@ jet package="org.eclipse.gmf.codegen.templates.lite.editor" class="DiagramEditorUtilGenerator" >- imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*"%> >+ imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.* org.eclipse.emf.codegen.ecore.genmodel.*"%> > <% > final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; > final GenEditorGenerator editorGen = genDiagram.getEditorGen(); >+final GenPlugin genPlugin = editorGen.getPlugin(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final GenModel genModel = genDiagram.getEditorGen().getDomainGenModel(); >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer);%> > >@@ -51,7 +54,7 @@ > IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); > IWorkbenchPage page = workbenchWindow.getActivePage(); > >- IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString()); >+ IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(fileURI.lastSegment()); > if (editorDescriptor == null) { > MessageDialog.openError( > workbenchWindow.getShell(), >@@ -73,6 +76,9 @@ > return true; > } > >+<% >+if (!genDiagram.getEditorGen().isSameFileForDiagramAndModel()) { >+%> > /** > * @generated > */ >@@ -92,5 +98,337 @@ > } > return diagramFileURI.trimFileExtension().appendFileExtension("<%=editorGen.getDomainFileExtension()%>"); > } >- } >+<% >+} >+%> >+<% >+if (isRichClientPlatform) { >+ boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+%> >+ /** >+ * Looks up a string in the plugin's plugin.properties file. >+ * @generated >+ */ >+ private static String getString(String key) { >+ return <%=importManager.getImportedName(genPlugin.getActivatorQualifiedClassName())%>.getInstance().getBundleString(key); >+ } >+ >+ /** >+ * RCP's application >+ * @generated >+ */ >+ public static class Application implements <%=importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")%> { >+ /** >+ * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object) >+ * @generated >+ */ >+ public Object run(Object args) { >+ <%=importManager.getImportedName("org.eclipse.ui.application.WorkbenchAdvisor")%> workbenchAdvisor = new Advisor(); >+ <%=importManager.getImportedName("org.eclipse.swt.widgets.Display")%> display = <%=importManager.getImportedName("org.eclipse.ui.PlatformUI")%>.createDisplay(); >+ try { >+ int returnCode = <%=importManager.getImportedName("org.eclipse.ui.PlatformUI")%>.createAndRunWorkbench(display, workbenchAdvisor); >+ if (returnCode == <%=importManager.getImportedName("org.eclipse.ui.PlatformUI")%>.RETURN_RESTART) { >+ return <%=importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")%>.EXIT_RESTART; >+ } else { >+ return <%=importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")%>.EXIT_OK; >+ } >+ } finally { >+ display.dispose(); >+ } >+ } >+ } >+ >+ /** >+ * RCP's perspective >+ * @generated >+ */ >+ public static class Advisor extends <%=importManager.getImportedName("org.eclipse.ui.application.WorkbenchAdvisor")%> { >+ /** >+ * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId() >+ * @generated >+ */ >+ public String getInitialWindowPerspectiveId() { >+ return Perspective.ID_PERSPECTIVE; >+ } >+ >+ /** >+ * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer) >+ * @generated >+ */ >+ public void initialize(<%=importManager.getImportedName("org.eclipse.ui.application.IWorkbenchConfigurer")%> configurer) { >+ super.initialize(configurer); >+ configurer.setSaveAndRestore(true); >+ } >+ >+ /** >+ * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer) >+ * @generated >+ */ >+ public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(<%=importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")%> configurer) { >+ return new WindowAdvisor(configurer); >+ } >+ } >+ >+ /** >+ * RCP's perspective >+ * @generated >+ */ >+ public static class Perspective implements <%=importManager.getImportedName("org.eclipse.ui.IPerspectiveFactory")%> { >+ /** >+ * Perspective ID >+ * @generated >+ */ >+ public static final String ID_PERSPECTIVE = "<%=genPlugin.getID()%>.Perspective"; //$NON-NLS-1$ >+ >+ /** >+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) >+ * @generated >+ */ >+ public void createInitialLayout(<%=importManager.getImportedName("org.eclipse.ui.IPageLayout")%> layout) { >+ layout.setEditorAreaVisible(true); >+ layout.addPerspectiveShortcut(ID_PERSPECTIVE); >+ >+ <%=importManager.getImportedName("org.eclipse.ui.IFolderLayout")%> right = layout.createFolder("right", <%=importManager.getImportedName("org.eclipse.ui.IPageLayout")%>.RIGHT, (float)0.66, layout.getEditorArea()); //$NON-NLS-1$ >+ right.addView(IPageLayout.ID_OUTLINE); >+ >+ <%=importManager.getImportedName("org.eclipse.ui.IFolderLayout")%> bottomRight = layout.createFolder("bottonRight", <%=importManager.getImportedName("org.eclipse.ui.IPageLayout")%>.BOTTOM, (float)0.60, "right"); //$NON-NLS-1$ //$NON-NLS-2$ >+ bottomRight.addView(<%=importManager.getImportedName("org.eclipse.ui.IPageLayout")%>.ID_PROP_SHEET); >+ } >+ } >+ >+ /** >+ * RCP's window advisor >+ * @generated >+ */ >+ public static class WindowAdvisor extends <%=importManager.getImportedName("org.eclipse.ui.application.WorkbenchWindowAdvisor")%> { >+ /** >+ * @see WorkbenchWindowAdvisor#WorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer) >+ * @generated >+ */ >+ public WindowAdvisor(<%=importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")%> configurer) { >+ super(configurer); >+ } >+ >+ /** >+ * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen() >+ * @generated >+ */ >+ public void preWindowOpen() { >+ <%=importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")%> configurer = getWindowConfigurer(); >+ configurer.setInitialSize(new <%=importManager.getImportedName("org.eclipse.swt.graphics.Point")%>(600, 450)); >+ configurer.setShowCoolBar(false); >+ configurer.setShowStatusLine(true); >+ configurer.setTitle(getString("_UI_Application_title")); //$NON-NLS-1$ >+ } >+ >+ /** >+ * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) >+ * @generated >+ */ >+ public <%=importManager.getImportedName("org.eclipse.ui.application.ActionBarAdvisor")%> createActionBarAdvisor(<%=importManager.getImportedName("org.eclipse.ui.application.IActionBarConfigurer")%> configurer) { >+ return new WindowActionBarAdvisor(configurer); >+ } >+ } >+ >+ /** >+ * RCP's action bar advisor >+ * @generated >+ */ >+ public static class WindowActionBarAdvisor extends <%=importManager.getImportedName("org.eclipse.ui.application.ActionBarAdvisor")%> { >+ /** >+ * @see ActionBarAdvisor#ActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) >+ * @generated >+ */ >+ public WindowActionBarAdvisor(<%=importManager.getImportedName("org.eclipse.ui.application.IActionBarConfigurer")%> configurer) { >+ super(configurer); >+ } >+ >+ /** >+ * @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager) >+ * @generated >+ */ >+ protected void fillMenuBar(<%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menuBar) { >+ <%=importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")%> window = getActionBarConfigurer().getWindowConfigurer().getWindow(); >+ menuBar.add(createFileMenu(window)); >+ menuBar.add(createEditMenu(window)); >+ menuBar.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ menuBar.add(createWindowMenu(window)); >+ menuBar.add(createHelpMenu(window)); >+ } >+ >+ /** >+ * Creates the 'File' menu. >+ * @generated >+ */ >+ protected <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> createFileMenu(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")%> window) { >+ <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menu = new <%=importManager.getImportedName("org.eclipse.jface.action.MenuManager")%>(getString("_UI_Menu_File_label"), //$NON-NLS-1$ >+ <%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.M_FILE); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.FILE_START)); >+ >+ <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> newMenu = new <%=importManager.getImportedName("org.eclipse.jface.action.MenuManager")%>(getString("_UI_Menu_New_label"), "new"); //$NON-NLS-1$ //$NON-NLS-2$ >+ newMenu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ >+ menu.add(newMenu); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.CLOSE.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.CLOSE_ALL.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.SAVE.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.SAVE_AS.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.SAVE_ALL.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.QUIT.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.FILE_END)); >+ return menu; >+ } >+ >+ /** >+ * Creates the 'Edit' menu. >+ * @generated >+ */ >+ protected <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> createEditMenu(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")%> window) { >+ <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menu = new <%=importManager.getImportedName("org.eclipse.jface.action.MenuManager")%>(getString("_UI_Menu_Edit_label"), //$NON-NLS-1$ >+ <%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.M_EDIT); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.EDIT_START)); >+ >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.UNDO.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.REDO.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.UNDO_EXT)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.CUT.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.COPY.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.PASTE.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.CUT_EXT)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.DELETE.create(window)); >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.SELECT_ALL.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>()); >+ >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.ADD_EXT)); >+ >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.EDIT_END)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.Separator")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ return menu; >+ } >+ >+ /** >+ * Creates the 'Window' menu. >+ * @generated >+ */ >+ protected <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> createWindowMenu(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")%> window) { >+ <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menu = new <%=importManager.getImportedName("org.eclipse.jface.action.MenuManager")%>(getString("_UI_Menu_Window_label"), //$NON-NLS-1$ >+ <%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.M_WINDOW); >+ >+ addToMenuAndRegister(menu, <%=importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")%>.OPEN_NEW_WINDOW.create(window)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ menu.add(<%=importManager.getImportedName("org.eclipse.ui.actions.ContributionItemFactory")%>.OPEN_WINDOWS.create(window)); >+ >+ return menu; >+ } >+ >+ /** >+ * Creates the 'Help' menu. >+ * @generated >+ */ >+ protected <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> createHelpMenu(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")%> window) { >+ <%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menu = new <%=importManager.getImportedName("org.eclipse.jface.action.MenuManager")%>(getString("_UI_Menu_Help_label"), <%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.M_HELP); //$NON-NLS-1$ >+ // Welcome or intro page would go here >+ // Help contents would go here >+ // Tips and tricks page would go here >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.HELP_START)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.HELP_END)); >+ menu.add(new <%=importManager.getImportedName("org.eclipse.jface.action.GroupMarker")%>(<%=importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")%>.MB_ADDITIONS)); >+ return menu; >+ } >+ >+ /** >+ * Adds the specified action to the given menu and also registers the action with the >+ * action bar configurer, in order to activate its key binding. >+ * @generated >+ */ >+ protected void addToMenuAndRegister(<%=importManager.getImportedName("org.eclipse.jface.action.IMenuManager")%> menuManager, <%=importManager.getImportedName("org.eclipse.jface.action.IAction")%> action) { >+ menuManager.add(action); >+ getActionBarConfigurer().registerGlobalAction(action); >+ } >+ } >+ >+ /** >+ * About action for the RCP application. >+ * @generated >+ */ >+ public static class AboutAction extends <%=importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")%> { >+ /** >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ * @generated >+ */ >+ public void run(<%=importManager.getImportedName("org.eclipse.jface.action.IAction")%> action) { >+ <%=importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")%>.openInformation(getWindow().getShell(), getString("_UI_About_title"), //$NON-NLS-1$ >+ getString("_UI_About_text")); //$NON-NLS-1$ >+ } >+ } >+ <% >+ } >+ %> >+ >+ /** >+ * Open action for the <%=genModel.getModelName()%> diagram. >+ * @generated >+ */ >+ public static class OpenDiagramAction extends <%=importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")%> { >+ /** >+ * Opens the editors for the files selected using the file dialog. >+ * @generated >+ */ >+ public void run(<%=importManager.getImportedName("org.eclipse.jface.action.IAction")%> action) { >+ String filePath = openFilePathDialog(getWindow().getShell(), "*.<%=editorGen.getDiagramFileExtension()%>", <%=importManager.getImportedName("org.eclipse.swt.SWT")%>.OPEN); //$NON-NLS-1$ >+ if (filePath != null) { >+ openEditor(URI.createFileURI(filePath)); >+ } >+ } >+ } >+ >+ /** >+ * Open URI action for the <%=genModel.getModelName()%> diagram. >+ * @generated >+ */ >+ public static class OpenURIAction extends <%=importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")%> { >+ /** >+ * Opens the editors for the files selected using the LoadResourceDialog. >+ * @generated >+ */ >+ public void run(<%=importManager.getImportedName("org.eclipse.jface.action.IAction")%> action) { >+ <%=importManager.getImportedName("org.eclipse.emf.edit.ui.action.LoadResourceAction")%>.LoadResourceDialog loadResourceDialog = new <%=importManager.getImportedName("org.eclipse.emf.edit.ui.action.LoadResourceAction")%>.LoadResourceDialog(getWindow().getShell()); >+ if (<%=importManager.getImportedName("org.eclipse.jface.dialogs.Dialog")%>.OK == loadResourceDialog.open()) { >+ for (<%=importManager.getImportedName("java.util.Iterator")%> it = loadResourceDialog.getURIs().iterator(); it.hasNext(); ) { >+ openEditor((URI) it.next()); >+ } >+ } >+ } >+ } >+ >+ /** >+ * New diagram action for the <%=genModel.getModelName()%> diagram. >+ * @generated >+ */ >+ public static class NewDiagramAction extends <%=importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")%> { >+ /** >+ * Opens the wizard to create the diagram. >+ * @generated >+ */ >+ public void run(<%=importManager.getImportedName("org.eclipse.jface.action.IAction")%> action) { >+ <%=importManager.getImportedName(genDiagram.getCreationWizardQualifiedClassName())%> wizard = new <%=importManager.getImportedName(genDiagram.getCreationWizardQualifiedClassName())%>(); >+ wizard.init(getWindow().getWorkbench(), <%=importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")%>.EMPTY); >+ <%=importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")%> wizardDialog = new <%=importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")%>(getWindow().getShell(), wizard); >+ wizardDialog.open(); >+ } >+ } >+<% >+} >+%> >+} > <%importManager.emitSortedImports();%> >Index: templates/editor/Plugin.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/Plugin.javajet,v >retrieving revision 1.1 >diff -u -r1.1 Plugin.javajet >--- templates/editor/Plugin.javajet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/Plugin.javajet 19 Apr 2006 10:45:49 -0000 >@@ -154,6 +154,17 @@ > /** > * @generated > */ >+ public String getBundleString(String key) { >+ try { >+ return <%=importManager.getImportedName("org.eclipse.core.runtime.Platform")%>.getResourceBundle(getBundle()).getString(key); >+ } catch (<%=importManager.getImportedName("java.util.MissingResourceException")%> e) { >+ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ >+ /** >+ * @generated >+ */ > public void logError(String error) { > logError(error, null); > } >Index: templates/editor/CreationWizardPage.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/CreationWizardPage.javajet,v >retrieving revision 1.1 >diff -u -r1.1 CreationWizardPage.javajet >--- templates/editor/CreationWizardPage.javajet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/CreationWizardPage.javajet 19 Apr 2006 10:45:49 -0000 >@@ -5,28 +5,34 @@ > final GenEditorGenerator editorGen = genDiagram.getEditorGen(); > final GenPlugin genPlugin = editorGen.getPlugin(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer); > >-importManager.addImport("java.io.File"); > importManager.addImport("org.eclipse.core.runtime.IProgressMonitor"); > importManager.addImport("org.eclipse.core.runtime.CoreException"); > importManager.addImport("java.io.IOException"); >-importManager.addImport("org.eclipse.swt.widgets.Text"); > importManager.addImport("org.eclipse.emf.common.util.URI"); >+if (isRichClientPlatform) { >+importManager.addImport("java.io.File"); > importManager.addImport("org.eclipse.swt.widgets.Composite"); > importManager.addImport("org.eclipse.swt.widgets.Label"); >+importManager.addImport("org.eclipse.swt.widgets.Text"); > importManager.addImport("org.eclipse.swt.events.ModifyListener"); > importManager.addImport("org.eclipse.swt.events.ModifyEvent"); > importManager.addImport("org.eclipse.swt.layout.GridLayout"); > importManager.addImport("org.eclipse.swt.layout.GridData"); >+} > %> > > /** > * @generated > */ >-public class <%=genDiagram.getCreationWizardPageClassName()%> extends <%=importManager.getImportedName("org.eclipse.jface.wizard.WizardPage")%> { >+public class <%=genDiagram.getCreationWizardPageClassName()%> extends <%=importManager.getImportedName(isRichClientPlatform ? "org.eclipse.jface.wizard.WizardPage" : "org.eclipse.ui.dialogs.WizardNewFileCreationPage")%> { >+<% >+if (isRichClientPlatform) { >+%> > /** > * @generated > */ >@@ -36,16 +42,40 @@ > * @generated > */ > private URI createdDiagramFileURI; >+<% >+} else { >+%> >+ /** >+ * @generated >+ */ >+ private <%=importManager.getImportedName("org.eclipse.core.resources.IFile")%> createdDiagramFile; >+<% >+} >+%> > > /** > * @generated > */ >+<% >+if (isRichClientPlatform) { >+%> > public <%=genDiagram.getCreationWizardPageClassName()%>() { > super("CreationWizardPage"); //$NON-NLS-1$ >+<% >+} else { >+%> >+ public <%=genDiagram.getCreationWizardPageClassName()%>(<%=importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")%> selection) { >+ super("CreationWizardPage", selection); //$NON-NLS-1$ >+<% >+} >+%> > setTitle("Create <%=editorGen.getDomainGenModel().getModelName()%> Diagram"); //$NON-NLS-1$ > setDescription("Create a new <%=editorGen.getDomainGenModel().getModelName()%> diagram."); //$NON-NLS-1$ > } > >+<% >+if (isRichClientPlatform) { >+%> > /** > * @generated > */ >@@ -126,22 +156,22 @@ > setPageComplete(validatePage()); > } > }; >- >+ >+<% >+} >+%> > /** > * @generated > */ > protected boolean validatePage() { >+<% >+if (isRichClientPlatform) { >+%> > URI diagramFileURI = getDiagramFileURI(); > if (diagramFileURI == null || diagramFileURI.isEmpty()) { > setErrorMessage(null); > return false; > } >- String requiredExt = "<%=editorGen.getDiagramFileExtension()%>"; >- String enteredExt = diagramFileURI.fileExtension(); >- if (enteredExt == null || !enteredExt.equals(requiredExt)) { >- setErrorMessage("The file name must end in " + requiredExt); >- return false; >- } > > if (diagramFileURI.isFile()) { > File diagramFile = new File(diagramFileURI.toFileString()); >@@ -149,26 +179,99 @@ > setErrorMessage("Diagram File already exists: " + diagramFile); > return false; > } >-<%if (!editorGen.isSameFileForDiagramAndModel()) {%> >+ } >+<% >+} else { >+%> >+ if (!super.validatePage()) { >+ return false; >+ } >+ String fileName = getFileName(); >+ >+ if (fileName == null) { >+ setErrorMessage(null); >+ return false; >+ } >+ >+ <%=importManager.getImportedName("org.eclipse.core.runtime.IPath")%> path = getContainerFullPath().append(fileName); >+ if (path.getFileExtension() == null) { >+ path = path.addFileExtension("<%=editorGen.getDiagramFileExtension()%>"); //$NON-NLS-1$ >+ } >+ >+ if (<%=importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")%>.getWorkspace().getRoot().exists(path)) { >+ setErrorMessage("Diagram File already exists: " + path.toOSString()); >+ return false; >+ } >+<% >+} >+%> >+ String requiredExt = "<%=editorGen.getDiagramFileExtension()%>"; >+<% >+if (isRichClientPlatform) { >+%> >+ String enteredExt = diagramFileURI.fileExtension(); >+<% >+} else { >+%> >+ String enteredExt = path.getFileExtension(); >+<% >+} >+%> >+ if (enteredExt == null || !enteredExt.equals(requiredExt)) { >+ setErrorMessage("The file name must end in " + requiredExt); >+ return false; >+ } >+<% >+if (!editorGen.isSameFileForDiagramAndModel()) { >+ if (isRichClientPlatform) { >+%> > URI modelFileURI = getModelFileURI(); > File modelFile = new File(modelFileURI.toFileString()); > if (modelFile.exists()) { > setErrorMessage("Model File already exists: " + modelFile); > return false; > } >-<%}%> >- } >- setErrorMessage(null); >+<% >+ } else { >+%> >+ path = path.removeFileExtension().addFileExtension("<%=editorGen.getDomainFileExtension()%>"); //$NON-NLS-1$ >+ if (<%=importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")%>.getWorkspace().getRoot().exists(path)) { >+ setErrorMessage("Model File already exists: " + path.lastSegment()); >+ return false; >+ } >+<% >+ } >+} >+%> >+ setErrorMessage(null); > return true; > } > >+<% >+if (isRichClientPlatform) { >+%> > /** > * @generated > */ > public URI getCreatedDiagramFileURI() { > return createdDiagramFileURI; > } >+<% >+} else { >+%> >+ /** >+ * @generated >+ */ >+ public IFile getCreatedDiagramFile() { >+ return createdDiagramFile; >+ } >+<% >+} >+%> > >+<% >+if (isRichClientPlatform) { >+%> > /** > * @generated > */ >@@ -180,7 +283,9 @@ > return null; > } > >-<%if (!editorGen.isSameFileForDiagramAndModel()) {%> >+<% >+ if (!editorGen.isSameFileForDiagramAndModel()) { >+%> > /** > * @generated > */ >@@ -191,7 +296,10 @@ > } > return diagramFileURI.trimFileExtension().appendFileExtension("<%=editorGen.getDomainFileExtension()%>"); > } >-<%}%> >+<% >+ } >+} >+%> > > /** > * Performs the operations necessary to create and open the diagram >@@ -200,8 +308,19 @@ > */ > public boolean finish() { > final boolean[] result = new boolean[1]; >+<% >+if (isRichClientPlatform) { >+%> > <%=importManager.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress")%> op = new IRunnableWithProgress() { > public void run(IProgressMonitor monitor) { >+<% >+} else { >+%> >+ <%=importManager.getImportedName("org.eclipse.ui.actions.WorkspaceModifyOperation")%> op = new WorkspaceModifyOperation(null) { >+ protected void execute(IProgressMonitor monitor) { >+<% >+} >+%> > result[0] = doFinish(monitor); > } > }; >@@ -233,23 +352,54 @@ > * @generated > */ > public boolean doFinish(IProgressMonitor monitor) { >- createdDiagramFileURI = createDiagramFile(monitor); >- return createdDiagramFileURI != null; >+<% >+String createdVar = isRichClientPlatform ? "createdDiagramFileURI" : "createdDiagramFile"; >+%> >+ <%=createdVar%> = createDiagramFile(monitor); >+ return <%=createdVar%> != null; > } > > /** > * @generated > */ >+<%if (isRichClientPlatform) {%> > private URI createDiagramFile(IProgressMonitor monitor) { >+<%} else {%> >+ private IFile createDiagramFile(IProgressMonitor monitor) { >+<%}%> > //TODO: Editing domain! > <%=importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")%> resourceSet = new <%=importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")%>(); >+<% >+if (isRichClientPlatform) { >+%> > final <%=importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")%> diagramResource = resourceSet.createResource(getDiagramFileURI()); > <% >+} else { >+%> >+ IPath diagramFilePath = getContainerFullPath().append(getFileName()); >+ if (diagramFilePath.getFileExtension() == null) { >+ diagramFilePath = diagramFilePath.addFileExtension("<%=editorGen.getDiagramFileExtension()%>"); //$NON-NLS-1$ >+ } >+ final IFile diagramFile = ResourcesPlugin.getWorkspace().getRoot().getFile(diagramFilePath); >+ final <%=importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")%> diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFilePath.toString())); >+<% >+} >+%> >+<% > final boolean standaloneDomainModel = !editorGen.isSameFileForDiagramAndModel() && genDiagram.getDomainDiagramElement() != null; > if (standaloneDomainModel) { >+ if (isRichClientPlatform) { > %> > final Resource modelResource = resourceSet.createResource(getModelFileURI()); >-<%}%> >+<% >+ } else { >+%> >+ IPath modelFilePath = diagramFilePath.removeFileExtension().addFileExtension("<%=editorGen.getDomainFileExtension()%>"); //$NON-NLS-1$ >+ final Resource modelResource = resourceSet.createResource(URI.createPlatformResourceURI(modelFilePath.toString())); >+<% >+ } >+} >+%> > > if (diagramResource != null<%if (standaloneDomainModel) {%> && modelResource != null<%}%>) { > //TODO: Editing domain! >@@ -280,11 +430,27 @@ > handleSaveException(e); > } > } >+<% >+if (isRichClientPlatform) { >+%> > boolean result = <%=genDiagram.getDiagramEditorUtilClassName()%>.openEditor(getDiagramFileURI()); > if (!result) { > return null; > } > return getDiagramFileURI(); >+<% >+} else { >+%> >+ try { >+ <%=importManager.getImportedName("org.eclipse.ui.ide.IDE")%>.openEditor(<%=importManager.getImportedName("org.eclipse.ui.PlatformUI")%>.getWorkbench().getActiveWorkbenchWindow().getActivePage(), diagramFile); >+ } catch (<%=importManager.getImportedName("org.eclipse.ui.PartInitException")%> e) { >+ <%=genPlugin.getActivatorClassName()%>.getInstance().getLog().log(e.getStatus()); >+ return null; >+ } >+ return diagramFile; >+<% >+} >+%> > } > > /** >Index: templates/editor/plugin.propertiesjet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/plugin.propertiesjet,v >retrieving revision 1.1 >diff -u -r1.1 plugin.propertiesjet >--- templates/editor/plugin.propertiesjet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/plugin.propertiesjet 19 Apr 2006 10:45:49 -0000 >@@ -1,5 +1,38 @@ > <%@ jet package="org.eclipse.gmf.codegen.templates.lite.editor" class="PluginPropertiesGenerator" >- imports="org.eclipse.gmf.codegen.gmfgen.*"%> >-<%GenPlugin genPlugin = (GenPlugin) argument;%> >+ imports="org.eclipse.gmf.codegen.gmfgen.* org.eclipse.emf.codegen.ecore.genmodel.*"%> >+<% >+GenPlugin genPlugin = (GenPlugin) argument; >+final GenDiagram genDiagram = genPlugin.getEditorGen().getDiagram(); >+final GenModel genModel = genPlugin.getEditorGen().getDomainGenModel(); >+final boolean isRichClientPlatform = genModel.isRichClientPlatform(); >+%> > pluginName=<%=genPlugin.getName()%> > providerName=<%=genPlugin.getProvider()%> >+ >+<%if (isRichClientPlatform) {%> >+_UI_Menu_OpenURI_label=Open Diagram &URI... >+_UI_Menu_OpenURI_description=Opens a <%=genModel.getModelName()%> diagram loading it from a URI >+_UI_Menu_Open_label=&Open Diagram... >+_UI_Menu_Open_description=Opens a <%=genModel.getModelName()%> diagram >+ >+_UI_<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>_ActionSet_label=<%=genModel.getModelName()%> Diagram Action Set >+_UI_<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>NewDiagramCommand=<%=genModel.getModelName()%> diagram >+ >+<% >+ boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+%> >+_UI_Perspective_label = <%=genModel.getModelName()%> Diagram >+_UI_Application_title=<%=genModel.getModelName()%> Diagram Application >+_UI_Menu_File_label=&File >+_UI_Menu_New_label=&New >+_UI_Menu_Edit_label=&Edit >+_UI_Menu_Window_label=&Window >+_UI_Menu_Help_label=&Help >+_UI_Menu_About_label=<%=genModel.getModelName()%> Diagram &About... >+_UI_About_title = <%=genModel.getModelName()%> Diagram Application >+_UI_About_text = <%=genModel.getModelName()%> Diagram Application about box goes here. >+<% >+ } >+} >+%> >Index: templates/editor/plugin.xmljet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/plugin.xmljet,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xmljet >--- templates/editor/plugin.xmljet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/plugin.xmljet 19 Apr 2006 10:45:49 -0000 >@@ -5,6 +5,7 @@ > final GenEditorGenerator editorGen = genPlugin.getEditorGen(); > final GenDiagram genDiagram = editorGen.getDiagram(); > final GenModel genModel = editorGen.getDomainGenModel(); >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > %> > <?xml version="1.0" encoding="UTF-8"?> > <?eclipse version="3.0"?> >@@ -28,6 +29,100 @@ > </editor> > </extension> > >+<% >+if (isRichClientPlatform) { >+ final boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+%> >+ <extension >+ point="org.eclipse.core.runtime.applications" >+ id="<%=genModel.getModelName()%>DiagramApplication"> >+ <application> >+ <run >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$Application"> >+ </run> >+ </application> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.perspectives"> >+ <perspective >+ name="%_UI_Perspective_label" >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$Perspective" >+ id="<%=genPlugin.getID()%>.Perspective"> >+ </perspective> >+ </extension> >+<% >+ } >+%> >+ <extension >+ point="org.eclipse.ui.commands"> >+ <command >+ name="%_UI_Menu_OpenURI_label" >+ description="%_UI_Menu_OpenURI_description" >+ categoryId="org.eclipse.ui.category.file" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenURICommand" /> >+ <command >+ name="%_UI_Menu_Open_label" >+ description="%_UI_Menu_Open_description" >+ categoryId="org.eclipse.ui.category.file" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenCommand" /> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.bindings"> >+ <key >+ commandId="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenURICommand" >+ sequence="M1+U" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" /> >+ <key >+ commandId="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenCommand" >+ sequence="M1+O" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" /> >+ </extension> >+ <extension >+ point="org.eclipse.ui.actionSets"> >+ <actionSet >+ label="%_UI_<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>_ActionSet_label" >+ visible="true" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>ActionSet"> >+<% >+ if (shouldGenerateApplication) { >+%> >+ <action >+ label="%_UI_Menu_About_label" >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$AboutAction" >+ menubarPath="help/additions" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>AboutAction"> >+ </action> >+<% >+ } >+%> >+ <action >+ label="%_UI_Menu_OpenURI_label" >+ definitionId="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenURICommand" >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$OpenURIAction" >+ menubarPath="file/additions" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenURIAction"> >+ </action> >+ <action >+ label="%_UI_Menu_Open_label" >+ definitionId="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenCommand" >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$OpenDiagramAction" >+ menubarPath="file/additions" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>OpenDiagramAction"> >+ </action> >+ <action >+ label="%_UI_<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>NewDiagramCommand" >+ class="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>$NewDiagramAction" >+ menubarPath="file/new/additions" >+ id="<%=genDiagram.getDiagramEditorUtilQualifiedClassName()%>NewAction"> >+ </action> >+ </actionSet> >+ </extension> >+<% >+} else { >+%> > <extension point="org.eclipse.ui.newWizards"> > <wizard > name="<%=genModel.getModelName()%> Diagram" >@@ -41,4 +136,7 @@ > </wizard> > </extension> > >+<% >+} >+%> > </plugin> >Index: templates/editor/CreationWizard.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/editor/CreationWizard.javajet,v >retrieving revision 1.1 >diff -u -r1.1 CreationWizard.javajet >--- templates/editor/CreationWizard.javajet 13 Apr 2006 21:20:16 -0000 1.1 >+++ templates/editor/CreationWizard.javajet 19 Apr 2006 10:45:49 -0000 >@@ -4,6 +4,7 @@ > final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; > final GenModel genModel = genDiagram.getEditorGen().getDomainGenModel(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer); >@@ -15,11 +16,24 @@ > /** > * @generated > */ >-public class <%=genDiagram.getCreationWizardClassName()%> extends <%=importManager.getImportedName("org.eclipse.jface.wizard.Wizard")%> implements <%=importManager.getImportedName("org.eclipse.ui.INewWizard")%> { >+public class <%=genDiagram.getCreationWizardClassName()%> extends <%=importManager.getImportedName(isRichClientPlatform ? "org.eclipse.jface.wizard.Wizard" : "org.eclipse.ui.wizards.newresource.BasicNewResourceWizard")%> implements <%=importManager.getImportedName("org.eclipse.ui.INewWizard")%> { >+<% >+if (isRichClientPlatform) { >+%> > /** > * @generated > */ > private <%=importManager.getImportedName("org.eclipse.emf.common.util.URI")%> diagramFileURI; >+<% >+} else { >+%> >+ /** >+ * @generated >+ */ >+ private <%=importManager.getImportedName("org.eclipse.core.resources.IFile")%> diagramFile; >+<% >+} >+%> > > /** > * @generated >@@ -32,7 +46,7 @@ > public void addPages() { > super.addPages(); > if (page == null) { >- page = new <%=importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())%>(); >+ page = new <%=importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())%>(<%if(!isRichClientPlatform) {%>getSelection()<%}%>); > } > addPage(page); > } >@@ -41,6 +55,13 @@ > * @generated > */ > public void init(IWorkbench workbench, IStructuredSelection selection) { >+<% >+if (!isRichClientPlatform) { >+%> >+ super.init(workbench, selection); >+<% >+} >+%> > setWindowTitle("New <%=genModel.getModelName()%> Diagram"); //$NON-NLS-1$ > setDefaultPageImageDescriptor(<%=genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()%>.getBundledImageDescriptor( > "icons/full/wizban/New<%=genModel.getModelName()%>.gif")); //$NON-NLS-1$ >@@ -52,10 +73,23 @@ > */ > public boolean performFinish() { > boolean retVal = page.finish(); >+<% >+if (isRichClientPlatform) { >+%> > diagramFileURI = page.getCreatedDiagramFileURI(); >+<% >+} else { >+%> >+ diagramFile = page.getCreatedDiagramFile(); >+<% >+} >+%> > return retVal; > } > >+<% >+if (isRichClientPlatform) { >+%> > /** > * returns the diagram file > * @return URI the diagram file >@@ -64,5 +98,19 @@ > public final URI getDiagramFileURI() { > return diagramFileURI; > } >+<% >+} else { >+%> >+ /** >+ * returns the diagram file >+ * @return IFile the diagram file >+ * @generated >+ */ >+ public final IFile getDiagramFile() { >+ return diagramFile; >+ } >+<% >+} >+%> > } > <%importManager.emitSortedImports();%> >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 PluginGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -27,10 +27,12 @@ > protected final String TEXT_8 = NL + "\t\tfactories.add(new "; > protected final String TEXT_9 = "());"; > protected final String TEXT_10 = NL + "\t\tfactories.add(new ResourceItemProviderAdapterFactory());" + NL + "\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic AdapterFactory getItemProvidersAdapterFactory() {" + NL + "\t\treturn adapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ImageDescriptor getItemImageDescriptor(Object item) {" + NL + "\t\tIItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);" + NL + "\t\tif (labelProvider != null) {"; >- protected final String TEXT_11 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Returns an image for the image file at the given plug-in relative path." + NL + "\t * Client do not need to dispose this image. Images will be disposed automatically." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return image instance" + NL + "\t */" + NL + "\tpublic Image getBundledImage(String path) {" + NL + "\t\tImage image = getImageRegistry().get(path);" + NL + "\t\tif (image == null) {" + NL + "\t\t\tgetImageRegistry().put(path, getBundledImageDescriptor(path));" + NL + "\t\t\timage = getImageRegistry().get(path);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error) {" + NL + "\t\tlogError(error, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error, Throwable throwable) {" + NL + "\t\tif (error == null && throwable != null) {" + NL + "\t\t\terror = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.ERROR, "; >- protected final String TEXT_12 = ".ID, IStatus.OK, error, throwable));" + NL + "\t\tdebug(error, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message) {" + NL + "\t\tlogInfo(message, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message, Throwable throwable) {" + NL + "\t\tif (message == null && message != null) {" + NL + "\t\t\tmessage = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.INFO, "; >- protected final String TEXT_13 = ".ID, IStatus.OK, message, throwable));" + NL + "\t\tdebug(message, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void debug(String message, Throwable throwable) {" + NL + "\t\tif (!isDebugging()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (message != null) {" + NL + "\t\t\tSystem.err.println(message);" + NL + "\t\t}" + NL + "\t\tif (throwable != null) {" + NL + "\t\t\tthrowable.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "}"; >- protected final String TEXT_14 = NL; >+ protected final String TEXT_11 = NL + "\t\t\treturn ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Returns an image descriptor for the image file at the given" + NL + "\t * plug-in relative path." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return the image descriptor" + NL + "\t */" + NL + "\tpublic static ImageDescriptor getBundledImageDescriptor(String path) {" + NL + "\t\treturn AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * Returns an image for the image file at the given plug-in relative path." + NL + "\t * Client do not need to dispose this image. Images will be disposed automatically." + NL + "\t *" + NL + "\t * @generated" + NL + "\t * @param path the path" + NL + "\t * @return image instance" + NL + "\t */" + NL + "\tpublic Image getBundledImage(String path) {" + NL + "\t\tImage image = getImageRegistry().get(path);" + NL + "\t\tif (image == null) {" + NL + "\t\t\tgetImageRegistry().put(path, getBundledImageDescriptor(path));" + NL + "\t\t\timage = getImageRegistry().get(path);" + NL + "\t\t}" + NL + "\t\treturn image;" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String getBundleString(String key) {" + NL + "\t\ttry {" + NL + "\t\t\treturn "; >+ protected final String TEXT_12 = ".getResourceBundle(getBundle()).getString(key);" + NL + "\t\t} catch ("; >+ protected final String TEXT_13 = " e) {" + NL + "\t\t\treturn \"!\" + key + \"!\";\t//$NON-NLS-1$\t//$NON-NLS-2$" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error) {" + NL + "\t\tlogError(error, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logError(String error, Throwable throwable) {" + NL + "\t\tif (error == null && throwable != null) {" + NL + "\t\t\terror = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.ERROR, "; >+ protected final String TEXT_14 = ".ID, IStatus.OK, error, throwable));" + NL + "\t\tdebug(error, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message) {" + NL + "\t\tlogInfo(message, null);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param throwable actual error or null could be passed" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void logInfo(String message, Throwable throwable) {" + NL + "\t\tif (message == null && message != null) {" + NL + "\t\t\tmessage = throwable.getMessage();" + NL + "\t\t}" + NL + "\t\tgetLog().log(new Status(IStatus.INFO, "; >+ protected final String TEXT_15 = ".ID, IStatus.OK, message, throwable));" + NL + "\t\tdebug(message, throwable);" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void debug(String message, Throwable throwable) {" + NL + "\t\tif (!isDebugging()) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif (message != null) {" + NL + "\t\t\tSystem.err.println(message);" + NL + "\t\t}" + NL + "\t\tif (throwable != null) {" + NL + "\t\t\tthrowable.printStackTrace();" + NL + "\t\t}" + NL + "\t}" + NL + "\t" + NL + "}"; >+ protected final String TEXT_16 = NL; > > public String generate(Object argument) > { >@@ -68,12 +70,16 @@ > // FIXME move image registry to plugin class code > > stringBuffer.append(TEXT_11); >- stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Platform")); > stringBuffer.append(TEXT_12); >- stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(importManager.getImportedName("java.util.MissingResourceException")); > stringBuffer.append(TEXT_13); >- importManager.emitSortedImports(); >+ stringBuffer.append(genPlugin.getActivatorClassName()); > stringBuffer.append(TEXT_14); >+ stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(TEXT_15); >+ importManager.emitSortedImports(); >+ stringBuffer.append(TEXT_16); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/ManifestGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/ManifestGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 ManifestGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/ManifestGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/ManifestGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -20,12 +20,14 @@ > protected final String TEXT_2 = "; singleton:=true" + NL + "Bundle-Version: "; > protected final String TEXT_3 = NL + "Bundle-ClassPath: ." + NL + "Bundle-Activator: "; > protected final String TEXT_4 = NL + "Bundle-Vendor: %providerName" + NL + "Bundle-Localization: plugin" + NL + "Export-Package: "; >- protected final String TEXT_5 = NL + "Require-Bundle: org.eclipse.core.runtime," + NL + " org.eclipse.jface," + NL + " org.eclipse.ui.views," + NL + " org.eclipse.ui.workbench," + NL + " org.eclipse.emf.ecore," + NL + " org.eclipse.emf.edit.ui," + NL + " org.eclipse.gef;visibility:=reexport," + NL + " org.eclipse.gmf.runtime.notation," + NL + " org.eclipse.gmf.runtime.notation.edit"; >- protected final String TEXT_6 = ","; >- protected final String TEXT_7 = NL + " "; >- protected final String TEXT_8 = ";visibility:=reexport"; >- protected final String TEXT_9 = NL + "Eclipse-LazyStart: true"; >- protected final String TEXT_10 = NL; >+ protected final String TEXT_5 = NL + "Require-Bundle: org.eclipse.core.runtime,"; >+ protected final String TEXT_6 = "org.eclipse.core.resources," + NL + " org.eclipse.ui.ide,"; >+ protected final String TEXT_7 = NL + " org.eclipse.jface," + NL + " org.eclipse.ui.views," + NL + " org.eclipse.ui.workbench," + NL + " org.eclipse.emf.ecore," + NL + " org.eclipse.emf.edit.ui," + NL + " org.eclipse.gef;visibility:=reexport," + NL + " org.eclipse.gmf.runtime.notation," + NL + " org.eclipse.gmf.runtime.notation.edit"; >+ protected final String TEXT_8 = ","; >+ protected final String TEXT_9 = NL + " "; >+ protected final String TEXT_10 = ";visibility:=reexport"; >+ protected final String TEXT_11 = NL + "Eclipse-LazyStart: true"; >+ protected final String TEXT_12 = NL; > > public String generate(Object argument) > { >@@ -57,14 +59,18 @@ > stringBuffer.append(TEXT_4); > stringBuffer.append(genPlugin.getEditorGen().getEditor().getPackageName()); > stringBuffer.append(TEXT_5); >- while(requiredBundleIterator.hasNext()) { >+ if (!genModel.isRichClientPlatform()) { > stringBuffer.append(TEXT_6); >+ } > stringBuffer.append(TEXT_7); >- stringBuffer.append(requiredBundleIterator.next()); >+ while(requiredBundleIterator.hasNext()) { > stringBuffer.append(TEXT_8); >- } > stringBuffer.append(TEXT_9); >+ stringBuffer.append(requiredBundleIterator.next()); > stringBuffer.append(TEXT_10); >+ } >+ stringBuffer.append(TEXT_11); >+ stringBuffer.append(TEXT_12); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/DiagramEditorUtilGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/DiagramEditorUtilGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 DiagramEditorUtilGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/DiagramEditorUtilGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/DiagramEditorUtilGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -2,6 +2,7 @@ > > import org.eclipse.gmf.codegen.gmfgen.*; > import org.eclipse.gmf.common.codegen.*; >+import org.eclipse.emf.codegen.ecore.genmodel.*; > > public class DiagramEditorUtilGenerator > { >@@ -17,10 +18,143 @@ > protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; > protected final String TEXT_1 = ""; > protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; >- protected final String TEXT_3 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String openFilePathDialog(Shell shell, String fileExtensionFilter, int style) {" + NL + "\t\tFileDialog fileDialog = new FileDialog(shell, style);" + NL + "\t\tfileDialog.setFilterExtensions(new String[]{fileExtensionFilter});" + NL + "" + NL + "\t\tfileDialog.open();" + NL + "\t\tif (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {" + NL + "\t\t\treturn fileDialog.getFilterPath() + File.separator + fileDialog.getFileName();" + NL + "\t\t}" + NL + "\t\telse" + NL + "\t\t{" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean openEditor(URI fileURI) {" + NL + "\t\tIWorkbench workbench = PlatformUI.getWorkbench();" + NL + "\t\tIWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();" + NL + "\t\tIWorkbenchPage page = workbenchWindow.getActivePage();" + NL + "" + NL + "\t\tIEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString());" + NL + "\t\tif (editorDescriptor == null) {" + NL + "\t\t\tMessageDialog.openError(" + NL + "\t\t\tworkbenchWindow.getShell()," + NL + "\t\t\t\"Error\"," + NL + "\t\t\t\"There is no editor registered for the file \" + fileURI.toFileString());" + NL + "\t\t\treturn false;" + NL + "\t\t} else {" + NL + "\t\t\ttry {" + NL + "\t\t\t\tpage.openEditor(new URIEditorInput(fileURI), editorDescriptor.getId());" + NL + "\t\t\t} catch (PartInitException exception) {" + NL + "\t\t\t\tMessageDialog.openError(" + NL + "\t\t\t\tworkbenchWindow.getShell()," + NL + "\t\t\t\t\"Error Opening Editor\"," + NL + "\t\t\t\texception.getMessage());" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static URI getDiagramFileURI(URI modelFileURI) {" + NL + "\t\tif (modelFileURI == null || !modelFileURI.isFile()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn modelFileURI.trimFileExtension().appendFileExtension(\""; >- protected final String TEXT_4 = "\");" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static URI getModelFileURI(URI diagramFileURI) {" + NL + "\t\tif (diagramFileURI == null || !diagramFileURI.isFile()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFileURI.trimFileExtension().appendFileExtension(\""; >- protected final String TEXT_5 = "\");" + NL + "\t}" + NL + " }"; >- protected final String TEXT_6 = NL; >+ protected final String TEXT_3 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static String openFilePathDialog(Shell shell, String fileExtensionFilter, int style) {" + NL + "\t\tFileDialog fileDialog = new FileDialog(shell, style);" + NL + "\t\tfileDialog.setFilterExtensions(new String[]{fileExtensionFilter});" + NL + "" + NL + "\t\tfileDialog.open();" + NL + "\t\tif (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {" + NL + "\t\t\treturn fileDialog.getFilterPath() + File.separator + fileDialog.getFileName();" + NL + "\t\t}" + NL + "\t\telse" + NL + "\t\t{" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static boolean openEditor(URI fileURI) {" + NL + "\t\tIWorkbench workbench = PlatformUI.getWorkbench();" + NL + "\t\tIWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();" + NL + "\t\tIWorkbenchPage page = workbenchWindow.getActivePage();" + NL + "" + NL + "\t\tIEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(fileURI.lastSegment());" + NL + "\t\tif (editorDescriptor == null) {" + NL + "\t\t\tMessageDialog.openError(" + NL + "\t\t\tworkbenchWindow.getShell()," + NL + "\t\t\t\"Error\"," + NL + "\t\t\t\"There is no editor registered for the file \" + fileURI.toFileString());" + NL + "\t\t\treturn false;" + NL + "\t\t} else {" + NL + "\t\t\ttry {" + NL + "\t\t\t\tpage.openEditor(new URIEditorInput(fileURI), editorDescriptor.getId());" + NL + "\t\t\t} catch (PartInitException exception) {" + NL + "\t\t\t\tMessageDialog.openError(" + NL + "\t\t\t\tworkbenchWindow.getShell()," + NL + "\t\t\t\t\"Error Opening Editor\"," + NL + "\t\t\t\texception.getMessage());" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\treturn true;" + NL + "\t}" + NL; >+ protected final String TEXT_4 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static URI getDiagramFileURI(URI modelFileURI) {" + NL + "\t\tif (modelFileURI == null || !modelFileURI.isFile()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn modelFileURI.trimFileExtension().appendFileExtension(\""; >+ protected final String TEXT_5 = "\");" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static URI getModelFileURI(URI diagramFileURI) {" + NL + "\t\tif (diagramFileURI == null || !diagramFileURI.isFile()) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFileURI.trimFileExtension().appendFileExtension(\""; >+ protected final String TEXT_6 = "\");" + NL + "\t}"; >+ protected final String TEXT_7 = NL + "\t/**" + NL + "\t * Looks up a string in the plugin's plugin.properties file." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static String getString(String key) {" + NL + "\t\treturn "; >+ protected final String TEXT_8 = ".getInstance().getBundleString(key);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * RCP's application" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class Application implements "; >+ protected final String TEXT_9 = " {" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic Object run(Object args) {" + NL + "\t\t\t"; >+ protected final String TEXT_10 = " workbenchAdvisor = new Advisor();" + NL + "\t\t\t"; >+ protected final String TEXT_11 = " display = "; >+ protected final String TEXT_12 = ".createDisplay();" + NL + "\t\t\ttry {" + NL + "\t\t\t\tint returnCode = "; >+ protected final String TEXT_13 = ".createAndRunWorkbench(display, workbenchAdvisor);" + NL + "\t\t\t\tif (returnCode == "; >+ protected final String TEXT_14 = ".RETURN_RESTART) {" + NL + "\t\t\t\t\treturn "; >+ protected final String TEXT_15 = ".EXIT_RESTART;" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\treturn "; >+ protected final String TEXT_16 = ".EXIT_OK;" + NL + "\t\t\t\t}" + NL + "\t\t\t} finally {" + NL + "\t\t\t\tdisplay.dispose();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + " " + NL + " \t/**" + NL + "\t * RCP's perspective" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class Advisor extends "; >+ protected final String TEXT_17 = " {" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId()" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic String getInitialWindowPerspectiveId() {" + NL + "\t\t\treturn Perspective.ID_PERSPECTIVE;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void initialize("; >+ protected final String TEXT_18 = " configurer) {" + NL + "\t\t\tsuper.initialize(configurer);" + NL + "\t\t\tconfigurer.setSaveAndRestore(true);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic WorkbenchWindowAdvisor createWorkbenchWindowAdvisor("; >+ protected final String TEXT_19 = " configurer) {" + NL + "\t\t\treturn new WindowAdvisor(configurer);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + " \t/**" + NL + "\t * RCP's perspective" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class Perspective implements "; >+ protected final String TEXT_20 = " {" + NL + "\t\t/**" + NL + "\t\t * Perspective ID" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic static final String ID_PERSPECTIVE = \""; >+ protected final String TEXT_21 = ".Perspective\";\t//$NON-NLS-1$" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void createInitialLayout("; >+ protected final String TEXT_22 = " layout) {" + NL + "\t\t\tlayout.setEditorAreaVisible(true);" + NL + "\t\t\tlayout.addPerspectiveShortcut(ID_PERSPECTIVE);" + NL + "" + NL + "\t\t\t"; >+ protected final String TEXT_23 = " right = layout.createFolder(\"right\", "; >+ protected final String TEXT_24 = ".RIGHT, (float)0.66, layout.getEditorArea());\t//$NON-NLS-1$" + NL + "\t\t\tright.addView(IPageLayout.ID_OUTLINE);" + NL + "" + NL + "\t\t\t"; >+ protected final String TEXT_25 = " bottomRight = layout.createFolder(\"bottonRight\", "; >+ protected final String TEXT_26 = ".BOTTOM, (float)0.60, \"right\");\t//$NON-NLS-1$\t//$NON-NLS-2$" + NL + "\t\t\tbottomRight.addView("; >+ protected final String TEXT_27 = ".ID_PROP_SHEET);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * RCP's window advisor" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class WindowAdvisor extends "; >+ protected final String TEXT_28 = " {" + NL + "\t\t/**" + NL + "\t\t * @see WorkbenchWindowAdvisor#WorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic WindowAdvisor("; >+ protected final String TEXT_29 = " configurer) {" + NL + "\t\t\tsuper(configurer);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen()" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void preWindowOpen() {" + NL + "\t\t\t"; >+ protected final String TEXT_30 = " configurer = getWindowConfigurer();" + NL + "\t\t\tconfigurer.setInitialSize(new "; >+ protected final String TEXT_31 = "(600, 450));" + NL + "\t\t\tconfigurer.setShowCoolBar(false);" + NL + "\t\t\tconfigurer.setShowStatusLine(true);" + NL + "\t\t\tconfigurer.setTitle(getString(\"_UI_Application_title\"));\t//$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; >+ protected final String TEXT_32 = " createActionBarAdvisor("; >+ protected final String TEXT_33 = " configurer) {" + NL + "\t\t\treturn new WindowActionBarAdvisor(configurer);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * RCP's action bar advisor" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class WindowActionBarAdvisor extends "; >+ protected final String TEXT_34 = " {" + NL + "\t\t/**" + NL + "\t\t * @see ActionBarAdvisor#ActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic WindowActionBarAdvisor("; >+ protected final String TEXT_35 = " configurer) {" + NL + "\t\t\tsuper(configurer);" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.application.ActionBarAdvisor#fillMenuBar(org.eclipse.jface.action.IMenuManager)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected void fillMenuBar("; >+ protected final String TEXT_36 = " menuBar) {" + NL + "\t\t\t"; >+ protected final String TEXT_37 = " window = getActionBarConfigurer().getWindowConfigurer().getWindow();" + NL + "\t\t\tmenuBar.add(createFileMenu(window));" + NL + "\t\t\tmenuBar.add(createEditMenu(window));" + NL + "\t\t\tmenuBar.add(new "; >+ protected final String TEXT_38 = "("; >+ protected final String TEXT_39 = ".MB_ADDITIONS));" + NL + "\t\t\tmenuBar.add(createWindowMenu(window));" + NL + "\t\t\tmenuBar.add(createHelpMenu(window));\t\t\t\t\t" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Creates the 'File' menu." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; >+ protected final String TEXT_40 = " createFileMenu("; >+ protected final String TEXT_41 = " window) {" + NL + "\t\t\t"; >+ protected final String TEXT_42 = " menu = new "; >+ protected final String TEXT_43 = "(getString(\"_UI_Menu_File_label\"),\t//$NON-NLS-1$" + NL + "\t\t\t\t"; >+ protected final String TEXT_44 = ".M_FILE);" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_45 = "("; >+ protected final String TEXT_46 = ".FILE_START));" + NL + "\t" + NL + "\t\t\t"; >+ protected final String TEXT_47 = " newMenu = new "; >+ protected final String TEXT_48 = "(getString(\"_UI_Menu_New_label\"), \"new\");\t//$NON-NLS-1$\t//$NON-NLS-2$" + NL + "\t\t\tnewMenu.add(new "; >+ protected final String TEXT_49 = "("; >+ protected final String TEXT_50 = ".MB_ADDITIONS));" + NL + "\t" + NL + "\t\t\tmenu.add(newMenu);" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_51 = "());" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_52 = "("; >+ protected final String TEXT_53 = ".MB_ADDITIONS));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_54 = "());" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_55 = ".CLOSE.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_56 = ".CLOSE_ALL.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_57 = "());" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_58 = ".SAVE.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_59 = ".SAVE_AS.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_60 = ".SAVE_ALL.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_61 = "());" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_62 = ".QUIT.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_63 = "("; >+ protected final String TEXT_64 = ".FILE_END));" + NL + "\t\t\treturn menu;" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * Creates the 'Edit' menu." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; >+ protected final String TEXT_65 = " createEditMenu("; >+ protected final String TEXT_66 = " window) {" + NL + "\t\t\t"; >+ protected final String TEXT_67 = " menu = new "; >+ protected final String TEXT_68 = "(getString(\"_UI_Menu_Edit_label\"),\t//$NON-NLS-1$" + NL + "\t\t\t\t"; >+ protected final String TEXT_69 = ".M_EDIT);" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_70 = "("; >+ protected final String TEXT_71 = ".EDIT_START));" + NL + "\t" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_72 = ".UNDO.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_73 = ".REDO.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_74 = "("; >+ protected final String TEXT_75 = ".UNDO_EXT));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_76 = "());" + NL + "\t" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_77 = ".CUT.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_78 = ".COPY.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_79 = ".PASTE.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_80 = "("; >+ protected final String TEXT_81 = ".CUT_EXT));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_82 = "());" + NL + "\t" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_83 = ".DELETE.create(window));" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_84 = ".SELECT_ALL.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_85 = "());" + NL + "\t" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_86 = "("; >+ protected final String TEXT_87 = ".ADD_EXT));" + NL + "\t" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_88 = "("; >+ protected final String TEXT_89 = ".EDIT_END));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_90 = "("; >+ protected final String TEXT_91 = ".MB_ADDITIONS));" + NL + "\t\t\treturn menu;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * Creates the 'Window' menu." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; >+ protected final String TEXT_92 = " createWindowMenu("; >+ protected final String TEXT_93 = " window) {" + NL + "\t\t\t"; >+ protected final String TEXT_94 = " menu = new "; >+ protected final String TEXT_95 = "(getString(\"_UI_Menu_Window_label\"),\t//$NON-NLS-1$" + NL + "\t\t\t\t"; >+ protected final String TEXT_96 = ".M_WINDOW);" + NL + "\t" + NL + "\t\t\taddToMenuAndRegister(menu, "; >+ protected final String TEXT_97 = ".OPEN_NEW_WINDOW.create(window));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_98 = "("; >+ protected final String TEXT_99 = ".MB_ADDITIONS));" + NL + "\t\t\tmenu.add("; >+ protected final String TEXT_100 = ".OPEN_WINDOWS.create(window));" + NL + "\t" + NL + "\t\t\treturn menu;" + NL + "\t\t}" + NL + "\t" + NL + "\t\t/**" + NL + "\t\t * Creates the 'Help' menu." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected "; >+ protected final String TEXT_101 = " createHelpMenu("; >+ protected final String TEXT_102 = " window) {" + NL + "\t\t\t"; >+ protected final String TEXT_103 = " menu = new "; >+ protected final String TEXT_104 = "(getString(\"_UI_Menu_Help_label\"), "; >+ protected final String TEXT_105 = ".M_HELP);\t//$NON-NLS-1$" + NL + "\t\t\t// Welcome or intro page would go here" + NL + "\t\t\t// Help contents would go here" + NL + "\t\t\t// Tips and tricks page would go here" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_106 = "("; >+ protected final String TEXT_107 = ".HELP_START));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_108 = "("; >+ protected final String TEXT_109 = ".HELP_END));" + NL + "\t\t\tmenu.add(new "; >+ protected final String TEXT_110 = "("; >+ protected final String TEXT_111 = ".MB_ADDITIONS));" + NL + "\t\t\treturn menu;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\t/**" + NL + "\t\t * Adds the specified action to the given menu and also registers the action with the" + NL + "\t\t * action bar configurer, in order to activate its key binding." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprotected void addToMenuAndRegister("; >+ protected final String TEXT_112 = " menuManager, "; >+ protected final String TEXT_113 = " action) {" + NL + "\t\t\tmenuManager.add(action);" + NL + "\t\t\tgetActionBarConfigurer().registerGlobalAction(action);\t\t\t" + NL + "\t\t}\t\t" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * About action for the RCP application." + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class AboutAction extends "; >+ protected final String TEXT_114 = " {" + NL + "\t\t/**" + NL + "\t\t * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run("; >+ protected final String TEXT_115 = " action) {" + NL + "\t\t\t"; >+ protected final String TEXT_116 = ".openInformation(getWindow().getShell(), getString(\"_UI_About_title\"),\t//$NON-NLS-1$" + NL + "\t\t\tgetString(\"_UI_About_text\"));\t//$NON-NLS-1$" + NL + "\t\t}" + NL + "\t}"; >+ protected final String TEXT_117 = NL + NL + " \t/**" + NL + "\t * Open action for the "; >+ protected final String TEXT_118 = " diagram." + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class OpenDiagramAction extends "; >+ protected final String TEXT_119 = " {" + NL + "\t\t/**" + NL + "\t\t * Opens the editors for the files selected using the file dialog." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run("; >+ protected final String TEXT_120 = " action) {" + NL + "\t\t\tString filePath = openFilePathDialog(getWindow().getShell(), \"*."; >+ protected final String TEXT_121 = "\", "; >+ protected final String TEXT_122 = ".OPEN);\t//$NON-NLS-1$" + NL + "\t\t\tif (filePath != null) {" + NL + "\t\t\t\topenEditor(URI.createFileURI(filePath));" + NL + "\t\t\t}" + NL + "\t\t}" + NL + " \t}" + NL + "" + NL + "\t/**" + NL + "\t * Open URI action for the "; >+ protected final String TEXT_123 = " diagram." + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class OpenURIAction extends "; >+ protected final String TEXT_124 = " {" + NL + "\t\t/**" + NL + "\t\t * Opens the editors for the files selected using the LoadResourceDialog." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run("; >+ protected final String TEXT_125 = " action) {" + NL + "\t\t\t"; >+ protected final String TEXT_126 = ".LoadResourceDialog loadResourceDialog = new "; >+ protected final String TEXT_127 = ".LoadResourceDialog(getWindow().getShell());" + NL + "\t\t\tif ("; >+ protected final String TEXT_128 = ".OK == loadResourceDialog.open()) {" + NL + "\t\t\t\tfor ("; >+ protected final String TEXT_129 = " it = loadResourceDialog.getURIs().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\t\topenEditor((URI) it.next());" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * New diagram action for the "; >+ protected final String TEXT_130 = " diagram." + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static class NewDiagramAction extends "; >+ protected final String TEXT_131 = " {" + NL + "\t\t/**" + NL + "\t\t * Opens the wizard to create the diagram." + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void run("; >+ protected final String TEXT_132 = " action) {" + NL + "\t\t\t"; >+ protected final String TEXT_133 = " wizard = new "; >+ protected final String TEXT_134 = "();" + NL + "\t\t\twizard.init(getWindow().getWorkbench(), "; >+ protected final String TEXT_135 = ".EMPTY);" + NL + "\t\t\t"; >+ protected final String TEXT_136 = " wizardDialog = new "; >+ protected final String TEXT_137 = "(getWindow().getShell(), wizard);" + NL + "\t\t\twizardDialog.open();" + NL + "\t\t}" + NL + "\t}"; >+ protected final String TEXT_138 = NL + "}"; >+ protected final String TEXT_139 = NL; > > public String generate(Object argument) > { >@@ -28,7 +162,10 @@ > > final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; > final GenEditorGenerator editorGen = genDiagram.getEditorGen(); >+final GenPlugin genPlugin = editorGen.getPlugin(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final GenModel genModel = genDiagram.getEditorGen().getDomainGenModel(); >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > stringBuffer.append(TEXT_1); >@@ -49,12 +186,291 @@ > stringBuffer.append(TEXT_2); > stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); > stringBuffer.append(TEXT_3); >- stringBuffer.append(editorGen.getDiagramFileExtension()); >+ >+if (!genDiagram.getEditorGen().isSameFileForDiagramAndModel()) { >+ > stringBuffer.append(TEXT_4); >- stringBuffer.append(editorGen.getDomainFileExtension()); >+ stringBuffer.append(editorGen.getDiagramFileExtension()); > stringBuffer.append(TEXT_5); >- importManager.emitSortedImports(); >+ stringBuffer.append(editorGen.getDomainFileExtension()); > stringBuffer.append(TEXT_6); >+ >+} >+ >+ >+if (isRichClientPlatform) { >+ boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+ >+ stringBuffer.append(TEXT_7); >+ stringBuffer.append(importManager.getImportedName(genPlugin.getActivatorQualifiedClassName())); >+ stringBuffer.append(TEXT_8); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")); >+ stringBuffer.append(TEXT_9); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.WorkbenchAdvisor")); >+ stringBuffer.append(TEXT_10); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Display")); >+ stringBuffer.append(TEXT_11); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); >+ stringBuffer.append(TEXT_12); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); >+ stringBuffer.append(TEXT_13); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); >+ stringBuffer.append(TEXT_14); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")); >+ stringBuffer.append(TEXT_15); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IPlatformRunnable")); >+ stringBuffer.append(TEXT_16); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.WorkbenchAdvisor")); >+ stringBuffer.append(TEXT_17); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IWorkbenchConfigurer")); >+ stringBuffer.append(TEXT_18); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")); >+ stringBuffer.append(TEXT_19); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPerspectiveFactory")); >+ stringBuffer.append(TEXT_20); >+ stringBuffer.append(genPlugin.getID()); >+ stringBuffer.append(TEXT_21); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPageLayout")); >+ stringBuffer.append(TEXT_22); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFolderLayout")); >+ stringBuffer.append(TEXT_23); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPageLayout")); >+ stringBuffer.append(TEXT_24); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFolderLayout")); >+ stringBuffer.append(TEXT_25); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPageLayout")); >+ stringBuffer.append(TEXT_26); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPageLayout")); >+ stringBuffer.append(TEXT_27); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.WorkbenchWindowAdvisor")); >+ stringBuffer.append(TEXT_28); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")); >+ stringBuffer.append(TEXT_29); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IWorkbenchWindowConfigurer")); >+ stringBuffer.append(TEXT_30); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.graphics.Point")); >+ stringBuffer.append(TEXT_31); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.ActionBarAdvisor")); >+ stringBuffer.append(TEXT_32); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IActionBarConfigurer")); >+ stringBuffer.append(TEXT_33); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.ActionBarAdvisor")); >+ stringBuffer.append(TEXT_34); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.application.IActionBarConfigurer")); >+ stringBuffer.append(TEXT_35); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_36); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")); >+ stringBuffer.append(TEXT_37); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_38); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_39); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_40); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")); >+ stringBuffer.append(TEXT_41); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_42); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.MenuManager")); >+ stringBuffer.append(TEXT_43); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_44); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_45); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_46); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_47); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.MenuManager")); >+ stringBuffer.append(TEXT_48); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_49); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_50); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_51); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_52); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_53); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_54); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_55); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_56); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_57); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_58); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_59); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_60); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_61); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_62); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_63); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_64); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_65); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")); >+ stringBuffer.append(TEXT_66); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_67); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.MenuManager")); >+ stringBuffer.append(TEXT_68); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_69); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_70); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_71); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_72); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_73); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_74); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_75); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_76); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_77); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_78); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_79); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_80); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_81); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_82); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_83); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_84); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_85); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_86); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_87); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_88); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_89); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.Separator")); >+ stringBuffer.append(TEXT_90); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_91); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_92); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")); >+ stringBuffer.append(TEXT_93); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_94); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.MenuManager")); >+ stringBuffer.append(TEXT_95); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_96); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ActionFactory")); >+ stringBuffer.append(TEXT_97); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_98); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_99); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.ContributionItemFactory")); >+ stringBuffer.append(TEXT_100); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_101); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchWindow")); >+ stringBuffer.append(TEXT_102); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_103); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.MenuManager")); >+ stringBuffer.append(TEXT_104); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_105); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_106); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_107); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_108); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_109); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.GroupMarker")); >+ stringBuffer.append(TEXT_110); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IWorkbenchActionConstants")); >+ stringBuffer.append(TEXT_111); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IMenuManager")); >+ stringBuffer.append(TEXT_112); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); >+ stringBuffer.append(TEXT_113); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")); >+ stringBuffer.append(TEXT_114); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); >+ stringBuffer.append(TEXT_115); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.MessageDialog")); >+ stringBuffer.append(TEXT_116); >+ >+ } >+ >+ stringBuffer.append(TEXT_117); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_118); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")); >+ stringBuffer.append(TEXT_119); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); >+ stringBuffer.append(TEXT_120); >+ stringBuffer.append(editorGen.getDiagramFileExtension()); >+ stringBuffer.append(TEXT_121); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); >+ stringBuffer.append(TEXT_122); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_123); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")); >+ stringBuffer.append(TEXT_124); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); >+ stringBuffer.append(TEXT_125); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.action.LoadResourceAction")); >+ stringBuffer.append(TEXT_126); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.edit.ui.action.LoadResourceAction")); >+ stringBuffer.append(TEXT_127); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.Dialog")); >+ stringBuffer.append(TEXT_128); >+ stringBuffer.append(importManager.getImportedName("java.util.Iterator")); >+ stringBuffer.append(TEXT_129); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_130); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate")); >+ stringBuffer.append(TEXT_131); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.action.IAction")); >+ stringBuffer.append(TEXT_132); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardQualifiedClassName())); >+ stringBuffer.append(TEXT_133); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardQualifiedClassName())); >+ stringBuffer.append(TEXT_134); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.StructuredSelection")); >+ stringBuffer.append(TEXT_135); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); >+ stringBuffer.append(TEXT_136); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardDialog")); >+ stringBuffer.append(TEXT_137); >+ >+} >+ >+ stringBuffer.append(TEXT_138); >+ importManager.emitSortedImports(); >+ stringBuffer.append(TEXT_139); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 EditorGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -19,58 +19,97 @@ > protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; > protected final String TEXT_1 = ""; > protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; >- protected final String TEXT_3 = " extends GraphicalEditorWithFlyoutPalette {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class UpdatableActionGroup {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addAction(UpdateAction action) {" + NL + "\t\t\tassert action != null;" + NL + "\t\t\tmyActions.add(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeAction(UpdateAction action) {" + NL + "\t\t\tmyActions.remove(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void update() {" + NL + "\t\t\tfor (Iterator it = myActions.iterator(); it.hasNext();) {" + NL + "\t\t\t\tUpdateAction next = (UpdateAction) it.next();" + NL + "\t\t\t\tnext.update();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ArrayList myActions = new ArrayList();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; >- protected final String TEXT_4 = " "; >- protected final String TEXT_5 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; >- protected final String TEXT_6 = " diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isDirty = false;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PaletteRoot paletteRoot;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PropertySheetPage undoablePropertySheetPage;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup stackActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener commandStackListener = new CommandStackListener() {" + NL + "" + NL + "\t\tpublic void commandStackChanged(EventObject event) {" + NL + "\t\t\tstackActions.update();" + NL + "\t\t\tsetDirty(((CommandStack) event.getSource()).isDirty());" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editPartActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener selectionListener = new ISelectionListener() {" + NL + "" + NL + "\t\tpublic void selectionChanged(IWorkbenchPart part, ISelection selection) {" + NL + "\t\t\teditPartActions.update();" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editorActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory domainAdapterFactory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void firePropertyChange(int propertyId) {" + NL + "\t\tsuper.firePropertyChange(propertyId);" + NL + "\t\teditorActions.update();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an action to this editor's <code>ActionRegistry</code>. (This is" + NL + "\t * a helper method.)" + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the action to add." + NL + "\t */" + NL + "\tprotected void addAction(IAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an editor action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * Editor actions are actions that depend and work on the editor." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the editor action" + NL + "\t */" + NL + "\tprotected void addEditorAction(WorkbenchPartAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditorActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>EditPart</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>EditPart</code> actions are actions that depend and work on the" + NL + "\t * selected <code>EditPart</code>s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>EditPart</code> action" + NL + "\t */" + NL + "\tprotected void addEditPartAction(SelectionAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditPartActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>CommandStack</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>CommandStack</code> actions are actions that depend and work on" + NL + "\t * the <code>CommandStack</code>." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>CommandStack</code> action" + NL + "\t */" + NL + "\tprotected void addStackAction(StackAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\tstackActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createActions() {" + NL + "\t\taddStackAction(new UndoAction(this));" + NL + "\t\taddStackAction(new RedoAction(this));" + NL + "" + NL + "\t\taddEditPartAction(new DeleteAction((IWorkbenchPart) this));" + NL + "\t\taddEditPartAction(new DirectEditAction((IWorkbenchPart) this));" + NL + "" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE));" + NL + "" + NL + "\t\taddEditorAction(new SaveAction(this));" + NL + "\t\taddEditorAction(new PrintAction(this));" + NL + "" + NL + "\t\tIAction zoomIn = new ZoomInAction(getZoomManager());" + NL + "\t\tIAction zoomOut = new ZoomOutAction(getZoomManager());" + NL + "\t\taddAction(zoomIn);" + NL + "\t\taddAction(zoomOut);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomIn);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomOut);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void dispose() {" + NL + "\t\t// remove CommandStackListener" + NL + "\t\tgetCommandStack().removeCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// remove selection listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(getSelectionListener());" + NL + "" + NL + "\t\t// dispose the ActionRegistry (will dispose all actions)" + NL + "\t\tgetActionRegistry().dispose();" + NL + "" + NL + "\t\t// important: always call super implementation of dispose" + NL + "\t\tsuper.dispose();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSave(IProgressMonitor monitor) {" + NL + "\t\ttry {" + NL + "\t\t\tsave(monitor);" + NL + "\t\t\tgetCommandStack().markSaveLocation();" + NL + "\t\t} catch (CoreException e) {" + NL + "\t\t\tErrorDialog.openError(getSite().getShell(), \"Error During Save\", \"The current "; >- protected final String TEXT_7 = " model could not be saved.\", e.getStatus());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void save(IProgressMonitor progressMonitor) throws CoreException {" + NL + "\t\tif (progressMonitor == null) {" + NL + "\t\t\tprogressMonitor = new NullProgressMonitor();" + NL + "\t\t}" + NL + "\t\tprogressMonitor.beginTask(\"Saving\", getEditingDomain().getResourceSet().getResources().size());" + NL + "\t\ttry {" + NL + "\t\t\tfor(Iterator it = getEditingDomain().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tResource next = (Resource)it.next();" + NL + "\t\t\t\tnext.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\tprogressMonitor.worked(1);" + NL + "\t\t\t}" + NL + "\t\t} catch (IOException e) {" + NL + "\t\t\tIStatus status = new Status(IStatus.ERROR, "; >- protected final String TEXT_8 = ".ID, 0, \"Error writing file.\", e);" + NL + "\t\t\tthrow new CoreException(status);" + NL + "\t\t} finally {" + NL + "\t\t\tprogressMonitor.done();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\t// TODO: should be allowed." + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\t// TODO: Implement." + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == IPropertySheetPage.class) {" + NL + "\t\t\treturn getPropertySheetPage();" + NL + "\t\t} else if (type == IContentOutlinePage.class) {" + NL + "\t\t\treturn getOutlinePage();" + NL + "\t\t} else if (type == ZoomManager.class) {" + NL + "\t\t\treturn getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ZoomManager getZoomManager() {" + NL + "\t\treturn getZoomManager(getGraphicalViewer());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ZoomManager getZoomManager(GraphicalViewer viewer) {" + NL + "\t\t// get zoom manager from root edit part" + NL + "\t\tRootEditPart rootEditPart = viewer.getRootEditPart();" + NL + "\t\tZoomManager zoomManager = null;" + NL + "\t\tif (rootEditPart instanceof ScalableFreeformRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableFreeformRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t} else if (rootEditPart instanceof ScalableRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn zoomManager;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener getStackActionsListener() {" + NL + "\t\treturn commandStackListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IContentOutlinePage getOutlinePage() {" + NL + "\t\t//TODO: outline page missing" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot getPaletteRoot() {" + NL + "\t\tif (paletteRoot == null) {" + NL + "\t\t\tpaletteRoot = new PaletteRoot();"; >- protected final String TEXT_9 = NL + "\t\t\tnew "; >- protected final String TEXT_10 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);"; >- protected final String TEXT_11 = NL + "\t\t}" + NL + "\t\treturn paletteRoot;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PropertySheetPage getPropertySheetPage() {" + NL + "\t\tif (undoablePropertySheetPage == null) {" + NL + "\t\t\tundoablePropertySheetPage = new PropertySheetPage();" + NL + "\t\t\t"; >- protected final String TEXT_12 = " rootEntry = new "; >- protected final String TEXT_13 = "(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new "; >- protected final String TEXT_14 = "(getDomainAdapterFactory()));" + NL + "\t\t\tundoablePropertySheetPage.setRootEntry(rootEntry);" + NL + "\t\t}" + NL + "" + NL + "\t\treturn undoablePropertySheetPage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener getSelectionListener() {" + NL + "\t\treturn selectionListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >- protected final String TEXT_15 = " get"; >- protected final String TEXT_16 = "() {" + NL + "\t\treturn "; >- protected final String TEXT_17 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Diagram getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IEditorSite site, IEditorInput input) throws PartInitException {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tif (file == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "\t\tsetSite(site);" + NL + "\t\tsetInput(input);" + NL + "\t\tsetEditDomain(new DefaultEditDomain(this));" + NL + "" + NL + "\t\t// validate" + NL + "\t\tif (get"; >- protected final String TEXT_18 = "() == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "" + NL + "\t\t// add CommandStackListener" + NL + "\t\tgetCommandStack().addCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// add selection change listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().addSelectionListener(getSelectionListener());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setInput(IEditorInput input) {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsetContentDescription(file.toFileString());" + NL + "\t\tsuper.setInput(input);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {" + NL + "\t\tif (input instanceof URIEditorInput) {" + NL + "\t\t\treturn ((URIEditorInput) input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof IPathEditorInput) {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isDirty() {" + NL + "\t\treturn isDirty;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setDirty(boolean dirty) {" + NL + "\t\tif (isDirty != dirty) {" + NL + "\t\t\tisDirty = dirty;" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\tBasicCommandStack commandStack = new BasicCommandStack();" + NL + "\t\t\teditingDomain = new AdapterFactoryEditingDomain(getDomainAdapterFactory(), commandStack, new HashMap());" + NL + "\t\t\teditingDomain.getResourceSet().eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(editingDomain));" + NL + "\t\t}" + NL + "\t\treturn editingDomain;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate AdapterFactory getDomainAdapterFactory() {" + NL + "\t\tif (domainAdapterFactory == null) {" + NL + "\t\t\tList factories = new ArrayList();" + NL + "\t\t\tfactories.add(new ResourceItemProviderAdapterFactory());"; >- protected final String TEXT_19 = NL + "\t\t\tfactories.add(new "; >- protected final String TEXT_20 = "());"; >- protected final String TEXT_21 = NL + "\t\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t\t\tfactories.add(new NotationItemProviderAdapterFactory());" + NL + "\t\t\tdomainAdapterFactory = new ComposedAdapterFactory(factories);" + NL + "\t\t}" + NL + "\t\treturn domainAdapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void load(URI diagramFile) {" + NL + "\t\t"; >- protected final String TEXT_22 = " = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tEditingDomain editingDomain = getEditingDomain();" + NL + "\t\tResourceSet resourceSet = editingDomain.getResourceSet();" + NL + "\t\tResource diagramResource = resourceSet.getResource(diagramFile, true);" + NL + "\t\tif (diagramResource == null) {" + NL + "\t\t\tdiagramResource = resourceSet.createResource(diagramFile);" + NL + "\t\t}" + NL + "\t\tdiagram = (Diagram) findInResource(diagramResource, Diagram.class);" + NL + "\t\tif (diagram == null) {" + NL + "\t\t\tdiagram = NotationFactory.eINSTANCE.createDiagram();" + NL + "\t\t\tdiagramResource.getContents().add(0, diagram);" + NL + "\t\t\t//Auxiliary creation should not be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; >- protected final String TEXT_23 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}"; >- protected final String TEXT_24 = NL + "\t\tURI modelFile = "; >- protected final String TEXT_25 = ".getModelFileURI(diagramFile);" + NL + "\t\tResource modelResource = resourceSet.getResource(modelFile, true);" + NL + "\t\tif (modelResource == null) {" + NL + "\t\t\tmodelResource = resourceSet.createResource(modelFile);" + NL + "\t\t}"; >- protected final String TEXT_26 = NL + "\t\t"; >- protected final String TEXT_27 = " = ("; >- protected final String TEXT_28 = ") findInResource("; >- protected final String TEXT_29 = ", "; >- protected final String TEXT_30 = ".class);" + NL + "\t\tif ("; >- protected final String TEXT_31 = " == null) {" + NL + "\t\t\t"; >- protected final String TEXT_32 = " = "; >- protected final String TEXT_33 = ".eINSTANCE.create"; >- protected final String TEXT_34 = "();" + NL + "\t\t\t"; >- protected final String TEXT_35 = ".getContents().add(0, "; >- protected final String TEXT_36 = ");" + NL + "\t\t\t//We don't want this auxiliary creation to be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\t"; >- protected final String TEXT_37 = ".save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; >- protected final String TEXT_38 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (!diagram.isSetElement()) {" + NL + "\t\t\tdiagram.setElement("; >- protected final String TEXT_39 = ");" + NL + "\t\t}" + NL + "\t}"; >- protected final String TEXT_40 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Object findInResource(Resource resource, Class expectedClass) {" + NL + "\t\tfor(Iterator it = resource.getContents().iterator(); it.hasNext(); ) {" + NL + "\t\t\tObject next = it.next();" + NL + "\t\t\tif (expectedClass.isInstance(next)) {" + NL + "\t\t\t\treturn next;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFocus() {" + NL + "\t\tgetGraphicalViewer().getControl().setFocus();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final void createPartControl(Composite parent) {" + NL + "\t\tsuper.createPartControl(parent);" + NL + "\t\t// initialize actions" + NL + "\t\tcreateActions();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createGraphicalViewer(Composite parent) {" + NL + "\t\tsuper.createGraphicalViewer(parent);" + NL + "\t\t// initialize the viewer with input" + NL + "\t\tScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();" + NL + "\t\tgetGraphicalViewer().setRootEditPart(root);" + NL + "\t\tgetGraphicalViewer().setEditPartFactory(new "; >- protected final String TEXT_41 = "());" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + NL + "" + NL + "\t\t"; >- protected final String TEXT_42 = " printableLayers = ("; >- protected final String TEXT_43 = ") root.getLayer("; >- protected final String TEXT_44 = ".PRINTABLE_LAYERS);" + NL + "\t\t"; >- protected final String TEXT_45 = " extLabelsLayer = new "; >- protected final String TEXT_46 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new "; >- protected final String TEXT_47 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, "; >- protected final String TEXT_48 = ".EXTERNAL_NODE_LABELS_LAYER, "; >- protected final String TEXT_49 = ".PRIMARY_LAYER);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void configureGraphicalViewer() {" + NL + "\t\tsuper.configureGraphicalViewer();" + NL + "\t\tGraphicalViewer viewer = getGraphicalViewer();" + NL + "\t\t// configure the context menu" + NL + "\t\tContextMenuProvider provider = new "; >- protected final String TEXT_50 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu("; >- protected final String TEXT_51 = ".ID + \".editor.contextmenu\", provider, getSite().getSelectionProvider()); //$NON-NLS-1$" + NL + "" + NL + "\t\tKeyHandler keyHandler = new GraphicalViewerKeyHandler(viewer);" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId()));" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));" + NL + "\t\tviewer.setKeyHandler(keyHandler);" + NL + "" + NL + "\t\tviewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class "; >- protected final String TEXT_52 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; >- protected final String TEXT_53 = "ContextMenuProvider(EditPartViewer viewer) {" + NL + "\t\t\tsuper(viewer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t public void buildContextMenu(IMenuManager menuManager) {" + NL + "\t GEFActionConstants.addStandardActionGroups(menuManager);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.UNDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.REDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.COPY.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.PASTE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.DELETE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, GEFActionConstants.DIRECT_EDIT, GEFActionConstants.GROUP_EDIT);" + NL + "" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.SAVE.getId(), GEFActionConstants.GROUP_SAVE);" + NL + "" + NL + "\t\t\tappendAlignmentSubmenu(menuManager);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendAlignmentSubmenu(IMenuManager menuManager) {" + NL + "\t\t\t// Alignment Actions" + NL + "\t\t\tMenuManager submenu = new MenuManager(\"Align\");" + NL + "\t\t\tsubmenu.add(new Separator(GEFActionConstants.MB_ADDITIONS));" + NL + "\t" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_LEFT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_CENTER, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_RIGHT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_TOP, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_MIDDLE, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_BOTTOM, GEFActionConstants.MB_ADDITIONS);" + NL + "\t" + NL + "\t\t\tif (!submenu.isEmpty()) {" + NL + "\t\t\t\tmenuManager.appendToGroup(GEFActionConstants.GROUP_REST, submenu);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendActionToMenu(IMenuManager menu, String actionId, String menuGroup) {" + NL + "\t\t\tIAction action = getActionRegistry().getAction(actionId);" + NL + "\t\t\tif (action != null && action.isEnabled()) {" + NL + "\t\t\t\tmenu.appendToGroup(menuGroup, action);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}"; >- protected final String TEXT_54 = NL; >+ protected final String TEXT_3 = " extends GraphicalEditorWithFlyoutPalette {"; >+ protected final String TEXT_4 = NL + "\t/**" + NL + "\t * This class listens to changes to the file system in the workspace, and" + NL + "\t * makes the following changes: " + NL + "\t * <ul><li>If an open, saved file gets deleted, the editor is closed.</li>" + NL + "\t * <li>If an open file gets renamed or moved, the editor's" + NL + "\t * input is changed accordingly.</li></ul>" + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ResourceTracker implements "; >+ protected final String TEXT_5 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void resourceChanged("; >+ protected final String TEXT_6 = " event) {" + NL + "\t\t\t"; >+ protected final String TEXT_7 = " delta = event.getDelta();" + NL + "\t\t\tif (delta != null) {" + NL + "\t\t\t\t"; >+ protected final String TEXT_8 = " fileDelta = delta.findMember((("; >+ protected final String TEXT_9 = ") getEditorInput()).getFile().getFullPath());" + NL + "\t\t\t\tif (fileDelta != null) {" + NL + "\t\t\t\t\tprocessFileDelta(fileDelta);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void processFileDelta("; >+ protected final String TEXT_10 = " delta) {" + NL + "\t\t\tassert (delta != null && delta.getResource().equals((("; >+ protected final String TEXT_11 = ") getEditorInput()).getFile()));" + NL + "\t\t\tif (delta.getKind() == "; >+ protected final String TEXT_12 = ".REMOVED) {" + NL + "\t\t\t\tif (("; >+ protected final String TEXT_13 = ".MOVED_TO & delta.getFlags()) == 0) {" + NL + "\t\t\t\t\t"; >+ protected final String TEXT_14 = NL + "\t\t\t\t\tif (!isDirty()) {" + NL + "\t\t\t\t\t\tcloseEditor();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// else if it was moved or renamed" + NL + "\t\t\t\t\tfinal "; >+ protected final String TEXT_15 = " newFile = "; >+ protected final String TEXT_16 = ".getWorkspace().getRoot().getFile(delta.getMovedToPath());" + NL + "\t\t\t\t\t"; >+ protected final String TEXT_17 = " display = getSite().getShell().getDisplay();" + NL + "\t\t\t\t\tdisplay.asyncExec(new Runnable() {" + NL + "\t\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t\tsetInput(new "; >+ protected final String TEXT_18 = "(newFile));" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t});" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ResourceTracker resourceTracker;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ResourceTracker getResourceTracker() {" + NL + "\t\tif (resourceTracker == null) {" + NL + "\t\t\tresourceTracker = new ResourceTracker();" + NL + "\t\t}" + NL + "\t\treturn resourceTracker;" + NL + "\t}" + NL; >+ protected final String TEXT_19 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class UpdatableActionGroup {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addAction(UpdateAction action) {" + NL + "\t\t\tassert action != null;" + NL + "\t\t\tmyActions.add(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeAction(UpdateAction action) {" + NL + "\t\t\tmyActions.remove(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void update() {" + NL + "\t\t\tfor (Iterator it = myActions.iterator(); it.hasNext();) {" + NL + "\t\t\t\tUpdateAction next = (UpdateAction) it.next();" + NL + "\t\t\t\tnext.update();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ArrayList myActions = new ArrayList();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; >+ protected final String TEXT_20 = " "; >+ protected final String TEXT_21 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; >+ protected final String TEXT_22 = " diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isDirty = false;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PaletteRoot paletteRoot;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PropertySheetPage undoablePropertySheetPage;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup stackActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener commandStackListener = new CommandStackListener() {" + NL + "" + NL + "\t\tpublic void commandStackChanged(EventObject event) {" + NL + "\t\t\tstackActions.update();" + NL + "\t\t\tsetDirty(((CommandStack) event.getSource()).isDirty());" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editPartActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener selectionListener = new ISelectionListener() {" + NL + "" + NL + "\t\tpublic void selectionChanged(IWorkbenchPart part, ISelection selection) {" + NL + "\t\t\teditPartActions.update();" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editorActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory domainAdapterFactory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void firePropertyChange(int propertyId) {" + NL + "\t\tsuper.firePropertyChange(propertyId);" + NL + "\t\teditorActions.update();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an action to this editor's <code>ActionRegistry</code>. (This is" + NL + "\t * a helper method.)" + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the action to add." + NL + "\t */" + NL + "\tprotected void addAction(IAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an editor action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * Editor actions are actions that depend and work on the editor." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the editor action" + NL + "\t */" + NL + "\tprotected void addEditorAction(WorkbenchPartAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditorActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>EditPart</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>EditPart</code> actions are actions that depend and work on the" + NL + "\t * selected <code>EditPart</code>s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>EditPart</code> action" + NL + "\t */" + NL + "\tprotected void addEditPartAction(SelectionAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditPartActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>CommandStack</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>CommandStack</code> actions are actions that depend and work on" + NL + "\t * the <code>CommandStack</code>." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>CommandStack</code> action" + NL + "\t */" + NL + "\tprotected void addStackAction(StackAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\tstackActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createActions() {" + NL + "\t\taddStackAction(new UndoAction(this));" + NL + "\t\taddStackAction(new RedoAction(this));" + NL + "" + NL + "\t\taddEditPartAction(new DeleteAction((IWorkbenchPart) this));" + NL + "\t\taddEditPartAction(new DirectEditAction((IWorkbenchPart) this));" + NL + "" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE));" + NL + "" + NL + "\t\taddEditorAction(new SaveAction(this));" + NL + "\t\taddEditorAction(new PrintAction(this));" + NL + "" + NL + "\t\tIAction zoomIn = new ZoomInAction(getZoomManager());" + NL + "\t\tIAction zoomOut = new ZoomOutAction(getZoomManager());" + NL + "\t\taddAction(zoomIn);" + NL + "\t\taddAction(zoomOut);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomIn);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomOut);" + NL + "\t}" + NL; >+ protected final String TEXT_23 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tvoid closeEditor() {" + NL + "\t\tgetSite().getShell().getDisplay().syncExec(new Runnable() {" + NL + "\t\t\tpublic void run() {" + NL + "\t\t\t\tgetSite().getPage().closeEditor("; >+ protected final String TEXT_24 = ".this, false);" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}"; >+ protected final String TEXT_25 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void dispose() {" + NL + "\t\t// remove CommandStackListener" + NL + "\t\tgetCommandStack().removeCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// remove selection listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(getSelectionListener());" + NL + "" + NL + "\t\t// dispose the ActionRegistry (will dispose all actions)" + NL + "\t\tgetActionRegistry().dispose();" + NL + "" + NL + "\t\t// important: always call super implementation of dispose" + NL + "\t\tsuper.dispose();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSave(IProgressMonitor monitor) {" + NL + "\t\ttry {" + NL + "\t\t\tsave(monitor);" + NL + "\t\t\tgetCommandStack().markSaveLocation();" + NL + "\t\t} catch (CoreException e) {" + NL + "\t\t\tErrorDialog.openError(getSite().getShell(), \"Error During Save\", \"The current "; >+ protected final String TEXT_26 = " model could not be saved.\", e.getStatus());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void save(IProgressMonitor progressMonitor) throws CoreException {" + NL + "\t\tif (progressMonitor == null) {" + NL + "\t\t\tprogressMonitor = new NullProgressMonitor();" + NL + "\t\t}" + NL + "\t\tprogressMonitor.beginTask(\"Saving\", getEditingDomain().getResourceSet().getResources().size());" + NL + "\t\ttry {" + NL + "\t\t\tfor(Iterator it = getEditingDomain().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tResource next = (Resource)it.next();" + NL + "\t\t\t\tnext.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\tprogressMonitor.worked(1);" + NL + "\t\t\t}" + NL + "\t\t} catch (IOException e) {" + NL + "\t\t\tIStatus status = new Status(IStatus.ERROR, "; >+ protected final String TEXT_27 = ".ID, 0, \"Error writing file.\", e);" + NL + "\t\t\tthrow new CoreException(status);" + NL + "\t\t} finally {" + NL + "\t\t\tprogressMonitor.done();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\t// TODO: should be allowed." + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\t// TODO: Implement." + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == IPropertySheetPage.class) {" + NL + "\t\t\treturn getPropertySheetPage();" + NL + "\t\t} else if (type == IContentOutlinePage.class) {" + NL + "\t\t\treturn getOutlinePage();" + NL + "\t\t} else if (type == ZoomManager.class) {" + NL + "\t\t\treturn getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ZoomManager getZoomManager() {" + NL + "\t\treturn getZoomManager(getGraphicalViewer());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ZoomManager getZoomManager(GraphicalViewer viewer) {" + NL + "\t\t// get zoom manager from root edit part" + NL + "\t\tRootEditPart rootEditPart = viewer.getRootEditPart();" + NL + "\t\tZoomManager zoomManager = null;" + NL + "\t\tif (rootEditPart instanceof ScalableFreeformRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableFreeformRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t} else if (rootEditPart instanceof ScalableRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn zoomManager;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener getStackActionsListener() {" + NL + "\t\treturn commandStackListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IContentOutlinePage getOutlinePage() {" + NL + "\t\t//TODO: outline page missing" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot getPaletteRoot() {" + NL + "\t\tif (paletteRoot == null) {" + NL + "\t\t\tpaletteRoot = new PaletteRoot();"; >+ protected final String TEXT_28 = NL + "\t\t\tnew "; >+ protected final String TEXT_29 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);"; >+ protected final String TEXT_30 = NL + "\t\t}" + NL + "\t\treturn paletteRoot;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PropertySheetPage getPropertySheetPage() {" + NL + "\t\tif (undoablePropertySheetPage == null) {" + NL + "\t\t\tundoablePropertySheetPage = new PropertySheetPage();" + NL + "\t\t\t"; >+ protected final String TEXT_31 = " rootEntry = new "; >+ protected final String TEXT_32 = "(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new "; >+ protected final String TEXT_33 = "(getDomainAdapterFactory()));" + NL + "\t\t\tundoablePropertySheetPage.setRootEntry(rootEntry);" + NL + "\t\t}" + NL + "" + NL + "\t\treturn undoablePropertySheetPage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener getSelectionListener() {" + NL + "\t\treturn selectionListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >+ protected final String TEXT_34 = " get"; >+ protected final String TEXT_35 = "() {" + NL + "\t\treturn "; >+ protected final String TEXT_36 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Diagram getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IEditorSite site, IEditorInput input) throws PartInitException {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tif (file == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "\t\tsetSite(site);" + NL + "\t\tsetInput(input);" + NL + "\t\tsetEditDomain(new DefaultEditDomain(this));" + NL + "" + NL + "\t\t// validate" + NL + "\t\tif (get"; >+ protected final String TEXT_37 = "() == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "" + NL + "\t\t// add CommandStackListener" + NL + "\t\tgetCommandStack().addCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// add selection change listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().addSelectionListener(getSelectionListener());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setInput(IEditorInput input) {"; >+ protected final String TEXT_38 = NL + "\t\tif (getEditorInput() instanceof "; >+ protected final String TEXT_39 = ") {" + NL + "\t\t\t"; >+ protected final String TEXT_40 = " resource = (("; >+ protected final String TEXT_41 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().removeResourceChangeListener(getResourceTracker());" + NL + "\t\t}"; >+ protected final String TEXT_42 = NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsuper.setInput(input);"; >+ protected final String TEXT_43 = NL + "\t\tif (getEditorInput() instanceof "; >+ protected final String TEXT_44 = ") {" + NL + "\t\t\t"; >+ protected final String TEXT_45 = " resource = (("; >+ protected final String TEXT_46 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().addResourceChangeListener(getResourceTracker());" + NL + "\t\t}"; >+ protected final String TEXT_47 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {"; >+ protected final String TEXT_48 = NL + "\t\tif (input instanceof "; >+ protected final String TEXT_49 = ") {" + NL + "\t\t\treturn (("; >+ protected final String TEXT_50 = ") input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof "; >+ protected final String TEXT_51 = ") {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}"; >+ protected final String TEXT_52 = NL + "\t\tif (input instanceof "; >+ protected final String TEXT_53 = ") {" + NL + "\t\t\treturn URI.createPlatformResourceURI(((IFileEditorInput)input).getFile().getFullPath().toString());" + NL + "\t\t}"; >+ protected final String TEXT_54 = NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isDirty() {" + NL + "\t\treturn isDirty;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setDirty(boolean dirty) {" + NL + "\t\tif (isDirty != dirty) {" + NL + "\t\t\tisDirty = dirty;" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\tBasicCommandStack commandStack = new BasicCommandStack();" + NL + "\t\t\teditingDomain = new AdapterFactoryEditingDomain(getDomainAdapterFactory(), commandStack, new HashMap());" + NL + "\t\t\teditingDomain.getResourceSet().eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(editingDomain));" + NL + "\t\t}" + NL + "\t\treturn editingDomain;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate AdapterFactory getDomainAdapterFactory() {" + NL + "\t\tif (domainAdapterFactory == null) {" + NL + "\t\t\tList factories = new ArrayList();" + NL + "\t\t\tfactories.add(new ResourceItemProviderAdapterFactory());"; >+ protected final String TEXT_55 = NL + "\t\t\tfactories.add(new "; >+ protected final String TEXT_56 = "());"; >+ protected final String TEXT_57 = NL + "\t\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t\t\tfactories.add(new NotationItemProviderAdapterFactory());" + NL + "\t\t\tdomainAdapterFactory = new ComposedAdapterFactory(factories);" + NL + "\t\t}" + NL + "\t\treturn domainAdapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void load(URI diagramFile) {" + NL + "\t\t"; >+ protected final String TEXT_58 = " = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tEditingDomain editingDomain = getEditingDomain();" + NL + "\t\tResourceSet resourceSet = editingDomain.getResourceSet();" + NL + "\t\tResource diagramResource = resourceSet.getResource(diagramFile, true);" + NL + "\t\tif (diagramResource == null) {" + NL + "\t\t\tdiagramResource = resourceSet.createResource(diagramFile);" + NL + "\t\t}" + NL + "\t\tdiagram = (Diagram) findInResource(diagramResource, Diagram.class);" + NL + "\t\tif (diagram == null) {" + NL + "\t\t\tdiagram = NotationFactory.eINSTANCE.createDiagram();" + NL + "\t\t\tdiagramResource.getContents().add(0, diagram);" + NL + "\t\t\t//Auxiliary creation should not be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; >+ protected final String TEXT_59 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t"; >+ protected final String TEXT_60 = " = ("; >+ protected final String TEXT_61 = ") diagram.getElement();" + NL + "\t\tif ("; >+ protected final String TEXT_62 = " == null) {"; >+ protected final String TEXT_63 = NL + "\t\t\tURI modelFile = "; >+ protected final String TEXT_64 = ".getModelFileURI(diagramFile);" + NL + "\t\t\tResource modelResource = resourceSet.getResource(modelFile, true);" + NL + "\t\t\tif (modelResource == null) {" + NL + "\t\t\t\tmodelResource = resourceSet.createResource(modelFile);" + NL + "\t\t\t}"; >+ protected final String TEXT_65 = NL + "\t\t\t"; >+ protected final String TEXT_66 = " = ("; >+ protected final String TEXT_67 = ") findInResource("; >+ protected final String TEXT_68 = ", "; >+ protected final String TEXT_69 = ".class);" + NL + "\t\t\tif ("; >+ protected final String TEXT_70 = " == null) {" + NL + "\t\t\t\t"; >+ protected final String TEXT_71 = " = "; >+ protected final String TEXT_72 = ".eINSTANCE.create"; >+ protected final String TEXT_73 = "();" + NL + "\t\t\t\t"; >+ protected final String TEXT_74 = ".getContents().add(0, "; >+ protected final String TEXT_75 = ");" + NL + "\t\t\t\t//We don't want this auxiliary creation to be undoable." + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\t"; >+ protected final String TEXT_76 = ".save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t} catch (IOException e) {" + NL + "\t\t\t\t\tdiagram = null;" + NL + "\t\t\t\t\t"; >+ protected final String TEXT_77 = " = null;" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tif (!diagram.isSetElement()) {" + NL + "\t\t\t\tdiagram.setElement("; >+ protected final String TEXT_78 = ");" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}"; >+ protected final String TEXT_79 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Object findInResource(Resource resource, Class expectedClass) {" + NL + "\t\tfor(Iterator it = resource.getContents().iterator(); it.hasNext(); ) {" + NL + "\t\t\tObject next = it.next();" + NL + "\t\t\tif (expectedClass.isInstance(next)) {" + NL + "\t\t\t\treturn next;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFocus() {" + NL + "\t\tgetGraphicalViewer().getControl().setFocus();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final void createPartControl(Composite parent) {" + NL + "\t\tsuper.createPartControl(parent);" + NL + "\t\t// initialize actions" + NL + "\t\tcreateActions();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createGraphicalViewer(Composite parent) {" + NL + "\t\tsuper.createGraphicalViewer(parent);" + NL + "\t\t// initialize the viewer with input" + NL + "\t\tScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();" + NL + "\t\tgetGraphicalViewer().setRootEditPart(root);" + NL + "\t\tgetGraphicalViewer().setEditPartFactory(new "; >+ protected final String TEXT_80 = "());" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + NL + "" + NL + "\t\t"; >+ protected final String TEXT_81 = " printableLayers = ("; >+ protected final String TEXT_82 = ") root.getLayer("; >+ protected final String TEXT_83 = ".PRINTABLE_LAYERS);" + NL + "\t\t"; >+ protected final String TEXT_84 = " extLabelsLayer = new "; >+ protected final String TEXT_85 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new "; >+ protected final String TEXT_86 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, "; >+ protected final String TEXT_87 = ".EXTERNAL_NODE_LABELS_LAYER, "; >+ protected final String TEXT_88 = ".PRIMARY_LAYER);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void configureGraphicalViewer() {" + NL + "\t\tsuper.configureGraphicalViewer();" + NL + "\t\tGraphicalViewer viewer = getGraphicalViewer();" + NL + "\t\t// configure the context menu" + NL + "\t\tContextMenuProvider provider = new "; >+ protected final String TEXT_89 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu("; >+ protected final String TEXT_90 = ".ID + \".editor.contextmenu\", provider, getSite().getSelectionProvider()); //$NON-NLS-1$" + NL + "" + NL + "\t\tKeyHandler keyHandler = new GraphicalViewerKeyHandler(viewer);" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId()));" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));" + NL + "\t\tviewer.setKeyHandler(keyHandler);" + NL + "" + NL + "\t\tviewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class "; >+ protected final String TEXT_91 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; >+ protected final String TEXT_92 = "ContextMenuProvider(EditPartViewer viewer) {" + NL + "\t\t\tsuper(viewer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t public void buildContextMenu(IMenuManager menuManager) {" + NL + "\t GEFActionConstants.addStandardActionGroups(menuManager);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.UNDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.REDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.COPY.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.PASTE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.DELETE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, GEFActionConstants.DIRECT_EDIT, GEFActionConstants.GROUP_EDIT);" + NL + "" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.SAVE.getId(), GEFActionConstants.GROUP_SAVE);" + NL + "" + NL + "\t\t\tappendAlignmentSubmenu(menuManager);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendAlignmentSubmenu(IMenuManager menuManager) {" + NL + "\t\t\t// Alignment Actions" + NL + "\t\t\tMenuManager submenu = new MenuManager(\"Align\");" + NL + "\t\t\tsubmenu.add(new Separator(GEFActionConstants.MB_ADDITIONS));" + NL + "\t" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_LEFT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_CENTER, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_RIGHT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_TOP, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_MIDDLE, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_BOTTOM, GEFActionConstants.MB_ADDITIONS);" + NL + "\t" + NL + "\t\t\tif (!submenu.isEmpty()) {" + NL + "\t\t\t\tmenuManager.appendToGroup(GEFActionConstants.GROUP_REST, submenu);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendActionToMenu(IMenuManager menu, String actionId, String menuGroup) {" + NL + "\t\t\tIAction action = getActionRegistry().getAction(actionId);" + NL + "\t\t\tif (action != null && action.isEnabled()) {" + NL + "\t\t\t\tmenu.appendToGroup(menuGroup, action);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}"; >+ protected final String TEXT_93 = NL; > > public String generate(Object argument) > { >@@ -79,6 +118,7 @@ > final GenEditorView genEditor = (GenEditorView) ((Object[]) argument)[0]; > final GenDiagram genDiagram = genEditor.getEditorGen().getDiagram(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer); >@@ -99,7 +139,6 @@ > importManager.addImport("org.eclipse.core.runtime.Status"); > importManager.addImport("org.eclipse.draw2d.PositionConstants"); > importManager.addImport("org.eclipse.emf.common.command.BasicCommandStack"); >-importManager.addImport("org.eclipse.emf.common.ui.URIEditorInput"); > importManager.addImport("org.eclipse.emf.common.util.URI"); > importManager.addImport("org.eclipse.emf.ecore.resource.Resource"); > importManager.addImport("org.eclipse.emf.ecore.resource.ResourceSet"); >@@ -151,7 +190,6 @@ > importManager.addImport("org.eclipse.ui.IEditorPart"); > importManager.addImport("org.eclipse.ui.IEditorInput"); > importManager.addImport("org.eclipse.ui.IEditorSite"); >-importManager.addImport("org.eclipse.ui.IPathEditorInput"); > importManager.addImport("org.eclipse.ui.ISelectionListener"); > importManager.addImport("org.eclipse.ui.IWorkbenchPart"); > importManager.addImport("org.eclipse.ui.PartInitException"); >@@ -166,57 +204,151 @@ > stringBuffer.append(TEXT_2); > stringBuffer.append(genEditor.getClassName()); > stringBuffer.append(TEXT_3); >- stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >+ >+if (!isRichClientPlatform) { >+ > stringBuffer.append(TEXT_4); >- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceChangeListener")); > stringBuffer.append(TEXT_5); >- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceChangeEvent")); > stringBuffer.append(TEXT_6); >- stringBuffer.append(genDiagram.getEditorGen().getDomainGenModel().getModelName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); > stringBuffer.append(TEXT_7); >- stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); > stringBuffer.append(TEXT_8); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_9); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); >+ stringBuffer.append(TEXT_10); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_11); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); >+ stringBuffer.append(TEXT_12); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); >+ stringBuffer.append(TEXT_13); >+ /*XXX: make sure unsaved deleted file is handled correctly*/ >+ stringBuffer.append(TEXT_14); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); >+ stringBuffer.append(TEXT_15); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")); >+ stringBuffer.append(TEXT_16); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Display")); >+ stringBuffer.append(TEXT_17); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.FileEditorInput")); >+ stringBuffer.append(TEXT_18); >+ >+} >+ >+ stringBuffer.append(TEXT_19); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >+ stringBuffer.append(TEXT_20); >+ stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >+ stringBuffer.append(TEXT_21); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); >+ stringBuffer.append(TEXT_22); >+ >+if (!isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_23); >+ stringBuffer.append(genEditor.getClassName()); >+ stringBuffer.append(TEXT_24); >+ >+} >+ >+ stringBuffer.append(TEXT_25); >+ stringBuffer.append(genDiagram.getEditorGen().getDomainGenModel().getModelName()); >+ stringBuffer.append(TEXT_26); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); >+ stringBuffer.append(TEXT_27); > > { > final Palette palette = genDiagram.getPalette(); > if (palette != null) { > >- stringBuffer.append(TEXT_9); >+ stringBuffer.append(TEXT_28); > stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); >- stringBuffer.append(TEXT_10); >+ stringBuffer.append(TEXT_29); > > } > } > >- stringBuffer.append(TEXT_11); >+ stringBuffer.append(TEXT_30); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); >- stringBuffer.append(TEXT_12); >+ stringBuffer.append(TEXT_31); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); >- stringBuffer.append(TEXT_13); >+ stringBuffer.append(TEXT_32); > stringBuffer.append(importManager.getImportedName(genDiagram.getPropertyProviderQualifiedClassName())); >- stringBuffer.append(TEXT_14); >+ stringBuffer.append(TEXT_33); > stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >- stringBuffer.append(TEXT_15); >+ stringBuffer.append(TEXT_34); > stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); >- stringBuffer.append(TEXT_16); >+ stringBuffer.append(TEXT_35); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_17); >+ stringBuffer.append(TEXT_36); > stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); >- stringBuffer.append(TEXT_18); >+ stringBuffer.append(TEXT_37); >+ >+if (!isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_38); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_39); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); >+ stringBuffer.append(TEXT_40); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_41); >+ >+} >+ >+ stringBuffer.append(TEXT_42); >+ >+if (!isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_43); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_44); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); >+ stringBuffer.append(TEXT_45); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_46); >+ >+} >+ >+ stringBuffer.append(TEXT_47); >+ if (isRichClientPlatform) { >+ stringBuffer.append(TEXT_48); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); >+ stringBuffer.append(TEXT_49); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); >+ stringBuffer.append(TEXT_50); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPathEditorInput")); >+ stringBuffer.append(TEXT_51); >+ } else { >+ stringBuffer.append(TEXT_52); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); >+ stringBuffer.append(TEXT_53); >+ } >+ stringBuffer.append(TEXT_54); > > final EList genPackages = genDiagram.getEditorGen().getAllDomainGenPackages(true); > for (int i = 0; i < genPackages.size(); i++) { > GenPackage genPackage = (GenPackage) genPackages.get(i); > >- stringBuffer.append(TEXT_19); >+ stringBuffer.append(TEXT_55); > stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedItemProviderAdapterFactoryClassName())); >- stringBuffer.append(TEXT_20); >+ stringBuffer.append(TEXT_56); > } >- stringBuffer.append(TEXT_21); >+ stringBuffer.append(TEXT_57); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_22); >+ stringBuffer.append(TEXT_58); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_23); >+ stringBuffer.append(TEXT_59); >+ stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >+ stringBuffer.append(TEXT_60); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >+ stringBuffer.append(TEXT_61); >+ stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >+ stringBuffer.append(TEXT_62); > > { > >@@ -225,74 +357,74 @@ > String resourceToUse; > if (!sameFile) { > >- stringBuffer.append(TEXT_24); >+ stringBuffer.append(TEXT_63); > stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); >- stringBuffer.append(TEXT_25); >+ stringBuffer.append(TEXT_64); > > resourceToUse = "modelResource"; > } else { > resourceToUse = "diagramResource"; > } > >- stringBuffer.append(TEXT_26); >+ stringBuffer.append(TEXT_65); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_27); >+ stringBuffer.append(TEXT_66); > stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >- stringBuffer.append(TEXT_28); >+ stringBuffer.append(TEXT_67); > stringBuffer.append(resourceToUse); >- stringBuffer.append(TEXT_29); >+ stringBuffer.append(TEXT_68); > stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >- stringBuffer.append(TEXT_30); >+ stringBuffer.append(TEXT_69); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_31); >+ stringBuffer.append(TEXT_70); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_32); >+ stringBuffer.append(TEXT_71); > stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); >- stringBuffer.append(TEXT_33); >+ stringBuffer.append(TEXT_72); > stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); >- stringBuffer.append(TEXT_34); >+ stringBuffer.append(TEXT_73); > stringBuffer.append(resourceToUse); >- stringBuffer.append(TEXT_35); >+ stringBuffer.append(TEXT_74); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_36); >+ stringBuffer.append(TEXT_75); > stringBuffer.append(resourceToUse); >- stringBuffer.append(TEXT_37); >+ stringBuffer.append(TEXT_76); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_38); >+ stringBuffer.append(TEXT_77); > stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); >- stringBuffer.append(TEXT_39); >+ stringBuffer.append(TEXT_78); > > } > >- stringBuffer.append(TEXT_40); >+ stringBuffer.append(TEXT_79); > stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); >- stringBuffer.append(TEXT_41); >+ stringBuffer.append(TEXT_80); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); >- stringBuffer.append(TEXT_42); >+ stringBuffer.append(TEXT_81); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); >- stringBuffer.append(TEXT_43); >+ stringBuffer.append(TEXT_82); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); >- stringBuffer.append(TEXT_44); >+ stringBuffer.append(TEXT_83); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); >- stringBuffer.append(TEXT_45); >+ stringBuffer.append(TEXT_84); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); >- stringBuffer.append(TEXT_46); >+ stringBuffer.append(TEXT_85); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.DelegatingLayout")); >- stringBuffer.append(TEXT_47); >+ stringBuffer.append(TEXT_86); > stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); >- stringBuffer.append(TEXT_48); >+ stringBuffer.append(TEXT_87); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); >- stringBuffer.append(TEXT_49); >+ stringBuffer.append(TEXT_88); > stringBuffer.append(genEditor.getClassName()); >- stringBuffer.append(TEXT_50); >+ stringBuffer.append(TEXT_89); > stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); >- stringBuffer.append(TEXT_51); >+ stringBuffer.append(TEXT_90); > stringBuffer.append(genEditor.getClassName()); >- stringBuffer.append(TEXT_52); >+ stringBuffer.append(TEXT_91); > stringBuffer.append(genEditor.getClassName()); >- stringBuffer.append(TEXT_53); >+ stringBuffer.append(TEXT_92); > importManager.emitSortedImports(); >- stringBuffer.append(TEXT_54); >+ stringBuffer.append(TEXT_93); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginXML.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginXML.java,v >retrieving revision 1.1 >diff -u -r1.1 PluginXML.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginXML.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginXML.java 19 Apr 2006 10:45:49 -0000 >@@ -22,13 +22,40 @@ > protected final String TEXT_5 = "\"" + NL + " extensions=\""; > protected final String TEXT_6 = "\"" + NL + " default=\"true\"" + NL + " class=\""; > protected final String TEXT_7 = "\"" + NL + " contributorClass=\""; >- protected final String TEXT_8 = "\">" + NL + " </editor>" + NL + " </extension>" + NL + "" + NL + " <extension point=\"org.eclipse.ui.newWizards\">" + NL + " \t <wizard" + NL + " \t name=\""; >- protected final String TEXT_9 = " Diagram\"" + NL + " \t icon=\""; >- protected final String TEXT_10 = "\"" + NL + " \t category=\"org.eclipse.ui.Examples\"" + NL + " \t class=\""; >- protected final String TEXT_11 = "\"" + NL + " \t id=\""; >- protected final String TEXT_12 = "ID\">" + NL + " \t \t <description>" + NL + " \t \t\tCreates "; >- protected final String TEXT_13 = " diagram." + NL + " \t \t </description> " + NL + " </wizard>" + NL + " </extension>" + NL + "" + NL + "</plugin>"; >- protected final String TEXT_14 = NL; >+ protected final String TEXT_8 = "\">" + NL + " </editor>" + NL + " </extension>" + NL; >+ protected final String TEXT_9 = NL + " <extension" + NL + " point=\"org.eclipse.core.runtime.applications\"" + NL + " id=\""; >+ protected final String TEXT_10 = "DiagramApplication\">" + NL + " <application>" + NL + " <run" + NL + " class=\""; >+ protected final String TEXT_11 = "$Application\">" + NL + " </run>" + NL + " </application>" + NL + " </extension>" + NL + "" + NL + " <extension" + NL + " point=\"org.eclipse.ui.perspectives\">" + NL + " <perspective" + NL + " name=\"%_UI_Perspective_label\"" + NL + " class=\""; >+ protected final String TEXT_12 = "$Perspective\"" + NL + " id=\""; >+ protected final String TEXT_13 = ".Perspective\">" + NL + " </perspective>" + NL + " </extension>"; >+ protected final String TEXT_14 = NL + " <extension" + NL + " point=\"org.eclipse.ui.commands\">" + NL + " <command" + NL + " name=\"%_UI_Menu_OpenURI_label\"" + NL + " description=\"%_UI_Menu_OpenURI_description\"" + NL + " categoryId=\"org.eclipse.ui.category.file\"" + NL + " id=\""; >+ protected final String TEXT_15 = "OpenURICommand\" /> " + NL + " <command" + NL + " name=\"%_UI_Menu_Open_label\"" + NL + " description=\"%_UI_Menu_Open_description\"" + NL + " categoryId=\"org.eclipse.ui.category.file\"" + NL + " id=\""; >+ protected final String TEXT_16 = "OpenCommand\" /> " + NL + " </extension> " + NL + "" + NL + " <extension" + NL + " point=\"org.eclipse.ui.bindings\">" + NL + " <key" + NL + " commandId=\""; >+ protected final String TEXT_17 = "OpenURICommand\"" + NL + " sequence=\"M1+U\"" + NL + " schemeId=\"org.eclipse.ui.defaultAcceleratorConfiguration\" />" + NL + " <key" + NL + " commandId=\""; >+ protected final String TEXT_18 = "OpenCommand\"" + NL + " sequence=\"M1+O\"" + NL + " schemeId=\"org.eclipse.ui.defaultAcceleratorConfiguration\" />" + NL + " </extension>" + NL + " <extension" + NL + " point=\"org.eclipse.ui.actionSets\">" + NL + " <actionSet" + NL + " label=\"%_UI_"; >+ protected final String TEXT_19 = "_ActionSet_label\"" + NL + " visible=\"true\"" + NL + " id=\""; >+ protected final String TEXT_20 = "ActionSet\">"; >+ protected final String TEXT_21 = NL + " <action" + NL + " label=\"%_UI_Menu_About_label\"" + NL + " class=\""; >+ protected final String TEXT_22 = "$AboutAction\"" + NL + " menubarPath=\"help/additions\"" + NL + " id=\""; >+ protected final String TEXT_23 = "AboutAction\">" + NL + " </action>"; >+ protected final String TEXT_24 = NL + " <action" + NL + " label=\"%_UI_Menu_OpenURI_label\"" + NL + " definitionId=\""; >+ protected final String TEXT_25 = "OpenURICommand\"" + NL + " class=\""; >+ protected final String TEXT_26 = "$OpenURIAction\"" + NL + " menubarPath=\"file/additions\"" + NL + " id=\""; >+ protected final String TEXT_27 = "OpenURIAction\">" + NL + " </action>" + NL + " <action" + NL + " label=\"%_UI_Menu_Open_label\"" + NL + " definitionId=\""; >+ protected final String TEXT_28 = "OpenCommand\"" + NL + " class=\""; >+ protected final String TEXT_29 = "$OpenDiagramAction\"" + NL + " menubarPath=\"file/additions\"" + NL + " id=\""; >+ protected final String TEXT_30 = "OpenDiagramAction\">" + NL + " </action>" + NL + " <action" + NL + " label=\"%_UI_"; >+ protected final String TEXT_31 = "NewDiagramCommand\"" + NL + " class=\""; >+ protected final String TEXT_32 = "$NewDiagramAction\"" + NL + " menubarPath=\"file/new/additions\"" + NL + " id=\""; >+ protected final String TEXT_33 = "NewAction\">" + NL + " </action>" + NL + " </actionSet> " + NL + " </extension>"; >+ protected final String TEXT_34 = NL + " <extension point=\"org.eclipse.ui.newWizards\">" + NL + " \t <wizard" + NL + " \t name=\""; >+ protected final String TEXT_35 = " Diagram\"" + NL + " \t icon=\""; >+ protected final String TEXT_36 = "\"" + NL + " \t category=\"org.eclipse.ui.Examples\"" + NL + " \t class=\""; >+ protected final String TEXT_37 = "\"" + NL + " \t id=\""; >+ protected final String TEXT_38 = "ID\">" + NL + " \t \t <description>" + NL + " \t \t\tCreates "; >+ protected final String TEXT_39 = " diagram." + NL + " \t \t </description> " + NL + " </wizard>" + NL + " </extension>" + NL; >+ protected final String TEXT_40 = NL + "</plugin>"; >+ protected final String TEXT_41 = NL; > > public String generate(Object argument) > { >@@ -38,6 +65,7 @@ > final GenEditorGenerator editorGen = genPlugin.getEditorGen(); > final GenDiagram genDiagram = editorGen.getDiagram(); > final GenModel genModel = editorGen.getDomainGenModel(); >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > stringBuffer.append(TEXT_1); > stringBuffer.append(editorGen.getDiagramFileExtension()); >@@ -54,17 +82,85 @@ > stringBuffer.append(TEXT_7); > stringBuffer.append(editorGen.getEditor().getActionBarContributorQualifiedClassName()); > stringBuffer.append(TEXT_8); >- stringBuffer.append(genModel.getModelName()); >+ >+if (isRichClientPlatform) { >+ final boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+ > stringBuffer.append(TEXT_9); >- stringBuffer.append(genDiagram.getCreationWizardIconPath()); >+ stringBuffer.append(genModel.getModelName()); > stringBuffer.append(TEXT_10); >- stringBuffer.append(genDiagram.getCreationWizardQualifiedClassName()); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); > stringBuffer.append(TEXT_11); >- stringBuffer.append(genDiagram.getCreationWizardQualifiedClassName()); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); > stringBuffer.append(TEXT_12); >- stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(genPlugin.getID()); > stringBuffer.append(TEXT_13); >+ >+ } >+ > stringBuffer.append(TEXT_14); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_15); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_16); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_17); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_18); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_19); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_20); >+ >+ if (shouldGenerateApplication) { >+ >+ stringBuffer.append(TEXT_21); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_22); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_23); >+ >+ } >+ >+ stringBuffer.append(TEXT_24); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_25); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_26); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_27); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_28); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_29); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_30); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_31); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_32); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_33); >+ >+} else { >+ >+ stringBuffer.append(TEXT_34); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_35); >+ stringBuffer.append(genDiagram.getCreationWizardIconPath()); >+ stringBuffer.append(TEXT_36); >+ stringBuffer.append(genDiagram.getCreationWizardQualifiedClassName()); >+ stringBuffer.append(TEXT_37); >+ stringBuffer.append(genDiagram.getCreationWizardQualifiedClassName()); >+ stringBuffer.append(TEXT_38); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_39); >+ >+} >+ >+ stringBuffer.append(TEXT_40); >+ stringBuffer.append(TEXT_41); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 CreationWizardGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -19,14 +19,28 @@ > protected final String TEXT_1 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; > protected final String TEXT_2 = " extends "; > protected final String TEXT_3 = " implements "; >- protected final String TEXT_4 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private "; >- protected final String TEXT_5 = " diagramFileURI;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private "; >- protected final String TEXT_6 = " page;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {" + NL + "\t\tsuper.addPages();" + NL + "\t\tif (page == null) {" + NL + "\t\t\tpage = new "; >- protected final String TEXT_7 = "();" + NL + "\t\t}" + NL + "\t\taddPage(page);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IWorkbench workbench, IStructuredSelection selection) {" + NL + "\t\tsetWindowTitle(\"New "; >- protected final String TEXT_8 = " Diagram\"); //$NON-NLS-1$" + NL + "\t\tsetDefaultPageImageDescriptor("; >- protected final String TEXT_9 = ".getBundledImageDescriptor(" + NL + "\t\t\t\"icons/full/wizban/New"; >- protected final String TEXT_10 = ".gif\")); //$NON-NLS-1$" + NL + "\t\tsetNeedsProgressMonitor(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tboolean retVal = page.finish();" + NL + "\t\tdiagramFileURI = page.getCreatedDiagramFileURI();" + NL + "\t\treturn retVal;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * returns the diagram file " + NL + "\t * @return URI the diagram file" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final URI getDiagramFileURI() {" + NL + "\t\treturn diagramFileURI;" + NL + "\t}" + NL + "}"; >- protected final String TEXT_11 = NL; >+ protected final String TEXT_4 = " {"; >+ protected final String TEXT_5 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private "; >+ protected final String TEXT_6 = " diagramFileURI;"; >+ protected final String TEXT_7 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private "; >+ protected final String TEXT_8 = " diagramFile;"; >+ protected final String TEXT_9 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t private "; >+ protected final String TEXT_10 = " page;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addPages() {" + NL + "\t\tsuper.addPages();" + NL + "\t\tif (page == null) {" + NL + "\t\t\tpage = new "; >+ protected final String TEXT_11 = "("; >+ protected final String TEXT_12 = "getSelection()"; >+ protected final String TEXT_13 = ");" + NL + "\t\t}" + NL + "\t\taddPage(page);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IWorkbench workbench, IStructuredSelection selection) {"; >+ protected final String TEXT_14 = NL + "\t\tsuper.init(workbench, selection);"; >+ protected final String TEXT_15 = NL + "\t\tsetWindowTitle(\"New "; >+ protected final String TEXT_16 = " Diagram\"); //$NON-NLS-1$" + NL + "\t\tsetDefaultPageImageDescriptor("; >+ protected final String TEXT_17 = ".getBundledImageDescriptor(" + NL + "\t\t\t\"icons/full/wizban/New"; >+ protected final String TEXT_18 = ".gif\")); //$NON-NLS-1$" + NL + "\t\tsetNeedsProgressMonitor(true);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean performFinish() {" + NL + "\t\tboolean retVal = page.finish();"; >+ protected final String TEXT_19 = NL + "\t\tdiagramFileURI = page.getCreatedDiagramFileURI();"; >+ protected final String TEXT_20 = NL + "\t\tdiagramFile = page.getCreatedDiagramFile();"; >+ protected final String TEXT_21 = NL + "\t\treturn retVal;" + NL + "\t}" + NL; >+ protected final String TEXT_22 = NL + "\t/**" + NL + "\t * returns the diagram file " + NL + "\t * @return URI the diagram file" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final URI getDiagramFileURI() {" + NL + "\t\treturn diagramFileURI;" + NL + "\t}"; >+ protected final String TEXT_23 = NL + "\t/**" + NL + "\t * returns the diagram file " + NL + "\t * @return IFile the diagram file" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final IFile getDiagramFile() {" + NL + "\t\treturn diagramFile;" + NL + "\t}"; >+ protected final String TEXT_24 = NL + "}"; >+ protected final String TEXT_25 = NL; > > public String generate(Object argument) > { >@@ -35,6 +49,7 @@ > final GenDiagram genDiagram = (GenDiagram) ((Object[]) argument)[0]; > final GenModel genModel = genDiagram.getEditorGen().getDomainGenModel(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer); >@@ -45,24 +60,74 @@ > stringBuffer.append(TEXT_1); > stringBuffer.append(genDiagram.getCreationWizardClassName()); > stringBuffer.append(TEXT_2); >- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.Wizard")); >+ stringBuffer.append(importManager.getImportedName(isRichClientPlatform ? "org.eclipse.jface.wizard.Wizard" : "org.eclipse.ui.wizards.newresource.BasicNewResourceWizard")); > stringBuffer.append(TEXT_3); > stringBuffer.append(importManager.getImportedName("org.eclipse.ui.INewWizard")); > stringBuffer.append(TEXT_4); >- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_5); >- stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.util.URI")); > stringBuffer.append(TEXT_6); >- stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())); >+ >+} else { >+ > stringBuffer.append(TEXT_7); >- stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); > stringBuffer.append(TEXT_8); >- stringBuffer.append(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()); >+ >+} >+ > stringBuffer.append(TEXT_9); >- stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())); > stringBuffer.append(TEXT_10); >- importManager.emitSortedImports(); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getCreationWizardPageQualifiedClassName())); > stringBuffer.append(TEXT_11); >+ if(!isRichClientPlatform) { >+ stringBuffer.append(TEXT_12); >+ } >+ stringBuffer.append(TEXT_13); >+ >+if (!isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_14); >+ >+} >+ >+ stringBuffer.append(TEXT_15); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_16); >+ stringBuffer.append(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()); >+ stringBuffer.append(TEXT_17); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_18); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_19); >+ >+} else { >+ >+ stringBuffer.append(TEXT_20); >+ >+} >+ >+ stringBuffer.append(TEXT_21); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_22); >+ >+} else { >+ >+ stringBuffer.append(TEXT_23); >+ >+} >+ >+ stringBuffer.append(TEXT_24); >+ importManager.emitSortedImports(); >+ stringBuffer.append(TEXT_25); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardPageGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardPageGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 CreationWizardPageGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardPageGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/CreationWizardPageGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -17,50 +17,100 @@ > protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; > protected final String TEXT_1 = NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; > protected final String TEXT_2 = " extends "; >- protected final String TEXT_3 = " {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Text fileField;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI createdDiagramFileURI;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >- protected final String TEXT_4 = "() {" + NL + "\t\tsuper(\"CreationWizardPage\"); //$NON-NLS-1$" + NL + "\t\tsetTitle(\"Create "; >- protected final String TEXT_5 = " Diagram\"); //$NON-NLS-1$" + NL + "\t\tsetDescription(\"Create a new "; >- protected final String TEXT_6 = " diagram.\"); //$NON-NLS-1$" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent)" + NL + "\t{" + NL + "\t\tComposite composite = new Composite(parent, SWT.NONE);" + NL + "\t\t{" + NL + "\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\tlayout.numColumns = 1;" + NL + "\t\t\tlayout.verticalSpacing = 12;" + NL + "\t\t\tcomposite.setLayout(layout);" + NL + "" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.verticalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessVerticalSpace = true;" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tcomposite.setLayoutData(data);" + NL + "\t\t}" + NL + "\t\tLabel resourceURILabel = new Label(composite, SWT.LEFT);" + NL + "\t\t{" + NL + "\t\t\tresourceURILabel.setText(\"&File\");" + NL + "" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tresourceURILabel.setLayoutData(data);" + NL + "\t\t}" + NL + "" + NL + "\t\tComposite fileComposite = new Composite(composite, SWT.NONE);" + NL + "\t\t{" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\tfileComposite.setLayoutData(data);" + NL + "" + NL + "\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\tlayout.marginHeight = 0;" + NL + "\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\tlayout.numColumns = 2;" + NL + "\t\t\tfileComposite.setLayout(layout);" + NL + "\t\t}" + NL + "" + NL + "\t\tfileField = new "; >- protected final String TEXT_7 = "(fileComposite, SWT.BORDER);" + NL + "\t\t{" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\tdata.horizontalSpan = 1;" + NL + "\t\t\tfileField.setLayoutData(data);" + NL + "\t\t}" + NL + "" + NL + "\t\tfileField.addModifyListener(validator);" + NL + "\t\t"; >- protected final String TEXT_8 = " resourceURIBrowseFileSystemButton = new "; >- protected final String TEXT_9 = "(fileComposite, SWT.PUSH);" + NL + "\t\tresourceURIBrowseFileSystemButton.setText(\"&Browse\");" + NL + " " + NL + "\t\tresourceURIBrowseFileSystemButton.addSelectionListener" + NL + "\t\t\t(new "; >- protected final String TEXT_10 = "() {" + NL + "\t\t\t\t public void widgetSelected("; >- protected final String TEXT_11 = " event) {" + NL + "\t\t\t\t\t String fileExtension = \""; >- protected final String TEXT_12 = "\";" + NL + "\t\t\t\t\t String filePath = "; >- protected final String TEXT_13 = ".openFilePathDialog(getShell(), \"*.\" + fileExtension, "; >- protected final String TEXT_14 = ".OPEN);" + NL + "\t\t\t\t\t if (filePath != null) {" + NL + "\t\t\t\t\t\t if (!filePath.endsWith(\".\" + fileExtension)) {" + NL + "\t\t\t\t\t\t\t filePath = filePath + \".\" + fileExtension;" + NL + "\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t fileField.setText(filePath);" + NL + "\t\t\t\t\t }" + NL + "\t\t\t\t }" + NL + "\t\t\t }); " + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t\tsetControl(composite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ModifyListener validator =" + NL + "\t\tnew ModifyListener() {" + NL + "\t\t\tpublic void modifyText(ModifyEvent e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t};" + NL + " " + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t protected boolean validatePage() {" + NL + "\t\tURI diagramFileURI = getDiagramFileURI();" + NL + "\t\tif (diagramFileURI == null || diagramFileURI.isEmpty()) {" + NL + "\t\t\tsetErrorMessage(null);" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tString requiredExt = \""; >- protected final String TEXT_15 = "\";" + NL + "\t\tString enteredExt = diagramFileURI.fileExtension();" + NL + "\t\tif (enteredExt == null || !enteredExt.equals(requiredExt)) {" + NL + "\t\t\tsetErrorMessage(\"The file name must end in \" + requiredExt); " + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\tif (diagramFileURI.isFile()) {" + NL + "\t\t\tFile diagramFile = new File(diagramFileURI.toFileString());" + NL + "\t\t\tif (diagramFile.exists()) {" + NL + "\t\t\t\tsetErrorMessage(\"Diagram File already exists: \" + diagramFile);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}"; >- protected final String TEXT_16 = NL + "\t\t\tURI modelFileURI = getModelFileURI();" + NL + "\t\t\tFile modelFile = new File(modelFileURI.toFileString());" + NL + "\t\t\tif (modelFile.exists()) {" + NL + "\t\t\t\tsetErrorMessage(\"Model File already exists: \" + modelFile);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}"; >- protected final String TEXT_17 = NL + "\t\t}" + NL + "\t\tsetErrorMessage(null); " + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getCreatedDiagramFileURI() {" + NL + "\t\treturn createdDiagramFileURI;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getDiagramFileURI() {" + NL + "\t\ttry {" + NL + "\t\t\treturn URI.createFileURI(fileField.getText());" + NL + "\t\t} catch (Exception exception) {" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL; >- protected final String TEXT_18 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getModelFileURI() {" + NL + "\t\tURI diagramFileURI = getDiagramFileURI();" + NL + "\t\tif (diagramFileURI == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFileURI.trimFileExtension().appendFileExtension(\""; >- protected final String TEXT_19 = "\");" + NL + "\t}"; >- protected final String TEXT_20 = NL + NL + "\t/**" + NL + "\t * Performs the operations necessary to create and open the diagram" + NL + "\t * @return boolean indicating whether the creation and opening the Diagram was successful " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean finish() {" + NL + "\t\tfinal boolean[] result = new boolean[1];" + NL + "\t\t"; >- protected final String TEXT_21 = " op = new IRunnableWithProgress() {" + NL + "\t\t\tpublic void run(IProgressMonitor monitor) {" + NL + "\t\t\t\tresult[0] = doFinish(monitor);" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "" + NL + "\t\ttry {" + NL + "\t\t\tgetContainer().run(false, true, op);" + NL + "\t\t} catch (InterruptedException e) {" + NL + "\t\t\treturn false;" + NL + "\t\t} catch ("; >- protected final String TEXT_22 = " e) {" + NL + "\t\t\tif (e.getTargetException() instanceof CoreException) {" + NL + "\t\t\t\t"; >- protected final String TEXT_23 = ".openError(" + NL + "\t\t\t\t\tgetContainer().getShell()," + NL + "\t\t\t\t\t\"Creation Problems\"," + NL + "\t\t\t\t\tnull,\t// no special message" + NL + "\t\t\t\t\t((CoreException) e.getTargetException()).getStatus());" + NL + "\t\t\t}" + NL + "\t\t\telse {" + NL + "\t\t\t\t// CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur." + NL + "\t\t\t\t"; >- protected final String TEXT_24 = ".getInstance().getLog().log(new "; >- protected final String TEXT_25 = "("; >- protected final String TEXT_26 = ".ERROR, "; >- protected final String TEXT_27 = ".ID, 0, \"Creation failed\", e.getTargetException()));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn result[0];" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param monitor the <code>IProgressMonitor</code> to use to indicate progress and check for cancellation" + NL + "\t * @return boolean indicating whether the diagram was created and opened successfully" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean doFinish(IProgressMonitor monitor) {" + NL + "\t\tcreatedDiagramFileURI = createDiagramFile(monitor);" + NL + "\t\treturn createdDiagramFileURI != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI createDiagramFile(IProgressMonitor monitor) {" + NL + "\t\t//TODO: Editing domain!" + NL + "\t\t"; >- protected final String TEXT_28 = " resourceSet = new "; >- protected final String TEXT_29 = "();" + NL + "\t\tfinal "; >- protected final String TEXT_30 = " diagramResource = resourceSet.createResource(getDiagramFileURI());"; >- protected final String TEXT_31 = NL + "\t\tfinal Resource modelResource = resourceSet.createResource(getModelFileURI());"; >- protected final String TEXT_32 = NL + NL + "\t\tif (diagramResource != null"; >- protected final String TEXT_33 = " && modelResource != null"; >- protected final String TEXT_34 = ") {" + NL + "\t\t\t//TODO: Editing domain!" + NL + "\t\t\t"; >- protected final String TEXT_35 = " model = "; >- protected final String TEXT_36 = ".eINSTANCE.create"; >- protected final String TEXT_37 = "();"; >- protected final String TEXT_38 = NL + "\t\t\tmodelResource.getContents().add(model);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmodelResource.save("; >- protected final String TEXT_39 = ".EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\thandleSaveException(e);" + NL + "\t\t\t}"; >- protected final String TEXT_40 = NL + "\t\t\tdiagramResource.getContents().add(model);"; >- protected final String TEXT_41 = NL + "\t\t\t"; >- protected final String TEXT_42 = " diagram = "; >- protected final String TEXT_43 = ".eINSTANCE.createDiagram();" + NL + "\t\t\tdiagram.setElement(model);" + NL + "\t\t\t"; >- protected final String TEXT_44 = ".decorateView(diagram);" + NL + "\t\t\tdiagramResource.getContents().add(diagram);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\thandleSaveException(e);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tboolean result = "; >- protected final String TEXT_45 = ".openEditor(getDiagramFileURI());" + NL + "\t\tif (!result) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn getDiagramFileURI();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void handleSaveException(IOException e) {" + NL + "\t\tthrow new RuntimeException(e);" + NL + "\t}" + NL + "}"; >- protected final String TEXT_46 = NL; >+ protected final String TEXT_3 = " {"; >+ protected final String TEXT_4 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Text fileField;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI createdDiagramFileURI;"; >+ protected final String TEXT_5 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; >+ protected final String TEXT_6 = " createdDiagramFile;"; >+ protected final String TEXT_7 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; >+ protected final String TEXT_8 = NL + "\tpublic "; >+ protected final String TEXT_9 = "() {" + NL + "\t\tsuper(\"CreationWizardPage\"); //$NON-NLS-1$"; >+ protected final String TEXT_10 = NL + "\tpublic "; >+ protected final String TEXT_11 = "("; >+ protected final String TEXT_12 = " selection) {" + NL + "\t\tsuper(\"CreationWizardPage\", selection);\t//$NON-NLS-1$"; >+ protected final String TEXT_13 = NL + "\t\tsetTitle(\"Create "; >+ protected final String TEXT_14 = " Diagram\"); //$NON-NLS-1$" + NL + "\t\tsetDescription(\"Create a new "; >+ protected final String TEXT_15 = " diagram.\"); //$NON-NLS-1$" + NL + "\t}" + NL; >+ protected final String TEXT_16 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createControl(Composite parent)" + NL + "\t{" + NL + "\t\tComposite composite = new Composite(parent, SWT.NONE);" + NL + "\t\t{" + NL + "\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\tlayout.numColumns = 1;" + NL + "\t\t\tlayout.verticalSpacing = 12;" + NL + "\t\t\tcomposite.setLayout(layout);" + NL + "" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.verticalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessVerticalSpace = true;" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tcomposite.setLayoutData(data);" + NL + "\t\t}" + NL + "\t\tLabel resourceURILabel = new Label(composite, SWT.LEFT);" + NL + "\t\t{" + NL + "\t\t\tresourceURILabel.setText(\"&File\");" + NL + "" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tresourceURILabel.setLayoutData(data);" + NL + "\t\t}" + NL + "" + NL + "\t\tComposite fileComposite = new Composite(composite, SWT.NONE);" + NL + "\t\t{" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\tfileComposite.setLayoutData(data);" + NL + "" + NL + "\t\t\tGridLayout layout = new GridLayout();" + NL + "\t\t\tlayout.marginHeight = 0;" + NL + "\t\t\tlayout.marginWidth = 0;" + NL + "\t\t\tlayout.numColumns = 2;" + NL + "\t\t\tfileComposite.setLayout(layout);" + NL + "\t\t}" + NL + "" + NL + "\t\tfileField = new "; >+ protected final String TEXT_17 = "(fileComposite, SWT.BORDER);" + NL + "\t\t{" + NL + "\t\t\tGridData data = new GridData();" + NL + "\t\t\tdata.horizontalAlignment = GridData.FILL;" + NL + "\t\t\tdata.grabExcessHorizontalSpace = true;" + NL + "\t\t\tdata.horizontalSpan = 1;" + NL + "\t\t\tfileField.setLayoutData(data);" + NL + "\t\t}" + NL + "" + NL + "\t\tfileField.addModifyListener(validator);" + NL + "\t\t"; >+ protected final String TEXT_18 = " resourceURIBrowseFileSystemButton = new "; >+ protected final String TEXT_19 = "(fileComposite, SWT.PUSH);" + NL + "\t\tresourceURIBrowseFileSystemButton.setText(\"&Browse\");" + NL + " " + NL + "\t\tresourceURIBrowseFileSystemButton.addSelectionListener" + NL + "\t\t\t(new "; >+ protected final String TEXT_20 = "() {" + NL + "\t\t\t\t public void widgetSelected("; >+ protected final String TEXT_21 = " event) {" + NL + "\t\t\t\t\t String fileExtension = \""; >+ protected final String TEXT_22 = "\";" + NL + "\t\t\t\t\t String filePath = "; >+ protected final String TEXT_23 = ".openFilePathDialog(getShell(), \"*.\" + fileExtension, "; >+ protected final String TEXT_24 = ".OPEN);" + NL + "\t\t\t\t\t if (filePath != null) {" + NL + "\t\t\t\t\t\t if (!filePath.endsWith(\".\" + fileExtension)) {" + NL + "\t\t\t\t\t\t\t filePath = filePath + \".\" + fileExtension;" + NL + "\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t fileField.setText(filePath);" + NL + "\t\t\t\t\t }" + NL + "\t\t\t\t }" + NL + "\t\t\t }); " + NL + "\t\tsetPageComplete(validatePage());" + NL + "\t\tsetControl(composite);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ModifyListener validator =" + NL + "\t\tnew ModifyListener() {" + NL + "\t\t\tpublic void modifyText(ModifyEvent e) {" + NL + "\t\t\t\tsetPageComplete(validatePage());" + NL + "\t\t\t}" + NL + "\t\t};" + NL; >+ protected final String TEXT_25 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\t protected boolean validatePage() {"; >+ protected final String TEXT_26 = NL + "\t\tURI diagramFileURI = getDiagramFileURI();" + NL + "\t\tif (diagramFileURI == null || diagramFileURI.isEmpty()) {" + NL + "\t\t\tsetErrorMessage(null);" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\tif (diagramFileURI.isFile()) {" + NL + "\t\t\tFile diagramFile = new File(diagramFileURI.toFileString());" + NL + "\t\t\tif (diagramFile.exists()) {" + NL + "\t\t\t\tsetErrorMessage(\"Diagram File already exists: \" + diagramFile);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}" + NL + "\t\t}"; >+ protected final String TEXT_27 = NL + "\t\tif (!super.validatePage()) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\tString fileName = getFileName();" + NL + "" + NL + "\t\tif (fileName == null) {" + NL + "\t\t\tsetErrorMessage(null);" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "" + NL + "\t\t"; >+ protected final String TEXT_28 = " path = getContainerFullPath().append(fileName);" + NL + "\t\tif (path.getFileExtension() == null) {" + NL + "\t\t\tpath = path.addFileExtension(\""; >+ protected final String TEXT_29 = "\");\t//$NON-NLS-1$" + NL + "\t\t}" + NL + "" + NL + "\t\tif ("; >+ protected final String TEXT_30 = ".getWorkspace().getRoot().exists(path)) {" + NL + "\t\t\tsetErrorMessage(\"Diagram File already exists: \" + path.toOSString());" + NL + "\t\t\treturn false;" + NL + "\t\t}"; >+ protected final String TEXT_31 = NL + "\t\tString requiredExt = \""; >+ protected final String TEXT_32 = "\";"; >+ protected final String TEXT_33 = NL + "\t\tString enteredExt = diagramFileURI.fileExtension();"; >+ protected final String TEXT_34 = NL + "\t\tString enteredExt = path.getFileExtension();"; >+ protected final String TEXT_35 = NL + "\t\tif (enteredExt == null || !enteredExt.equals(requiredExt)) {" + NL + "\t\t\tsetErrorMessage(\"The file name must end in \" + requiredExt); " + NL + "\t\t\treturn false;" + NL + "\t\t}"; >+ protected final String TEXT_36 = NL + "\t\t\tURI modelFileURI = getModelFileURI();" + NL + "\t\t\tFile modelFile = new File(modelFileURI.toFileString());" + NL + "\t\t\tif (modelFile.exists()) {" + NL + "\t\t\t\tsetErrorMessage(\"Model File already exists: \" + modelFile);" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}"; >+ protected final String TEXT_37 = NL + "\t\t\tpath = path.removeFileExtension().addFileExtension(\""; >+ protected final String TEXT_38 = "\"); //$NON-NLS-1$" + NL + "\t\t\tif ("; >+ protected final String TEXT_39 = ".getWorkspace().getRoot().exists(path)) {" + NL + "\t\t\t\tsetErrorMessage(\"Model File already exists: \" + path.lastSegment());" + NL + "\t\t\t\treturn false;" + NL + "\t\t\t}"; >+ protected final String TEXT_40 = NL + "\t\tsetErrorMessage(null);" + NL + "\t\treturn true;" + NL + "\t}" + NL; >+ protected final String TEXT_41 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic URI getCreatedDiagramFileURI() {" + NL + "\t\treturn createdDiagramFileURI;" + NL + "\t}"; >+ protected final String TEXT_42 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFile getCreatedDiagramFile() {" + NL + "\t\treturn createdDiagramFile;" + NL + "\t}"; >+ protected final String TEXT_43 = NL; >+ protected final String TEXT_44 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getDiagramFileURI() {" + NL + "\t\ttry {" + NL + "\t\t\treturn URI.createFileURI(fileField.getText());" + NL + "\t\t} catch (Exception exception) {" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL; >+ protected final String TEXT_45 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getModelFileURI() {" + NL + "\t\tURI diagramFileURI = getDiagramFileURI();" + NL + "\t\tif (diagramFileURI == null) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFileURI.trimFileExtension().appendFileExtension(\""; >+ protected final String TEXT_46 = "\");" + NL + "\t}"; >+ protected final String TEXT_47 = NL + NL + "\t/**" + NL + "\t * Performs the operations necessary to create and open the diagram" + NL + "\t * @return boolean indicating whether the creation and opening the Diagram was successful " + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean finish() {" + NL + "\t\tfinal boolean[] result = new boolean[1];"; >+ protected final String TEXT_48 = NL + "\t\t"; >+ protected final String TEXT_49 = " op = new IRunnableWithProgress() {" + NL + "\t\t\tpublic void run(IProgressMonitor monitor) {"; >+ protected final String TEXT_50 = NL + "\t\t"; >+ protected final String TEXT_51 = " op = new WorkspaceModifyOperation(null) {" + NL + "\t\t\tprotected void execute(IProgressMonitor monitor) {"; >+ protected final String TEXT_52 = NL + "\t\t\t\tresult[0] = doFinish(monitor);" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "" + NL + "\t\ttry {" + NL + "\t\t\tgetContainer().run(false, true, op);" + NL + "\t\t} catch (InterruptedException e) {" + NL + "\t\t\treturn false;" + NL + "\t\t} catch ("; >+ protected final String TEXT_53 = " e) {" + NL + "\t\t\tif (e.getTargetException() instanceof CoreException) {" + NL + "\t\t\t\t"; >+ protected final String TEXT_54 = ".openError(" + NL + "\t\t\t\t\tgetContainer().getShell()," + NL + "\t\t\t\t\t\"Creation Problems\"," + NL + "\t\t\t\t\tnull,\t// no special message" + NL + "\t\t\t\t\t((CoreException) e.getTargetException()).getStatus());" + NL + "\t\t\t}" + NL + "\t\t\telse {" + NL + "\t\t\t\t// CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur." + NL + "\t\t\t\t"; >+ protected final String TEXT_55 = ".getInstance().getLog().log(new "; >+ protected final String TEXT_56 = "("; >+ protected final String TEXT_57 = ".ERROR, "; >+ protected final String TEXT_58 = ".ID, 0, \"Creation failed\", e.getTargetException()));" + NL + "\t\t\t}" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\treturn result[0];" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @param monitor the <code>IProgressMonitor</code> to use to indicate progress and check for cancellation" + NL + "\t * @return boolean indicating whether the diagram was created and opened successfully" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean doFinish(IProgressMonitor monitor) {"; >+ protected final String TEXT_59 = NL + "\t\t"; >+ protected final String TEXT_60 = " = createDiagramFile(monitor);" + NL + "\t\treturn "; >+ protected final String TEXT_61 = " != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; >+ protected final String TEXT_62 = NL + "\tprivate URI createDiagramFile(IProgressMonitor monitor) {"; >+ protected final String TEXT_63 = NL + "\tprivate IFile createDiagramFile(IProgressMonitor monitor) {"; >+ protected final String TEXT_64 = NL + "\t\t//TODO: Editing domain!" + NL + "\t\t"; >+ protected final String TEXT_65 = " resourceSet = new "; >+ protected final String TEXT_66 = "();"; >+ protected final String TEXT_67 = NL + "\t\tfinal "; >+ protected final String TEXT_68 = " diagramResource = resourceSet.createResource(getDiagramFileURI());"; >+ protected final String TEXT_69 = NL + "\t\tIPath diagramFilePath = getContainerFullPath().append(getFileName());" + NL + "\t\tif (diagramFilePath.getFileExtension() == null) {" + NL + "\t\t\tdiagramFilePath = diagramFilePath.addFileExtension(\""; >+ protected final String TEXT_70 = "\");\t\t//$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\tfinal IFile diagramFile = ResourcesPlugin.getWorkspace().getRoot().getFile(diagramFilePath);" + NL + "\t\tfinal "; >+ protected final String TEXT_71 = " diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFilePath.toString()));"; >+ protected final String TEXT_72 = NL + "\t\tfinal Resource modelResource = resourceSet.createResource(getModelFileURI());"; >+ protected final String TEXT_73 = NL + "\t\tIPath modelFilePath = diagramFilePath.removeFileExtension().addFileExtension(\""; >+ protected final String TEXT_74 = "\"); //$NON-NLS-1$" + NL + "\t\tfinal Resource modelResource = resourceSet.createResource(URI.createPlatformResourceURI(modelFilePath.toString()));"; >+ protected final String TEXT_75 = NL + NL + "\t\tif (diagramResource != null"; >+ protected final String TEXT_76 = " && modelResource != null"; >+ protected final String TEXT_77 = ") {" + NL + "\t\t\t//TODO: Editing domain!" + NL + "\t\t\t"; >+ protected final String TEXT_78 = " model = "; >+ protected final String TEXT_79 = ".eINSTANCE.create"; >+ protected final String TEXT_80 = "();"; >+ protected final String TEXT_81 = NL + "\t\t\tmodelResource.getContents().add(model);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmodelResource.save("; >+ protected final String TEXT_82 = ".EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\thandleSaveException(e);" + NL + "\t\t\t}"; >+ protected final String TEXT_83 = NL + "\t\t\tdiagramResource.getContents().add(model);"; >+ protected final String TEXT_84 = NL + "\t\t\t"; >+ protected final String TEXT_85 = " diagram = "; >+ protected final String TEXT_86 = ".eINSTANCE.createDiagram();" + NL + "\t\t\tdiagram.setElement(model);" + NL + "\t\t\t"; >+ protected final String TEXT_87 = ".decorateView(diagram);" + NL + "\t\t\tdiagramResource.getContents().add(diagram);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\thandleSaveException(e);" + NL + "\t\t\t}" + NL + "\t\t}"; >+ protected final String TEXT_88 = NL + "\t\tboolean result = "; >+ protected final String TEXT_89 = ".openEditor(getDiagramFileURI());" + NL + "\t\tif (!result) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn getDiagramFileURI();"; >+ protected final String TEXT_90 = NL + "\t\ttry {" + NL + "\t\t\t"; >+ protected final String TEXT_91 = ".openEditor("; >+ protected final String TEXT_92 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage(), diagramFile);" + NL + "\t\t} catch ("; >+ protected final String TEXT_93 = " e) {" + NL + "\t\t\t"; >+ protected final String TEXT_94 = ".getInstance().getLog().log(e.getStatus());" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFile;"; >+ protected final String TEXT_95 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void handleSaveException(IOException e) {" + NL + "\t\tthrow new RuntimeException(e);" + NL + "\t}" + NL + "}"; >+ protected final String TEXT_96 = NL; > > public String generate(Object argument) > { >@@ -70,123 +120,302 @@ > final GenEditorGenerator editorGen = genDiagram.getEditorGen(); > final GenPlugin genPlugin = editorGen.getPlugin(); > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; >+final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); > > importManager.emitPackageStatement(stringBuffer); > importManager.markImportLocation(stringBuffer); > >-importManager.addImport("java.io.File"); > importManager.addImport("org.eclipse.core.runtime.IProgressMonitor"); > importManager.addImport("org.eclipse.core.runtime.CoreException"); > importManager.addImport("java.io.IOException"); >-importManager.addImport("org.eclipse.swt.widgets.Text"); > importManager.addImport("org.eclipse.emf.common.util.URI"); >+if (isRichClientPlatform) { >+importManager.addImport("java.io.File"); > importManager.addImport("org.eclipse.swt.widgets.Composite"); > importManager.addImport("org.eclipse.swt.widgets.Label"); >+importManager.addImport("org.eclipse.swt.widgets.Text"); > importManager.addImport("org.eclipse.swt.events.ModifyListener"); > importManager.addImport("org.eclipse.swt.events.ModifyEvent"); > importManager.addImport("org.eclipse.swt.layout.GridLayout"); > importManager.addImport("org.eclipse.swt.layout.GridData"); >+} > > stringBuffer.append(TEXT_1); > stringBuffer.append(genDiagram.getCreationWizardPageClassName()); > stringBuffer.append(TEXT_2); >- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.wizard.WizardPage")); >+ stringBuffer.append(importManager.getImportedName(isRichClientPlatform ? "org.eclipse.jface.wizard.WizardPage" : "org.eclipse.ui.dialogs.WizardNewFileCreationPage")); > stringBuffer.append(TEXT_3); >- stringBuffer.append(genDiagram.getCreationWizardPageClassName()); >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_4); >- stringBuffer.append(editorGen.getDomainGenModel().getModelName()); >+ >+} else { >+ > stringBuffer.append(TEXT_5); >- stringBuffer.append(editorGen.getDomainGenModel().getModelName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); > stringBuffer.append(TEXT_6); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Text")); >+ >+} >+ > stringBuffer.append(TEXT_7); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_8); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); >+ stringBuffer.append(genDiagram.getCreationWizardPageClassName()); > stringBuffer.append(TEXT_9); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionAdapter")); >+ >+} else { >+ > stringBuffer.append(TEXT_10); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionEvent")); >+ stringBuffer.append(genDiagram.getCreationWizardPageClassName()); > stringBuffer.append(TEXT_11); >- stringBuffer.append(editorGen.getDiagramFileExtension()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")); > stringBuffer.append(TEXT_12); >- stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); >+ >+} >+ > stringBuffer.append(TEXT_13); >- stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); >+ stringBuffer.append(editorGen.getDomainGenModel().getModelName()); > stringBuffer.append(TEXT_14); >- stringBuffer.append(editorGen.getDiagramFileExtension()); >+ stringBuffer.append(editorGen.getDomainGenModel().getModelName()); > stringBuffer.append(TEXT_15); >- if (!editorGen.isSameFileForDiagramAndModel()) { >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_16); >- } >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Text")); > stringBuffer.append(TEXT_17); >- if (!editorGen.isSameFileForDiagramAndModel()) { >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); > stringBuffer.append(TEXT_18); >- stringBuffer.append(editorGen.getDomainFileExtension()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Button")); > stringBuffer.append(TEXT_19); >- } >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionAdapter")); > stringBuffer.append(TEXT_20); >- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress")); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.events.SelectionEvent")); > stringBuffer.append(TEXT_21); >- stringBuffer.append(importManager.getImportedName("java.lang.reflect.InvocationTargetException")); >+ stringBuffer.append(editorGen.getDiagramFileExtension()); > stringBuffer.append(TEXT_22); >- stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.ErrorDialog")); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); > stringBuffer.append(TEXT_23); >- stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.swt.SWT")); > stringBuffer.append(TEXT_24); >- stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status")); >+ >+} >+ > stringBuffer.append(TEXT_25); >- stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus")); >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_26); >- stringBuffer.append(genPlugin.getActivatorClassName()); >+ >+} else { >+ > stringBuffer.append(TEXT_27); >- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IPath")); > stringBuffer.append(TEXT_28); >- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")); >+ stringBuffer.append(editorGen.getDiagramFileExtension()); > stringBuffer.append(TEXT_29); >- stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")); > stringBuffer.append(TEXT_30); > >-final boolean standaloneDomainModel = !editorGen.isSameFileForDiagramAndModel() && genDiagram.getDomainDiagramElement() != null; >-if (standaloneDomainModel) { >+} > > stringBuffer.append(TEXT_31); >- } >+ stringBuffer.append(editorGen.getDiagramFileExtension()); > stringBuffer.append(TEXT_32); >- if (standaloneDomainModel) { >+ >+if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_33); >- } >+ >+} else { >+ > stringBuffer.append(TEXT_34); >- stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >+ >+} >+ > stringBuffer.append(TEXT_35); >- stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); >+ >+if (!editorGen.isSameFileForDiagramAndModel()) { >+ if (isRichClientPlatform) { >+ > stringBuffer.append(TEXT_36); >- stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); >+ >+ } else { >+ > stringBuffer.append(TEXT_37); >+ stringBuffer.append(editorGen.getDomainFileExtension()); >+ stringBuffer.append(TEXT_38); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")); >+ stringBuffer.append(TEXT_39); >+ >+ } >+} >+ >+ stringBuffer.append(TEXT_40); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_41); >+ >+} else { >+ >+ stringBuffer.append(TEXT_42); >+ >+} >+ >+ stringBuffer.append(TEXT_43); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_44); >+ >+ if (!editorGen.isSameFileForDiagramAndModel()) { >+ >+ stringBuffer.append(TEXT_45); >+ stringBuffer.append(editorGen.getDomainFileExtension()); >+ stringBuffer.append(TEXT_46); >+ >+ } >+} >+ >+ stringBuffer.append(TEXT_47); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_48); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.operation.IRunnableWithProgress")); >+ stringBuffer.append(TEXT_49); >+ >+} else { >+ >+ stringBuffer.append(TEXT_50); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.actions.WorkspaceModifyOperation")); >+ stringBuffer.append(TEXT_51); >+ >+} >+ >+ stringBuffer.append(TEXT_52); >+ stringBuffer.append(importManager.getImportedName("java.lang.reflect.InvocationTargetException")); >+ stringBuffer.append(TEXT_53); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.jface.dialogs.ErrorDialog")); >+ stringBuffer.append(TEXT_54); >+ stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(TEXT_55); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status")); >+ stringBuffer.append(TEXT_56); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus")); >+ stringBuffer.append(TEXT_57); >+ stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(TEXT_58); >+ >+String createdVar = isRichClientPlatform ? "createdDiagramFileURI" : "createdDiagramFile"; >+ >+ stringBuffer.append(TEXT_59); >+ stringBuffer.append(createdVar); >+ stringBuffer.append(TEXT_60); >+ stringBuffer.append(createdVar); >+ stringBuffer.append(TEXT_61); >+ if (isRichClientPlatform) { >+ stringBuffer.append(TEXT_62); >+ } else { >+ stringBuffer.append(TEXT_63); >+ } >+ stringBuffer.append(TEXT_64); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); >+ stringBuffer.append(TEXT_65); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")); >+ stringBuffer.append(TEXT_66); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_67); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); >+ stringBuffer.append(TEXT_68); >+ >+} else { >+ >+ stringBuffer.append(TEXT_69); >+ stringBuffer.append(editorGen.getDiagramFileExtension()); >+ stringBuffer.append(TEXT_70); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); >+ stringBuffer.append(TEXT_71); > >+} >+ >+ >+final boolean standaloneDomainModel = !editorGen.isSameFileForDiagramAndModel() && genDiagram.getDomainDiagramElement() != null; > if (standaloneDomainModel) { >+ if (isRichClientPlatform) { > >- stringBuffer.append(TEXT_38); >+ stringBuffer.append(TEXT_72); >+ >+ } else { >+ >+ stringBuffer.append(TEXT_73); >+ stringBuffer.append(editorGen.getDomainFileExtension()); >+ stringBuffer.append(TEXT_74); >+ >+ } >+} >+ >+ stringBuffer.append(TEXT_75); >+ if (standaloneDomainModel) { >+ stringBuffer.append(TEXT_76); >+ } >+ stringBuffer.append(TEXT_77); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); >+ stringBuffer.append(TEXT_78); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); >+ stringBuffer.append(TEXT_79); >+ stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); >+ stringBuffer.append(TEXT_80); >+ >+if (standaloneDomainModel) { >+ >+ stringBuffer.append(TEXT_81); > stringBuffer.append(importManager.getImportedName("java.util.Collections")); >- stringBuffer.append(TEXT_39); >+ stringBuffer.append(TEXT_82); > > } else { > >- stringBuffer.append(TEXT_40); >+ stringBuffer.append(TEXT_83); > > } > >- stringBuffer.append(TEXT_41); >+ stringBuffer.append(TEXT_84); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); >- stringBuffer.append(TEXT_42); >+ stringBuffer.append(TEXT_85); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); >- stringBuffer.append(TEXT_43); >+ stringBuffer.append(TEXT_86); > stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoryQualifiedClassName())); >- stringBuffer.append(TEXT_44); >+ stringBuffer.append(TEXT_87); >+ >+if (isRichClientPlatform) { >+ >+ stringBuffer.append(TEXT_88); > stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); >- stringBuffer.append(TEXT_45); >+ stringBuffer.append(TEXT_89); >+ >+} else { >+ >+ stringBuffer.append(TEXT_90); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.ide.IDE")); >+ stringBuffer.append(TEXT_91); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); >+ stringBuffer.append(TEXT_92); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); >+ stringBuffer.append(TEXT_93); >+ stringBuffer.append(genPlugin.getActivatorClassName()); >+ stringBuffer.append(TEXT_94); >+ >+} >+ >+ stringBuffer.append(TEXT_95); > importManager.emitSortedImports(); >- stringBuffer.append(TEXT_46); >+ stringBuffer.append(TEXT_96); > return stringBuffer.toString(); > } > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginPropertiesGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginPropertiesGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 PluginPropertiesGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginPropertiesGenerator.java 13 Apr 2006 21:20:16 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/PluginPropertiesGenerator.java 19 Apr 2006 10:45:48 -0000 >@@ -1,6 +1,7 @@ > package org.eclipse.gmf.codegen.templates.lite.editor; > > import org.eclipse.gmf.codegen.gmfgen.*; >+import org.eclipse.emf.codegen.ecore.genmodel.*; > > public class PluginPropertiesGenerator > { >@@ -17,16 +18,69 @@ > protected final String TEXT_1 = "pluginName="; > protected final String TEXT_2 = NL + "providerName="; > protected final String TEXT_3 = NL; >+ protected final String TEXT_4 = NL + "_UI_Menu_OpenURI_label=Open Diagram &URI..." + NL + "_UI_Menu_OpenURI_description=Opens a "; >+ protected final String TEXT_5 = " diagram loading it from a URI" + NL + "_UI_Menu_Open_label=&Open Diagram..." + NL + "_UI_Menu_Open_description=Opens a "; >+ protected final String TEXT_6 = " diagram" + NL + "" + NL + "_UI_"; >+ protected final String TEXT_7 = "_ActionSet_label="; >+ protected final String TEXT_8 = " Diagram Action Set " + NL + "_UI_"; >+ protected final String TEXT_9 = "NewDiagramCommand=New "; >+ protected final String TEXT_10 = " diagram" + NL; >+ protected final String TEXT_11 = NL + "_UI_Perspective_label = "; >+ protected final String TEXT_12 = " Diagram" + NL + "_UI_Application_title="; >+ protected final String TEXT_13 = " Diagram Application " + NL + "_UI_Menu_File_label=&File" + NL + "_UI_Menu_New_label=&New" + NL + "_UI_Menu_Edit_label=&Edit" + NL + "_UI_Menu_Window_label=&Window" + NL + "_UI_Menu_Help_label=&Help" + NL + "_UI_Menu_About_label="; >+ protected final String TEXT_14 = " Diagram &About..." + NL + "_UI_About_title = "; >+ protected final String TEXT_15 = " Diagram Application" + NL + "_UI_About_text = "; >+ protected final String TEXT_16 = " Diagram Application about box goes here."; >+ protected final String TEXT_17 = NL; > > public String generate(Object argument) > { > final StringBuffer stringBuffer = new StringBuffer(); >- GenPlugin genPlugin = (GenPlugin) argument; >+ >+GenPlugin genPlugin = (GenPlugin) argument; >+final GenDiagram genDiagram = genPlugin.getEditorGen().getDiagram(); >+final GenModel genModel = genPlugin.getEditorGen().getDomainGenModel(); >+final boolean isRichClientPlatform = genModel.isRichClientPlatform(); >+ > stringBuffer.append(TEXT_1); > stringBuffer.append(genPlugin.getName()); > stringBuffer.append(TEXT_2); > stringBuffer.append(genPlugin.getProvider()); > stringBuffer.append(TEXT_3); >+ if (isRichClientPlatform) { >+ stringBuffer.append(TEXT_4); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_5); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_6); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_7); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_8); >+ stringBuffer.append(genDiagram.getDiagramEditorUtilQualifiedClassName()); >+ stringBuffer.append(TEXT_9); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_10); >+ >+ boolean shouldGenerateApplication = true; /*XXX: option in gmfgen*/ >+ if (shouldGenerateApplication) { >+ >+ stringBuffer.append(TEXT_11); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_12); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_13); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_14); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_15); >+ stringBuffer.append(genModel.getModelName()); >+ stringBuffer.append(TEXT_16); >+ >+ } >+} >+ >+ stringBuffer.append(TEXT_17); > return stringBuffer.toString(); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114200
: 38918