Examples of TextRange


Examples of com.intellij.openapi.util.TextRange

    public PsiElement getElement() {
        return this.element;
    }

    public TextRange getRangeInElement() {
        return new TextRange(1, element.getTextLength() - 1);
    }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

                                .replace(basePath, ""));
                        String protectedPath = YiiRefsHelper.getCurrentProtected(path);
                        protectedPath = protectedPath.replace(basePath, "");

                        String str = element.getText();
                        TextRange textRange = CommonHelper.getTextRange(element, str);
                        String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
                        int start = textRange.getStartOffset();
                        int len = textRange.getLength();

                        if (!uri.endsWith(".tpl") && !uri.startsWith("smarty:")) {
                            uri += ".php";
                        }

                        VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
                        VirtualFile protectedPathDir = (!protectedPath.equals(""))
                                ? baseDir.findFileByRelativePath(protectedPath) : null;

                        String filepath = viewPath + "/" + uri;
                        if (uri.matches("^//.+")) {
                            filepath = viewAbsolutePath + "/" + uri.replace("//", "");
                        }
                        VirtualFile viewfile = baseDir.findFileByRelativePath(filepath);

                        if (viewfile != null && appDir != null) {
                            PsiReference ref = new FileReference(
                                    viewfile,
                                    uri,
                                    element,
                                    new TextRange(start, start + len),
                                    project,
                                    protectedPathDir,
                                    appDir);
                            return new PsiReference[]{ref};
                        }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

                }

                if (file != null && baseDir != null) {
                    VirtualFile protectedPathDir = (!protectedPath.equals("")) ? baseDir.findFileByRelativePath(protectedPath) : null;
                    String str = element.getText();
                    TextRange textRange = CommonHelper.getTextRange(element, str);
                    String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
                    int start = textRange.getStartOffset();
                    int len = textRange.getLength();

                    //System.out.println("Temp pour int : " + (System.nanoTime() - startTime) / 1000000 + " ms");

                    PsiReference ref = new FileReference(file, uri, element,
                            new TextRange(start, start + len), YiiPsiReferenceProvider.project, protectedPathDir, protectedPathDir);
                    return new PsiReference[]{ref};
                }
            }

            return PsiReference.EMPTY_ARRAY;
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

            String protectedPath = YiiRefsHelper.getCurrentProtected(path);
            protectedPath = protectedPath.replace(YiiPsiReferenceProvider.projectPath, "");
            if (ARRelationReferenceProvider.isARRelationClassName(element)) {

                String str = element.getText();
                TextRange textRange = CommonHelper.getTextRange(element, str);
                if (textRange != null) {
                    VirtualFile baseDir = YiiPsiReferenceProvider.project.getBaseDir();
                    if (baseDir != null) {
                        String className = element.getText();
                        VirtualFile v = ARRelationReferenceProvider.getClassFile(className);
                        VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
                        VirtualFile protectedPathDir = (!protectedPath.equals("")) ? baseDir.findFileByRelativePath(protectedPath) : null;
                        if (appDir != null) {
                            PsiReference ref = new FileReference(v, str.substring(textRange.getStartOffset(), textRange.getEndOffset())
                                    , element,
                                    textRange, YiiPsiReferenceProvider.project, protectedPathDir, appDir);
                            return new PsiReference[]{ref};
                        }
                    }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

            String protectedPath = CommonHelper.searchCurrentProtected(path).replace(YiiPsiReferenceProvider.projectPath, "");
            String viewAbsolutePath = protectedPath + "/views";
            String viewPath = currentPath + "/views";

            String str = element.getText();
            TextRange textRange = CommonHelper.getTextRange(element, str);
            String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
            int start = textRange.getStartOffset();
            int len = textRange.getLength();

            if (!uri.endsWith(".tpl") && !uri.startsWith("smarty:")) {
                uri += ".php";
            }

            VirtualFile baseDir = YiiPsiReferenceProvider.project.getBaseDir();
            if (baseDir != null) {
                VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
                VirtualFile protectedPathDir = (!protectedPath.equals("")) ? baseDir.findFileByRelativePath(protectedPath) : null;

                String filepath = viewPath + "/" + uri;
                if (uri.matches("^//.+")) {
                    filepath = viewAbsolutePath + "/" + uri.replace("//", "");
                }
                VirtualFile file = baseDir.findFileByRelativePath(filepath);

                if (file != null && appDir != null) {
                    PsiReference ref = new FileReference(file, uri, element,
                            new TextRange(start, start + len), YiiPsiReferenceProvider.project, protectedPathDir, appDir);
                    return new PsiReference[]{ref};
                }
            }
            return PsiReference.EMPTY_ARRAY;
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

                        }
                        VirtualFile widgetfile = baseDir.findFileByRelativePath(widgetFilePath);
                        VirtualFile protectedPathDir = (!protectedPath.equals("")) ? baseDir.findFileByRelativePath(protectedPath) : null;

                        String str = element.getText();
                        TextRange textRange = CommonHelper.getTextRange(element, str);
                        String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
                        int start = textRange.getStartOffset();
                        int len = textRange.getLength();

                        if (widgetfile != null) {
                            PsiReference ref = new FileReference(widgetfile, uri, element,
                                    new TextRange(start, start + len), project, protectedPathDir, protectedPathDir);
                            return new PsiReference[]{ref};
                        }
                        return PsiReference.EMPTY_ARRAY;
                    }
                }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

            String protectedPath = CommonHelper.searchCurrentProtected(path).replace(YiiPsiReferenceProvider.projectPath, "");
            VirtualFile baseDir = YiiPsiReferenceProvider.project.getBaseDir();
            if (protectedPath != null && baseDir != null) {
                path = path.replace(YiiPsiReferenceProvider.projectPath, "");
                String str = element.getText();
                TextRange textRange = CommonHelper.getTextRange(element, str);
                String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());

                VirtualFile protectedVirtual = baseDir.findFileByRelativePath(protectedPath);
                VirtualFile appDir = baseDir.findFileByRelativePath(path);
                if (uri.matches("^application.+")) {
                    uri = uri.replace("application.", "").replace(".", "/");
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

                        protectedPath = protectedPath.replace(projectPath, "")
                                .replaceAll("/controllers/[a-zA-Z0-9_]+?.(php|tpl)+", "");

                        Method method = elementClass.getMethod("getValueRange");
                        Object obj = method.invoke(element);
                        TextRange textRange = (TextRange) obj;
                        Class _PhpPsiElement = elementClass.getSuperclass().getSuperclass().getSuperclass();
                        Method phpPsiElementGetText = _PhpPsiElement.getMethod("getText");
                        Object obj2 = phpPsiElementGetText.invoke(element);
                        String str = obj2.toString();
                        String uri = str.substring(textRange.getStartOffset(), textRange.getEndOffset());
                        int start = textRange.getStartOffset();
                        int len = textRange.getLength();
                        String controllerName = YiiRefsHelper.getControllerClassName(path);


                        if (controllerName != null) {
                            if (baseDir != null) {
                                String inThemeFullPath = viewPathTheme + controllerName + "/" + uri
                                        + (uri.endsWith(".tpl") ? "" : ".php");
                                if (baseDir.findFileByRelativePath(inThemeFullPath) != null) {
                                    viewPath = viewPathTheme;
                                }
                                VirtualFile appDir = baseDir.findFileByRelativePath(viewPath);
                                VirtualFile protectedPathDir = (!protectedPath.equals("")) ?
                                        baseDir.findFileByRelativePath(protectedPath) : null;
                                if (appDir != null) {
                                    PsiReference ref = new ViewsReference(controllerName, uri, element,
                                            new TextRange(start, start + len), project, protectedPathDir, appDir);
                                    return new PsiReference[]{ref};
                                }
                            }
                            return PsiReference.EMPTY_ARRAY;
                        }
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

        if (selectionEvent.getNewRange().getLength() == 0) {
            return;
        }

        String text = editor.getDocument().getText();
        TextRange textRange = selectionEvent.getNewRange();

        // aufgrund selektiertem Text erstellen
        final String highlightText;
        if ((textRange.getStartOffset() != 0 || textRange.getEndOffset() != text.length()) && // fix issue 5: komplettem text ausschliessen
                BWACUtils.isStartEnd(text, textRange.getStartOffset(), textRange.getEndOffset(), false)) {
            highlightText = textRange.substring(text);
        } else {
            highlightText = null; // ansonsten löschen
        }
        SwingUtilities.invokeLater(new Runnable() {
            @Override
View Full Code Here

Examples of com.intellij.openapi.util.TextRange

    public Language getLanguage() {
        return SQLLanguage.INSTANCE;
    }

    public TextRange getTextRange() {
        return new TextRange(0, getText().length());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.