3.x RC1 compatibility
authorkhartlage <khartlage>
Fri, 4 Jun 2004 19:23:36 +0000 (19:23 +0000)
committerkhartlage <khartlage>
Fri, 4 Jun 2004 19:23:36 +0000 (19:23 +0000)
16 files changed:
archive/net.sourceforge.phpeclipse.quantum.sql/.classpath
archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml [deleted file]
archive/net.sourceforge.phpeclipse.quantum.sql/plugin.xml
archive/net.sourceforge.phpeclipse.quantum.sql/schema/data.exsd
archive/net.sourceforge.phpeclipse.quantum.sql/schema/metadata.exsd
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumPlugin.java
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/QuantumResources.properties
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLConnectionPreferencePage.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLTemplatesPreferencePage.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/util/xml/XMLHelper.java
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/PHPSourceConsole.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/tableview/TableViewMenuListener.java
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPDeleteRowPage.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPInsertRowPage.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPSelectRowPage.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPUpdateRowPage.java [new file with mode: 0644]

index 5074f04..065ac06 100644 (file)
@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="src-test"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-       <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.junit_3.8.1/junit.jar"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml b/archive/net.sourceforge.phpeclipse.quantum.sql/plugin-3.0.xml
deleted file mode 100644 (file)
index 213fbe7..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
-   id="com.quantum.Quantum"
-   name="%quantum.name"
-   version="2.2.4"
-   provider-name="Tom Schneider"
-   class="com.quantum.QuantumPlugin">
-
-   <runtime>
-      <library name="quantum.jar"/>
-   </runtime>
-   <requires>
-      <import plugin="org.eclipse.core.boot"/>
-      <import plugin="org.eclipse.core.runtime"/>
-      <import plugin="org.eclipse.core.resources"/>
-      <import plugin="org.eclipse.swt"/>
-      <import plugin="org.eclipse.ui"/>
-      <import plugin="org.eclipse.ui.ide"/>
-      <import plugin="org.eclipse.text"/>
-      <import plugin="org.eclipse.jface.text"/>
-      <import plugin="org.apache.xerces"/>
-      <import plugin="org.eclipse.core.runtime.compatibility"/>
-      <import plugin="org.eclipse.ui.editors"/>
-      <import plugin="org.eclipse.ui.workbench.texteditor"/>
-   </requires>
-
-
-<!-- Pop-up Menus -->
-   <extension
-         point="org.eclipse.ui.popupMenus">
-      <objectContribution
-            objectClass="org.eclipse.core.resources.IFile"
-            nameFilter="*.sql"
-            id="com.quantum">
-         <menu
-               label="Quantum"
-               path="additions"
-               id="com.quantum.menu1">
-            <separator
-                  name="group1">
-            </separator>
-         </menu>
-         <action
-               label="Execute Against..."
-               class="com.quantum.actions.ExecuteAgainstAction"
-               menubarPath="com.quantum.menu1/group1"
-               enablesFor="1"
-               id="com.quantum.actions.ExecuteAgainstAction">
-         </action>
-      </objectContribution>
-   </extension>
-<!--   <extension
-         point="org.eclipse.ui.actionSets">
-      <actionSet
-            label="Execute Query"
-            visible="true"
-            id="com.quantum.actionssets">
-         <action
-               label="Execute Query"
-               icon="icons/play.gif"
-               class="com.quantum.actions.ExecuteAction"
-               tooltip="Execute Query"
-               toolbarPath="quantumGroup"
-               id="com.quantum.actions.ExecuteAction">
-         </action>
-      </actionSet>
-   </extension> -->
-   <extension
-         point="org.eclipse.ui.commands">
-      <category
-            name="%category.name"
-            description="%category.description"
-            id="com.quantum.category">
-      </category>
-      <command
-            name="%command.execute.name"
-            category="com.quantum.category"
-            description="%command.execute.description"
-            id="com.quantum.actions.ExecuteAction">
-      </command>
-      <keyBinding
-            string="Ctrl+Shift+Q"
-            scope="com.quantum.view.sql"
-            command="com.quantum.actions.ExecuteAction"
-            configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-      </keyBinding>
-      <scope
-            name="%scope.name"
-            description="%scope.description"
-            id="com.quantum.view.sql">
-      </scope>
-   </extension>
-<!-- Perspective -->
-   <extension
-         point="org.eclipse.ui.perspectives">
-      <perspective
-            name="%perspective.name"
-            icon="icons/quantum-ng.gif"
-            class="com.quantum.perspective.DBPerspective"
-            id="com.quantum.dbperspective">
-      </perspective>
-   </extension>
-<!-- Views -->
-   <extension
-         point="org.eclipse.ui.views">
-      <category
-            name="%category.name"
-            id="com.quantum.views">
-      </category>
-      <view
-            name="%sqllogview.name"
-            icon="icons/log.gif"
-            category="com.quantum.views"
-            class="com.quantum.view.SQLLogView"
-            id="com.quantum.view.logview">
-      </view>
-      <view
-            name="%tableview.name"
-            icon="icons/table.gif"
-            category="com.quantum.views"
-            class="com.quantum.view.tableview.TableView"
-            id="com.quantum.view.tableview.TableView">
-      </view>
-      <view
-            name="%bookmarkview.name"
-            icon="icons/bookmarks.gif"
-            category="com.quantum.views"
-            class="com.quantum.view.bookmark.BookmarkView"
-            id="com.quantum.view.bookmarkview">
-      </view>
-      <view
-            name="%subsetview.name"
-            icon="icons/subset.gif"
-            category="com.quantum.views"
-            class="com.quantum.view.subset.SubsetView"
-            id="com.quantum.view.subsetview">
-      </view>
-      <view
-            name="%sqlqueryview.name"
-            icon="icons/script.gif"
-            category="com.quantum.views"
-            class="com.quantum.view.SQLQueryView"
-            id="com.quantum.view.sqlqueryview">
-      </view>
-   </extension>
-<!-- Editors -->
-   <extension
-         point="org.eclipse.ui.editors">
-      <editor
-            name="Quantum SQL Editor"
-            extensions="sql,ddl"
-            icon="icons/script.gif"
-            class="com.quantum.editors.SQLEditor"
-            contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
-            id="com.quantum.editors.SQLEditor">
-      </editor>
-      <editor
-            name="Table Data Editor"
-            icon="icons/greentable.gif"
-            class="com.quantum.editors.dataeditor.DataEditor"
-            id="com.quantum.editors.dataeditor.DataEditor">
-      </editor>
-   </extension>
-<!-- Preferences -->
-   <extension
-         point="org.eclipse.ui.preferencePages">
-      <page
-            name="Quantum DB"
-            class="com.quantum.preferences.GlobalPreferences"
-            id="com.quantum.preferences">
-      </page>
-      <page
-            name="SQL Editor"
-            category="com.quantum.preferences"
-            class="com.quantum.preferences.SQLEditorPreferences"
-            id="com.quantum.preferences.editor">
-      </page>
-      <page
-            name="Copy"
-            category="com.quantum.preferences"
-            class="com.quantum.preferences.CopyPreferences"
-            id="com.quantum.preferences.copy">
-      </page>
-      <page
-            name="Custom Copy 1"
-            category="com.quantum.preferences.copy"
-            class="com.quantum.preferences.CustomCopyPreferences"
-            id="com.quantum.preferences.customcopy">
-      </page>
-      <page
-            name="Custom Copy 2"
-            category="com.quantum.preferences.copy"
-            class="com.quantum.preferences.CustomCopyPreferences2"
-            id="com.quantum.preferences.customcopy2">
-      </page>
-      <page
-            name="Custom Copy 3"
-            category="com.quantum.preferences.copy"
-            class="com.quantum.preferences.CustomCopyPreferences3"
-            id="com.quantum.preferences.customcopy3">
-      </page>
-   </extension>
-<!-- Menu for Bookmark View -->
-   <extension
-         point="org.eclipse.ui.viewActions">
-      <viewContribution
-            targetID="com.quantum.view.bookmarkview"
-            id="com.quantum.view.bookmarkview.menu">
-<!-- Export Bookmarks -->
-         <action
-               label="%bookmarkview.exportbookmarks"
-               icon="icons/export.gif"
-               class="com.quantum.actions.ExportBookmarksAction"
-               tooltip="Exports bookmarks to a file"
-               menubarPath="additions"
-               id="com.quantum.action.importbookmarks">
-         </action>
-<!-- Import Bookmarks -->
-         <action
-               label="%bookmarkview.importboomarks "
-               icon="icons/import.gif"
-               class="com.quantum.actions.ImportBookmarksAction"
-               tooltip="Imports bookmarks from a file"
-               menubarPath="additions"
-               id="com.quantum.action.importbookmarks">
-         </action>
-      </viewContribution>
-   </extension>
-   <extension
-         point="org.eclipse.ui.perspectiveExtensions">
-      <perspectiveExtension
-            targetID="org.eclipse.ui.resourcePerspective">
-      </perspectiveExtension>
-   </extension>
-<!-- Property Pages -->
-   <extension
-         point="org.eclipse.ui.propertyPages">
-      <page
-            objectClass="com.quantum.view.bookmark.TreeNode"
-            name="Database"
-            class="com.quantum.properties.DatabaseInformationPropertyPage"
-            nameFilter="*"
-            id="com.quantum.properties.DatabaseInformationPropertyPage">
-      </page>
-      <page
-            objectClass="com.quantum.view.bookmark.BookmarkNode"
-            name="Bookmark"
-            class="com.quantum.properties.BookmarkPropertyPage"
-            nameFilter="*"
-            id="com.quantum.properties.BookmarkPropertyPage">
-      </page>
-      <page
-            objectClass="com.quantum.view.bookmark.BookmarkNode"
-            name="Schemas"
-            class="com.quantum.properties.SchemaPropertyPage"
-            nameFilter="*"
-            id="com.quantum.properties.SchemaPropertyPage">
-      </page>
-      <page
-            objectClass="com.quantum.view.bookmark.EntityNode"
-            name="Tables, Views and Sequences"
-            class="com.quantum.properties.EntityPropertyPage"
-            nameFilter="*"
-            id="com.quantum.properties.EntityPropertyPage">
-      </page>
-   </extension>
-   <extension
-         point="org.eclipse.ui.exportWizards">
-      <wizard
-            name="Export to Quantum Bookmark File"
-            icon="./icons/bookmarkfile.gif"
-            class="com.quantum.wizards.ExportBookmarkWizard"
-            id="com.quantum.wizards.ExportBookmarkWizard">
-         <description>
-            A wizard that exports the list of database bookmarks to a Quantum bookmark file.
-         </description>
-      </wizard>
-      <wizard
-            name="Export to Torque Configuration File"
-            icon="./icons/torque.gif"
-            class="com.quantum.wizards.ExportTorqueWizard"
-            id="com.quantum.wizards.ExportTorqueWizard">
-         <description>
-            A wizard that exports the database structure to a Torque-compatible XML file.
-         </description>
-         <selection
-               class="com.quantum.view.bookmark.BookmarkNode">
-         </selection>
-      </wizard>
-   </extension>
-   <extension
-         point="org.eclipse.help.toc">
-      <toc
-            file="doc/toc.xml"
-            primary="true">
-      </toc>
-   </extension>
-
-</plugin>
index 4558693..9d27d0d 100644 (file)
@@ -8,10 +8,19 @@
    class="com.quantum.QuantumPlugin">
 
    <runtime>
-      <library name="quantum.jar"/>
+  <!-- <library name="lib/xercesImpl.jar">
+         <export name="*"/>
+      </library>
+      <library name="lib/xmlParserAPIs.jar">
+         <export name="*"/>
+      </library> -->
+      <library name="quantum.jar">
+         <export name="*"/>
+      </library>
    </runtime>
    <requires>
       <import plugin="org.eclipse.core.runtime.compatibility"/>
+      <import plugin="org.eclipse.core.runtime.compatibility"/>
       <import plugin="org.eclipse.ui.ide"/>
       <import plugin="org.eclipse.ui.views"/>
       <import plugin="org.eclipse.jface.text"/>
@@ -22,7 +31,6 @@
       <import plugin="org.eclipse.core.resources"/>
       <import plugin="org.eclipse.swt"/>
       <import plugin="org.eclipse.ui"/>
-      <import plugin="org.apache.xerces"/>
    </requires>
 
 
             class="com.quantum.view.SQLQueryView"
             id="com.quantum.view.sqlqueryview">
       </view>
+      <view
+            name="%phpsourceconsoleview.name"
+            icon="icons/script.gif"
+            class="com.quantum.view.PHPSourceConsole"
+            id="com.quantum.view.phpsourceconsoleview">
+      </view>
    </extension>
 <!-- Editors -->
    <extension
    <extension
          point="org.eclipse.ui.preferencePages">
       <page
-            name="Quantum DB"
+            name="PHP SQL(Quantum DB)"
             class="com.quantum.preferences.GlobalPreferences"
             id="com.quantum.preferences">
       </page>
             class="com.quantum.preferences.CustomCopyPreferences3"
             id="com.quantum.preferences.customcopy3">
       </page>
+      <page
+            name="PHP Connecting"
+            category="com.quantum.preferences"
+            class="com.quantum.preferences.php.PHPSQLConnectionPreferencePage"
+            id="com.quantum.preferences.php.PHPSQLConnectionPreferencePage">
+      </page>
+      <page
+            name="PHP Templates"
+            category="com.quantum.preferences"
+            class="com.quantum.preferences.php.PHPSQLTemplatesPreferencePage"
+            id="com.quantum.preferences.php.PHPSQLTemplatesPreferencePage">
+      </page>
    </extension>
 <!-- Menu for Bookmark View -->
    <extension
index 765ec41..4285d8a 100644 (file)
@@ -1,9 +1,9 @@
 <?xml version='1.0' encoding='UTF-8'?>\r
 <!-- Schema file written by PDE -->\r
-<schema targetNamespace="com.quantum.Quantum">\r
+<schema targetNamespace="net.sourceforge.phpeclipse.quantum.sql">\r
 <annotation>\r
       <appInfo>\r
-         <meta.schema plugin="com.quantum.Quantum" id="data" name="Data"/>\r
+         <meta.schema plugin="net.sourceforge.phpeclipse.quantum.sql" id="data" name="Data"/>\r
       </appInfo>\r
       <documentation>\r
          This extension point allow other plug-ins to act on data information extracted by Quantum.
@@ -97,7 +97,7 @@ For each registered extension, Quantum will add a menu entry in the context menu
 \r
    <annotation>\r
       <appInfo>\r
-         <meta.section type="copyright"/>\r
+         <meta.section type="copyright"/> \r
       </appInfo>\r
       <documentation>\r
          \r
index 25ea75f..eca31de 100644 (file)
@@ -1,15 +1,15 @@
 <?xml version='1.0' encoding='UTF-8'?>\r
 <!-- Schema file written by PDE -->\r
-<schema targetNamespace="com.quantum.Quantum">\r
+<schema targetNamespace="net.sourceforge.phpeclipse.quantum.sql">\r
 <annotation>\r
       <appInfo>\r
-         <meta.schema plugin="com.quantum.Quantum" id="metadata" name="Metadata"/>\r
+         <meta.schema plugin="net.sourceforge.phpeclipse.quantum.sql" id="metadata" name="Metadata"/>\r
       </appInfo>\r
       <documentation>\r
          This extension point allow other plug-ins to act on metadata information extracted by Quantum.
 For each registered extension, Quantum will add a menu entry in the context menu of the Bookmarks View.\r
       </documentation>\r
-   </annotation>\r
+   </annotation>  \r
 \r
    <element name="extension">\r
       <complexType>\r
index 154604a..140a149 100644 (file)
@@ -46,7 +46,7 @@ import org.xml.sax.SAXException;
  * Main class of the quantum plugin, sets defaults, saves and recovers state.
  */
 public class QuantumPlugin extends AbstractUIPlugin {
-     
+    public final static String PLUGIN_ID = "net.sourceforge.phpeclipse.quantum.sql";
        private static QuantumPlugin plugin;
        private Clipboard sysClip;
 
@@ -129,7 +129,7 @@ public class QuantumPlugin extends AbstractUIPlugin {
         */
        public void shutdown() throws CoreException {
                super.shutdown();
-               sysClip.dispose();
+//             sysClip.dispose();
        }
 
        /**
@@ -208,6 +208,30 @@ public class QuantumPlugin extends AbstractUIPlugin {
                getPreferenceStore().setDefault("quantum.numeric.bold", false); //$NON-NLS-1$
                PreferenceConverter.setDefault(getPreferenceStore(), "quantum.font", (FontData) null); //$NON-NLS-1$
         getPreferenceStore().setDefault("com.quantum.model.Bookmark.queryHistorySize", 20); //$NON-NLS-1$
+        
+        getPreferenceStore().setDefault(
+            "phpeclipse.sql.select.template",
+            "$results = mysql_query(\"SELECT {0} FROM {1} WHERE {2} \");");
+
+          getPreferenceStore().setDefault(
+            "phpeclipse.sql.insert.template",
+            "$results = mysql_query(\"INSERT INTO {0} ({1}) VALUES {2} \");");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.update.template", "$results = mysql_query(\"UPDATE {0} SET {1} WHERE {2} \");");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.delete.template", "$results = mysql_query(\"DELETE FROM {0} WHERE {1} \");");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.username.connect", "root");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.connect.connect", "jdbc:mysql://localhost/mysql");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.driver.connect", "com.mysql.jdbc.Driver");
+
+          getPreferenceStore().setDefault("phpeclipse.sql.type.connect", "MySQL");
+
+          getPreferenceStore().setDefault(
+            "phpeclipse.sql.filename.connect",
+            "C:\\wampp2\\mysql\\lib\\mysql-connector.jar");
        }
        // Returns the active page
        public IWorkbenchPage getActivePage()
index d0a7e30..06a897b 100644 (file)
@@ -30,6 +30,10 @@ tableview.close = Close Table
 tableview.update = Update...
 tableview.insert = Insert...
 tableview.delete = Delete...
+tableview.phpselect = PHP Select...
+tableview.phpupdate = PHP Update...
+tableview.phpinsert = PHP Insert...
+tableview.phpdelete = PHP Delete...
 tableview.filterSort = Sort or Filter Table...
 tableview.showAll = Toggle Show All Table Rows
 tableview.defaultEncoding = Set Default Encoding
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLConnectionPreferencePage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLConnectionPreferencePage.java
new file mode 100644 (file)
index 0000000..99f7918
--- /dev/null
@@ -0,0 +1,108 @@
+package com.quantum.preferences.php;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.quantum.QuantumPlugin;
+
+public class PHPSQLConnectionPreferencePage
+  extends PreferencePage
+  implements IWorkbenchPreferencePage {
+
+  StringFieldEditor fUserNameSFE;
+  StringFieldEditor fConnectSFE;
+  StringFieldEditor fDriverSFE;
+  StringFieldEditor fTypeSFE;
+  StringFieldEditor fDriverFileFFE;
+
+  public PHPSQLConnectionPreferencePage() {
+       super();
+       setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
+  }
+  public void init(IWorkbench workbench) {
+       setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
+  }
+  protected void performDefaults() {
+       fUserNameSFE.loadDefault();
+       fConnectSFE.loadDefault();
+       fDriverSFE.loadDefault();
+       fTypeSFE.loadDefault();
+       fDriverFileFFE.loadDefault();
+       super.performDefaults();
+  }
+
+  public boolean performOk() {
+       fUserNameSFE.store();
+       fConnectSFE.store();
+       fDriverSFE.store();
+       fTypeSFE.store();
+       fDriverFileFFE.store();
+       return super.performOk();
+  }
+
+  protected Control createContents(Composite parent) {
+       initializeDialogUnits(parent);
+       //  final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+       Composite composite = new Composite(parent, SWT.LEFT);
+       GridLayout layout = new GridLayout();
+       composite.setLayout(layout);
+       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+       //   layout.numColumns = 1;
+
+       fUserNameSFE =
+         new StringFieldEditor(
+               "phpeclipse.sql.username.connect",
+               "Default User name:",
+               composite);
+       fUserNameSFE.setPreferencePage(this);
+       fUserNameSFE.setPreferenceStore(getPreferenceStore());
+       fUserNameSFE.load();
+
+       fConnectSFE =
+         new StringFieldEditor(
+               "phpeclipse.sql.connect.connect",
+               "Connect:",
+               composite);
+       fConnectSFE.setPreferencePage(this);
+       fConnectSFE.setPreferenceStore(getPreferenceStore());
+       fConnectSFE.load();
+
+       fDriverSFE =
+         new StringFieldEditor(
+               "phpeclipse.sql.driver.connect",
+               "Driver:",
+               composite);
+       fDriverSFE.setPreferencePage(this);
+       fDriverSFE.setPreferenceStore(getPreferenceStore());
+       fDriverSFE.load();
+
+       fTypeSFE =
+         new StringFieldEditor("phpeclipse.sql.type.connect", "Type:", composite);
+       fTypeSFE.setPreferencePage(this);
+       fTypeSFE.setPreferenceStore(getPreferenceStore());
+       fTypeSFE.load();
+
+       //    fDriverFileFFE =
+       //      new FileFieldEditor(
+       //        "phpeclipse.sql.filename.connect",
+       //        "Driver filename:",
+       //        composite);
+       fDriverFileFFE =
+         new StringFieldEditor(
+               "phpeclipse.sql.filename.connect",
+               "Driver filename:",
+               composite);
+       fDriverFileFFE.setPreferencePage(this);
+       fDriverFileFFE.setPreferenceStore(getPreferenceStore());
+       fDriverFileFFE.load();
+
+       return composite;
+  }
+}
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLTemplatesPreferencePage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/preferences/php/PHPSQLTemplatesPreferencePage.java
new file mode 100644 (file)
index 0000000..6854ee5
--- /dev/null
@@ -0,0 +1,94 @@
+package com.quantum.preferences.php;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import com.quantum.QuantumPlugin;
+
+public class PHPSQLTemplatesPreferencePage
+  extends PreferencePage
+  implements IWorkbenchPreferencePage {
+
+  StringFieldEditor fPHPSelectSFE;
+  StringFieldEditor fPHPInsertSFE;
+  StringFieldEditor fPHPUpdateSFE;
+  StringFieldEditor fPHPDeleteSFE;
+
+  public PHPSQLTemplatesPreferencePage() {
+    super();
+    setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
+    //  setDescription("PHP SQL templates"); //$NON-NLS-1$
+  }
+  
+  public void init(IWorkbench workbench) {
+    setPreferenceStore(QuantumPlugin.getDefault().getPreferenceStore());
+  }
+  
+  protected void performDefaults() {
+    fPHPSelectSFE.loadDefault();
+    fPHPInsertSFE.loadDefault();
+    fPHPUpdateSFE.loadDefault();
+    fPHPDeleteSFE.loadDefault();
+    super.performDefaults();
+  }
+
+  public boolean performOk() {
+    fPHPSelectSFE.store();
+    fPHPInsertSFE.store();
+    fPHPUpdateSFE.store();
+    fPHPDeleteSFE.store();
+    return super.performOk();
+  }
+
+  protected Control createContents(Composite parent) {
+    initializeDialogUnits(parent);
+    //  final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+    Composite composite = new Composite(parent, SWT.LEFT);
+    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+    composite.setLayout(new GridLayout());
+
+    fPHPSelectSFE =
+      new StringFieldEditor(
+        "phpeclipse.sql.select.template",
+        "SELECT template:",
+        composite);
+    fPHPSelectSFE.setPreferencePage(this);
+    fPHPSelectSFE.setPreferenceStore(getPreferenceStore());
+    fPHPSelectSFE.load();
+
+    fPHPInsertSFE =
+      new StringFieldEditor(
+        "phpeclipse.sql.insert.template",
+        "INSERT template:",
+        composite);
+    fPHPInsertSFE.setPreferencePage(this);
+    fPHPInsertSFE.setPreferenceStore(getPreferenceStore());
+    fPHPInsertSFE.load();
+
+    fPHPUpdateSFE =
+      new StringFieldEditor(
+        "phpeclipse.sql.update.template",
+        "UPDATE template:",
+        composite);
+    fPHPUpdateSFE.setPreferencePage(this);
+    fPHPUpdateSFE.setPreferenceStore(getPreferenceStore());
+    fPHPUpdateSFE.load();
+
+    fPHPDeleteSFE =
+      new StringFieldEditor(
+        "phpeclipse.sql.delete.template",
+        "DELETE template:",
+        composite);
+    fPHPDeleteSFE.setPreferencePage(this);
+    fPHPDeleteSFE.setPreferenceStore(getPreferenceStore());
+    fPHPDeleteSFE.load();
+    return composite;
+  }
+}
index bf16296..9fdeeef 100644 (file)
@@ -10,9 +10,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.xml.serialize.DOMSerializer;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
+import org.apache.xalan.serialize.DOMSerializer;
+import org.apache.xalan.serialize.SerializerToXML;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -28,21 +27,27 @@ public class XMLHelper {
     
     public static DOMSerializer createDOMSerializer(Writer writer) 
         throws IOException {
-        XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat());
+//      XMLSerializer serializer = new XMLSerializer(writer, createOutputFormat());
+//     return serializer.asDOMSerializer();
+       SerializerToXML serializer = new SerializerToXML();
+        serializer.setWriter(writer);
         return serializer.asDOMSerializer();
     }
 
     public static DOMSerializer createDOMSerializer(OutputStream stream) 
         throws IOException {
-        XMLSerializer serializer = new XMLSerializer(stream, createOutputFormat());
+//      XMLSerializer serializer = new XMLSerializer(stream, createOutputFormat());
+//      return serializer.asDOMSerializer();
+        SerializerToXML serializer = new SerializerToXML();
+        serializer.setOutputStream(stream);
         return serializer.asDOMSerializer();
     }
-    private static OutputFormat createOutputFormat() {
-        OutputFormat format = new OutputFormat();
-        format.setIndenting(true);
-        format.setLineWidth(80);
-        return format;
-    }
+//    private static OutputFormat createOutputFormat() {
+//        OutputFormat format = new OutputFormat();
+//        format.setIndenting(true);
+//        format.setLineWidth(80);
+//        return format;
+//    }
     
     public static Document createEmptyDocument() throws ParserConfigurationException {
         DocumentBuilder builder = createDocumentBuilder();
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/PHPSourceConsole.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/PHPSourceConsole.java
new file mode 100644 (file)
index 0000000..42c2956
--- /dev/null
@@ -0,0 +1,157 @@
+package com.quantum.view;
+
+/**********************************************************************
+Copyright (c) 2000, 2002 IBM Corp. and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Common Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/cpl-v10.html
+
+Contributors:
+       IBM Corporation - Initial implementation
+       Klaus Hartlage - www.eclipseproject.de
+**********************************************************************/
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+import com.quantum.Messages;
+import com.quantum.QuantumPlugin;
+
+/**
+ * The PHPSourceConsole is used to display the output from the PHP SQL wizards
+ * @see ViewPart
+ */
+public class PHPSourceConsole extends ViewPart {
+
+  public static final String CONSOLE_ID =
+       "net.sourceforge.phpdt.sql.view.phpsourceconsoleview";
+
+  TextViewer viewer = null;
+  private Document document = null;
+
+  /**
+   * The constructor.
+   */
+  public PHPSourceConsole() {
+  }
+
+  /**
+   * Insert the method's description here.
+   * @see ViewPart#createPartControl
+   */
+  public void createPartControl(Composite parent) {
+       viewer = new TextViewer(parent, SWT.WRAP | SWT.V_SCROLL | SWT.H_SCROLL);
+       GridData viewerData = new GridData(GridData.FILL_BOTH);
+       viewer.getControl().setLayoutData(viewerData);
+       viewer.setEditable(false);
+
+       StyledText widget = viewer.getTextWidget();
+       widget.setFont(
+         JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
+       Action cutAction = new Action() {
+         public void run() {
+               viewer.getTextWidget().cut();
+         }
+       };
+       Action copyAction = new Action() {
+         public void run() {
+               viewer.getTextWidget().copy();
+         }
+       };
+       Action pasteAction = new Action() {
+         public void run() {
+               viewer.getTextWidget().paste();
+         }
+       };
+
+       IActionBars bars = this.getViewSite().getActionBars();
+       bars.setGlobalActionHandler(IWorkbenchActionConstants.CUT, cutAction);
+       bars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyAction);
+       bars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, pasteAction);
+  }
+
+  /**
+   * Insert the method's description here.
+   * @see ViewPart#setFocus
+   */
+  public void setFocus() {
+  }
+
+  /**
+   * Set the text for the viewer
+   */
+  private void setOutputText(String text) {
+       document = new Document(text);
+       viewer.setDocument(document);
+  }
+
+  private void appendOutputText(String text) {
+       try {
+         if (document == null) {
+               document = new Document(text);
+               viewer.setDocument(document);
+         }
+         document.replace(document.getLength(), 0, text);
+       } catch (BadLocationException e) {
+       }
+       //  viewer.setDocument(document);
+  }
+
+  public static PHPSourceConsole getInstance() {
+       IWorkbenchPage page =
+         PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+       PHPSourceConsole console = (PHPSourceConsole) page.findView(PHPSourceConsole.CONSOLE_ID);
+       // if (PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) {
+
+       try {
+         page.showView(PHPSourceConsole.CONSOLE_ID);
+         if (console == null) { 
+               console = (PHPSourceConsole) page.findView(PHPSourceConsole.CONSOLE_ID);
+         }
+       } catch (PartInitException e) {
+         QuantumPlugin.getDefault().getLog().log(
+               new Status(
+                 IStatus.ERROR,
+                 QuantumPlugin.PLUGIN_ID,  
+                 0,
+                 Messages.getString("sqlconsole.viewopeningproblem"),
+                 e));
+       }
+
+       //   }
+       return console;
+  }
+
+  /**
+   * Prints out the string represented by the string buffer
+   */
+  public synchronized void print(String output) {
+       appendOutputText(output);
+  }
+
+  /**
+   * Prints out the string represented by the string buffer
+   */
+  public synchronized void println(String output) {
+       appendOutputText(output+'\n');
+  }
+
+  public synchronized void clear() {
+       setOutputText("");
+  }
+}
index 09da28f..319001a 100644 (file)
@@ -3,18 +3,7 @@
  *
  */
 package com.quantum.view.tableview;
-
 import java.util.Vector;
-
-import com.quantum.Messages;
-import com.quantum.extensions.ExtensionAction;
-import com.quantum.sql.TableRow;
-import com.quantum.util.StringMatrix;
-import com.quantum.wizards.DeleteRowPage;
-import com.quantum.wizards.InsertRowPage;
-import com.quantum.wizards.SQLRowWizard;
-import com.quantum.wizards.UpdateRowPage;
-
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
@@ -23,116 +12,162 @@ import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
-
-
+import com.quantum.Messages;
+import com.quantum.extensions.ExtensionAction;
+import com.quantum.sql.TableRow;
+import com.quantum.util.StringMatrix;
+import com.quantum.wizards.DeleteRowPage;
+import com.quantum.wizards.InsertRowPage;
+import com.quantum.wizards.PHPDeleteRowPage;
+import com.quantum.wizards.PHPInsertRowPage;
+import com.quantum.wizards.PHPSelectRowPage;
+import com.quantum.wizards.PHPUpdateRowPage;
+import com.quantum.wizards.SQLRowWizard;
+import com.quantum.wizards.UpdateRowPage;
 public final class TableViewMenuListener implements IMenuListener {
-       private final TableView tableView;
-       private final Table table;
-       private final Action UTF16EncodingAction;
-       private final TableAdapter ta;
-       private final Action defaultEncodingAction;
-       private final Action UTF8EncodingAction;
-       private final Vector extensionVector;
-       
-       public TableViewMenuListener(
-               TableView view, 
-               Table table, 
-               Action UTF16EncodingAction, 
-               TableAdapter ta, 
-               Action defaultEncodingAction, 
-               Action UTF8EncodingAction,
-               Vector extensionVector ) {
-                       
-               super();
-               this.tableView = view;
-               this.table = table;
-               this.UTF16EncodingAction = UTF16EncodingAction;
-               this.ta = ta;
-               this.defaultEncodingAction = defaultEncodingAction;
-               this.UTF8EncodingAction = UTF8EncodingAction;
-               this.extensionVector = extensionVector;
-       }
-       public void menuAboutToShow(IMenuManager mgr) {
-               if (ta.getTable() != null) {
-                       TableItem[] selection = table.getSelection();
-                       TableColumn[] columns = table.getColumns();
-                       // Copy in columnNames the names of the columns of the selected rows
-                       String columnNames[] = new String[columns.length];
-                       for (int i = 0; i < columns.length; i++) {
-                               columnNames[i] = columns[i].getText();
-                       }
-                       // Copy in data the values of the data columns of the selected rows
-                       StringMatrix data = new StringMatrix();
-                       data.addMatrixHeader(columnNames);
-                       if (selection != null && selection.length > 0) {
-                               for (int iRow = 0; iRow < selection.length; iRow++) {
-                                       TableItem sel = selection[iRow];
-                                       for (int i = 0; i < columns.length; i++) {
-                                               data.addAt(columnNames[i], sel.getText(i), iRow );
-                                       }
-                               }
-                       } else {
-                               // Create dummy values in case nothing selected
-                               for (int i = 0; i < columns.length; i++) {
-                                       data.addAt(columnNames[i], "", 0); //$NON-NLS-1$
-                               }
-                       }
-                       final TableRow row =
-                               new TableRow(ta.getEntity(), ta.getBookmark(), ta.getTable(), data);
-                       Action updateAction = new Action() {
-                               public void run() {
-                                       UpdateRowPage page = new UpdateRowPage(""); //$NON-NLS-1$
-                                       SQLRowWizard wizard = new SQLRowWizard();
-                                       wizard.init(Messages.getString("TableView.UpdateRow"), page, row, ta); //$NON-NLS-1$
-                                       WizardDialog dialog =
-                                               new WizardDialog(
-                                                       tableView.getSite().getShell(),
-                                                       wizard);
-                                       dialog.open();
-                               }
-                       };
-                       updateAction.setText(Messages.getString("tableview.update")); //$NON-NLS-1$
-                       Action insertAction = new Action() {
-                               public void run() {
-                                       InsertRowPage page = new InsertRowPage(""); //$NON-NLS-1$
-                                       SQLRowWizard wizard = new SQLRowWizard();
-                                       wizard.init(Messages.getString("TableView.InsertRow"), page, row, ta); //$NON-NLS-1$
-                                       WizardDialog dialog =
-                                               new WizardDialog(
-                                                       tableView.getSite().getShell(),
-                                                       wizard);
-                                       dialog.open();
-                               }
-                       };
-                       insertAction.setText(Messages.getString("tableview.insert")); //$NON-NLS-1$
-                       Action deleteAction = new Action() {
-                               public void run() {
-                                       DeleteRowPage page = new DeleteRowPage(""); //$NON-NLS-1$
-                                       SQLRowWizard wizard = new SQLRowWizard();
-                                       wizard.init(Messages.getString("TableView.DeleteRow"), page, row, ta); //$NON-NLS-1$
-                                       WizardDialog dialog =
-                                               new WizardDialog(
-                                       tableView.getSite().getShell(),
-                                                       wizard);
-                                       dialog.open();
-                               }
-                       };
-                       deleteAction.setText(Messages.getString("tableview.delete")); //$NON-NLS-1$
-                       mgr.add(insertAction);
-                       mgr.add(updateAction);
-                       mgr.add(deleteAction);
-
-                       MenuManager subMenuExtension = new MenuManager("Extensions"); 
-                       for (int i = 0; i < extensionVector.size(); i++) {
-                               ExtensionAction extensionAction = (ExtensionAction) extensionVector.get(i);
-                               extensionAction.addRowData(row);
-                               subMenuExtension.add(extensionAction);
-                       }
-                       if (extensionVector.size() > 0) mgr.add(subMenuExtension);
-
-               }
-               mgr.add(defaultEncodingAction);
-               mgr.add(UTF8EncodingAction);
-               mgr.add(UTF16EncodingAction);
-       }
+  private final TableView tableView;
+  private final Table table;
+  private final Action UTF16EncodingAction;
+  private final TableAdapter ta;
+  private final Action defaultEncodingAction;
+  private final Action UTF8EncodingAction;
+  private final Vector extensionVector;
+  public TableViewMenuListener(TableView view, Table table,
+      Action UTF16EncodingAction, TableAdapter ta,
+      Action defaultEncodingAction, Action UTF8EncodingAction,
+      Vector extensionVector) {
+    super();
+    this.tableView = view;
+    this.table = table;
+    this.UTF16EncodingAction = UTF16EncodingAction;
+    this.ta = ta;
+    this.defaultEncodingAction = defaultEncodingAction;
+    this.UTF8EncodingAction = UTF8EncodingAction;
+    this.extensionVector = extensionVector;
+  }
+  public void menuAboutToShow(IMenuManager mgr) {
+    if (ta.getTable() != null) {
+      TableItem[] selection = table.getSelection();
+      TableColumn[] columns = table.getColumns();
+      // Copy in columnNames the names of the columns of the selected rows
+      String columnNames[] = new String[columns.length];
+      for (int i = 0; i < columns.length; i++) {
+        columnNames[i] = columns[i].getText();
+      }
+      // Copy in data the values of the data columns of the selected rows
+      StringMatrix data = new StringMatrix();
+      data.addMatrixHeader(columnNames);
+      if (selection != null && selection.length > 0) {
+        for (int iRow = 0; iRow < selection.length; iRow++) {
+          TableItem sel = selection[iRow];
+          for (int i = 0; i < columns.length; i++) {
+            data.addAt(columnNames[i], sel.getText(i), iRow);
+          }
+        }
+      } else {
+        // Create dummy values in case nothing selected
+        for (int i = 0; i < columns.length; i++) {
+          data.addAt(columnNames[i], "", 0); //$NON-NLS-1$
+        }
+      }
+      final TableRow row = new TableRow(ta.getEntity(), ta.getBookmark(), ta
+          .getTable(), data);
+      Action phpSelectAction = new Action() {
+        public void run() {
+          PHPSelectRowPage page = new PHPSelectRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.UpdateRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(tableView.getSite().getShell()
+              .getShell(), wizard);
+          dialog.open();
+        }
+      };
+      phpSelectAction.setText(Messages.getString("tableview.phpselect")); //$NON-NLS-1$
+      Action phpUpdateAction = new Action() {
+        public void run() {
+          PHPUpdateRowPage page = new PHPUpdateRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.UpdateRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      phpUpdateAction.setText(Messages.getString("tableview.phpupdate")); //$NON-NLS-1$
+      Action phpInsertAction = new Action() {
+        public void run() {
+          PHPInsertRowPage page = new PHPInsertRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.InsertRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      phpInsertAction.setText(Messages.getString("tableview.phpinsert")); //$NON-NLS-1$
+      Action phpDeleteAction = new Action() {
+        public void run() {
+          PHPDeleteRowPage page = new PHPDeleteRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.DeleteRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      phpDeleteAction.setText(Messages.getString("tableview.phpdelete")); //$NON-NLS-1$
+      Action updateAction = new Action() {
+        public void run() {
+          UpdateRowPage page = new UpdateRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.UpdateRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      updateAction.setText(Messages.getString("tableview.update")); //$NON-NLS-1$
+      Action insertAction = new Action() {
+        public void run() {
+          InsertRowPage page = new InsertRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.InsertRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      insertAction.setText(Messages.getString("tableview.insert")); //$NON-NLS-1$
+      Action deleteAction = new Action() {
+        public void run() {
+          DeleteRowPage page = new DeleteRowPage(""); //$NON-NLS-1$
+          SQLRowWizard wizard = new SQLRowWizard();
+          wizard.init(Messages.getString("TableView.DeleteRow"), page, row, ta); //$NON-NLS-1$
+          WizardDialog dialog = new WizardDialog(
+              tableView.getSite().getShell(), wizard);
+          dialog.open();
+        }
+      };
+      deleteAction.setText(Messages.getString("tableview.delete")); //$NON-NLS-1$
+      mgr.add(phpSelectAction);
+      mgr.add(phpInsertAction);
+      mgr.add(phpUpdateAction);
+      mgr.add(phpDeleteAction);
+      mgr.add(insertAction);
+      mgr.add(updateAction);
+      mgr.add(deleteAction);
+      MenuManager subMenuExtension = new MenuManager("Extensions");
+      for (int i = 0; i < extensionVector.size(); i++) {
+        ExtensionAction extensionAction = (ExtensionAction) extensionVector
+            .get(i);
+        extensionAction.addRowData(row);
+        subMenuExtension.add(extensionAction);
+      }
+      if (extensionVector.size() > 0)
+        mgr.add(subMenuExtension);
+    }
+    mgr.add(defaultEncodingAction);
+    mgr.add(UTF8EncodingAction);
+    mgr.add(UTF16EncodingAction);
+  }
 }
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPDeleteRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPDeleteRowPage.java
new file mode 100644 (file)
index 0000000..8b48541
--- /dev/null
@@ -0,0 +1,174 @@
+package com.quantum.wizards;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.quantum.QuantumPlugin;
+import com.quantum.sql.TableRow;
+import com.quantum.view.PHPSourceConsole;
+import com.quantum.view.tableview.TableAdapter;
+
+public class PHPDeleteRowPage extends WizardPage implements SQLPage {
+  TableRow row;
+  String[] columnNames;
+  Text[] values;
+  Button[] whereValues;
+  Label query;
+  IPreferenceStore fStore;
+  private final static boolean DEBUG = false;
+
+  public PHPDeleteRowPage(String pageName) {
+    super(pageName);
+  }
+
+  public void init(TableRow row, TableAdapter adapter) {
+    this.row = row;
+  }
+
+  public void createControl(Composite parent) {
+    System.out.println("page create control");
+    fStore = QuantumPlugin.getDefault().getPreferenceStore();
+    Composite container = new Composite(parent, SWT.NULL);
+    GridLayout layout = new GridLayout();
+    container.setLayout(layout);
+    int layoutColumns = 3;
+    layout.numColumns = layoutColumns;
+
+    if (DEBUG) {
+      if (row == null) {
+        System.out.println("Row is null");
+      }
+      if (row.getColumnNames() == null) {
+        System.out.println("Columns are null");
+      }
+      if (row.getTableData() == null) {
+        System.out.println("Data is null");
+      }
+    }
+    columnNames = row.getColumnNames();
+    String[] data = row.getTableData();
+    if (DEBUG) {
+      for (int i = 0; i < row.getColumnCount(); i++) {
+        System.out.println("data = " + i + "=" + data[i]);
+        System.out.println("column = " + i + "=" + columnNames[i]);
+      }
+    }
+    values = new Text[row.getColumnCount()];
+    whereValues = new Button[row.getColumnCount()];
+    Label temp = new Label(container, SWT.NULL);
+    temp.setText("Column Name");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Value");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Include in?");
+    for (int i = 0; i < row.getColumnCount(); i++) {
+      Label label = new Label(container, SWT.NULL);
+      label.setText(columnNames[i]);
+      values[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+      GridData fullHorizontal = new GridData();
+      fullHorizontal.horizontalAlignment = GridData.FILL;
+      values[i].setLayoutData(fullHorizontal);
+
+      if (data[i] == null || data[i].equals("")) {
+        values[i].setText('$' + columnNames[i]);
+      } else {
+        values[i].setText(data[i]);
+      }
+
+      values[i].addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          updateQuery();
+        }
+      });
+
+      whereValues[i] = new Button(container, SWT.CHECK);
+      whereValues[i].setText("Where clause");
+      whereValues[i].addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+        public void widgetSelected(SelectionEvent e) {
+          updateQuery();
+        }
+      });
+    }
+    query = new Label(container, SWT.WRAP);
+    GridData gridData = new GridData();
+    gridData.horizontalSpan = layoutColumns;
+    gridData.horizontalAlignment = GridData.FILL;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    query.setLayoutData(gridData);
+
+    setControl(container);
+    updateQuery();
+
+    setPageComplete(true);
+  }
+  public void updateQuery() {
+    if (DEBUG) {
+      System.out.println("Updating delete query");
+    }
+    StringBuffer whereClause = new StringBuffer();
+    int numSelected = 0;
+    boolean first = false;
+    for (int i = 0; i < columnNames.length; i++) {
+      if (whereValues[i].getSelection()) {
+        numSelected++;
+        if (first) {
+          whereClause.append(", ");
+        }
+
+        whereClause.append(columnNames[i]);
+        whereClause.append(" = ");
+        whereClause.append("'" + values[i].getText() + "'");
+
+        first = true;
+      }
+    }
+    //    if (whereClause.length() > 1) {
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //    }
+
+    String[] arguments = { row.getTable(), whereClause.toString()};
+    MessageFormat form = new MessageFormat(fStore.getString("phpeclipse.sql.delete.template"));
+
+    String query = form.format(arguments);
+
+    //   String query = "$results = mysql_query(\"DELETE FROM " + row.getTable();
+    //   if (numSelected > 0) {
+    //         query += " WHERE " + whereClause.toString() + "\");";
+    //   } else {
+    //         query += "\");";
+    //   }
+
+    if (numSelected > 0) {
+      setMessage("");
+    } else {
+      setMessage("Warning: no \"where clause\" columns selected, all rows will be deleted");
+    }
+
+    this.getControl().pack();
+    this.query.setText(query);
+  }
+  public boolean performFinish() {
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPInsertRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPInsertRowPage.java
new file mode 100644 (file)
index 0000000..4e850b7
--- /dev/null
@@ -0,0 +1,144 @@
+package com.quantum.wizards;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.quantum.QuantumPlugin;
+import com.quantum.sql.TableRow;
+import com.quantum.view.PHPSourceConsole;
+import com.quantum.view.tableview.TableAdapter;
+
+public class PHPInsertRowPage extends WizardPage implements SQLPage {
+  TableRow row;
+  String[] columnNames;
+  Text[] values;
+  Label query;
+  private final static boolean DEBUG = false;
+  private IPreferenceStore fStore;
+
+  public PHPInsertRowPage(String pageName) {
+    super(pageName);
+  }
+
+  public void init(TableRow row, TableAdapter adapter) {
+    this.row = row;
+  }
+
+  public void createControl(Composite parent) {
+    if (DEBUG) {
+      System.out.println("page create control");
+    }
+    fStore = QuantumPlugin.getDefault().getPreferenceStore();
+    Composite container = new Composite(parent, SWT.NULL);
+    GridLayout layout = new GridLayout();
+    container.setLayout(layout);
+    int layoutColumns = 2;
+    layout.numColumns = layoutColumns;
+
+    if (DEBUG) {
+      if (row == null) {
+        System.out.println("Row is null");
+      }
+      if (row.getColumnNames() == null) {
+        System.out.println("Columns are null");
+      }
+      if (row.getTableData() == null) {
+        System.out.println("Data is null");
+      }
+    }
+
+    columnNames = row.getColumnNames();
+    String[] data = row.getTableData();
+    if (DEBUG) {
+      for (int i = 0; i < row.getColumnCount(); i++) {
+        System.out.println("data = " + i + "=" + data[i]);
+        System.out.println("column = " + i + "=" + columnNames[i]);
+      }
+    }
+    values = new Text[row.getColumnCount()];
+    Label temp = new Label(container, SWT.NULL);
+    temp.setText("Column Name");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Value");
+    for (int i = 0; i < row.getColumnCount(); i++) {
+      Label label = new Label(container, SWT.NULL);
+      label.setText(columnNames[i]);
+      values[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+      GridData fullHorizontal = new GridData();
+      fullHorizontal.horizontalAlignment = GridData.FILL;
+      values[i].setLayoutData(fullHorizontal);
+
+      //values[i].setText(data[i]);
+      values[i].addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          updateQuery();
+        }
+      });
+    }
+    query = new Label(container, SWT.WRAP);
+    GridData gridData = new GridData();
+    gridData.horizontalSpan = layoutColumns;
+    gridData.horizontalAlignment = GridData.FILL;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    query.setLayoutData(gridData);
+
+    setControl(container);
+    updateQuery();
+
+    setPageComplete(true);
+  }
+  public void updateQuery() {
+    if (DEBUG) {
+      System.out.println("Updating insert query");
+    }
+    StringBuffer fieldClause = new StringBuffer();
+
+    StringBuffer valuesClause = new StringBuffer();
+    String text;
+    boolean first = false;
+    for (int i = 0; i < columnNames.length; i++) {
+      text = values[i].getText();
+      if (!text.equals("")) {
+        if (first) {
+          valuesClause.append(", ");
+          fieldClause.append(", ");
+        }
+        valuesClause.append("'" + values[i].getText() + "'");
+        fieldClause.append(columnNames[i]);
+        first = true;
+      }
+    }
+    //    if (valuesClause.length() > 1) {
+    //      valuesClause.deleteCharAt(valuesClause.length() - 1);
+    //      valuesClause.deleteCharAt(valuesClause.length() - 1);
+    //    }
+    String[] arguments = { row.getTable(), fieldClause.toString(), valuesClause.toString()};
+    MessageFormat form = new MessageFormat(fStore.getString("phpeclipse.sql.insert.template"));
+
+    String query = form.format(arguments);
+
+    //    String query = "$results = mysql_query(\"INSERT INTO " + row.getTable() + " (";
+    //    query += fieldClause.toString() + ") ";
+    //    query += " VALUES (" + valuesClause.toString();
+    //    query += ")\");";
+    this.query.setText(query);
+  }
+  public boolean performFinish() {
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPSelectRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPSelectRowPage.java
new file mode 100644 (file)
index 0000000..05cb2d4
--- /dev/null
@@ -0,0 +1,202 @@
+package com.quantum.wizards;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.quantum.QuantumPlugin;
+import com.quantum.sql.TableRow;
+import com.quantum.view.PHPSourceConsole;
+import com.quantum.view.tableview.TableAdapter;
+
+public class PHPSelectRowPage extends WizardPage implements SQLPage {
+  TableRow row;
+  String[] columnNames;
+  Text[] whereValues;
+  // Text[] newValues;
+  Button[] primaryKeys;
+  Button[] setValues;
+  Label query;
+  IPreferenceStore fStore;
+  private final static boolean DEBUG = false;
+
+  public PHPSelectRowPage(String pageName) {
+    super(pageName);
+  }
+
+  public void init(TableRow row, TableAdapter adapter) {
+    this.row = row;
+  }
+
+  public void createControl(Composite parent) {
+    if (DEBUG) {
+      System.out.println("page create control");
+    }
+    Composite container = new Composite(parent, SWT.NULL);
+    fStore = QuantumPlugin.getDefault().getPreferenceStore();
+
+    GridLayout layout = new GridLayout();
+    container.setLayout(layout);
+    int layoutColumns = 4;
+    layout.numColumns = layoutColumns;
+
+    if (DEBUG) {
+      if (row == null) {
+        System.out.println("Row is null");
+      }
+      if (row.getColumnNames() == null) {
+        System.out.println("Columns are null");
+      }
+      if (row.getTableData() == null) {
+        System.out.println("Data is null");
+      }
+    }
+
+    columnNames = row.getColumnNames();
+    String[] data = row.getTableData();
+
+    for (int i = 0; i < row.getColumnCount(); i++) {
+      System.out.println("data = " + i + "=" + data[i]);
+      System.out.println("column = " + i + "=" + columnNames[i]);
+    }
+
+    whereValues = new Text[row.getColumnCount()];
+    //  newValues = new Text[row.getColumnCount()];
+    primaryKeys = new Button[row.getColumnCount()];
+    setValues = new Button[row.getColumnCount()];
+    Label temp = new Label(container, SWT.NULL);
+    temp.setText("Column Name");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Value");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Where");
+    //    temp = new Label(container, SWT.NULL);
+    //    temp.setText("New Value");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Select");
+    for (int i = 0; i < row.getColumnCount(); i++) {
+      Label label = new Label(container, SWT.NULL);
+      label.setText(columnNames[i]);
+      whereValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+      if (data[i] == null || data[i].equals("")) {
+        whereValues[i].setText('$' + columnNames[i]);
+      } else {
+        whereValues[i].setText(data[i]);
+      }
+
+      whereValues[i].addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          updateQuery();
+        }
+      });
+
+      primaryKeys[i] = new Button(container, SWT.CHECK);
+      //primaryKeys[i].setText("Where Clause");
+      primaryKeys[i].addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+        public void widgetSelected(SelectionEvent e) {
+          updateQuery();
+        }
+      });
+      //   newValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+      //   newValues[i].setText(data[i]);
+      //   newValues[i].addModifyListener(new ModifyListener() {
+      //    public void modifyText(ModifyEvent e) {
+      //       updateQuery();
+      //    }
+      //  });
+      setValues[i] = new Button(container, SWT.CHECK);
+      //setValues[i].setText("Select Value");
+      setValues[i].addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+        public void widgetSelected(SelectionEvent e) {
+          updateQuery();
+        }
+      });
+    }
+    query = new Label(container, SWT.WRAP);
+    GridData gridData = new GridData();
+    gridData.horizontalSpan = layoutColumns;
+    gridData.horizontalAlignment = GridData.FILL;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    query.setLayoutData(gridData);
+
+    setControl(container);
+    updateQuery();
+
+    setPageComplete(true);
+  }
+
+  public void updateQuery() {
+    if (DEBUG) {
+      System.out.println("PHP SELECT");
+    }
+    StringBuffer setClause = new StringBuffer();
+    StringBuffer whereClause = new StringBuffer();
+    String temp;
+    boolean firstClause = false;
+    for (int i = 0; i < columnNames.length; i++) {
+      if (primaryKeys[i].getSelection()) {
+        if (firstClause) {
+          whereClause.append(" AND ");
+        }
+        firstClause = true;
+        whereClause.append(columnNames[i]);
+        whereClause.append(" = ");
+        temp = whereValues[i].getText();
+        //        if (temp.charAt(0) == '$') {
+        //          whereClause.append(temp);
+        //        } else {
+        whereClause.append("'" + temp + "'");
+        //        }
+
+      }
+      if (setValues[i].getSelection()) {
+        setClause.append(columnNames[i]);
+        //   setClause.append(" = ");
+        //   setClause.append(newValues[i].getText());
+        setClause.append(", ");
+      }
+    }
+    //    if (whereClause.length() > 1) {
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //    }
+    if (setClause.length() > 1) {
+      setClause.deleteCharAt(setClause.length() - 1);
+      setClause.deleteCharAt(setClause.length() - 1);
+    }
+
+    String[] arguments = { setClause.toString(), row.getTable(), whereClause.toString()};
+    MessageFormat form = new MessageFormat(fStore.getString("phpeclipse.sql.select.template"));
+
+    String query = form.format(arguments);
+    //    String query = "$results = mysql_query(\"SELECT " + setClause.toString();
+    //    query += " FROM " + row.getTable();
+    //    query += " WHERE " + whereClause.toString() + "\");";
+    this.query.setText(query);
+  }
+
+  public boolean performFinish() {
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
+    return true;
+  }
+}
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPUpdateRowPage.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/wizards/PHPUpdateRowPage.java
new file mode 100644 (file)
index 0000000..26b2ea9
--- /dev/null
@@ -0,0 +1,195 @@
+package com.quantum.wizards;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.quantum.QuantumPlugin;
+import com.quantum.sql.TableRow;
+import com.quantum.view.PHPSourceConsole;
+import com.quantum.view.tableview.TableAdapter;
+
+public class PHPUpdateRowPage extends WizardPage implements SQLPage {
+  TableRow row;
+  String[] columnNames;
+  Text[] oldValues;
+  Text[] newValues;
+  Button[] primaryKeys;
+  Button[] setValues;
+  Label query;
+  IPreferenceStore fStore;
+  private final static boolean DEBUG = false;
+
+  public PHPUpdateRowPage(String pageName) {
+    super(pageName);
+  }
+
+  public void init(TableRow row, TableAdapter adapter) {
+    this.row = row;
+  }
+
+  public void createControl(Composite parent) {
+    if (DEBUG) {
+      System.out.println("page create control");
+    }
+    fStore = QuantumPlugin.getDefault().getPreferenceStore();
+    Composite container = new Composite(parent, SWT.NULL);
+    GridLayout layout = new GridLayout();
+    container.setLayout(layout);
+    int layoutColumns = 5;
+    layout.numColumns = layoutColumns;
+
+    if (DEBUG) {
+      if (row == null) {
+        System.out.println("Row is null");
+      }
+      if (row.getColumnNames() == null) {
+        System.out.println("Columns are null");
+      }
+      if (row.getTableData() == null) {
+        System.out.println("Data is null");
+      }
+    }
+
+    columnNames = row.getColumnNames();
+    String[] data = row.getTableData();
+
+    if (DEBUG) {
+      for (int i = 0; i < row.getColumnCount(); i++) {
+        System.out.println("data = " + i + "=" + data[i]);
+        System.out.println("column = " + i + "=" + columnNames[i]);
+      }
+    }
+
+    oldValues = new Text[row.getColumnCount()];
+    newValues = new Text[row.getColumnCount()];
+    primaryKeys = new Button[row.getColumnCount()];
+    setValues = new Button[row.getColumnCount()];
+    Label temp = new Label(container, SWT.NULL);
+    temp.setText("Column Name");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Where Value");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Where");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Set Value");
+    temp = new Label(container, SWT.NULL);
+    temp.setText("Set");
+    for (int i = 0; i < row.getColumnCount(); i++) {
+      Label label = new Label(container, SWT.NULL);
+      label.setText(columnNames[i]);
+      oldValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+      if (data[i] == null || data[i].equals("")) {
+        oldValues[i].setText('$' + columnNames[i]);
+      } else {
+        oldValues[i].setText(data[i]);
+      }
+      oldValues[i].addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          updateQuery();
+        }
+      });
+      primaryKeys[i] = new Button(container, SWT.CHECK);
+      //   primaryKeys[i].setText("Where");
+      primaryKeys[i].addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+        public void widgetSelected(SelectionEvent e) {
+          updateQuery();
+        }
+      });
+      newValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
+
+      if (data[i] == null || data[i].equals("")) {
+        newValues[i].setText('$' + columnNames[i]);
+      } else {
+        newValues[i].setText(data[i]);
+      }
+      newValues[i].addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          updateQuery();
+        }
+      });
+      setValues[i] = new Button(container, SWT.CHECK);
+      //  setValues[i].setText("Set Value");
+      setValues[i].addSelectionListener(new SelectionListener() {
+        public void widgetDefaultSelected(SelectionEvent e) {
+        }
+        public void widgetSelected(SelectionEvent e) {
+          updateQuery();
+        }
+      });
+    }
+    query = new Label(container, SWT.WRAP);
+    GridData gridData = new GridData();
+    gridData.horizontalSpan = layoutColumns;
+    gridData.horizontalAlignment = GridData.FILL;
+    gridData.verticalAlignment = GridData.FILL;
+    gridData.grabExcessHorizontalSpace = true;
+    gridData.grabExcessVerticalSpace = true;
+    query.setLayoutData(gridData);
+
+    setControl(container);
+    updateQuery();
+
+    setPageComplete(true);
+  }
+  
+  public void updateQuery() {
+    if (DEBUG) {
+      System.out.println("Updating update query");
+    }
+
+    StringBuffer setClause = new StringBuffer();
+    StringBuffer whereClause = new StringBuffer();
+    for (int i = 0; i < columnNames.length; i++) {
+      if (primaryKeys[i].getSelection()) {
+        whereClause.append(columnNames[i]);
+        whereClause.append(" = ");
+        whereClause.append("'" + oldValues[i].getText() + "'");
+        whereClause.append(", ");
+      }
+      if (setValues[i].getSelection()) {
+        setClause.append(columnNames[i]);
+        setClause.append(" = ");
+        setClause.append("'" + newValues[i].getText() + "'");
+        setClause.append(", ");
+      }
+    }
+    if (whereClause.length() > 1) {
+      whereClause.deleteCharAt(whereClause.length() - 1);
+      whereClause.deleteCharAt(whereClause.length() - 1);
+    }
+    if (setClause.length() > 1) {
+      setClause.deleteCharAt(setClause.length() - 1);
+      setClause.deleteCharAt(setClause.length() - 1);
+    }
+    String[] arguments = { row.getTable(), setClause.toString(), whereClause.toString()};
+    MessageFormat form = new MessageFormat(fStore.getString("phpeclipse.sql.update.template"));
+
+    String query = form.format(arguments);
+    //
+    //    String query = "$results = mysql_query(\"UPDATE " + row.getTable();
+    //    query += " SET " + setClause.toString();
+    //    query += " WHERE " + whereClause.toString() + "\");";
+    this.query.setText(query);
+  }
+  public boolean performFinish() {
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
+    return true;
+  }
+}
\ No newline at end of file