/**
* @author
*/
-public class PHPEclipseSQLPlugin extends AbstractUIPlugin {
+public class PHPEclipseSQLPlugin
+ extends AbstractUIPlugin
+ implements IConstants {
+
private static final String BUNDLE_NAME =
"net.sourceforge.phpdt.sql.PHPEclipseSQLResources";
private static final ResourceBundle RESOURCE_BUNDLE =
public void startup() throws CoreException {
super.startup();
- ISaveParticipant saveParticipant = new QuantumSaveParticipant();
+ ISaveParticipant saveParticipant = new PHPSQLSaveParticipant();
ISavedState lastState =
ResourcesPlugin.getWorkspace().addSaveParticipant(this, saveParticipant);
if (lastState == null)
IPreferenceStore store = getPreferenceStore();
PreferenceConverter.setDefault(
store,
- "quantum.background.color",
+ "phpeclipse.sql.background.color",
BACKGROUND);
- PreferenceConverter.setDefault(store, "quantum.text.color", DEFAULT);
- PreferenceConverter.setDefault(store, "quantum.keyword.color", KEYWORD);
- PreferenceConverter.setDefault(store, "quantum.comment.color", COMMENT);
- PreferenceConverter.setDefault(store, "quantum.string.color", STRING);
- PreferenceConverter.setDefault(store, "quantum.numeric.color", NUMERIC);
- getPreferenceStore().setDefault("quantum.text.bold", false);
- getPreferenceStore().setDefault("quantum.keyword.bold", true);
- getPreferenceStore().setDefault("quantum.string.bold", false);
- getPreferenceStore().setDefault("quantum.comment.bold", false);
- getPreferenceStore().setDefault("quantum.numeric.bold", false);
+ 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);
+ getPreferenceStore().setDefault("phpeclipse.sql.text.bold", false);
+ getPreferenceStore().setDefault("phpeclipse.sql.keyword.bold", true);
+ getPreferenceStore().setDefault("phpeclipse.sql.string.bold", false);
+ getPreferenceStore().setDefault("phpeclipse.sql.comment.bold", false);
+ getPreferenceStore().setDefault("phpeclipse.sql.numeric.bold", false);
+
+ 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/test");
+
+ getPreferenceStore().setDefault(
+ "phpeclipse.sql.driver.connect",
+ "com.mysql.jdbc.Driver");
+
+ getPreferenceStore().setDefault("phpeclipse.sql.type.connect", "MySQL");
+
+ getPreferenceStore().setDefault(
+ "phpeclipse.sql.filename.connect",
+ "C:\\apache\\mysql\\lib\\mysql-connector-java-2.0.14-bin.jar");
+
PreferenceConverter.setDefault(
getPreferenceStore(),
- "quantum.font",
+ "phpeclipse.sql.font",
(FontData) null);
}
}
-class QuantumSaveParticipant implements ISaveParticipant {
+class PHPSQLSaveParticipant implements ISaveParticipant, IConstants {
/**
* @see org.eclipse.core.resources.ISaveParticipant#doneSaving(ISaveContext)
*/
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
- .getStateLocation()
- .append(saveFileName)
- .toFile();
+ 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 {
- System.out.println("Not saving unchanged bookmarks");
+ if (DEBUG) {
+ System.out.println("Not saving unchanged bookmarks");
+ }
}
break;
case ISaveContext.PROJECT_SAVE :