use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.
the class CreateDashboard 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().CreateDashboard_Dashboard);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateDashboard_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_DASHBOARD, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateDashboard_Error, dlg.getObjectName());
}
}.start();
}
use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.
the class CreateTemplateGroup 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().CreateTemplateGroup_TemplateGroup);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateTemplateGroup_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_TEMPLATEGROUP, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateTemplateGroup_JobError, dlg.getObjectName());
}
}.start();
}
use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.
the class CloneDashboard method run.
@Override
public void run(final IAction action) {
final long parentId = sourceObject.getParentIdList()[0];
final CreateObjectDialog dlg = new CreateObjectDialog(window.getShell(), Messages.get().CloneDashboard_Dashboard);
if (dlg.open() == Window.OK) {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CloneDashboard_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_DASHBOARD, dlg.getObjectName(), parentId);
final long newDashboardId = session.createObject(cd);
final NXCObjectModificationData md = new NXCObjectModificationData(newDashboardId);
md.setDashboardElements(sourceObject.getElements());
md.setColumnCount(sourceObject.getNumColumns());
md.setObjectFlags(sourceObject.getOptions());
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CloneDashboard_Error, dlg.getObjectName());
}
}.start();
}
}
use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.
the class CreateDashboardGroup 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(), "Create dashboard group");
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob("Create dashboard group", part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_DASHBOARDGROUP, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format("Cannot create dashboard group object %s", dlg.getObjectName());
}
}.start();
}
use of org.netxms.client.NXCObjectCreationData in project netxms by netxms.
the class CloneNetworkMap method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
if (source == null)
return;
final CreateObjectDialog dlg = new CreateObjectDialog(window.getShell(), Messages.get().CloneNetworkMap_NetworkMap);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateNetworkMap_JobName, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_NETWORKMAP, dlg.getObjectName(), source.getParentIdList()[0]);
NXCObjectModificationData md = new NXCObjectModificationData(0);
source.prepareCopy(cd, md);
long id = session.createObject(cd);
md.setObjectId(id);
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateNetworkMap_JobError, dlg.getObjectName());
}
}.start();
}
Aggregations