Search in sources :

Example 1 with DartNamedElementNode

use of com.jetbrains.lang.dart.ide.DartNamedElementNode in project intellij-plugins by JetBrains.

the class BaseDartGenerateHandler method invoke.

public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file, final int offset) {
    final DartClass dartClass = PsiTreeUtil.getParentOfType(file.findElementAt(offset), DartClassDefinition.class);
    if (dartClass == null)
        return;
    final List<DartComponent> candidates = new ArrayList<>();
    collectCandidates(dartClass, candidates);
    List<DartNamedElementNode> selectedElements = Collections.emptyList();
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        selectedElements = ContainerUtil.map(candidates, DartNamedElementNode::new);
    } else if (!candidates.isEmpty()) {
        final MemberChooser<DartNamedElementNode> chooser = createMemberChooserDialog(project, dartClass, candidates, getTitle());
        chooser.show();
        if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE)
            return;
        selectedElements = chooser.getSelectedElements();
    }
    doInvoke(project, editor, file, selectedElements, createFix(dartClass));
}
Also used : DartClass(com.jetbrains.lang.dart.psi.DartClass) DartComponent(com.jetbrains.lang.dart.psi.DartComponent) DartNamedElementNode(com.jetbrains.lang.dart.ide.DartNamedElementNode) MemberChooser(com.intellij.ide.util.MemberChooser)

Aggregations

MemberChooser (com.intellij.ide.util.MemberChooser)1 DartNamedElementNode (com.jetbrains.lang.dart.ide.DartNamedElementNode)1 DartClass (com.jetbrains.lang.dart.psi.DartClass)1 DartComponent (com.jetbrains.lang.dart.psi.DartComponent)1