Search in sources :

Example 1 with SendSMSDialog

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();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NXCSession(org.netxms.client.NXCSession) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) SendSMSDialog(org.netxms.ui.eclipse.console.dialogs.SendSMSDialog)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NXCSession (org.netxms.client.NXCSession)1 SendSMSDialog (org.netxms.ui.eclipse.console.dialogs.SendSMSDialog)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1