carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DocumentProvider.xpt
changeset 422 033392511bf7
equal deleted inserted replaced
421:631a44165bcf 422:033392511bf7
       
     1 /*
       
     2  * Copyright (c) 2007 Borland Software Corporation
       
     3  * 
       
     4  * All rights reserved. This program and the accompanying materials
       
     5  * are made available under the terms of the Eclipse Public License v1.0
       
     6  * which accompanies this distribution, and is available at
       
     7  * http://www.eclipse.org/legal/epl-v10.html
       
     8  *
       
     9  * Contributors:
       
    10  *    Alexander Shatalin (Borland) - initial API and implementation
       
    11  */
       
    12 
       
    13 «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
       
    14 «EXTENSION xpt::editor::Utils»
       
    15 
       
    16 «DEFINE DocumentProvider FOR gmfgen::GenDiagram-»
       
    17 	«EXPAND xpt::Common::copyright FOR editorGen-»
       
    18 package «editorGen.editor.packageName»;
       
    19 
       
    20 «EXPAND xpt::Common::generatedClassComment»
       
    21 public class «documentProviderClassName» extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider implements org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider {
       
    22 	
       
    23 	«EXPAND createElementInfo-»
       
    24 	
       
    25 	«EXPAND createDocument-»
       
    26 	
       
    27 	«EXPAND setupDocument-»
       
    28 	
       
    29 	«EXPAND computeModificationStamp-»
       
    30 	
       
    31 	«EXPAND createEmptyDocument-»
       
    32 	
       
    33 	«EXPAND createEditingDomain-»
       
    34 	
       
    35 	«EXPAND setDocumentContent-»
       
    36 	
       
    37 	«EXPAND getModificationStamp-»
       
    38 	
       
    39 	«EXPAND isDeleted-»
       
    40 	
       
    41 	«EXPAND getResourceSetInfo-»
       
    42 	
       
    43 	«EXPAND disposeElementInfo-»
       
    44 	«IF null == editorGen.application-»
       
    45 
       
    46 		«EXPAND doValidateState-»
       
    47 	«ENDIF-»
       
    48 	
       
    49 	«EXPAND isReadOnly-»
       
    50 	
       
    51 	«EXPAND isModifiable-»
       
    52 	
       
    53 	«EXPAND updateCache-»
       
    54 	
       
    55 	«EXPAND doUpdateStateCache-»
       
    56 	
       
    57 	«EXPAND isSynchronized-»
       
    58 	«IF null == editorGen.application-»
       
    59 		
       
    60 		«EXPAND getResetRule-»
       
    61 	
       
    62 		«EXPAND getSaveRule-»
       
    63 	
       
    64 		«EXPAND getSynchronizeRule-»
       
    65 	
       
    66 		«EXPAND getValidateStateRule-»
       
    67 	
       
    68 		«EXPAND computeSchedulingRule-»
       
    69 	«ENDIF-»
       
    70 	
       
    71 	«EXPAND doSynchronize-»
       
    72 	
       
    73 	«EXPAND doSaveDocument-»
       
    74 	
       
    75 	«EXPAND handleElementChanged-»
       
    76 
       
    77 	«EXPAND handleElementMoved-»
       
    78 
       
    79 	«EXPAND createInputWithEditingDomain-»
       
    80 
       
    81 	«EXPAND getDiagramDocument-»
       
    82 	
       
    83 	«EXPAND getOperationRunner-»
       
    84 	«IF null != editorGen.application-»
       
    85 
       
    86 		«EXPAND getFile-»
       
    87 	«ENDIF-»
       
    88 	
       
    89 	«EXPAND xpt::editor::ResourceSetInfo::ResourceSetInfo-»
       
    90 	
       
    91 	«EXPAND xpt::editor::ResourceSetModificationListener::ResourceSetModificationListener-»
       
    92 
       
    93 	«EXPAND additions-»
       
    94 }
       
    95 «ENDDEFINE»
       
    96 
       
    97 «DEFINE createElementInfo FOR gmfgen::GenDiagram-»
       
    98 	«EXPAND xpt::Common::generatedMemberComment»
       
    99 protected ElementInfo createElementInfo(Object element) throws org.eclipse.core.runtime.CoreException {
       
   100 	«EXPAND checkEditorInputInstance-»
       
   101 	org.eclipse.ui.IEditorInput editorInput = (org.eclipse.ui.IEditorInput) element;
       
   102 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) createDocument(editorInput);
       
   103 
       
   104 	ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
       
   105 	info.setModificationStamp(computeModificationStamp(info));
       
   106 	info.fStatus = null;
       
   107 	return info;
       
   108 }
       
   109 «ENDDEFINE»
       
   110 
       
   111 «DEFINE checkEditorInputInstance FOR gmfgen::GenDiagram-»
       
   112 if («IF null == editorGen.application»false == element instanceof «EXPAND fileEditorInputClassFQName» && «ENDIF»false == element instanceof «EXPAND uriEditorInputClassFQName») {
       
   113 	«EXPAND throwIncorrectInputException-»
       
   114 }
       
   115 «ENDDEFINE»
       
   116 
       
   117 «DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
       
   118 throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, 
       
   119 		org.eclipse.osgi.util.NLS.bind(
       
   120 			«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIncorrectInputError()) FOR editorGen»,
       
   121 			new Object[] {element, «IF null == editorGen.application»"«EXPAND fileEditorInputClassFQName»", «ENDIF»"«EXPAND uriEditorInputClassFQName»"}), «EXPAND xpt::Common::nonNLS(1)»«IF null == editorGen.application» «EXPAND xpt::Common::nonNLS(2)»«ENDIF» 
       
   122 		null));
       
   123 «ENDDEFINE»
       
   124 
       
   125 «DEFINE fileEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.ui.part.FileEditorInput«ENDDEFINE»
       
   126 
       
   127 «DEFINE uriEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.emf.common.ui.URIEditorInput«ENDDEFINE»
       
   128 
       
   129 «DEFINE createDocument FOR gmfgen::GenDiagram-»
       
   130 	«EXPAND xpt::Common::generatedMemberComment»
       
   131 protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createDocument(Object element) throws org.eclipse.core.runtime.CoreException {
       
   132 	«EXPAND checkEditorInputInstance-»
       
   133 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = createEmptyDocument();
       
   134 	setDocumentContent(document, (org.eclipse.ui.IEditorInput) element);
       
   135 	setupDocument(element, document);
       
   136 	return document;
       
   137 }
       
   138 «ENDDEFINE»
       
   139 
       
   140 «DEFINE setupDocument FOR gmfgen::GenDiagram-»
       
   141 	«EXPAND xpt::Common::generatedMemberComment(
       
   142 		"Sets up the given document as it would be provided for the given element. The\n" +
       
   143 		"content of the document is not changed. This default implementation is empty.\n" +
       
   144 		"Subclasses may reimplement.\n" +
       
   145 		"\n" +
       
   146 		"@param element the blue-print element\n" +
       
   147 		"@param document the document to set up"
       
   148
       
   149 protected void setupDocument(Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document) {
       
   150 	// for subclasses
       
   151 }
       
   152 «ENDDEFINE»
       
   153 
       
   154 «DEFINE computeModificationStamp FOR gmfgen::GenDiagram-»
       
   155 	«EXPAND xpt::Common::generatedMemberComment»
       
   156 private long computeModificationStamp(ResourceSetInfo info) {
       
   157 	int result = 0;
       
   158 	for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   159 		org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   160 	«IF null == editorGen.application-»
       
   161 		org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   162 		if (file != null) {
       
   163 			if (file.getLocation() != null) {
       
   164 				result += file.getLocation().toFile().lastModified();
       
   165 			} else {
       
   166 				result += file.getModificationStamp();
       
   167 			}
       
   168 		}
       
   169 	«ELSE-»
       
   170 		java.io.File file = getFile(nextResource);
       
   171 		if (file != null && file.exists()) {
       
   172 			result += file.lastModified();
       
   173 		}
       
   174 	«ENDIF-»
       
   175 	}
       
   176 	return result;
       
   177 }
       
   178 «ENDDEFINE»
       
   179 
       
   180 «DEFINE createEmptyDocument FOR gmfgen::GenDiagram-»
       
   181 	«EXPAND xpt::Common::generatedMemberComment»
       
   182 protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createEmptyDocument() {
       
   183 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument document = new org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument();
       
   184 	document.setEditingDomain(createEditingDomain());
       
   185 	return document;
       
   186 }
       
   187 «ENDDEFINE»
       
   188 
       
   189 «DEFINE createEditingDomain FOR gmfgen::GenDiagram-»
       
   190 	«EXPAND xpt::Common::generatedMemberComment»
       
   191 private org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
       
   192 	org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory.getInstance().createEditingDomain();
       
   193 	editingDomain.setID("«editingDomainID»"); «EXPAND xpt::Common::nonNLS»
       
   194 	final org.eclipse.emf.transaction.NotificationFilter diagramResourceModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.ADD)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.ResourceSet.class, org.eclipse.emf.ecore.resource.ResourceSet.RESOURCE_SET__RESOURCES));
       
   195 	editingDomain.getResourceSet().eAdapters().add(new org.eclipse.emf.common.notify.Adapter() {
       
   196 
       
   197 		private org.eclipse.emf.common.notify.Notifier myTarger;
       
   198 
       
   199 		public org.eclipse.emf.common.notify.Notifier getTarget() {
       
   200 			return myTarger;
       
   201 		}
       
   202 
       
   203 		public boolean isAdapterForType(Object type) {
       
   204 			return false;
       
   205 		}
       
   206 
       
   207 		public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
       
   208 			if (diagramResourceModifiedFilter.matches(notification)) {
       
   209 				Object value = notification.getNewValue();
       
   210 				if (value instanceof org.eclipse.emf.ecore.resource.Resource) {
       
   211 					((org.eclipse.emf.ecore.resource.Resource) value).setTrackingModification(true);
       
   212 				}
       
   213 			}
       
   214 		}
       
   215 
       
   216 		public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
       
   217 			myTarger = newTarget;
       
   218 		}
       
   219 			
       
   220 	});	
       
   221 	
       
   222 	return editingDomain;
       
   223 }
       
   224 «ENDDEFINE»
       
   225 
       
   226 «DEFINE setDocumentContent FOR gmfgen::GenDiagram-»
       
   227 	«EXPAND xpt::Common::generatedMemberComment»
       
   228 protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException {
       
   229 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
       
   230 	org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
       
   231 	«IF null == editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
       
   232 		org.eclipse.core.resources.IStorage storage = ((«EXPAND fileEditorInputClassFQName») element).getStorage();
       
   233 		org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
       
   234 		document.setContent(diagram);
       
   235 	} else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
       
   236 		org.eclipse.emf.common.util.URI uri = ((«EXPAND uriEditorInputClassFQName») element).getURI();
       
   237 		org.eclipse.emf.ecore.resource.Resource resource = null;
       
   238 		try {
       
   239 			resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
       
   240 			if (resource == null) {
       
   241 				resource = domain.getResourceSet().createResource(uri.trimFragment());
       
   242 			}
       
   243 			if (!resource.isLoaded()) {
       
   244 				try {
       
   245 					java.util.Map options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
       
   246 					// @see 171060 
       
   247 					// options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
       
   248 					resource.load(options);
       
   249 				} catch (java.io.IOException e) {
       
   250 					resource.unload();
       
   251 					throw e;
       
   252 				}
       
   253 			}
       
   254 			if (uri.fragment() != null) {
       
   255 				org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());
       
   256 				if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
       
   257 					document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
       
   258 					return;
       
   259 				}
       
   260 			} else {
       
   261 				for (java.util.Iterator it = resource.getContents().iterator(); it.hasNext();) {
       
   262 					Object rootElement = it.next();
       
   263 					if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
       
   264 						document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
       
   265 						return;
       
   266 					}
       
   267 				}
       
   268 			}
       
   269 			throw new RuntimeException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderNoDiagramInResourceError()) FOR editorGen»);
       
   270 		} catch (Exception e) {
       
   271 			org.eclipse.core.runtime.CoreException thrownExcp = null;
       
   272 			if (e instanceof org.eclipse.core.runtime.CoreException) {
       
   273 				thrownExcp = (org.eclipse.core.runtime.CoreException) e;
       
   274 			} else {
       
   275 				String msg = e.getLocalizedMessage();
       
   276 				thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, 
       
   277 				msg != null ? msg : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderDiagramLoadingError()) FOR editorGen», e));
       
   278 			}
       
   279 			throw thrownExcp;
       
   280 		}
       
   281 	} else {
       
   282 	«EXPAND throwIncorrectInputException-»
       
   283 	}	
       
   284 }
       
   285 «ENDDEFINE»
       
   286 
       
   287 «DEFINE getModificationStamp FOR gmfgen::GenDiagram-»
       
   288 	«EXPAND xpt::Common::generatedMemberComment»
       
   289 public long getModificationStamp(Object element) {
       
   290 	ResourceSetInfo info = getResourceSetInfo(element);
       
   291 	if (info != null) {
       
   292 		return computeModificationStamp(info);
       
   293 	}
       
   294 	return super.getModificationStamp(element);
       
   295 }
       
   296 «ENDDEFINE»
       
   297 
       
   298 «DEFINE isDeleted FOR gmfgen::GenDiagram-»
       
   299 	«EXPAND xpt::Common::generatedMemberComment»
       
   300 public boolean isDeleted(Object element) {
       
   301 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument(element);
       
   302 	if (document != null) {
       
   303 		org.eclipse.emf.ecore.resource.Resource diagramResource = document.getDiagram().eResource();
       
   304 		if (diagramResource != null) {
       
   305 	«IF null == editorGen.application-»
       
   306 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource);
       
   307 			return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
       
   308 	«ELSE-»
       
   309 			java.io.File file = getFile(diagramResource);
       
   310 			return file != null && !file.exists();
       
   311 	«ENDIF-»
       
   312 		}
       
   313 	}
       
   314 	return super.isDeleted(element);
       
   315 }
       
   316 «ENDDEFINE»
       
   317 
       
   318 «DEFINE getResourceSetInfo FOR gmfgen::GenDiagram-»
       
   319 	«EXPAND xpt::Common::generatedMemberComment»
       
   320 public ResourceSetInfo getResourceSetInfo(Object editorInput) {
       
   321 	return (ResourceSetInfo) super.getElementInfo(editorInput);
       
   322 }
       
   323 «ENDDEFINE»
       
   324 
       
   325 «DEFINE disposeElementInfo FOR gmfgen::GenDiagram-»
       
   326 	«EXPAND xpt::Common::generatedMemberComment»
       
   327 protected void disposeElementInfo(Object element, ElementInfo info) {
       
   328 	if (info instanceof ResourceSetInfo) {
       
   329 		ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
       
   330 		resourceSetInfo.dispose();
       
   331 	}
       
   332 	super.disposeElementInfo(element, info);
       
   333 }
       
   334 «ENDDEFINE»
       
   335 
       
   336 «DEFINE doValidateState FOR gmfgen::GenDiagram-»
       
   337 	«EXPAND xpt::Common::generatedMemberComment»
       
   338 protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException {
       
   339 	ResourceSetInfo info = getResourceSetInfo(element);
       
   340 	if (info != null) {
       
   341 		java.util.Collection/*<org.eclipse.core.resources.IFile>*/ files2Validate = new java.util.ArrayList/*<org.eclipse.core.resources.IFile>*/();
       
   342 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   343 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   344 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   345 			if (file != null && file.isReadOnly()) {
       
   346 				files2Validate.add(file);
       
   347 			}
       
   348 		}
       
   349 		org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit((org.eclipse.core.resources.IFile[]) files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
       
   350 	}
       
   351 
       
   352 	super.doValidateState(element, computationContext);
       
   353 }
       
   354 «ENDDEFINE»
       
   355 
       
   356 «DEFINE isReadOnly FOR gmfgen::GenDiagram-»
       
   357 	«EXPAND xpt::Common::generatedMemberComment»
       
   358 public boolean isReadOnly(Object element) {
       
   359 	ResourceSetInfo info = getResourceSetInfo(element);
       
   360 	if (info != null) {
       
   361 		«EXPAND callUpdateCache-»
       
   362 		return info.isReadOnly();
       
   363 	}
       
   364 	return super.isReadOnly(element);
       
   365 }
       
   366 «ENDDEFINE»
       
   367 
       
   368 «DEFINE isModifiable FOR gmfgen::GenDiagram-»
       
   369 	«EXPAND xpt::Common::generatedMemberComment»
       
   370 public boolean isModifiable(Object element) {
       
   371 	if (!isStateValidated(element)) {
       
   372 		if («IF null == editorGen.application»element instanceof «EXPAND fileEditorInputClassFQName» || «ENDIF»element instanceof «EXPAND uriEditorInputClassFQName») {
       
   373 			return true;
       
   374 		}
       
   375 	}
       
   376 	ResourceSetInfo info = getResourceSetInfo(element);
       
   377 	if (info != null) {
       
   378 		«EXPAND callUpdateCache-»
       
   379 		return info.isModifiable();
       
   380 	}
       
   381 	return super.isModifiable(element);
       
   382 }
       
   383 «ENDDEFINE»
       
   384 
       
   385 «DEFINE callUpdateCache FOR gmfgen::GenDiagram-»
       
   386 if (info.isUpdateCache()) {
       
   387 	try {
       
   388 		updateCache(element);
       
   389 	} catch (org.eclipse.core.runtime.CoreException ex) {
       
   390 		«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIsModifiable()) FOR editorGen», ex);
       
   391 		// Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
       
   392 	}
       
   393 }
       
   394 «ENDDEFINE»
       
   395 
       
   396 «DEFINE updateCache FOR gmfgen::GenDiagram-»
       
   397 	«EXPAND xpt::Common::generatedMemberComment»
       
   398 protected void updateCache(Object element) throws org.eclipse.core.runtime.CoreException {
       
   399 	ResourceSetInfo info = getResourceSetInfo(element);
       
   400 	if (info != null) {
       
   401 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   402 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   403 	«IF null == editorGen.application-»
       
   404 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   405 			if (file != null && file.isReadOnly()) {
       
   406 	«ELSE-»
       
   407 			java.io.File file = getFile(nextResource);
       
   408 			if (file != null && file.exists() && !file.canWrite()) {
       
   409 	«ENDIF-»
       
   410 				info.setReadOnly(true);
       
   411 				info.setModifiable(false);
       
   412 				return;
       
   413 			}
       
   414 		}
       
   415 		info.setReadOnly(false);
       
   416 		info.setModifiable(true);
       
   417 		return;
       
   418 	}
       
   419 }
       
   420 «ENDDEFINE»
       
   421 
       
   422 «DEFINE doUpdateStateCache FOR gmfgen::GenDiagram-»
       
   423 	«EXPAND xpt::Common::generatedMemberComment»
       
   424 protected void doUpdateStateCache(Object element) throws org.eclipse.core.runtime.CoreException {
       
   425 	ResourceSetInfo info = getResourceSetInfo(element);
       
   426 	if (info != null) {
       
   427 		info.setUpdateCache(true);
       
   428 	}
       
   429 	super.doUpdateStateCache(element);
       
   430 }
       
   431 «ENDDEFINE»
       
   432 
       
   433 «DEFINE isSynchronized FOR gmfgen::GenDiagram-»
       
   434 	«EXPAND xpt::Common::generatedMemberComment»
       
   435 public boolean isSynchronized(Object element) {
       
   436 	ResourceSetInfo info = getResourceSetInfo(element);
       
   437 	if (info != null) {
       
   438 		return info.isSynchronized();
       
   439 	}
       
   440 	return super.isSynchronized(element);
       
   441 }
       
   442 «ENDDEFINE»
       
   443 
       
   444 «DEFINE getResetRule FOR gmfgen::GenDiagram-»
       
   445 	«EXPAND xpt::Common::generatedMemberComment»
       
   446 protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) {
       
   447 	ResourceSetInfo info = getResourceSetInfo(element);
       
   448 	if (info != null) {
       
   449 		java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
       
   450 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   451 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   452 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   453 			if (file != null) {
       
   454 				rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
       
   455 			}
       
   456 		}
       
   457 		return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
       
   458 	}
       
   459 	return null;
       
   460 }
       
   461 «ENDDEFINE»
       
   462 
       
   463 «DEFINE getSaveRule FOR gmfgen::GenDiagram-»
       
   464 	«EXPAND xpt::Common::generatedMemberComment»
       
   465 protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) {
       
   466 	ResourceSetInfo info = getResourceSetInfo(element);
       
   467 	if (info != null) {
       
   468 		java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
       
   469 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   470 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   471 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   472 			if (file != null) {
       
   473 				rules.add(computeSchedulingRule(file));
       
   474 			}
       
   475 		}
       
   476 		return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
       
   477 	}
       
   478 	return null;
       
   479 }
       
   480 «ENDDEFINE»
       
   481 
       
   482 «DEFINE getSynchronizeRule FOR gmfgen::GenDiagram-»
       
   483 	«EXPAND xpt::Common::generatedMemberComment»
       
   484 protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) {
       
   485 	ResourceSetInfo info = getResourceSetInfo(element);
       
   486 	if (info != null) {
       
   487 		java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
       
   488 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   489 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   490 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   491 			if (file != null) {
       
   492 				rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
       
   493 			}
       
   494 		}
       
   495 		return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
       
   496 	}
       
   497 	return null;
       
   498 }
       
   499 «ENDDEFINE»
       
   500 
       
   501 «DEFINE getValidateStateRule FOR gmfgen::GenDiagram-»
       
   502 	«EXPAND xpt::Common::generatedMemberComment»
       
   503 protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) {
       
   504 	ResourceSetInfo info = getResourceSetInfo(element);
       
   505 	if (info != null) {
       
   506 		java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ files = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
       
   507 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   508 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   509 			org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
       
   510 			if (file != null) {
       
   511 				files.add(file);
       
   512 			}
       
   513 		}
       
   514 		return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((org.eclipse.core.resources.IFile[]) files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
       
   515 	}
       
   516 	return null;
       
   517 }
       
   518 «ENDDEFINE»
       
   519 
       
   520 «DEFINE computeSchedulingRule FOR gmfgen::GenDiagram-»
       
   521 	«EXPAND xpt::Common::generatedMemberComment»
       
   522 private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) {
       
   523 	if (toCreateOrModify.exists())
       
   524 		return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
       
   525 
       
   526 	org.eclipse.core.resources.IResource parent = toCreateOrModify;
       
   527 	do {
       
   528 		/*
       
   529 		 * XXX This is a workaround for
       
   530 		 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
       
   531 		 * IResourceRuleFactory.createRule should iterate the hierarchy
       
   532 		 * itself.
       
   533 		 */
       
   534 		toCreateOrModify = parent;
       
   535 		parent = toCreateOrModify.getParent();
       
   536 	} while (parent != null && !parent.exists());
       
   537 
       
   538 	return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
       
   539 }
       
   540 «ENDDEFINE»
       
   541 
       
   542 «DEFINE doSynchronize FOR gmfgen::GenDiagram-»
       
   543 	«EXPAND xpt::Common::generatedMemberComment»
       
   544 protected void doSynchronize(Object element, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException {
       
   545 	ResourceSetInfo info = getResourceSetInfo(element);
       
   546 	if (info != null) {
       
   547 		for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   548 			org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   549 			handleElementChanged(info, nextResource, monitor);	
       
   550 		}
       
   551 		return;
       
   552 	}
       
   553 	super.doSynchronize(element, monitor);
       
   554 }
       
   555 «ENDDEFINE»
       
   556 
       
   557 «DEFINE handleElementChanged FOR gmfgen::GenDiagram-»
       
   558 	«EXPAND xpt::Common::generatedMemberComment»
       
   559 protected void handleElementChanged(ResourceSetInfo info, org.eclipse.emf.ecore.resource.Resource changedResource, org.eclipse.core.runtime.IProgressMonitor monitor) {
       
   560 	«IF null == editorGen.application-»
       
   561 	org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(changedResource);
       
   562 	if (file != null) {
       
   563 		try {
       
   564 			file.refreshLocal(org.eclipse.core.resources.IResource.DEPTH_INFINITE, monitor);
       
   565 		} catch (org.eclipse.core.runtime.CoreException ex) {
       
   566 			«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderHandleElementContentChanged()) FOR editorGen», ex);
       
   567 			// Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
       
   568 		}
       
   569 	}
       
   570 	«ENDIF-»
       
   571 	changedResource.unload();
       
   572 	
       
   573 	fireElementContentAboutToBeReplaced(info.getEditorInput());
       
   574 	removeUnchangedElementListeners(info.getEditorInput(), info);
       
   575 	info.fStatus = null;
       
   576 	try {
       
   577 		setDocumentContent(info.fDocument, info.getEditorInput());
       
   578 	} catch (org.eclipse.core.runtime.CoreException e) {
       
   579 		info.fStatus = e.getStatus();
       
   580 	}
       
   581 «REM»TODO: Remove this if and call setModificationStamp only from doSaveDocument method«ENDREM»«-»
       
   582 	if (!info.fCanBeSaved) {
       
   583 		info.setModificationStamp(computeModificationStamp(info));
       
   584 	}
       
   585 	addUnchangedElementListeners(info.getEditorInput(), info);
       
   586 	fireElementContentReplaced(info.getEditorInput());
       
   587 }
       
   588 «ENDDEFINE»
       
   589 
       
   590 «DEFINE doSaveDocument FOR gmfgen::GenDiagram-»
       
   591 	«EXPAND xpt::Common::generatedMemberComment»
       
   592 protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException {
       
   593 	ResourceSetInfo info = getResourceSetInfo(element);
       
   594 	if (info != null) {
       
   595 		if (!overwrite && !info.isSynchronized()) {
       
   596 			throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 
       
   597 				«IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF», 
       
   598 				«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentUnsynchronizedFileSaveError()) FOR editorGen», 
       
   599 				null));
       
   600 		}
       
   601 	«IF null == editorGen.application-»
       
   602 		info.stopResourceListening();
       
   603 	«ENDIF-»
       
   604 		fireElementStateChanging(element);
       
   605 		try {
       
   606 			monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagramTask()) FOR editorGen», info.getResourceSet().getResources().size() + 1); //"Saving diagram"
       
   607 			for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
       
   608 				org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
       
   609 				monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
       
   610 						«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveNextResourceTask()) FOR editorGen», 
       
   611 						nextResource.getURI()));
       
   612 				if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
       
   613 					try {
       
   614 						nextResource.save(«EXPAND xpt::Common::getSaveOptions»);
       
   615 					} catch (java.io.IOException e) {
       
   616 						fireElementStateChangeFailed(element);
       
   617 						throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
       
   618 					}
       
   619 				}
       
   620 				monitor.worked(1);
       
   621 			}
       
   622 			monitor.done();
       
   623 			info.setModificationStamp(computeModificationStamp(info));
       
   624 		} catch (RuntimeException x) {
       
   625 			fireElementStateChangeFailed(element);
       
   626 			throw x;
       
   627 		} «IF null == editorGen.application» finally {
       
   628 			info.startResourceListening();
       
   629 		} «ENDIF»
       
   630 	} else {
       
   631 		org.eclipse.emf.common.util.URI newResoruceURI;
       
   632 		java.util.List affectedFiles = null;
       
   633 		«IF null == editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
       
   634 			org.eclipse.core.resources.IFile newFile = ((«EXPAND fileEditorInputClassFQName») element).getFile();
       
   635 			affectedFiles = java.util.Collections.singletonList(newFile);
       
   636 			newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
       
   637 		} else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
       
   638 			newResoruceURI = ((«EXPAND uriEditorInputClassFQName») element).getURI();
       
   639 		} else {
       
   640 			fireElementStateChangeFailed(element);
       
   641 			«EXPAND throwIncorrectInputException-»
       
   642 		}
       
   643 		if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
       
   644 			fireElementStateChangeFailed(element);
       
   645 			throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
       
   646 			"Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
       
   647 		}
       
   648 		org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
       
   649 		final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
       
   650 		final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = (org.eclipse.gmf.runtime.notation.Diagram) org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
       
   651 		try {
       
   652 			new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveAs()) FOR editorGen», diagramCopy.getName()), affectedFiles) {
       
   653 				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 {
       
   654 					newResource.getContents().add(diagramCopy);					
       
   655 					return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
       
   656 				}
       
   657 			}.execute(monitor, null);
       
   658 			newResource.save(«EXPAND xpt::Common::getSaveOptions»);
       
   659 		} catch (org.eclipse.core.commands.ExecutionException e) {
       
   660 			fireElementStateChangeFailed(element);
       
   661 			throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
       
   662 		} catch (java.io.IOException e) {
       
   663 			fireElementStateChangeFailed(element);
       
   664 			throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
       
   665 		}
       
   666 		newResource.unload();
       
   667 	}
       
   668 }
       
   669 «ENDDEFINE»
       
   670 
       
   671 «DEFINE handleElementMoved FOR gmfgen::GenDiagram-»
       
   672 	«EXPAND xpt::Common::generatedMemberComment»
       
   673 protected void handleElementMoved(org.eclipse.ui.IEditorInput input, org.eclipse.emf.common.util.URI uri) {
       
   674 	«IF null == editorGen.application»if (input instanceof «EXPAND fileEditorInputClassFQName») {
       
   675 		org.eclipse.core.resources.IFile newFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(new org.eclipse.core.runtime.Path(org.eclipse.emf.common.util.URI.decode(uri.path())).removeFirstSegments(1));
       
   676 		fireElementMoved(input, newFile == null ? null : new org.eclipse.ui.part.FileEditorInput(newFile));
       
   677 		return;
       
   678 	}«ENDIF»
       
   679 	// TODO: append suffix to the URI! (use diagram as a parameter)
       
   680 	fireElementMoved(input, new org.eclipse.emf.common.ui.URIEditorInput(uri));
       
   681 }
       
   682 «ENDDEFINE»
       
   683 
       
   684 «DEFINE createInputWithEditingDomain FOR gmfgen::GenDiagram-»
       
   685 	«EXPAND xpt::Common::generatedMemberComment»
       
   686 public org.eclipse.ui.IEditorInput createInputWithEditingDomain(org.eclipse.ui.IEditorInput editorInput, org.eclipse.emf.transaction.TransactionalEditingDomain domain) {
       
   687 	return editorInput;
       
   688 }
       
   689 «ENDDEFINE»
       
   690 
       
   691 «DEFINE getDiagramDocument FOR gmfgen::GenDiagram-»
       
   692 	«EXPAND xpt::Common::generatedMemberComment»
       
   693 public org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument getDiagramDocument(Object element) {
       
   694 	org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument doc = getDocument(element);
       
   695 	if (doc instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
       
   696 		return (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) doc;
       
   697 	}
       
   698 	return null;
       
   699 }
       
   700 «ENDDEFINE»
       
   701 
       
   702 «DEFINE getOperationRunner FOR gmfgen::GenDiagram-»
       
   703 	«EXPAND xpt::Common::generatedMemberComment»
       
   704 protected org.eclipse.jface.operation.IRunnableContext getOperationRunner(org.eclipse.core.runtime.IProgressMonitor monitor) {
       
   705 	return null;
       
   706 }
       
   707 «ENDDEFINE»
       
   708 
       
   709 «DEFINE getFile FOR gmfgen::GenDiagram-»
       
   710 	«EXPAND xpt::Common::generatedMemberComment»
       
   711 private static java.io.File getFile(org.eclipse.emf.ecore.resource.Resource resource) {
       
   712 	org.eclipse.emf.common.util.URI resourceUri = resource.getURI();
       
   713 	if (resourceUri != null && resourceUri.isFile()) {
       
   714 		java.io.File file = new java.io.File(resourceUri.toFileString());
       
   715 		if (!file.isDirectory()) {
       
   716 			return file;
       
   717 		}
       
   718 	}
       
   719 	return null;
       
   720 }
       
   721 «ENDDEFINE»
       
   722 
       
   723 «DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
       
   724 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIsModifiable())-»
       
   725 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderHandleElementContentChanged())-»
       
   726 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIncorrectInputError())-»
       
   727 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderNoDiagramInResourceError())-»
       
   728 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderDiagramLoadingError())-»
       
   729 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentUnsynchronizedFileSaveError())-»
       
   730 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveDiagramTask())-»
       
   731 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveNextResourceTask())-»
       
   732 	«EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveAs())-»
       
   733 «ENDDEFINE»
       
   734 
       
   735 «DEFINE i18nValues FOR gmfgen::GenDiagram-»
       
   736 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIsModifiable(), "Updating cache failed")-»
       
   737 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderHandleElementContentChanged(), "Failed to refresh hierarchy for changed resource")-»
       
   738 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIncorrectInputError(), "Incorrect element used: {0} instead of " + editorGen.application == null ? "{1} or {2}" : "{1}")-»
       
   739 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderNoDiagramInResourceError(), "Diagram is not present in resource")-»
       
   740 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderDiagramLoadingError(), "Error loading diagram")-»
       
   741 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentUnsynchronizedFileSaveError(), "The file has been changed on the file system")-»
       
   742 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveDiagramTask(), "Saving diagram")-»
       
   743 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveNextResourceTask(), "Saving {0}")-»
       
   744 «EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveAs(), "Saving {0} diagram as")-»
       
   745 «ENDDEFINE»
       
   746 
       
   747 «DEFINE additions FOR gmfgen::GenDiagram-»
       
   748 «ENDDEFINE»