当前位置: 首页>>代码示例>>Java>>正文


Java Context.document方法代码示例

本文整理汇总了Java中org.netbeans.modules.editor.indent.spi.Context.document方法的典型用法代码示例。如果您正苦于以下问题:Java Context.document方法的具体用法?Java Context.document怎么用?Java Context.document使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.modules.editor.indent.spi.Context的用法示例。


在下文中一共展示了Context.document方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reformat

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public void reformat(Context context, ParserResult info) {
    final Context formatContext = context;
    final BaseDocument doc = (BaseDocument) context.document();

    doc.runAtomic(new Runnable() {
        @Override
        public void run() {

            final int caretOffset = EditorRegistry.lastFocusedComponent() != null
                    ? EditorRegistry.lastFocusedComponent().getCaretPosition()
                    : 0;

            MutableTextInput mti = (MutableTextInput) doc.getProperty(MutableTextInput.class);
            try {
                mti.tokenHierarchyControl().setActive(false);

            } finally {
                mti.tokenHierarchyControl().setActive(true);
            }
        }
    });

}
 
开发者ID:daimor,项目名称:NBStudio,代码行数:24,代码来源:macFormatter.java

示例2: process

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public void process(Context context) throws BadLocationException{
    if (context.isIndent()) {
        //
        // A temporary workaround for issue #178512
        BaseDocument doc = (BaseDocument)context.document();
        int firstLine = Utilities.getLineOffset(doc, context.startOffset());
        int lastLine = Utilities.getLineOffset(doc, context.endOffset());
        if (firstLine == lastLine) {
            enterPressed(context);
        } else {
            reformat(context);
        }
    } else {
        reformat(context);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TagBasedLexerFormatter.java

示例3: reformat

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public void reformat(Context context, final int startOffset, final int endOffset)
        throws BadLocationException {
    final BaseDocument doc = (BaseDocument) context.document();
    doc.runAtomic(new Runnable() {

        public void run() {
            doReformat(doc, startOffset, endOffset);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:XMLLexerFormatter.java

示例4: ContextIndent

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param context the current Apex file.
 */
public ContextIndent(Context context) {
    this.context = context;
    document = context.document();
    tokenHierarchy = TokenHierarchy.get(document);
    indentLevelSize = org.netbeans.modules.editor.indent.api.IndentUtils.indentLevelSize(document);
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:12,代码来源:ContextIndent.java

示例5: DocumentFormatter

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param context the current Apex file.
 * @param parserResult contains the tokens sequence of the Apex file
 */
public DocumentFormatter(Context context, ParserResult parserResult) {
    this.context = context;
    Document document = context.document();
    this.parserResult = (ApexParserResult) parserResult;
    contextIndent = new ContextIndent(context);
    Preferences preferences = CodeStylePreferences.get(document).getPreferences();
    bracesFormatter = new BracesFormatter(document, preferences, FormatOptions.getInstance());
    newLineFormatter = new NewLineFormatter(document);
    reformatTreeVisitor = new ReformatTreeVisitor(document,context.startOffset(), context.endOffset());
    optionsToReformat = new ArrayList<>();
    visitParserResult();
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:19,代码来源:DocumentFormatter.java

示例6: Reformatter

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public Reformatter(Source source, Context context) {
    this.source = source;
    this.context = context;
    this.doc = context.document();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:Reformatter.java

示例7: reformat

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public void reformat(Context context, int startOffset, int endOffset) throws BadLocationException {
    BaseDocument doc = (BaseDocument) context.document();
    doc.runAtomic(new FormattingTask(context, startOffset, endOffset));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:TagBasedLexerFormatter.java

示例8: enterPressed

import org.netbeans.modules.editor.indent.spi.Context; //导入方法依赖的package包/类
public void enterPressed(Context context) {
    BaseDocument doc = (BaseDocument)context.document();   
    doc.runAtomic(new EnterPressedTask(context));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:TagBasedLexerFormatter.java


注:本文中的org.netbeans.modules.editor.indent.spi.Context.document方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。