Package org.netbeans.modules.php.api.editor

Examples of org.netbeans.modules.php.api.editor.EditorSupport


        return false;
    }

    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();
View Full Code Here


        this.offset = offset;
    }

    @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) {
View Full Code Here

            addCommands(appCommandsDirectory, commandFiles);
        }

        // sort
        YiiUtils.sort(commandFiles);
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        for (FileObject commandFile : commandFiles) {
            // add command
            String commandName = commandFile.getName().replace(COMMAND_SUFFIX, "").toLowerCase(); // NOI18N
            commands.add(new YiiFrameworkCommand(phpModule, commandName, commandName, commandName));

            // add sub commands
            Collection<PhpClass> phpClasses = editorSupport.getClasses(commandFile);
            for (PhpClass phpClass : phpClasses) {
                Collection<PhpClass.Method> methods = phpClass.getMethods();
                PhpClass.Method[] methodArray = methods.toArray(new PhpClass.Method[]{});
                Arrays.sort(methodArray, new Comparator<PhpClass.Method>() {
                    @Override
View Full Code Here

        this.offset = offset;
    }

    @Override
    public boolean goToView() {
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        PhpBaseElement element = editorSupport.getElement(controller, offset);
        if (element instanceof PhpClass.Method) {

            // get view file
            PhpClass.Method method = (PhpClass.Method) element;
            String actionId = YiiUtils.getViewName(method);
View Full Code Here

     * @param controller
     * @return offset
     */
    public int getActionMethodOffset(FileObject controller) {
        String actionMethodName = YiiUtils.getActionMethodName(view.getName());
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);

        for (PhpClass phpClass : editorSupport.getClasses(controller)) {
            if (!YiiUtils.isControllerName(phpClass.getName())) {
                continue;
            }
            if (actionMethodName == null) {
                break;
View Full Code Here

            return;
        }

        // get element for caret positon
        int caretPosition = editor.getCaretPosition();
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        PhpBaseElement element = editorSupport.getElement(controller, caretPosition);

        // get actionId, controllerId
        final String actionId = getActionId(element);
        final String controllerId = getControllerId(controller);
        if (StringUtils.isEmpty(actionId) || StringUtils.isEmpty(controllerId)) {
View Full Code Here

        this.offset = offset;
  }

  @Override
  public boolean goToView() {
    EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        PhpBaseElement phpElement = editorSupport.getElement(fo, offset);
    if (phpElement == null) {
            return false;
        }
        FileObject view = EditorUtils.getView(fo, phpElement);
        if (view != null) {
View Full Code Here

    }

    private int getActionMethodOffset(FileObject action) {
        String actionMethodName = EditorUtils.getActionName(fo);
        String renderMethodName = EditorUtils.getRenderName(fo);
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        for (PhpClass phpClass : editorSupport.getClasses(action)) {
            if (phpClass.getName().endsWith(NetteFramework.NETTE_PRESENTER_SUFFIX)) {
                methodOffset(actionMethodName, phpClass);
                methodOffset(renderMethodName, phpClass);

                return methodOffset == NO_OFFSET ? phpClass.getOffset() : methodOffset;
View Full Code Here

     */
    public static boolean isController(FileObject controller) {
        if (controller == null) {
            return false;
        }
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        Collection<PhpClass> phpClasses = editorSupport.getClasses(controller);
        if (phpClasses.size() != 1) {
            return false;
        }

        PhpClass phpClass = null;
View Full Code Here

        this.actionName = actionName;
    }

    public FuelPhpControllerVisitor(FileObject targetFile, int currentCaretPosition) {
        // get PhpBaseElement(Method) for current positon
        EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
        // XXX
        int startClassOffset = 0;
        Collection<PhpClass> classes = editorSupport.getClasses(targetFile);
        for (PhpClass phpClass : classes) {
            startClassOffset = phpClass.getOffset();
            break;
        }
        // FIXME exception might be occurred
        // if user run action at outside php class.
        // e.g. document area.
        //
        if (currentCaretPosition > startClassOffset) {
            PhpBaseElement phpElement = editorSupport.getElement(targetFile, currentCaretPosition);
            if (phpElement != null && phpElement instanceof PhpClass.Method) {
                PhpClass.Method method = (PhpClass.Method) phpElement;
                actionName = method.getName();
            }
        }
View Full Code Here

TOP

Related Classes of org.netbeans.modules.php.api.editor.EditorSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.