| /* |
| * Copyright (c) 2007, 2010, 2013 Borland Software Corporation and others |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| «IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'» |
| «EXTENSION xpt::editor::GenDiagram» |
| «EXTENSION xpt::editor::Utils» |
| |
| «DEFINE DiagramEditorUtil FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::copyright FOR editorGen-» |
| package «editorGen.editor.packageName»; |
| |
| «EXPAND xpt::Common::generatedClassComment» |
| public class «diagramEditorUtilClassName» { |
| |
| «EXPAND saveOptions-» |
| |
| «EXPAND openDiagramMethod-» |
| «IF editorGen.application = null-» |
| |
| «EXPAND setCharsetMethods-» |
| «ENDIF-» |
| |
| «EXPAND getUniqueFileNameMethod-» |
| |
| «IF editorGen.application <> null» |
| /** |
| * Allows user to select file and loads it as a model. |
| * |
| * @generated |
| */ |
| public static org.eclipse.emf.ecore.resource.Resource openModel( |
| org.eclipse.swt.widgets.Shell shell, String description, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) { |
| org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell, org.eclipse.swt.SWT.OPEN); |
| if (description != null) { |
| fileDialog.setText(description); |
| } |
| fileDialog.open(); |
| String fileName = fileDialog.getFileName(); |
| if (fileName == null || fileName.length() == 0) { |
| return null; |
| } |
| if (fileDialog.getFilterPath() != null) { |
| fileName = fileDialog.getFilterPath() + java.io.File.separator + fileName; |
| } |
| org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createFileURI(fileName); |
| org.eclipse.emf.ecore.resource.Resource resource = null; |
| try { |
| resource = editingDomain.getResourceSet().getResource(uri, true); |
| } catch (org.eclipse.emf.common.util.WrappedException we) { |
| «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + uri, we); «EXPAND xpt::Common::nonNLS» |
| org.eclipse.jface.dialogs.MessageDialog.openError(shell, |
| «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForOpenModelResourceErrorDialog(self))) FOR editorGen», |
| org.eclipse.osgi.util.NLS.bind( |
| «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForOpenModelResourceErrorDialog(self))) FOR editorGen», |
| fileName)); |
| } |
| return resource; |
| } |
| «ENDIF» |
| |
| /** |
| * Runs the wizard in a dialog. |
| * |
| * @generated |
| */ |
| public static void runWizard(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.Wizard wizard, String settingsKey) { |
| org.eclipse.jface.dialogs.IDialogSettings pluginDialogSettings = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDialogSettings(); |
| org.eclipse.jface.dialogs.IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); |
| if (wizardDialogSettings == null) { |
| wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); |
| } |
| wizard.setDialogSettings(wizardDialogSettings); |
| org.eclipse.jface.wizard.WizardDialog dialog = new org.eclipse.jface.wizard.WizardDialog(shell, wizard); |
| dialog.create(); |
| dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); |
| dialog.open(); |
| } |
| |
| «EXPAND createDiagramMethod-» |
| «IF domainDiagramElement <> null» |
| «EXPAND createInitialModelMethod» |
| «EXPAND attachModelMethod» |
| «IF hasDocumentRoot(self)»«EXPAND createDocumentRootMethod»«ENDIF» |
| «ENDIF» |
| |
| «EXPAND selectElementsMethod» |
| «EXPAND findElementsMethod» |
| «EXPAND findViewMethod» |
| |
| «EXPAND additions» |
| } |
| «ENDDEFINE» |
| |
| «DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» |
| |
| «DEFINE saveOptions FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static «EXPAND CodeStyle::G2('java.util.Map', '?', '?')» getSaveOptions() { |
| «EXPAND CodeStyle::newGenericInstance2('saveOptions', 'java.util.HashMap', 'String', 'Object')»(); |
| saveOptions.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_ENCODING, "UTF-8"); «EXPAND xpt::Common::nonNLS» |
| saveOptions.put(org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED, org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); |
| return saveOptions; |
| } |
| «ENDDEFINE» |
| |
| «DEFINE openDiagramMethod FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static boolean openDiagram(org.eclipse.emf.ecore.resource.Resource diagram) throws org.eclipse.ui.PartInitException { |
| «IF editorGen.application = null-» |
| String path = diagram.getURI().toPlatformString(true); |
| org.eclipse.core.resources.IResource workspaceResource = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(new org.eclipse.core.runtime.Path(path)); |
| if (workspaceResource instanceof org.eclipse.core.resources.IFile) { |
| org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
| return null != page.openEditor(new org.eclipse.ui.part.FileEditorInput((org.eclipse.core.resources.IFile) workspaceResource), «editorGen.editor.getQualifiedClassName()».ID); |
| } |
| return false; |
| «ELSE-» |
| org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
| page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(diagram.getURI()), «editorGen.editor.getQualifiedClassName()».ID); |
| return true; |
| «ENDIF-» |
| } |
| «ENDDEFINE» |
| |
| «DEFINE setCharsetMethods FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static void setCharset(org.eclipse.core.resources.IFile file) { |
| if (file == null) { |
| return; |
| } |
| try { |
| file.setCharset("UTF-8", new org.eclipse.core.runtime.NullProgressMonitor()); «EXPAND xpt::Common::nonNLS» |
| } catch (org.eclipse.core.runtime.CoreException e) { |
| «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); «EXPAND xpt::Common::nonNLS» |
| } |
| } |
| «ENDDEFINE» |
| |
| «DEFINE getUniqueFileNameMethod FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) { |
| return org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «-» |
| org.eclipse.gmf.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application = null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»); |
| } |
| «ENDDEFINE» |
| |
| «DEFINE createDiagramMethod FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Common::generatedMemberComment((if editorGen.application = null then 'This method should be called within a workspace modify operation since it creates resources.' else '' endif))» |
| public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(self)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) { |
| org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain(); |
| progressMonitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramProgressTask(self)) FOR editorGen», 3); |
| final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI); |
| «IF standaloneDomainModel(self)-» |
| final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI); |
| «ELSEIF domainDiagramElement <> null and hasDocumentRoot(self) /*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/-» |
| ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); |
| ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); |
| «ENDIF-» |
| final String diagramName = diagramURI.lastSegment(); |
| org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramCommandLabel(self)) FOR editorGen», java.util.Collections.EMPTY_LIST) { |
| protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { |
| «IF domainDiagramElement <> null-» |
| «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model = createInitialModel(); |
| attachModelToResource(model, «IF standaloneDomainModel(self)»model«ELSE»diagram«ENDIF»Resource); |
| «ENDIF» |
| org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram( |
| «IF domainDiagramElement <> null-» |
| «EXPAND MetaModel::DowncastToEObject('model') FOR domainDiagramElement», |
| «ENDIF-» |
| «EXPAND xpt::editor::VisualIDRegistry::modelID», «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»); |
| if (diagram != null) { |
| diagramResource.getContents().add(diagram); |
| diagram.setName(diagramName); |
| «IF domainDiagramElement <> null-» |
| diagram.setElement(«EXPAND MetaModel::DowncastToEObject('model') FOR domainDiagramElement»); |
| «ENDIF-» |
| } |
| |
| try { |
| «IF standaloneDomainModel(self)»modelResource.save(«EXPAND xpt::Common::getSaveOptions»);«ENDIF» |
| diagramResource.save(«EXPAND xpt::Common::getSaveOptions»); |
| } catch (java.io.IOException e) { |
| «/* TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?*/» |
| «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to store model and diagram resources", e); «EXPAND xpt::Common::nonNLS» |
| } |
| return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); |
| } |
| }; |
| try { |
| org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null); |
| } catch (org.eclipse.core.commands.ExecutionException e) { |
| «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create model and diagram", e); «EXPAND xpt::Common::nonNLS» |
| } |
| «IF editorGen.application = null-» |
| «IF standaloneDomainModel(self)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF» |
| setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource)); |
| «ENDIF-» |
| return diagramResource; |
| } |
| «ENDDEFINE» |
| |
| «DEFINE createInitialModelMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment('Create a new instance of domain element associated with canvas.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->')» |
| private static «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» createInitialModel() { |
| return «EXPAND MetaModel::NewInstance FOR domainDiagramElement»; |
| } |
| «ENDDEFINE» |
| |
| «DEFINE attachModelMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment('Store model element in the resource.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->')» |
| private static void attachModelToResource(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model, org.eclipse.emf.ecore.resource.Resource resource) { |
| resource.getContents().add(«IF hasDocumentRoot(self)»createDocumentRoot(model)«ELSE»«EXPAND MetaModel::DowncastToEObject('model') FOR domainDiagramElement»«ENDIF»); |
| } |
| «ENDDEFINE» |
| |
| // invoke only when there's DocumentRoot in the domain model |
| «DEFINE createDocumentRootMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment» |
| private static «EXPAND MetaModel::QualifiedClassName FOR getDocumentRoot(self)» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) { |
| «IF domainDiagramElement = getDocumentRoot(self)» |
| return model; |
| «ELSE» |
| «EXPAND MetaModel::NewInstance('docRoot') FOR getDocumentRoot(self)» |
| «LET getDocumentRootSetFeature(self) AS f»«IF f.oclIsUndefined()-» |
| docRoot.set«domainDiagramElement.ecoreClass.name»(model); // FIXME name of the set method is pure guess«ELSE-» |
| «EXPAND MetaModel::modifyFeature('docRoot', getDocumentRoot(self), 'model') FOR f»«ENDIF» |
| «ENDLET-» |
| return docRoot; |
| «ENDIF» |
| } |
| «ENDDEFINE» |
| |
| // FIXME only metrics and audits use selectElementsInDiagram and findView (and hence LazyElement2ViewMap and findElementsInDiagramByID) |
| // methods, thus it's reasonable to generate these methods iff Metrics or Audits are enabled. |
| |
| «DEFINE selectElementsMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static void selectElementsInDiagram(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart, «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gef.EditPart')» editParts) { |
| diagramPart.getDiagramGraphicalViewer().deselectAll(); |
| |
| org.eclipse.gef.EditPart firstPrimary = null; |
| «EXPAND CodeStyle::iterate('nextPart', 'org.eclipse.gef.EditPart', 'editParts')-» |
| diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); |
| if(firstPrimary == null && nextPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart) { |
| firstPrimary = nextPart; |
| } |
| } |
| |
| if(!editParts.isEmpty()) { |
| diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (org.eclipse.gef.EditPart)editParts.get(0)); |
| } |
| } |
| «ENDDEFINE» |
| |
| «DEFINE findElementsMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment» |
| private static int findElementsInDiagramByID(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramPart, org.eclipse.emf.ecore.EObject element, «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gef.EditPart')» editPartCollector) { |
| org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer viewer = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer) diagramPart.getViewer(); |
| final int intialNumOfEditParts = editPartCollector.size(); |
| |
| if (element instanceof org.eclipse.gmf.runtime.notation.View) { // support notation element lookup |
| org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) viewer.getEditPartRegistry().get(element); |
| if (editPart != null) { |
| editPartCollector.add(editPart); |
| return 1; |
| } |
| } |
| |
| String elementID = org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getProxyID(element); |
| «EXPAND CodeStyle::SuppressWarnings('"unchecked"')-» |
| «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gef.EditPart')» associatedParts = viewer.findEditPartsForElement(elementID, org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class); |
| // perform the possible hierarchy disjoint -> take the top-most parts only |
| «EXPAND CodeStyle::iterate('nextPart', 'org.eclipse.gef.EditPart', 'associatedParts')-» |
| org.eclipse.gef.EditPart parentPart = nextPart.getParent(); |
| while (parentPart != null && !associatedParts.contains(parentPart)) { |
| parentPart = parentPart.getParent(); |
| } |
| if (parentPart == null) { |
| editPartCollector.add(nextPart); |
| } |
| } |
| |
| if (intialNumOfEditParts == editPartCollector.size()) { |
| if (!associatedParts.isEmpty()) { |
| editPartCollector.add(associatedParts.get(0)); |
| } else { |
| if (element.eContainer() != null) { |
| return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector); |
| } |
| } |
| } |
| return editPartCollector.size() - intialNumOfEditParts; |
| } |
| «ENDDEFINE» |
| |
| «DEFINE findViewMethod FOR gmfgen::GenDiagram» |
| «EXPAND xpt::Common::generatedMemberComment» |
| public static org.eclipse.gmf.runtime.notation.View findView(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.emf.ecore.EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { |
| boolean hasStructuralURI = false; |
| if(targetElement.eResource() instanceof org.eclipse.emf.ecore.xmi.XMLResource) { |
| hasStructuralURI = ((org.eclipse.emf.ecore.xmi.XMLResource)targetElement.eResource()).getID(targetElement) == null; |
| } |
| |
| org.eclipse.gmf.runtime.notation.View view = null; |
| «EXPAND CodeStyle::newGenericInstance('editPartHolder', 'java.util.LinkedList', 'org.eclipse.gef.EditPart')»(); |
| if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { |
| view = «EXPAND CodeStyle::castTyped('org.eclipse.gmf.runtime.notation.View')»lazyElement2ViewMap.getElement2ViewMap().get(targetElement); |
| } else if (findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) { |
| org.eclipse.gef.EditPart editPart = «EXPAND CodeStyle::castTyped('org.eclipse.gef.EditPart')»editPartHolder.get(0); |
| view = editPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View ? (org.eclipse.gmf.runtime.notation.View) editPart.getModel() : null; |
| } |
| |
| return (view == null) ? diagramEditPart.getDiagramView() : view; |
| } |
| |
| «EXPAND xpt::Common::generatedMemberComment('XXX This is quite suspicious code (especially editPartTmpHolder) and likely to be removed soon')» |
| public static class LazyElement2ViewMap { |
| «EXPAND xpt::Common::generatedMemberComment» |
| private «EXPAND CodeStyle::G2('java.util.Map', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')» element2ViewMap; |
| |
| «EXPAND xpt::Common::generatedMemberComment» |
| private org.eclipse.gmf.runtime.notation.View scope; |
| |
| «EXPAND xpt::Common::generatedMemberComment» |
| private «EXPAND CodeStyle::G('java.util.Set', '? extends org.eclipse.emf.ecore.EObject')» elementSet; |
| |
| «EXPAND xpt::Common::generatedMemberComment» |
| public LazyElement2ViewMap(org.eclipse.gmf.runtime.notation.View scope, «EXPAND CodeStyle::G('java.util.Set', '? extends org.eclipse.emf.ecore.EObject')» elements) { |
| this.scope = scope; |
| this.elementSet = elements; |
| } |
| |
| «EXPAND xpt::Common::generatedMemberComment» |
| public final «EXPAND CodeStyle::G2('java.util.Map', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')» getElement2ViewMap() { |
| if(element2ViewMap == null) { |
| element2ViewMap = new «EXPAND CodeStyle::G2('java.util.HashMap', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')»(); |
| // map possible notation elements to itself as these can't be found by view.getElement() |
| «EXPAND CodeStyle::iterate('element', 'org.eclipse.emf.ecore.EObject', 'elementSet')-» |
| if(element instanceof org.eclipse.gmf.runtime.notation.View) { |
| org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) element; |
| if(view.getDiagram() == scope.getDiagram()) { |
| element2ViewMap.put(element, view); // take only those that part of our diagram |
| } |
| } |
| } |
| |
| buildElement2ViewMap(scope, element2ViewMap, elementSet); |
| } |
| return element2ViewMap; |
| } |
| «EXPAND xpt::Common::generatedMemberComment» |
| private static boolean buildElement2ViewMap(org.eclipse.gmf.runtime.notation.View parentView, «EXPAND CodeStyle::G2('java.util.Map', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')» element2ViewMap, «EXPAND CodeStyle::G('java.util.Set', '? extends org.eclipse.emf.ecore.EObject')» elements) { |
| if (elements.size() == element2ViewMap.size()) { |
| return true; |
| } |
| |
| if(parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) { |
| element2ViewMap.put(parentView.getElement(), parentView); |
| if (elements.size() == element2ViewMap.size()) { |
| return true; |
| } |
| } |
| boolean complete = false; |
| for («EXPAND CodeStyle::G('java.util.Iterator', '?')» it = parentView.getChildren().iterator(); it.hasNext() && !complete;) { |
| complete = buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements); |
| } |
| for («EXPAND CodeStyle::G('java.util.Iterator', '?')» it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete;) { |
| complete = buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements); |
| } |
| for («EXPAND CodeStyle::G('java.util.Iterator', '?')» it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete;) { |
| complete = buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements); |
| } |
| return complete; |
| } |
| } //LazyElement2ViewMap |
| «ENDDEFINE» |
| |
| «DEFINE i18nAccessors FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForOpenModelResourceErrorDialog(self)))-» |
| «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForOpenModelResourceErrorDialog(self)))-» |
| «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramProgressTask(self))-» |
| «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramCommandLabel(self))-» |
| «ENDDEFINE» |
| |
| «DEFINE i18nValues FOR gmfgen::GenDiagram-» |
| «EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForOpenModelResourceErrorDialog(self)), 'Error')-» |
| «EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForOpenModelResourceErrorDialog(self)), 'Failed to load model file {0}')-» |
| «EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramProgressTask(self), 'Creating diagram and model files')-» |
| «EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramCommandLabel(self), 'Creating diagram and model')-» |
| «ENDDEFINE» |