@Override public void registerExistenceDependency(EditorCell cell, Pair<SNodeReference, String> pair) { WeakSet<EditorCell> dependentCells = myExistenceDependentCells.get(pair); if (dependentCells == null) { dependentCells = new WeakSet<EditorCell>(); myExistenceDependentCells.put(pair, dependentCells); } dependentCells.add(cell); }
private boolean applyInstantIntention( final EditorContext editorContext, final SNode quickFixNode, QuickFixProvider intentionProvider) { final QuickFix_Runtime intention = intentionProvider.getQuickFix(); if (intention != null) { if (!myOnceExecutedQuickFixes.contains(intention)) { myOnceExecutedQuickFixes.add(intention); ApplicationManager.getApplication() .invokeLater( new Runnable() { @Override public void run() { EditorCell selectedCell = editorContext.getSelectedCell(); if (selectedCell == null) return; int caretX = selectedCell.getCaretX(); int caretY = selectedCell.getBaseline(); Project p = editorContext.getOperationContext() != null ? editorContext.getOperationContext().getProject() : null; if (p == null) { return; } p.getModelAccess() .executeUndoTransparentCommand( new Runnable() { @Override public void run() { intention.execute(quickFixNode); } }); editorContext.flushEvents(); if (editorContext.getSelectionManager().getSelection() == null) { EditorCell rootCell = editorContext.getEditorComponent().getRootCell(); EditorCell leaf = rootCell.findLeaf(caretX, caretY); if (leaf != null) { editorContext.getEditorComponent().changeSelection(leaf); leaf.setCaretX(caretX); } } } }, ModalityState.NON_MODAL); } return true; } return false; }