New (Quantum SQL) wizard module which extends Quantum context menus (Bookmark-Tables...
[phpeclipse.git] / net.sourceforge.phpeclipse.wizards / src / net / sourceforge / phpeclipse / wizards / actions / data / PHPDataWizard.java
diff --git a/net.sourceforge.phpeclipse.wizards/src/net/sourceforge/phpeclipse/wizards/actions/data/PHPDataWizard.java b/net.sourceforge.phpeclipse.wizards/src/net/sourceforge/phpeclipse/wizards/actions/data/PHPDataWizard.java
new file mode 100644 (file)
index 0000000..483a689
--- /dev/null
@@ -0,0 +1,45 @@
+package net.sourceforge.phpeclipse.wizards.actions.data;
+
+import net.sourceforge.phpeclipse.wizards.xml.ModelUtil;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.quantum.extensions.IDataExtension;
+import com.quantum.model.Column;
+import com.quantum.model.xml.XMLToModelConverter;
+import com.quantum.util.StringMatrix;
+
+public class PHPDataWizard implements IDataExtension {
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see com.quantum.extensions.IDataExtension#run(org.w3c.dom.Document)
+   */
+  public void run(Document doc) {
+    Element root = doc.getDocumentElement();
+
+    // matrix contains the actual selected data in the row:
+//    StringMatrix matrix = new StringMatrix();
+//    String sub = "DataRow";
+//    ModelUtil.xmlToStringMatrix(matrix, root, sub);
+//    System.out.println(matrix.toString());
+
+    try {
+      XMLToModelConverter c = new XMLToModelConverter(root);
+      String name = ModelUtil.getTableName(root);
+      System.out.print("Table-name: ");
+      System.out.println(name);
+      Column[] cols = c.getColumns();
+      for (int i = 0; i < cols.length; i++) {
+        System.out.print("Column-name: " + i + " ");
+        System.out.println(cols[i].getName());
+      }
+
+    } catch (Exception e) {
+      e.printStackTrace();
+    }
+  }
+
+}
\ No newline at end of file