src/com/github/isarthur/netbeans/editor/generator/java/MethodGenerator.java
@Override
    public void invoke() {
        try {
            javaSource.runModificationTask(workingCopy -> {
                workingCopy.toPhase(JavaSource.Phase.RESOLVED);
                compilationUnit = workingCopy.getCompilationUnit();
                trees = workingCopy.getTrees();
                treeUtilities = workingCopy.getTreeUtilities();
                currentPath = treeUtilities.pathFor(caretPosition);
                TreePath classInterfaceOrEnumPath = treeUtilities.getPathElementOfKind(
                        EnumSet.of(Tree.Kind.CLASS, Tree.Kind.ENUM, Tree.Kind.INTERFACE), currentPath);
                if (classInterfaceOrEnumPath != null) {
                    Tree classInterfaceOrEnumTree = classInterfaceOrEnumPath.getLeaf();
                    ClassTree oldTree = (ClassTree) classInterfaceOrEnumTree;
                    setInsertIndex(oldTree);
                    if (classInterfaceOrEnumTree.getKind() == Tree.Kind.CLASS
                            || classInterfaceOrEnumTree.getKind() == Tree.Kind.ENUM) {
                        isInterface = false;
                        dialog = GenerateMethodDialog.createAndShow(isInterface);
                    } else {
                        isInterface = true;
                        dialog = GenerateMethodDialog.createAndShow(isInterface);
                    }
                    if (dialog.isOkButtonPushed()) {
                        insertMethodIntoClassInterfaceOrEnum(workingCopy);
                    }
                }
            }).commit();
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
        dialog.saveBounds();
        dialog.dispose();
    }
/**
     * This will be invoked when user chooses this Generator from Insert Code
     * dialog
     */
This will be invoked when user chooses this Generator from Insert Code
dialog
This will be invoked when user chooses this Generator from Insert Code dialog
@Override
    public void invoke() {
        try {
            javaSource.runModificationTask(workingCopy -> {
                workingCopy.toPhase(JavaSource.Phase.RESOLVED);
                compilationUnit = workingCopy.getCompilationUnit();
                trees = workingCopy.getTrees();
                treeUtilities = workingCopy.getTreeUtilities();
                currentPath = treeUtilities.pathFor(caretPosition);
                TreePath classInterfaceOrEnumPath = treeUtilities.getPathElementOfKind(
                        EnumSet.of(Tree.Kind.CLASS, Tree.Kind.ENUM, Tree.Kind.INTERFACE), currentPath);
                if (classInterfaceOrEnumPath != null) {
                    Tree classInterfaceOrEnumTree = classInterfaceOrEnumPath.getLeaf();
                    ClassTree oldTree = (ClassTree) classInterfaceOrEnumTree;
                    setInsertIndex(oldTree);
                    if (classInterfaceOrEnumTree.getKind() == Tree.Kind.CLASS
                            || classInterfaceOrEnumTree.getKind() == Tree.Kind.ENUM) {
                        isInterface = false;
                        dialog = GenerateMethodDialog.createAndShow(isInterface);
                    } else {
                        isInterface = true;
                        dialog = GenerateMethodDialog.createAndShow(isInterface);
                    }
                    if (dialog.isOkButtonPushed()) {
                        insertMethodIntoClassInterfaceOrEnum(workingCopy);
                    }
                }
            }).commit();
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
        dialog.saveBounds();
        dialog.dispose();
    }
@ Override public void invoke ( ) { try { javaSource . runModificationTask ( workingCopy -> { workingCopy . toPhase ( JavaSource . Phase . RESOLVED ) ; compilationUnit = workingCopy . getCompilationUnit ( ) ; trees = workingCopy . getTrees ( ) ; treeUtilities = workingCopy . getTreeUtilities ( ) ; currentPath = treeUtilities . pathFor ( caretPosition ) ; TreePath classInterfaceOrEnumPath = treeUtilities . getPathElementOfKind ( EnumSet . of ( Tree . Kind . CLASS , Tree . Kind . ENUM , Tree . Kind . INTERFACE ) , currentPath ) ; if ( classInterfaceOrEnumPath != null ) { Tree classInterfaceOrEnumTree = classInterfaceOrEnumPath . getLeaf ( ) ; ClassTree oldTree = ( ClassTree ) classInterfaceOrEnumTree ; setInsertIndex ( oldTree ) ; if ( classInterfaceOrEnumTree . getKind ( ) == Tree . Kind . CLASS || classInterfaceOrEnumTree . getKind ( ) == Tree . Kind . ENUM ) { isInterface = false ; dialog = GenerateMethodDialog . createAndShow ( isInterface ) ; } else { isInterface = true ; dialog = GenerateMethodDialog . createAndShow ( isInterface ) ; } if ( dialog . isOkButtonPushed ( ) ) { insertMethodIntoClassInterfaceOrEnum ( workingCopy ) ; } } } ) . commit ( ) ; } catch ( IOException ex ) { Exceptions . printStackTrace ( ex ) ; } dialog . saveBounds ( ) ; dialog . dispose ( ) ; }
This will be invoked when user chooses this Generator from Insert Code
 dialog
This will be invoked when user chooses this Generator from Insert Code dialog