Package com.intellij.formatting

Examples of com.intellij.formatting.Block


    final String text = editor != null ? editor.getDocument().getText() : "";
    final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
    MathematicaFormattingModelBuilder modelBuilder = new MathematicaFormattingModelBuilder();
    final PsiFile file = PsiFileFactory.getInstance(project).createFileFromText("a.m", MathematicaLanguage.INSTANCE, text);
    final FormattingModel model = modelBuilder.createModel(file.getNode().getPsi(), settings);
    final Block rootBlock = model.getRootBlock();
    final String blockText = printBlock((AbstractBlock) rootBlock, text);

    JTextArea textArea = new JTextArea(blockText);
    final JScrollPane pane = new JScrollPane(textArea);
    dialogBuilder.setCenterPanel(pane);
View Full Code Here


    private static final Logger LOG = Logger.getInstance("ideah.formatter.HaskellFormattingModelBuilder");

    @NotNull
    public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
        Block root = null;
        try {
            root = doCreateModel(element);
        } catch (Exception ex) {
            LOG.error(ex);
        }
View Full Code Here

    public ChildAttributes getChildAttributes(final int newChildIndex) {
        List<Block> subBlocks = getSubBlocks();
        if (newChildIndex > subBlocks.size() - 1) {
            return new ChildAttributes(Indent.getNoneIndent(), Alignment.createAlignment());
        } else {
            Block child = getSubBlocks().get(newChildIndex);
            return new ChildAttributes(child.getIndent(), child.getAlignment());
        }
    }
View Full Code Here

        }
        return false;
    }

    private boolean isPreviousIncomplete() {
        Block previous = getPreviousBlockInParent();
        return previous != null && previous.isIncomplete();
    }
View Full Code Here

        boolean deliberate = CommonUtil.isCalledThrough(CodeFormatterFacade.class);
        if (deliberate && settings.getCaseSettings().isEnabled()) {
            DBLCodeStyleManager.getInstance(element.getProject()).formatCase(element.getContainingFile());
        }

        Block rootBlock = deliberate && settings.getFormattingSettings().isEnabled() ?
                new FormattingBlock(codeStyleSettings, settings, element, null, 0) :
                new PassiveFormattingBlock(element);
        return FormattingModelProvider.createFormattingModelForPsiFile(psiFile, rootBlock, codeStyleSettings);
    }
View Full Code Here

            (TreeElement) SourceTreeToPsiMap.psiElementToTree(element));

        CommonCodeStyleSettings goSettings =
            settings.getCommonSettings(GoLanguage.INSTANCE);

        Block block = GoBlockGenerator.generateBlock(fileElement, goSettings);

        return FormattingModelProvider
            .createFormattingModelForPsiFile(element.getContainingFile(),
                                             block, settings);
    }
View Full Code Here

                    children.add(new GoTypeStructFieldBlock(child, fieldAlignment, Indent.getNormalIndent(), mySettings));
                }
                continue;
            }

            Block childBlock;
            if (getIndentedElements().contains(type)) {
                childBlock = GoBlockGenerator.generateBlock(child, Indent.getNormalIndent(), mySettings);
            } else {
                childBlock = GoBlockGenerator.generateBlock(child, mySettings);
            }
View Full Code Here

                newLinesAfterLastComment = 0;
                children.add(GoBlockGenerator.generateBlock(child, commentAlignment, mySettings));
                continue;
            }

            Block childBlock;
            if (getIndentedElements().contains(type)) {
                childBlock = GoBlockGenerator.generateBlock(child, Indent.getNormalIndent(), mySettings);
            } else {
                childBlock = GoBlockGenerator.generateBlock(child, mySettings);
            }
View Full Code Here

                newLinesAfterLastComment = 0;
                children.add(GoBlockGenerator.generateBlock(child, commentAlignment, mySettings));
                continue;
            }

            Block childBlock;
            if (getIndentedElements().contains(type)) {
                childBlock =
                    GoBlockGenerator.generateBlock(
                        child, Indent.getNormalIndent(), mySettings);
            } else {
View Full Code Here

    @Override
    protected List<Block> buildChildren() {
        List<Block> children = new ArrayList<Block>();
        for (ASTNode child : getGoChildren()) {
            Block block;
            Indent indent = Indent.getNormalIndent();
            if (isWhiteSpaceNode(child.getPsi())) {
                continue;
            }
View Full Code Here

TOP

Related Classes of com.intellij.formatting.Block

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.