本文整理汇总了Java中com.intellij.openapi.editor.Document.removeDocumentListener方法的典型用法代码示例。如果您正苦于以下问题:Java Document.removeDocumentListener方法的具体用法?Java Document.removeDocumentListener怎么用?Java Document.removeDocumentListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.editor.Document
的用法示例。
在下文中一共展示了Document.removeDocumentListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeListener
import com.intellij.openapi.editor.Document; //导入方法依赖的package包/类
public static void removeListener(Document document) {
final EduDocumentListener listener = myDocumentListeners.get(document);
if (listener != null) {
document.removeDocumentListener(listener);
}
myDocumentListeners.remove(document);
}
示例2: switchStep
import com.intellij.openapi.editor.Document; //导入方法依赖的package包/类
/***
* @param toSubtaskIndex from 0 to subtaskNum - 1
*/
public static void switchStep(@NotNull Project project, @NotNull TaskWithSubtasks task, int toSubtaskIndex, boolean navigateToTask) {
if (toSubtaskIndex == task.getActiveSubtaskIndex()) {
return;
}
VirtualFile taskDir = task.getTaskDir(project);
if (taskDir == null) {
return;
}
VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
if (srcDir != null) {
taskDir = srcDir;
}
int fromSubtaskIndex = task.getActiveSubtaskIndex();
for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
String name = entry.getKey();
VirtualFile virtualFile = taskDir.findFileByRelativePath(name);
if (virtualFile == null) {
continue;
}
TaskFile taskFile = entry.getValue();
Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
if (document == null) {
continue;
}
EduDocumentListener listener = null;
if (!FileEditorManager.getInstance(project).isFileOpen(virtualFile)) {
listener = new EduDocumentListener(taskFile, true);
document.addDocumentListener(listener);
}
updatePlaceholderTexts(document, taskFile, fromSubtaskIndex, toSubtaskIndex);
if (listener != null) {
document.removeDocumentListener(listener);
}
UndoManager.getInstance(project).nonundoableActionPerformed(DocumentReferenceManager.getInstance().create(document), false);
EditorNotifications.getInstance(project).updateNotifications(virtualFile);
if (StudyUtils.isStudentProject(project)) {
WolfTheProblemSolver.getInstance(project).clearProblems(virtualFile);
taskFile.setHighlightErrors(false);
}
}
transformTestFile(project, toSubtaskIndex, taskDir);
task.setActiveSubtaskIndex(toSubtaskIndex);
updateUI(project, task, !CCUtils.isCourseCreator(project) && navigateToTask);
if (CCUtils.isCourseCreator(project)) {
updateOpenedTestFiles(project, taskDir, fromSubtaskIndex, toSubtaskIndex);
}
}