com.intellij.ui.EditorNotifications Java Examples
The following examples show how to use
com.intellij.ui.EditorNotifications.
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: FlutterStudioProjectOpenProcessor.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable @Override public Project doOpenProject(@NotNull VirtualFile virtualFile, @Nullable Project projectToClose, boolean forceOpenInNewFrame) { final ProjectOpenProcessor importProvider = getDelegateImportProvider(virtualFile); if (importProvider == null) return null; importProvider.doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame); // A callback may have caused the project to be reloaded. Find the new Project object. Project project = FlutterUtils.findProject(virtualFile.getPath()); if (project == null || project.isDisposed()) { return project; } for (Module module : FlutterModuleUtils.getModules(project)) { if (FlutterModuleUtils.declaresFlutter(module) && !FlutterModuleUtils.isFlutterModule(module)) { FlutterModuleUtils.setFlutterModuleType(module); FlutterModuleUtils.enableDartSDK(module); } } project.save(); EditorNotifications.getInstance(project).updateAllNotifications(); FlutterProjectCreator.disableUserConfig(project); return project; }
Example #2
Source File: DesktopPsiAwareTextEditorImpl.java From consulo with Apache License 2.0 | 6 votes |
@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); }; }
Example #3
Source File: DetectedIndentOptionsNotificationProvider.java From consulo with Apache License 2.0 | 6 votes |
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); } } } }
Example #4
Source File: BackgroundTaskByVfsChangeManageDialog.java From consulo with Apache License 2.0 | 6 votes |
@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(); }
Example #5
Source File: ForcedSoftWrapsNotificationProvider.java From consulo with Apache License 2.0 | 6 votes |
@RequiredReadAction @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(); if (!Boolean.TRUE.equals(editor.getUserData(DesktopEditorImpl.FORCED_SOFT_WRAPS)) || !Boolean.TRUE.equals(editor.getUserData(DesktopEditorImpl.SOFT_WRAPS_EXIST)) || 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"), () -> { editor.putUserData(DesktopEditorImpl.FORCED_SOFT_WRAPS, null); EditorNotifications.getInstance(myProject).updateNotifications(file); }); panel.createActionLabel(EditorBundle.message("forced.soft.wrap.dont.show.again.message"), () -> { PropertiesComponent.getInstance().setValue(DISABLED_NOTIFICATION_KEY, "true"); EditorNotifications.getInstance(myProject).updateAllNotifications(); }); return panel; }
Example #6
Source File: GraphQLProjectConfigurable.java From js-graphql-intellij-plugin with MIT License | 6 votes |
public void apply() throws ConfigurationException { if (myForm != null) { if (myProject.isDefault()) { myForm.apply(); } else { WriteAction.run(() -> { myForm.apply(); }); ApplicationManager.getApplication().invokeLater(() -> { if (!myProject.isDisposed()) { DaemonCodeAnalyzer.getInstance(myProject).restart(); EditorNotifications.getInstance(myProject).updateAllNotifications(); } }, myProject.getDisposed()); } } }
Example #7
Source File: FlutterStudioProjectOpenProcessor.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Nullable @Override public Project doOpenProject(@NotNull VirtualFile virtualFile, @Nullable Project projectToClose, boolean forceOpenInNewFrame) { final ProjectOpenProcessor importProvider = getDelegateImportProvider(virtualFile); if (importProvider == null) return null; importProvider.doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame); // A callback may have caused the project to be reloaded. Find the new Project object. Project project = FlutterUtils.findProject(virtualFile.getPath()); if (project == null || project.isDisposed()) { return project; } for (Module module : FlutterModuleUtils.getModules(project)) { if (FlutterModuleUtils.declaresFlutter(module) && !FlutterModuleUtils.isFlutterModule(module)) { FlutterModuleUtils.setFlutterModuleType(module); FlutterModuleUtils.enableDartSDK(module); } } project.save(); EditorNotifications.getInstance(project).updateAllNotifications(); FlutterProjectCreator.disableUserConfig(project); return project; }
Example #8
Source File: NativeEditorNotificationProvider.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
NativeEditorActionsPanel(VirtualFile file, VirtualFile root, String actionName) { super(EditorColors.GUTTER_BACKGROUND); myFile = file; myRoot = root; myAction = ActionManager.getInstance().getAction(actionName); icon(FlutterIcons.Flutter); text("Flutter commands"); // Ensure this project is a Flutter project by updating the menu action. It will only be visible for Flutter projects. myAction.update(AnActionEvent.createFromDataContext(ActionPlaces.EDITOR_TOOLBAR, myAction.getTemplatePresentation(), makeContext())); isVisible = myAction.getTemplatePresentation().isVisible(); createActionLabel(myAction.getTemplatePresentation().getText(), this::performAction) .setToolTipText(myAction.getTemplatePresentation().getDescription()); createActionLabel(FlutterBundle.message("flutter.androidstudio.open.hide.notification.text"), () -> { showNotification = false; EditorNotifications.getInstance(myProject).updateAllNotifications(); }).setToolTipText(FlutterBundle.message("flutter.androidstudio.open.hide.notification.description")); }
Example #9
Source File: NativeEditorNotificationProvider.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
NativeEditorActionsPanel(VirtualFile file, VirtualFile root, String actionName) { super(EditorColors.GUTTER_BACKGROUND); myFile = file; myRoot = root; myAction = ActionManager.getInstance().getAction(actionName); icon(FlutterIcons.Flutter); text("Flutter commands"); // Ensure this project is a Flutter project by updating the menu action. It will only be visible for Flutter projects. myAction.update(AnActionEvent.createFromDataContext(ActionPlaces.EDITOR_TOOLBAR, myAction.getTemplatePresentation(), makeContext())); isVisible = myAction.getTemplatePresentation().isVisible(); createActionLabel(myAction.getTemplatePresentation().getText(), this::performAction) .setToolTipText(myAction.getTemplatePresentation().getDescription()); createActionLabel(FlutterBundle.message("flutter.androidstudio.open.hide.notification.text"), () -> { showNotification = false; EditorNotifications.getInstance(myProject).updateAllNotifications(); }).setToolTipText(FlutterBundle.message("flutter.androidstudio.open.hide.notification.description")); }
Example #10
Source File: FileIsNotAttachedProvider.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Inject public FileIsNotAttachedProvider(Project project, final EditorNotifications notifications) { myProject = project; myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { notifications.updateAllNotifications(); } }); myProject.getMessageBus().connect().subscribe(ModuleExtension.CHANGE_TOPIC, (oldExtension, newExtension) -> notifications.updateAllNotifications()); }
Example #11
Source File: FlutterModuleUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void setFlutterModuleAndReload(@NotNull Module module, @NotNull Project project) { if (project.isDisposed()) return; setFlutterModuleType(module); enableDartSDK(module); project.save(); EditorNotifications.getInstance(project).updateAllNotifications(); ProjectManager.getInstance().reloadProject(project); }
Example #12
Source File: ChangeListManagerImpl.java From consulo with Apache License 2.0 | 5 votes |
@Inject 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); } } }); }
Example #13
Source File: FileChangedNotificationProvider.java From consulo with Apache License 2.0 | 5 votes |
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; }
Example #14
Source File: FlutterModuleUtils.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void setFlutterModuleAndReload(@NotNull Module module, @NotNull Project project) { if (project.isDisposed()) return; setFlutterModuleType(module); enableDartSDK(module); project.save(); EditorNotifications.getInstance(project).updateAllNotifications(); ProjectManager.getInstance().reloadProject(project); }
Example #15
Source File: DesktopAsyncEditorLoader.java From consulo with Apache License 2.0 | 5 votes |
private void loadingFinished(Runnable continuation) { if (!myLoadingFinished.compareAndSet(false, true)) return; myEditor.putUserData(ASYNC_LOADER, null); if (myEditorComponent.isDisposed()) return; if (continuation != null) { continuation.run(); } myEditorComponent.loadingFinished(); if (myDelayedState != null && PsiDocumentManager.getInstance(myProject).isCommitted(myEditor.getDocument())) { TextEditorState state = new TextEditorState(); state.RELATIVE_CARET_POSITION = Integer.MAX_VALUE; // don't do any scrolling 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); }
Example #16
Source File: IgnoredEditingNotificationProvider.java From idea-gitignore with MIT License | 5 votes |
/** * Builds a new instance of {@link IgnoredEditingNotificationProvider}. * * @param project current project */ public IgnoredEditingNotificationProvider(@NotNull Project project) { this.notifications = EditorNotifications.getInstance(project); this.settings = IgnoreSettings.getInstance(); this.manager = IgnoreManager.getInstance(project); this.changeListManager = ChangeListManager.getInstance(project); }
Example #17
Source File: AdditionalLanguagesHelper.java From intellij with Apache License 2.0 | 5 votes |
AdditionalLanguagesHelper(Project project) { this.project = project; this.notifications = EditorNotifications.getInstance(project); for (LanguageClass langauge : LanguageClass.values()) { if (PropertiesComponent.getInstance(project).getBoolean(propertyKey(langauge))) { notifiedLanguages.add(langauge); } } }
Example #18
Source File: SetupUnitySDKProvider.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Inject public SetupUnitySDKProvider(Project project, final EditorNotifications notifications) { myProject = project; myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { notifications.updateAllNotifications(); } }); myProject.getMessageBus().connect().subscribe(ModuleExtension.CHANGE_TOPIC, (oldExtension, newExtension) -> notifications.updateAllNotifications()); }
Example #19
Source File: GraphQLRelayModernEnableStartupActivity.java From js-graphql-intellij-plugin with MIT License | 5 votes |
@Override public void runActivity(@NotNull Project project) { final GraphQLSettings settings = GraphQLSettings.getSettings(project); if (settings.isEnableRelayModernFrameworkSupport()) { // already enabled Relay Modern return; } try { final GlobalSearchScope scope = GlobalSearchScope.projectScope(project); for (VirtualFile virtualFile : FilenameIndex.getVirtualFilesByName(project, "package.json", scope)) { if (!virtualFile.isDirectory() && virtualFile.isInLocalFileSystem()) { try (InputStream inputStream = virtualFile.getInputStream()) { final String packageJson = IOUtils.toString(inputStream, virtualFile.getCharset()); if (packageJson.contains("\"react-relay\"") || packageJson.contains("\"relay-compiler\"")) { final Notification enableRelayModern = new Notification("GraphQL", "Relay Modern project detected", "<a href=\"enable\">Enable Relay Modern</a> GraphQL tooling", NotificationType.INFORMATION, (notification, event) -> { settings.setEnableRelayModernFrameworkSupport(true); ApplicationManager.getApplication().saveSettings(); notification.expire(); DaemonCodeAnalyzer.getInstance(project).restart(); EditorNotifications.getInstance(project).updateAllNotifications(); }); enableRelayModern.setImportant(true); Notifications.Bus.notify(enableRelayModern); break; } } } } } catch (Exception e) { log.error("Unable to detect Relay Modern", e); } }
Example #20
Source File: AddTsConfigNotificationProvider.java From intellij with Apache License 2.0 | 5 votes |
private EditorNotificationPanel createNotificationPanel( Project project, VirtualFile file, Label tsConfig) { EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("Do you want to add the tsconfig.json for this file to the project view?"); panel.createActionLabel( "Add tsconfig.json to project view", () -> { ProjectViewEdit edit = ProjectViewEdit.editLocalProjectView( project, builder -> { ListSection<Label> rules = builder.getLast(TsConfigRulesSection.KEY); builder.replace( rules, ListSection.update(TsConfigRulesSection.KEY, rules).add(tsConfig)); return true; }); if (edit != null) { edit.apply(); } EditorNotifications.getInstance(project).updateNotifications(file); }); panel.createActionLabel( "Hide notification", () -> { // suppressed for this file until the editor is restarted suppressedFiles.add(VfsUtil.virtualToIoFile(file)); EditorNotifications.getInstance(project).updateNotifications(file); }); return panel; }
Example #21
Source File: CMakeNotificationFilter.java From intellij with Apache License 2.0 | 5 votes |
public static void overrideProjectExtension(Project project) { ExtensionPoint<EditorNotifications.Provider> ep = Extensions.getArea(project).getExtensionPoint(EDITOR_NOTIFICATIONS_EPNAME); for (EditorNotifications.Provider<?> editorNotificationsProvider : ep.getExtensions()) { if (editorNotificationsProvider instanceof CMakeNotificationProvider) { ep.unregisterExtension(editorNotificationsProvider); } } ep.registerExtension(new CMakeNotificationFilter(project)); }
Example #22
Source File: ExternalFileProjectManagementHelper.java From intellij with Apache License 2.0 | 5 votes |
@Override public void onSyncComplete( Project project, BlazeContext context, BlazeImportSettings importSettings, ProjectViewSet projectViewSet, ImmutableSet<Integer> buildIds, BlazeProjectData blazeProjectData, SyncMode syncMode, SyncResult syncResult) { // update the editor notifications if the target map might have changed if (SyncMode.involvesBlazeBuild(syncMode) && syncResult.successful()) { EditorNotifications.getInstance(project).updateAllNotifications(); } }
Example #23
Source File: BlazeUserSettings.java From intellij with Apache License 2.0 | 5 votes |
public void setShowAddFileToProjectNotification(boolean showAddFileToProjectNotification) { if (this.showAddFileToProjectNotification == showAddFileToProjectNotification) { return; } this.showAddFileToProjectNotification = showAddFileToProjectNotification; for (Project project : ProjectManager.getInstance().getOpenProjects()) { EditorNotifications.getInstance(project).updateAllNotifications(); } }
Example #24
Source File: GraphQLTemplateFragmentLanguageInjector.java From js-graphql-intellij-plugin with MIT License | 4 votes |
@Override public void getLanguagesToInject(@NotNull MultiHostRegistrar registrar, @NotNull PsiElement context) { if(GraphQLLanguageInjectionUtil.isJSGraphQLLanguageInjectionTarget(context)) { final JSStringTemplateExpression template = (JSStringTemplateExpression)context; final TextRange graphQlTextRange = GraphQLLanguageInjectionUtil.getGraphQLTextRange(template); if(graphQlTextRange.isEmpty()) { // all whitespace return; } registrar.startInjecting(GraphQLLanguage.INSTANCE); final StringBuilder sb = new StringBuilder(); final TextRange[] stringRanges = template.getStringRanges(); int stringIndex = 0; boolean insideTemplate = false; for (ASTNode astNode : template.getNode().getChildren(null)) { if(astNode.getElementType() == JSTokenTypes.BACKQUOTE) { insideTemplate = true; continue; } if(astNode.getElementType() == JSTokenTypes.STRING_TEMPLATE_PART) { registrar.addPlace(sb.toString(), "", (PsiLanguageInjectionHost) template, stringRanges[stringIndex]); stringIndex++; sb.setLength(0); } else if(insideTemplate) { sb.append(astNode.getText()); } } registrar.doneInjecting(); // update graphql config notifications final VirtualFile virtualFile = context.getContainingFile().getVirtualFile(); if(virtualFile != null && !ApplicationManager.getApplication().isUnitTestMode()) { EditorNotifications.getInstance(context.getProject()).updateNotifications(virtualFile); } } }
Example #25
Source File: GraphQLScopeEditorNotificationProvider.java From js-graphql-intellij-plugin with MIT License | 4 votes |
public GraphQLScopeEditorNotificationProvider(Project project, EditorNotifications notifications) { myProject = project; myNotifications = notifications; }
Example #26
Source File: BaseSdkCompat.java From intellij with Apache License 2.0 | 4 votes |
/** #api193: made public in 2020.1. */ public static ProjectExtensionPointName<EditorNotifications.Provider<?>> getEditorNotificationsEp() { return EditorNotificationsImpl.EP_PROJECT; }
Example #27
Source File: BaseSdkCompat.java From intellij with Apache License 2.0 | 4 votes |
/** #api193: made public in 2020.1. */ @Nullable public static ProjectExtensionPointName<EditorNotifications.Provider<?>> getEditorNotificationsEp() { return null; }
Example #28
Source File: SoftWrapApplianceManager.java From consulo with Apache License 2.0 | 4 votes |
private void recalculateSoftWraps(@Nonnull IncrementalCacheUpdateEvent event) { if (myEditor.getDocument() instanceof DocumentImpl && ((DocumentImpl)myEditor.getDocument()).acceptsSlashR()) { LOG.error("Soft wrapping is not supported for documents with non-standard line endings. File: " + myEditor.getVirtualFile()); } if (myInProgress) { LOG.error("Detected race condition at soft wraps recalculation", new Throwable(), AttachmentFactory.createContext(myEditor.dumpState(), event)); } myInProgress = true; try { myEventBeingProcessed = event; notifyListenersOnCacheUpdateStart(event); int endOffsetUpperEstimate = getEndOffsetUpperEstimate(event); if (myVisibleAreaWidth == QUICK_DUMMY_WRAPPING) { doRecalculateSoftWrapsRoughly(event); } else if (Registry.is("editor.old.soft.wrap.logic") && !IGNORE_OLD_SOFT_WRAP_LOGIC_REGISTRY_OPTION.isIn(myEditor)) { doRecalculateSoftWraps(event, endOffsetUpperEstimate); } else { new SoftWrapEngine(myEditor, myPainter, myStorage, myDataMapper, event, myVisibleAreaWidth, myCustomIndentUsedLastTime ? myCustomIndentValueUsedLastTime : -1).generate(); } if (LOG.isDebugEnabled()) { LOG.debug("Soft wrap recalculation done: " + event.toString() + ". " + (event.getActualEndOffset() - event.getStartOffset()) + " characters processed"); } if (event.getActualEndOffset() > endOffsetUpperEstimate) { LOG.error("Unexpected error at soft wrap recalculation", consulo.logging.attachment.AttachmentFactory.get().create("softWrapModel.txt", myEditor.getSoftWrapModel().toString())); } notifyListenersOnCacheUpdateEnd(event); myEventBeingProcessed = null; } finally { myInProgress = false; } Project project = myEditor.getProject(); VirtualFile file = myEditor.getVirtualFile(); if (project != null && file != null && myEditor.getUserData(DesktopEditorImpl.FORCED_SOFT_WRAPS) != null) { if (myStorage.isEmpty()) { myEditor.putUserData(DesktopEditorImpl.SOFT_WRAPS_EXIST, null); } else if (myEditor.getUserData(DesktopEditorImpl.SOFT_WRAPS_EXIST) == null) { myEditor.putUserData(DesktopEditorImpl.SOFT_WRAPS_EXIST, Boolean.TRUE); EditorNotifications.getInstance(project).updateNotifications(file); } } }
Example #29
Source File: PluginAdvertiserEditorNotificationProvider.java From consulo with Apache License 2.0 | 4 votes |
@Inject public PluginAdvertiserEditorNotificationProvider(UnknownFeaturesCollector unknownFeaturesCollector, final EditorNotifications notifications) { myUnknownFeaturesCollector = unknownFeaturesCollector; myNotifications = notifications; }
Example #30
Source File: ChangelistConflictTracker.java From consulo with Apache License 2.0 | 4 votes |
public ChangelistConflictTracker(@Nonnull Project project, @Nonnull ChangeListManager changeListManager, @Nonnull FileStatusManager fileStatusManager, @Nonnull EditorNotifications editorNotifications) { myProject = project; myChangeListManager = changeListManager; myEditorNotifications = editorNotifications; myDocumentManager = FileDocumentManager.getInstance(); myFileStatusManager = fileStatusManager; myCheckSetLock = new Object(); myCheckSet = new HashSet<>(); final Application application = ApplicationManager.getApplication(); final ZipperUpdater zipperUpdater = new ZipperUpdater(300, Alarm.ThreadToUse.SWING_THREAD, project); final Runnable runnable = () -> { if (application.isDisposed() || myProject.isDisposed() || !myProject.isOpen()) { return; } final Set<VirtualFile> localSet; synchronized (myCheckSetLock) { localSet = new HashSet<>(); 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()); } }; }