@Override public void execute(Statistics statistics) { if (statistics instanceof DynamicStatistics) { executeDynamic((DynamicStatistics) statistics, null); } else { GraphController graphController = Lookup.getDefault().lookup(GraphController.class); GraphModel graphModel = graphController.getGraphModel(); statistics.execute(graphModel); model.addReport(statistics); } }
@Override public void execute(final Statistics statistics, LongTaskListener listener) { StatisticsBuilder builder = getBuilder(statistics.getClass()); LongTaskExecutor executor = new LongTaskExecutor(true, "Statistics " + builder.getName(), 10); if (listener != null) { executor.setLongTaskListener(listener); } if (statistics instanceof DynamicStatistics) { final DynamicLongTask dynamicLongTask = new DynamicLongTask((DynamicStatistics) statistics); executor.execute( dynamicLongTask, new Runnable() { @Override public void run() { executeDynamic((DynamicStatistics) statistics, dynamicLongTask); } }, builder.getName(), null); } else { LongTask task = statistics instanceof LongTask ? (LongTask) statistics : null; executor.execute( task, new Runnable() { @Override public void run() { execute(statistics); } }, builder.getName(), null); } }