use of org.netxms.ui.eclipse.objecttools.dialogs.CreateNewToolDialog in project netxms by netxms.
the class ObjectToolsEditor method createTool.
/**
* Create new tool
*/
private void createTool() {
final CreateNewToolDialog dlg = new CreateNewToolDialog(getSite().getShell());
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().ObjectToolsEditor_JobNewId, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final long toolId = session.generateObjectToolId();
final ObjectToolDetails details = new ObjectToolDetails(toolId, dlg.getType(), dlg.getName());
session.modifyObjectTool(details);
runInUIThread(new Runnable() {
@Override
public void run() {
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, details);
dlg.open();
if (details.isModified())
saveObjectTool(details);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get(getDisplay()).ObjectToolsEditor_JobNewIdError;
}
}.start();
}
}
Aggregations