use of org.netxms.ui.eclipse.console.dialogs.SendSMSDialog in project netxms by netxms.
the class SendSMS method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
if (window == null)
return;
final SendSMSDialog dlg = new SendSMSDialog(window.getShell());
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().SendSMS_JobTitle + dlg.getPhoneNumber(), window.getActivePage().getActivePart(), Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.sendSMS(dlg.getPhoneNumber(), dlg.getMessage());
runInUIThread(new Runnable() {
@Override
public void run() {
final String message = Messages.get().SendSMS_DialogTextPrefix + dlg.getPhoneNumber() + Messages.get().SendSMS_DialogTextSuffix;
MessageDialogHelper.openInformation(window.getShell(), Messages.get().SendSMS_DialogTitle, message);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().SendSMS_SendError + dlg.getPhoneNumber();
}
}.start();
}
Aggregations