本文整理汇总了Java中com.intellij.ProjectTopics类的典型用法代码示例。如果您正苦于以下问题:Java ProjectTopics类的具体用法?Java ProjectTopics怎么用?Java ProjectTopics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectTopics类属于com.intellij包,在下文中一共展示了ProjectTopics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: projectOpened
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void projectOpened() {
// projectSourceRoots = ProjectRootManager.getInstance(project).getContentSourceRoots();
// for (VirtualFile resourceRoot : WebResourcesPathsConfiguration.getInstance(project).getResourceDirectories()) {
// projectResourceRoots = Arrays.copyOf(projectResourceRoots, projectResourceRoots.length + 1);
// projectResourceRoots[projectResourceRoots.length - 1] = resourceRoot;
// }
project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, this);
/* Шаблоны страниц */
// FileTemplateManager templateManager = FileTemplateManager.getInstance();
// boolean hasBxSimplePageTemplate = false;
// for (FileTemplate fileTemplate : Arrays.asList(templateManager.getAllTemplates())) {
// if (fileTemplate.getName().equals("Битрикс: Простая страница")) hasBxSimplePageTemplate = true;
// }
//
// if (!hasBxSimplePageTemplate) {
// FileTemplate bxSimplePage = templateManager.addTemplate("Битрикс: Простая страница", "php");
// try {
// bxSimplePage.setText(ResourceUtil.loadText(BitrixFramework.class.getResource("/pro/opcode/bitrix/resources/php/bxSimplePage.php")));
// } catch (IOException e){
// templateManager.removeTemplate(bxSimplePage);
// }
// }
}
示例2: ExternalAnnotationsManagerImpl
import com.intellij.ProjectTopics; //导入依赖的package包/类
public ExternalAnnotationsManagerImpl(@NotNull final Project project, final PsiManager psiManager) {
super(psiManager);
myBus = project.getMessageBus();
final MessageBusConnection connection = myBus.connect(project);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
dropCache();
}
});
final MyVirtualFileListener fileListener = new MyVirtualFileListener();
VirtualFileManager.getInstance().addVirtualFileListener(fileListener);
Disposer.register(myPsiManager.getProject(), new Disposable() {
@Override
public void dispose() {
VirtualFileManager.getInstance().removeVirtualFileListener(fileListener);
}
});
}
示例3: AnalyzeDependenciesComponent
import com.intellij.ProjectTopics; //导入依赖的package包/类
/**
* The constructor
*
* @param module the module to analyze
*/
public AnalyzeDependenciesComponent(Module module) {
myModule = module;
mySettings = AnalyzeDependenciesSettings.getInstance(myModule.getProject());
initTree();
init();
getSplitter().setProportion(0.3f);
myMessageBusConnection = myModule.getProject().getMessageBus().connect();
myMessageBusConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
myClasspaths.clear();
updateTree();
}
});
}
示例4: projectOpened
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void projectOpened() {
final ModuleRootListener rootListener = new ModuleRootAdapter() {
public void rootsChanged(ModuleRootEvent event) {
if (!myProject.isDisposed()) {
checkToolWindowStatuses(myProject);
}
}
};
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
public void run() {
if (!myProject.isDisposed()) {
checkToolWindowStatuses(myProject);
final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, rootListener);
}
}
});
}
示例5: projectOpened
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void projectOpened() {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
final StartupManager manager = StartupManager.getInstance(myProject);
manager.registerStartupActivity(new Runnable() {
@Override
public void run() {
if (myVcsManager.needAutodetectMappings()) {
autoDetectVcsMappings(true);
}
myVcsManager.updateActiveVcss();
}
});
manager.registerPostStartupActivity(new Runnable() {
@Override
public void run() {
if (myMessageBus != null) {
myConnection = myMessageBus.connect();
final MyModulesListener listener = new MyModulesListener();
myConnection.subscribe(ProjectTopics.MODULES, listener);
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, listener);
}
}
});
}
示例6: projectOpened
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void projectOpened() {
MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
}
}, ModalityState.NON_MODAL);
}
});
final WolfTheProblemSolver.ProblemListener myProblemListener = new MyProblemListener();
WolfTheProblemSolver.getInstance(myProject).addProblemListener(myProblemListener,myProject);
}
示例7: ModulesDependenciesPanel
import com.intellij.ProjectTopics; //导入依赖的package包/类
public ModulesDependenciesPanel(final Project project, final Module[] modules) {
super(new BorderLayout());
myProject = project;
myModules = modules;
//noinspection HardCodedStringLiteral
myRightTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode("Root"));
myRightTree = new Tree(myRightTreeModel);
initTree(myRightTree, true);
initLeftTree();
mySplitter = new Splitter();
mySplitter.setFirstComponent(new MyTreePanel(myLeftTree, myProject));
mySplitter.setSecondComponent(new MyTreePanel(myRightTree, myProject));
setSplitterProportion();
add(mySplitter, BorderLayout.CENTER);
add(createNorthPanel(), BorderLayout.NORTH);
project.getMessageBus().connect(this).subscribe(ProjectTopics.PROJECT_ROOTS, this);
}
示例8: queueTasks
import com.intellij.ProjectTopics; //导入依赖的package包/类
private void queueTasks(List<? extends Runnable> actions) {
for (Runnable action : actions) {
myTasks.offer(action);
}
final DumbModeTask task = new DumbModeTask() {
@Override
public void performInDumbMode(@NotNull ProgressIndicator indicator) {
performPushTasks();
}
};
myProject.getMessageBus().connect(task).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
DumbService.getInstance(myProject).cancelTask(task);
}
});
DumbService.getInstance(myProject).queueTask(task);
}
示例9: beforeValidityChanged
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void beforeValidityChanged(@NotNull VirtualFilePointer[] pointers) {
if (!myProject.isDisposed()) {
if (myInsideRefresh == 0) {
if (affectsRoots(pointers)) {
beforeRootsChange(false);
if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():""));
}
}
else if (!myPointerChangesDetected) {
//this is the first pointer changing validity
if (affectsRoots(pointers)) {
myPointerChangesDetected = true;
myProject.getMessageBus().syncPublisher(ProjectTopics.PROJECT_ROOTS).beforeRootsChange(new ModuleRootEventImpl(myProject, false));
if (myDoLogCachesUpdate) LOG.info(new Throwable(pointers.length > 0 ? pointers[0].getPresentableUrl():""));
}
}
}
}
示例10: PsiVFSListener
import com.intellij.ProjectTopics; //导入依赖的package包/类
public PsiVFSListener(Project project) {
myProject = project;
myFileTypeManager = FileTypeManager.getInstance();
myProjectRootManager = ProjectRootManager.getInstance(project);
myManager = (PsiManagerImpl) PsiManager.getInstance(project);
myFileManager = (FileManagerImpl) myManager.getFileManager();
myConnection = project.getMessageBus().connect(project);
StartupManager.getInstance(project).registerPreStartupActivity(new Runnable() {
@Override
public void run() {
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new MyModuleRootListener());
myConnection.subscribe(FileTypeManager.TOPIC, new FileTypeListener.Adapter() {
@Override
public void fileTypesChanged(@NotNull FileTypeEvent e) {
myFileManager.processFileTypesChanged();
}
});
myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new MyFileDocumentManagerAdapter());
myFileManager.markInitialized();
}
});
}
示例11: PyModuleListener
import com.intellij.ProjectTopics; //导入依赖的package包/类
public PyModuleListener(MessageBus messageBus) {
messageBus.connect().subscribe(ProjectTopics.MODULES, new ModuleAdapter() {
@Override
public void beforeModuleRemoved(@NotNull Project project, @NotNull Module module) {
final RunManagerEx runManager = RunManagerEx.getInstanceEx(project);
final Collection<RunnerAndConfigurationSettings> configurations = new ArrayList<RunnerAndConfigurationSettings>(runManager.getSortedConfigurations());
for (RunnerAndConfigurationSettings configuration : configurations) {
if (configuration.getConfiguration() instanceof AbstractPythonRunConfiguration) {
final Module configModule = ((AbstractPythonRunConfiguration)configuration.getConfiguration()).getModule();
if (configModule == module) {
runManager.removeConfiguration(configuration);
}
}
}
}
});
}
示例12: addProjectPropertiesUpdatingListener
import com.intellij.ProjectTopics; //导入依赖的package包/类
private void addProjectPropertiesUpdatingListener() {
myProject.getMessageBus().connect(myDisposable).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(final ModuleRootEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
updatePropertyFilesIfNecessary();
}
});
}
}, myProject.getDisposed());
}
});
}
示例13: initFacet
import com.intellij.ProjectTopics; //导入依赖的package包/类
@Override
public void initFacet() {
MessageBusConnection connection = getModule().getMessageBus().connect(this);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (!isDisposed()) {
PsiDocumentManager.getInstance(getModule().getProject()).commitAllDocuments();
updateConfiguration();
}
}
});
}
});
updateConfiguration();
}
示例14: testDoNotCommitIfFoldersWasNotChanged
import com.intellij.ProjectTopics; //导入依赖的package包/类
public void testDoNotCommitIfFoldersWasNotChanged() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
final int[] count = new int[]{0};
myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
@Override
public void rootsChanged(ModuleRootEvent event) {
count[0]++;
}
});
updateProjectFolders();
assertEquals(0, count[0]);
}
示例15: LoaderFactory
import com.intellij.ProjectTopics; //导入依赖的package包/类
public LoaderFactory(final Project project) {
myProject = project;
myModule2ClassLoader = ContainerUtil.createConcurrentWeakMap();
myConnection = myProject.getMessageBus().connect();
myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
public void rootsChanged(final ModuleRootEvent event) {
clearClassLoaderCache();
}
});
Disposer.register(project, new Disposable() {
public void dispose() {
myConnection.disconnect();
myModule2ClassLoader.clear();
}
});
}