X

Geertjan's Blog

  • February 7, 2008

Simple MySQL Integration into NetBeans IDE 6.0

Geertjan Wielenga
Product Manager
To celebrate the MySQL acquisition, here's some further integration (on top of that provided by 6.0, by default, by means of which you can register a MySQL connection, start/stop and even create MySQL databases). First, I followed the Options Window Module Tutorial and ended up with an extension to the Options window:

Then, as explained in the above tutorial, I passed on the file identified above and used it in a menu item's performAction:

Preferences pref = NbPreferences.forModule(MysqlPanel.class);
String app = pref.get("MySQLAdminLoc", "");
public void performAction() {
try {
NbProcessDescriptor desc = new NbProcessDescriptor(app, "");
Process process = desc.exec();
process.waitFor();
} catch (InterruptedException ex) {
JOptionPane.showMessageDialog(null, "Specify the location of " +
"the MySQL Admin console" +
" in the Options window!");
} catch (IOException ex) {
JOptionPane.showMessageDialog(null, "Specify the location of " +
"the MySQL Admin console" +
" in the Options window!");
}
}

This is how the menu item looks:

When selected, the MySQL Admin dialog opens:

It would be best if it did not open as a modal dialog, but I don't think I can do anything to change that.

Join the discussion

Comments ( 2 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.