Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt81
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt98
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt121
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt123
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt492
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt129
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt109
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt424
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLinkHelper.xpt132
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorSorter.xpt58
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/extensions.xpt176
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/getEditorInput.xpt44
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/navigatorGroup.gifbin0 -> 709 bytes
15 files changed, 2256 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt
new file mode 100644
index 000000000..50511d162
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE AbstractNavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public abstract class «abstractNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
+
+«IF null <> editorGen.propertySheet»
+ «EXPAND registerAdapterFactory-»
+«ENDIF-»
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND getParent-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
+ final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
+ public String getContributorId() {
+ return "«editorGen.plugin.iD»"; «EXPAND xpt::Common::nonNLS»
+ }
+ };
+ org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getAbstractNavigatorItemQualifiedClassName()» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getAbstractNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private Object myParent;
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected «abstractNavigatorItemClassName»(Object parent) {
+ myParent = parent;
+}
+«ENDDEFINE»
+
+«DEFINE getParent FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object getParent() {
+ return myParent;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt
new file mode 100644
index 000000000..df4a887f9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE DomainNavigatorContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainContentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iContentProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iStructuredContentProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iCommonContentProvider-»
+
+ «EXPAND iTreeContentProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::attributes-»
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «domainContentProviderClassName»() {
+ myAdapterFctoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+ «EXPAND xpt::navigator::NavigatorContentProvider::initCommonAttributes-»
+}
+«ENDDEFINE»
+
+«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getChildren-»
+
+ «EXPAND wrapEObjects-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::getParent-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::hasChildren-»
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ «EXPAND xpt::navigator::NavigatorContentProvider::getFileResoruce-»
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
+ }
+
+ if (parentElement instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((«getDomainNavigatorItemQualifiedClassName()») parentElement).getEObject()), parentElement);
+ }
+ «EXPAND getOtherChildren-»
+}
+«ENDDEFINE»
+
+«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
+return EMPTY_ARRAY;
+«ENDDEFINE»
+
+«DEFINE wrapEObjects FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof org.eclipse.emf.ecore.EObject) {
+ result.add(new «getDomainNavigatorItemQualifiedClassName()»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt
new file mode 100644
index 000000000..456459aba
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE DomainNavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
+
+ «EXPAND registerAdapterFactory-»
+
+ «EXPAND xpt::navigator::AbstractNavigatorItem::attributes-»
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND xpt::navigator::AbstractNavigatorItem::getParent-»
+
+ «EXPAND getEObject-»
+
+ «EXPAND getPropertySourceProvider-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ 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() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ «getDomainNavigatorItemQualifiedClassName()» domainNavigatorItem = («getDomainNavigatorItemQualifiedClassName()») 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;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getDomainNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myEObject;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.views.properties.IPropertySourceProvider myPropertySourceProvider;
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «domainNavigatorItemClassName»(org.eclipse.emf.ecore.EObject eObject, Object parent, org.eclipse.ui.views.properties.IPropertySourceProvider propertySourceProvider) {
+ myParent = parent;
+ myEObject = eObject;
+ myPropertySourceProvider = propertySourceProvider;
+}
+«ENDDEFINE»
+
+«DEFINE getEObject FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getEObject() {
+ return myEObject;
+}
+«ENDDEFINE»
+
+«DEFINE getPropertySourceProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.ui.views.properties.IPropertySourceProvider getPropertySourceProvider() {
+ return myPropertySourceProvider;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getDomainNavigatorItemQualifiedClassName()») obj).getEObject()));
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt
new file mode 100644
index 000000000..325c52700
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE DomainNavigatorLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainLabelProviderClassName» implements org.eclipse.ui.navigator.ICommonLabelProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND iCommonLabelProvider-»
+
+ «EXPAND iLabelProvider-»
+
+ «EXPAND iBaseLabelProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
+
+ «EXPAND iDescriptionProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE iCommonLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE iLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getImage-»
+
+ «EXPAND getText-»
+«ENDDEFINE»
+
+«DEFINE iBaseLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND addListener-»
+
+ «EXPAND dispose-»
+
+ «EXPAND isLabelProperty-»
+
+ «EXPAND removeListener-»
+«ENDDEFINE»
+
+«DEFINE iDescriptionProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getDescription(Object anElement) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE addListener FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.addListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myAdapterFactoryLabelProvider.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE isLabelProperty FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLabelProperty(Object element, String property) {
+ return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+}
+«ENDDEFINE»
+
+«DEFINE removeListener FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.removeListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE getImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return myAdapterFactoryLabelProvider.getImage(«EXPAND getEObject»);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getEObject FOR gmfgen::GenNavigator»((«getDomainNavigatorItemQualifiedClassName()») element).getEObject()«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return myAdapterFactoryLabelProvider.getText(«EXPAND getEObject»);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt
new file mode 100644
index 000000000..0a2bc7993
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2006,2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorActionProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «actionProviderClassName» extends org.eclipse.ui.navigator.CommonActionProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND _init-»
+
+ «EXPAND makeActions-»
+
+ «EXPAND fillActionBars-»
+
+ «EXPAND fillContextMenu-»
+
+ «EXPAND OpenDiagramAction-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean myContribute;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private OpenDiagramAction myOpenDiagramAction;
+«ENDDEFINE»
+
+«DEFINE _init FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) {
+ myContribute = true;
+ makeActions((org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ myContribute = false;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE makeActions FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void makeActions(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
+ myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+}
+«ENDDEFINE»
+
+«DEFINE fillActionBars FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void fillActionBars(org.eclipse.ui.IActionBars actionBars) {
+ if (!myContribute) {
+ return;
+ }
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(org.eclipse.ui.navigator.ICommonActionConstants.OPEN, myOpenDiagramAction);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE fillContextMenu FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void fillContextMenu(org.eclipse.jface.action.IMenuManager menu) {
+«REM»
+/*
+ * Put following code into the template to generate popup menu
+ *
+ if (!myContribute || getContext().getSelection().isEmpty()) {
+ return;
+ }
+
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
+
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ menu.insertAfter(org.eclipse.ui.navigator.ICommonMenuConstants.GROUP_OPEN, myOpenDiagramAction);
+ }*/
+«ENDREM»«-»
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramAction FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class OpenDiagramAction extends org.eclipse.jface.action.Action {
+
+ «EXPAND ODA_attributes-»
+
+ «EXPAND ODA_constructor-»
+
+ «EXPAND ODA_selectionChanged-»
+
+ «EXPAND ODA_run-»
+
+ «EXPAND ODA_getEditorInput-»
+
+ «EXPAND ODA_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE ODA_attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.Diagram myDiagram;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.navigator.ICommonViewerWorkbenchSite myViewerSite;
+«ENDDEFINE»
+
+«DEFINE ODA_constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public OpenDiagramAction(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramActionName()) FOR editorGen»);
+ myViewerSite = viewerSite;
+}
+«ENDDEFINE»
+
+«DEFINE ODA_selectionChanged FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public final void selectionChanged(org.eclipse.jface.viewers.IStructuredSelection selection) {
+ myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof «getNavigatorItemQualifiedClassName()») {
+ selectedElement = ((«getNavigatorItemQualifiedClassName()») selectedElement).getView();
+ } else if (selectedElement instanceof org.eclipse.core.runtime.IAdaptable) {
+ selectedElement = ((org.eclipse.core.runtime.IAdaptable) selectedElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ }
+ if (selectedElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = (org.eclipse.gmf.runtime.notation.Diagram) selectedElement;
+ if («EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(diagram))) {
+ myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(myDiagram != null);
+}
+«ENDDEFINE»
+
+«DEFINE ODA_run FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ if (myDiagram == null || myDiagram.eResource() == null) {
+ return;
+ }
+
+ org.eclipse.ui.IEditorInput editorInput = getEditorInput();
+ org.eclipse.ui.IWorkbenchPage page = myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, «editorGen.editor.getQualifiedClassName()».ID);
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while openning diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ODA_getEditorInput FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IEditorInput getEditorInput() {
+ «IF null = editorGen.application-»
+ for (java.util.Iterator it = myDiagram.eResource().getContents().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject nextEObject = (org.eclipse.emf.ecore.EObject) it.next();
+ if (nextEObject == myDiagram) {
+ return new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(myDiagram.eResource()));
+ }
+ if (nextEObject instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ break;
+ }
+ }
+ «ENDIF-»
+ «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput('myDiagram') FOR editorGen.diagram-»
+ return editorInput;
+}
+«ENDDEFINE»
+
+«DEFINE ODA_additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramActionName(), 'Open Diagram')-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramActionName())-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
new file mode 100644
index 000000000..bd55cdc4a
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
@@ -0,0 +1,492 @@
+/*
+ * Copyright (c) 2006,2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::navigator::Utils»
+«EXTENSION xpt::navigator::NativeUtils»
+
+«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «contentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND iContentProvider-»
+
+ «EXPAND iStructuredContentProvider-»
+
+ «EXPAND iMementoAware-»
+
+ «EXPAND iCommonContentProvider-»
+
+ «EXPAND iTreeContentProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.Viewer myViewer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain myEditingDomain;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.workspace.util.WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private Runnable myViewerRefreshRunnable;
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «contentProviderClassName»() {
+ «EXPAND initCommonAttributes-»
+}
+«ENDDEFINE»
+
+«DEFINE initCommonAttributes FOR gmfgen::GenNavigator-»
+org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
+myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
+myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+});
+myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+};
+myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND processChanges-»
+ }
+
+ public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND processChanges-»
+ }
+
+ public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
+ «EXPAND processChanges-»
+ }
+});
+«ENDDEFINE»
+
+«DEFINE processChanges FOR gmfgen::GenNavigator-»
+for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ nextResource.unload();
+}
+if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+}
+return true;
+«ENDDEFINE»
+
+«DEFINE iContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND dispose-»
+
+ «EXPAND inputChanged-»
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ resource.unload();
+ }
+ ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+}
+«ENDDEFINE»
+
+«DEFINE inputChanged FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+}
+«ENDDEFINE»
+
+«DEFINE iStructuredContentProvider FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+}
+«ENDDEFINE»
+
+«DEFINE iMementoAware FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void restoreState(org.eclipse.ui.IMemento aMemento) {
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void saveState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE iCommonContentProvider FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getChildren-»
+
+ «EXPAND getParent-»
+
+ «EXPAND hasChildren-»
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ «EXPAND getFileChildren-»
+ }
+
+ if (parentElement instanceof «getNavigatorGroupQualifiedClassName()») {
+ «EXPAND getGroupChildren-»
+ }
+
+ if (parentElement instanceof «getNavigatorItemQualifiedClassName()») {
+ «EXPAND getItemChildren-»
+ }
+
+ «IF editorGen.diagram.generateShortcutIcon()-»
+ «EXPAND getAdaptableChildren»
+ «ENDIF-»
+ «EXPAND getOtherChildren-»
+}
+
+ «EXPAND getViewChildren-»
+
+ «EXPAND utilityMethods-»
+«ENDDEFINE»
+
+«DEFINE getParent FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object getParent(Object element) {
+ if (element instanceof «getAbstractNavigatorItemQualifiedClassName()») {
+ «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE hasChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean hasChildren(Object element) {
+ return element instanceof org.eclipse.core.resources.IFile || getChildren(element).length > 0;
+}
+«ENDDEFINE»
+
+«DEFINE getFileChildren FOR gmfgen::GenNavigator-»
+ «EXPAND getFileResoruce-»
+java.util.Collection result = new java.util.ArrayList();
+ «LET getChildReferencesFrom(self, null) AS _references-»
+ «EXPAND initGroupVariables(self, _references, 'file', null) FOREACH getGroupNames(_references)-»
+ «FOREACH _references AS ref-»
+ «EXPAND addNavigatorItemsPrefix FOR ref»selectViewsByType(resource.getContents(), «EXPAND getChildViewType FOR ref.child»)«EXPAND addNavigatorItemsSuffix('file', false) FOR ref-»
+ «ENDFOREACH-»
+ «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
+ «ENDLET-»
+return result.toArray();
+«ENDDEFINE»
+
+«DEFINE getFileResoruce FOR gmfgen::GenNavigator-»
+org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) parentElement;
+org.eclipse.emf.common.util.URI fileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+org.eclipse.emf.ecore.resource.Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+«ENDDEFINE»
+
+«DEFINE getGroupChildren FOR gmfgen::GenNavigator-»
+«getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») parentElement;
+return group.getChildren();
+«ENDDEFINE»
+
+«DEFINE getItemChildren FOR gmfgen::GenNavigator-»
+«getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») parentElement;
+if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+}
+return getViewChildren(navigatorItem.getView(), parentElement);
+«ENDDEFINE»
+
+«DEFINE getAdaptableChildren FOR gmfgen::GenNavigator-»
+/*
+ * Due to plugin.xml restrictions this code will be called only for views representing
+ * shortcuts to this diagram elements created on other diagrams.
+*/
+if (parentElement instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) parentElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return getViewChildren(view, parentElement);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
+return EMPTY_ARRAY;
+«ENDDEFINE»
+
+«DEFINE getViewChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseNavigatorNode(self) FOREACH getNavigatorContainerNodes(self)-»
+ }
+ return EMPTY_ARRAY;
+}
+«ENDDEFINE»
+
+«DEFINE utilityMethods FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next();
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection selectViewsByType(java.util.Collection views, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = views.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
+ return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = views.iterator(); it.hasNext();) {
+ result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs));
+ }
+ return result;
+}
+«EXPAND getForeignShortcuts-»
+«ENDDEFINE»
+
+«DEFINE getForeignShortcuts FOR gmfgen::GenNavigator-»
+ «IF editorGen.diagram.generateCreateShortcutAction() and getChildReferencesFrom(self, editorGen.diagram)->size() > 0-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ result.add(nextView);
+ }
+ }
+ return createNavigatorItems(result, parent, false);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
+
+«DEFINE initGroupVariables(navigator : gmfgen::GenNavigator, _references : Sequence(gmfgen::GenNavigatorChildReference), parentVarName : String, contextElement : gmfgen::GenCommonBase) FOR String-»
+ «navigator.getNavigatorGroupQualifiedClassName()» «asValidJavaIdentifier(self)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(self, contextElement)) FOR navigator.editorGen»,
+ "«getNavigatorReference(self, _references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«asValidJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
+
+«DEFINE addNavigatorItemsSuffix(parentVarName : String, isLeaf : Boolean) FOR gmfgen::GenNavigatorChildReference-»
+, «IF isInsideGroup()»«asValidJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
+«ENDDEFINE»
+
+«DEFINE addGroups(_references : Sequence(gmfgen::GenNavigatorChildReference)) FOR String-»
+ «LET getNavigatorReference(self, _references) AS ref-»
+ «IF ref.hideIfEmpty-»
+ if (!«asValidJavaIdentifier(self)».isEmpty()) {«ENDIF-»
+ result.add(«asValidJavaIdentifier(self)»);
+ «IF ref.hideIfEmpty-»
+ }«ENDIF-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE getChildViewType FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::modelID»«ENDDEFINE»
+
+«DEFINE getChildViewType FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ENDDEFINE»
+
+«DEFINE caseNavigatorNode(navigator : gmfgen::GenNavigator) FOR gmfgen::GenCommonBase»
+«EXPAND xpt::Common::caseVisualID» {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND addForeignShortcuts FOR self-»
+ «LET getChildReferencesFrom(navigator, self) AS _references-»
+ «EXPAND initGroupVariables(navigator, _references, 'parentElement', self) FOREACH getGroupNames(_references)-»
+ «FOREACH _references AS reference ITERATOR referencesIterator-»
+ «FOREACH reference.findConnectionPaths()->asSequence() AS path ITERATOR pathsIterator-»
+ «FOREACH path.segments->asSequence() AS segment ITERATOR segmentsIterator-»
+ «IF referencesIterator.isFirstIteration() and (pathsIterator.isFirstIteration() and segmentsIterator.isFirstIteration())»java.util.Collection «ENDIF-»
+ connectedViews = «EXPAND childrenMethodName(reference.referenceType, segment) FOR segment._from-»
+ («IF segmentsIterator.isFirstIteration()»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF-»
+ , «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR segment.to»);
+ «ENDFOREACH-»
+ «EXPAND addNavigatorItemsPrefix FOR reference»connectedViews«EXPAND addNavigatorItemsSuffix('parentElement', reference.referenceType <> gmfgen::GenNavigatorReferenceType::children) FOR reference-»
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
+ «ENDLET-»
+ return result.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE addForeignShortcuts FOR gmfgen::GenDiagram-»
+ «IF generateCreateShortcutAction()-»
+result.addAll(getForeignShortcuts((org.eclipse.gmf.runtime.notation.Diagram) view, parentElement));
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addForeignShortcuts FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenLink-»
+ «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target»getLinksTargetByType«ELSE»getLinksSourceByType«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenCommonBase-»
+ «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target-»
+ getOutgoingLinksByType«ELSEIF referenceType = gmfgen::GenNavigatorReferenceType::in_source-»
+ getIncomingLinksByType«ELSE-»
+ «IF (Sequence { segment._from })[gmfgen::GenDiagram]->size() > 0 and (Sequence { segment.to })[gmfgen::GenLink]->size() > 0-»
+ getDiagramLinksByType«ELSE-»
+ getChildrenByType«ENDIF-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
+ «LET getChildReferencesFrom(self, null) AS _references-»
+ «EXPAND internal_i18nAccessors(null) FOREACH getGroupNames(_references)-»
+ «ENDLET-»
+ «FOREACH getNavigatorContainerNodes(self) AS contextElement-»
+ «LET getChildReferencesFrom(self, contextElement) AS _references-»
+ «EXPAND internal_i18nAccessors(contextElement) FOREACH getGroupNames(_references)-»
+ «ENDLET-»
+ «ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors(contextElement : gmfgen::GenCommonBase) FOR String-»
+«IF null <> self»«EXPAND xpt::Externalizer::accessorField(i18nKeyForGroup(self, contextElement))»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenNavigator-»
+«LET getChildReferencesFrom(self, null) AS _references-»
+«EXPAND internal_i18nValues(null) FOREACH getGroupNames(_references)-»
+«ENDLET-»
+«FOREACH getNavigatorContainerNodes(self) AS contextElement-»
+«LET getChildReferencesFrom(self, contextElement) AS _references-»
+«EXPAND internal_i18nValues(contextElement) FOREACH getGroupNames(_references)-»
+«ENDLET-»
+«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues(contextElement : gmfgen::GenCommonBase) FOR String-»
+«IF null <> self»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForGroup(self, contextElement), self)»«ENDIF-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt
new file mode 100644
index 000000000..2a05b29cf
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE NavigatorGroup FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «navigatorGroupClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND getGroupName-»
+
+ «EXPAND getIcon-»
+
+ «EXPAND getChildren-»
+
+ «EXPAND addChildren-»
+
+ «EXPAND addChild-»
+
+ «EXPAND isEmpty-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String myGroupName;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private String myIcon;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection myChildren = new java.util.LinkedList();
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+«navigatorGroupClassName»(String groupName, String icon, Object parent) {
+ super(parent);
+ myGroupName = groupName;
+ myIcon = icon;
+}
+«ENDDEFINE»
+
+«DEFINE getGroupName FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getGroupName() {
+ return myGroupName;
+}
+«ENDDEFINE»
+
+«DEFINE getIcon FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getIcon() {
+ return myIcon;
+}
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren() {
+ return myChildren.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE addChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addChildren(java.util.Collection children) {
+ myChildren.addAll(children);
+}
+«ENDDEFINE»
+
+«DEFINE addChild FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addChild(Object child) {
+ myChildren.add(child);
+}
+«ENDDEFINE»
+
+«DEFINE isEmpty FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isEmpty() {
+ return myChildren.size() == 0;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» anotherGroup = («getNavigatorGroupQualifiedClassName()») obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return getGroupName().hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt
new file mode 100644
index 000000000..fca531c27
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+
+«DEFINE NavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «navigatorItemClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
+
+ «EXPAND registerAdapterFactory-»
+
+ «EXPAND attributes-»
+
+ «EXPAND _constructor-»
+
+ «EXPAND getView-»
+
+ «EXPAND isLeaf-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
+ org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getNavigatorItemQualifiedClassName()» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
+ return ((«getNavigatorItemQualifiedClassName()») adaptableObject).getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.View myView;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean myLeaf = false;
+«ENDDEFINE»
+
+«DEFINE _constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «navigatorItemClassName»(org.eclipse.gmf.runtime.notation.View view, Object parent, boolean isLeaf) {
+ super(parent);
+ myView = view;
+ myLeaf = isLeaf;
+}
+«ENDDEFINE»
+
+«DEFINE getView FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.notation.View getView() {
+ return myView;
+}
+«ENDDEFINE»
+
+«DEFINE isLeaf FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLeaf() {
+ return myLeaf;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getNavigatorItemQualifiedClassName()») {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getNavigatorItemQualifiedClassName()») obj).getView()));
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt
new file mode 100644
index 000000000..4f2d3510b
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt
@@ -0,0 +1,424 @@
+/*
+ * Copyright (c) 2006, 2008 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION xpt::navigator::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE NavigatorLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «labelProviderClassName» extends org.eclipse.jface.viewers.LabelProvider implements org.eclipse.ui.navigator.ICommonLabelProvider, org.eclipse.jface.viewers.ITreePathLabelProvider {
+
+ «EXPAND staticInitializer-»
+
+ «EXPAND updateLabel-»
+
+ «EXPAND getImage-»
+
+ «EXPAND getViewImage-»
+
+ «EXPAND getImageByKey-»
+
+ «EXPAND getText-»
+
+ «EXPAND getViewText-»
+
+ «EXPAND getTextMethod FOREACH getNavigatorContainedNodes(self)-»
+
+ «EXPAND getUnknownElementText-»
+
+ «EXPAND getUnresolvedDomainElementProxyText-»
+
+ «EXPAND _init-»
+
+ «EXPAND restoreState-»
+
+ «EXPAND saveState-»
+
+ «EXPAND getDescription-»
+
+ «EXPAND isOwnView-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE staticInitializer FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND unknownElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND notFoundElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE updateLabel FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void updateLabel(org.eclipse.jface.viewers.ViewerLabel label, org.eclipse.jface.viewers.TreePath elementPath) {
+ Object element = elementPath.getLastSegment();
+ if (element instanceof «getNavigatorItemQualifiedClassName()» && !isOwnView(((«getNavigatorItemQualifiedClassName()») element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+}
+«ENDDEFINE»
+
+«DEFINE getImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ «EXPAND getNavigatorGroupImage-»
+
+ «EXPAND getNavigatorItemImage-»
+
+ «EXPAND getAdaptableImage-»
+
+ «EXPAND getAdditionalInputImage-»
+ return super.getImage(element);
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorGroupImage FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundledImage(group.getIcon());
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorItemImage FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+}
+«ENDDEFINE»
+
+«DEFINE getAdaptableImage FOR gmfgen::GenNavigator-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+// Due to plugin.xml content will be called only for "own" views
+if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null && isOwnView(view)) {
+ return getImage(view);
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getAdditionalInputImage FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE getViewImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(org.eclipse.gmf.runtime.notation.View view) {
+ «IF not getNavigatorContainedNodes(self)->isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseImage FOREACH getNavigatorContainedNodes(self)-»
+ }
+ «ENDIF-»
+ return getImage(«EXPAND unknownElementKey», null); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE caseImage FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return getImage("«EXPAND key»", «IF null <> elementType»«EXPAND xpt::providers::ElementTypes::accessElementType»«ELSE»null«ENDIF»);«EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getImageByKey FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.graphics.Image getImage(String key, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ org.eclipse.jface.resource.ImageRegistry imageRegistry = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry();
+ org.eclipse.swt.graphics.Image image = imageRegistry.get(key);
+ if (image == null && elementType != null && «editorGen.diagram.getElementTypesQualifiedClassName()».isKnownElementType(elementType)) {
+ image = «editorGen.diagram.getElementTypesQualifiedClassName()».getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get(«EXPAND notFoundElementKey»); «EXPAND xpt::Common::nonNLS»
+ imageRegistry.put(key, image);
+ }
+ return image;
+}
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ «EXPAND getNavigatorGroupText-»
+
+ «EXPAND getNavigatorItemText-»
+
+ «EXPAND getAdaptableText-»
+
+ «EXPAND getAdditionalInputText-»
+ return super.getText(element);
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorGroupText FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
+ return group.getGroupName();
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorItemText FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+«ENDDEFINE»
+
+«DEFINE getAdaptableText FOR gmfgen::GenNavigator-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+// Due to plugin.xml content will be called only for "own" views
+if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null && isOwnView(view)) {
+ return getText(view);
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getAdditionalInputText FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE getViewText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(org.eclipse.gmf.runtime.notation.View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ «IF not getNavigatorContainedNodes(self)->isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseText FOREACH getNavigatorContainedNodes(self)-»
+ }
+ «ENDIF-»
+ return getUnknownElementText(view);
+}
+«ENDDEFINE»
+
+«DEFINE caseText FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return «EXPAND getTextMethodName»(view);
+«ENDDEFINE»
+
+«DEFINE getTextMethodName FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»Text«ENDDEFINE»
+
+«DEFINE getTextMethod FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String «EXPAND getTextMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ «EXPAND getText-»
+}
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenCommonBase»«ERROR 'Incorrect GenCommonBase: ' + self.repr()»«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenDiagram-»
+ «EXPAND getLabelFeatureText(domainDiagramElement)-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenChildLabelNode-»
+«EXPAND getDiagramLabelText(self, labelModelFacet)-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenLinkLabel»«EXPAND getDiagramLabelText(link, modelFacet)»«ENDDEFINE»
+«DEFINE getText FOR gmfgen::GenNodeLabel»«EXPAND getDiagramLabelText(node, modelFacet)»«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNode-»
+«IF labels->isEmpty()-»
+ «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
+«ELSE-»
+ «EXPAND getDiagramLabelText(labels->asSequence())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenLink-»
+«IF labels->isEmpty()-»
+ «IF null <> modelFacet-»
+ «EXPAND getText(modelFacet)-»
+«ELSE-»
+ «EXPAND returnEmptyString-»
+ «ENDIF-»
+«ELSE-»
+ «EXPAND getDiagramLabelText(labels->asSequence())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getDiagramLabelText(labels : Sequence(gmfgen::GenLabel)) FOR gmfgen::GenCommonBase-»
+ «IF labels->isEmpty()-»
+ «ERROR 'Empty list of labels passed'-»
+ «ENDIF-»
+ «LET labels->first().oclAsType(gmfgen::GenLabel) AS label-»
+ «EXPAND getDiagramLabelText(self, label.modelFacet) FOR label-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE getText(modelFacet : gmfgen::LinkModelFacet) FOR gmfgen::GenLink-»
+ «EXPAND returnEmptyString-»
+«ENDDEFINE»
+
+«DEFINE getText(modelFacet : gmfgen::TypeLinkModelFacet) FOR gmfgen::GenLink-»
+ «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenCompartment-»
+return "«title»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«REM»FIXME: Refactor. Need to reuse parts of TextAware.xpt«ENDREM»
+/*
+ * this/self - aka hintHolder, visual element to present a text
+ * elementTypeHolder - model element being displayed
+ * modelFacet - may be null
+ */
+«DEFINE getDiagramLabelText(elementTypeHolder : gmfgen::GenCommonBase, labelModelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
+org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «EXPAND parsers::ParserProvider::accessorCall(elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»;
+if (parser != null) {
+ return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
+} else {
+ «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Parser was not found for label " + «visualID»);«EXPAND xpt::Common::nonNLS»
+ «EXPAND returnEmptyString-»
+}
+«ENDDEFINE»
+
+
+«DEFINE getLabelFeatureText(genClass : genmodel::GenClass) FOR gmfgen::GenCommonBase-»
+ «IF null <> genClass and null <> genClass.labelFeature-»
+«EXPAND MetaModel::DeclareAndAssign('domainModelElement', 'view.getElement()') FOR genClass»
+if (domainModelElement != null) {
+ return «IF not isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»«EXPAND MetaModel::getFeatureValue('domainModelElement', genClass) FOR genClass.labelFeature»«IF not isStringFeature(genClass.labelFeature)»)«ENDIF»;
+} else {
+ «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("No domain element for view with visualID = " + «visualID»); «EXPAND xpt::Common::nonNLS»
+ «EXPAND returnEmptyString-»
+}
+ «ELSE-»
+ «EXPAND returnEmptyString-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE returnEmptyString FOR OclAny-»
+return ""; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getUnknownElementText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String getUnknownElementText(org.eclipse.gmf.runtime.notation.View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
+}
+«ENDDEFINE»
+
+«DEFINE getUnresolvedDomainElementProxyText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String getUnresolvedDomainElementProxyText(org.eclipse.gmf.runtime.notation.View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
+}
+«ENDDEFINE»
+
+«DEFINE _init FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE restoreState FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void restoreState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE saveState FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void saveState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE getDescription FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getDescription(Object anElement) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE isOwnView FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
+ return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
+}
+«ENDDEFINE»
+
+«DEFINE unknownElementKey FOR OclAny»"«EXPAND commonKeyPrefix»UnknownElement"«ENDDEFINE»
+
+«DEFINE notFoundElementKey FOR OclAny»"«EXPAND commonKeyPrefix»ImageNotFound"«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenCommonBase»«ERROR 'Incorrect GenCommonBase: ' + self.repr()»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenDiagram»«EXPAND commonKeyPrefix»Diagram?«EXPAND keyFragment FOR domainDiagramElement»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenNode»«EXPAND commonKeyPrefix»«EXPAND keyFragment»«IF null <> modelFacet»«EXPAND keyFragment FOR modelFacet.metaClass»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenNode»Node?«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenTopLevelNode»TopLevelNode?«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLink»«EXPAND commonKeyPrefix»Link?«IF null <> modelFacet»«EXPAND keyFragment FOR modelFacet»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::LinkModelFacet»«ERROR 'Incorrect link model facet passed: ' + self.repr()»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::TypeLinkModelFacet»«EXPAND keyFragment FOR metaClass»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::FeatureLinkModelFacet»«EXPAND keyFragment FOR metaFeature»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenCompartment»«EXPAND key FOR node»?Compartment?«title»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLabel»«ERROR 'Incorrect GenLabel:' + self.repr()»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenNodeLabel»«EXPAND key FOR node»«EXPAND keyFragment»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLinkLabel»«EXPAND key FOR link»«EXPAND keyFragment»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenLabel»?Label?«EXPAND keyFragment(self) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE keyFragment FOR genmodel::GenClass»«genPackage.ecorePackage.nsURI»?«ecoreClass.name»«ENDDEFINE»
+
+«DEFINE keyFragment FOR genmodel::GenFeature»«EXPAND keyFragment FOR genClass»?«ecoreFeature.name»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::Viewmap»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::FigureViewmap»«figureQualifiedClassName»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::InnerClassViewmap»«className»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::ParentAssignedViewmap»«figureQualifiedClassName»«ENDDEFINE»
+
+«DEFINE keyFragment(label : gmfgen::GenLabel) FOR gmfgen::LabelModelFacet»«ERROR 'Incorrect label model facet: ' + self.repr()»«ENDDEFINE»
+
+«DEFINE keyFragment(label : gmfgen::GenLabel) FOR gmfgen::FeatureLabelModelFacet»«EXPAND keyFragment FOREACH metaFeatures»«ENDDEFINE»
+
+«DEFINE keyFragment(label : gmfgen::GenLabel) FOR gmfgen::DesignLabelModelFacet»«EXPAND keyFragment FOR label.viewmap»«ENDDEFINE»
+
+«DEFINE commonKeyPrefix FOR OclAny»Navigator?«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLinkHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLinkHelper.xpt
new file mode 100644
index 000000000..a27c573ad
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLinkHelper.xpt
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorLinkHelper FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «linkHelperClassName» implements org.eclipse.ui.navigator.ILinkHelper {
+
+ «EXPAND xpt::navigator::getEditorInput::getEditorInput FOR editorGen-»
+
+ «EXPAND findSelection-»
+
+ «EXPAND activateEditor-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE findSelection FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) {
+ «EXPAND defineDiagramDocument FOR editorGen.plugin-»
+ «EXPAND findSelectionBody-»
+}
+«ENDDEFINE»
+
+«DEFINE defineDiagramDocument FOR gmfgen::GenPlugin-»
+org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = «getActivatorQualifiedClassName()».getInstance().getDocumentProvider().getDiagramDocument(anInput);
+«ENDDEFINE»
+
+«DEFINE findSelectionBody FOR gmfgen::GenNavigator-»
+ «EXPAND getDiagramSelection FOR getDiagramTopReference(self)-»
+ return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+«ENDDEFINE»
+
+«REM»
+ Linking with editor currently supported only for the navigators conteining top
+ reference to the diagram. In this case diagram node will be selected in navigator.
+«ENDREM»
+«DEFINE getDiagramSelection FOR gmfgen::GenNavigatorChildReference-»
+«EXPAND getDiagram FOR navigator.editorGen-»
+org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagram.eResource());
+if (file != null) {
+ «IF isInsideGroup()-»
+ «navigator.getNavigatorGroupQualifiedClassName()» parentGroup = new «navigator.getNavigatorGroupQualifiedClassName()»("«groupName»", "«groupIcon»", «EXPAND xpt::editor::VisualIDRegistry::modelID FOR navigator.editorGen.diagram», file);
+ «ENDIF-»
+ «navigator.getNavigatorItemQualifiedClassName()» item = new «navigator.getNavigatorItemQualifiedClassName()»(diagram, «IF isInsideGroup()»parentGroup«ELSE»file«ENDIF», false);
+ «IF isInsideGroup()-»
+ parentGroup.addChild(item);
+ «ENDIF-»
+ return new org.eclipse.jface.viewers.StructuredSelection(«IF isInsideGroup()»parentGroup«ELSE»item«ENDIF»);
+}
+«ENDDEFINE»
+
+«DEFINE getDiagram FOR gmfgen::GenEditorGenerator-»
+if (document == null) {
+ return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+}
+org.eclipse.gmf.runtime.notation.Diagram diagram = document.getDiagram();
+«ENDDEFINE»
+
+«DEFINE activateEditor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void activateEditor(org.eclipse.ui.IWorkbenchPage aPage, org.eclipse.jface.viewers.IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof «getAbstractNavigatorItemQualifiedClassName()») {
+ return;
+ }
+
+ «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») aSelection.getFirstElement();
+ org.eclipse.gmf.runtime.notation.View navigatorView = null;
+ if (abstractNavigatorItem instanceof «getNavigatorItemQualifiedClassName()») {
+ navigatorView = ((«getNavigatorItemQualifiedClassName()») abstractNavigatorItem).getView();
+ } else if (abstractNavigatorItem instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» navigatorGroup = («getNavigatorGroupQualifiedClassName()») abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof «getNavigatorItemQualifiedClassName()») {
+ navigatorView = ((«getNavigatorItemQualifiedClassName()») navigatorGroup.getParent()).getView();
+ }«EXPAND getViewFromShortcut-»
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ org.eclipse.ui.IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ org.eclipse.ui.IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof «EXPAND diagramEditorClassFQName») {
+ «EXPAND diagramEditorClassFQName» diagramEditor = («EXPAND diagramEditorClassFQName») editor;
+ org.eclipse.emf.ecore.resource.ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
+ org.eclipse.emf.ecore.EObject selectedView = diagramEditorResourceSet.getEObject(org.eclipse.emf.ecore.util.EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) diagramEditor.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ org.eclipse.gef.EditPart selectedEditPart = (org.eclipse.gef.EditPart) graphicalViewer.getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getViewFromShortcut FOR gmfgen::GenNavigator-»
+ «IF editorGen.diagram.generateShortcutIcon()-»
+else if (navigatorGroup.getParent() instanceof org.eclipse.core.runtime.IAdaptable) {
+ navigatorView = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) navigatorGroup.getParent()).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE diagramEditorClassFQName FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorSorter.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorSorter.xpt
new file mode 100644
index 000000000..c629b7227
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorSorter.xpt
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006,2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorSorter FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «sorterClassName» extends org.eclipse.jface.viewers.ViewerSorter {
+
+ «EXPAND attributes-»
+
+ «EXPAND category-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final int GROUP_CATEGORY = «getMaxVisualID(self) + 2»;
+ «IF editorGen.diagram.generateCreateShortcutAction()-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final int SHORTCUTS_CATEGORY = «getMaxVisualID(self) + 1»;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE category FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int category(Object element) {
+ if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» item = («getNavigatorItemQualifiedClassName()») element;
+ «IF editorGen.diagram.generateCreateShortcutAction()-»
+ if (item.getView().getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ return SHORTCUTS_CATEGORY;
+ }
+ «ENDIF-»
+ return «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(item.getView());
+ }
+ return GROUP_CATEGORY;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto
new file mode 100644
index 000000000..18631d24e
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto
@@ -0,0 +1,63 @@
+import xpt.navigator.NativeUtils;
+
+modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
+modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
+
+library Utils;
+
+helper getMaxVisualID(navigator : genModel::GenNavigator) : Integer {
+ return (if getMaxVisualIDNavigatorNode(navigator)->size() = 1 then getMaxVisualIDNavigatorNode(navigator)->first().oclAsType(genModel::GenCommonBase).visualID else 0 endif)
+}
+
+helper getMaxVisualIDNavigatorNode(navigator : genModel::GenNavigator) : Sequence(genModel::GenCommonBase) {
+ return getNavigatorNodes(navigator)->select(navigatorNode | isMaximumVisualID(navigatorNode, getNavigatorNodes(navigator)))
+}
+
+helper isMaximumVisualID(commonBase : genModel::GenCommonBase, allNavigatorNodes : Sequence(genModel::GenCommonBase)) : Boolean {
+ return allNavigatorNodes->select(navigatorNode | navigatorNode.visualID > commonBase.visualID)->isEmpty()
+}
+
+helper isStringFeature(feature : genModel_1::GenFeature) : Boolean {
+ return feature.ecoreFeature.eType.name = 'EString'
+}
+
+helper getNavigatorContainerNodes(navigator : genModel::GenNavigator) : Sequence(genModel::GenCommonBase) {
+ return getNavigatorNodes(navigator)->select(n | getChildReferencesFrom(navigator, n)->size() > 0)
+}
+
+helper getNavigatorContainedNodes(navigator : genModel::GenNavigator) : Sequence(genModel::GenCommonBase) {
+ return getNavigatorNodes(navigator)->select(n | getChildReferencesTo(navigator, n)->size() > 0)
+}
+
+helper getNavigatorNodes(navigator : genModel::GenNavigator) : Sequence(genModel::GenCommonBase) {
+ return let diagram = navigator.editorGen.diagram in (((Sequence { diagram })[genModel::GenContainerBase]->union(diagram.topLevelNodes->asSequence())->union(diagram.childNodes->asSequence()))[genModel::GenCommonBase]->union(diagram.links->asSequence())->union(diagram.compartments->asSequence()))[genModel::GenCommonBase]
+}
+
+helper getGroupNames(_references : Sequence(genModel::GenNavigatorChildReference)) : Set(String) {
+ return _references->select(ref | ref.isInsideGroup())->collect(ref | ref.groupName)->asOrderedSet()
+}
+
+helper getNavigatorReference(groupName : String, childReferences : Sequence(genModel::GenNavigatorChildReference)) : genModel::GenNavigatorChildReference {
+ return childReferences->select(r | r.groupName = groupName)->first()
+}
+
+helper getChildReferencesFrom(navigator : genModel::GenNavigator, parent : genModel::GenCommonBase) : Sequence(genModel::GenNavigatorChildReference) {
+ return navigator.childReferences->select(r | parent.visualID = r.parent.visualID)->asSequence()
+}
+
+helper getChildReferencesTo(navigator : genModel::GenNavigator, child : genModel::GenCommonBase) : Sequence(genModel::GenNavigatorChildReference) {
+ return navigator.childReferences->select(r | child.visualID = r.child.visualID)->asSequence()
+}
+
+helper getDiagramTopReference(navigator : genModel::GenNavigator) : genModel::GenNavigatorChildReference {
+ return let diagramTopReferences = navigator.childReferences->select(cr | null = cr.parent)->select(cr | cr.child = navigator.editorGen.diagram) in (if diagramTopReferences->size() = 0 then null else diagramTopReferences->at(0 + 1) endif)
+}
+
+
+helper i18nKeyForGroup(groupName : String, contextElement : genModel::GenCommonBase) : String {
+ return 'NavigatorGroupName.' + (if null <> contextElement then contextElement.getUniqueIdentifier() else 'File' endif) + '.' + asValidJavaIdentifier(groupName)
+}
+
+helper i18nKeyForOpenDiagramActionName() : String {
+ return 'NavigatorActionProvider.OpenDiagramActionName'
+}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/extensions.xpt
new file mode 100644
index 000000000..283d17861
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/extensions.xpt
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
+
+«DEFINE extensions FOR gmfgen::GenNavigator-»
+ «EXPAND editorInputPropertyTester('URIEditorInput', 'org.eclipse.emf.common.ui.URIEditorInput', getUriInputTesterQualifiedClassName())-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+
+ «EXPAND editorInputPropertyTester('Shortcut', 'org.eclipse.gmf.runtime.notation.View', editorGen.diagram.getShortcutPropertyTesterQualifiedClassName())-»
+«ENDIF-»
+«IF generateDomainModelNavigator and null <> editorGen.domainGenModel-»
+
+ «EXPAND editorInputPropertyTester('DomainModelElement', 'org.eclipse.emf.ecore.EObject', getDomainModelElementTesterQualifiedClassName())-»
+«ENDIF-»
+
+ «EXPAND registerBindings-»
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent" id="navigator-content">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <navigatorContent
+ id="«contentExtensionID»"
+ name="«contentExtensionName»"
+ priority="«contentExtensionPriority»"
+ contentProvider="«getContentProviderQualifiedClassName()»"
+ labelProvider="«getLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </possibleChildren>
+ <commonSorter
+ id="«sorterExtensionID»"
+ class="«getSorterQualifiedClassName()»">
+ <parentExpression>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </or>
+ </parentExpression>
+ </commonSorter>
+ </navigatorContent>
+«IF generateDomainModelNavigator and null <> editorGen.domainGenModel-»
+ <navigatorContent
+ id="«domainContentExtensionID»"
+ name="«domainContentExtensionName»"
+ priority="«domainContentExtensionPriority»"
+ contentProvider="«getDomainContentProviderQualifiedClassName()»"
+ labelProvider="«getDomainLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.domainFileExtension»"/>
+ </and>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </possibleChildren>
+ </navigatorContent>
+«ENDIF-»
+ <actionProvider
+ id="«actionProviderID»"
+ class="«getActionProviderQualifiedClassName()»">
+ <enablement>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </enablement>
+ </actionProvider>
+ </extension>
+
+ «EXPAND registerLinkHelper-»
+«ENDDEFINE»
+
+«DEFINE editorInputPropertyTester(_property : String, type : String, testerClass : String) FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.core.expressions.propertyTesters" id="navigator-proptest.is«_property»">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyTester
+ id="«editorGen.plugin.iD».«_property»PropertyTester"
+ type="«type»"
+ namespace="«editorGen.plugin.iD»"
+ properties="is«_property»"
+ class="«testerClass»">
+ </propertyTester>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerBindings FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.viewer" id="navigator-viewbinding">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="«contentExtensionID»"/>
+«IF generateDomainModelNavigator and null <> editorGen.domainGenModel-»
+ <contentExtension pattern="«domainContentExtensionID»"/>
+«ENDIF-»
+ <contentExtension pattern="«linkHelperExtensionID»"/>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension pattern="«actionProviderID»"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerLinkHelper FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.linkHelper" id="navigator-linkhelper">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <linkHelper
+ id="«linkHelperExtensionID»"
+ class="«getLinkHelperQualifiedClassName()»">
+ <editorInputEnablement>
+ <and>
+ <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
+ <test property="«editorGen.plugin.iD».isURIEditorInput"/>
+ </and>
+ </editorInputEnablement>
+ <selectionEnablement>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </selectionEnablement>
+ </linkHelper>
+ </extension>
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/getEditorInput.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/getEditorInput.xpt
new file mode 100644
index 000000000..ccf0ec4e2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/getEditorInput.xpt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 Borland Software Corporation
+ *
+ * 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
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+
+«DEFINE getEditorInput FOR gmfgen::GenEditorGenerator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.ui.IEditorInput getEditorInput(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ org.eclipse.emf.ecore.resource.Resource diagramResource = diagram.eResource();
+«IF null = application-»
+ for (java.util.Iterator it = diagramResource.getContents().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject nextEObject = (org.eclipse.emf.ecore.EObject) it.next();
+ if (nextEObject == diagram) {
+ return new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ break;
+ }
+ }
+«ENDIF-»
+ «EXPAND defineURIEditorInput('diagram') FOR diagram-»
+ return editorInput;
+}
+«ENDDEFINE»
+
+«DEFINE defineURIEditorInput(diagramVarName : String) FOR gmfgen::GenDiagram-»
+«EXPAND defineURIEditorInput(diagramVarName, 'editorInput')-»
+«ENDDEFINE»
+
+«DEFINE defineURIEditorInput(diagramVarName : String, editorInputVarName : String) FOR gmfgen::GenDiagram-»
+org.eclipse.emf.common.util.URI uri = org.eclipse.emf.ecore.util.EcoreUtil.getURI(«diagramVarName»);
+String editorName = uri.lastSegment() + "#" + «diagramVarName».eResource().getContents().indexOf(«diagramVarName»); «EXPAND xpt::Common::nonNLS»
+org.eclipse.ui.IEditorInput «editorInputVarName» = new org.eclipse.emf.common.ui.URIEditorInput(uri, editorName);
+«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/navigatorGroup.gif b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/navigatorGroup.gif
new file mode 100644
index 000000000..fca9c53e6
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/navigatorGroup.gif
Binary files differ

Back to the top