public JpsContentEntry(JpsModule module, JpsRootModel rootModel, String rootUrl) { myModule = module; myRootModel = rootModel; myRoot = VirtualFilePointerManager.getInstance().create(rootUrl, this, null); mySourceFolders = new ArrayList<JpsSourceFolder>(); String rootPath = VfsUtilCore.urlToPath(getUrl()); for (JpsModuleSourceRoot root : myModule.getSourceRoots()) { if (FileUtil.isAncestor(rootPath, VfsUtilCore.urlToPath(root.getUrl()), false)) { mySourceFolders.add(new JpsSourceFolder(root, this)); } } myExcludeFolders = new ArrayList<JpsExcludeFolder>(); for (String excludedUrl : myModule.getExcludeRootsList().getUrls()) { if (FileUtil.isAncestor(rootPath, VfsUtilCore.urlToPath(excludedUrl), false)) { myExcludeFolders.add(new JpsExcludeFolder(excludedUrl, this)); } } }
RootModelImpl(@NotNull ModuleRootManagerImpl moduleRootManager, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) { myModuleRootManager = moduleRootManager; myProjectRootManager = projectRootManager; myFilePointerManager = filePointerManager; myWritable = false; addSourceOrderEntries(); myModuleLibraryTable = new ModuleLibraryTable(this, myProjectRootManager); for (ModuleExtension extension : Extensions.getExtensions(ModuleExtension.EP_NAME, moduleRootManager.getModule())) { ModuleExtension model = extension.getModifiableModel(false); registerOnDispose(model); myExtensions.add(model); } myConfigurationAccessor = new RootConfigurationAccessor(); }
@Override protected void setUp() throws Exception { EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() { @Override public void run() throws Exception { LightPlatformTestCase.super.setUp(); initApplication(); ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest()); ourApplication.setDataProvider(LightPlatformTestCase.this); LightProjectDescriptor descriptor = new SimpleLightProjectDescriptor(getModuleType(), getProjectJDK()); doSetup(descriptor, configureLocalInspectionTools(), getTestRootDisposable()); InjectedLanguageManagerImpl.pushInjectors(getProject()); storeSettings(); myThreadTracker = new ThreadTracker(); ModuleRootManager.getInstance(ourModule).orderEntries().getAllLibrariesAndSdkClassesRoots(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); } }); }
public Unity3dProjectChangeListener(@NotNull Project project, @NotNull StartupManager startupManager) { myProject = project; for(Unity3dProjectSourceFileTypeFactory factory : Unity3dProjectSourceFileTypeFactory.EP_NAME.getExtensions()) { factory.registerFileTypes(mySourceFileTypes::add); } myProject.getMessageBus().connect().subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { @Override @RequiredReadAction public void rootsChanged(ModuleRootEvent event) { checkAndRunIfNeed(); } }); VirtualFileManager.getInstance().addVirtualFileListener(this, this); myAssetsDirPointer = VirtualFilePointerManager.getInstance().create(StandardFileSystems.FILE_PROTOCOL_PREFIX + myProject.getPresentableUrl() + "/" + Unity3dProjectImportUtil .ASSETS_DIRECTORY, this, null); startupManager.registerPostStartupActivity(this::checkAndRunIfNeed); }
@Override protected void tearDown() throws Exception { Project project = getProject(); CodeStyleSettingsManager.getInstance(project).dropTemporarySettings(); checkForSettingsDamage(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); doTearDown(project, ourApplication, true); try { super.tearDown(); } finally { myThreadTracker.checkLeak(); InjectedLanguageManagerImpl.checkInjectorsAreDisposed(project); filePointerManager.assertPointersAreDisposed(); } }
public void setManifestPath(final String manifestPath) { if (manifestPath == null || manifestPath.length() == 0){ myManifestFilePointer = null; } else { final VirtualFile manifest = LocalFileSystem.getInstance().findFileByPath(manifestPath); if (manifest == null){ Messages.showErrorDialog(myModule.getProject(), DevKitBundle.message("error.file.not.found.message", manifestPath), DevKitBundle.message("error.file.not.found")); ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { myManifestFilePointer = VirtualFilePointerManager.getInstance().create(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(manifestPath)), myModule, null); } }); } else { ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { myManifestFilePointer = VirtualFilePointerManager.getInstance().create(manifest, myModule, null); } }); } } }
@Override @RequiredDispatchThread protected void setUp() throws Exception { super.setUp(); initApplication(); //ourApplication.setDataProvider(this); doSetup(createTestModuleDescriptor(), configureLocalInspectionTools(), myAvailableInspectionTools); InjectedLanguageManagerImpl.pushInjectors(getProject()); storeSettings(); myThreadTracker = new ThreadTracker(); ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest()); ModuleRootManager.getInstance(ourModule).orderEntries().getAllLibrariesAndSdkClassesRoots(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }
@Nonnull public static HistoryEntry createHeavy(@Nonnull Project project, @Nonnull VirtualFile file, @Nonnull FileEditorProvider[] providers, @Nonnull FileEditorState[] states, @Nonnull FileEditorProvider selectedProvider) { if (project.isDisposed()) return createLight(file, providers, states, selectedProvider); Disposable disposable = Disposer.newDisposable(); VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(file, disposable, null); HistoryEntry entry = new HistoryEntry(pointer, selectedProvider, disposable); for (int i = 0; i < providers.length; i++) { FileEditorProvider provider = providers[i]; FileEditorState state = states[i]; if (provider != null && state != null) { entry.putState(provider, state); } } return entry; }
public Info(@NotNull Project project, @NotNull String url, @NotNull final String providerId, @NotNull String psiElementId) { myProject = project; myVirtualFilePointer = VirtualFilePointerManager.getInstance().create(url, this, null); myProvider = ContainerUtil.find(DescriptionByAnotherPsiElementProvider.EP_NAME.getExtensions(), new Condition<DescriptionByAnotherPsiElementProvider<?>>() { @Override public boolean value(DescriptionByAnotherPsiElementProvider<?> psiElementProvider) { return psiElementProvider.getId().equals(providerId); } }); myId = providerId; myPsiElementId = psiElementId; }
@Override protected void setUp() throws Exception { super.setUp(); myJavaFacade = JavaPsiFacadeEx.getInstanceEx(myProject); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.storePointers(); }
@Override protected void tearDown() throws Exception { myJavaFacade = null; super.tearDown(); VirtualFilePointerManagerImpl filePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); filePointerManager.assertPointersAreDisposed(); }
private void readExternal(final Element element) { final Element outputPathChild = element.getChild(OUTPUT_TAG); if (outputPathChild != null) { String outputPath = outputPathChild.getAttributeValue(URL); myCompilerOutput = VirtualFilePointerManager.getInstance().create(outputPath, myProject, null); } }
public void setPresentableUrl(String newUrl) { myFilePointer = VirtualFilePointerManager.getInstance().create(VfsUtil.pathToUrl(FileUtil.toSystemIndependentName(newUrl)), myParentDisposable, null); final VirtualFile file = getVirtualFile(); if (file != null) { myIsFile = !file.isDirectory(); } }
public ModuleRootManagerImpl(Module module, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) { myModule = module; myProjectRootManager = projectRootManager; myFilePointerManager = filePointerManager; myRootModel = new RootModelImpl(this, myProjectRootManager, myFilePointerManager); myOrderRootsCache = new OrderRootsCache(module); }
private Map<OrderRootType, VirtualFilePointerContainer> initRoots() { Disposer.register(this, myPointersDisposable); Map<OrderRootType, VirtualFilePointerContainer> result = new HashMap<OrderRootType, VirtualFilePointerContainer>(4); for (OrderRootType rootType : getAllRootTypes()) { result.put(rootType, VirtualFilePointerManager.getInstance().createContainer(myPointersDisposable)); } return result; }
RootModelImpl(@NotNull RootModelImpl rootModel, ModuleRootManagerImpl moduleRootManager, final boolean writable, final RootConfigurationAccessor rootConfigurationAccessor, @NotNull VirtualFilePointerManager filePointerManager, ProjectRootManagerImpl projectRootManager) { myFilePointerManager = filePointerManager; myModuleRootManager = moduleRootManager; myProjectRootManager = projectRootManager; myModuleLibraryTable = new ModuleLibraryTable(this, myProjectRootManager); myWritable = writable; myConfigurationAccessor = rootConfigurationAccessor; final Set<ContentEntry> thatContent = rootModel.myContent; for (ContentEntry contentEntry : thatContent) { if (contentEntry instanceof ClonableContentEntry) { ContentEntry cloned = ((ClonableContentEntry)contentEntry).cloneEntry(this); myContent.add(cloned); } } setOrderEntriesFrom(rootModel); for (ModuleExtension extension : rootModel.myExtensions) { ModuleExtension model = extension.getModifiableModel(writable); registerOnDispose(model); myExtensions.add(model); } }
@Override @NotNull public OrderEntry cloneEntry(@NotNull RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) { ProjectRootManagerImpl rootManager = ProjectRootManagerImpl.getInstanceImpl(getRootModel().getModule().getProject()); return new LibraryOrderEntryImpl(this, rootModel, rootManager); }
@Override @NotNull public OrderEntry cloneEntry(@NotNull RootModelImpl rootModel, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) { return new ModuleJdkOrderEntryImpl(this, rootModel, ProjectRootManagerImpl.getInstanceImpl(getRootModel().getModule().getProject())); }
private void setRootUrls(final OrderRootType orderRootType, @NotNull final String[] urls) { VirtualFilePointerContainer container = myOrderRootPointerContainers.get(orderRootType); if (container == null) { container = VirtualFilePointerManager.getInstance().createContainer(this, null); myOrderRootPointerContainers.put(orderRootType, container); } container.clear(); for (final String url : urls) { container.add(url); } }
@Override public void readExternal(Element element) throws InvalidDataException { for (PersistentOrderRootType orderRootType : OrderRootType.getAllPersistentTypes()) { String paths = orderRootType.getModulePathsName(); if (paths != null) { final Element pathsElement = element.getChild(paths); if (pathsElement != null) { VirtualFilePointerContainer container = VirtualFilePointerManager.getInstance().createContainer(this, null); myOrderRootPointerContainers.put(orderRootType, container); container.readExternal(pathsElement, ROOT_ELEMENT); } } } }
public VirtualFilePointerContainer setCachedRoots(OrderRootType rootType, int flags, Collection<String> urls) { final VirtualFilePointerContainer container = VirtualFilePointerManager.getInstance().createContainer(myParentDisposable); for (String url : urls) { container.add(url); } myRoots.put(new CacheKey(rootType, flags), container); return container; }
public CoreModule(@NotNull Disposable parentDisposable, @NotNull Project project, String moduleFilePath) { super(project.getPicoContainer(), parentDisposable); myLifetime = parentDisposable; myProject = project; myPath = moduleFilePath; Extensions.instantiateArea(ExtensionAreas.IDEA_MODULE, this, null); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { Extensions.disposeArea(CoreModule.this); } }); initModuleExtensions(); final ModuleRootManagerImpl moduleRootManager = new ModuleRootManagerImpl(this, ProjectRootManagerImpl.getInstanceImpl(project), VirtualFilePointerManager.getInstance()) { @Override public void loadState(ModuleRootManagerState object) { loadState(object, false); } }; Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { moduleRootManager.disposeComponent(); } }); getPicoContainer().registerComponentInstance(ModuleRootManager.class, moduleRootManager); getPicoContainer().registerComponentInstance(PathMacroManager.class, createModulePathMacroManager(project)); getPicoContainer().registerComponentInstance(ModuleFileIndex.class, createModuleFileIndex(project)); myModuleScopeProvider = createModuleScopeProvider(); }
public void dispose() { checkDisposed(); if (myNode.incrementUsageCount(-1) == 0) { kill("URL when die: "+ toString()); VirtualFilePointerManager pointerManager = VirtualFilePointerManager.getInstance(); if (pointerManager instanceof VirtualFilePointerManagerImpl) { ((VirtualFilePointerManagerImpl)pointerManager).removeNode(myNode, myListener); // remove from the tree } myNode = null; } }
@Override protected void setUp() throws Exception { super.setUp(); myVirtualFilePointerManager = (VirtualFilePointerManagerImpl)VirtualFilePointerManager.getInstance(); numberOfPointersBefore = myVirtualFilePointerManager.numberOfPointers(); numberOfListenersBefore = myVirtualFilePointerManager.numberOfListeners(); }
public VirtualFilePointerContainerImpl(@NotNull VirtualFilePointerManager manager, @NotNull Disposable parentDisposable, @Nullable VirtualFilePointerListener listener) { //noinspection HardCodedStringLiteral super(TRACE_CREATION && !ApplicationInfoImpl.isInPerformanceTest() ? new Throwable("parent = '" + parentDisposable + "' (" + parentDisposable.getClass() + "); listener=" + listener) : null); myVirtualFilePointerManager = manager; myParent = parentDisposable; myListener = listener; }
protected FileOrDirectoryTreeNode(@NotNull String path, @NotNull SimpleTextAttributes invalidAttributes, @NotNull Project project, @Nullable String parentPath) { String preparedPath = path.replace(File.separatorChar, '/'); String url = VirtualFileManager.constructUrl(LocalFileSystem.getInstance().getProtocol(), preparedPath); setUserObject(VirtualFilePointerManager.getInstance().create(url, this, this)); myFile = new File(getFilePath()); myInvalidAttributes = invalidAttributes; myProject = project; myName = parentPath == null ? myFile.getAbsolutePath() : myFile.getName(); }
public DetectionExcludesConfigurationImpl(Project project, VirtualFilePointerManager pointerManager) { myProject = project; myPointerManager = pointerManager; myExcludedFrameworks = new HashSet<String>(); myExcludedFiles = new FactoryMap<String, VirtualFilePointerContainer>() { @Override protected VirtualFilePointerContainer create(String key) { return myPointerManager.createContainer(DetectionExcludesConfigurationImpl.this); } }; }
@Override public void loadState(Mappings state) { reset(); final VirtualFilePointerManager manager = VirtualFilePointerManager.getInstance(); final Map<String, String> map = state.myMappings; for (String file : map.keySet()) { myMappings.put(manager.create(file, myProject, null), manager.create(map.get(file), myProject, null)); } }
TempManager(FileAssociationsManagerImpl impl, Project project, VirtualFilePointerManager filePointerManager) { myTmp = new FileAssociationsManagerImpl(project, filePointerManager); myTmp.markAsTempCopy(); myTmp.copyFrom(impl); myImpl = impl; myStartModCount = 0; myImplModCount = myImpl.getModificationCount(); }
@Override public final RunConfiguration clone() { final XsltRunConfiguration configuration = (XsltRunConfiguration)super.clone(); configuration.myParameters = new ArrayList<Pair<String, String>>(myParameters); if (myXsltFile != null) configuration.myXsltFile = VirtualFilePointerManager.getInstance().duplicate(myXsltFile, getProject(), null); if (myXmlInputFile != null) configuration.myXmlInputFile = VirtualFilePointerManager.getInstance().duplicate(myXmlInputFile, getProject(), null); return configuration; }
public void setXsltFile(@NotNull String xsltFile) { if (isEmpty(xsltFile)) { myXsltFile = null; } else { myXsltFile = VirtualFilePointerManager.getInstance().create(VfsUtilCore.pathToUrl(xsltFile).replace(File.separatorChar, '/'), getProject(), null); } }
public void setXmlInputFile(@NotNull String xmlInputFile) { if (isEmpty(xmlInputFile)) { myXmlInputFile = null; } else { myXmlInputFile = VirtualFilePointerManager.getInstance().create(VfsUtilCore.pathToUrl(xmlInputFile).replace(File.separatorChar, '/'), getProject(), null); } }
public ModuleRootManagerImpl(Module module, DirectoryIndex directoryIndex, ProjectRootManagerImpl projectRootManager, VirtualFilePointerManager filePointerManager) { myModule = module; myProjectRootManager = projectRootManager; myFilePointerManager = filePointerManager; myFileIndex = new ModuleFileIndexImpl(myModule, directoryIndex); myRootModel = new RootModelImpl(this, myProjectRootManager, myFilePointerManager); myOrderRootsCache = new OrderRootsCache(module); }