Search in sources :

Example 1 with EditorSupport

use of org.netbeans.modules.php.api.editor.EditorSupport 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)

Example 2 with EditorSupport

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

the class CakePhpGoToViewAction method goToView.

@Override
public boolean goToView() {
    EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
    PhpBaseElement phpElement = editorSupport.getElement(controller, offset);
    if (phpElement == null) {
        return false;
    }
    FileObject view = CakePhpUtils.getView(controller, phpElement);
    if (view != null) {
        UiUtils.open(view, DEFAULT_OFFSET);
        return true;
    }
    return false;
}
Also used : EditorSupport(org.netbeans.modules.php.api.editor.EditorSupport) FileObject(org.openide.filesystems.FileObject) PhpBaseElement(org.netbeans.modules.php.api.editor.PhpBaseElement)

Aggregations

EditorSupport (org.netbeans.modules.php.api.editor.EditorSupport)2 PhpBaseElement (org.netbeans.modules.php.api.editor.PhpBaseElement)1 PhpClass (org.netbeans.modules.php.api.editor.PhpClass)1 FileObject (org.openide.filesystems.FileObject)1