Examples of GoImportDeclaration


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

            return PsiReference.EMPTY_ARRAY;

        GoPackage goPackage = null;
        if (findChildByType(GoTokenTypes.oDOT) != null) {
            GoLiteralIdentifier identifiers[] = findChildrenByClass(GoLiteralIdentifier.class);
            GoImportDeclaration importDeclaration = GoPsiUtils.resolveSafely(identifiers[0], GoImportDeclaration.class);
            goPackage = importDeclaration != null ? importDeclaration.getPackage() : null;
        }

        if ( goPackage != null && goPackage == GoPackages.C )
            return PsiReference.EMPTY_ARRAY;
View Full Code Here

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

        if (imports.length == 0) {
            addImportUnderPackage(file, document, pathToImport);
            return;
        }

        GoImportDeclaration lastImport = imports[imports.length - 1];

        PsiElement lastChild = getPrevSiblingIfItsWhiteSpaceOrComment(importDeclarations.getLastChild());
        if (lastChild == null) {
            addImportUnderPackage(file, document, pathToImport);
            return;
        }

        if (")".equals(lastChild.getText())) {
            document.insertString(lastChild.getTextOffset(), "\"" + pathToImport + "\"\n");
            int line = document.getLineNumber(lastChild.getTextOffset());
            reformatLines(file, editor, line, line);
        } else {
            String oldImport = lastImport.getText();
            int start = lastImport.getTextOffset();
            int end = start + lastImport.getTextLength();
            String declarations = String.format("(\n%s\n\"%s\"\n)", oldImport, pathToImport);
            document.replaceString(start, end, declarations);
            reformatPositions(file, start, start + declarations.length());
        }
    }
View Full Code Here

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

        if (!(element instanceof GoImportDeclaration)) {
            return true;
        }

        GoImportDeclaration importSpec = (GoImportDeclaration) element;

        if (!GoResolveUtil.inSamePackage(qualifiedName, importSpec)) {
            return true;
        }

        GoLiteralString literalString = importSpec.getImportPath();
        if ( literalString == null )
            return true;

        String importPath = literalString.getValue();
View Full Code Here

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

                       @NotNull PsiElement startElement, @NotNull PsiElement endElement) {
        if (!(startElement instanceof GoImportDeclaration) || !(file instanceof GoFile)) {
            return;
        }

        GoImportDeclaration declaration = (GoImportDeclaration) startElement;
        final GoImportDeclarations declarations = (GoImportDeclarations) declaration.getParent();
        String removeImport = declaration.getText();
        if (removeImport == null) {
            return;
        }

        GoImportDeclaration[] da = declarations.getDeclarations();
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.