added stubs for e4 extension and swt renderer
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTable.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTable.java
index 8e913e9..a63c108 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTable.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTable.java
@@ -70,6 +70,11 @@
// }
public NatTable(Composite parent, final int style) {
+ this(parent, style, null);
+ }
+
+ public NatTable(Composite parent, final int style, NatTableConfiguration natConfig) {
+
// this(parent, style, new DummyGridLayerStack());
// }
//
@@ -84,6 +89,14 @@
// public NatTable(final Composite parent, final int style, final ILayer layer, boolean autoconfigure) {
super(parent, style);
+
+ if (natConfig != null) {
+ //if a NatTableConfiguration is given, start configuring it by this
+ //e.g. if using the E4 extension, the layers and other configurations will
+ //be added by using dependency injection
+ natConfig.startConstruction();
+ }
+
// Disable scroll bars by default; if a Viewport is available, it will enable the scroll bars
disableScrollBar(getHorizontalBar());
disableScrollBar(getVerticalBar());
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTableConfiguration.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTableConfiguration.java
new file mode 100644
index 0000000..adf7765
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/core/NatTableConfiguration.java
@@ -0,0 +1,40 @@
+package org.eclipse.nebula.widgets.nattable.core;
+
+/**
+ * The NatTableConfiguration is responsible for configuring a NatTable instance.
+ * This means to compose the layer stacks and configure the layers and NatTable itself.
+ * In the context of dependency injection, it is also responsible for adding created
+ * instances to the dependency injection context.
+ *
+ * @author Dirk Fauth
+ *
+ */
+public interface NatTableConfiguration {
+
+ /**
+ * Starts constructing the NatTable with the given configuration.
+ */
+ public void startConstruction();
+
+ /**
+ * Sets a value to be associated with a given name in this configuration.
+ * @param name the name to store a value for
+ * @param value The value to be stored
+ */
+ void set(String name, Object value);
+
+ /**
+ * Sets a value to be associated with a given class in this configuration.
+ * @param clazz The class to store a value for
+ * @param value The value to be stored
+ * @see #set(String, Object)
+ */
+ <T> void set(Class<T> clazz, T value);
+
+ /**
+ * Creates an instance of the given class.
+ * @param clazz The class for which an instance should be created
+ * @return The created instance for the given class.
+ */
+ <T> T create(Class<T> clazz);
+}
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/.classpath b/org.eclipse.nebula.widgets.nattable.extension.e4/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/.project b/org.eclipse.nebula.widgets.nattable.extension.e4/.project
new file mode 100644
index 0000000..a98927d
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.nebula.widgets.nattable.extension.e4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c537b63
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..f344a6f
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: NatTable Extension for Eclipse 4
+Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.extension.e4
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.e4.core.contexts;bundle-version="1.2.0",
+ org.eclipse.e4.core.di;bundle-version="1.2.0",
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="1.0.0"
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/build.properties b/org.eclipse.nebula.widgets.nattable.extension.e4/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/E4NatTableConfiguration.java b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/E4NatTableConfiguration.java
new file mode 100644
index 0000000..c305d1b
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.extension.e4/src/org/eclipse/nebula/widgets/nattable/extension/e4/E4NatTableConfiguration.java
@@ -0,0 +1,67 @@
+package org.eclipse.nebula.widgets.nattable.extension.e4;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.nebula.widgets.nattable.core.NatTableConfiguration;
+
+/**
+ * NatTableConfiguration that supports dependency injection with the Eclipse 4
+ * Application Platform. Creates a new IEclipseContext and all configured
+ * objects for the NatTable instance are then created and managed by this
+ * context.
+ *
+ * @author Dirk Fauth
+ *
+ */
+public class E4NatTableConfiguration implements NatTableConfiguration {
+
+ /**
+ * The NatTable local IEclipseContext used for injection of NatTable specific
+ * objects.
+ */
+ private IEclipseContext localContext;
+
+ public E4NatTableConfiguration(IEclipseContext parentContext) {
+ this.localContext = parentContext.createChild();
+ }
+
+
+ public void startConstruction() {
+ /*
+ * TODO this is where the magic should happen
+ *
+ * we could read a config file or some EMF stuff to start creation
+ * of layers, composing the layer stacks, adding configurations
+ * and whatever we want to to automatically.
+ *
+ * The set() and make() methods encapsulate the DI stuff in first place
+ * so this method here could also be some kind of replaceable so you
+ * have different kinds of configuration (as just mentioned, file based
+ * or EMF, or whatever)
+ */
+ }
+
+ @Override
+ public void set(String name, Object value) {
+ //start the injection to the given value
+ ContextInjectionFactory.inject(value, this.localContext);
+ //set the value to the local context
+ this.localContext.set(name, value);
+ }
+
+ @Override
+ public <T> void set(Class<T> clazz, T value) {
+ //start the injection to the given value
+ ContextInjectionFactory.inject(value, this.localContext);
+ //set the value to the local context
+ this.localContext.set(clazz, value);
+ }
+
+ @Override
+ public <T> T create(Class<T> clazz) {
+ //Let the ContextInjectionFactory create the instance and put it
+ //into the local context. The classes need to be annotated with
+ //@Creatable to make this work
+ return ContextInjectionFactory.make(clazz, this.localContext);
+ }
+}
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/.classpath b/org.eclipse.nebula.widgets.nattable.renderer.swt/.classpath
new file mode 100644
index 0000000..ad32c83
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/.project b/org.eclipse.nebula.widgets.nattable.renderer.swt/.project
new file mode 100644
index 0000000..f2a2bc3
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.nebula.widgets.nattable.renderer.swt</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.nebula.widgets.nattable.renderer.swt/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..c537b63
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/META-INF/MANIFEST.MF b/org.eclipse.nebula.widgets.nattable.renderer.swt/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..acb1036
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: NatTable SWT Renderer
+Bundle-SymbolicName: org.eclipse.nebula.widgets.nattable.renderer.swt
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.swt,
+ org.eclipse.swt.events,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/build.properties b/org.eclipse.nebula.widgets.nattable.renderer.swt/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/SWTNatTableRenderer.java b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/SWTNatTableRenderer.java
new file mode 100644
index 0000000..398783f
--- /dev/null
+++ b/org.eclipse.nebula.widgets.nattable.renderer.swt/src/org/eclipse/nebula/widgets/nattable/renderer/swt/SWTNatTableRenderer.java
@@ -0,0 +1,37 @@
+package org.eclipse.nebula.widgets.nattable.renderer.swt;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Put all of the rendering related stuff in here.
+ * But to connect the rendering to the core, there needs to be some transition I guess.
+ * I haven't figured out the big picture on this yet. So this is just the stub for
+ * further discussion at the moment.
+ *
+ * @author Dirk Fauth
+ *
+ */
+public class SWTNatTableRenderer extends Canvas implements PaintListener {
+
+ public static final int DEFAULT_STYLE_OPTIONS = SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED | SWT.V_SCROLL | SWT.H_SCROLL;
+
+ public SWTNatTableRenderer(Composite parent) {
+ super(parent, DEFAULT_STYLE_OPTIONS);
+ }
+
+ public SWTNatTableRenderer(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ @Override
+ public void paintControl(final PaintEvent event) {
+ paintNatTable(event);
+ }
+
+ private void paintNatTable(final PaintEvent event) {
+ }
+}