Lines 2-7
Link Here
|
2 |
|
2 |
|
3 |
import org.eclipse.gmf.codegen.gmfgen.*; |
3 |
import org.eclipse.gmf.codegen.gmfgen.*; |
4 |
import org.eclipse.gmf.common.codegen.*; |
4 |
import org.eclipse.gmf.common.codegen.*; |
|
|
5 |
import org.eclipse.emf.codegen.ecore.genmodel.*; |
6 |
import org.eclipse.emf.ecore.*; |
5 |
|
7 |
|
6 |
public class CreationWizardPageGenerator |
8 |
public class CreationWizardPageGenerator |
7 |
{ |
9 |
{ |
Lines 78-119
Link Here
|
78 |
protected final String TEXT_61 = " != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; |
80 |
protected final String TEXT_61 = " != null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */"; |
79 |
protected final String TEXT_62 = NL + "\tprivate URI createDiagramFile(IProgressMonitor monitor) {"; |
81 |
protected final String TEXT_62 = NL + "\tprivate URI createDiagramFile(IProgressMonitor monitor) {"; |
80 |
protected final String TEXT_63 = NL + "\tprivate IFile createDiagramFile(IProgressMonitor monitor) {"; |
82 |
protected final String TEXT_63 = NL + "\tprivate IFile createDiagramFile(IProgressMonitor monitor) {"; |
81 |
protected final String TEXT_64 = NL + "\t\t//TODO: Editing domain!" + NL + "\t\t"; |
83 |
protected final String TEXT_64 = NL + "\t\t"; |
82 |
protected final String TEXT_65 = " resourceSet = new "; |
84 |
protected final String TEXT_65 = " editingDomain = "; |
83 |
protected final String TEXT_66 = "();"; |
85 |
protected final String TEXT_66 = ".INSTANCE.createEditingDomain();" + NL + "\t\t"; |
84 |
protected final String TEXT_67 = NL + "\t\tfinal "; |
86 |
protected final String TEXT_67 = " resourceSet = editingDomain.getResourceSet();"; |
85 |
protected final String TEXT_68 = " diagramResource = resourceSet.createResource(getDiagramFileURI());"; |
87 |
protected final String TEXT_68 = NL + "\t\tfinal "; |
86 |
protected final String TEXT_69 = NL + "\t\tIPath diagramFilePath = getContainerFullPath().append(getFileName());" + NL + "\t\tif (diagramFilePath.getFileExtension() == null) {" + NL + "\t\t\tdiagramFilePath = diagramFilePath.addFileExtension(\""; |
88 |
protected final String TEXT_69 = " diagramResource = resourceSet.createResource(getDiagramFileURI());"; |
87 |
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 "; |
89 |
protected final String TEXT_70 = NL + "\t\tIPath diagramFilePath = getContainerFullPath().append(getFileName());" + NL + "\t\tif (diagramFilePath.getFileExtension() == null) {" + NL + "\t\t\tdiagramFilePath = diagramFilePath.addFileExtension(\""; |
88 |
protected final String TEXT_71 = " diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFilePath.toString()));"; |
90 |
protected final String TEXT_71 = "\");\t\t//$NON-NLS-1$" + NL + "\t\t}" + NL + "\t\tfinal IFile diagramFile = ResourcesPlugin.getWorkspace().getRoot().getFile(diagramFilePath);" + NL + "\t\tfinal "; |
89 |
protected final String TEXT_72 = NL + "\t\tfinal Resource modelResource = resourceSet.createResource(getModelFileURI());"; |
91 |
protected final String TEXT_72 = " diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFilePath.toString()));"; |
90 |
protected final String TEXT_73 = NL + "\t\tIPath modelFilePath = diagramFilePath.removeFileExtension().addFileExtension(\""; |
92 |
protected final String TEXT_73 = NL + "\t\tfinal Resource modelResource = resourceSet.createResource(getModelFileURI());"; |
91 |
protected final String TEXT_74 = "\"); //$NON-NLS-1$" + NL + "\t\tfinal Resource modelResource = resourceSet.createResource(URI.createPlatformResourceURI(modelFilePath.toString()));"; |
93 |
protected final String TEXT_74 = NL + "\t\tIPath modelFilePath = diagramFilePath.removeFileExtension().addFileExtension(\""; |
92 |
protected final String TEXT_75 = NL + NL + "\t\tif (diagramResource != null"; |
94 |
protected final String TEXT_75 = "\"); //$NON-NLS-1$" + NL + "\t\tfinal Resource modelResource = resourceSet.createResource(URI.createPlatformResourceURI(modelFilePath.toString()));"; |
93 |
protected final String TEXT_76 = " && modelResource != null"; |
95 |
protected final String TEXT_76 = NL + NL + "\t\tif (diagramResource != null"; |
94 |
protected final String TEXT_77 = ") {" + NL + "\t\t\t//TODO: Editing domain!" + NL + "\t\t\t"; |
96 |
protected final String TEXT_77 = " && modelResource != null"; |
95 |
protected final String TEXT_78 = " model = "; |
97 |
protected final String TEXT_78 = ") {" + NL + "\t\t\t"; |
96 |
protected final String TEXT_79 = ".eINSTANCE.create"; |
98 |
protected final String TEXT_79 = " saveOperation = new "; |
97 |
protected final String TEXT_80 = "();"; |
99 |
protected final String TEXT_80 = "(editingDomain, \"Create diagram\") {" + NL + "\t\t\t\tpublic "; |
98 |
protected final String TEXT_81 = NL + "\t\t\tmodelResource.getContents().add(model);" + NL + "\t\t\ttry {" + NL + "\t\t\t\tmodelResource.save("; |
100 |
protected final String TEXT_81 = " doExecute("; |
99 |
protected final String TEXT_82 = ".EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\thandleSaveException(e);" + NL + "\t\t\t}"; |
101 |
protected final String TEXT_82 = " monitor, "; |
100 |
protected final String TEXT_83 = NL + "\t\t\tdiagramResource.getContents().add(model);"; |
102 |
protected final String TEXT_83 = " info) throws "; |
101 |
protected final String TEXT_84 = NL + "\t\t\t"; |
103 |
protected final String TEXT_84 = " {"; |
102 |
protected final String TEXT_85 = " diagram = "; |
104 |
protected final String TEXT_85 = NL + "\t\t\t\t\t"; |
103 |
protected final String TEXT_86 = ".eINSTANCE.createDiagram();" + NL + "\t\t\tdiagram.setElement("; |
105 |
protected final String TEXT_86 = " model = "; |
104 |
protected final String TEXT_87 = "("; |
106 |
protected final String TEXT_87 = ".eINSTANCE.create"; |
105 |
protected final String TEXT_88 = ") "; |
107 |
protected final String TEXT_88 = "();"; |
106 |
protected final String TEXT_89 = "model);" + NL + "\t\t\t"; |
108 |
protected final String TEXT_89 = NL + "\t\t\t\t\tmodelResource.getContents().add(createInitialRoot(model));"; |
107 |
protected final String TEXT_90 = ".INSTANCE.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}"; |
109 |
protected final String TEXT_90 = NL + "\t\t\t\t\tmodelResource.getContents().add(model);"; |
108 |
protected final String TEXT_91 = NL + "\t\tboolean result = "; |
110 |
protected final String TEXT_91 = NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tmodelResource.save("; |
109 |
protected final String TEXT_92 = ".openEditor(getDiagramFileURI());" + NL + "\t\tif (!result) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn getDiagramFileURI();"; |
111 |
protected final String TEXT_92 = ".EMPTY_MAP);" + NL + "\t\t\t\t\t} catch (IOException e) {" + NL + "\t\t\t\t\t\thandleSaveException(e);" + NL + "\t\t\t\t\t}"; |
110 |
protected final String TEXT_93 = NL + "\t\ttry {" + NL + "\t\t\t"; |
112 |
protected final String TEXT_93 = NL + "\t\t\t\t\tdiagramResource.getContents().add(model);"; |
111 |
protected final String TEXT_94 = ".openEditor("; |
113 |
protected final String TEXT_94 = NL + "\t\t\t\t\t"; |
112 |
protected final String TEXT_95 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage(), diagramFile);" + NL + "\t\t} catch ("; |
114 |
protected final String TEXT_95 = " diagram = "; |
113 |
protected final String TEXT_96 = " e) {" + NL + "\t\t\t"; |
115 |
protected final String TEXT_96 = ".eINSTANCE.createDiagram();" + NL + "\t\t\t\t\tdiagram.setElement("; |
114 |
protected final String TEXT_97 = ".getInstance().getLog().log(e.getStatus());" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFile;"; |
116 |
protected final String TEXT_97 = "("; |
115 |
protected final String TEXT_98 = 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 + "}"; |
117 |
protected final String TEXT_98 = ") "; |
116 |
protected final String TEXT_99 = NL; |
118 |
protected final String TEXT_99 = "model);" + NL + "\t\t\t\t\t"; |
|
|
119 |
protected final String TEXT_100 = ".INSTANCE.decorateView(diagram);" + NL + "\t\t\t\t\tdiagramResource.getContents().add(diagram);" + NL + "\t\t\t\t\ttry {" + NL + "\t\t\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t\t} catch (IOException e) {" + NL + "\t\t\t\t\t\thandleSaveException(e);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\treturn "; |
120 |
protected final String TEXT_101 = ".OK_STATUS;" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "\t\t\ttry {" + NL + "\t\t\t\tsaveOperation.execute(new "; |
121 |
protected final String TEXT_102 = "(), null);" + NL + "\t\t\t} catch ("; |
122 |
protected final String TEXT_103 = " e) {" + NL + "\t\t\t\t"; |
123 |
protected final String TEXT_104 = ".getInstance().logError(\"exception occurred while creating the diagram\", e);" + NL + "\t\t\t\treturn null;" + NL + "\t\t\t}" + NL + "\t\t}"; |
124 |
protected final String TEXT_105 = NL + "\t\tboolean result = "; |
125 |
protected final String TEXT_106 = ".openEditor(getDiagramFileURI());" + NL + "\t\tif (!result) {" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn getDiagramFileURI();"; |
126 |
protected final String TEXT_107 = NL + "\t\ttry {" + NL + "\t\t\t"; |
127 |
protected final String TEXT_108 = ".openEditor("; |
128 |
protected final String TEXT_109 = ".getWorkbench().getActiveWorkbenchWindow().getActivePage(), diagramFile);" + NL + "\t\t} catch ("; |
129 |
protected final String TEXT_110 = " e) {" + NL + "\t\t\t"; |
130 |
protected final String TEXT_111 = ".getInstance().getLog().log(e.getStatus());" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t\treturn diagramFile;"; |
131 |
protected final String TEXT_112 = NL + "\t}" + NL; |
132 |
protected final String TEXT_113 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static "; |
133 |
protected final String TEXT_114 = " createInitialRoot("; |
134 |
protected final String TEXT_115 = " model) {"; |
135 |
protected final String TEXT_116 = NL + "\t\t"; |
136 |
protected final String TEXT_117 = " docRoot = "; |
137 |
protected final String TEXT_118 = "."; |
138 |
protected final String TEXT_119 = ".create"; |
139 |
protected final String TEXT_120 = "();" + NL + "\t\tdocRoot.set"; |
140 |
protected final String TEXT_121 = "(model);" + NL + "\t\treturn docRoot;" + NL + "\t}" + NL; |
141 |
protected final String TEXT_122 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void handleSaveException(IOException e) throws "; |
142 |
protected final String TEXT_123 = " {" + NL + "\t\tthrow new "; |
143 |
protected final String TEXT_124 = "(\"Save failed\", e);" + NL + "\t}" + NL + "}"; |
144 |
protected final String TEXT_125 = NL; |
117 |
|
145 |
|
118 |
public String generate(Object argument) |
146 |
public String generate(Object argument) |
119 |
{ |
147 |
{ |
Lines 327-350
Link Here
|
327 |
stringBuffer.append(TEXT_63); |
355 |
stringBuffer.append(TEXT_63); |
328 |
} |
356 |
} |
329 |
stringBuffer.append(TEXT_64); |
357 |
stringBuffer.append(TEXT_64); |
330 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); |
358 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.transaction.TransactionalEditingDomain")); |
331 |
stringBuffer.append(TEXT_65); |
359 |
stringBuffer.append(TEXT_65); |
332 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.impl.ResourceSetImpl")); |
360 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.WorkspaceEditingDomainFactory")); |
333 |
stringBuffer.append(TEXT_66); |
361 |
stringBuffer.append(TEXT_66); |
|
|
362 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.ResourceSet")); |
363 |
stringBuffer.append(TEXT_67); |
334 |
|
364 |
|
335 |
if (isRichClientPlatform) { |
365 |
if (isRichClientPlatform) { |
336 |
|
366 |
|
337 |
stringBuffer.append(TEXT_67); |
|
|
338 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); |
339 |
stringBuffer.append(TEXT_68); |
367 |
stringBuffer.append(TEXT_68); |
|
|
368 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); |
369 |
stringBuffer.append(TEXT_69); |
340 |
|
370 |
|
341 |
} else { |
371 |
} else { |
342 |
|
372 |
|
343 |
stringBuffer.append(TEXT_69); |
|
|
344 |
stringBuffer.append(editorGen.getDiagramFileExtension()); |
345 |
stringBuffer.append(TEXT_70); |
373 |
stringBuffer.append(TEXT_70); |
346 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); |
374 |
stringBuffer.append(editorGen.getDiagramFileExtension()); |
347 |
stringBuffer.append(TEXT_71); |
375 |
stringBuffer.append(TEXT_71); |
|
|
376 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.resource.Resource")); |
377 |
stringBuffer.append(TEXT_72); |
348 |
|
378 |
|
349 |
} |
379 |
} |
350 |
|
380 |
|
Lines 353-430
Link Here
|
353 |
if (standaloneDomainModel) { |
383 |
if (standaloneDomainModel) { |
354 |
if (isRichClientPlatform) { |
384 |
if (isRichClientPlatform) { |
355 |
|
385 |
|
356 |
stringBuffer.append(TEXT_72); |
386 |
stringBuffer.append(TEXT_73); |
357 |
|
387 |
|
358 |
} else { |
388 |
} else { |
359 |
|
389 |
|
360 |
stringBuffer.append(TEXT_73); |
|
|
361 |
stringBuffer.append(editorGen.getDomainFileExtension()); |
362 |
stringBuffer.append(TEXT_74); |
390 |
stringBuffer.append(TEXT_74); |
|
|
391 |
stringBuffer.append(editorGen.getDomainFileExtension()); |
392 |
stringBuffer.append(TEXT_75); |
363 |
|
393 |
|
364 |
} |
394 |
} |
365 |
} |
395 |
} |
366 |
|
396 |
|
367 |
stringBuffer.append(TEXT_75); |
|
|
368 |
if (standaloneDomainModel) { |
369 |
stringBuffer.append(TEXT_76); |
397 |
stringBuffer.append(TEXT_76); |
370 |
} |
398 |
if (standaloneDomainModel) { |
371 |
stringBuffer.append(TEXT_77); |
399 |
stringBuffer.append(TEXT_77); |
372 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
400 |
} |
373 |
stringBuffer.append(TEXT_78); |
401 |
stringBuffer.append(TEXT_78); |
374 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); |
402 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.AbstractEMFOperation")); |
375 |
stringBuffer.append(TEXT_79); |
403 |
stringBuffer.append(TEXT_79); |
376 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
404 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.workspace.AbstractEMFOperation")); |
377 |
stringBuffer.append(TEXT_80); |
405 |
stringBuffer.append(TEXT_80); |
|
|
406 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IStatus")); |
407 |
stringBuffer.append(TEXT_81); |
408 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IProgressMonitor")); |
409 |
stringBuffer.append(TEXT_82); |
410 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.IAdaptable")); |
411 |
stringBuffer.append(TEXT_83); |
412 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.commands.ExecutionException")); |
413 |
stringBuffer.append(TEXT_84); |
378 |
|
414 |
|
379 |
if (standaloneDomainModel) { |
415 |
if (genDiagram.getDomainDiagramElement() != null) { |
380 |
|
416 |
|
381 |
stringBuffer.append(TEXT_81); |
417 |
stringBuffer.append(TEXT_85); |
|
|
418 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
419 |
stringBuffer.append(TEXT_86); |
420 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); |
421 |
stringBuffer.append(TEXT_87); |
422 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
423 |
stringBuffer.append(TEXT_88); |
424 |
|
425 |
if (standaloneDomainModel) { |
426 |
if (genDiagram.getDomainDiagramElement().getGenPackage().hasDocumentRoot()) { |
427 |
|
428 |
stringBuffer.append(TEXT_89); |
429 |
|
430 |
} else { |
431 |
|
432 |
stringBuffer.append(TEXT_90); |
433 |
|
434 |
} |
435 |
|
436 |
stringBuffer.append(TEXT_91); |
382 |
stringBuffer.append(importManager.getImportedName("java.util.Collections")); |
437 |
stringBuffer.append(importManager.getImportedName("java.util.Collections")); |
383 |
stringBuffer.append(TEXT_82); |
438 |
stringBuffer.append(TEXT_92); |
384 |
|
439 |
|
385 |
} else { |
440 |
} else { |
386 |
|
441 |
|
387 |
stringBuffer.append(TEXT_83); |
442 |
stringBuffer.append(TEXT_93); |
388 |
|
443 |
|
|
|
444 |
} |
389 |
} |
445 |
} |
390 |
|
446 |
|
391 |
stringBuffer.append(TEXT_84); |
447 |
stringBuffer.append(TEXT_94); |
392 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); |
448 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); |
393 |
stringBuffer.append(TEXT_85); |
449 |
stringBuffer.append(TEXT_95); |
394 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); |
450 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.NotationFactory")); |
395 |
stringBuffer.append(TEXT_86); |
451 |
stringBuffer.append(TEXT_96); |
396 |
if (genDiagram.getDomainDiagramElement().isExternalInterface()) { |
452 |
if (genDiagram.getDomainDiagramElement().isExternalInterface()) { |
397 |
stringBuffer.append(TEXT_87); |
453 |
stringBuffer.append(TEXT_97); |
398 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
454 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
399 |
stringBuffer.append(TEXT_88); |
455 |
stringBuffer.append(TEXT_98); |
400 |
} |
456 |
} |
401 |
stringBuffer.append(TEXT_89); |
457 |
stringBuffer.append(TEXT_99); |
402 |
stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoryQualifiedClassName())); |
458 |
stringBuffer.append(importManager.getImportedName(genDiagram.getNotationViewFactoryQualifiedClassName())); |
403 |
stringBuffer.append(TEXT_90); |
459 |
stringBuffer.append(TEXT_100); |
|
|
460 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.Status")); |
461 |
stringBuffer.append(TEXT_101); |
462 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.runtime.NullProgressMonitor")); |
463 |
stringBuffer.append(TEXT_102); |
464 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.commands.ExecutionException")); |
465 |
stringBuffer.append(TEXT_103); |
466 |
stringBuffer.append(genPlugin.getActivatorClassName()); |
467 |
stringBuffer.append(TEXT_104); |
404 |
|
468 |
|
405 |
if (isRichClientPlatform) { |
469 |
if (isRichClientPlatform) { |
406 |
|
470 |
|
407 |
stringBuffer.append(TEXT_91); |
471 |
stringBuffer.append(TEXT_105); |
408 |
stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); |
472 |
stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); |
409 |
stringBuffer.append(TEXT_92); |
473 |
stringBuffer.append(TEXT_106); |
410 |
|
474 |
|
411 |
} else { |
475 |
} else { |
412 |
|
476 |
|
413 |
stringBuffer.append(TEXT_93); |
477 |
stringBuffer.append(TEXT_107); |
414 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.ide.IDE")); |
478 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.ide.IDE")); |
415 |
stringBuffer.append(TEXT_94); |
479 |
stringBuffer.append(TEXT_108); |
416 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); |
480 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PlatformUI")); |
417 |
stringBuffer.append(TEXT_95); |
481 |
stringBuffer.append(TEXT_109); |
418 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); |
482 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.PartInitException")); |
419 |
stringBuffer.append(TEXT_96); |
483 |
stringBuffer.append(TEXT_110); |
420 |
stringBuffer.append(genPlugin.getActivatorClassName()); |
484 |
stringBuffer.append(genPlugin.getActivatorClassName()); |
421 |
stringBuffer.append(TEXT_97); |
485 |
stringBuffer.append(TEXT_111); |
422 |
|
486 |
|
423 |
} |
487 |
} |
424 |
|
488 |
|
425 |
stringBuffer.append(TEXT_98); |
489 |
stringBuffer.append(TEXT_112); |
|
|
490 |
|
491 |
if (standaloneDomainModel && genDiagram.getDomainDiagramElement().getGenPackage().hasDocumentRoot()) { |
492 |
|
493 |
stringBuffer.append(TEXT_113); |
494 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); |
495 |
stringBuffer.append(TEXT_114); |
496 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
497 |
stringBuffer.append(TEXT_115); |
498 |
|
499 |
// would be better to get GenClass for docRoot and directly use setter |
500 |
GenClass docRoot = genDiagram.getDomainDiagramElement().getGenPackage().getDocumentRoot(); |
501 |
String featureAccessor = "null"; // Alternative is: genDiagram.getDomainDiagramElement().getInterfaceName(); although it's a hack. Seems better to fail right away |
502 |
for (java.util.Iterator it = docRoot.getGenFeatures().iterator(); it.hasNext(); ) { |
503 |
GenFeature genFeature = (GenFeature) it.next(); |
504 |
boolean unspecifiedUpperBound = ETypedElement.UNSPECIFIED_MULTIPLICITY == genFeature.getEcoreFeature().getUpperBound(); |
505 |
// Perhaps, makes sense to check instanceof EReference && isContainment |
506 |
if (genFeature.isSet() && unspecifiedUpperBound && genDiagram.getDomainDiagramElement().equals(genFeature.getTypeGenClass())) { |
507 |
featureAccessor = genFeature.getAccessorName(); |
508 |
break; |
509 |
} |
510 |
} /*for*/ |
511 |
|
512 |
stringBuffer.append(TEXT_116); |
513 |
stringBuffer.append(importManager.getImportedName(docRoot.getQualifiedInterfaceName())); |
514 |
stringBuffer.append(TEXT_117); |
515 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryInterfaceName())); |
516 |
stringBuffer.append(TEXT_118); |
517 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getGenPackage().getFactoryInstanceName()); |
518 |
stringBuffer.append(TEXT_119); |
519 |
stringBuffer.append(docRoot.getName()); |
520 |
stringBuffer.append(TEXT_120); |
521 |
stringBuffer.append(featureAccessor); |
522 |
stringBuffer.append(TEXT_121); |
523 |
|
524 |
} /*if standaloneDomainModel && genDiagram.getDomainDiagramElement().getGenPackage().hasDocumentRoot()*/ |
525 |
|
526 |
stringBuffer.append(TEXT_122); |
527 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.commands.ExecutionException")); |
528 |
stringBuffer.append(TEXT_123); |
529 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.commands.ExecutionException")); |
530 |
stringBuffer.append(TEXT_124); |
426 |
importManager.emitSortedImports(); |
531 |
importManager.emitSortedImports(); |
427 |
stringBuffer.append(TEXT_99); |
532 |
stringBuffer.append(TEXT_125); |
428 |
return stringBuffer.toString(); |
533 |
return stringBuffer.toString(); |
429 |
} |
534 |
} |
430 |
} |
535 |
} |