use of org.netxms.ui.eclipse.datacollection.widgets.LastValuesWidget in project netxms by netxms.
the class AlarmDetails method refresh.
/**
* Refresh view
*/
private void refresh() {
new ConsoleJob(Messages.get().AlarmDetails_RefreshJobTitle, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final Alarm alarm = session.getAlarm(alarmId);
final List<AlarmComment> comments = session.getAlarmComments(alarmId);
List<EventInfo> _events = null;
try {
_events = session.getAlarmEvents(alarmId);
} catch (NXCException e) {
if (e.getErrorCode() != RCC.ACCESS_DENIED)
throw e;
}
final List<EventInfo> events = _events;
runInUIThread(new Runnable() {
@Override
public void run() {
updateAlarmDetails(alarm);
for (AlarmCommentsEditor e : editors.values()) e.dispose();
for (AlarmComment n : comments) editors.put(n.getId(), createEditor(n));
if (lastValuesWidget == null) {
AbstractObject object = session.findObjectById(alarm.getSourceObjectId());
if (object != null) {
// $NON-NLS-1$
lastValuesWidget = new LastValuesWidget(AlarmDetails.this, dataArea, SWT.BORDER, object, "AlarmDetails.LastValues", null);
lastValuesWidget.refresh();
}
}
if (events != null) {
eventViewer.setInput(events);
eventViewer.expandAll();
if (labelAccessDenied != null) {
labelAccessDenied.dispose();
labelAccessDenied = null;
}
} else if (labelAccessDenied == null) {
labelAccessDenied = new CLabel(eventViewer.getControl().getParent(), SWT.NONE);
toolkit.adapt(labelAccessDenied);
labelAccessDenied.setImage(StatusDisplayInfo.getStatusImage(Severity.CRITICAL));
labelAccessDenied.setText(Messages.get().AlarmDetails_RelatedEvents_AccessDenied);
labelAccessDenied.moveAbove(null);
labelAccessDenied.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
}
updateLayout();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().AlarmDetails_RefreshJobError;
}
}.start();
}
use of org.netxms.ui.eclipse.datacollection.widgets.LastValuesWidget in project netxms by netxms.
the class LastValues method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
FormLayout formLayout = new FormLayout();
parent.setLayout(formLayout);
// $NON-NLS-1$
dataView = new LastValuesWidget(this, parent, SWT.NONE, dcTarget, "LastValuesWidget", null);
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, 0);
dataView.setLayoutData(fd);
createActions();
contributeToActionBars();
dataView.setFilterCloseAction(actionShowFilter);
dataView.enableFilter(initShowFilter);
dataView.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
settings.put("LastValuesView", dataView.isFilterEnabled());
}
});
activateContext();
}
use of org.netxms.ui.eclipse.datacollection.widgets.LastValuesWidget in project netxms by netxms.
the class LastValues method createTabContent.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#createTabContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void createTabContent(Composite parent) {
final IDialogSettings settings = Activator.getDefault().getDialogSettings();
initShowFilter = safeCast(settings.get("LastValuesTab.showFilter"), settings.getBoolean("LastValuesTab.showFilter"), initShowFilter);
dataView = new LastValuesWidget(getViewPart(), parent, SWT.NONE, getObject(), "LastValuesTab", new // $NON-NLS-1$
VisibilityValidator() {
@Override
public boolean isVisible() {
return isActive();
}
});
dataView.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
settings.put("LastValuesTab.showFilter", dataView.isFilterEnabled());
}
});
dataView.setAutoRefreshEnabled(true);
dataView.setFilterCloseAction(new Action() {
@Override
public void run() {
dataView.enableFilter(false);
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
// $NON-NLS-1$
Command command = service.getCommand("org.netxms.ui.eclipse.datacollection.commands.show_dci_filter");
// $NON-NLS-1$
State state = command.getState("org.netxms.ui.eclipse.datacollection.commands.show_dci_filter.state");
state.setValue(false);
service.refreshElements(command.getId(), null);
}
});
dataView.enableFilter(initShowFilter);
}
Aggregations