Java 类com.intellij.ui.EditorNotifications 实例源码

项目:intellij-ce-playground    文件:DetectedIndentOptionsNotificationProvider.java   
public static void updateIndentNotification(@NotNull PsiFile file, boolean enforce) {
  VirtualFile vFile = file.getVirtualFile();
  if (vFile == null) return;

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()
      || ApplicationManager.getApplication().isUnitTestMode() && myShowNotificationInTest)
  {
    Project project = file.getProject();
    FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
    FileEditor fileEditor = fileEditorManager.getSelectedEditor(vFile);
    if (fileEditor != null) {
      Boolean notifiedFlag = fileEditor.getUserData(NOTIFIED_FLAG);
      if (notifiedFlag == null || enforce) {
        fileEditor.putUserData(NOTIFIED_FLAG, Boolean.TRUE);
        EditorNotifications.getInstance(project).updateNotifications(vFile);
      }
    }
  }
}
项目:intellij-ce-playground    文件:GradleSyncState.java   
public void notifyUser() {
  invokeLaterIfProjectAlive(myProject, new Runnable() {
    @Override
    public void run() {
      EditorNotifications notifications = EditorNotifications.getInstance(myProject);
      VirtualFile[] files = FileEditorManager.getInstance(myProject).getOpenFiles();
      for (VirtualFile file : files) {
        try {
          notifications.updateNotifications(file);
        }
        catch (Throwable e) {
          String filePath = toSystemDependentName(file.getPath());
          String msg = String.format("Failed to update editor notifications for file '%1$s'", filePath);
          LOG.info(msg, e);
        }
      }

      BuildVariantView.getInstance(myProject).updateContents();
    }
  });
}
项目:intellij-ce-playground    文件:ConfigureGroovyLibraryNotificationProvider.java   
public ConfigureGroovyLibraryNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });

  supportedFileTypes = new HashSet<FileType>();
  supportedFileTypes.add(GroovyFileType.GROOVY_FILE_TYPE);

  for (GroovyFrameworkConfigNotification configNotification : GroovyFrameworkConfigNotification.EP_NAME.getExtensions()) {
    Collections.addAll(supportedFileTypes, configNotification.getFrameworkFileTypes());
  }
}
项目:tools-idea    文件:ConfigureGroovyLibraryNotificationProvider.java   
public ConfigureGroovyLibraryNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });

  supportedFileTypes = new HashSet<FileType>();
  supportedFileTypes.add(GroovyFileType.GROOVY_FILE_TYPE);

  for (GroovyFrameworkConfigNotification configNotification : GroovyFrameworkConfigNotification.EP_NAME.getExtensions()) {
    Collections.addAll(supportedFileTypes, configNotification.getFrameworkFileTypes());
  }
}
项目:consulo    文件:BackgroundTaskByVfsChangeManageDialog.java   
@Override
protected void doOKAction() {
  if (myPrevTask != null) {
    myVfsChangePanel.applyTo(myPrevTask.getParameters());
  }

  BackgroundTaskByVfsChangeManager vfsChangeManager = BackgroundTaskByVfsChangeManager.getInstance(myProject);

  List<BackgroundTaskByVfsChangeTask> originalTasks = vfsChangeManager.findTasks(myVirtualFile);
  for (BackgroundTaskByVfsChangeTask originalTask : originalTasks) {
    vfsChangeManager.removeTask(originalTask);
  }

  List<BackgroundTaskByVfsChangeTask> tasks = getTasks();
  for (BackgroundTaskByVfsChangeTask task : tasks) {
    vfsChangeManager.registerTask(task);
  }
  EditorNotifications.updateAll();
  super.doOKAction();
}
项目:consulo    文件:PsiAwareTextEditorImpl.java   
@Nonnull
@Override
protected Runnable loadEditorInBackground() {
  Runnable baseAction = super.loadEditorInBackground();
  PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile);
  Document document = FileDocumentManager.getInstance().getDocument(myFile);
  CodeFoldingState foldingState = document != null && !myProject.isDefault()
                                  ? CodeFoldingManager.getInstance(myProject).buildInitialFoldings(document)
                                  : null;
  return () -> {
    baseAction.run();
    if (foldingState != null) {
      foldingState.setToEditor(getEditor());
    }
    if (psiFile != null && psiFile.isValid()) {
      DaemonCodeAnalyzer.getInstance(myProject).restart(psiFile);
    }
    EditorNotifications.getInstance(myProject).updateNotifications(myFile);
  };
}
项目:consulo    文件:DetectedIndentOptionsNotificationProvider.java   
public static void updateIndentNotification(@Nonnull PsiFile file, boolean enforce) {
  VirtualFile vFile = file.getVirtualFile();
  if (vFile == null) return;

  if (!ApplicationManager.getApplication().isHeadlessEnvironment()
      || ApplicationManager.getApplication().isUnitTestMode() && myShowNotificationInTest)
  {
    Project project = file.getProject();
    FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
    if (fileEditorManager == null) return;
    FileEditor fileEditor = fileEditorManager.getSelectedEditor(vFile);
    if (fileEditor != null) {
      Boolean notifiedFlag = fileEditor.getUserData(NOTIFIED_FLAG);
      if (notifiedFlag == null || enforce) {
        fileEditor.putUserData(NOTIFIED_FLAG, Boolean.TRUE);
        EditorNotifications.getInstance(project).updateNotifications(vFile);
      }
    }
  }
}
项目:intellij-ce-playground    文件:SetupSDKNotificationProvider.java   
public SetupSDKNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:intellij-ce-playground    文件:AttachSourcesNotificationProvider.java   
public AttachSourcesNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:intellij-ce-playground    文件:ForcedSoftWrapsNotificationProvider.java   
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
  if (!(fileEditor instanceof TextEditor)) return null;
  final Editor editor = ((TextEditor)fileEditor).getEditor();
  final Project project = editor.getProject();
  if (project == null 
      || !Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS)) 
      || PropertiesComponent.getInstance().isTrueValue(DISABLED_NOTIFICATION_KEY)) return null;

  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(EditorBundle.message("forced.soft.wrap.message"));
  panel.createActionLabel(EditorBundle.message("forced.soft.wrap.hide.message"), new Runnable() {
    @Override
    public void run() {
      editor.putUserData(EditorImpl.FORCED_SOFT_WRAPS, null);
      EditorNotifications.getInstance(project).updateNotifications(file);
    }
  });
  panel.createActionLabel(EditorBundle.message("forced.soft.wrap.dont.show.again.message"), new Runnable() {
    @Override
    public void run() {
      PropertiesComponent.getInstance().setValue(DISABLED_NOTIFICATION_KEY, "true");
      EditorNotifications.getInstance(project).updateAllNotifications();
    }
  });
  return panel;
}
项目:intellij-ce-playground    文件:FileChangedNotificationProvider.java   
private EditorNotificationPanel createPanel(@NotNull final VirtualFile file) {
  EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(IdeBundle.message("file.changed.externally.message"));
  panel.createActionLabel(IdeBundle.message("file.changed.externally.reload"), new Runnable() {
    @Override
    public void run() {
      if (!myProject.isDisposed()) {
        file.refresh(false, false);
        EditorNotifications.getInstance(myProject).updateNotifications(file);
      }
    }
  });
  return panel;
}
项目:intellij-ce-playground    文件:NonProjectFileAccessTest.java   
@Override
public void setUp() throws Exception {
  super.setUp();
  EditorNotifications notifications = new EditorNotificationsImpl(getProject());
  ((ComponentManagerImpl)getProject()).registerComponentInstance(EditorNotifications.class, notifications);
  NonProjectFileWritingAccessProvider.enableChecksInTests(getProject(), true);
  ProjectManagerEx.getInstanceEx().blockReloadingProjectOnExternalChanges();
}
项目:intellij-ce-playground    文件:AttachAndroidSdkSourcesNotificationProvider.java   
public AttachAndroidSdkSourcesNotificationProvider(@NotNull Project project, @NotNull final EditorNotifications notifications) {
  myProject = project;
  myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:intellij-ce-playground    文件:UseDistributionWithSourcesNotificationProvider.java   
public UseDistributionWithSourcesNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:intellij-ce-playground    文件:EditorConfigNotifierProvider.java   
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
  if (!(fileEditor instanceof TextEditor)) return null;
  final Project project = ((TextEditor)fileEditor).getEditor().getProject();
  final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
  if (!Utils.isEnabled(settings) || PropertiesComponent.getInstance(project).getBoolean(EDITOR_CONFIG_ACCEPTED)) return null;

  final List<EditorConfig.OutPair> pairs = SettingsProviderComponent.getInstance().getOutPairs(project, Utils.getFilePath(project, file));
  if (!pairs.isEmpty()) {
    final EditorNotificationPanel panel = new EditorNotificationPanel() {
      @Override
      public Color getBackground() {
        return LightColors.GREEN;
      }
    }.text("EditorConfig is overriding Code Style settings for this file").
      icon(EditorconfigIcons.Editorconfig);
    panel.createActionLabel("OK", new Runnable() {
      @Override
      public void run() {
        PropertiesComponent.getInstance(project).setValue(EDITOR_CONFIG_ACCEPTED, true);
        EditorNotifications.getInstance(project).updateAllNotifications();
      }
    });
    panel.createActionLabel("Disable EditorConfig support", new Runnable() {
      @Override
      public void run() {
        settings.getCustomSettings(EditorConfigSettings.class).ENABLED = false;
        EditorNotifications.getInstance(project).updateAllNotifications();
      }
    });
    return panel;
  }
  return null;
}
项目:intellij    文件:AdditionalLanguagesHelper.java   
public AdditionalLanguagesHelper(Project project, final EditorNotifications notifications) {
  this.project = project;
  this.notifications = notifications;

  for (LanguageClass langauge : LanguageClass.values()) {
    if (PropertiesComponent.getInstance(project).getBoolean(propertyKey(langauge))) {
      notifiedLanguages.add(langauge);
    }
  }
}
项目:intellij    文件:BlazeUserSettings.java   
public void setShowAddFileToProjectNotification(boolean showAddFileToProjectNotification) {
  if (this.showAddFileToProjectNotification == showAddFileToProjectNotification) {
    return;
  }
  this.showAddFileToProjectNotification = showAddFileToProjectNotification;
  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    EditorNotifications.getInstance(project).updateAllNotifications();
  }
}
项目:squirrel-lang-idea-plugin    文件:WrongSdkConfigurationNotificationProvider.java   
public WrongSdkConfigurationNotificationProvider(@NotNull Project project, @NotNull final EditorNotifications notifications) {
  myProject = project;
  MessageBusConnection connection = myProject.getMessageBus().connect(project);
  connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:js-graphql-intellij-plugin    文件:JSGraphQLLineMarkerProvider.java   
private LineMarkerInfo createLineMarkerInfo(PsiElement element, Ref<String> envRef) {
    final Icon icon;
    final String tooltip;
    final String url;
    boolean configureGQL = false;
    if(JSGraphQLLanguageInjectionUtil.RELAY_ENVIRONMENT.equals(envRef.get())) {
        icon = JSGraphQLIcons.Logos.Relay;
        tooltip = "Relay GraphQL Template";
        url = "https://facebook.github.io/relay/docs/api-reference-relay-ql.html";
    } else if(JSGraphQLLanguageInjectionUtil.GRAPHQL_ENVIRONMENT.equals(envRef.get())) {
        icon = JSGraphQLIcons.Logos.GraphQL;
        tooltip = "GraphQL";
        url = "http://graphql.org/";
    } else if(JSGraphQLLanguageInjectionUtil.APOLLO_ENVIRONMENT.equals(envRef.get())) {
        icon = JSGraphQLIcons.Logos.Apollo;
        tooltip = "Apollo Client GraphQL Template";
        url = "http://docs.apollostack.com/apollo-client/core.html";
        configureGQL = true;
    } else if(JSGraphQLLanguageInjectionUtil.LOKKA_ENVIRONMENT.equals(envRef.get())) {
        icon = JSGraphQLIcons.Logos.Lokka;
        tooltip = "Lokka GraphQL Template";
        url = "https://github.com/kadirahq/lokka";
        configureGQL = true;
    } else {
        return null;
    }
    if(configureGQL && !JSGraphQLLanguageInjectionUtil.isGQLEnvironmentConfigured(element.getProject())) {
        EditorNotifications.getInstance(element.getProject()).updateNotifications(element.getContainingFile().getVirtualFile());
    }
    return new LineMarkerInfo<>(element, element.getTextRange(), icon, Pass.UPDATE_ALL, o -> tooltip, (e, elt) -> {
        BrowserUtil.browse(url);
    }, GutterIconRenderer.Alignment.CENTER);
}
项目:consulo-unity3d    文件:SetupUnitySDKProvider.java   
public SetupUnitySDKProvider(Project project, final EditorNotifications notifications)
{
    myProject = project;
    myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter()
    {
        @Override
        public void rootsChanged(ModuleRootEvent event)
        {
            notifications.updateAllNotifications();
        }
    });
    myProject.getMessageBus().connect().subscribe(ModuleExtension.CHANGE_TOPIC, (oldExtension, newExtension) -> notifications.updateAllNotifications());
}
项目:tools-idea    文件:SetupSDKNotificationProvider.java   
public SetupSDKNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:tools-idea    文件:AttachSourcesNotificationProvider.java   
public AttachSourcesNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    public void rootsChanged(ModuleRootEvent event) {
      notifications.updateAllNotifications();
    }
  });
}
项目:tools-idea    文件:FileChangedNotificationProvider.java   
public FileChangedNotificationProvider(@NotNull Project project, @NotNull FrameStateManager frameStateManager) {
  myProject = project;

  frameStateManager.addListener(new FrameStateListener.Adapter() {
    @Override
    public void onFrameActivated() {
      if (!myProject.isDisposed() && !GeneralSettings.getInstance().isSyncOnFrameActivation()) {
        EditorNotifications notifications = EditorNotifications.getInstance(myProject);
        for (VirtualFile file : FileEditorManager.getInstance(myProject).getSelectedFiles()) {
          notifications.updateNotifications(file);
        }
      }
    }
  }, project);
}
项目:tools-idea    文件:FileChangedNotificationProvider.java   
private EditorNotificationPanel createPanel(@NotNull final VirtualFile file) {
  EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(IdeBundle.message("file.changed.externally.message"));
  panel.createActionLabel(IdeBundle.message("file.changed.externally.reload"), new Runnable() {
    @Override
    public void run() {
      if (!myProject.isDisposed()) {
        RefreshQueue.getInstance().refresh(false, false, null, file);
        EditorNotifications.getInstance(myProject).updateNotifications(file);
      }
    }
  });
  return panel;
}
项目:idea-gitignore    文件:AddUnversionedFilesNotificationProvider.java   
/**
 * Builds a new instance of {@link AddUnversionedFilesNotificationProvider}.
 *
 * @param project       current project
 * @param notifications notifications component
 */
public AddUnversionedFilesNotificationProvider(@NotNull Project project,
                                               @NotNull EditorNotifications notifications) {
    this.project = project;
    this.notifications = notifications;
    this.settings = IgnoreSettings.getInstance();
}
项目:idea-gitignore    文件:IgnoredEditingNotificationProvider.java   
/**
 * Builds a new instance of {@link IgnoredEditingNotificationProvider}.
 *
 * @param project       current project
 * @param notifications notifications component
 */
public IgnoredEditingNotificationProvider(@NotNull Project project, @NotNull EditorNotifications notifications) {
    this.project = project;
    this.notifications = notifications;
    this.settings = IgnoreSettings.getInstance();
    this.manager = IgnoreManager.getInstance(project);
}
项目:consulo    文件:AsyncEditorLoader.java   
private void loadingFinished(Runnable continuation) {
  if (myLoadingFinished.isDone()) return;
  myLoadingFinished.complete(null);
  myEditor.putUserData(ASYNC_LOADER, null);

  if (myEditorComponent.isDisposed()) return;

  if (continuation != null) {
    continuation.run();
  }

  if (myEditorComponent.isLoading()) {
    myEditorComponent.stopLoading();
  }
  myEditorComponent.getContentPanel().setVisible(true);

  if (myDelayedState != null) {
    TextEditorState state = new TextEditorState();
    state.setFoldingState(myDelayedState.getFoldingState());
    myProvider.setStateImpl(myProject, myEditor, state);
    myDelayedState = null;
  }

  for (Runnable runnable : myDelayedActions) {
    myEditor.getScrollingModel().disableAnimation();
    runnable.run();
  }
  myEditor.getScrollingModel().enableAnimation();

  if (FileEditorManager.getInstance(myProject).getSelectedTextEditor() == myEditor) {
    IdeFocusManager.getInstance(myProject).requestFocusInProject(myTextEditor.getPreferredFocusedComponent(), myProject);
  }
  EditorNotifications.getInstance(myProject).updateNotifications(myTextEditor.myFile);
}
项目:consulo    文件:ForcedSoftWrapsNotificationProvider.java   
@RequiredReadAction
@RequiredDispatchThread
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@Nonnull final VirtualFile file, @Nonnull final FileEditor fileEditor) {
  if (!(fileEditor instanceof TextEditor)) return null;
  final Editor editor = ((TextEditor)fileEditor).getEditor();
  final Project project = editor.getProject();
  if (project == null ||
      !Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS)) ||
      PropertiesComponent.getInstance().isTrueValue(DISABLED_NOTIFICATION_KEY)) {
    return null;
  }

  final EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(EditorBundle.message("forced.soft.wrap.message"));
  panel.createActionLabel(EditorBundle.message("forced.soft.wrap.hide.message"), new Runnable() {
    @Override
    public void run() {
      editor.putUserData(EditorImpl.FORCED_SOFT_WRAPS, null);
      EditorNotifications.getInstance(project).updateNotifications(file);
    }
  });
  panel.createActionLabel(EditorBundle.message("forced.soft.wrap.dont.show.again.message"), new Runnable() {
    @Override
    public void run() {
      PropertiesComponent.getInstance().setValue(DISABLED_NOTIFICATION_KEY, "true");
      EditorNotifications.getInstance(project).updateAllNotifications();
    }
  });
  return panel;
}
项目:consulo    文件:FileChangedNotificationProvider.java   
private EditorNotificationPanel createPanel(@Nonnull final VirtualFile file) {
  EditorNotificationPanel panel = new EditorNotificationPanel();
  panel.setText(IdeBundle.message("file.changed.externally.message"));
  panel.createActionLabel(IdeBundle.message("file.changed.externally.reload"), () -> {
    if (!myProject.isDisposed()) {
      file.refresh(false, false);
      EditorNotifications.getInstance(myProject).updateNotifications(file);
    }
  });
  return panel;
}
项目:consulo    文件:ChangeListManagerImpl.java   
public ChangeListManagerImpl(Project project, final VcsConfiguration config) {
  myProject = project;
  myConfig = config;
  myFreezeName = new AtomicReference<>(null);
  myAdditionalInfo = null;
  myChangesViewManager = myProject.isDefault() ? new DummyChangesView(myProject) : ChangesViewManager.getInstance(myProject);
  myFileStatusManager = FileStatusManager.getInstance(myProject);
  myComposite = new FileHolderComposite(project);
  myIgnoredIdeaLevel = new IgnoredFilesComponent(myProject, true);
  myUpdater = new UpdateRequestsQueue(myProject, myScheduler, new ActualUpdater());

  myWorker = new ChangeListWorker(myProject, new MyChangesDeltaForwarder(myProject, myScheduler));
  myDelayedNotificator = new DelayedNotificator(myListeners, myScheduler);
  myModifier = new Modifier(myWorker, myDelayedNotificator);

  myConflictTracker = new ChangelistConflictTracker(project, this, myFileStatusManager, EditorNotifications.getInstance(project));

  myListeners.addListener(new ChangeListAdapter() {
    @Override
    public void defaultListChanged(final ChangeList oldDefaultList, ChangeList newDefaultList) {
      final LocalChangeList oldList = (LocalChangeList)oldDefaultList;
      if (oldDefaultList == null || oldList.hasDefaultName() || oldDefaultList.equals(newDefaultList)) return;

      if (!ApplicationManager.getApplication().isUnitTestMode()) {
        scheduleAutomaticChangeListDeletionIfEmpty(oldList, config);
      }
    }
  });
}
项目:consulo-javascript    文件:DescriptionByAnotherPsiElementEditorNotification.java   
private void wantUpdate(PsiFile psiFile)
{
    ((PsiModificationTrackerImpl) PsiModificationTracker.SERVICE.getInstance(myProject)).incCounter();

    DaemonCodeAnalyzer.getInstance(myProject).restart(psiFile);

    EditorNotifications.getInstance(psiFile.getProject()).updateNotifications(psiFile.getVirtualFile());
}
项目:consulo-java    文件:SetupJDKNotificationProvider.java   
public SetupJDKNotificationProvider(Project project, final EditorNotifications notifications)
{
    myProject = project;
    myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter()
    {
        @Override
        public void rootsChanged(ModuleRootEvent event)
        {
            notifications.updateAllNotifications();
        }
    });
    myProject.getMessageBus().connect().subscribe(ModuleExtension.CHANGE_TOPIC, (oldExtension, newExtension) -> notifications.updateAllNotifications());
}
项目:consulo-java    文件:AttachSourcesNotificationProvider.java   
public AttachSourcesNotificationProvider(Project project, final EditorNotifications notifications)
{
    myProject = project;
    myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter()
    {
        @Override
        public void rootsChanged(ModuleRootEvent event)
        {
            notifications.updateAllNotifications();
        }
    });
}
项目:educational-plugin    文件:StudySubtaskUtils.java   
/***
 * @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);
  }
}
项目:educational-plugin    文件:CCSubtaskEditorNotificationProvider.java   
@Nullable
private PopupStep deleteSubtask() {
  final int lastSubtaskIndex = myTask.getLastSubtaskIndex();
  for (TaskFile taskFile : myTask.getTaskFiles().values()) {
    List<AnswerPlaceholder> emptyPlaceholders = new ArrayList<>();
    for (AnswerPlaceholder placeholder : taskFile.getAnswerPlaceholders()) {
      Map<Integer, AnswerPlaceholderSubtaskInfo> infos = placeholder.getSubtaskInfos();
      if (infos.containsKey(mySubtaskIndex)) {
        infos.remove(mySubtaskIndex);
        if (infos.isEmpty()) {
          emptyPlaceholders.add(placeholder);
        }
      }
    }
    taskFile.getAnswerPlaceholders().removeAll(emptyPlaceholders);
  }
  VirtualFile taskDir = myTask.getTaskDir(myProject);
  if (taskDir == null) {
    return FINAL_CHOICE;
  }
  deleteSubtaskFiles(taskDir);
  if (mySubtaskIndex != lastSubtaskIndex) {
    renameFiles(taskDir, myProject, mySubtaskIndex);
    updateInfoIndexes();
  }
  myTask.setLastSubtaskIndex(lastSubtaskIndex - 1);
  int activeSubtaskIndex = myTask.getActiveSubtaskIndex();
  if (mySubtaskIndex != 0 && activeSubtaskIndex == mySubtaskIndex) {
    StudySubtaskUtils.switchStep(myProject, myTask, mySubtaskIndex - 1);
  }
  if (activeSubtaskIndex > mySubtaskIndex) {
    myTask.setActiveSubtaskIndex(activeSubtaskIndex - 1);
  }
  StudySubtaskUtils.updateUI(myProject, myTask, true);
  for (VirtualFile file : FileEditorManager.getInstance(myProject).getOpenFiles()) {
    EditorNotifications.getInstance(myProject).updateNotifications(file);
  }
  if (lastSubtaskIndex == 1) {
    convertToTask();
  }
  return FINAL_CHOICE;
}
项目:intellij-ce-playground    文件:PluginAdvertiserEditorNotificationProvider.java   
public PluginAdvertiserEditorNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myNotifications = notifications;
}
项目:intellij-ce-playground    文件:ChangelistConflictTracker.java   
public ChangelistConflictTracker(@NotNull Project project,
                                 @NotNull ChangeListManager changeListManager,
                                 @NotNull FileStatusManager fileStatusManager,
                                 @NotNull EditorNotifications editorNotifications) {
  myProject = project;

  myChangeListManager = changeListManager;
  myEditorNotifications = editorNotifications;
  myDocumentManager = FileDocumentManager.getInstance();
  myFileStatusManager = fileStatusManager;
  myCheckSetLock = new Object();
  myCheckSet = new HashSet<VirtualFile>();

  final Application application = ApplicationManager.getApplication();
  final ZipperUpdater zipperUpdater = new ZipperUpdater(300, myProject);
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      if (application.runReadAction(new Computable<Boolean>() {
        @Override
        public Boolean compute() {
          return application.isDisposed() || myProject.isDisposed() || !myProject.isOpen();
        }
      })) {
        return;
      }
      final Set<VirtualFile> localSet;
      synchronized (myCheckSetLock) {
        localSet = new HashSet<VirtualFile>();
        localSet.addAll(myCheckSet);
        myCheckSet.clear();
      }
      checkFiles(localSet);
    }
  };
  myDocumentListener = new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      if (!myOptions.TRACKING_ENABLED) {
        return;
      }
      Document document = e.getDocument();
      VirtualFile file = myDocumentManager.getFile(document);
      if (ProjectUtil.guessProjectForFile(file) == myProject) {
        synchronized (myCheckSetLock) {
          myCheckSet.add(file);
        }
        zipperUpdater.queue(runnable);
      }
    }
  };

  myChangeListListener = new ChangeListAdapter() {
    @Override
    public void changeListChanged(ChangeList list) {
      if (myChangeListManager.isDefaultChangeList(list)) {
        clearChanges(list.getChanges());
      }
    }

    @Override
    public void changesMoved(Collection<Change> changes, ChangeList fromList, ChangeList toList) {
      if (myChangeListManager.isDefaultChangeList(toList)) {
        clearChanges(changes);
      }
    }

    @Override
    public void changesRemoved(Collection<Change> changes, ChangeList fromList) {
      clearChanges(changes);
    }

    @Override
    public void defaultListChanged(ChangeList oldDefaultList, ChangeList newDefaultList) {
      clearChanges(newDefaultList.getChanges());
    }
  };
}
项目:intellij-ce-playground    文件:GeneratedSourceFileChangeTrackerImpl.java   
public GeneratedSourceFileChangeTrackerImpl(Project project, FileDocumentManager documentManager, EditorNotifications editorNotifications) {
  super(project);
  myDocumentManager = documentManager;
  myEditorNotifications = editorNotifications;
  myCheckingQueue = new MergingUpdateQueue("Checking for changes in generated sources", 500, false, null, project, null, Alarm.ThreadToUse.SHARED_THREAD);
}
项目:intellij-ce-playground    文件:AndroidCodeStyleNotificationProvider.java   
public AndroidCodeStyleNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myNotifications = notifications;
}
项目:intellij-ce-playground    文件:AndroidSdkNotConfiguredNotificationProvider.java   
public AndroidSdkNotConfiguredNotificationProvider(Project project, final EditorNotifications notifications) {
  myProject = project;
  myNotifications = notifications;
}