use of org.netxms.client.datacollection.DciValue in project netxms by netxms.
the class StartDataRecalculation method selectionChanged.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
@Override
public void selectionChanged(IAction action, ISelection selection) {
Set<DCI> dciList = null;
if (selection instanceof IStructuredSelection) {
dciList = new HashSet<DCI>();
for (Object o : ((IStructuredSelection) selection).toList()) {
if (o instanceof DciValue) {
dciList.add(new DCI(((DciValue) o).getNodeId(), ((DciValue) o).getId()));
} else if (o instanceof DataCollectionObject) {
dciList.add(new DCI(((DataCollectionObject) o).getNodeId(), ((DataCollectionObject) o).getId()));
} else {
dciList = null;
break;
}
}
}
objects = dciList;
action.setEnabled((objects != null) && (objects.size() > 0));
}
use of org.netxms.client.datacollection.DciValue in project netxms by netxms.
the class ForceDciPoll method selectionChanged.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
@Override
public void selectionChanged(IAction action, ISelection selection) {
Set<DCI> dciList = null;
if (selection instanceof IStructuredSelection) {
dciList = new HashSet<DCI>();
for (Object o : ((IStructuredSelection) selection).toList()) {
if (o instanceof DciValue) {
dciList.add(new DCI(((DciValue) o).getNodeId(), ((DciValue) o).getId()));
} else if (o instanceof DataCollectionObject) {
dciList.add(new DCI(((DataCollectionObject) o).getNodeId(), ((DataCollectionObject) o).getId()));
} else {
dciList = null;
break;
}
}
}
objects = dciList;
action.setEnabled((objects != null) && (objects.size() > 0));
}
use of org.netxms.client.datacollection.DciValue in project netxms by netxms.
the class LinkDataSources method addItem.
/**
* Add new item
*/
private void addItem() {
SelectDciDialog dlg = new SelectDciDialog(getShell(), 0);
if (dlg.open() == Window.OK) {
List<DciValue> selection = dlg.getSelection();
List<SingleDciConfig> select = new ArrayList<SingleDciConfig>();
for (DciValue item : selection) {
SingleDciConfig dci = new SingleDciConfig(item);
select.add(dci);
labelProvider.addCacheEntry(dci.getNodeId(), dci.dciId, dci.name);
dciList.add(dci);
}
viewer.setInput(dciList.toArray());
viewer.setSelection(new StructuredSelection(select));
}
}
use of org.netxms.client.datacollection.DciValue in project netxms by netxms.
the class LastValuesWidget method copySelectionDciName.
/**
* Copy DCI name of selection
*/
private void copySelectionDciName() {
IStructuredSelection selection = (IStructuredSelection) dataViewer.getSelection();
if (selection.isEmpty())
return;
StringBuilder dciName = new StringBuilder();
for (Object o : selection.toList()) {
if (dciName.length() > 0)
dciName.append(' ');
DciValue v = (DciValue) o;
dciName.append(v.getName());
}
WidgetHelper.copyToClipboard(dciName.toString());
}
use of org.netxms.client.datacollection.DciValue in project netxms by netxms.
the class DciList method getDataFromServer.
/**
* Get data from server
*/
private void getDataFromServer() {
if (node == null) {
viewer.setInput(new DciValue[0]);
return;
}
ConsoleJob job = new ConsoleJob(String.format(Messages.get().DciList_JobTitle, node.getObjectName()), viewPart, Activator.PLUGIN_ID, null) {
@Override
protected String getErrorMessage() {
return String.format(Messages.get().DciList_JobError, node.getObjectName());
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final List<DciValue> data = (dcObjectType == -1) ? Arrays.asList(session.getLastValues(node.getObjectId(), false, false, allowNoValueObjects)) : new ArrayList<DciValue>(Arrays.asList(session.getLastValues(node.getObjectId(), false, false, allowNoValueObjects)));
if (dcObjectType != -1) {
Iterator<DciValue> it = data.iterator();
while (it.hasNext()) {
DciValue dci = it.next();
if (dci.getDcObjectType() != dcObjectType)
it.remove();
}
}
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(data.toArray());
}
});
}
};
job.setUser(false);
job.start();
}
Aggregations