Examples of GoPackageDeclaration


Examples of ro.redeul.google.go.lang.psi.toplevel.GoPackageDeclaration

        }
    }

    private static String getFilePackageName(PsiFile file) {
        if (file instanceof GoFile) {
            GoPackageDeclaration currentPackage = ((GoFile) file).getPackage();
            if (currentPackage != null) {
                return currentPackage.getPackageName();
            }
        }
        return "";
    }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoPackageDeclaration

    }

    @Override
    protected void doCheckFile(@NotNull GoFile file, @NotNull InspectionResult result) {

        GoPackageDeclaration packageDeclaration = file.getPackage();

        if (packageDeclaration.isMainPackage())
            return;

        String packageName = packageDeclaration.getPackageName();

        VirtualFile virtualFile = file.getVirtualFile();

        if (virtualFile == null)
            return;
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoPackageDeclaration

        // If import statements exist, put new variable statement under last import statement.
        // Otherwise, put new variable statement under package statement
        if (imports.length != 0) {
            position = imports[imports.length - 1].getTextRange().getEndOffset();
        } else {
            GoPackageDeclaration packageDeclaration = goFile.getPackage();
            if (packageDeclaration != null) {
                position = packageDeclaration.getTextRange().getEndOffset();
            }
        }

        String variableName = element.getText();
        String decl = String.format("\nvar (\n%s = $%s$\n)\n", variableName, VARIABLE);
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoPackageDeclaration

                           "is null when called from inspection") final Editor editor,
                       @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
        if (!(startElement instanceof GoPackageDeclaration))
            return;

        final GoPackageDeclaration packageDeclaration = (GoPackageDeclaration) startElement;


        ApplicationManager.getApplication().runWriteAction(new Runnable() {
            @Override
            public void run() {
                Document doc =
                    PsiDocumentManager.getInstance(project).getDocument(file);

                if (doc == null) {
                    return;
                }

                TextRange textRange = packageDeclaration.getTextRange();

                doc.replaceString(textRange.getStartOffset(),
                                  textRange.getEndOffset(),
                                  "package " + targetPackage);
            }
View Full Code Here

Examples of ro.redeul.google.go.lang.psi.toplevel.GoPackageDeclaration

    private static String getPackageName(GoFile file) {
        if (file == null) {
            return "";
        }

        GoPackageDeclaration pkg = file.getPackage();
        return pkg == null ? "" : pkg.getPackageName();
    }
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.