Search in sources :

Example 26 with NXCObjectCreationData

use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.

the class CreateMapGroup method run.

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

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

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

Example 27 with NXCObjectCreationData

use of org.netxms.client.NXCObjectCreationData 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)

Example 28 with NXCObjectCreationData

use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.

the class CreateNodeLink method run.

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

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

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

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)28 NXCObjectCreationData (org.netxms.client.NXCObjectCreationData)28 NXCSession (org.netxms.client.NXCSession)28 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)28 CreateObjectDialog (org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog)15 NXCObjectModificationData (org.netxms.client.NXCObjectModificationData)3 List (java.util.List)2 CreateNodeDialog (org.netxms.ui.eclipse.objectmanager.dialogs.CreateNodeDialog)2 CreateServiceCheckDialog (org.netxms.ui.eclipse.slm.dialogs.CreateServiceCheckDialog)2 ArrayList (java.util.ArrayList)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)1 TransformerException (javax.xml.transform.TransformerException)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Display (org.eclipse.swt.widgets.Display)1 AgentTunnel (org.netxms.client.AgentTunnel)1 DashboardElement (org.netxms.client.dashboards.DashboardElement)1 ImportDashboardDialog (org.netxms.ui.eclipse.dashboard.dialogs.ImportDashboardDialog)1 CreateNetworkMapDialog (org.netxms.ui.eclipse.networkmaps.dialogs.CreateNetworkMapDialog)1 CreateChassisDialog (org.netxms.ui.eclipse.objectmanager.dialogs.CreateChassisDialog)1