Lines 57-66
Link Here
|
57 |
import org.netbeans.modules.db.explorer.dlg.AddDriverDialog; |
57 |
import org.netbeans.modules.db.explorer.dlg.AddDriverDialog; |
58 |
import org.netbeans.api.db.explorer.JDBCDriver; |
58 |
import org.netbeans.api.db.explorer.JDBCDriver; |
59 |
import org.netbeans.api.db.explorer.JDBCDriverManager; |
59 |
import org.netbeans.api.db.explorer.JDBCDriverManager; |
|
|
60 |
import org.openide.util.Exceptions; |
60 |
|
61 |
|
61 |
public class AddDriverAction extends DatabaseAction { |
62 |
public class AddDriverAction extends DatabaseAction { |
62 |
static final long serialVersionUID =-109193000951395612L; |
63 |
static final long serialVersionUID =-109193000951395612L; |
63 |
|
64 |
|
|
|
65 |
@Override |
64 |
public void performAction(Node[] activatedNodes) { |
66 |
public void performAction(Node[] activatedNodes) { |
65 |
new AddDriverDialogDisplayer().showDialog(); |
67 |
new AddDriverDialogDisplayer().showDialog(); |
66 |
} |
68 |
} |
Lines 68-76
Link Here
|
68 |
public static final class AddDriverDialogDisplayer { |
70 |
public static final class AddDriverDialogDisplayer { |
69 |
|
71 |
|
70 |
private Dialog dialog; |
72 |
private Dialog dialog; |
71 |
private JDBCDriver driver; |
73 |
private JDBCDriver driver = null; |
72 |
|
74 |
|
73 |
public void showDialog() { |
75 |
public JDBCDriver showDialog() { |
74 |
final AddDriverDialog dlgPanel = new AddDriverDialog(); |
76 |
final AddDriverDialog dlgPanel = new AddDriverDialog(); |
75 |
|
77 |
|
76 |
ActionListener actionListener = new ActionListener() { |
78 |
ActionListener actionListener = new ActionListener() { |
Lines 90-96
Link Here
|
90 |
err.append(bundle().getString("AddDriverDialog_MissingClass")); //NOI18N |
92 |
err.append(bundle().getString("AddDriverDialog_MissingClass")); //NOI18N |
91 |
} |
93 |
} |
92 |
if (err.length() > 0) { |
94 |
if (err.length() > 0) { |
93 |
String message = MessageFormat.format(bundle().getString("AddDriverDialog_ErrorMessage"), new String[] {err.toString()}); //NOI18N |
95 |
String message = MessageFormat.format(bundle().getString("AddDriverDialog_ErrorMessage"), |
|
|
96 |
err.toString()); //NOI18N |
94 |
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.INFORMATION_MESSAGE)); |
97 |
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.INFORMATION_MESSAGE)); |
95 |
|
98 |
|
96 |
return; |
99 |
return; |
Lines 107-113
Link Here
|
107 |
driver = JDBCDriver.create(name, name, drvClass, (URL[]) drvLoc.toArray(new URL[drvLoc.size()])); |
110 |
driver = JDBCDriver.create(name, name, drvClass, (URL[]) drvLoc.toArray(new URL[drvLoc.size()])); |
108 |
JDBCDriverManager.getDefault().addDriver(driver); |
111 |
JDBCDriverManager.getDefault().addDriver(driver); |
109 |
} catch (DatabaseException exc) { |
112 |
} catch (DatabaseException exc) { |
110 |
//PENDING |
113 |
Exceptions.printStackTrace(exc); |
111 |
} |
114 |
} |
112 |
} |
115 |
} |
113 |
} |
116 |
} |
Lines 118-123
Link Here
|
118 |
descriptor.setClosingOptions(closingOptions); |
121 |
descriptor.setClosingOptions(closingOptions); |
119 |
dialog = DialogDisplayer.getDefault().createDialog(descriptor); |
122 |
dialog = DialogDisplayer.getDefault().createDialog(descriptor); |
120 |
dialog.setVisible(true); |
123 |
dialog.setVisible(true); |
|
|
124 |
return driver; |
121 |
} |
125 |
} |
122 |
} |
126 |
} |
123 |
} |
127 |
} |