Search in sources :

Example 1 with CreateChassisDialog

use of org.netxms.ui.eclipse.objectmanager.dialogs.CreateChassisDialog in project netxms by netxms.

the class CreateChassis method run.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
@Override
public void run(IAction action) {
    CreateChassisDialog dlg = null;
    do {
        dlg = new CreateChassisDialog(window.getShell(), dlg);
        if (dlg.open() != Window.OK)
            return;
        final NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_CHASSIS, dlg.getObjectName(), parentId);
        cd.setControllerId(dlg.getControllerId());
        final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
        new ConsoleJob("Creating chassis", part, Activator.PLUGIN_ID, null) {

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

            @Override
            protected String getErrorMessage() {
                return String.format("Cannot create chassis object %s", cd.getName());
            }
        }.start();
    } while (dlg.isShowAgain());
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NXCSession(org.netxms.client.NXCSession) CreateChassisDialog(org.netxms.ui.eclipse.objectmanager.dialogs.CreateChassisDialog) NXCObjectCreationData(org.netxms.client.NXCObjectCreationData) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NXCObjectCreationData (org.netxms.client.NXCObjectCreationData)1 NXCSession (org.netxms.client.NXCSession)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 CreateChassisDialog (org.netxms.ui.eclipse.objectmanager.dialogs.CreateChassisDialog)1