@Nullable @Override public RefEntity getReference(final String type, final String fqName) { for (RefManagerExtension extension : myExtensions.values()) { final RefEntity refEntity = extension.getReference(type, fqName); if (refEntity != null) return refEntity; } if (SmartRefElementPointer.FILE.equals(type)) { return RefFileImpl.fileFromExternalName(this, fqName); } if (SmartRefElementPointer.MODULE.equals(type)) { return RefModuleImpl.moduleFromName(this, fqName); } if (SmartRefElementPointer.PROJECT.equals(type)) { return getRefProject(); } if (SmartRefElementPointer.DIR.equals(type)) { String url = VfsUtilCore.pathToUrl(PathMacroManager.getInstance(getProject()).expandPath(fqName)); VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url); if (vFile != null) { final PsiDirectory dir = PsiManager.getInstance(getProject()).findDirectory(vFile); return getReference(dir); } } return null; }
protected JPanel createFilePanel(JTextField textField, JButton button) { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.fill = GridBagConstraints.HORIZONTAL; JLabel promptLabel = new JLabel(IdeBundle.message("editbox.export.to.file")); gbConstraints.weightx = 0; panel.add(promptLabel, gbConstraints); gbConstraints.weightx = 1; panel.add(myTfFile, gbConstraints); String defaultFilePath = myExporter.getDefaultFilePath(); if (! new File(defaultFilePath).isAbsolute()) { defaultFilePath = PathMacroManager.getInstance(myProject).collapsePath(defaultFilePath).replace('/', File.separatorChar); } else { defaultFilePath = defaultFilePath.replace('/', File.separatorChar); } myTfFile.setText(defaultFilePath); panel.setBorder(JBUI.Borders.emptyBottom(5)); return panel; }
@NotNull @Override protected String expandPath(@NotNull String path) { Project project = getProject(); if (project != null) { path = PathMacroManager.getInstance(project).expandPath(path); } Module module = myFileChooserDescriptor.getUserData(LangDataKeys.MODULE_CONTEXT); if (module == null) { module = myFileChooserDescriptor.getUserData(LangDataKeys.MODULE); } if (module != null) { path = PathMacroManager.getInstance(module).expandPath(path); } return super.expandPath(path); }
public static void replaceModuleRelatedRoots(final Project project, final Library.ModifiableModel modifiableModel, final Element libElement, final OrderRootType orderRootType, final String relativeModuleName) { final List<String> urls = new ArrayList<String>(Arrays.asList(modifiableModel.getUrls(orderRootType))); for (Element r : libElement.getChildren(relativeModuleName)) { final String root = PathMacroManager.getInstance(project).expandPath(r.getAttributeValue(PROJECT_RELATED)); for (Iterator<String> iterator = urls.iterator(); iterator.hasNext();) { final String url = iterator.next(); if (areUrlsPointTheSame(root, url)) { iterator.remove(); modifiableModel.removeRoot(url, orderRootType); modifiableModel.addRoot(root, orderRootType); break; } } } }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); readModule(element); vmParams = JDOMExternalizer.readString(element, "vmparams"); cmdLine = JDOMExternalizer.readString(element, "cmdLine"); String sPassParentEnviroment = JDOMExternalizer.readString(element, "passParentEnv"); passParentEnv = StringUtil.isEmpty(sPassParentEnviroment) || Boolean.parseBoolean(sPassParentEnviroment); envs.clear(); JDOMExternalizer.readMap(element, envs, null, "env"); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); depsClasspath = !"false".equals(JDOMExternalizer.readString(element, "depsClasspath")); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); readModule(element); scriptPath = ExternalizablePath.localPathValue(JDOMExternalizer.readString(element, "path")); vmParams = JDOMExternalizer.readString(element, "vmparams"); scriptParams = JDOMExternalizer.readString(element, "params"); final String wrk = JDOMExternalizer.readString(element, "workDir"); if (!".".equals(wrk)) { workDir = ExternalizablePath.localPathValue(wrk); } isDebugEnabled = Boolean.parseBoolean(JDOMExternalizer.readString(element, "debug")); envs.clear(); JDOMExternalizer.readMap(element, envs, null, "env"); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); DefaultJDOMExternalizer.readExternal(this, element); readModule(element); EnvironmentVariablesComponent.readExternal(element, getEnvs()); // common config workingDirectory = JDOMExternalizerUtil.readField(element, "WORKING_DIRECTORY"); String parentEnvValue = JDOMExternalizerUtil.readField(element, "PARENT_ENVS"); if (parentEnvValue != null) { setPassParentEnvs(Boolean.parseBoolean(parentEnvValue)); } // run config scriptName = JDOMExternalizerUtil.readField(element, "SCRIPT_NAME"); setProgramParameters(JDOMExternalizerUtil.readField(element, "PARAMETERS")); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); // common config JDOMExternalizerUtil.writeField(element, "WORKING_DIRECTORY", workingDirectory); JDOMExternalizerUtil.writeField(element, "PARENT_ENVS", Boolean.toString(isPassParentEnvs())); // run config JDOMExternalizerUtil.writeField(element, "SCRIPT_NAME", scriptName); JDOMExternalizerUtil.writeField(element, "PARAMETERS", getProgramParameters()); //JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); DefaultJDOMExternalizer.writeExternal(this, element); writeModule(element); EnvironmentVariablesComponent.writeExternal(element, getEnvs()); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
public static void replaceModuleRelatedRoots(final Project project, final Library.ModifiableModel modifiableModel, final Element libElement, final OrderRootType orderRootType, final String relativeModuleName) { final List<String> urls = new ArrayList<String>(Arrays.asList(modifiableModel.getUrls(orderRootType))); for (Object r : libElement.getChildren(relativeModuleName)) { final String root = PathMacroManager.getInstance(project).expandPath(((Element)r).getAttributeValue(PROJECT_RELATED)); for (Iterator<String> iterator = urls.iterator(); iterator.hasNext();) { final String url = iterator.next(); if (areUrlsPointTheSame(root, url)) { iterator.remove(); modifiableModel.removeRoot(url, orderRootType); modifiableModel.addRoot(root, orderRootType); break; } } } }
public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); readModule(element); vmParams = JDOMExternalizer.readString(element, "vmparams"); cmdLine = JDOMExternalizer.readString(element, "cmdLine"); String sPassParentEnviroment = JDOMExternalizer.readString(element, "passParentEnv"); passParentEnv = StringUtil.isEmpty(sPassParentEnviroment) ? true : Boolean.parseBoolean(sPassParentEnviroment); envs.clear(); JDOMExternalizer.readMap(element, envs, null, "env"); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); depsClasspath = !"false".equals(JDOMExternalizer.readString(element, "depsClasspath")); }
@Nonnull @Override protected String expandPath(@Nonnull String path) { Project project = getProject(); if (project != null) { path = PathMacroManager.getInstance(project).expandPath(path); } Module module = myFileChooserDescriptor.getUserData(LangDataKeys.MODULE_CONTEXT); if (module == null) { module = myFileChooserDescriptor.getUserData(LangDataKeys.MODULE); } if (module != null) { path = PathMacroManager.getInstance(module).expandPath(path); } return super.expandPath(path); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); XmlSerializer.deserializeInto(myBean, element); EnvironmentVariablesComponent.readExternal(element, getEnvs()); myConfigurationModule.readExternal(element); }
@Override public void readExternal(final Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); DefaultJDOMExternalizer.readExternal(this, element); readModule(element); EnvironmentVariablesComponent.readExternal(element, getEnvs()); }
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(); }
private static void loadDirectoryProject(MockProject project, VirtualFile projectDir) throws IOException, JDOMException, InvalidDataException { VirtualFile dotIdea = projectDir.findChild(Project.DIRECTORY_STORE_FOLDER); if (dotIdea == null) throw new FileNotFoundException("Missing '" + Project.DIRECTORY_STORE_FOLDER + "' in " + projectDir.getPath()); VirtualFile modulesXml = dotIdea.findChild("modules.xml"); if (modulesXml == null) throw new FileNotFoundException("Missing 'modules.xml' in " + dotIdea.getPath()); TreeMap<String, Element> storageData = loadStorageFile(project, modulesXml); final Element moduleManagerState = storageData.get("ProjectModuleManager"); if (moduleManagerState == null) { throw new JDOMException("cannot find ProjectModuleManager state in modules.xml"); } final CoreModuleManager moduleManager = (CoreModuleManager)ModuleManager.getInstance(project); moduleManager.loadState(moduleManagerState); VirtualFile miscXml = dotIdea.findChild("misc.xml"); if (miscXml == null) throw new FileNotFoundException("Missing 'misc.xml' in " + dotIdea.getPath()); storageData = loadStorageFile(project, miscXml); final Element projectRootManagerState = storageData.get("ProjectRootManager"); if (projectRootManagerState == null) { throw new JDOMException("cannot find ProjectRootManager state in misc.xml"); } ((ProjectRootManagerImpl) ProjectRootManager.getInstance(project)).loadState(projectRootManagerState); VirtualFile libraries = dotIdea.findChild("libraries"); if (libraries != null) { Map<String, Element> data = DirectoryStorageUtil.loadFrom(libraries, PathMacroManager.getInstance(project).createTrackingSubstitutor()); Element libraryTable = DefaultStateSerializer.deserializeState(DirectoryStorageUtil.getCompositeState(data, new ProjectLibraryTable.LibraryStateSplitter()), Element.class, null); ((LibraryTableBase) ProjectLibraryTable.getInstance(project)).loadState(libraryTable); } moduleManager.loadModules(); project.projectOpened(); }
@Nullable public static RefElement fileFromExternalName(final RefManager manager, final String fqName) { final VirtualFile virtualFile = VirtualFileManager.getInstance().findFileByUrl(PathMacroManager.getInstance(manager.getProject()).expandPath(fqName)); if (virtualFile != null) { final PsiFile psiFile = PsiManager.getInstance(manager.getProject()).findFile(virtualFile); if (psiFile != null) { return manager.getReference(psiFile); } } return null; }
public ShelveChangesManager(final Project project, final MessageBus bus) { super(project); myPathMacroSubstitutor = PathMacroManager.getInstance(myProject).createTrackingSubstitutor(); myBus = bus; mySchemeManager = SchemesManagerFactory.getInstance(project).create(SHELVE_MANAGER_DIR_PATH, new SchemeProcessor<ShelvedChangeList>() { @Nullable @Override public ShelvedChangeList readScheme(@NotNull Element element) throws InvalidDataException { return readOneShelvedChangeList(element); } @Override public Parent writeScheme(@NotNull ShelvedChangeList scheme) throws WriteExternalException { Element child = new Element(ELEMENT_CHANGELIST); scheme.writeExternal(child); myPathMacroSubstitutor.collapsePaths(child); return child; } }); File shelfDirectory = mySchemeManager.getRootDirectory(); myFileProcessor = new CompoundShelfFileProcessor(shelfDirectory); // do not try to ignore when new project created, // because it may lead to predefined ignore creation conflict; see ConvertExcludedToIgnoredTest etc if (shelfDirectory.exists()) { ChangeListManager.getInstance(project).addDirectoryToIgnoreImplicitly(shelfDirectory.getAbsolutePath()); } }
private synchronized void writeOutput(@NotNull final CommonProblemDescriptor[] descriptions, @NotNull RefEntity refElement) { final Element parentNode = new Element(InspectionsBundle.message("inspection.problems")); exportResults(descriptions, refElement, parentNode); final List list = parentNode.getChildren(); @NonNls final String ext = ".xml"; final String fileName = ourOutputPath + File.separator + myToolWrapper.getShortName() + ext; final PathMacroManager pathMacroManager = PathMacroManager.getInstance(getContext().getProject()); PrintWriter printWriter = null; try { new File(ourOutputPath).mkdirs(); final File file = new File(fileName); final CharArrayWriter writer = new CharArrayWriter(); if (!file.exists()) { writer.append("<").append(InspectionsBundle.message("inspection.problems")).append(" " + GlobalInspectionContextBase.LOCAL_TOOL_ATTRIBUTE + "=\"") .append(Boolean.toString(myToolWrapper instanceof LocalInspectionToolWrapper)).append("\">\n"); } for (Object o : list) { final Element element = (Element)o; pathMacroManager.collapsePaths(element); JDOMUtil.writeElement(element, writer, "\n"); } printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName, true), CharsetToolkit.UTF8_CHARSET))); printWriter.append("\n"); printWriter.append(writer.toString()); } catch (IOException e) { LOG.error(e); } finally { if (printWriter != null) { printWriter.close(); } } }
protected String expandPath(String path, Module module, Project project) { path = PathMacroManager.getInstance(project).expandPath(path); if (module != null) { path = PathMacroManager.getInstance(module).expandPath(path); } return path; }
@NotNull @Override public String getReportText() { final Element rootElement = new Element("root"); rootElement.setAttribute("isBackward", String.valueOf(!myForward)); final List<PsiFile> files = new ArrayList<PsiFile>(myDependencies.keySet()); Collections.sort(files, new Comparator<PsiFile>() { @Override public int compare(PsiFile f1, PsiFile f2) { final VirtualFile virtualFile1 = f1.getVirtualFile(); final VirtualFile virtualFile2 = f2.getVirtualFile(); if (virtualFile1 != null && virtualFile2 != null) { return virtualFile1.getPath().compareToIgnoreCase(virtualFile2.getPath()); } return 0; } }); for (PsiFile file : files) { final Element fileElement = new Element("file"); fileElement.setAttribute("path", file.getVirtualFile().getPath()); for (PsiFile dep : myDependencies.get(file)) { Element depElement = new Element("dependency"); depElement.setAttribute("path", dep.getVirtualFile().getPath()); fileElement.addContent(depElement); } rootElement.addContent(fileElement); } PathMacroManager.getInstance(myProject).collapsePaths(rootElement); return JDOMUtil.writeDocument(new Document(rootElement), SystemProperties.getLineSeparator()); }
@SuppressWarnings({"HardCodedStringLiteral"}) private static void writeFragments(final List<PsiFragment> psiFragments, final PrettyPrintWriter writer, Project project, final boolean shouldWriteOffsets) { final PathMacroManager macroManager = PathMacroManager.getInstance(project); final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); for (PsiFragment fragment : psiFragments) { final PsiFile psiFile = fragment.getFile(); final VirtualFile virtualFile = psiFile != null ? psiFile.getVirtualFile() : null; if (virtualFile != null) { writer.startNode("fragment"); writer.addAttribute("file", macroManager.collapsePath(virtualFile.getUrl())); if (shouldWriteOffsets) { final Document document = documentManager.getDocument(psiFile); LOG.assertTrue(document != null); int startOffset = fragment.getStartOffset(); final int line = document.getLineNumber(startOffset); writer.addAttribute("line", String.valueOf(line)); final int lineStartOffset = document.getLineStartOffset(line); if (StringUtil.isEmptyOrSpaces(document.getText().substring(lineStartOffset, startOffset))) { startOffset = lineStartOffset; } writer.addAttribute("start", String.valueOf(startOffset)); writer.addAttribute("end", String.valueOf(fragment.getEndOffset())); if (fragment.containsMultipleFragments()) { final int[][] offsets = fragment.getOffsets(); for (int[] offset : offsets) { writer.startNode("offset"); writer.addAttribute("start", String.valueOf(offset[0])); writer.addAttribute("end", String.valueOf(offset[1])); writer.endNode(); } } } writer.endNode(); } } }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); myIsPureUnittest = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "PUREUNITTEST")); myParams = JDOMExternalizerUtil.readField(element, "PARAMS"); useParam = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "USE_PARAM")); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); myTestToRun = JDOMExternalizerUtil.readField(element, TEST_TO_RUN_FIELD); myKeywords = JDOMExternalizerUtil.readField(element, KEYWORDS_FIELD); myParams = JDOMExternalizerUtil.readField(element, PARAMS_FIELD); useParam = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "USE_PARAM")); useKeyword = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "USE_KEYWORD")); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); myParams = JDOMExternalizerUtil.readField(element, "PARAMS"); useParam = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, "USE_PARAM")); }
public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); myScriptName = JDOMExternalizerUtil.readField(element, SCRIPT_NAME); myScriptParameters = JDOMExternalizerUtil.readField(element, PARAMETERS); myShowCommandLineAfterwards = Boolean.parseBoolean(JDOMExternalizerUtil.readField(element, SHOW_COMMAND_LINE, "false")); }
private static boolean appendRelatedToModule(Element element, String classesUrl, String rootName, VirtualFile file, Module module) { for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) { if (VfsUtilCore.isAncestor(contentRoot, file, false)) { final Element clsElement = new Element(rootName); clsElement.setAttribute(PROJECT_RELATED, PathMacroManager.getInstance(module.getProject()).collapsePath(classesUrl)); element.addContent(clsElement); return true; } } return false; }
public void readClasspath(@NotNull ModifiableRootModel model, @NotNull Collection<String> unknownLibraries, @NotNull Collection<String> unknownJdks, Set<String> refsToModules, final String testPattern, Element classpathElement) throws IOException, ConversionException { for (OrderEntry orderEntry : model.getOrderEntries()) { if (!(orderEntry instanceof ModuleSourceOrderEntry)) { model.removeOrderEntry(orderEntry); } } int idx = 0; EclipseModuleManagerImpl eclipseModuleManager = EclipseModuleManagerImpl.getInstance(model.getModule()); Set<String> libs = new HashSet<String>(); for (Element o : classpathElement.getChildren(EclipseXml.CLASSPATHENTRY_TAG)) { try { readClasspathEntry(model, unknownLibraries, unknownJdks, refsToModules, testPattern, o, idx++, eclipseModuleManager, ((BasePathMacroManager)PathMacroManager.getInstance(model.getModule())).getExpandMacroMap(), libs); } catch (ConversionException e) { ErrorLog.rethrow(ErrorLog.Level.Warning, null, EclipseXml.CLASSPATH_FILE, e); } } if (!model.isSdkInherited() && model.getSdkName() == null) { eclipseModuleManager.setForceConfigureJDK(); model.inheritSdk(); } }
@Override public void assertCompatible(final ModuleRootModel model) throws ConfigurationException { final String moduleName = model.getModule().getName(); for (OrderEntry entry : model.getOrderEntries()) { if (entry instanceof LibraryOrderEntry) { final LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry; if (libraryEntry.isModuleLevel()) { final Library library = libraryEntry.getLibrary(); if (library == null || libraryEntry.getRootUrls(OrderRootType.CLASSES).length != 1 || library.isJarDirectory(library.getUrls(OrderRootType.CLASSES)[0])) { throw new ConfigurationException( "Library \'" + entry.getPresentableName() + "\' from module \'" + moduleName + "\' dependencies is incompatible with eclipse format which supports only one library content root"); } } } } if (model.getContentRoots().length == 0) { throw new ConfigurationException("Module \'" + moduleName + "\' has no content roots thus is not compatible with eclipse format"); } final String output = model.getModuleExtension(CompilerModuleExtension.class).getCompilerOutputUrl(); final String contentRoot = getContentRoot(model); if (output == null || !StringUtil.startsWith(VfsUtilCore.urlToPath(output), contentRoot) && PathMacroManager.getInstance(model.getModule()).collapsePath(output).equals(output)) { throw new ConfigurationException("Module \'" + moduleName + "\' output path is incompatible with eclipse format which supports output under content root only.\nPlease make sure that \"Inherit project compile output path\" is not selected"); } }
protected static String expandPath(String path, Module module, Project project) { path = PathMacroManager.getInstance(project).expandPath(path); if (module != null) { path = PathMacroManager.getInstance(module).expandPath(path); } return path; }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); DefaultJDOMExternalizer.readExternal(this, element); readModule(element); EnvironmentVariablesComponent.readExternal(element, getEnvs()); interpreterOptions = JDOMExternalizerUtil.readField(element, "INTERPRETER_OPTIONS"); interpreterName = JDOMExternalizerUtil.readField(element, "INTERPRETER_NAME"); programName = JDOMExternalizerUtil.readField(element, "PROGRAM_NAME"); setProgramParameters(JDOMExternalizerUtil.readField(element, "PROGRAM_PARAMETERS")); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JDOMExternalizerUtil.writeField(element, "INTERPRETER_OPTIONS", interpreterOptions); JDOMExternalizerUtil.writeField(element, "INTERPRETER_NAME", interpreterName); JDOMExternalizerUtil.writeField(element, "PROGRAM_NAME", programName); JDOMExternalizerUtil.writeField(element, "PROGRAM_PARAMETERS", getProgramParameters()); DefaultJDOMExternalizer.writeExternal(this, element); writeModule(element); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
private String expandPath(String dirName) { if (project != null) { dirName = PathMacroManager.getInstance(project).expandPath(dirName); } if (module != null) { dirName = PathMacroManager.getInstance(module).expandPath(dirName); } return dirName; }
@Override public void readExternal(@NotNull final Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); myScriptPath = JDOMExternalizerUtil.readField(element, SCRIPT_PATH, ""); myScriptArgs = JDOMExternalizerUtil.readField(element, SCRIPT_ARGS, ""); myWorkingDirectoryPath = JDOMExternalizerUtil.readField(element, WORKING_DIRECTORY_PATH, ""); readEnvs(element); }
@Override public void writeExternal(@NotNull final Element element) throws WriteExternalException { super.writeExternal(element); JDOMExternalizerUtil.writeField(element, SCRIPT_PATH, myScriptPath); JDOMExternalizerUtil.writeField(element, SCRIPT_ARGS, myScriptArgs); JDOMExternalizerUtil.writeField(element, WORKING_DIRECTORY_PATH, myWorkingDirectoryPath); writeEnvs(element); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
@Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); writeModule(element); writeRunClass(element); writeHtmlFile(element); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
@Override public void readExternal(Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); readModule(element); readRunClass(element); readHtmlFile(element); }
public void readExternal(final Element element) throws InvalidDataException { PathMacroManager.getInstance(getProject()).expandPaths(element); super.readExternal(element); JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element); DefaultJDOMExternalizer.readExternal(this, element); readModule(element); EnvironmentVariablesComponent.readExternal(element, getEnvs()); }
public void writeExternal(final Element element) throws WriteExternalException { super.writeExternal(element); JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element); DefaultJDOMExternalizer.writeExternal(this, element); writeModule(element); EnvironmentVariablesComponent.writeExternal(element, getEnvs()); PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element); }
@NotNull @Override protected StateStorageManager createStateStorageManager() { return new ProjectStateStorageManager(PathMacroManager.getInstance(getComponentManager()).createTrackingSubstitutor(), myProject) { @Override public StorageData createWsStorageData() { return new IdeaWsStorageData(ROOT_TAG_NAME, myProject); } @Override public StorageData createIprStorageData() { return new IdeaIprStorageData(ROOT_TAG_NAME, myProject); } }; }
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); CoreApplicationEnvironment.registerExtensionPoint(Extensions.getArea(this), ModuleExtension.EP_NAME, ModuleExtension.class); Disposer.register(parentDisposable, new Disposable() { @Override public void dispose() { Extensions.disposeArea(CoreModule.this); } }); initModuleExtensions(); final ModuleRootManagerImpl moduleRootManager = new ModuleRootManagerImpl(this, DirectoryIndex.getInstance(project), 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, new ModulePathMacroManager(PathMacros.getInstance(), this)); myModuleScopeProvider = createModuleScopeProvider(); }