added PHP code generators for UPDATE, INSERT, DELETE
authorkhartlage <khartlage>
Tue, 4 Mar 2003 20:39:07 +0000 (20:39 +0000)
committerkhartlage <khartlage>
Tue, 4 Mar 2003 20:39:07 +0000 (20:39 +0000)
archive/net.sourceforge.phpeclipse.sql/plugin.xml
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/PHPEclipseSQLPlugin.java
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/preferences/PreferencesPage.java
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPDeleteRowPage.java
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPInsertRowPage.java
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPSelectRowPage.java
archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPUpdateRowPage.java

index 23bdeca..797cd75 100644 (file)
@@ -99,7 +99,7 @@
             name="PHPEclipse SQL Editor"
             category="PHPSQL"
             class="net.sourceforge.phpdt.sql.preferences.PreferencesPage"
-            id="net.sourceforge.phpdt.sql.preferences">
+            id="net.sourceforge.phpdt.sql.preferences.PreferencesPage">
       </page>
    </extension>
 <!-- Menu for Bookmark View -->
index 8449c6f..ea9b4c2 100644 (file)
@@ -140,18 +140,18 @@ class PHPSQLSaveParticipant implements ISaveParticipant, IConstants {
   public void saving(ISaveContext context) throws CoreException {
     switch (context.getKind()) {
       case ISaveContext.FULL_SAVE :
-        PHPEclipseSQLPlugin quantumPluginInstance = PHPEclipseSQLPlugin.getDefault();
+        PHPEclipseSQLPlugin sqlPluginInstance = PHPEclipseSQLPlugin.getDefault();
         // save the plug in state 
         if (BookmarkContentProvider.getInstance().hasChanged()) {
           int saveNumber = context.getSaveNumber();
           String saveFileName = "save " + Integer.toString(saveNumber);
           File f =
-            quantumPluginInstance
+            sqlPluginInstance
               .getStateLocation()
               .append(saveFileName)
               .toFile();
           // if we fail to write, an exception is thrown and we do not update the path 
-          quantumPluginInstance.writeImportantState(f);
+          sqlPluginInstance.writeImportantState(f);
           context.map(new Path("save"), new Path(saveFileName));
           context.needSaveNumber();
         } else {
index c265deb..1173afd 100644 (file)
@@ -1,6 +1,5 @@
 package net.sourceforge.phpdt.sql.preferences;
 
-
 import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin;
 
 import org.eclipse.jface.preference.ColorFieldEditor;
@@ -26,315 +25,342 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
 import net.sourceforge.phpdt.sql.editors.ColorManager;
 import net.sourceforge.phpdt.sql.editors.SQLColorConstants;
 
-public class PreferencesPage extends PreferencePage
-       implements IWorkbenchPreferencePage {
-       FontDialog fontDialog;
-       ColorFieldEditor backgroundColorEditor;
-       
-       ColorFieldEditor textColorEditor;
-       boolean textFlag;
-       ColorFieldEditor keywordColorEditor;
-       boolean keywordFlag;
-       ColorFieldEditor stringColorEditor;
-       boolean stringFlag;
-       ColorFieldEditor numericColorEditor;
-       boolean numericFlag;
-       ColorFieldEditor commentColorEditor;
-       boolean commentFlag;
-       
-       Button boldText;
-       Button boldKeyword;
-       Button boldString;
-       Button boldNumeric;
-       Button boldComment;
-       
-       IWorkbench workbench;
-       FontData fontData;
-       Label fontDisplay;
-       public void init(IWorkbench workbench) {
-               //Initialize the preference store
-               this.workbench = workbench;
-               setPreferenceStore(PHPEclipseSQLPlugin.getDefault().getPreferenceStore());
-               initializeColorDefaults(getPreferenceStore());
-       }
-
-       private void initializeColorDefaults(IPreferenceStore store) {
-               RGB BACKGROUND = new RGB(255, 255, 255);
-               RGB COMMENT = new RGB(88, 148, 64);
-               RGB IDENTIFIER = new RGB(0, 0, 0);
-               RGB KEYWORD = new RGB(126, 0, 75);
-               RGB STRING = new RGB(0, 0, 255);
-               RGB NUMERIC = new RGB(255, 0, 0);
-               RGB DEFAULT = new RGB(0, 0, 0);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.background.color", BACKGROUND);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.text.color", DEFAULT);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.keyword.color", KEYWORD);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.comment.color", COMMENT);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.string.color", STRING);
-               PreferenceConverter.setDefault(store,
-                       "phpeclipse.sql.numeric.color", NUMERIC);
-       }
-
-       protected void performDefaults() {
-               fontData = null;
-               updateFontDisplay();
-               textFlag = false;
-               keywordFlag = true;
-               stringFlag = false;
-               numericFlag = false;
-               commentFlag = false;
-               updateFlags();
-               backgroundColorEditor.loadDefault();
-               textColorEditor.loadDefault();
-               keywordColorEditor.loadDefault();
-               stringColorEditor.loadDefault();
-               commentColorEditor.loadDefault();
-               numericColorEditor.loadDefault();
-       }
-       /** 
-        * Save the preferences to the preference store.
-        */
-       public boolean performOk() {
-               PreferenceConverter.setValue(getPreferenceStore(), "phpeclipse.sql.font", fontData);
-               getPreferenceStore().setValue("phpeclipse.sql.text.bold", textFlag);
-               getPreferenceStore().setValue("phpeclipse.sql.keyword.bold", keywordFlag);
-               getPreferenceStore().setValue("phpeclipse.sql.string.bold", stringFlag);
-               getPreferenceStore().setValue("phpeclipse.sql.comment.bold", commentFlag);
-               getPreferenceStore().setValue("phpeclipse.sql.numeric.bold", numericFlag);
-               backgroundColorEditor.store();
-               textColorEditor.store();
-               keywordColorEditor.store();
-               stringColorEditor.store();
-               commentColorEditor.store();
-               numericColorEditor.store();
-               return super.performOk();
-       }
-       protected Control createContents(Composite parent) {
-               Composite main = new Composite(parent, SWT.NULL);
-               
-               GridLayout innerLayout = new GridLayout();
-               innerLayout.numColumns = 4;
-               main.setLayout(innerLayout);
-
-               fontData = PreferenceConverter.getFontData(getPreferenceStore(), "phpeclipse.sql.font");
-               textFlag = getPreferenceStore().getBoolean("phpeclipse.sql.text.bold");
-               keywordFlag = getPreferenceStore().getBoolean("phpeclipse.sql.keyword.bold");
-               stringFlag = getPreferenceStore().getBoolean("phpeclipse.sql.string.bold");
-               commentFlag = getPreferenceStore().getBoolean("phpeclipse.sql.comment.bold");
-               numericFlag = getPreferenceStore().getBoolean("phpeclipse.sql.numeric.bold");
-               
-               fontDialog = new FontDialog(workbench.getActiveWorkbenchWindow().getShell());
-               Button fontButton = new Button(main, SWT.PUSH);
-               fontButton.setText("Pick Font");
-               fontButton.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               if (fontData != null) {
-                                       fontDialog.setFontData(fontData);
-                               }
-                               FontData data = fontDialog.open();
-                               if (data != null) {
-                                       fontData = data;
-                                       updateFontDisplay();
-                               }
-                       }
-               });
-               Button defaultButton = new Button(main, SWT.PUSH);
-               defaultButton.setText("Default Font");
-               defaultButton.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               fontData = null;
-                               updateFontDisplay();
-                       }
-               });
-
-               fontDisplay = new Label(main, SWT.NULL);
-               GridData data = new GridData(GridData.FILL_HORIZONTAL);
-               data.grabExcessHorizontalSpace = true;
-               fontDisplay.setLayoutData(data);
-               updateFontDisplay();
-
-               ColorManager manager = new ColorManager();
-
-               Composite comp = new Composite(main, SWT.NULL);
-               GridData layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-               
-               Color defaultColor = manager.getColor(SQLColorConstants.DEFAULT);
-               backgroundColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.background.color",
-                               "Background Color",
-                               comp);                          
-
-               Composite temp = new Composite(main, SWT.NULL);
-               temp.setSize(0, 0);
-               
-               comp = new Composite(main, SWT.NULL);
-               layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-               
-               textColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.text.color",
-                               "Default Text Color",
-                               comp);                          
-
-               boldText = new Button(main, SWT.CHECK);
-               boldText.setSelection(textFlag);
-               boldText.setText("Bold");
-               boldText.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               textFlag = boldText.getSelection();
-                       }
-               });
-
-               comp = new Composite(main, SWT.NULL);
-               layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-
-               keywordColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.keyword.color",
-                               "Keyword Text Color",
-                               comp);
-
-               boldKeyword = new Button(main, SWT.CHECK);
-               boldKeyword.setSelection(keywordFlag);
-               boldKeyword.setText("Bold");
-               boldKeyword.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               keywordFlag = boldKeyword.getSelection();
-                       }
-               });
-
-               comp = new Composite(main, SWT.NULL);
-               layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-
-               commentColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.comment.color",
-                               "Comment Text Color",
-                               comp);
-
-               boldComment = new Button(main, SWT.CHECK);
-               boldComment.setSelection(commentFlag);
-               boldComment.setText("Bold");
-               boldComment.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               commentFlag = boldComment.getSelection();
-                       }
-               });
-
-               comp = new Composite(main, SWT.NULL);
-               layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-
-               stringColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.string.color",
-                               "String Text Color",
-                               comp);
-
-               boldString = new Button(main, SWT.CHECK);
-               boldString.setSelection(stringFlag);
-               boldString.setText("Bold");
-               boldString.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               stringFlag = boldString.getSelection();
-                       }
-               });
-
-               comp = new Composite(main, SWT.NULL);
-               layoutData = new GridData();
-               layoutData.horizontalSpan = 2;
-               comp.setLayoutData(layoutData);
-
-               numericColorEditor =
-                       new ColorFieldEditor(
-                               "phpeclipse.sql.numeric.color",
-                               "Numeric Text Color",
-                               comp);
-
-               boldNumeric = new Button(main, SWT.CHECK);
-               boldNumeric.setSelection(numericFlag);
-               boldNumeric.setText("Bold");
-               boldNumeric.addSelectionListener(new SelectionListener() {
-                       public void widgetDefaultSelected(SelectionEvent e) {
-                       }
-                       public void widgetSelected(SelectionEvent e) {
-                               numericFlag = boldNumeric.getSelection();
-                       }
-               });
-
-               backgroundColorEditor.setPreferencePage(this);
-               backgroundColorEditor.setPreferenceStore(getPreferenceStore());
-               backgroundColorEditor.load();
-               
-               textColorEditor.setPreferencePage(this);
-               textColorEditor.setPreferenceStore(getPreferenceStore());
-               textColorEditor.load();
-               
-               keywordColorEditor.setPreferencePage(this);
-               keywordColorEditor.setPreferenceStore(getPreferenceStore());
-               keywordColorEditor.load();
-               
-               commentColorEditor.setPreferencePage(this);
-               commentColorEditor.setPreferenceStore(getPreferenceStore());
-               commentColorEditor.load();
-               
-               stringColorEditor.setPreferencePage(this);
-               stringColorEditor.setPreferenceStore(getPreferenceStore());
-               stringColorEditor.load();
-
-               numericColorEditor.setPreferencePage(this);
-               numericColorEditor.setPreferenceStore(getPreferenceStore());
-               numericColorEditor.load();
-
-               return main;
-       }
-       public void updateFontDisplay() {
-               if (fontData == null) {
-                       fontDisplay.setText("Font: default");
-               } else {
-                       String style = "regular";
-                       if (fontData.getStyle() == SWT.BOLD) {
-                               style = "bold";
-                       } else if (fontData.getStyle() == SWT.ITALIC) {
-                               style = "italic";
-                       } else if (fontData.getStyle() == (SWT.BOLD | SWT.ITALIC)) {
-                               style = "bold italic";
-                       }
-                       fontDisplay.setText("Font: " + fontData.getName() + '-' + style + '-' + fontData.getHeight());
-               }
-       }
-       public void updateFlags() {
-               boldText.setSelection(textFlag);
-               boldKeyword.setSelection(keywordFlag);
-               boldString.setSelection(stringFlag);
-               boldNumeric.setSelection(numericFlag);
-               boldComment.setSelection(commentFlag);
-       }
+public class PreferencesPage
+  extends PreferencePage
+  implements IWorkbenchPreferencePage {
+  FontDialog fontDialog;
+  ColorFieldEditor backgroundColorEditor;
+
+  ColorFieldEditor textColorEditor;
+  boolean textFlag;
+  ColorFieldEditor keywordColorEditor;
+  boolean keywordFlag;
+  ColorFieldEditor stringColorEditor;
+  boolean stringFlag;
+  ColorFieldEditor numericColorEditor;
+  boolean numericFlag;
+  ColorFieldEditor commentColorEditor;
+  boolean commentFlag;
+
+  Button boldText;
+  Button boldKeyword;
+  Button boldString;
+  Button boldNumeric;
+  Button boldComment;
+
+  IWorkbench workbench;
+  FontData fontData;
+  Label fontDisplay;
+  public void init(IWorkbench workbench) {
+    //Initialize the preference store
+    this.workbench = workbench;
+    setPreferenceStore(PHPEclipseSQLPlugin.getDefault().getPreferenceStore());
+    initializeColorDefaults(getPreferenceStore());
+  }
+
+  private void initializeColorDefaults(IPreferenceStore store) {
+    RGB BACKGROUND = new RGB(255, 255, 255);
+    RGB COMMENT = new RGB(88, 148, 64);
+    RGB IDENTIFIER = new RGB(0, 0, 0);
+    RGB KEYWORD = new RGB(126, 0, 75);
+    RGB STRING = new RGB(0, 0, 255);
+    RGB NUMERIC = new RGB(255, 0, 0);
+    RGB DEFAULT = new RGB(0, 0, 0);
+    PreferenceConverter.setDefault(
+      store,
+      "phpeclipse.sql.background.color",
+      BACKGROUND);
+    PreferenceConverter.setDefault(store, "phpeclipse.sql.text.color", DEFAULT);
+    PreferenceConverter.setDefault(
+      store,
+      "phpeclipse.sql.keyword.color",
+      KEYWORD);
+    PreferenceConverter.setDefault(
+      store,
+      "phpeclipse.sql.comment.color",
+      COMMENT);
+    PreferenceConverter.setDefault(
+      store,
+      "phpeclipse.sql.string.color",
+      STRING);
+    PreferenceConverter.setDefault(
+      store,
+      "phpeclipse.sql.numeric.color",
+      NUMERIC);
+  }
+
+  protected void performDefaults() {
+    fontData = null;
+    updateFontDisplay();
+    textFlag = false;
+    keywordFlag = true;
+    stringFlag = false;
+    numericFlag = false;
+    commentFlag = false;
+    updateFlags();
+    backgroundColorEditor.loadDefault();
+    textColorEditor.loadDefault();
+    keywordColorEditor.loadDefault();
+    stringColorEditor.loadDefault();
+    commentColorEditor.loadDefault();
+    numericColorEditor.loadDefault();
+  }
+  /** 
+   * Save the preferences to the preference store.
+   */
+  public boolean performOk() {
+    PreferenceConverter.setValue(
+      getPreferenceStore(),
+      "phpeclipse.sql.font",
+      fontData);
+    getPreferenceStore().setValue("phpeclipse.sql.text.bold", textFlag);
+    getPreferenceStore().setValue("phpeclipse.sql.keyword.bold", keywordFlag);
+    getPreferenceStore().setValue("phpeclipse.sql.string.bold", stringFlag);
+    getPreferenceStore().setValue("phpeclipse.sql.comment.bold", commentFlag);
+    getPreferenceStore().setValue("phpeclipse.sql.numeric.bold", numericFlag);
+    backgroundColorEditor.store();
+    textColorEditor.store();
+    keywordColorEditor.store();
+    stringColorEditor.store();
+    commentColorEditor.store();
+    numericColorEditor.store();
+    return super.performOk();
+  }
+  
+  protected Control createContents(Composite parent) {
+    Composite composite = new Composite(parent, SWT.NULL);
+
+    GridLayout innerLayout = new GridLayout();
+    innerLayout.numColumns = 4;
+    composite.setLayout(innerLayout);
+
+    fontData =
+      PreferenceConverter.getFontData(
+        getPreferenceStore(),
+        "phpeclipse.sql.font");
+    textFlag = getPreferenceStore().getBoolean("phpeclipse.sql.text.bold");
+    keywordFlag =
+      getPreferenceStore().getBoolean("phpeclipse.sql.keyword.bold");
+    stringFlag = getPreferenceStore().getBoolean("phpeclipse.sql.string.bold");
+    commentFlag =
+      getPreferenceStore().getBoolean("phpeclipse.sql.comment.bold");
+    numericFlag =
+      getPreferenceStore().getBoolean("phpeclipse.sql.numeric.bold");
+
+    fontDialog =
+      new FontDialog(workbench.getActiveWorkbenchWindow().getShell());
+    Button fontButton = new Button(composite, SWT.PUSH);
+    fontButton.setText("Pick Font");
+    fontButton.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        if (fontData != null) {
+          fontDialog.setFontData(fontData);
+        }
+        FontData data = fontDialog.open();
+        if (data != null) {
+          fontData = data;
+          updateFontDisplay();
+        }
+      }
+    });
+    Button defaultButton = new Button(composite, SWT.PUSH);
+    defaultButton.setText("Default Font");
+    defaultButton.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        fontData = null;
+        updateFontDisplay();
+      }
+    });
+
+    fontDisplay = new Label(composite, SWT.NULL);
+    GridData data = new GridData(GridData.FILL_HORIZONTAL);
+    data.grabExcessHorizontalSpace = true;
+    fontDisplay.setLayoutData(data);
+    updateFontDisplay();
+
+    ColorManager manager = new ColorManager();
+
+    Composite comp = new Composite(composite, SWT.NULL);
+    GridData layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    Color defaultColor = manager.getColor(SQLColorConstants.DEFAULT);
+    backgroundColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.background.color",
+        "Background Color",
+        comp);
+
+    Composite temp = new Composite(composite, SWT.NULL);
+    temp.setSize(0, 0);
+
+    comp = new Composite(composite, SWT.NULL);
+    layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    textColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.text.color",
+        "Default Text Color",
+        comp);
+
+    boldText = new Button(composite, SWT.CHECK);
+    boldText.setSelection(textFlag);
+    boldText.setText("Bold");
+    boldText.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        textFlag = boldText.getSelection();
+      }
+    });
+
+    comp = new Composite(composite, SWT.NULL);
+    layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    keywordColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.keyword.color",
+        "Keyword Text Color",
+        comp);
+
+    boldKeyword = new Button(composite, SWT.CHECK);
+    boldKeyword.setSelection(keywordFlag);
+    boldKeyword.setText("Bold");
+    boldKeyword.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        keywordFlag = boldKeyword.getSelection();
+      }
+    });
+
+    comp = new Composite(composite, SWT.NULL);
+    layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    commentColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.comment.color",
+        "Comment Text Color",
+        comp);
+
+    boldComment = new Button(composite, SWT.CHECK);
+    boldComment.setSelection(commentFlag);
+    boldComment.setText("Bold");
+    boldComment.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        commentFlag = boldComment.getSelection();
+      }
+    });
+
+    comp = new Composite(composite, SWT.NULL);
+    layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    stringColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.string.color",
+        "String Text Color",
+        comp);
+
+    boldString = new Button(composite, SWT.CHECK);
+    boldString.setSelection(stringFlag);
+    boldString.setText("Bold");
+    boldString.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        stringFlag = boldString.getSelection();
+      }
+    });
+
+    comp = new Composite(composite, SWT.NULL);
+    layoutData = new GridData();
+    layoutData.horizontalSpan = 2;
+    comp.setLayoutData(layoutData);
+
+    numericColorEditor =
+      new ColorFieldEditor(
+        "phpeclipse.sql.numeric.color",
+        "Numeric Text Color",
+        comp);
+
+    boldNumeric = new Button(composite, SWT.CHECK);
+    boldNumeric.setSelection(numericFlag);
+    boldNumeric.setText("Bold");
+    boldNumeric.addSelectionListener(new SelectionListener() {
+      public void widgetDefaultSelected(SelectionEvent e) {
+      }
+      public void widgetSelected(SelectionEvent e) {
+        numericFlag = boldNumeric.getSelection();
+      }
+    });
+
+    backgroundColorEditor.setPreferencePage(this);
+    backgroundColorEditor.setPreferenceStore(getPreferenceStore());
+    backgroundColorEditor.load();
+
+    textColorEditor.setPreferencePage(this);
+    textColorEditor.setPreferenceStore(getPreferenceStore());
+    textColorEditor.load();
+
+    keywordColorEditor.setPreferencePage(this);
+    keywordColorEditor.setPreferenceStore(getPreferenceStore());
+    keywordColorEditor.load();
+
+    commentColorEditor.setPreferencePage(this);
+    commentColorEditor.setPreferenceStore(getPreferenceStore());
+    commentColorEditor.load();
+
+    stringColorEditor.setPreferencePage(this);
+    stringColorEditor.setPreferenceStore(getPreferenceStore());
+    stringColorEditor.load();
+
+    numericColorEditor.setPreferencePage(this);
+    numericColorEditor.setPreferenceStore(getPreferenceStore());
+    numericColorEditor.load();
+
+    return composite;
+  }
+  public void updateFontDisplay() {
+    if (fontData == null) {
+      fontDisplay.setText("Font: default");
+    } else {
+      String style = "regular";
+      if (fontData.getStyle() == SWT.BOLD) {
+        style = "bold";
+      } else if (fontData.getStyle() == SWT.ITALIC) {
+        style = "italic";
+      } else if (fontData.getStyle() == (SWT.BOLD | SWT.ITALIC)) {
+        style = "bold italic";
+      }
+      fontDisplay.setText(
+        "Font: "
+          + fontData.getName()
+          + '-'
+          + style
+          + '-'
+          + fontData.getHeight());
+    }
+  }
+  public void updateFlags() {
+    boldText.setSelection(textFlag);
+    boldKeyword.setSelection(keywordFlag);
+    boldString.setSelection(stringFlag);
+    boldNumeric.setSelection(numericFlag);
+    boldComment.setSelection(commentFlag);
+  }
 }
index 0815049..fb50a4a 100644 (file)
@@ -1,5 +1,9 @@
 package net.sourceforge.phpdt.sql.wizards;
 
+import net.sourceforge.phpdt.sql.sql.TableRow;
+import net.sourceforge.phpdt.sql.view.PHPSourceConsole;
+import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
+
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -13,10 +17,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
-import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
-import net.sourceforge.phpdt.sql.sql.TableRow;
-import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
-
 public class PHPDeleteRowPage extends WizardPage implements SQLPage {
   TableRow row;
   String[] columnNames;
@@ -77,7 +77,12 @@ public class PHPDeleteRowPage extends WizardPage implements SQLPage {
       GridData fullHorizontal = new GridData();
       fullHorizontal.horizontalAlignment = GridData.FILL;
       values[i].setLayoutData(fullHorizontal);
-      values[i].setText(data[i]);
+
+      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) {
@@ -111,38 +116,49 @@ public class PHPDeleteRowPage extends WizardPage implements SQLPage {
   }
   public void updateQuery() {
     if (DEBUG) {
-      System.out.println("Updating query");
+      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());
-        whereClause.append(", ");
+        whereClause.append("'" + values[i].getText() + "'");
+
+        first = true;
       }
     }
-    if (whereClause.length() > 1) {
-      whereClause.deleteCharAt(whereClause.length() - 1);
-      whereClause.deleteCharAt(whereClause.length() - 1);
-    }
-    String query = "DELETE FROM " + row.getTable();
+    //    if (whereClause.length() > 1) {
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //      whereClause.deleteCharAt(whereClause.length() - 1);
+    //    }
+    String query = "$results = mysql_query(\"DELETE FROM " + row.getTable();
     if (numSelected > 0) {
-      query += " WHERE " + whereClause.toString();
+      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() {
-    MultiSQLServer server = MultiSQLServer.getInstance();
-    server.execute(query.getText());
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
     return true;
   }
 }
\ No newline at end of file
index cfceda7..4f7f044 100644 (file)
@@ -1,5 +1,9 @@
 package net.sourceforge.phpdt.sql.wizards;
 
+import net.sourceforge.phpdt.sql.sql.TableRow;
+import net.sourceforge.phpdt.sql.view.PHPSourceConsole;
+import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
+
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -10,10 +14,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
-import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
-import net.sourceforge.phpdt.sql.sql.TableRow;
-import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
-
 public class PHPInsertRowPage extends WizardPage implements SQLPage {
   TableRow row;
   String[] columnNames;
@@ -92,25 +92,39 @@ public class PHPInsertRowPage extends WizardPage implements SQLPage {
   }
   public void updateQuery() {
     if (DEBUG) {
-      System.out.println("Updating query");
+      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++) {
-      valuesClause.append(values[i].getText());
-      valuesClause.append(", ");
-    }
-    if (valuesClause.length() > 1) {
-      valuesClause.deleteCharAt(valuesClause.length() - 1);
-      valuesClause.deleteCharAt(valuesClause.length() - 1);
+      text = values[i].getText();
+      if (! text.equals("")) {
+        if (first) {
+          valuesClause.append(", ");
+          fieldClause.append(", ");
+        }
+        valuesClause.append("'"+values[i].getText()+"'");
+        fieldClause.append(columnNames[i]);
+        first = true;
+      }
     }
-    String query = "INSERT INTO " + row.getTable();
+//    if (valuesClause.length() > 1) {
+//      valuesClause.deleteCharAt(valuesClause.length() - 1);
+//      valuesClause.deleteCharAt(valuesClause.length() - 1);
+//    }
+    String query = "$results = mysql_query(\"INSERT INTO " + row.getTable() + " (";
+    query += fieldClause.toString() + ") ";
     query += " VALUES (" + valuesClause.toString();
-    query += " )";
+    query += ")\");";
     this.query.setText(query);
   }
   public boolean performFinish() {
-    MultiSQLServer server = MultiSQLServer.getInstance();
-    server.execute(query.getText());
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
     return true;
   }
 }
\ No newline at end of file
index beef6fb..26cae8a 100644 (file)
@@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.Text;
 public class PHPSelectRowPage extends WizardPage implements SQLPage {
   TableRow row;
   String[] columnNames;
-  Text[] oldValues;
+  Text[] whereValues;
   // Text[] newValues;
   Button[] primaryKeys;
   Button[] setValues;
@@ -57,43 +57,45 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage {
     }
     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()];
+    
+    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("Old Value");
+    temp.setText("Value");
     temp = new Label(container, SWT.NULL);
-    temp.setText("");
+    temp.setText("Where");
     //    temp = new Label(container, SWT.NULL);
     //    temp.setText("New Value");
     temp = new Label(container, SWT.NULL);
-    temp.setText("");
+    temp.setText("Select");
     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);
+      whereValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
       if (data[i] == null || data[i].equals("")) {
-        oldValues[i].setText('$' + columnNames[i]);
+        whereValues[i].setText('$' + columnNames[i]);
       } else {
-        oldValues[i].setText(data[i]);
+        whereValues[i].setText(data[i]);
       }
-      oldValues[i].addModifyListener(new ModifyListener() {
+      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].setText("Where Clause");
       primaryKeys[i].addSelectionListener(new SelectionListener() {
         public void widgetDefaultSelected(SelectionEvent e) {
         }
@@ -109,7 +111,7 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage {
       //    }
       //  });
       setValues[i] = new Button(container, SWT.CHECK);
-      setValues[i].setText("Select Value");
+      //setValues[i].setText("Select Value");
       setValues[i].addSelectionListener(new SelectionListener() {
         public void widgetDefaultSelected(SelectionEvent e) {
         }
@@ -149,7 +151,7 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage {
         firstClause = true;
         whereClause.append(columnNames[i]);
         whereClause.append(" = ");
-        temp = oldValues[i].getText();
+        temp = whereValues[i].getText();
         //        if (temp.charAt(0) == '$') {
         //          whereClause.append(temp);
         //        } else {
index 0c6690f..3f62d19 100644 (file)
@@ -1,5 +1,9 @@
 package net.sourceforge.phpdt.sql.wizards;
 
+import net.sourceforge.phpdt.sql.sql.TableRow;
+import net.sourceforge.phpdt.sql.view.PHPSourceConsole;
+import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
+
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -13,10 +17,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
-import net.sourceforge.phpdt.sql.sql.MultiSQLServer;
-import net.sourceforge.phpdt.sql.sql.TableRow;
-import net.sourceforge.phpdt.sql.view.tableview.TableAdapter;
-
 public class PHPUpdateRowPage extends WizardPage implements SQLPage {
   TableRow row;
   String[] columnNames;
@@ -70,25 +70,29 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage {
     Label temp = new Label(container, SWT.NULL);
     temp.setText("Column Name");
     temp = new Label(container, SWT.NULL);
-    temp.setText("Old Value");
+    temp.setText("Where Value");
     temp = new Label(container, SWT.NULL);
-    temp.setText("");
+    temp.setText("Where");
     temp = new Label(container, SWT.NULL);
-    temp.setText("New Value");
+    temp.setText("Set Value");
     temp = new Label(container, SWT.NULL);
-    temp.setText("");
+    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);
-      oldValues[i].setText(data[i]);
+      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("Primary Key");
+   //   primaryKeys[i].setText("Where");
       primaryKeys[i].addSelectionListener(new SelectionListener() {
         public void widgetDefaultSelected(SelectionEvent e) {
         }
@@ -97,14 +101,19 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage {
         }
       });
       newValues[i] = new Text(container, SWT.BORDER | SWT.SINGLE);
-      newValues[i].setText(data[i]);
+
+      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].setText("Set Value");
       setValues[i].addSelectionListener(new SelectionListener() {
         public void widgetDefaultSelected(SelectionEvent e) {
         }
@@ -129,7 +138,7 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage {
   }
   public void updateQuery() {
     if (DEBUG) {
-      System.out.println("Updating query");
+      System.out.println("Updating update query");
     }
     StringBuffer setClause = new StringBuffer();
     StringBuffer whereClause = new StringBuffer();
@@ -137,13 +146,13 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage {
       if (primaryKeys[i].getSelection()) {
         whereClause.append(columnNames[i]);
         whereClause.append(" = ");
-        whereClause.append(oldValues[i].getText());
+        whereClause.append("'"+oldValues[i].getText()+"'");
         whereClause.append(", ");
       }
       if (setValues[i].getSelection()) {
         setClause.append(columnNames[i]);
         setClause.append(" = ");
-        setClause.append(newValues[i].getText());
+        setClause.append("'"+newValues[i].getText()+"'");
         setClause.append(", ");
       }
     }
@@ -155,14 +164,15 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage {
       setClause.deleteCharAt(setClause.length() - 1);
       setClause.deleteCharAt(setClause.length() - 1);
     }
-    String query = "UPDATE " + row.getTable();
+    String query = "$results = mysql_query(\"UPDATE " + row.getTable();
     query += " SET " + setClause.toString();
-    query += " WHERE " + whereClause.toString();
+    query += " WHERE " + whereClause.toString() + "\");";
     this.query.setText(query);
   }
   public boolean performFinish() {
-    MultiSQLServer server = MultiSQLServer.getInstance();
-    server.execute(query.getText());
+    PHPSourceConsole console = PHPSourceConsole.getInstance();
+    console.clear();
+    console.print(query.getText());
     return true;
   }
 }
\ No newline at end of file