Java Code Examples for com.intellij.openapi.module.Module#getModuleDirUrl()

The following examples show how to use com.intellij.openapi.module.Module#getModuleDirUrl() . 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: ContentEntryImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private List<ContentFolder> getFolders0(Predicate<ContentFolderTypeProvider> predicate) {
  List<ContentFolder> list = new ArrayList<>(myContentFolders.size());
  for (ContentFolder contentFolder : myContentFolders) {
    if (predicate.apply(contentFolder.getType())) {
      list.add(contentFolder);
    }
  }

  Module module = getModuleRootLayer().getModule();
  if(module.getModuleDirUrl() == null) {
    return list;
  }

  if (predicate.apply(ExcludedContentFolderTypeProvider.getInstance())) {
    for (DirectoryIndexExcludePolicy excludePolicy : DirectoryIndexExcludePolicy.EP_NAME.getExtensions(getRootModel().getProject())) {
      final VirtualFilePointer[] files = excludePolicy.getExcludeRootsForModule(myModuleRootLayer);
      for (VirtualFilePointer file : files) {
        list.add(new LightContentFolderImpl(file, ExcludedContentFolderTypeProvider.getInstance(), this));
      }
    }
  }
  return list;
}
 
Example 2
Source File: Unity3dModuleResolver.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
@RequiredReadAction
public Module resolveModule(@Nonnull PsiDirectory psiDirectory, @Nonnull FileType fileType)
{
	Module module = resolveModuleImpl(psiDirectory, fileType);
	return module != null && module.getModuleDirUrl() != null ? null : module;
}
 
Example 3
Source File: ModuleManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
public void getState0(Element element) {
  final Element modulesElement = new Element(ELEMENT_MODULES);
  final Module[] modules = getModules();

  for (Module module : modules) {
    Element moduleElement = new Element(ELEMENT_MODULE);
    String name = module.getName();
    final String[] moduleGroupPath = getModuleGroupPath(module);
    if (moduleGroupPath != null) {
      name = StringUtil.join(moduleGroupPath, MODULE_GROUP_SEPARATOR) + MODULE_GROUP_SEPARATOR + name;
    }
    moduleElement.setAttribute(ATTRIBUTE_NAME, name);
    String moduleDirUrl = module.getModuleDirUrl();
    if (moduleDirUrl != null) {
      moduleElement.setAttribute(ATTRIBUTE_DIRURL, moduleDirUrl);
    }

    final ModuleRootManagerImpl moduleRootManager = (ModuleRootManagerImpl)ModuleRootManager.getInstance(module);
    moduleRootManager.saveState(moduleElement);

    collapseOrExpandMacros(module, moduleElement, true);

    modulesElement.addContent(moduleElement);
  }

  for (ModuleLoadItem failedModulePath : new ArrayList<>(myFailedModulePaths)) {
    final Element clone = failedModulePath.getElement().clone();
    modulesElement.addContent(clone);
  }

  element.addContent(modulesElement);
}
 
Example 4
Source File: MSBaseDotNetCompilerOptionsBuilder.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Override
public DotNetCompilerMessage convertToMessage(Module module, String line)
{
	if(line.startsWith("error"))
	{
		return new DotNetCompilerMessage(CompilerMessageCategory.ERROR, line, null, -1, 1);
	}
	else
	{
		Matcher matcher = LINE_ERROR_PATTERN.matcher(line);
		if(matcher.matches())
		{
			CompilerMessageCategory category = CompilerMessageCategory.INFORMATION;
			if(matcher.group(4).equals("error"))
			{
				category = CompilerMessageCategory.ERROR;
			}
			else if(matcher.group(4).equals("warning"))
			{
				category = CompilerMessageCategory.WARNING;
			}

			String fileUrl = FileUtil.toSystemIndependentName(matcher.group(1));
			if(!FileUtil.isAbsolute(fileUrl))
			{
				fileUrl = module.getModuleDirUrl() + "/" + fileUrl;
			}
			else
			{
				fileUrl = VirtualFileManager.constructUrl(StandardFileSystems.FILE_PROTOCOL, fileUrl);
			}

			int codeLine = Integer.parseInt(matcher.group(2));
			int codeColumn = Integer.parseInt(matcher.group(3));
			String message = matcher.group(6);
			if(ApplicationProperties.isInSandbox())
			{
				message += "(" + matcher.group(5) + ")";
			}
			return new DotNetCompilerMessage(category, message, fileUrl, codeLine, codeColumn - 1);
		}
	}
	return null;
}
 
Example 5
Source File: ModuleRootCompileScope.java    From consulo with Apache License 2.0 4 votes vote down vote up
private String[] getModuleContentUrls(final Module module) {
  return new String[]{module.getModuleDirUrl()};
}