Source:
public static void openTraceFromElement(final TmfCommonProjectElement traceElement) { final IFile file; try { file = traceElement.createBookmarksFile(); } catch (final CoreException e) { Activator.getDefault().logError(Messages.TmfOpenTraceHelper_ErrorOpeningTrace + ' ' + traceElement.getName()); TraceUtils.displayErrorMsg(Messages.TmfOpenTraceHelper_OpenTrace, Messages.TmfOpenTraceHelper_ErrorTrace + ENDL + ENDL + e.getMessage()); return; } final IWorkbench wb = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); final IEditorPart editor = findEditor(new FileEditorInput(file), true); if (editor != null) { activePage.activate(editor); return; } Thread thread = new Thread() { @Override public void run() { final ITmfTrace trace = openProjectElement(traceElement, file); if (trace == null) { return; } String traceEditorId = traceElement.getEditorId(); final String editorId = (traceEditorId != null) ? traceEditorId : TmfEventsEditor.ID; final IEditorInput editorInput = new TmfEditorInput(file, trace); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { activePage.openEditor(editorInput, editorId); IDE.setDefaultEditor(file, editorId); } catch (final PartInitException e) { TraceUtils.displayErrorMsg(Messages.TmfOpenTraceHelper_OpenTrace, Messages.TmfOpenTraceHelper_ErrorOpeningTrace + ENDL + ENDL + e.getMessage()); Activator.getDefault().logError(Messages.TmfOpenTraceHelper_ErrorOpeningTrace + ' ' + traceElement.getName()); trace.dispose(); } } }); } }; thread.start(); }

Target:
public static void openTraceFromElement(final TmfCommonProjectElement traceElement) { final IFile file; try { file = traceElement.createBookmarksFile(); } catch (final CoreException e) { Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), NLS.bind(Messages.TmfOpenTraceHelper_ErrorElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); return; } final IWorkbench wb = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); final IEditorPart editor = findEditor(new FileEditorInput(file), true); if (editor != null) { activePage.activate(editor); return; } Thread thread = new Thread() { @Override public void run() { final ITmfTrace trace = openProjectElement(traceElement, file); if (trace == null) { return; } String traceEditorId = traceElement.getEditorId(); final String editorId = (traceEditorId != null) ? traceEditorId : TmfEventsEditor.ID; final IEditorInput editorInput = new TmfEditorInput(file, trace); Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { activePage.openEditor(editorInput, editorId); IDE.setDefaultEditor(file, editorId); } catch (final PartInitException e) { TraceUtils.displayErrorMsg(NLS.bind(Messages.TmfOpenTraceHelper_OpenElement, traceElement.getTypeName()), NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ENDL + ENDL + e.getMessage()); Activator.getDefault().logError(NLS.bind(Messages.TmfOpenTraceHelper_ErrorOpeningElement, traceElement.getTypeName()) + ' ' + traceElement.getName()); trace.dispose(); } } }); } }; thread.start(); }