Search in sources :

Example 1 with ChildObjectListDialog

use of org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog 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)

Example 2 with ChildObjectListDialog

use of org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog in project netxms by netxms.

the class RemoveClusterNode 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, clusterId, ChildObjectListDialog.createClassFilter(AbstractObject.OBJECT_NODE));
    dlg.open();
    if (dlg.getReturnCode() == Window.OK) {
        final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
        new ConsoleJob(Messages.get().RemoveClusterNode_JobTitle, viewPart, Activator.PLUGIN_ID, null) {

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

            @Override
            protected void runInternal(IProgressMonitor monitor) throws Exception {
                List<AbstractObject> objects = dlg.getSelectedObjects();
                for (int i = 0; i < objects.size(); i++) session.removeClusterNode(clusterId, objects.get(i).getObjectId());
            }
        }.start();
    }
}
Also used : 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)

Example 3 with ChildObjectListDialog

use of org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog in project netxms by netxms.

the class UnbindObject 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);
    dlg.open();
    if (dlg.getReturnCode() == Window.OK) {
        final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
        new ConsoleJob(Messages.get().UnbindObject_JobTitle, viewPart, Activator.PLUGIN_ID, null) {

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

            @Override
            protected void runInternal(IProgressMonitor monitor) throws Exception {
                List<AbstractObject> objects = dlg.getSelectedObjects();
                for (int i = 0; i < objects.size(); i++) session.unbindObject(parentId, objects.get(i).getObjectId());
            }
        }.start();
    }
}
Also used : 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)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 NXCSession (org.netxms.client.NXCSession)3 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)3 ChildObjectListDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.ChildObjectListDialog)3 DciRemoveConfirmationDialog (org.netxms.ui.eclipse.datacollection.dialogs.DciRemoveConfirmationDialog)1