Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2007-03-14 12:59:52 +0000
committeratikhomirov2007-03-14 12:59:52 +0000
commit9c1d6d25b338f989d175c6ff8db685713d8ea4c3 (patch)
treeb3336f01feb1785c4e19467c02f1e0f0beb4ac63 /plugins/org.eclipse.gmf.graphdef.codegen
parentb898b824e7a630a6f2a03099d4ba399f496e7943 (diff)
downloadorg.eclipse.gmf-tooling-9c1d6d25b338f989d175c6ff8db685713d8ea4c3.tar.gz
org.eclipse.gmf-tooling-9c1d6d25b338f989d175c6ff8db685713d8ea4c3.tar.xz
org.eclipse.gmf-tooling-9c1d6d25b338f989d175c6ff8db685713d8ea4c3.zip
Regenerated graphdef, tooldef and gmfmap models with EMF 2.3 M5 Generics, updated code to be "generified"
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/CanvasProcessor.java20
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryMirrorProcessor.java5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryProcessor.java6
3 files changed, 12 insertions, 19 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/CanvasProcessor.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/CanvasProcessor.java
index 3b9b1d109..15597c20f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/CanvasProcessor.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/CanvasProcessor.java
@@ -13,7 +13,6 @@ package org.eclipse.gmf.internal.graphdef.codegen;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.LinkedList;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -56,7 +55,7 @@ public class CanvasProcessor extends Processor {
public void go(ProcessorCallback callback, Config config) throws InterruptedException {
myCallback = callback;
myOutcomeGallery = GMFGraphFactory.eINSTANCE.createFigureGallery();
- myOutcomeGallery.setName(myInput.getFigures().size() == 1 ? ((FigureGallery) myInput.getFigures().get(0)).getName() : "GeneratedGallery");
+ myOutcomeGallery.setName(myInput.getFigures().size() == 1 ? myInput.getFigures().get(0).getName() : "GeneratedGallery");
// TODO respect implementation from original FigureGallery, see (#x#)
myOutcomeGallery.setImplementationBundle(config.getPluginID());
handleNodes();
@@ -83,30 +82,26 @@ public class CanvasProcessor extends Processor {
public String[] getRequiredBundles(FigureQualifiedNameSwitch fqnSwitch) {
ArrayList<String> rv = new ArrayList<String>();
- for (Iterator galleries = myInput.getFigures().iterator(); galleries.hasNext();) {
- FigureGallery next = (FigureGallery) galleries.next();
+ for (FigureGallery next : myInput.getFigures()) {
rv.addAll(Arrays.asList(fqnSwitch.getDependencies(next)));
}
return rv.toArray(new String[rv.size()]);
}
private void handleNodes() throws InterruptedException {
- for (Iterator it = myInput.getNodes().iterator(); it.hasNext();) {
- Node next = (Node) it.next();
+ for (Node next : myInput.getNodes()) {
handleFigure(next.getNodeFigure());
}
}
private void handleLinks() throws InterruptedException {
- for (Iterator it = myInput.getConnections().iterator(); it.hasNext();) {
- Connection next = (Connection) it.next();
+ for (Connection next : myInput.getConnections()) {
handleFigure(next.getConnectionFigure());
}
}
private void handleCompartments() throws InterruptedException {
- for (Iterator it = myInput.getCompartments().iterator(); it.hasNext();) {
- Compartment next = (Compartment) it.next();
+ for (Compartment next : myInput.getCompartments()) {
FigureHandle nextFigure = next.getFigure();
if (nextFigure == null){
throw new NullPointerException("Compartment without figure : " + next);
@@ -120,8 +115,7 @@ public class CanvasProcessor extends Processor {
}
private void handleLabels() throws InterruptedException {
- for (Iterator it = myInput.getLabels().iterator(); it.hasNext();) {
- DiagramLabel next = (DiagramLabel) it.next();
+ for (DiagramLabel next : myInput.getLabels()) {
if (next.getFigure() instanceof FigureAccessor) {
assert myElementCopier.containsKey(next.getFigure()) : "Should be copied as part of previously referenced CustomFigure";
} else {
@@ -172,7 +166,7 @@ public class CanvasProcessor extends Processor {
// XXX an implementationBundle might be an issue here (#x#),
// since myOutcomeGallery gonna get one we generate, while the original CustomFigure
// may have one specified in the ownining FigureGallery.
- myOutcomeGallery.getFigures().add(myElementCopier.copy(figure));
+ myOutcomeGallery.getFigures().add((CustomFigure) myElementCopier.copy(figure));
} else {
String fqn = myCallback.visitFigure(figure);
myElementCopier.registerSubstitution(figure, createCustomFigure(figure, fqn));
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryMirrorProcessor.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryMirrorProcessor.java
index 880cd586c..c007161ee 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryMirrorProcessor.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryMirrorProcessor.java
@@ -47,8 +47,8 @@ public class GalleryMirrorProcessor extends GalleryProcessor {
result.setName("GeneratedGallery"); // FIXME smth reasonable
result.setImplementationBundle(myGeneratedBundle);
- for (Enumeration originalFigures = myGenerationInfo.getProcessedFigures(); originalFigures.hasMoreElements();){
- Figure nextOriginal = (Figure) originalFigures.nextElement();
+ for (Enumeration<Figure> originalFigures = myGenerationInfo.getProcessedFigures(); originalFigures.hasMoreElements();) {
+ Figure nextOriginal = originalFigures.nextElement();
String nextConvertedFqn = myGenerationInfo.getGeneratedClassFQN(nextOriginal);
CustomFigure custom = DiagramElementsCopier.createCustomFigure(nextOriginal);
custom.setName(nextOriginal.getName());
@@ -69,6 +69,7 @@ public class GalleryMirrorProcessor extends GalleryProcessor {
}
public interface GenerationInfo {
+ // FIXME use iterator instead to allow enhanced for loop
public Enumeration<Figure> getProcessedFigures();
public String getGeneratedClassFQN(Figure figure);
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryProcessor.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryProcessor.java
index ecaaf66a3..bb7d6c03e 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryProcessor.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/internal/graphdef/codegen/GalleryProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006 Borland Software Corporation
+ * 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
@@ -13,7 +13,6 @@ package org.eclipse.gmf.internal.graphdef.codegen;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import org.eclipse.gmf.gmfgraph.Figure;
import org.eclipse.gmf.gmfgraph.FigureGallery;
@@ -40,8 +39,7 @@ public class GalleryProcessor extends Processor {
public void go(ProcessorCallback callback, Config config) throws InterruptedException {
for (int i = 0; i < myInput.length; i++) {
- for (Iterator it = myInput[i].getFigures().iterator(); it.hasNext();) {
- Figure next = (Figure) it.next();
+ for (Figure next : myInput[i].getFigures()) {
String fqn = callback.visitFigure(next);
handle(next, fqn);
}

Back to the top