Search in sources :

Example 1 with PhpClass

use of org.netbeans.modules.php.api.editor.PhpClass in project cakephp-netbeans by cakephp.

the class CakePhpGoToActionAction method getActionMethodOffset.

private int getActionMethodOffset(FileObject controller) {
    String actionMethodName = CakePhpUtils.getActionName(view);
    EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
    for (PhpClass phpClass : editorSupport.getClasses(controller)) {
        if (CakePhpUtils.isControllerName(phpClass.getName())) {
            if (actionMethodName != null) {
                for (PhpClass.Method method : phpClass.getMethods()) {
                    if (actionMethodName.equals(method.getName())) {
                        return method.getOffset();
                    }
                }
            }
            return phpClass.getOffset();
        }
    }
    return DEFAULT_OFFSET;
}
Also used : EditorSupport(org.netbeans.modules.php.api.editor.EditorSupport) PhpClass(org.netbeans.modules.php.api.editor.PhpClass)

Aggregations

EditorSupport (org.netbeans.modules.php.api.editor.EditorSupport)1 PhpClass (org.netbeans.modules.php.api.editor.PhpClass)1