use of org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog in project netxms by netxms.
the class CreateAgentPolicyLogParser 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(targetPart.getSite().getShell(), Messages.get().CreateAgentPolicyConfig_AgentPolicy_Config);
if (dlg.open() == Window.OK) {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateAgentPolicyConfig_JobName, targetPart, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_AGENTPOLICY_LOGPARSER, dlg.getObjectName(), currentObject.getObjectId());
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return Messages.get().CreateAgentPolicyConfig_JobError;
}
}.start();
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog in project netxms by netxms.
the class CreateCondition 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().CreateCondition_Condition);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateCondition_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_CONDITION, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateCondition_JobError, dlg.getObjectName());
}
}.start();
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog in project netxms by netxms.
the class CreateTemplate 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().CreateTemplate_Template);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateTemplate_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_TEMPLATE, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateTemplate_JobError, dlg.getObjectName());
}
}.start();
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog in project netxms by netxms.
the class CreateContainer 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().CreateContainer_Container);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateContainer_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_CONTAINER, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateContainer_JobError, dlg.getObjectName());
}
}.start();
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.CreateObjectDialog in project netxms by netxms.
the class ObjectToolsEditor method cloneTool.
/**
* Clone object tool
*/
private void cloneTool() {
final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.isEmpty())
return;
final CreateObjectDialog dlg = new CreateObjectDialog(getSite().getShell(), "Object tool");
if (dlg.open() == Window.OK) {
new ConsoleJob("Clone object tool", this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final long toolId = session.generateObjectToolId();
ObjectTool objTool = (ObjectTool) selection.toArray()[0];
ObjectToolDetails details = session.getObjectToolDetails(objTool.getId());
details.setId(toolId);
details.setName(dlg.getObjectName());
session.modifyObjectTool(details);
}
@Override
protected String getErrorMessage() {
return "Cannot clone object tool";
}
}.start();
}
}
Aggregations