Search in sources :

Example 1 with CreateSensorWizard

use of org.netxms.ui.eclipse.objectmanager.wizards.CreateSensorWizard in project netxms by netxms.

the class CreateSensor method run.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
@Override
public void run(IAction action) {
    // Create wizard - first page with overall information and communication type, second page with communication details
    final CreateSensorWizard creationWizard = new CreateSensorWizard(parentId);
    WizardDialog dlg = new WizardDialog(window.getShell(), creationWizard);
    if (dlg.open() != Window.OK)
        return;
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    new ConsoleJob("Create Sensor", part, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            session.createObject(creationWizard.getCreationData());
        }

        @Override
        protected String getErrorMessage() {
            return String.format("Create sensor %s", creationWizard.getCreationData().getName());
        }
    }.start();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CreateSensorWizard(org.netxms.ui.eclipse.objectmanager.wizards.CreateSensorWizard) NXCSession(org.netxms.client.NXCSession) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 NXCSession (org.netxms.client.NXCSession)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 CreateSensorWizard (org.netxms.ui.eclipse.objectmanager.wizards.CreateSensorWizard)1