rename examples with Example suffix; GenerateNatExamplesIndex culls
missing entries
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/GridLayer.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/GridLayerExample.xtend
similarity index 100%
rename from org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/GridLayer.xtend
rename to org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/GridLayerExample.xtend
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayer.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
similarity index 90%
rename from org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayer.xtend
rename to org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
index 294ef8e..e6434b8 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/BigLayerExample.xtend
@@ -10,7 +10,13 @@
import org.eclipse.nebula.widgets.nattable.core.layer.impl.header.RowHeaderLayer
import org.eclipse.nebula.widgets.nattable.core.layer.impl.viewport.ViewportLayer
-class BigLayer extends AbstractNatExample {
+class BigLayerExample extends AbstractNatExample {
+
+ override getDescription() {
+ '''
+ A grid with 10 million columns and 10 million rows!
+ '''
+ }
override createLayer() {
val bodyLayer = new ViewportLayer(new DummyLayer(
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/index.properties b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/index.properties
index ae2a358..e80bb29 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/index.properties
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/big/index.properties
@@ -1,2 +1,2 @@
-#Fri May 31 12:59:51 EDT 2013
-BigLayer=org.eclipse.nebula.widgets.nattable.core.example.impl.big.BigLayer
+#Fri May 31 14:04:35 EDT 2013
+BigLayerExample=org.eclipse.nebula.widgets.nattable.core.example.impl.big.BigLayerExample
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/index.properties b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/index.properties
index 231b651..d8b316a 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/index.properties
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/impl/index.properties
@@ -1,3 +1,3 @@
-#Fri May 31 12:59:51 EDT 2013
-big=|big
+#Fri May 31 14:04:35 EDT 2013
+big=|Huge examples
GridLayer=org.eclipse.nebula.widgets.nattable.core.example.impl.GridLayer
diff --git a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/GenerateNatExamplesIndex.xtend b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/GenerateNatExamplesIndex.xtend
index 132de20..910b70b 100644
--- a/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/GenerateNatExamplesIndex.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core.example/src/org/eclipse/nebula/widgets/nattable/core/example/index/GenerateNatExamplesIndex.xtend
@@ -4,6 +4,7 @@
import java.io.FileReader
import java.io.FileWriter
import java.lang.reflect.Modifier
+import java.util.Collections
import java.util.Properties
import org.eclipse.nebula.widgets.nattable.core.example.NatExample
@@ -34,35 +35,48 @@
* Recursively find all examples in the given directory and below, accumulating information about them in the examples index.
*/
def private void findExamples(File srcDir, File binDir) {
- val indexProperties = new Properties
-
- val indexFile = new File(srcDir, INDEX_FILE_NAME)
-
- // If an index file already exists in this directory, load it
- if (indexFile.exists) {
- val reader = new FileReader(indexFile)
- indexProperties.load(reader)
- reader.close
- }
+ val newIndexProperties = new Properties
// Look through bin directory
for (String s : binDir.list) {
val f = new File(binDir, s)
if (f.directory) {
- if (!indexProperties.containsKey(f.name)) // Don't overwrite existing entries
- indexProperties.put(f.name, "|" + f.name)
+ newIndexProperties.put(f.name, "|" + f.name)
findExamples(new File(srcDir, s), f) // Recurse; use corresponding src directory
} else if (f.name.endsWith(".class")) {
- val shortName = f.name.replaceFirst("\\.class$", "")
- if (!indexProperties.containsKey(shortName)) { // Don't overwrite existing entries
- val exampleClass = f.canonicalPath.replaceAll("\\.class$", "").getExampleClass
- if (exampleClass != null)
- indexProperties.put(exampleClass.simpleName, exampleClass.canonicalName)
- }
+ val exampleClass = f.canonicalPath.replaceAll("\\.class$", "").getExampleClass
+ if (exampleClass != null)
+ newIndexProperties.put(exampleClass.simpleName, exampleClass.canonicalName)
}
}
- // Write properties
+ // Compare the new index with the (pre-existing) index, if it exists
+ val indexFile = new File(srcDir, INDEX_FILE_NAME)
+ val indexProperties = new Properties
+ if (indexFile.exists) {
+ // If an index file already exists in this directory, load it
+ val reader = new FileReader(indexFile)
+ indexProperties.load(reader)
+ reader.close
+ }
+
+ // Remove any entries in the old index that do not have a corresponding entry in the new index
+ val keysToRemove = Collections::list(indexProperties.propertyNames)
+ keysToRemove.removeAll(newIndexProperties.keySet)
+ keysToRemove.forEach[
+ println('''Removing entry for «it» from the index as it no longer exists.''')
+ indexProperties.remove(it)
+ ]
+
+ // Add new entries from the new index into the old index
+ val keysToAdd = Collections::list(newIndexProperties.propertyNames)
+ keysToAdd.removeAll(indexProperties.keySet)
+ keysToAdd.forEach[
+ println('''Adding new entry for «it» to the index.''')
+ indexProperties.put(it, newIndexProperties.get(it))
+ ]
+
+ // Write index properties
if (!indexProperties.empty) {
val writer = new FileWriter(indexFile)
indexProperties.store(writer, null)
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
index 517e341..828a356 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/layer/impl/composite/CompositeLayer.xtend
@@ -26,7 +26,7 @@
[ layer | layer.horizontalAxis ]
)
val verticalAxis = new CompositeAxis(
- [ | compositeRows.map [ childLayers.get(0) ] ],
+ [ | compositeRows.map[ childLayers.get(0) ] ],
[ layer | layer.verticalAxis ]
)
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/NavContentProvider.xtend b/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/NavContentProvider.xtend
index d7b4b98..8e356b4 100644
--- a/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/NavContentProvider.xtend
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt.example/src/org/eclipse/nebula/widgets/nattable/renderer/swt/example/NavContentProvider.xtend
@@ -31,7 +31,7 @@
override getChildren(Object parent) {
val nodePath = parent as String
val node = NatExamplesIndex::getNode(nodePath)
- node.childNodeNames.map [ nodePath + '/' + it ]
+ node.childNodeNames.map[ nodePath + '/' + it ]
}
override getElements(Object inputElement) {