Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2010-04-23 16:30:44 -0400
committeratikhomirov2010-04-23 16:30:44 -0400
commit5013011f19ca48dd3c9b8abd775712fd0d61e338 (patch)
tree7130f5f9fb186481cf080b5c3fb877cd1528bfcc
parentacc2cb8417e68e032de2f51fc91d2569dba81bf3 (diff)
downloadorg.eclipse.gmf-tooling-5013011f19ca48dd3c9b8abd775712fd0d61e338.tar.gz
org.eclipse.gmf-tooling-5013011f19ca48dd3c9b8abd775712fd0d61e338.tar.xz
org.eclipse.gmf-tooling-5013011f19ca48dd3c9b8abd775712fd0d61e338.zip
[188329] Java5-friendly code - short for cycle notation when Iterable is availablev20100423-2359
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/CodeStyle.xpt19
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt10
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt6
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt6
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt14
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt2
7 files changed, 40 insertions, 35 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates/CodeStyle.xpt b/plugins/org.eclipse.gmf.codegen/templates/CodeStyle.xpt
index fbf3d3acc..f0de4308c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/CodeStyle.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/CodeStyle.xpt
@@ -33,20 +33,21 @@
«DEFINE newGenericInstance2(String varName, String type, String typeArgument1, String typeArgument2, String typeArgument3) FOR gmfgen::GenCommonBase»«EXPAND _g2_3(type, typeArgument1, typeArgument2, typeArgument3)» «varName»= new «EXPAND _g2_3(type, typeArgument1, typeArgument2, typeArgument3)»«ENDDEFINE»
// iterate cycle with explicit iterator variable
+// use this one if you need access to iterator (i.e. remove elements) or when there's no java.lang.Iterable source (i.e. some API gives Iterator right away)
«DEFINE iterate(String elementVar, String elementType, String iteratorVar, String iterationSource) FOR gmfgen::GenCommonBase-»
for («EXPAND G('java.util.Iterator', elementType)» «iteratorVar» = «iterationSource»; «iteratorVar».hasNext();) {
«elementType» «elementVar» = «IF 'Object' <> elementType /*cast to Object is implicit*/ and not (self.jdkComplianceLevel() > 4) /*generics are not used then, should cast. Using 'not greater 4' instead of 'less than 5' to handle null/undefined case correctly*/»(«elementType») «ENDIF»«iteratorVar».next();
«ENDDEFINE»
-// uses default iterator name, 'it'
-TODO Java5-style iterate cycle (no explicit iterator), if possible. Need to complicate iterationSource - whether it's .iterator() (present state) or just collection
-«DEFINE iterate(String elementVar, String elementType, String iterationSource) FOR gmfgen::GenCommonBase-»
-«REM»
-<IF self.getDiagram().domainDiagramElement.jdkComplianceLevel() > 4>
-for (<elementType> <elementVar> : <iterationSource>) {
-<ELSE>
-«ENDREM-»
-«EXPAND iterate(elementVar, elementType, 'it', iterationSource)-»
+//
+// generates Java5-style iterate cycle (no explicit iterator), if possibl, otherwise uses default iterator name, 'it'
+// beware of nested cycles using same 'it' name (relevant for Java 1.4)
+«DEFINE iterate(String elementVar, String elementType, String iterable /*java.lang.Iterable*/) FOR gmfgen::GenCommonBase-»
+«IF self.jdkComplianceLevel() > 4 -»
+for («elementType» «elementVar» : «iterable») {
+«ELSE-»
+«EXPAND iterate(elementVar, elementType, 'it', iterable.concat('.iterator()'))-»
+«ENDIF-»
«ENDDEFINE»
«DEFINE emptyList FOR gmfgen::GenCommonBase-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
index f32fda9d6..69528a98f 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
@@ -65,7 +65,7 @@ protected java.util.List getSemanticChildrenList() {
org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.emf.ecore.EObject', 'result')»();
«EXPAND CodeStyle::G('java.util.List', getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName())» childDescriptors = «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodCall»(viewObject);
- «EXPAND CodeStyle::iterate('d', getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName(), 'childDescriptors.iterator()')-»
+ «EXPAND CodeStyle::iterate('d', getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName(), 'childDescriptors')-»
result.add(d.getModelElement());
}
return result;
@@ -117,7 +117,7 @@ private boolean isMyDiagramElement(org.eclipse.gmf.runtime.notation.View view) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'orphaned')»();
// we care to check only views we recognize as ours
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'knownViewChildren')»();
- «EXPAND CodeStyle::iterate('v', 'org.eclipse.gmf.runtime.notation.View', 'getViewChildren().iterator()')-»
+ «EXPAND CodeStyle::iterate('v', 'org.eclipse.gmf.runtime.notation.View', 'getViewChildren()')-»
if (isMyDiagramElement(v)) {
knownViewChildren.add(v);
}
@@ -137,7 +137,7 @@ private boolean isMyDiagramElement(org.eclipse.gmf.runtime.notation.View view) {
«IF childrenShareSameMetaclass-»
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'potentialMatch')»(); // semanticElement matches, hint does not
«ENDIF-»
- «EXPAND CodeStyle::iterate('childView', 'org.eclipse.gmf.runtime.notation.View', 'getViewChildren().iterator()')-»
+ «EXPAND CodeStyle::iterate('childView', 'org.eclipse.gmf.runtime.notation.View', 'getViewChildren()')-»
org.eclipse.emf.ecore.EObject semanticElement = childView.getElement();
if (next.getModelElement().equals(semanticElement)) {
if (hint.equals(childView.getType())) {
@@ -176,7 +176,7 @@ private boolean isMyDiagramElement(org.eclipse.gmf.runtime.notation.View view) {
org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand boundsCommand = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(host().getEditingDomain(), org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.SetLocationCommand_Label_Resize);
«ENDIF-»
«EXPAND CodeStyle::newGenericInstance('java.util.ArrayList', 'org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor', 'viewDescriptors')»(childDescriptors.size());
- «EXPAND CodeStyle::iterate('next', diagramUpdater.getNodeDescriptorQualifiedClassName(), 'childDescriptors.iterator()')-»
+ «EXPAND CodeStyle::iterate('next', diagramUpdater.getNodeDescriptorQualifiedClassName(), 'childDescriptors')-»
String hint = «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall('next.getVisualID()')»;
org.eclipse.core.runtime.IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint);
org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor descriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(elementAdapter, org.eclipse.gmf.runtime.notation.Node.class, hint, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, false, host().getDiagramPreferencesHint());
@@ -300,7 +300,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', editorGen.diagramUpdater.g
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.core.runtime.IAdaptable')» createConnections(«EXPAND CodeStyle::G('java.util.Collection', editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName())» linkDescriptors, «EXPAND CodeStyle::G2('java.util.Map', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')» domain2NotationMap) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.runtime.IAdaptable', 'adapters')»();
- «EXPAND CodeStyle::iterate('nextLinkDescriptor', editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName(), 'linkDescriptors.iterator()')-»
+ «EXPAND CodeStyle::iterate('nextLinkDescriptor', editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName(), 'linkDescriptors')-»
org.eclipse.gef.EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
org.eclipse.gef.EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
if (sourceEditPart == null || targetEditPart == null) {
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt
index 0a10c0273..b4506991d 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt
@@ -155,7 +155,7 @@ protected void setupDocument(Object element, org.eclipse.gmf.runtime.diagram.ui.
«EXPAND xpt::Common::generatedMemberComment»
private long computeModificationStamp(ResourceSetInfo info) {
int result = 0;
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
«IF null = editorGen.application-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null) {
@@ -338,7 +338,7 @@ protected void doValidateState(Object element, Object computationContext) throws
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.resources.IFile', 'files2Validate')»();
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null && file.isReadOnly()) {
files2Validate.add(file);
@@ -396,7 +396,7 @@ if (info.isUpdateCache()) {
protected void updateCache(Object element) throws org.eclipse.core.runtime.CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
«IF null = editorGen.application-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null && file.isReadOnly()) {
@@ -444,7 +444,7 @@ protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object elem
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.runtime.jobs.ISchedulingRule', 'rules')»();
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null) {
rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
@@ -462,7 +462,7 @@ protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object eleme
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.runtime.jobs.ISchedulingRule', 'rules')»();
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null) {
rules.add(computeSchedulingRule(file));
@@ -480,7 +480,7 @@ protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Objec
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.runtime.jobs.ISchedulingRule', 'rules')»();
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null) {
rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
@@ -498,7 +498,7 @@ protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Obj
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.core.runtime.jobs.ISchedulingRule', 'files')»();
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
if (file != null) {
files.add(file);
@@ -537,7 +537,7 @@ private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.
protected void doSynchronize(Object element, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException {
ResourceSetInfo info = getResourceSetInfo(element);
if (info != null) {
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
handleElementChanged(info, nextResource, monitor);
}
return;
@@ -596,7 +596,7 @@ protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor,
fireElementStateChanging(element);
try {
monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagramTask(self)) FOR editorGen», info.getResourceSet().getResources().size() + 1); //"Saving diagram"
- «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'info.getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('nextResource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'info.getLoadedResourcesIterator()')-»
monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveNextResourceTask(self)) FOR editorGen»,
nextResource.getURI()));
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt
index c02536361..21eb8a44c 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt
@@ -140,6 +140,9 @@ public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet() {
}
«ENDDEFINE»
+«REM»
+ XXX Would be nice to change API and to return List instead of Iterator - there seems to be little sense using latter.
+«ENDREM»
«DEFINE getLoadedResourcesIterator FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
public «EXPAND CodeStyle::G('java.util.Iterator', 'org.eclipse.emf.ecore.resource.Resource')» getLoadedResourcesIterator() {
@@ -161,9 +164,10 @@ public void dispose() {
stopResourceListening();
«ENDIF-»
getResourceSet().eAdapters().remove(myResourceSetListener);
- «EXPAND CodeStyle::iterate('resource', 'org.eclipse.emf.ecore.resource.Resource', 'getLoadedResourcesIterator()')-»
+ «EXPAND CodeStyle::iterate('resource', 'org.eclipse.emf.ecore.resource.Resource', 'it', 'getLoadedResourcesIterator()')-»
resource.unload();
}
+«REM»FIXME: Perhaps, should wrap unload into transaction, otherwise each unload triggers a lot of root transactions«ENDREM-»
getEditingDomain().dispose();
}
«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt
index 384c50b1b..5473d6bc0 100755
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt
@@ -63,7 +63,7 @@ public class «className» {
}
«EXPAND xpt::Common::generatedMemberComment»
- «EXPAND CodeStyle::SuppressWarnings('{ "rawtypes", "unchecked" }' /*unchecked needed only until I have .iterator() below. Once I use Java5 for notation there, unchecked is not needed */) FOR container.editorGen.diagram-»
+ «EXPAND CodeStyle::SuppressWarnings('"rawtypes"') FOR container.editorGen.diagram-»
protected Object doEvaluate(Object context, java.util.Map env) {
if (oclExpression == null) {
return null;
@@ -71,7 +71,7 @@ public class «className» {
// on the first call, both evalEnvironment and extentMap are clear, for later we have finally, below.
org.eclipse.ocl.EvaluationEnvironment«EXPAND CodeStyle::G('?,?,?,?,?') FOR container.editorGen.diagram» evalEnv = oclInstance.getEvaluationEnvironment();
// initialize environment«REM»Using Object below because Map env comes as raw type, and Object(unlike String) works fine for both Iterator<Type> = iterable.iterator() and for (Type a : iterable) code styles «ENDREM»
- «EXPAND CodeStyle::iterate('nextKey', 'Object', 'env.keySet().iterator()') FOR container.editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextKey', 'Object', 'env.keySet()') FOR container.editorGen.diagram-»
evalEnv.replace((String) nextKey, env.get(nextKey));
}
try {
@@ -86,7 +86,7 @@ public class «className» {
«EXPAND xpt::Common::generatedMemberComment»
private static void initCustomEnv(org.eclipse.ocl.Environment«EXPAND CodeStyle::G('?,org.eclipse.emf.ecore.EClassifier,?,?,?,org.eclipse.emf.ecore.EParameter,?,?,?,?,?,?') FOR container.editorGen.diagram» ecoreEnv, java.util.Map«EXPAND CodeStyle::G2('String', 'org.eclipse.emf.ecore.EClassifier') FOR container.editorGen.diagram» environment) {
«EXPAND initializeEnvironment('ecoreEnv')-»
- «EXPAND CodeStyle::iterate('varName', 'String', 'environment.keySet().iterator()') FOR container.editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('varName', 'String', 'environment.keySet()') FOR container.editorGen.diagram-»
org.eclipse.emf.ecore.EClassifier varType = «EXPAND CodeStyle::castTyped('org.eclipse.emf.ecore.EClassifier') FOR container.editorGen.diagram»environment.get(varName);
ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt
index 299f87e3b..6ad9cd924 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt
@@ -219,7 +219,7 @@ public boolean hasChildren(Object element) {
«LET getChildReferencesFrom(self, null) AS _references-»
«EXPAND initGroupVariables(self, _references, 'file', null) FOREACH getGroupNames(_references)-»
«EXPAND CodeStyle::newGenericInstance('java.util.ArrayList', 'org.eclipse.gmf.runtime.notation.View', 'topViews') FOR editorGen.diagram»(resource.getContents().size());
- «EXPAND CodeStyle::iterate('o', 'org.eclipse.emf.ecore.EObject', 'resource.getContents().iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('o', 'org.eclipse.emf.ecore.EObject', 'resource.getContents()') FOR editorGen.diagram-»
if (o instanceof org.eclipse.gmf.runtime.notation.View) {
topViews.add((org.eclipse.gmf.runtime.notation.View) o);
}
@@ -313,7 +313,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.n
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» getOutgoingLinksByType(«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» nodes, String type) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'result') FOR editorGen.diagram»();
- «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes.iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes') FOR editorGen.diagram-»
result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
}
return result;
@@ -322,7 +322,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.n
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» getIncomingLinksByType(«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» nodes, String type) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'result') FOR editorGen.diagram»();
- «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes.iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes') FOR editorGen.diagram-»
result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
}
return result;
@@ -331,7 +331,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.n
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» getChildrenByType(«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» nodes, String type) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'result') FOR editorGen.diagram»();
- «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes.iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextNode', 'org.eclipse.gmf.runtime.notation.View', 'nodes') FOR editorGen.diagram-»
result.addAll(selectViewsByType(nextNode.getChildren(), type));
}
return result;
@@ -351,7 +351,7 @@ private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» selectViewsByType(«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» views, String type) {
«EXPAND CodeStyle::newGenericInstance('java.util.ArrayList', 'org.eclipse.gmf.runtime.notation.View', 'result') FOR editorGen.diagram»();
- «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'views.iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'views') FOR editorGen.diagram-»
if (type.equals(nextView.getType()) && isOwnView(nextView)) {
result.add(nextView);
}
@@ -367,7 +367,7 @@ private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', getNavigatorItemQualifiedClassName()) FOR editorGen.diagram» createNavigatorItems(«EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.gmf.runtime.notation.View') FOR editorGen.diagram» views, Object parent, boolean isLeafs) {
«EXPAND CodeStyle::newGenericInstance('java.util.ArrayList', getNavigatorItemQualifiedClassName(), 'result') FOR editorGen.diagram»(views.size());
- «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'views.iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'views') FOR editorGen.diagram-»
result.add(new «getNavigatorItemQualifiedClassName()»(nextView, parent, isLeafs));
}
return result;
@@ -381,7 +381,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', getNavigatorItemQualifiedC
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', getNavigatorItemQualifiedClassName()) FOR editorGen.diagram» getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
«EXPAND CodeStyle::newGenericInstance('java.util.LinkedList', 'org.eclipse.gmf.runtime.notation.View', 'result') FOR editorGen.diagram»();
- «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'diagram.getChildren().iterator()') FOR editorGen.diagram-»
+ «EXPAND CodeStyle::iterate('nextView', 'org.eclipse.gmf.runtime.notation.View', 'it', 'diagram.getChildren().iterator()') FOR editorGen.diagram-»
if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
result.add(nextView);
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt
index 3fbffff19..2e17091a2 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt
@@ -195,7 +195,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.notation.Diagram diagram =
(org.eclipse.gmf.runtime.notation.Diagram) editPart.getRoot().getContents().getModel();
«EXPAND CodeStyle::newGenericInstance('java.util.HashSet', 'org.eclipse.emf.ecore.EObject', 'elements')»();
- «EXPAND CodeStyle::iterate('element', 'org.eclipse.emf.ecore.EObject', 'diagram.getElement().eAllContents()')-»
+ «EXPAND CodeStyle::iterate('element', 'org.eclipse.emf.ecore.EObject', 'it', 'diagram.getElement().eAllContents()')-»
if (isApplicableElement(element, types)) {
elements.add(element);
}

Back to the top