diff options
Diffstat (limited to 'plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend')
-rw-r--r-- | plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend new file mode 100644 index 00000000000..e8e32303b09 --- /dev/null +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2007, 2009, 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: + * Alexander Shatalin (Borland) - initial API and implementation + * Michael Golubev (Montages) - #386838 - migrate to Xtend2 + */ +package aspects.xpt.navigator + +import com.google.inject.Inject +import org.eclipse.gmf.codegen.gmfgen.GenNavigator +import xpt.Common +import xpt.CodeStyle + +@com.google.inject.Singleton class DomainNavigatorItem extends xpt.navigator.DomainNavigatorItem { + @Inject extension Common; + @Inject extension CodeStyle + + override 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(it.editorGen.diagram)» + @SuppressWarnings("rawtypes") + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adaptableObject instanceof «qualifiedClassName(it)») { + «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject; + org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject(); + if (adapterType == org.eclipse.emf.ecore.EObject.class) { + return eObject; + } + if (adapterType == org.eclipse.ui.views.properties.IPropertySource.class) { + return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject); + } + } + + return null; + } + + «overrideI(it.editorGen.diagram)» + @SuppressWarnings("rawtypes") + public Class[] getAdapterList() { + return supportedTypes; + } + }, «qualifiedClassName(it)».class); + } + ''' + + +} |