public static Implementables collectFrom(EditorEx editor, PsiFile file) throws IllegalArgumentException { final Project project = editor.getProject(); final PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true); if (aClass == null) { throw new IllegalArgumentException("No context for implement"); } // collectFrom all candidates final Collection<CandidateInfo> override = OverrideImplementUtil.getMethodsToOverrideImplement(aClass, false); final Collection<CandidateInfo> implement = OverrideImplementUtil.getMethodsToOverrideImplement(aClass, true); final Implementables result = new Implementables(project, editor, aClass); result.addFrom(override); result.addFrom(implement); // TODO sort them somehow? // Collections.sort(result, new Comparator<Implementable>() { // @Override // public int compare(Implementable o1, Implementable o2) { // return 0; // } // }); return result; } }
@SuppressWarnings("ConstantConditions") @Override public void actionPerformed(AnActionEvent event) { DataContext dataContext = event.getDataContext(); Editor editor = EDITOR.getData(dataContext); if (editor instanceof EditorEx && event.getInputEvent() instanceof MouseEvent && editor.getUserData(POPUP_LINE) != null) { EditorEx exEditor = (EditorEx) editor; if (exEditor.getProject() == null) { LOG.error("could not add a snapshot location as the target editor was unexpectedly null."); return; } if (editor.getUserData(POPUP_LINE) == null) { LOG.error("could not add a snapshot location as the target line was unexpectedly null."); return; } XDebuggerUtil.getInstance() .toggleLineBreakpoint( exEditor.getProject(), CloudLineBreakpointType.getInstance(), exEditor.getVirtualFile(), editor.getUserData(POPUP_LINE)); } }
return null; final Project project = editor.getProject(); if (project == null) { throw new IllegalArgumentException(); // shouldn't happen