本文整理汇总了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);
}
}
});
}
示例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);
}
}
示例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);
}
});
}
示例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);
}
示例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();
}
示例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();
}
示例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));
}
示例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));
}