本文整理汇总了Java中com.intellij.openapi.editor.ex.DocumentEx.setInBulkUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentEx.setInBulkUpdate方法的具体用法?Java DocumentEx.setInBulkUpdate怎么用?Java DocumentEx.setInBulkUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.ex.DocumentEx
的用法示例。
在下文中一共展示了DocumentEx.setInBulkUpdate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSuccessiveBulkModeOperations
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
public void testSuccessiveBulkModeOperations() throws Exception {
initText("some text");
DocumentEx document = (DocumentEx)myEditor.getDocument();
document.setInBulkUpdate(true);
document.replaceString(4, 5, "-");
document.setInBulkUpdate(false);
myEditor.getCaretModel().moveToOffset(9);
document.setInBulkUpdate(true);
document.replaceString(4, 5, "+");
document.setInBulkUpdate(false);
checkResultByText("some+text<caret>");
}
示例2: setDone
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
@Override
protected void setDone(boolean done) {
super.setDone(done);
if (myResetBulkUpdateState) {
DocumentEx document = getAffectedDocument(myModel);
if (document != null) {
document.setInBulkUpdate(false);
myResetBulkUpdateState = false;
}
}
if (done) {
myModel.commitChanges();
}
}
示例3: testNoExceptionDuringBulkModeDocumentUpdate
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
public void testNoExceptionDuringBulkModeDocumentUpdate() throws Exception {
initText("something");
DocumentEx document = (DocumentEx)myEditor.getDocument();
document.setInBulkUpdate(true);
try {
document.setText("something\telse");
}
finally {
document.setInBulkUpdate(false);
}
checkResultByText("something\telse");
}
示例4: testSoftWrapModeUpdateDuringBulkModeChange
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
public void testSoftWrapModeUpdateDuringBulkModeChange() throws Exception {
initText("long long line<caret>");
configureSoftWraps(12);
DocumentEx document = (DocumentEx)myEditor.getDocument();
document.setInBulkUpdate(true);
document.replaceString(4, 5, "-");
document.setInBulkUpdate(false);
assertEquals(new VisualPosition(1, 5), myEditor.getCaretModel().getVisualPosition());
}
示例5: prepare
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
@Override
public void prepare() {
myBlocksToModify = collectBlocksToModify();
// call doModifications static method to ensure no access to state
// thus we may clear formatting state
//reset();
//myDisposed = true;
if (myBlocksToModify.isEmpty()) {
setDone(true);
return;
}
myProgressCallback.beforeApplyingFormatChanges(myBlocksToModify);
final int blocksToModifyCount = myBlocksToModify.size();
if (blocksToModifyCount > BULK_REPLACE_OPTIMIZATION_CRITERIA) {
applyChangesAtRewriteMode(myBlocksToModify, myModel);
setDone(true);
}
else if (blocksToModifyCount > 50) {
DocumentEx updatedDocument = getAffectedDocument(myModel);
if (updatedDocument != null) {
updatedDocument.setInBulkUpdate(true);
myResetBulkUpdateState = true;
}
}
}
示例6: prepare
import com.intellij.openapi.editor.ex.DocumentEx; //导入方法依赖的package包/类
@Override
protected void prepare() {
myBlocksToModify = collectBlocksToModify();
// call doModifications static method to ensure no access to state
// thus we may clear formatting state
reset();
myInfos = null;
myRootBlockWrapper = null;
myTextRangeToWrapper = null;
myPreviousDependencies = null;
myLastWhiteSpace = null;
myFirstTokenBlock = null;
myLastTokenBlock = null;
myDisposed = true;
if (myBlocksToModify.isEmpty()) {
setDone(true);
return;
}
//for GeneralCodeFormatterTest
if (myJavaIndentOptions == null) {
myJavaIndentOptions = mySettings.getIndentOptions(StdFileTypes.JAVA);
}
myProgressCallback.beforeApplyingFormatChanges(myBlocksToModify);
final int blocksToModifyCount = myBlocksToModify.size();
final boolean bulkReformat = blocksToModifyCount > 50;
DocumentEx updatedDocument = bulkReformat ? getAffectedDocument(myModel) : null;
if (updatedDocument != null) {
updatedDocument.setInBulkUpdate(true);
myResetBulkUpdateState = true;
}
if (blocksToModifyCount > BULK_REPLACE_OPTIMIZATION_CRITERIA
&& applyChangesAtRewriteMode(myBlocksToModify, myModel, myDefaultIndentOption))
{
setDone(true);
}
}