use of org.eclipse.linuxtools.internal.oprofile.core.model.OpModelRoot in project linuxtools by eclipse.
the class OprofileView method refreshView.
/**
* Extremely convoluted way of getting the running and parsing to happen in
* a separate thread, with a progress monitor. In most cases and on fast
* machines this will probably only be a blip.
*/
public void refreshView() {
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(OprofileUiPlugin.ID_OPROFILE_VIEW);
} catch (PartInitException e) {
e.printStackTrace();
}
IRunnableWithProgress refreshRunner = monitor -> {
// $NON-NLS-1$
monitor.beginTask(OprofileUiMessages.getString("view.dialog.parsing.text"), 2);
OpModelRoot dataModelRoot = OpModelRoot.getDefault();
dataModelRoot.refreshModel();
monitor.worked(1);
final UiModelRoot UiRoot = UiModelRoot.getDefault();
UiRoot.refreshModel();
Display.getDefault().asyncExec(() -> OprofileUiPlugin.getDefault().getOprofileView().getTreeViewer().setInput(UiRoot));
monitor.worked(1);
monitor.done();
};
ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
try {
dialog.run(true, false, refreshRunner);
} catch (InvocationTargetException | InterruptedException e) {
e.printStackTrace();
}
}
Aggregations