public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) { try { AbstractDebugSession debugSession = DebugActionsUtil.getDebugSession(event); AbstractUiState uiState = ((AbstractUiState) debugSession.getUiState()); StringBuffer sb = new StringBuffer(); for (IThread thread : ListSequence.fromList(uiState.getThreads())) { sb.append(thread.getPresentation()); sb.append('\n'); for (IStackFrame frame : ListSequence.fromList(thread.getFrames())) { ILocation location = frame.getLocation(); sb.append('\t'); sb.append("at "); sb.append(location.getUnitName()); sb.append("."); sb.append(location.getRoutineName()); sb.append("("); sb.append(frame.getLocation().getFileName()); sb.append(":"); sb.append(location.getLineNumber()); sb.append(")"); sb.append('\n'); } sb.append('\n'); } final ExportThreadsDialog dialog = new ExportThreadsDialog( ((IOperationContext) MapSequence.fromMap(_params).get("context")), sb); ApplicationManager.getApplication() .invokeLater( new Runnable() { public void run() { dialog.showDialog(); } }, ModalityState.NON_MODAL); } catch (Throwable t) { if (log.isErrorEnabled()) { log.error("User's action execute method failed. Action:" + "ExportThreads", t); } } }
public void init(final _FunctionTypes._void_P0_E0 callback) { if (myInitialized) { callback.invoke(); return; } if (!(isLeaf())) { if (myInitializationInProgress.compareAndSet(false, true)) { myState.invokeEvaluation( new _FunctionTypes._void_P0_E0() { public void invoke() { try { myWatchable.getValue().initSubvalues(); ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { try { removeAllChildren(); for (IWatchable watchable : ListSequence.fromList(getValue().getSubvalues())) { add(new WatchableNode(watchable, myState)); } updatePresentation(); myInitialized = true; callback.invoke(); for (_FunctionTypes._void_P0_E0 callback : ListSequence.fromList(myCallbacks)) { try { callback.invoke(); } catch (Throwable t) { if (LOG.isEnabledFor(Level.ERROR)) { LOG.error("", t); } } } ListSequence.fromList(myCallbacks).clear(); nodeChanged(); } finally { myInitializationInProgress.set(false); } } }); } catch (Throwable t) { myInitializationInProgress.set(false); } } }); } else { // callbacks are accessed from ui thread only ListSequence.fromList(myCallbacks).addElement(callback); } } }