diff options
Diffstat (limited to 'plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend')
-rw-r--r-- | plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend index 963f80d112b..419ce09a906 100644 --- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend +++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/navigator/DomainNavigatorItem.xtend @@ -1,28 +1,31 @@ -/******************************************************************************* - * 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.navigator import com.google.inject.Inject import org.eclipse.papyrus.gmf.codegen.gmfgen.GenNavigator import xpt.Common +import xpt.CodeStyle @com.google.inject.Singleton class DomainNavigatorItem { @Inject extension Common; - @Inject AbstractNavigatorItem xptAbstractNavigatorItem; + @Inject NavigatorAbstractNavigatorItem xptAbstractNavigatorItem; + @Inject extension CodeStyle def className(GenNavigator it) '''«it.domainNavigatorItemClassName»''' @@ -35,38 +38,39 @@ import xpt.Common def DomainNavigatorItem(GenNavigator it) ''' «copyright(editorGen)» package «packageName(it)»; - + «generatedClassComment()» public class «className(it)» extends org.eclipse.core.runtime.PlatformObject { - + «registerAdapterFactory(it)» - + «xptAbstractNavigatorItem.attributes(it)» - + «attributes(it)» - + «constructor(it)» - + «xptAbstractNavigatorItem.getParent(it)» - + «getEObject(it)» - + «getPropertySourceProvider(it)» - - «equals(it)» - + + «equalsMethod(it)» + «hashCode(it)» - - «additions(it)» } ''' def registerAdapterFactory(GenNavigator it) ''' «generatedMemberComment()» static { + @SuppressWarnings("rawtypes") final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class }; org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - + + «overrideI» + @SuppressWarnings({ "rawtypes", "unchecked" }) public Object getAdapter(Object adaptableObject, Class adapterType) { if (adaptableObject instanceof «qualifiedClassName(it)») { «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject; @@ -78,10 +82,12 @@ import xpt.Common return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject); } } - + return null; } - + + «overrideI» + @SuppressWarnings({ "rawtypes", "unchecked" }) public Class[] getAdapterList() { return supportedTypes; } @@ -92,7 +98,7 @@ import xpt.Common def attributes(GenNavigator it) ''' «generatedMemberComment()» private org.eclipse.emf.ecore.EObject myEObject; - + «generatedMemberComment()» private org.eclipse.ui.views.properties.IPropertySourceProvider myPropertySourceProvider; ''' @@ -120,8 +126,9 @@ import xpt.Common } ''' - def equals(GenNavigator it) ''' + def equalsMethod(GenNavigator it) ''' «generatedMemberComment()» + «overrideC» public boolean equals(Object obj) { if (obj instanceof «qualifiedClassName(it)») { return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«qualifiedClassName(it)») obj).getEObject())); @@ -132,11 +139,9 @@ import xpt.Common def hashCode(GenNavigator it) ''' «generatedMemberComment()» + «overrideC» public int hashCode() { return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).hashCode(); } ''' - - def additions(GenNavigator it) '''''' - } |