diff options
Diffstat (limited to 'plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend')
-rw-r--r-- | plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend index 3bf0dc48853..0502184a82a 100644 --- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend +++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/ResourceSetModificationListener.xtend @@ -1,25 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others +/***************************************************************************** + * Copyright (c) 2007, 2009, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * + * https://www.eclipse.org/legal/epl-2.0/ + * * SPDX-License-Identifier: EPL-2.0 * - * Contributors: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174 + * Contributors: + * Alexander Shatalin (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend + * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : L1.2 clean up *****************************************************************************/ package xpt.editor import com.google.inject.Inject +import com.google.inject.Singleton import org.eclipse.papyrus.gmf.codegen.gmfgen.GenDiagram import xpt.Common +import xpt.CodeStyle + +@Singleton class ResourceSetModificationListener { -@com.google.inject.Singleton class ResourceSetModificationListener { + @Inject extension CodeStyle; @Inject extension Common; def extendsList(GenDiagram it) '''extends org.eclipse.emf.ecore.util.EContentAdapter''' @@ -30,21 +35,19 @@ import xpt.Common def ResourceSetModificationListener(GenDiagram it) ''' «generatedClassComment» private class ResourceSetModificationListener «extendsList(it)» { - + «attributes(it)» - + «constructor(it)» - + «notifyChanged(it)» - - «additions(it)» } ''' def attributes(GenDiagram it) ''' «generatedMemberComment» private org.eclipse.emf.transaction.NotificationFilter myModifiedFilter; - + «generatedMemberComment» private ResourceSetInfo myInfo; ''' @@ -58,7 +61,8 @@ import xpt.Common ''' def notifyChanged(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» + «overrideC» public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) { if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) { super.notifyChanged(notification); @@ -68,8 +72,8 @@ import xpt.Common org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier(); if (resource.isLoaded()) { boolean modified = false; - for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) { - org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next(); + for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) { + org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); if (nextResource.isLoaded()) { modified = nextResource.isModified(); } @@ -80,15 +84,14 @@ import xpt.Common myInfo.fCanBeSaved = modified; dirtyStateChanged = true; } - «IF null == editorGen.application» - if (!resource.isModified()) { - myInfo.setSynchronized(resource); - } + «IF null === editorGen.application » + if (!resource.isModified()) { + myInfo.setSynchronized(resource); + } «ENDIF» } if (dirtyStateChanged) { fireElementDirtyStateChanged(myInfo.getEditorInput(), modified); - if (!modified) { myInfo.setModificationStamp(computeModificationStamp(myInfo)); } @@ -98,7 +101,4 @@ import xpt.Common } } ''' - - def additions(GenDiagram it) ''' -''' } |