Java 类com.intellij.openapi.editor.event.EditorFactoryAdapter 实例源码

项目:intellij-ce-playground    文件:TemplateManagerImpl.java   
public TemplateManagerImpl(Project project) {
  myProject = project;
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@NotNull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState state = getTemplateState(editor);
      if (state != null) {
        state.gotoEnd();
      }
      clearTemplateState(editor);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
项目:tools-idea    文件:TemplateManagerImpl.java   
@Override
public void projectOpened() {
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@NotNull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState tState = getTemplateState(editor);
      if (tState != null) {
        tState.gotoEnd();
      }
      editor.putUserData(TEMPLATE_STATE_KEY, null);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
项目:consulo    文件:EncodingManagerImpl.java   
public EncodingManagerImpl(@Nonnull EditorFactory editorFactory) {
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      Document document = e.getDocument();
      if (isEditorOpenedFor(document)) {
        queueUpdateEncodingFromContent(document);
      }
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@Nonnull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
项目:consulo    文件:EditorUtil.java   
public static void disposeWithEditor(@Nonnull Editor editor, @Nonnull Disposable disposable) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (Disposer.isDisposed(disposable)) return;
  if (editor.isDisposed()) {
    Disposer.dispose(disposable);
    return;
  }
  // for injected editors disposal will happen only when host editor is disposed,
  // but this seems to be the best we can do (there are no notifications on disposal of injected editor)
  Editor hostEditor = editor instanceof EditorWindow ? ((EditorWindow)editor).getDelegate() : editor;
  EditorFactory.getInstance().addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@Nonnull EditorFactoryEvent event) {
      if (event.getEditor() == hostEditor) {
        Disposer.dispose(disposable);
      }
    }
  }, disposable);
}
项目:consulo    文件:TemplateManagerImpl.java   
public TemplateManagerImpl(Project project) {
  myProject = project;
  final EditorFactoryListener myEditorFactoryListener = new EditorFactoryAdapter() {
    @Override
    public void editorReleased(@Nonnull EditorFactoryEvent event) {
      Editor editor = event.getEditor();
      if (editor.getProject() != null && editor.getProject() != myProject) return;
      if (myProject.isDisposed() || !myProject.isOpen()) return;
      TemplateState state = getTemplateState(editor);
      if (state != null) {
        state.gotoEnd();
      }
      clearTemplateState(editor);
    }
  };
  EditorFactory.getInstance().addEditorFactoryListener(myEditorFactoryListener, myProject);
}
项目:intellij-ce-playground    文件:EncodingManagerImpl.java   
public EncodingManagerImpl(@NotNull EditorFactory editorFactory) {
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      queueUpdateEncodingFromContent(e.getDocument());
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@NotNull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
项目:intellij-ce-playground    文件:XmlTagNameSynchronizer.java   
public XmlTagNameSynchronizer(EditorFactory editorFactory, FileDocumentManager manager, CommandProcessor processor) {
  myFileDocumentManager = manager;
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@NotNull EditorFactoryEvent event) {
      installSynchronizer(event.getEditor());
    }
  }, ApplicationManager.getApplication());
  processor.addCommandListener(this);
}
项目:tools-idea    文件:EncodingManagerImpl.java   
public EncodingManagerImpl(@NotNull EditorFactory editorFactory) {
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      queueUpdateEncodingFromContent(e.getDocument());
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryAdapter() {
    @Override
    public void editorCreated(@NotNull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
项目:consulo-xml    文件:XmlTagNameSynchronizer.java   
public XmlTagNameSynchronizer(EditorFactory editorFactory, FileDocumentManager manager, CommandProcessor processor)
{
    myFileDocumentManager = manager;
    editorFactory.addEditorFactoryListener(new EditorFactoryAdapter()
    {
        @Override
        public void editorCreated(@NotNull EditorFactoryEvent event)
        {
            installSynchronizer(event.getEditor());
        }
    }, ApplicationManager.getApplication());
    processor.addCommandListener(this);
}