]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Support for sheet in the old model browser
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 12 Jul 2011 08:03:06 +0000 (08:03 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 12 Jul 2011 08:03:06 +0000 (08:03 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@21471 ac1ea38d-2e2b-0410-8846-a27921b304fc

12 files changed:
org.simantics.sysdyn.ui/icons/table.png [new file with mode: 0644]
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/plugin_customization.ini
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Book.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/BookLabeler.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Configuration.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SheetLabeler.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/BookNode.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SheetNode.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ImportModelHandler.java
org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj

diff --git a/org.simantics.sysdyn.ui/icons/table.png b/org.simantics.sysdyn.ui/icons/table.png
new file mode 100644 (file)
index 0000000..abcd936
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/table.png differ
index 487b47423ab2969b902c40f311589c78b3020bb5..3f02bddc8313c86bccf9d7ae8d14734100ae16ce 100644 (file)
                class="org.simantics.sysdyn.ui.browser.contributions.SharedFunctionLibraries"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.Book"\r
+               preference="2.0">\r
+         </implementation>\r
       </binding>\r
       <binding browseContext="http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser">\r
         <implementation class="org.simantics.sysdyn.ui.property.OperationProjectContributor" preference="1.0"/>\r
                class="org.simantics.sysdyn.ui.browser.contributions.SharedFunctionsLabeler"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.BookLabeler"\r
+               preference="2.0">\r
+         </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.SheetLabeler"\r
+               preference="2.0">\r
+         </implementation>\r
       </binding>\r
       <binding browseContext="http://www.simantics.org/Sysdyn-1.0/SysdynOperationBrowser">\r
         <implementation class="org.simantics.sysdyn.ui.property.OperationModelLabels" preference="1.0"/>\r
index ea850333856ea5e8520c0cecfe942650eb3dcae6..92e8ed0c0a7cf0e914520a8fc7b0c9c7f93fb234 100644 (file)
@@ -1 +1,2 @@
 org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = false\r
+org.eclipse.ui/DOCK_PERSPECTIVE_BAR=right
\ No newline at end of file
index 6b447f4d3e4d2be5853ee50624dac14e96eb74cf..e6051f38b83975508734e0d939d8d4969576b01a 100644 (file)
@@ -18,6 +18,7 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.BookNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.ExperimentsFolder;\r
@@ -30,6 +31,7 @@ import org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode;
 import org.simantics.sysdyn.ui.browser.nodes.ModulesNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionLibraryNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionsFolder;\r
+import org.simantics.sysdyn.ui.browser.nodes.SheetNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.VariableNode;\r
 \r
 public class AbstractNodeImager extends ImagerContributor<AbstractNode<Resource>> {\r
@@ -56,6 +58,10 @@ public class AbstractNodeImager extends ImagerContributor<AbstractNode<Resource>
             image = "icons/chart_organisation.png";\r
         else if (node instanceof VariableNode)\r
             image =  "icons/brick.png";\r
+        else if (node instanceof BookNode)\r
+            image =  "icons/table_multiple.png";\r
+        else if (node instanceof SheetNode)\r
+            image =  "icons/table.png";\r
         \r
         if (image != null)\r
             return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource(image));\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Book.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/Book.java
new file mode 100644 (file)
index 0000000..8bd950f
--- /dev/null
@@ -0,0 +1,29 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.BookNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.SheetNode;\r
+\r
+public class Book extends ViewpointContributor<BookNode> {\r
+\r
+    @Override\r
+    public Collection<?> getContribution(ReadGraph graph, BookNode book) throws DatabaseException {\r
+        ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        for(Resource r : graph.syncRequest(new ObjectsWithType(book.data, l0.ConsistsOf, SpreadsheetResource.getInstance(graph).Spreadsheet))) {\r
+            result.add(new SheetNode(r));\r
+        }\r
+        return result;\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/BookLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/BookLabeler.java
new file mode 100644 (file)
index 0000000..e0f950d
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.browser.nodes.BookNode;\r
+\r
+public class BookLabeler  extends LabelerContributor<BookNode>{\r
+\r
+    @Override\r
+    public String getLabel(ReadGraph graph, BookNode input) throws DatabaseException {\r
+        return "SpreadSheets";\r
+    }\r
+\r
+}\r
index d92b3073056a2e6252f76c82eb130349e26c9519..c874e0428c6fee8ca7b8080f3dbe5068469dedda 100644 (file)
@@ -14,14 +14,18 @@ package org.simantics.sysdyn.ui.browser.contributions;
 import java.util.ArrayList;\r
 import java.util.Collection;\r
 \r
-import org.simantics.browsing.ui.common.node.AbstractNode;\r
 import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.variable.Variable;\r
 import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ui.modelBrowser2.model.SheetsNode;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
 import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.BookNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.ConfigurationNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.EnumerationNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.InputNode;\r
@@ -32,7 +36,7 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
 \r
        @Override\r
        public Collection<?> getContribution(ReadGraph graph, ConfigurationNode<Resource> configuration) throws DatabaseException {\r
-               ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
+               ArrayList<Object> result = new ArrayList<Object>();\r
                Variable variable = configuration.getVariable();\r
                \r
                if (variable == null) {\r
@@ -74,6 +78,14 @@ public class Configuration extends ViewpointContributor<ConfigurationNode<Resour
                        Resource represents = (Resource)v.getPropertyValue(graph, Variables.REPRESENTS);\r
                        result.add(new EnumerationNode(v, represents));\r
                }\r
+               \r
+               for(Resource r : graph.syncRequest(new ObjectsWithType(\r
+                       configuration.data,\r
+                       Layer0.getInstance(graph).ConsistsOf, \r
+                       SpreadsheetResource.getInstance(graph).Book))) {\r
+                   result.add(new BookNode(r));\r
+               }\r
+               \r
                return result;\r
        }\r
 \r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SheetLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SheetLabeler.java
new file mode 100644 (file)
index 0000000..ff4bd59
--- /dev/null
@@ -0,0 +1,15 @@
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.ui.browser.nodes.SheetNode;\r
+\r
+public class SheetLabeler  extends LabelerContributor<SheetNode>{\r
+\r
+    @Override\r
+    public String getLabel(ReadGraph graph, SheetNode sheet) throws DatabaseException {\r
+        return  graph.getPossibleRelatedValue(sheet.data, Layer0.getInstance(graph).HasName);\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/BookNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/BookNode.java
new file mode 100644 (file)
index 0000000..325d777
--- /dev/null
@@ -0,0 +1,19 @@
+package org.simantics.sysdyn.ui.browser.nodes;\r
+\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.db.Resource;\r
+\r
+public class BookNode extends AbstractNode<Resource> {\r
+\r
+    public BookNode(Resource data) {\r
+        super(data);\r
+    }\r
+\r
+    @SuppressWarnings("rawtypes")\r
+    @Override\r
+    public Object getAdapter(Class adapter) {\r
+        if(clazz == adapter) // There is no resource for this node..\r
+            return null;\r
+        return super.getAdapter(adapter);\r
+    }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SheetNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SheetNode.java
new file mode 100644 (file)
index 0000000..8df2d43
--- /dev/null
@@ -0,0 +1,81 @@
+package org.simantics.sysdyn.ui.browser.nodes;\r
+\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.PlatformUI;\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.browsing.ui.common.node.IDoubleClickableNode;\r
+import org.simantics.browsing.ui.common.node.IModifiableNode;\r
+import org.simantics.browsing.ui.content.Labeler.Modifier;\r
+import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
+import org.simantics.db.common.request.ReadRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.workbench.ResourceEditorInput2;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
+\r
+public class SheetNode extends AbstractNode<Resource> implements IModifiableNode, IDoubleClickableNode {\r
+\r
+    public SheetNode(Resource data) {\r
+        super(data);\r
+    }\r
+    \r
+    @Override\r
+    public Modifier getModifier(String columnId) {\r
+        \r
+        Session session = SimanticsUI.getSession();\r
+        LabelModifier modifier = new LabelModifier(session, data, session.getService(Layer0.class).HasName) {\r
+            @Override\r
+            public String isValid(String label) {\r
+                if (label.isEmpty())\r
+                    return "Empty label not allowed";\r
+                return null;\r
+            }\r
+        };\r
+        return modifier;\r
+    }\r
+\r
+    @Override\r
+    public boolean handleDoubleClick() {\r
+        \r
+        try {\r
+            \r
+            SimanticsUI.getSession().asyncRequest(new ReadRequest() {\r
+                @Override\r
+                public void run(ReadGraph graph) throws DatabaseException {\r
+\r
+                    Variable variable = graph.adapt(data, Variable.class);\r
+                    Resource model = Variables.getModel(graph, variable);\r
+                    final String modelURI = graph.getURI(model);\r
+                    final String RVI = Variables.getRVI(graph, variable);\r
+\r
+                    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {\r
+                        \r
+                        private static final String EDITOR_ID = "org.simantics.spreadsheet.ui.editor2";\r
+                        \r
+                        @Override\r
+                        public void run() {\r
+                            try {\r
+                                System.out.println("Activating sheet: model=" + modelURI + " rvi=" + RVI);\r
+                                WorkbenchUtils.openEditor(EDITOR_ID, new ResourceEditorInput2(EDITOR_ID, data, modelURI, RVI));\r
+                            } catch (PartInitException e) {\r
+                                e.printStackTrace();\r
+                            }\r
+                        }\r
+                    });\r
+                }\r
+            });\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+        \r
+        return true;\r
+    }\r
+\r
+\r
+}\r
index ddeaec1bc6b29a328a69554e45eedb916d74fc11..0faf71bd83e2ae2b297110f476e8c1982e344d32 100644 (file)
@@ -14,6 +14,7 @@ package org.simantics.sysdyn.ui.handlers;
 import java.io.File;\r
 import java.io.IOException;\r
 import java.util.HashSet;\r
+import java.util.UUID;\r
 \r
 import org.eclipse.core.commands.AbstractHandler;\r
 import org.eclipse.core.commands.ExecutionEvent;\r
@@ -29,6 +30,7 @@ import org.simantics.databoard.Files;
 import org.simantics.databoard.binding.error.RuntimeBindingConstructionException;\r
 import org.simantics.db.Resource;\r
 import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
 import org.simantics.db.common.request.WriteRequest;\r
 import org.simantics.db.common.utils.NameUtils;\r
 import org.simantics.db.exception.DatabaseException;\r
@@ -39,6 +41,7 @@ import org.simantics.layer0.Layer0;
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.modeling.ModelingResources;\r
 import org.simantics.simulation.ontology.SimulationResource;\r
+import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
 import org.simantics.structural.stubs.StructuralResource2;\r
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.Activator;\r
@@ -134,6 +137,7 @@ public class ImportModelHandler extends AbstractHandler {
                                                updateOldConfigurationToBaseRealization(graph, root);\r
                                                addDefaultOntologyLinks(graph, root);\r
                                                addURIsToDiagrams(graph, root);\r
+                                               addSpreadSheetBook(graph, root);\r
                                        }\r
                                }\r
                        });\r
@@ -222,4 +226,94 @@ public class ImportModelHandler extends AbstractHandler {
                        e.printStackTrace();\r
                }\r
        }\r
+       \r
+       \r
+       /**\r
+        * Add a missing spreadsheet book to the model\r
+        * \r
+        * @param graph\r
+        * @param model\r
+        */\r
+       private static void addSpreadSheetBook(WriteGraph graph, Resource model) {\r
+           try {\r
+               Layer0 l0 = Layer0.getInstance(graph);\r
+               SpreadsheetResource ssr = SpreadsheetResource.getInstance(graph);\r
+               SimulationResource simu = SimulationResource.getInstance(graph);\r
+               Resource conf = graph.getPossibleObject(model, simu.HasConfiguration);\r
+               if(conf != null && graph.syncRequest(new ObjectsWithType(conf, l0.ConsistsOf, ssr.Book)).isEmpty()) {\r
+                   Resource book = graph.newResource();\r
+                   graph.claim(book, l0.InstanceOf, null, ssr.Book);\r
+                   graph.addLiteral(book, l0.HasName, l0.NameOf, l0.String, "Book" + UUID.randomUUID().toString(), Bindings.STRING);\r
+                   graph.claim(conf, l0.ConsistsOf, l0.PartOf, book);\r
+\r
+                   createSheet(graph, book, "Sheet1", new String[] { }, new int[] { 50 });\r
+               }\r
+           } catch (DatabaseException e) {\r
+               e.printStackTrace();\r
+           }\r
+       }\r
+       \r
+       /**\r
+        * Create a sheet (Copied from SysdynProject)\r
+        * \r
+        * @param graph\r
+        * @param book\r
+        * @param name\r
+        * @param colNames\r
+        * @param colWidths\r
+        * @return\r
+        * @throws DatabaseException\r
+        */\r
+    private static Resource createSheet(WriteGraph graph, Resource book, String name, String[] colNames, int[] colWidths) throws DatabaseException {\r
+\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
+        SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);\r
+\r
+        Resource result = graph.newResource();\r
+        graph.claim(result, L0.InstanceOf, null, sr.Spreadsheet);\r
+\r
+        if(name == null) {\r
+            name = NameUtils.findFreshEscapedName(graph, "Sheet", book, sr.HasSheet);\r
+        }\r
+        graph.claimLiteral(result, L0.HasName, L0.NameOf, L0.String, name, Bindings.STRING);\r
+        graph.claim(book, L0.ConsistsOf, L0.PartOf, result);\r
+\r
+        {\r
+            Resource newCell = graph.newResource();\r
+            graph.claim(newCell, L0.InstanceOf, null, sr.Cell);\r
+            graph.claimLiteral(newCell, L0.HasName, L0.NameOf, L0.String, "Dimensions", Bindings.STRING);\r
+            graph.addLiteral(newCell, sr.FitColumns, sr.FitColumnsOf, L0.Boolean, false, Bindings.BOOLEAN);\r
+            graph.addLiteral(newCell, sr.FitRows, sr.FitRowsOf, L0.Boolean, false, Bindings.BOOLEAN);\r
+            graph.addLiteral(newCell, sr.ColumnCount, sr.ColumnCountOf, L0.Integer, 128, Bindings.INTEGER);\r
+            graph.addLiteral(newCell, sr.RowCount, sr.RowCountOf, L0.Integer, 256, Bindings.INTEGER);\r
+            graph.claim(result, L0.ConsistsOf, L0.PartOf, newCell);\r
+        }\r
+\r
+        {\r
+            Resource newCell = graph.newResource();\r
+            graph.claim(newCell, L0.InstanceOf, null, sr.Cell);\r
+            graph.claimLiteral(newCell, L0.HasName, L0.NameOf, L0.String, "Headers", Bindings.STRING);\r
+            graph.addLiteral(newCell, sr.ColumnLabels, sr.ColumnLabelsOf, L0.StringArray, colNames, Bindings.STRING_ARRAY);\r
+            graph.addLiteral(newCell, sr.ColumnWidths, sr.ColumnWidthsOf, L0.IntegerArray, colWidths, Bindings.INT_ARRAY);\r
+            graph.claim(result, L0.ConsistsOf, L0.PartOf, newCell);\r
+        }\r
+\r
+        {\r
+            \r
+            double[] doubles = new double[10*2];\r
+            for(int i=0;i<10*2;i++) doubles[i] = i;\r
+            \r
+            Resource newCell = graph.newResource();\r
+            graph.claim(newCell, L0.InstanceOf, null, sr.DoubleArrayCell);\r
+            graph.addLiteral(newCell, sr.DoubleArrayCell_HasWidth, sr.DoubleArrayCell_HasWidth_Inverse, L0.Integer, 10, Bindings.INTEGER);\r
+            graph.addLiteral(newCell, sr.HasLocation, sr.HasLocation_Inverse, L0.String, "B2", Bindings.STRING);\r
+            graph.addLiteral(newCell, sr.DoubleArrayCell_HasDoubleArray, sr.DoubleArrayCell_HasDoubleArray_Inverse, L0.DoubleArray, doubles, Bindings.DOUBLE_ARRAY);\r
+            graph.claim(result, L0.HasChildVariables, L0.HasChildVariables_Inverse, newCell);\r
+            \r
+        }\r
+        \r
+        return result;\r
+\r
+    }\r
+\r
 }\r
index f1173c1b715e7c1aaacb5b992ade5d2265657872..3685cdaa5f885c4d2c24a13266828971574d0f60 100644 (file)
@@ -207,14 +207,14 @@ void component_reference(String prevToken) : {
        //IDENT [ array_subscripts ] [ "." component_reference ]\r
        <IDENT> {\r
     String name = token.image;   \r
-       // prevToken != null => this is the second part of an enumeration\r
+       // forIndex == true and prevToken != null => this is the second part of an enumeration in for-index\r
        if(forIndex == true && prevToken != null) {\r
                if(enumerationReferences.get(prevToken) == null) {\r                     enumerationReferences.put(prevToken, new ArrayList<Token>());\r
                }\r
                List<Token> list = enumerationReferences.get(prevToken);\r
                list.add(token);                \r
 \r
-       // forIndex == true, prevToken == null => this is the enumeration\r
+       // forIndex == true and prevToken == null => this is the enumeration in for-index\r
        } else if(forIndex == true && prevToken == null) {\r
                if(enumerationReferences.get(name) == null) {\r
                        enumerationReferences.put(name, new ArrayList<Token>());\r