From: khartlage Date: Wed, 5 Mar 2003 20:52:54 +0000 (+0000) Subject: added 2 new Preferencepages X-Git-Url: http://git.phpeclipse.com added 2 new Preferencepages --- diff --git a/archive/net.sourceforge.phpeclipse.sql/plugin.xml b/archive/net.sourceforge.phpeclipse.sql/plugin.xml index 797cd75..240a879 100644 --- a/archive/net.sourceforge.phpeclipse.sql/plugin.xml +++ b/archive/net.sourceforge.phpeclipse.sql/plugin.xml @@ -96,11 +96,22 @@ + + + + 0) { - query += " WHERE " + whereClause.toString() + "\");"; - } else { - query += "\");"; - } + + + 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(""); diff --git a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPInsertRowPage.java b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPInsertRowPage.java index 4f7f044..74aac22 100644 --- a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPInsertRowPage.java +++ b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPInsertRowPage.java @@ -1,9 +1,13 @@ package net.sourceforge.phpdt.sql.wizards; +import java.text.MessageFormat; + +import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin; 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.preference.IPreferenceStore; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -19,6 +23,8 @@ public class PHPInsertRowPage extends WizardPage implements SQLPage { String[] columnNames; Text[] values; Label query; + private IPreferenceStore fStore; + public PHPInsertRowPage(String pageName) { super(pageName); } @@ -31,6 +37,7 @@ public class PHPInsertRowPage extends WizardPage implements SQLPage { if (DEBUG) { System.out.println("page create control"); } + fStore = PHPEclipseSQLPlugin.getDefault().getPreferenceStore(); Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); @@ -115,10 +122,15 @@ public class PHPInsertRowPage extends WizardPage implements SQLPage { // 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 += ")\");"; + 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() { diff --git a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPSelectRowPage.java b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPSelectRowPage.java index 26cae8a..4bfa368 100644 --- a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPSelectRowPage.java +++ b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPSelectRowPage.java @@ -1,9 +1,13 @@ package net.sourceforge.phpdt.sql.wizards; +import java.text.MessageFormat; + +import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin; 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.preference.IPreferenceStore; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -25,6 +29,7 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage { Button[] primaryKeys; Button[] setValues; Label query; + IPreferenceStore fStore; public PHPSelectRowPage(String pageName) { super(pageName); @@ -39,6 +44,8 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage { System.out.println("page create control"); } Composite container = new Composite(parent, SWT.NULL); + fStore = PHPEclipseSQLPlugin.getDefault().getPreferenceStore(); + GridLayout layout = new GridLayout(); container.setLayout(layout); int layoutColumns = 4; @@ -174,9 +181,14 @@ public class PHPSelectRowPage extends WizardPage implements SQLPage { setClause.deleteCharAt(setClause.length() - 1); setClause.deleteCharAt(setClause.length() - 1); } - String query = "$results = mysql_query(\"SELECT " + setClause.toString(); - query += " FROM " + row.getTable(); - query += " WHERE " + whereClause.toString() + "\");"; + + 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); } diff --git a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPUpdateRowPage.java b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPUpdateRowPage.java index 3f62d19..fdb15ec 100644 --- a/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPUpdateRowPage.java +++ b/archive/net.sourceforge.phpeclipse.sql/src/net/sourceforge/phpdt/sql/wizards/PHPUpdateRowPage.java @@ -1,9 +1,13 @@ package net.sourceforge.phpdt.sql.wizards; +import java.text.MessageFormat; + +import net.sourceforge.phpdt.sql.PHPEclipseSQLPlugin; 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.preference.IPreferenceStore; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -25,6 +29,8 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage { Button[] primaryKeys; Button[] setValues; Label query; + IPreferenceStore fStore; + public PHPUpdateRowPage(String pageName) { super(pageName); } @@ -37,6 +43,7 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage { if (DEBUG) { System.out.println("page create control"); } + fStore = PHPEclipseSQLPlugin.getDefault().getPreferenceStore(); Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); @@ -164,9 +171,14 @@ public class PHPUpdateRowPage extends WizardPage implements SQLPage { setClause.deleteCharAt(setClause.length() - 1); setClause.deleteCharAt(setClause.length() - 1); } - String query = "$results = mysql_query(\"UPDATE " + row.getTable(); - query += " SET " + setClause.toString(); - query += " WHERE " + whereClause.toString() + "\");"; + String[] arguments = { setClause.toString(), row.getTable(), 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() {