Search in sources :

Example 1 with DciRemoveConfirmationDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.DciRemoveConfirmationDialog in project netxms by netxms.

the class RemoveTemplate method run.

/* (non-Javadoc)
	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
	 */
public void run(IAction action) {
    final ChildObjectListDialog dlg = new ChildObjectListDialog(shell, parentId, null);
    if (dlg.open() == Window.OK) {
        final DciRemoveConfirmationDialog dlg2 = new DciRemoveConfirmationDialog(shell);
        if (dlg2.open() == Window.OK) {
            final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
            new ConsoleJob(Messages.get().RemoveTemplate_JobTitle, viewPart, Activator.PLUGIN_ID, null) {

                @Override
                protected String getErrorMessage() {
                    return Messages.get().RemoveTemplate_JobError;
                }

                @Override
                protected void runInternal(IProgressMonitor monitor) throws Exception {
                    List<AbstractObject> objects = dlg.getSelectedObjects();
                    for (int i = 0; i < objects.size(); i++) session.removeTemplate(parentId, objects.get(i).getObjectId(), dlg2.getRemoveFlag());
                }
            }.start();
        }
    }
}
Also used : DciRemoveConfirmationDialog(org.netxms.ui.eclipse.datacollection.dialogs.DciRemoveConfirmationDialog) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NXCSession(org.netxms.client.NXCSession) ChildObjectListDialog(org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog) List(java.util.List) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob)

Aggregations

List (java.util.List)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NXCSession (org.netxms.client.NXCSession)1 DciRemoveConfirmationDialog (org.netxms.ui.eclipse.datacollection.dialogs.DciRemoveConfirmationDialog)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 ChildObjectListDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog)1