Search in sources :

Example 1 with CreateServiceCheckDialog

use of org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog in project netxms by netxms.

the class CreateServiceCheckTemplate method run.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
@Override
public void run(IAction action) {
    final CreateServiceCheckDialog dlg = new CreateServiceCheckDialog(window.getShell());
    if (dlg.open() != Window.OK)
        return;
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    new ConsoleJob(Messages.get().CreateServiceCheckTemplate_JobTitle, part, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_SLMCHECK, dlg.getName(), parentId);
            cd.setTemplate(true);
            session.createObject(cd);
        }

        @Override
        protected String getErrorMessage() {
            return String.format(Messages.get().CreateServiceCheckTemplate_JobError, dlg.getName());
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CreateServiceCheckDialog(org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog) NXCSession(org.netxms.client.NXCSession) NXCObjectCreationData(org.netxms.client.NXCObjectCreationData) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob)

Example 2 with CreateServiceCheckDialog

use of org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog in project netxms by netxms.

the class CreateServiceCheck method run.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
@Override
public void run(IAction action) {
    final CreateServiceCheckDialog dlg = new CreateServiceCheckDialog(window.getShell());
    if (dlg.open() != Window.OK)
        return;
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    new ConsoleJob(Messages.get().CreateServiceCheck_JobTitle, part, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_SLMCHECK, dlg.getName(), parentId);
            cd.setTemplate(false);
            session.createObject(cd);
        }

        @Override
        protected String getErrorMessage() {
            return String.format(Messages.get().CreateServiceCheck_JobError, dlg.getName());
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CreateServiceCheckDialog(org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog) NXCSession(org.netxms.client.NXCSession) NXCObjectCreationData(org.netxms.client.NXCObjectCreationData) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NXCObjectCreationData (org.netxms.client.NXCObjectCreationData)2 NXCSession (org.netxms.client.NXCSession)2 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)2 CreateServiceCheckDialog (org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog)2