/** * Constructor. * * @param c the OpenOffice component context */ public SettingsDialog(XComponentContext c) { super(c, Constants.SETTINGS_DIALOG); LoginData loginData = new LoginData(); XWikiExtension xWikiExtension = XWikiExtension.getInstance(); if (loginData.canAutoLogin()) { credentials = loginData.getCredentials(); ConnectionSettings set = xWikiExtension.getSettings(); set.setServerURL(credentials[0]); set.setPassword(credentials[1]); set.setPassword(credentials[2]); set.setWikiURL(credentials[3]); set.setXmlRpcURL(credentials[4]); try { getPropSet("txtServerURL").setPropertyValue("Text", credentials[0]); getPropSet("txtUsername").setPropertyValue("Text", credentials[1]); // TODO secure store for the password getPropSet("txtPassword").setPropertyValue("Text", credentials[2]); } catch (UnknownPropertyException e) { e.printStackTrace(); } catch (PropertyVetoException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (WrappedTargetException e) { e.printStackTrace(); } } String urlOkButton = xWikiExtension.getImagesDirUrl() + "/" + Constants.IMG_OK_BUTTON; String urlCancelButton = xWikiExtension.getImagesDirUrl() + "/" + Constants.IMG_CANCEL_BUTTON; String urlCustomButton = xWikiExtension.getImagesDirUrl() + "/" + Constants.IMG_CONN_SETTINGS; try { getPropSet("btnOK").setPropertyValue("ImageURL", urlOkButton); getPropSet("btnCancel").setPropertyValue("ImageURL", urlCancelButton); getPropSet("cmdCustom").setPropertyValue("ImageURL", urlCustomButton); } catch (UnknownPropertyException e) { e.printStackTrace(); } catch (PropertyVetoException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (WrappedTargetException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }