com.intellij.openapi.editor.event.EditorFactoryListener Java Examples

The following examples show how to use com.intellij.openapi.editor.event.EditorFactoryListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LineStatusTrackerManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void projectOpened() {
  StartupManager.getInstance(myProject).registerPreStartupActivity(new Runnable() {
    @Override
    public void run() {
      final MyFileStatusListener fileStatusListener = new MyFileStatusListener();
      final EditorFactoryListener editorFactoryListener = new MyEditorFactoryListener();
      final MyVirtualFileListener virtualFileListener = new MyVirtualFileListener();

      final FileStatusManager fsManager = FileStatusManager.getInstance(myProject);
      fsManager.addFileStatusListener(fileStatusListener, myDisposable);

      final EditorFactory editorFactory = EditorFactory.getInstance();
      editorFactory.addEditorFactoryListener(editorFactoryListener, myDisposable);

      final VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
      virtualFileManager.addVirtualFileListener(virtualFileListener, myDisposable);
    }
  });
}
 
Example #2
Source File: EncodingManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
public EncodingManagerImpl() {
  ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
    @Override
    public void appClosing() {
      // should call before dispose in write action
      // prevent any further re-detection and wait for the queue to clear
      myDisposed.set(true);
      clearDocumentQueue();
    }
  });

  EditorFactory editorFactory = EditorFactory.getInstance();
  editorFactory.getEventMulticaster().addDocumentListener(new DocumentListener() {
    @Override
    public void documentChanged(@Nonnull DocumentEvent e) {
      Document document = e.getDocument();
      if (isEditorOpenedFor(document)) {
        queueUpdateEncodingFromContent(document);
      }
    }
  }, this);
  editorFactory.addEditorFactoryListener(new EditorFactoryListener() {
    @Override
    public void editorCreated(@Nonnull EditorFactoryEvent event) {
      queueUpdateEncodingFromContent(event.getEditor().getDocument());
    }
  }, this);
}
 
Example #3
Source File: MockEditorFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addEditorFactoryListener(@Nonnull EditorFactoryListener listener) {
}
 
Example #4
Source File: MockEditorFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addEditorFactoryListener(@Nonnull EditorFactoryListener listener, @Nonnull Disposable parentDisposable) {
}
 
Example #5
Source File: MockEditorFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void removeEditorFactoryListener(@Nonnull EditorFactoryListener listener) {
}
 
Example #6
Source File: EditorFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Deprecated
public void addEditorFactoryListener(@Nonnull EditorFactoryListener listener) {
  myEditorFactoryEventDispatcher.addListener(listener);
}
 
Example #7
Source File: EditorFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addEditorFactoryListener(@Nonnull EditorFactoryListener listener, @Nonnull Disposable parentDisposable) {
  myEditorFactoryEventDispatcher.addListener(listener, parentDisposable);
}
 
Example #8
Source File: EditorFactoryImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Deprecated
public void removeEditorFactoryListener(@Nonnull EditorFactoryListener listener) {
  myEditorFactoryEventDispatcher.removeListener(listener);
}
 
Example #9
Source File: EditorFactory.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Registers a listener for receiving notifications when editor instances are created
 * and released.
 *
 * @deprecated use the {@link #addEditorFactoryListener(EditorFactoryListener, Disposable)} instead
 */
@Deprecated
public abstract void addEditorFactoryListener(@Nonnull EditorFactoryListener listener);
 
Example #10
Source File: EditorFactory.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Registers a listener for receiving notifications when editor instances are created and released
 * and removes the listener when the {@code parentDisposable} gets disposed.
 */
public abstract void addEditorFactoryListener(@Nonnull EditorFactoryListener listener, @Nonnull Disposable parentDisposable);
 
Example #11
Source File: EditorFactory.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Un-registers a listener for receiving notifications when editor instances are created
 * and released.
 *
 * @deprecated you should have used the {@link #addEditorFactoryListener(EditorFactoryListener, Disposable)} instead
 */
@Deprecated
public abstract void removeEditorFactoryListener(@Nonnull EditorFactoryListener listener);