本文整理匯總了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);
}
}