use of de.janrufmonitor.fritzbox.firmware.exception.DeleteCallListException in project janrufmonitor by tbrandt77.
the class Delete method run.
public void run() {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(DisplayManager.getDefaultDisplay().getActiveShell());
try {
if (MessageDialog.openConfirm(new Shell(DisplayManager.getDefaultDisplay()), this.getI18nManager().getString(this.getNamespace(), "delete", "label", this.getLanguage()), this.getI18nManager().getString(this.getNamespace(), "delete", "description", this.getLanguage()))) {
IRunnableWithProgress r = new IRunnableWithProgress() {
public void run(IProgressMonitor progressMonitor) {
progressMonitor.beginTask(getI18nManager().getString(getNamespace(), "deleteprogress", "label", getLanguage()), IProgressMonitor.UNKNOWN);
progressMonitor.worked(1);
progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "loginprogress", "label", getLanguage()));
FirmwareManager fwm = FirmwareManager.getInstance();
try {
if (!fwm.isLoggedIn())
fwm.login();
progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "deleteprogress", "label", getLanguage()));
fwm.deleteCallList();
progressMonitor.setTaskName(getI18nManager().getString(getNamespace(), "finished", "label", getLanguage()));
} catch (IOException e) {
m_logger.warning(e.toString());
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "faileddelete", e));
} catch (FritzBoxLoginException e) {
m_logger.warning(e.toString());
} catch (DeleteCallListException e) {
m_logger.warning(e.toString());
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "faileddelete", e));
}
progressMonitor.done();
}
};
pmd.setBlockOnOpen(false);
pmd.run(true, false, r);
m_app.updateViews(true);
}
// ModalContext.run(r, true, pmd.getProgressMonitor(), DisplayManager.getDefaultDisplay());
} catch (InterruptedException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
} catch (InvocationTargetException e) {
m_logger.log(Level.SEVERE, e.getMessage(), e);
}
return;
}
use of de.janrufmonitor.fritzbox.firmware.exception.DeleteCallListException in project janrufmonitor by tbrandt77.
the class TR064FritzBoxFirmware method deleteCallList.
public void deleteCallList() throws DeleteCallListException, IOException {
if (!this.isInitialized())
throw new DeleteCallListException("Could not delete call list from FritzBox: FritzBox firmware not initialized.");
String u = "http://" + this.m_server + ":" + this.m_port + "/fon_num/foncalls_list.lua";
String body = "usejournal=on&clear=&callstab=all&sid=" + FritzBoxTR064Manager.getInstance().getSID(this.m_user, this.m_password, this.m_server, (this.m_useHttp ? FritzBoxTR064Manager.getInstance().getDefaultFritzBoxTR064Port() : FritzBoxTR064Manager.getInstance().getDefaultFritzBoxTR064SecurePort(this.m_server)), (this.m_useHttp ? "http" : "https"));
doHttpCall(u, "POST", body, new String[][] { { "Content-Length", Integer.toString(body.length()) } });
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Callist from FritzBox succuessfully deleted.");
}
Aggregations