com.intellij.openapi.roots.ModuleRootListener Java Examples
The following examples show how to use
com.intellij.openapi.roots.ModuleRootListener.
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: ORProjectRootListener.java From reasonml-idea-plugin with MIT License | 6 votes |
private ORProjectRootListener(@NotNull Project project) { project.getMessageBus(). connect(project). subscribe(PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(@NotNull ModuleRootEvent event) { DumbService.getInstance(project).queueTask(new DumbModeTask() { @Override public void performInDumbMode(@NotNull ProgressIndicator indicator) { if (!project.isDisposed()) { indicator.setText("Updating resource repository roots"); // should be done per module //ModuleManager moduleManager = ModuleManager.getInstance(project); //for (Module module : moduleManager.getModules()) { // moduleRootsOrDependenciesChanged(module); //} Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk(); if (projectSdk != null && projectSdk.getSdkType() instanceof OCamlSdkType) { OCamlSdkType.reindexSourceRoots(projectSdk); } } } }); } }); }
Example #2
Source File: PantsSystemProjectResolver.java From intellij-pants-plugin with Apache License 2.0 | 6 votes |
private void doViewSwitch(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) { Project ideProject = id.findProject(); if (ideProject == null) { return; } // Disable zooming on subsequent project resolves/refreshes, // i.e. a project that already has existing modules, because it may zoom at a module // that is going to be replaced by the current resolve. if (ModuleManager.getInstance(ideProject).getModules().length > 0) { return; } MessageBusConnection messageBusConnection = ideProject.getMessageBus().connect(); messageBusConnection.subscribe( ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { // Initiate view switch only when project modules have been created. new ViewSwitchProcessor(ideProject, projectPath).asyncViewSwitch(); } } ); }
Example #3
Source File: PantsProjectCache.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
private void listenForRootsChange() { if (myProject.isDefault() || !PantsUtil.isPantsProject(myProject)) { return; } final MessageBusConnection connection = myProject.getMessageBus().connect(this); connection.subscribe( ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(@NotNull ModuleRootEvent event) { myProjectRoots = null; } } ); }
Example #4
Source File: Unity3dProjectService.java From consulo-unity3d with Apache License 2.0 | 5 votes |
@Inject Unity3dProjectService(Project project) { myProject = project; project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { myValue.drop(); } }); }
Example #5
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 #6
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 #7
Source File: HaxeProjectModel.java From intellij-haxe with Apache License 2.0 | 5 votes |
private void addProjectListeners() { project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { rootsCache = null; } }); }
Example #8
Source File: EditorNotificationsImpl.java From consulo with Apache License 2.0 | 5 votes |
@Inject public EditorNotificationsImpl(Project project) { myProject = project; myUpdateMerger = new MergingUpdateQueue("EditorNotifications update merger", 100, true, null, project); MessageBusConnection connection = project.getMessageBus().connect(project); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { @Override public void fileOpened(@Nonnull FileEditorManager source, @Nonnull VirtualFile file) { updateNotifications(file); } }); connection.subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void enteredDumbMode() { updateAllNotifications(); } @Override public void exitDumbMode() { updateAllNotifications(); } }); connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { updateAllNotifications(); } }); }
Example #9
Source File: RecentProjectsManagerBase.java From consulo with Apache License 2.0 | 5 votes |
@Override public void projectOpened(final Project project, UIAccess uiAccess) { String path = getProjectPath(project); if (path != null) { markPathRecent(path, project); } SystemDock.getInstance().updateMenu(); project.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { updateProjectModuleExtensions(project); } }); }
Example #10
Source File: UnindexedFilesUpdater.java From consulo with Apache License 2.0 | 5 votes |
public UnindexedFilesUpdater(final Project project) { myProject = project; myPusher = PushedFilePropertiesUpdater.getInstance(myProject); project.getMessageBus().connect(this).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(@Nonnull ModuleRootEvent event) { DumbService.getInstance(project).cancelTask(UnindexedFilesUpdater.this); } }); }
Example #11
Source File: ProjectTreeBuilder.java From consulo with Apache License 2.0 | 5 votes |
public ProjectTreeBuilder(@Nonnull Project project, @Nonnull JTree tree, @Nonnull DefaultTreeModel treeModel, @Nullable Comparator<NodeDescriptor> comparator, @Nonnull ProjectAbstractTreeStructureBase treeStructure) { super(project, tree, treeModel, treeStructure, comparator); final MessageBusConnection connection = project.getMessageBus().connect(this); connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override public void rootsChanged(ModuleRootEvent event) { queueUpdate(); } }); connection.subscribe(BookmarksListener.TOPIC, new MyBookmarksListener()); PsiManager.getInstance(project).addPsiTreeChangeListener(createPsiTreeChangeListener(project), this); FileStatusManager.getInstance(project).addFileStatusListener(new MyFileStatusListener(), this); CopyPasteManager.getInstance().addContentChangedListener(new CopyPasteUtil.DefaultCopyPasteListener(getUpdater()), this); connection.subscribe(ProblemListener.TOPIC, new MyProblemListener()); setCanYieldUpdate(true); initRootNode(); }