// Add these plugins first, they will create menu items for the global menu
pm.createInstance(ErrorDialogPlugin.class, this);
// Try to connect to the server
// By default, use an anonymous login
ServerConnection connection = ServerConnection.getInstance();
connection.setLoginInfo(new ClientLoginInfo("Anonymous", null));
try
{
connection.connect(true);
}
catch (OpenBPException e)
{
// Show dialog box if the user has not chose to skip it before
if (! SettingUtil.getBooleanSetting("openbp.cockpit.connectionwarning.hide", false))
{
// Hide splash screen.
if (splashScreen != null)
{
splashScreen.setVisible(false);
}
int response = JMsgBox.show(null, getPluginResourceCollection().getRequiredString(
"connectionerror.title"), ResourceCollectionUtil.formatMsg(getPluginResourceCollection(),
"connectionerror.description", new Object[]
{
connection.getConnectionInfo().getRmiServerHost(),
new Integer(connection.getConnectionInfo().getRmiServerPort()), e.getMessage()
}), JMsgBox.ICON_INFO | JMsgBox.TYPE_OK | JMsgBox.DEFAULT_OK | JMsgBox.TYPE_DO_NOT_SHOW_AGAIN);
if ((response & JMsgBox.TYPE_DO_NOT_SHOW_AGAIN) != 0)
{
// Skip this dialog the next time