Search in sources :

Example 1 with SummaryTable

use of org.netxms.ui.eclipse.datacollection.views.SummaryTable in project netxms by netxms.

the class SummaryTablesDynamicMenu method queryTable.

/**
 * Query table using selected base object
 *
 * @param baseObjectId
 * @param tableId
 */
private void queryTable(final long baseObjectId, final int tableId) {
    final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
    new ConsoleJob(Messages.get().SummaryTablesDynamicMenu_QueryTableJob, null, Activator.PLUGIN_ID, null) {

        @Override
        protected void runInternal(IProgressMonitor monitor) throws Exception {
            final Table results = session.queryDciSummaryTable(tableId, baseObjectId);
            runInUIThread(new Runnable() {

                @Override
                public void run() {
                    // $NON-NLS-1$
                    String secondaryId = Integer.toString(tableId) + "&" + Long.toString(baseObjectId);
                    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                    try {
                        SummaryTable view = (SummaryTable) window.getActivePage().showView(SummaryTable.ID, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
                        view.setTable(results);
                    } catch (PartInitException e) {
                        MessageDialogHelper.openError(window.getShell(), Messages.get().SummaryTablesDynamicMenu_Error, String.format(Messages.get().SummaryTablesDynamicMenu_CannotOpenView, e.getLocalizedMessage()));
                    }
                }
            });
        }

        @Override
        protected String getErrorMessage() {
            return Messages.get().SummaryTablesDynamicMenu_CannotReadData;
        }
    }.start();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) NXCSession(org.netxms.client.NXCSession) SummaryTable(org.netxms.ui.eclipse.datacollection.views.SummaryTable) Table(org.netxms.client.Table) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) PartInitException(org.eclipse.ui.PartInitException) PartInitException(org.eclipse.ui.PartInitException) SummaryTable(org.netxms.ui.eclipse.datacollection.views.SummaryTable)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1 NXCSession (org.netxms.client.NXCSession)1 Table (org.netxms.client.Table)1 SummaryTable (org.netxms.ui.eclipse.datacollection.views.SummaryTable)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1