use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class EmbeddedDashboard method addDashboard.
/**
* Add dashboard to list
*/
protected void addDashboard() {
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getShell(), null, ObjectSelectionDialog.createDashboardSelectionFilter());
if (dlg.open() == Window.OK) {
dashboardObjects.addAll(Arrays.asList(dlg.getSelectedObjects(Dashboard.class)));
viewer.setInput(dashboardObjects.toArray());
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class MapLinkGeneral method addObject.
/**
* Add object to status source list
*/
private void addObject() {
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getShell(), null, null);
dlg.enableMultiSelection(false);
if (dlg.open() == Window.OK) {
AbstractObject[] objects = dlg.getSelectedObjects(AbstractObject.class);
if (objects.length > 0) {
for (AbstractObject obj : objects) {
object.addStatusObject(obj.getObjectId());
// $NON-NLS-1$ //$NON-NLS-2$
list.add((obj != null) ? obj.getObjectName() : ("<" + Long.toString(obj.getObjectId()) + ">"));
}
}
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class ShowIPRouteTo method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
if (node == null)
return;
ObjectSelectionDialog dlg = new ObjectSelectionDialog(window.getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
if (dlg.open() != Window.OK)
return;
AbstractObject[] selection = dlg.getSelectedObjects(Node.class);
if (selection.length == 0) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowIPRoute_Error, Messages.get().ShowIPRoute_InvalidTarget);
return;
}
try {
// $NON-NLS-1$
window.getActivePage().showView(IPRouteMap.ID, Long.toString(node.getObjectId()) + "&" + Long.toString(selection[0].getObjectId()), IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowIPRoute_Error, String.format(Messages.get().ShowIPRoute_ErrorOpenView, e.getLocalizedMessage()));
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class ObjectBrowser method moveObject.
/**
* Move selected objects to another container
*/
private void moveObject(SubtreeType subtree) {
if (!isValidSelectionForMove(subtree))
return;
List<Object> currentObject = new ArrayList<Object>();
List<Object> parentObject = new ArrayList<Object>();
TreeItem[] selection = objectTree.getTreeControl().getSelection();
for (int i = 0; i < selection.length; i++) {
currentObject.add(selection[i].getData());
parentObject.add(selection[i].getParentItem().getData());
}
Set<Integer> filter;
switch(subtree) {
case INFRASTRUCTURE:
filter = ObjectSelectionDialog.createContainerSelectionFilter();
break;
case TEMPLATES:
filter = ObjectSelectionDialog.createTemplateGroupSelectionFilter();
break;
case BUSINESS_SERVICES:
filter = ObjectSelectionDialog.createBusinessServiceSelectionFilter();
break;
case DASHBOARDS:
filter = ObjectSelectionDialog.createDashboardGroupSelectionFilter();
break;
case MAPS:
filter = ObjectSelectionDialog.createNetworkMapGroupsSelectionFilter();
break;
case POLICIES:
filter = ObjectSelectionDialog.createPolicyGroupSelectionFilter();
break;
default:
filter = null;
break;
}
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getSite().getShell(), null, filter, currentObject);
dlg.enableMultiSelection(false);
if (dlg.open() == Window.OK) {
final AbstractObject target = dlg.getSelectedObjects().get(0);
for (int i = 0; i < selection.length; i++) {
performObjectMove(target, parentObject.get(i), currentObject.get(i), true);
}
}
}
use of org.netxms.ui.eclipse.objectbrowser.dialogs.ObjectSelectionDialog in project netxms by netxms.
the class TunnelManager method bindTunnel.
/**
* Bind tunnel to node
*/
private void bindTunnel() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final AgentTunnel tunnel = (AgentTunnel) selection.getFirstElement();
if (tunnel.isBound())
return;
ObjectSelectionDialog dlg = new ObjectSelectionDialog(getSite().getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(false));
if (dlg.open() != Window.OK)
return;
final long nodeId = dlg.getSelectedObjects().get(0).getObjectId();
final NXCSession session = ConsoleSharedData.getSession();
new ConsoleJob("Bind tunnels", this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.bindAgentTunnel(tunnel.getId(), nodeId);
final List<AgentTunnel> tunnels = session.getAgentTunnels();
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(tunnels);
}
});
}
@Override
protected String getErrorMessage() {
return "Cannot bind tunnel";
}
}.start();
}
Aggregations