use of org.netxms.ui.eclipse.logviewer.views.LogViewer in project netxms by netxms.
the class ShowObjectSnmpTrapLog method execute.
/* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
ISelection selection = window.getActivePage().getSelection();
if ((selection == null) || !(selection instanceof IStructuredSelection) || selection.isEmpty())
return null;
ColumnFilter cf = new ColumnFilter();
cf.setOperation(ColumnFilterSetOperation.OR);
for (Object o : ((IStructuredSelection) selection).toList()) {
if (!(o instanceof AbstractObject))
continue;
cf.addSubFilter(new ColumnFilter((o instanceof AbstractNode) ? ColumnFilterType.EQUALS : ColumnFilterType.CHILDOF, ((AbstractObject) o).getObjectId()));
}
try {
// $NON-NLS-1$
LogViewer view = (LogViewer) window.getActivePage().showView(LogViewer.ID, "SnmpTrapLog", IWorkbenchPage.VIEW_ACTIVATE);
LogFilter filter = new LogFilter();
// $NON-NLS-1$
filter.setColumnFilter("object_id", cf);
List<OrderingColumn> orderingColumns = new ArrayList<OrderingColumn>(1);
// $NON-NLS-1$
orderingColumns.add(new OrderingColumn("trap_timestamp", Messages.get().ShowObjectSnmpTrapLog_Time, true));
filter.setOrderingColumns(orderingColumns);
view.queryWithFilter(filter);
} catch (PartInitException e) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowObjectSnmpTrapLog_Error, String.format(Messages.get().ShowObjectSnmpTrapLog_ErrorOpenLogViewer, e.getMessage()));
}
return null;
}
use of org.netxms.ui.eclipse.logviewer.views.LogViewer in project netxms by netxms.
the class ShowObjectEvents method execute.
/* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
ISelection selection = window.getActivePage().getSelection();
if ((selection == null) || !(selection instanceof IStructuredSelection) || selection.isEmpty())
return null;
ColumnFilter cf = new ColumnFilter();
cf.setOperation(ColumnFilterSetOperation.OR);
for (Object o : ((IStructuredSelection) selection).toList()) {
if (!(o instanceof AbstractObject))
continue;
cf.addSubFilter(new ColumnFilter((o instanceof AbstractNode) ? ColumnFilterType.EQUALS : ColumnFilterType.CHILDOF, ((AbstractObject) o).getObjectId()));
}
try {
// $NON-NLS-1$
LogViewer view = (LogViewer) window.getActivePage().showView(LogViewer.ID, "EventLog", IWorkbenchPage.VIEW_ACTIVATE);
LogFilter filter = new LogFilter();
// $NON-NLS-1$
filter.setColumnFilter("event_source", cf);
List<OrderingColumn> orderingColumns = new ArrayList<OrderingColumn>(1);
// $NON-NLS-1$
orderingColumns.add(new OrderingColumn("event_timestamp", Messages.get().ShowObjectEvents_Time, true));
filter.setOrderingColumns(orderingColumns);
view.queryWithFilter(filter);
} catch (PartInitException e) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowObjectEvents_Error, String.format(Messages.get().ShowObjectEvents_CannotOpenLogViewer, e.getMessage()));
}
return null;
}
use of org.netxms.ui.eclipse.logviewer.views.LogViewer in project netxms by netxms.
the class ShowObjectSyslog method execute.
/* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
ISelection selection = window.getActivePage().getSelection();
if ((selection == null) || !(selection instanceof IStructuredSelection) || selection.isEmpty())
return null;
ColumnFilter cf = new ColumnFilter();
cf.setOperation(ColumnFilterSetOperation.OR);
for (Object o : ((IStructuredSelection) selection).toList()) {
if (!(o instanceof AbstractObject))
continue;
cf.addSubFilter(new ColumnFilter((o instanceof AbstractNode) ? ColumnFilterType.EQUALS : ColumnFilterType.CHILDOF, ((AbstractObject) o).getObjectId()));
}
try {
// $NON-NLS-1$
LogViewer view = (LogViewer) window.getActivePage().showView(LogViewer.ID, "syslog", IWorkbenchPage.VIEW_ACTIVATE);
LogFilter filter = new LogFilter();
// $NON-NLS-1$
filter.setColumnFilter("source_object_id", cf);
List<OrderingColumn> orderingColumns = new ArrayList<OrderingColumn>(1);
// $NON-NLS-1$
orderingColumns.add(new OrderingColumn("msg_timestamp", Messages.get().ShowObjectSyslog_Time, true));
filter.setOrderingColumns(orderingColumns);
view.queryWithFilter(filter);
} catch (PartInitException e) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowObjectSyslog_Error, String.format(Messages.get().ShowObjectSyslog_ErrorOpenLogViewer, e.getMessage()));
}
return null;
}
Aggregations