### Eclipse Workspace Patch 1.0
#P org.eclipse.gmf.tests.lite
Index: src/org/eclipse/gmf/tests/lite/gen/LiteCompilationTest.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteCompilationTest.java,v
retrieving revision 1.1
diff -u -r1.1 LiteCompilationTest.java
--- src/org/eclipse/gmf/tests/lite/gen/LiteCompilationTest.java 22 May 2006 18:14:09 -0000 1.1
+++ src/org/eclipse/gmf/tests/lite/gen/LiteCompilationTest.java 25 May 2006 11:10:15 -0000
@@ -11,6 +11,10 @@
*/
package org.eclipse.gmf.tests.lite.gen;
+import org.eclipse.gmf.bridge.genmodel.InnerClassViewmapProducer;
+import org.eclipse.gmf.bridge.genmodel.ViewmapProducer;
+import org.eclipse.gmf.gmfgraph.util.RuntimeLiteFQNSwitch;
+import org.eclipse.gmf.graphdef.codegen.MapModeCodeGenStrategy;
import org.eclipse.gmf.tests.gen.CompilationTest;
import org.eclipse.gmf.tests.setup.GeneratorConfiguration;
@@ -23,4 +27,8 @@
protected GeneratorConfiguration getGeneratorConfiguration() {
return new LiteGeneratorConfiguration();
}
+
+ protected ViewmapProducer getViewmapProducer() {
+ return new InnerClassViewmapProducer(new RuntimeLiteFQNSwitch(), new MapModeCodeGenStrategy.StaticIdentityMapMode());
+ }
}
#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.5
diff -u -r1.5 Editor.javajet
--- templates/editor/Editor.javajet 22 May 2006 18:22:10 -0000 1.5
+++ templates/editor/Editor.javajet 25 May 2006 11:10:17 -0000
@@ -564,7 +564,7 @@
/**
* @generated
*/
- private <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%> <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>;
+ private <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%> diagramRoot;
/**
* @generated
@@ -899,8 +899,8 @@
/**
* @generated
*/
- public <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%> get<%=genDiagram.getDomainDiagramElement().getClassifierAccessorName()%>() {
- return <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>;
+ public <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%> getDiagramRoot() {
+ return diagramRoot;
}
/**
@@ -923,7 +923,7 @@
setEditDomain(new DefaultEditDomain(this));
// validate
- if (get<%=genDiagram.getDomainDiagramElement().getClassifierAccessorName()%>() == null) {
+ if (getDiagramRoot() == null) {
throw new PartInitException("The specified input is not valid.");
}
@@ -1037,7 +1037,7 @@
* @generated
*/
private void load(URI diagramFile) {
- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = null;
+ diagramRoot = null;
diagram = null;
if (diagramFile == null) {
return;
@@ -1057,12 +1057,12 @@
diagramResource.save(Collections.EMPTY_MAP);
} catch (IOException e) {
diagram = null;
- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = null;
+ diagramRoot = null;
return;
}
}
- <%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) diagram.getElement();
- if (<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%> == null) {
+ diagramRoot = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) diagram.getElement();
+ if (diagramRoot == null) {
<%
{
%>
@@ -1082,21 +1082,21 @@
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()%>);
+ diagramRoot = (<%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>) findInResource(<%=resourceToUse%>, <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())%>.class);
+ if (diagramRoot == null) {
+ diagramRoot = <%=importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())%>.eINSTANCE.create<%=genDiagram.getDomainDiagramElement().getClassifierAccessorName()%>();
+ <%=resourceToUse%>.getContents().add(0, diagramRoot);
//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;
+ diagramRoot = null;
return;
}
}
if (!diagram.isSetElement()) {
- diagram.setElement(<%=genDiagram.getDomainDiagramElement().getSafeUncapName()%>);
+ diagram.setElement(diagramRoot);
}
}
}
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.5
diff -u -r1.5 EditorGenerator.java
--- src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java 22 May 2006 18:22:10 -0000 1.5
+++ src-templates/org/eclipse/gmf/codegen/templates/lite/editor/EditorGenerator.java 25 May 2006 11:10:17 -0000
@@ -75,79 +75,65 @@
protected final String TEXT_56 = " command) {" + NL + "\t\t\t";
protected final String TEXT_57 = " cc = new ";
protected final String TEXT_58 = "();" + NL + "\t\t\tcommand.add(cc);" + NL + "\t" + NL + "\t\t\tSetValueCommand setCommand;" + NL + "\t\t\tfor (int i = 0; i < getValues().length; i++) {" + NL + "\t\t\t\tsetCommand = new SetValueCommand(child.getDisplayName());" + NL + "\t\t\t\tsetCommand.setTarget(getPropertySource(getValues()[i]));" + NL + "\t\t\t\tsetCommand.setPropertyId(child.getDescriptor().getId());" + NL + "\t\t\t\tsetCommand.setPropertyValue(child.getValues()[i]);" + NL + "\t\t\t\tcc.add(setCommand);" + NL + "\t\t\t}" + NL + "\t" + NL + "\t\t\t// inform our parent" + NL + "\t\t\tif (getParent() != null)" + NL + "\t\t\t\t((UndoablePropertySheetEntry)getParent()).valueChanged(this, command);" + NL + "\t\t\telse {" + NL + "\t\t\t\t//I am the root entry" + NL + "\t\t\t\tstack.execute(command);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate TransactionalEditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_59 = " ";
- protected final String TEXT_60 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_61 = " 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 ActionRegistry
. (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 *
" + 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 EditPart
action to this editor." + NL + "\t * " + NL + "\t *
" + NL + "\t * EditPart
actions are actions that depend and work on the" + NL + "\t * selected EditPart
s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the EditPart
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 CommandStack
action to this editor." + NL + "\t * " + NL + "\t *
" + NL + "\t * CommandStack
actions are actions that depend and work on" + NL + "\t * the CommandStack
." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the CommandStack
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_62 = 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_63 = ".this, false);" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}";
- protected final String TEXT_64 = 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_65 = " 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_66 = ".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_67 = NL + "\t\t\tnew ";
- protected final String TEXT_68 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);";
- protected final String TEXT_69 = 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\tUndoablePropertySheetEntry rootEntry = new UndoablePropertySheetEntry(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new ";
- protected final String TEXT_70 = "(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_71 = " get";
- protected final String TEXT_72 = "() {" + NL + "\t\treturn ";
- protected final String TEXT_73 = ";" + 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_74 = "() == 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_75 = NL + "\t\tif (getEditorInput() instanceof ";
- protected final String TEXT_76 = ") {" + NL + "\t\t\t";
- protected final String TEXT_77 = " resource = ((";
- protected final String TEXT_78 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().removeResourceChangeListener(getResourceTracker());" + NL + "\t\t}";
- protected final String TEXT_79 = NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsuper.setInput(input);";
- protected final String TEXT_80 = NL + "\t\tif (getEditorInput() instanceof ";
- protected final String TEXT_81 = ") {" + NL + "\t\t\t";
- protected final String TEXT_82 = " resource = ((";
- protected final String TEXT_83 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().addResourceChangeListener(getResourceTracker());" + NL + "\t\t}";
- protected final String TEXT_84 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {";
+ protected final String TEXT_59 = " diagramRoot;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_60 = " 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 ActionRegistry
. (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 *
" + 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 EditPart
action to this editor." + NL + "\t * " + NL + "\t *
" + NL + "\t * EditPart
actions are actions that depend and work on the" + NL + "\t * selected EditPart
s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the EditPart
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 CommandStack
action to this editor." + NL + "\t * " + NL + "\t *
" + NL + "\t * CommandStack
actions are actions that depend and work on" + NL + "\t * the CommandStack
." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the CommandStack
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_61 = 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_62 = ".this, false);" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}";
+ protected final String TEXT_63 = 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_64 = " 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_65 = ".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_66 = NL + "\t\t\tnew ";
+ protected final String TEXT_67 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);";
+ protected final String TEXT_68 = 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\tUndoablePropertySheetEntry rootEntry = new UndoablePropertySheetEntry(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new ";
+ protected final String TEXT_69 = "(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_70 = " getDiagramRoot() {" + NL + "\t\treturn diagramRoot;" + 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 (getDiagramRoot() == 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_71 = NL + "\t\tif (getEditorInput() instanceof ";
+ protected final String TEXT_72 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_73 = " resource = ((";
+ protected final String TEXT_74 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().removeResourceChangeListener(getResourceTracker());" + NL + "\t\t}";
+ protected final String TEXT_75 = NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsuper.setInput(input);";
+ protected final String TEXT_76 = NL + "\t\tif (getEditorInput() instanceof ";
+ protected final String TEXT_77 = ") {" + NL + "\t\t\t";
+ protected final String TEXT_78 = " resource = ((";
+ protected final String TEXT_79 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().addResourceChangeListener(getResourceTracker());" + NL + "\t\t}";
+ protected final String TEXT_80 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {";
+ protected final String TEXT_81 = NL + "\t\tif (input instanceof ";
+ protected final String TEXT_82 = ") {" + NL + "\t\t\treturn ((";
+ protected final String TEXT_83 = ") input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof ";
+ protected final String TEXT_84 = ") {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}";
protected final String TEXT_85 = NL + "\t\tif (input instanceof ";
- protected final String TEXT_86 = ") {" + NL + "\t\t\treturn ((";
- protected final String TEXT_87 = ") input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof ";
- protected final String TEXT_88 = ") {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}";
- protected final String TEXT_89 = NL + "\t\tif (input instanceof ";
- protected final String TEXT_90 = ") {" + NL + "\t\t\treturn URI.createPlatformResourceURI(((IFileEditorInput)input).getFile().getFullPath().toString());" + NL + "\t\t}";
- protected final String TEXT_91 = 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 TransactionalEditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\teditingDomain = ";
- protected final String TEXT_92 = ".INSTANCE.createEditingDomain();" + NL + "\t\t\t//editingDomain.setAdapterFactory(getDomainAdapterFactory());" + 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_93 = NL + "\t\t\tfactories.add(new ";
- protected final String TEXT_94 = "());";
- protected final String TEXT_95 = 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_96 = " = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tTransactionalEditingDomain 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_97 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t";
- protected final String TEXT_98 = " = (";
- protected final String TEXT_99 = ") diagram.getElement();" + NL + "\t\tif (";
- protected final String TEXT_100 = " == null) {";
- protected final String TEXT_101 = NL + "\t\t\tURI modelFile = ";
- protected final String TEXT_102 = ".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_103 = NL + "\t\t\t";
- protected final String TEXT_104 = " = (";
- protected final String TEXT_105 = ") findInResource(";
- protected final String TEXT_106 = ", ";
- protected final String TEXT_107 = ".class);" + NL + "\t\t\tif (";
- protected final String TEXT_108 = " == null) {" + NL + "\t\t\t\t";
- protected final String TEXT_109 = " = ";
- protected final String TEXT_110 = ".eINSTANCE.create";
- protected final String TEXT_111 = "();" + NL + "\t\t\t\t";
- protected final String TEXT_112 = ".getContents().add(0, ";
- protected final String TEXT_113 = ");" + 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_114 = ".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_115 = " = 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_116 = ");" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}";
- protected final String TEXT_117 = 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_118 = "());" + NL + "" + NL + "\t\t";
- protected final String TEXT_119 = " printableLayers = (";
- protected final String TEXT_120 = ") root.getLayer(";
- protected final String TEXT_121 = ".PRINTABLE_LAYERS);" + NL + "\t\t";
- protected final String TEXT_122 = " extLabelsLayer = new ";
- protected final String TEXT_123 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new ";
- protected final String TEXT_124 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, ";
- protected final String TEXT_125 = ".EXTERNAL_NODE_LABELS_LAYER, ";
- protected final String TEXT_126 = ".PRIMARY_LAYER);" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + 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_127 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu(";
- protected final String TEXT_128 = ".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_129 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
- protected final String TEXT_130 = "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_131 = NL;
+ protected final String TEXT_86 = ") {" + NL + "\t\t\treturn URI.createPlatformResourceURI(((IFileEditorInput)input).getFile().getFullPath().toString());" + NL + "\t\t}";
+ protected final String TEXT_87 = 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 TransactionalEditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\teditingDomain = ";
+ protected final String TEXT_88 = ".INSTANCE.createEditingDomain();" + NL + "\t\t\t//editingDomain.setAdapterFactory(getDomainAdapterFactory());" + 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_89 = NL + "\t\t\tfactories.add(new ";
+ protected final String TEXT_90 = "());";
+ protected final String TEXT_91 = 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\tdiagramRoot = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tTransactionalEditingDomain 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\tdiagramRoot = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tdiagramRoot = (";
+ protected final String TEXT_92 = ") diagram.getElement();" + NL + "\t\tif (diagramRoot == null) {";
+ protected final String TEXT_93 = NL + "\t\t\tURI modelFile = ";
+ protected final String TEXT_94 = ".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_95 = NL + "\t\t\tdiagramRoot = (";
+ protected final String TEXT_96 = ") findInResource(";
+ protected final String TEXT_97 = ", ";
+ protected final String TEXT_98 = ".class);" + NL + "\t\t\tif (diagramRoot == null) {" + NL + "\t\t\t\tdiagramRoot = ";
+ protected final String TEXT_99 = ".eINSTANCE.create";
+ protected final String TEXT_100 = "();" + NL + "\t\t\t\t";
+ protected final String TEXT_101 = ".getContents().add(0, diagramRoot);" + 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_102 = ".save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t} catch (IOException e) {" + NL + "\t\t\t\t\tdiagram = null;" + NL + "\t\t\t\t\tdiagramRoot = 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(diagramRoot);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}";
+ protected final String TEXT_103 = 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_104 = "());" + NL + "" + NL + "\t\t";
+ protected final String TEXT_105 = " printableLayers = (";
+ protected final String TEXT_106 = ") root.getLayer(";
+ protected final String TEXT_107 = ".PRINTABLE_LAYERS);" + NL + "\t\t";
+ protected final String TEXT_108 = " extLabelsLayer = new ";
+ protected final String TEXT_109 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new ";
+ protected final String TEXT_110 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, ";
+ protected final String TEXT_111 = ".EXTERNAL_NODE_LABELS_LAYER, ";
+ protected final String TEXT_112 = ".PRIMARY_LAYER);" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + 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_113 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu(";
+ protected final String TEXT_114 = ".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_115 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic ";
+ protected final String TEXT_116 = "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_117 = NL;
public String generate(Object argument)
{
@@ -366,111 +352,95 @@
stringBuffer.append(TEXT_58);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()));
stringBuffer.append(TEXT_59);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_60);
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram"));
- stringBuffer.append(TEXT_61);
+ stringBuffer.append(TEXT_60);
if (!isRichClientPlatform) {
- stringBuffer.append(TEXT_62);
+ stringBuffer.append(TEXT_61);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_63);
+ stringBuffer.append(TEXT_62);
}
- stringBuffer.append(TEXT_64);
+ stringBuffer.append(TEXT_63);
stringBuffer.append(genDiagram.getEditorGen().getDomainGenModel().getModelName());
- stringBuffer.append(TEXT_65);
+ stringBuffer.append(TEXT_64);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_66);
+ stringBuffer.append(TEXT_65);
{
final Palette palette = genDiagram.getPalette();
if (palette != null) {
- stringBuffer.append(TEXT_67);
+ stringBuffer.append(TEXT_66);
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_68);
+ stringBuffer.append(TEXT_67);
}
}
- stringBuffer.append(TEXT_69);
+ stringBuffer.append(TEXT_68);
stringBuffer.append(importManager.getImportedName(genDiagram.getPropertyProviderQualifiedClassName()));
- stringBuffer.append(TEXT_70);
+ stringBuffer.append(TEXT_69);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_71);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName());
- stringBuffer.append(TEXT_72);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_73);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName());
- stringBuffer.append(TEXT_74);
+ stringBuffer.append(TEXT_70);
if (!isRichClientPlatform) {
- stringBuffer.append(TEXT_75);
+ stringBuffer.append(TEXT_71);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_76);
+ stringBuffer.append(TEXT_72);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile"));
- stringBuffer.append(TEXT_77);
+ stringBuffer.append(TEXT_73);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_78);
+ stringBuffer.append(TEXT_74);
}
- stringBuffer.append(TEXT_79);
+ stringBuffer.append(TEXT_75);
if (!isRichClientPlatform) {
- stringBuffer.append(TEXT_80);
+ stringBuffer.append(TEXT_76);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_81);
+ stringBuffer.append(TEXT_77);
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile"));
- stringBuffer.append(TEXT_82);
+ stringBuffer.append(TEXT_78);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_83);
+ stringBuffer.append(TEXT_79);
}
- stringBuffer.append(TEXT_84);
+ stringBuffer.append(TEXT_80);
if (isRichClientPlatform) {
- stringBuffer.append(TEXT_85);
+ stringBuffer.append(TEXT_81);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput"));
- stringBuffer.append(TEXT_86);
+ stringBuffer.append(TEXT_82);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput"));
- stringBuffer.append(TEXT_87);
+ stringBuffer.append(TEXT_83);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPathEditorInput"));
- stringBuffer.append(TEXT_88);
+ stringBuffer.append(TEXT_84);
} else {
- stringBuffer.append(TEXT_89);
+ stringBuffer.append(TEXT_85);
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput"));
- stringBuffer.append(TEXT_90);
+ stringBuffer.append(TEXT_86);
}
- stringBuffer.append(TEXT_91);
+ stringBuffer.append(TEXT_87);
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.WorkspaceEditingDomainFactory"));
- stringBuffer.append(TEXT_92);
+ stringBuffer.append(TEXT_88);
final EList genPackages = genDiagram.getEditorGen().getAllDomainGenPackages(true);
for (int i = 0; i < genPackages.size(); i++) {
GenPackage genPackage = (GenPackage) genPackages.get(i);
- stringBuffer.append(TEXT_93);
+ stringBuffer.append(TEXT_89);
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedItemProviderAdapterFactoryClassName()));
- stringBuffer.append(TEXT_94);
+ stringBuffer.append(TEXT_90);
}
- stringBuffer.append(TEXT_95);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_96);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_97);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_98);
+ stringBuffer.append(TEXT_91);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_99);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_100);
+ stringBuffer.append(TEXT_92);
{
@@ -479,74 +449,62 @@
String resourceToUse;
if (!sameFile) {
- stringBuffer.append(TEXT_101);
+ stringBuffer.append(TEXT_93);
stringBuffer.append(genDiagram.getDiagramEditorUtilClassName());
- stringBuffer.append(TEXT_102);
+ stringBuffer.append(TEXT_94);
resourceToUse = "modelResource";
} else {
resourceToUse = "diagramResource";
}
- stringBuffer.append(TEXT_103);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_104);
+ stringBuffer.append(TEXT_95);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_105);
+ stringBuffer.append(TEXT_96);
stringBuffer.append(resourceToUse);
- stringBuffer.append(TEXT_106);
+ stringBuffer.append(TEXT_97);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName()));
- stringBuffer.append(TEXT_107);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_108);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_109);
+ stringBuffer.append(TEXT_98);
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName()));
- stringBuffer.append(TEXT_110);
+ stringBuffer.append(TEXT_99);
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName());
- stringBuffer.append(TEXT_111);
+ stringBuffer.append(TEXT_100);
stringBuffer.append(resourceToUse);
- stringBuffer.append(TEXT_112);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_113);
+ stringBuffer.append(TEXT_101);
stringBuffer.append(resourceToUse);
- stringBuffer.append(TEXT_114);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_115);
- stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName());
- stringBuffer.append(TEXT_116);
+ stringBuffer.append(TEXT_102);
}
- stringBuffer.append(TEXT_117);
+ stringBuffer.append(TEXT_103);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_118);
+ stringBuffer.append(TEXT_104);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane"));
- stringBuffer.append(TEXT_119);
+ stringBuffer.append(TEXT_105);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane"));
- stringBuffer.append(TEXT_120);
+ stringBuffer.append(TEXT_106);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants"));
- stringBuffer.append(TEXT_121);
+ stringBuffer.append(TEXT_107);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer"));
- stringBuffer.append(TEXT_122);
+ stringBuffer.append(TEXT_108);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer"));
- stringBuffer.append(TEXT_123);
+ stringBuffer.append(TEXT_109);
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.DelegatingLayout"));
- stringBuffer.append(TEXT_124);
+ stringBuffer.append(TEXT_110);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName()));
- stringBuffer.append(TEXT_125);
+ stringBuffer.append(TEXT_111);
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants"));
- stringBuffer.append(TEXT_126);
+ stringBuffer.append(TEXT_112);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_127);
+ stringBuffer.append(TEXT_113);
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()));
- stringBuffer.append(TEXT_128);
+ stringBuffer.append(TEXT_114);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_129);
+ stringBuffer.append(TEXT_115);
stringBuffer.append(genEditor.getClassName());
- stringBuffer.append(TEXT_130);
+ stringBuffer.append(TEXT_116);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_131);
+ stringBuffer.append(TEXT_117);
return stringBuffer.toString();
}
}
#P org.eclipse.gmf.tests
Index: src/org/eclipse/gmf/tests/setup/DiaGenSetup.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/DiaGenSetup.java,v
retrieving revision 1.35
diff -u -r1.35 DiaGenSetup.java
--- src/org/eclipse/gmf/tests/setup/DiaGenSetup.java 14 May 2006 16:22:37 -0000 1.35
+++ src/org/eclipse/gmf/tests/setup/DiaGenSetup.java 25 May 2006 11:10:20 -0000
@@ -27,7 +27,9 @@
import org.eclipse.gmf.bridge.genmodel.DiagramGenModelTransformer;
import org.eclipse.gmf.bridge.genmodel.DiagramRunTimeModelHelper;
import org.eclipse.gmf.bridge.genmodel.GenModelMatcher;
+import org.eclipse.gmf.bridge.genmodel.InnerClassViewmapProducer;
import org.eclipse.gmf.bridge.genmodel.RuntimeGenModelAccess;
+import org.eclipse.gmf.bridge.genmodel.ViewmapProducer;
import org.eclipse.gmf.codegen.gmfgen.FeatureLabelModelFacet;
import org.eclipse.gmf.codegen.gmfgen.FigureViewmap;
import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory;
@@ -46,6 +48,7 @@
import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet;
import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet;
import org.eclipse.gmf.codegen.gmfgen.Viewmap;
+import org.eclipse.gmf.internal.bridge.NaiveIdentifierDispenser;
import org.eclipse.gmf.internal.bridge.naming.CollectingDispenser;
import org.eclipse.gmf.internal.bridge.naming.NamingStrategy;
import org.eclipse.gmf.internal.bridge.naming.gen.GenModelNamingMediatorImpl;
@@ -62,8 +65,14 @@
private GenLink myLinkC;
private GenLink myLinkD;
private GenNode myNodeB;
+ private ViewmapProducer myViewmapProducer;
public DiaGenSetup() {
+ this(new InnerClassViewmapProducer());
+ }
+
+ public DiaGenSetup(ViewmapProducer viewmapProducer) {
+ myViewmapProducer = viewmapProducer;
}
/**
@@ -172,7 +181,7 @@
final DiagramRunTimeModelHelper drth = new BasicDiagramRunTimeModelHelper();
final CollectingDispenser uniquenessDispenser = new CollectingDispenser();
final GenModelNamingMediatorImpl namingMediator = new GenModelNamingMediatorImpl(uniquenessDispenser);
- DiagramGenModelTransformer t = new DiagramGenModelTransformer(drth, namingMediator);
+ DiagramGenModelTransformer t = new DiagramGenModelTransformer(drth, namingMediator, myViewmapProducer, new NaiveIdentifierDispenser());
t.setEMFGenModel(initGenModel(mapSource.getMapping().getDiagram().getDomainModel()));
t.transform(mapSource.getMapping());
myGenDiagram = t.getResult().getDiagram();
Index: src/org/eclipse/gmf/tests/gen/CompilationTest.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/CompilationTest.java,v
retrieving revision 1.13
diff -u -r1.13 CompilationTest.java
--- src/org/eclipse/gmf/tests/gen/CompilationTest.java 24 May 2006 18:05:31 -0000 1.13
+++ src/org/eclipse/gmf/tests/gen/CompilationTest.java 25 May 2006 11:10:19 -0000
@@ -17,6 +17,8 @@
import junit.framework.TestCase;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.gmf.bridge.genmodel.InnerClassViewmapProducer;
+import org.eclipse.gmf.bridge.genmodel.ViewmapProducer;
import org.eclipse.gmf.tests.Plugin;
import org.eclipse.gmf.tests.setup.DiaGenSetup;
import org.eclipse.gmf.tests.setup.DomainModelSetup;
@@ -71,7 +73,7 @@
domainModel.getNodeB().getNameAttr().setName("class");
domainModel.getDiagramElement().setName("Diagram");
MapDefSource mapSource = new MapSetup().init(new DiaDefSetup(null).init(), domainModel, new ToolDefSetup());
- DiaGenSource gmfGenSource = new DiaGenSetup().init(mapSource);
+ DiaGenSource gmfGenSource = new DiaGenSetup(getViewmapProducer()).init(mapSource);
generateAndCompile(gmfGenSource);
}
@@ -103,7 +105,11 @@
return new RuntimeBasedGeneratorConfiguration();
}
+ protected ViewmapProducer getViewmapProducer() {
+ return new InnerClassViewmapProducer();
+ }
+
protected void tearDown() throws Exception {
super.tearDown();
}
-}
+}
\ No newline at end of file