use of org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCommentsEditor 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.alarmviewer.widgets.AlarmCommentsEditor in project netxms by netxms.
the class AlarmDetails method createEditor.
/**
* Create comment editor widget
*
* @param note alarm note associated with this widget
* @return
*/
private AlarmCommentsEditor createEditor(final AlarmComment note) {
HyperlinkAdapter editAction = new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
editComment(note.getId(), note.getText());
}
};
HyperlinkAdapter deleteAction = new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
deleteComment(note.getId());
}
};
final AlarmCommentsEditor e = new AlarmCommentsEditor(editorsArea, toolkit, imageCache, note, editAction, deleteAction);
toolkit.adapt(e);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
e.setLayoutData(gd);
e.moveBelow(linkAddComment);
return e;
}
use of org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCommentsEditor in project netxms by netxms.
the class AlarmComments method createEditor.
/**
* Create comment editor widget
*
* @param note alarm note associated with this widget
* @return
*/
private AlarmCommentsEditor createEditor(final AlarmComment note) {
HyperlinkAdapter editAction = new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
editComment(note.getId(), note.getText());
}
};
HyperlinkAdapter deleteAction = new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
deleteComment(note.getId());
}
};
final AlarmCommentsEditor e = new AlarmCommentsEditor(editorsArea, toolkit, imageCache, note, editAction, deleteAction);
toolkit.adapt(e);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
e.setLayoutData(gd);
e.moveBelow(linkAddComment);
return e;
}
use of org.netxms.ui.eclipse.alarmviewer.widgets.AlarmCommentsEditor in project netxms by netxms.
the class AlarmComments method refresh.
/**
* Refresh view
*/
private void refresh() {
new ConsoleJob(Messages.get().AlarmComments_GetComments, 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);
runInUIThread(new Runnable() {
@Override
public void run() {
updateAlarmDetails(alarm);
for (AlarmCommentsEditor e : editors.values()) e.dispose();
for (AlarmComment c : comments) editors.put(c.getId(), createEditor(c));
updateLayout();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().AlarmComments_GetError;
}
}.start();
}
Aggregations