Java 类com.intellij.openapi.editor.colors.EditorColorsListener 实例源码

项目:intellij-ce-playground    文件:LineStatusTrackerManager.java   
@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 EditorColorsListener editorColorsListener = new MyEditorColorsListener();

      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);

      final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance();
      editorColorsManager.addEditorColorsListener(editorColorsListener, myDisposable);
    }
  });
}
项目:tools-idea    文件:DebuggerManagerImpl.java   
public DebuggerManagerImpl(Project project, StartupManager startupManager, final EditorColorsManager colorsManager) {
  myProject = project;
  myBreakpointManager = new BreakpointManager(myProject, startupManager, this);
  if (!project.isDefault()) {
    final EditorColorsListener colorsListener = new EditorColorsListener() {
      public void globalSchemeChange(EditorColorsScheme scheme) {
        getBreakpointManager().updateBreakpointsUI();
      }
    };
    colorsManager.addEditorColorsListener(colorsListener);
    Disposer.register(project, new Disposable() {
      public void dispose() {
        colorsManager.removeEditorColorsListener(colorsListener);
      }
    });
  }
}
项目:consulo    文件:EditorFactoryImpl.java   
public EditorFactoryImpl(EditorActionManager editorActionManager) {
  Application application = ApplicationManager.getApplication();
  MessageBus bus = application.getMessageBus();
  MessageBusConnection connect = bus.connect();
  connect.subscribe(ProjectLifecycleListener.TOPIC, new ProjectLifecycleListener() {
    @Override
    public void beforeProjectLoaded(@Nonnull final Project project) {
      // validate all editors are disposed after fireProjectClosed() was called, because it's the place where editor should be released
      Disposer.register(project, () -> {
        final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
        final boolean isLastProjectClosed = openProjects.length == 0;
        validateEditorsAreReleased(project, isLastProjectClosed);
      });
    }
  });

  ApplicationManager.getApplication().getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      refreshAllEditors();
    }
  });
  TypedAction typedAction = editorActionManager.getTypedAction();
  TypedActionHandler originalHandler = typedAction.getRawHandler();
  typedAction.setupRawHandler(new MyTypedHandler(originalHandler));
}
项目:consulo-java    文件:DebuggerManagerImpl.java   
public DebuggerManagerImpl(Project project, StartupManager startupManager)
{
    myProject = project;
    myBreakpointManager = new BreakpointManager(myProject, startupManager, this);
    if(!project.isDefault())
    {
        if(!project.isDefault())
        {
            DebuggerManagerListener[] extensions = DebuggerManagerListener.EP_NAME.getExtensions(project);
            for(DebuggerManagerListener extension : extensions)
            {
                myDispatcher.addListener(extension);
            }
        }

        project.getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener()
        {
            @Override
            public void globalSchemeChange(EditorColorsScheme scheme)
            {
                getBreakpointManager().updateBreakpointsUI();
            }
        });
    }
}
项目:intellij-ce-playground    文件:DebuggerManagerImpl.java   
public DebuggerManagerImpl(Project project, StartupManager startupManager, EditorColorsManager colorsManager) {
  myProject = project;
  myBreakpointManager = new BreakpointManager(myProject, startupManager, this);
  if (!project.isDefault()) {
    colorsManager.addEditorColorsListener(new EditorColorsListener() {
      @Override
      public void globalSchemeChange(EditorColorsScheme scheme) {
        getBreakpointManager().updateBreakpointsUI();
      }
    }, project);
  }
}
项目:intellij-ce-playground    文件:TodoConfiguration.java   
public TodoConfiguration(@NotNull MessageBus messageBus, EditorColorsManager manager) {
  myMessageBus = messageBus;
  manager.addEditorColorsListener(new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      colorSettingsChanged();
    }
  }, this);
  resetToDefaultTodoPatterns();
}
项目:intellij-ce-playground    文件:FileStatusManagerImpl.java   
public FileStatusManagerImpl(Project project, StartupManager startupManager, EditorColorsManager colorsManager,
                             @SuppressWarnings("UnusedParameters") DirectoryIndex makeSureIndexIsInitializedFirst) {
  myProject = project;

  colorsManager.addEditorColorsListener(new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      fileStatusesChanged();
    }
  }, myProject);

  startupManager.registerPreStartupActivity(new Runnable() {
    @Override
    public void run() {
      DocumentAdapter documentListener = new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent event) {
          VirtualFile file = FileDocumentManager.getInstance().getFile(event.getDocument());
          if (file != null) {
            refreshFileStatusFromDocument(file, event.getDocument());
          }
        }
      };

      final EditorFactory factory = EditorFactory.getInstance();
      if (factory != null) {
        factory.getEventMulticaster().addDocumentListener(documentListener, myProject);
      }
    }
  });
  startupManager.registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      fileStatusesChanged();
    }
  });
}
项目:intellij-ce-playground    文件:ExecutionPointHighlighter.java   
public ExecutionPointHighlighter(final Project project) {
  myProject = project;

  // Update highlighter colors if global color schema was changed
  final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
  if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
    colorsManager.addEditorColorsListener(new EditorColorsListener() {
      @Override
      public void globalSchemeChange(EditorColorsScheme scheme) {
        update(false);
      }
    }, project);
  }
}
项目:tools-idea    文件:DebuggerPanelsManager.java   
public DebuggerPanelsManager(Project project, final EditorColorsManager colorsManager, ExecutionManager executionManager) {
  myProject = project;
  myExecutionManager = executionManager;

  myEditorManager = new PositionHighlighter(myProject, getContextManager());

  final EditorColorsListener myColorsListener = new EditorColorsListener() {
    public void globalSchemeChange(EditorColorsScheme scheme) {
      myEditorManager.updateContextPointDescription();
    }
  };
  colorsManager.addEditorColorsListener(myColorsListener);
  Disposer.register(project, new Disposable() {
    public void dispose() {
      colorsManager.removeEditorColorsListener(myColorsListener);
    }
  });

  getContextManager().addListener(new DebuggerContextListener() {
    public void changeEvent(final DebuggerContextImpl newContext, int event) {
      if (event == DebuggerSession.EVENT_PAUSE) {
        DebuggerInvocationUtil.invokeLater(myProject, new Runnable() {
          public void run() {
            toFront(newContext.getDebuggerSession());
          }
        });
      }
    }
  });
}
项目:tools-idea    文件:LineStatusTrackerManager.java   
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 EditorColorsListener editorColorsListener = new EditorColorsListener() {
        public void globalSchemeChange(EditorColorsScheme scheme) {
          resetTrackersForOpenFiles();
        }
      };

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

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

      final VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
      virtualFileManager.addVirtualFileListener(virtualFileListener,myProject);

      final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance();
      editorColorsManager.addEditorColorsListener(editorColorsListener);

      Disposer.register(myDisposable, new Disposable() {
        public void dispose() {
          fsManager.removeFileStatusListener(fileStatusListener);
          virtualFileManager.removeVirtualFileListener(virtualFileListener);
          editorColorsManager.removeEditorColorsListener(editorColorsListener);
        }
      });
    }
  });
}
项目:consulo    文件:FileStatusManagerImpl.java   
public FileStatusManagerImpl(Project project, StartupManager startupManager, @SuppressWarnings("UnusedParameters") DirectoryIndex makeSureIndexIsInitializedFirst) {
  myProject = project;

  project.getMessageBus().connect().subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      fileStatusesChanged();
    }
  });

  if (project.isDefault()) return;

  startupManager.registerPreStartupActivity(() -> {
    DocumentAdapter documentListener = new DocumentAdapter() {
      @Override
      public void documentChanged(DocumentEvent event) {
        if (event.getOldLength() == 0 && event.getNewLength() == 0) return;
        VirtualFile file = FileDocumentManager.getInstance().getFile(event.getDocument());
        if (file != null) {
          refreshFileStatusFromDocument(file, event.getDocument());
        }
      }
    };

    final EditorFactory factory = EditorFactory.getInstance();
    if (factory != null) {
      factory.getEventMulticaster().addDocumentListener(documentListener, myProject);
    }
  });
  startupManager.registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      fileStatusesChanged();
    }
  });
}
项目:consulo    文件:ExecutionPointHighlighter.java   
public ExecutionPointHighlighter(final Project project) {
  myProject = project;

  // Update highlighter colors if global color schema was changed
  final EditorColorsManager colorsManager = EditorColorsManager.getInstance();
  if (colorsManager != null) { // in some debugger tests EditorColorsManager component isn't loaded
    colorsManager.addEditorColorsListener(new EditorColorsListener() {
      @Override
      public void globalSchemeChange(EditorColorsScheme scheme) {
        ExecutionPointHighlighter.this.update(false);
      }
    }, project);
  }
}
项目:educational-plugin    文件:StudyProjectComponent.java   
@Override
public void projectOpened() {
  // Check if user has javafx lib in his JDK. Now bundled JDK doesn't have this lib inside.
  if (StudyUtils.hasJavaFx()) {
    Platform.setImplicitExit(false);
  }

  StartupManager.getInstance(myProject).runWhenProjectIsInitialized(
    () -> {
      Course course = StudyTaskManager.getInstance(myProject).getCourse();
      if (course == null) {
        LOG.warn("Opened project is with null course");
        return;
      }

      if (!course.isAdaptive() && !course.isUpToDate()) {
        updateAvailable(course);
      }

      StudyUtils.registerStudyToolWindow(course, myProject);
      addStepicWidget();
      selectStep(course);

      ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(() -> {
          UISettings instance = UISettings.getInstance();
          instance.setHideToolStripes(false);
          instance.fireUISettingsChanged();
          registerShortcuts();
          EduUsagesCollector.projectTypeOpened(course.isAdaptive() ? EduNames.ADAPTIVE : EduNames.STUDY);
        }));
    }
  );

  myBusConnection = ApplicationManager.getApplication().getMessageBus().connect();
  myBusConnection.subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
    @Override
    public void globalSchemeChange(EditorColorsScheme scheme) {
      final StudyToolWindow toolWindow = StudyUtils.getStudyToolWindow(myProject);
      if (toolWindow != null) {
        toolWindow.updateFonts(myProject);
      }
    }
  });
}
项目:intellij-ce-playground    文件:EditorColorsManagerImpl.java   
@Override
public void addEditorColorsListener(@NotNull EditorColorsListener listener) {
  myListeners.addListener(listener);
}
项目:intellij-ce-playground    文件:EditorColorsManagerImpl.java   
@Override
public void addEditorColorsListener(@NotNull EditorColorsListener listener, @NotNull Disposable disposable) {
  myListeners.addListener(listener, disposable);
}
项目:intellij-ce-playground    文件:EditorColorsManagerImpl.java   
@Override
public void removeEditorColorsListener(@NotNull EditorColorsListener listener) {
  myListeners.removeListener(listener);
}
项目:tools-idea    文件:EditorColorsManagerImpl.java   
@Override
public void addEditorColorsListener(@NotNull EditorColorsListener listener) {
  myListeners.addListener(listener);
}
项目:tools-idea    文件:EditorColorsManagerImpl.java   
@Override
public void addEditorColorsListener(@NotNull EditorColorsListener listener, @NotNull Disposable disposable) {
  myListeners.addListener(listener, disposable);
}
项目:tools-idea    文件:EditorColorsManagerImpl.java   
@Override
public void removeEditorColorsListener(@NotNull EditorColorsListener listener) {
  myListeners.removeListener(listener);
}