New (Quantum SQL) wizard module which extends Quantum context menus (Bookmark-Tables...
[phpeclipse.git] / net.sourceforge.phpeclipse.wizards / src / net / sourceforge / phpeclipse / wizards / actions / metadata / PHPMetadataWizard.java
1 package net.sourceforge.phpeclipse.wizards.actions.metadata;
2
3 import net.sourceforge.phpeclipse.wizards.xml.ModelUtil;
4
5 import org.w3c.dom.Document;
6 import org.w3c.dom.Element;
7
8 import com.quantum.extensions.IMetadataExtension;
9 import com.quantum.model.Column;
10 import com.quantum.model.xml.XMLToModelConverter;
11
12 public class PHPMetadataWizard implements IMetadataExtension {
13
14   /*
15    * (non-Javadoc)
16    * 
17    * @see com.quantum.extensions.IDataExtension#run(org.w3c.dom.Document)
18    */
19   public void run(Document doc) {
20 //    System.out.println(doc);
21     
22     Element root = doc.getDocumentElement();
23
24     try {
25       XMLToModelConverter c = new XMLToModelConverter(root);
26       String name = ModelUtil.getTableName(root);
27       System.out.print("Table-name: ");
28       System.out.println(name);
29       Column[] cols = c.getColumns();
30       for (int i = 0; i < cols.length; i++) {
31         System.out.print("Column-name: "+i+" ");
32         System.out.println(cols[i].getName());
33       }
34
35     } catch (Exception e) {
36       e.printStackTrace();
37     }
38   }
39
40 }