use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class PredefinedMap method addObjectToMap.
/**
* Add object to map
*/
private void addObjectToMap() {
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getSite().getShell(), null, null);
if (dlg.open() != Window.OK)
return;
addObjectsFromList(dlg.getSelectedObjects(), null);
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class ObjectSelector method selectionButtonHandler.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.widgets.AbstractSelector#selectionButtonHandler()
*/
@Override
protected void selectionButtonHandler() {
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getShell(), null, classFilter);
dlg.enableMultiSelection(false);
if (dlg.open() == Window.OK) {
AbstractObject[] objects = dlg.getSelectedObjects(objectClass);
if (objects.length > 0) {
objectId = objects[0].getObjectId();
setText(objects[0].getObjectName());
} else {
objectId = 0;
setText(emptySelectionName);
}
fireModifyListeners();
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class ApplyPolicy method run.
@Override
public void run(IAction action) {
final ObjectSelectionDialog dlg = new ObjectSelectionDialog(shell, null, ObjectSelectionDialog.createPolicySelectionFilter());
dlg.showFilterToolTip(false);
if (dlg.open() == Window.OK) {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob("Deploy agent policy", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
for (int i = 0; i < selectedObjects.size(); i++) {
for (int n = 0; n < dlg.getSelectedObjects().size(); n++) {
session.deployAgentPolicy(dlg.getSelectedObjects().get(n).getObjectId(), selectedObjects.get(i).getObjectId());
}
}
}
@Override
protected String getErrorMessage() {
return "Cannot deploy agent policy";
}
}.start();
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class BindObjectTo method run.
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
final ObjectSelectionDialog dlg = new ObjectSelectionDialog(shell, null, ObjectSelectionDialog.createContainerSelectionFilter());
dlg.showFilterToolTip(false);
if (dlg.open() == Window.OK) {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
final Long[] childIdList = objects.toArray(new Long[objects.size()]);
new ConsoleJob(Messages.get().BindObject_JobTitle, viewPart, Activator.PLUGIN_ID, null) {
@Override
protected String getErrorMessage() {
return Messages.get().BindObject_JobError;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
List<AbstractObject> objects = dlg.getSelectedObjects();
for (AbstractObject parent : objects) {
for (Long childId : childIdList) {
session.bindObject(parent.getObjectId(), childId);
}
}
}
}.start();
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class WorldMap method placeObject.
/**
* Place object on map at mouse position
*/
private void placeObject() {
final ObjectSelectionDialog dlg = new ObjectSelectionDialog(getSite().getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(true));
if (dlg.open() == Window.OK) {
final NXCObjectModificationData md = new NXCObjectModificationData(dlg.getSelectedObjects().get(0).getObjectId());
md.setGeolocation(map.getLocationAtPoint(map.getCurrentPoint()));
final NXCSession session = ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().WorldMap_JobTitle, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().WorldMap_JobError;
}
}.start();
}
}
Aggregations