Java 类com.intellij.util.descriptors.ConfigFile 实例源码

项目:intellij-ce-playground    文件:DeploymentUtilImpl.java   
@Nullable
public String getConfigFileErrorMessage(final ConfigFile configFile) {
  if (configFile.getVirtualFile() == null) {
    String path = FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl()));
    return CompilerBundle.message("mesage.text.deployment.descriptor.file.not.exist", path);
  }
  PsiFile psiFile = configFile.getPsiFile();
  if (psiFile == null || !psiFile.isValid()) {
    return CompilerBundle.message("message.text.deployment.description.invalid.file");
  }

  if (psiFile instanceof XmlFile) {
    XmlDocument document = ((XmlFile)psiFile).getDocument();
    if (document == null || document.getRootTag() == null) {
      return CompilerBundle.message("message.text.xml.file.invalid", FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl())));
    }
  }
  return null;
}
项目:google-cloud-intellij    文件:AppEngineStandardUltimateWebIntegration.java   
@Override
public VirtualFile suggestParentDirectoryForAppEngineWebXml(
    @NotNull Module module, @NotNull ModifiableRootModel rootModel) {
  final WebFacet webFacet = ContainerUtil.getFirstItem(WebFacet.getInstances(module));
  if (webFacet == null) {
    return null;
  }

  ConfigFile configFile = webFacet.getWebXmlDescriptor();
  if (configFile == null) {
    return null;
  }

  final VirtualFile webXml = configFile.getVirtualFile();
  if (webXml == null) {
    return null;
  }

  return webXml.getParent();
}
项目:tools-idea    文件:DeploymentUtilImpl.java   
@Nullable
public String getConfigFileErrorMessage(final ConfigFile configFile) {
  if (configFile.getVirtualFile() == null) {
    String path = FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl()));
    return CompilerBundle.message("mesage.text.deployment.descriptor.file.not.exist", path);
  }
  PsiFile psiFile = configFile.getPsiFile();
  if (psiFile == null || !psiFile.isValid()) {
    return CompilerBundle.message("message.text.deployment.description.invalid.file");
  }

  if (psiFile instanceof XmlFile) {
    XmlDocument document = ((XmlFile)psiFile).getDocument();
    if (document == null || document.getRootTag() == null) {
      return CompilerBundle.message("message.text.xml.file.invalid", FileUtil.toSystemDependentName(VfsUtil.urlToPath(configFile.getUrl())));
    }
  }
  return null;
}
项目:consulo-javaee    文件:JavaeeDescriptor.java   
@Nullable
public <T extends DomElement> T getRoot(@Nullable JavaEEModuleExtension<?> facet, @NotNull Class<T> type)
{
    if(facet != null)
    {
        ConfigFile item = facet.getDescriptorsContainer().getConfigFile(meta);
        if(item != null)
        {
            XmlFile xml = item.getXmlFile();
            if(xml != null)
            {
                DomFileElement<T> element = DomManager.getDomManager(facet.getModule().getProject()).getFileElement(xml, type);
                if(element != null)
                {
                    return element.getRootElement();
                }
            }
        }
    }
    return null;
}
项目:intellij-ce-playground    文件:DeploymentUtilImpl.java   
public void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module) {
  final String description = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
  String descriptorPath = VfsUtil.urlToPath(descriptor.getUrl());
  final String message =
    CompilerBundle.message("message.text.compiling.item.deployment.descriptor.could.not.be.found", description, descriptorPath);
  context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
}
项目:intellij-ce-playground    文件:DeploymentUtilImpl.java   
public void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module) {
  if (new File(VfsUtil.urlToPath(descriptor.getUrl())).exists()) {
    String message = getConfigFileErrorMessage(descriptor);
    if (message != null) {
      final String moduleDescription = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
      compileContext.addMessage(CompilerMessageCategory.ERROR,
                              CompilerBundle.message("message.text.compiling.module.message", moduleDescription, message),
                                descriptor.getUrl(), -1, -1);
    }
  }
  else {
    DeploymentUtil.getInstance().reportDeploymentDescriptorDoesNotExists(descriptor, compileContext, module);
  }
}
项目:intellij-ce-playground    文件:PluginModuleType.java   
@Nullable
  public static XmlFile getPluginXml(Module module) {
    if (module == null) return null;
    if (!isOfType(module)) return null;

    final PluginBuildConfiguration buildConfiguration = PluginBuildConfiguration.getInstance(module);
    if (buildConfiguration == null) return null;
    final ConfigFile configFile = buildConfiguration.getPluginXmlConfigFile();
    return configFile != null ? configFile.getXmlFile() : null;
}
项目:tools-idea    文件:DeploymentUtilImpl.java   
public void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module) {
  final String description = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
  String descriptorPath = VfsUtil.urlToPath(descriptor.getUrl());
  final String message =
    CompilerBundle.message("message.text.compiling.item.deployment.descriptor.could.not.be.found", description, descriptorPath);
  context.addMessage(CompilerMessageCategory.ERROR, message, null, -1, -1);
}
项目:tools-idea    文件:DeploymentUtilImpl.java   
public void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module) {
  if (new File(VfsUtil.urlToPath(descriptor.getUrl())).exists()) {
    String message = getConfigFileErrorMessage(descriptor);
    if (message != null) {
      final String moduleDescription = ModuleType.get(module).getName() + " '" + module.getName() + '\'';
      compileContext.addMessage(CompilerMessageCategory.ERROR,
                              CompilerBundle.message("message.text.compiling.module.message", moduleDescription, message),
                                descriptor.getUrl(), -1, -1);
    }
  }
  else {
    DeploymentUtil.getInstance().reportDeploymentDescriptorDoesNotExists(descriptor, compileContext, module);
  }
}
项目:tools-idea    文件:PluginModuleType.java   
@Nullable
  public static XmlFile getPluginXml(Module module) {
    if (module == null) return null;
    if (!(get(module) instanceof PluginModuleType)) return null;

    final PluginBuildConfiguration buildConfiguration = PluginBuildConfiguration.getInstance(module);
    if (buildConfiguration == null) return null;
    final ConfigFile configFile = buildConfiguration.getPluginXmlConfigFile();
    return configFile != null ? configFile.getXmlFile() : null;
}
项目:consulo-javaee    文件:TomcatUtil.java   
@Nullable
public static Element findContextInContextXmlByFacet(TomcatDeploymentModelBase tomcatModel)
{
    Artifact artifact = tomcatModel.getArtifact();
    if(artifact != null)
    {
        JavaeeDescriptor contextDescriptor = TomcatIntegration.getInstance().getDescriptorsManager().getItem(TomcatContextRoot.class);
        ConfigFileMetaData metaData = contextDescriptor.getMetaData();
        for(JavaEEModuleExtension facet : JavaeeArtifactUtil.getInstance().getFacetsIncludedInArtifact(tomcatModel.getCommonModel().getProject(), artifact, JavaWebModuleExtension.class))
        {
            ConfigFile configFile = facet.getDescriptorsContainer().getConfigFile(metaData);
            try
            {
                if(configFile != null)
                {
                    VirtualFile contextXmlFile = configFile.getVirtualFile();
                    if(contextXmlFile != null)
                    {
                        Document contextDocument = loadXMLFile(VfsUtilCore.virtualToIoFile(contextXmlFile));
                        return contextDocument.getRootElement();
                    }
                }
            }
            catch(ExecutionException e)
            {
                LOG.info(e);
            }
        }
    }

    return null;
}
项目:intellij-ce-playground    文件:DeploymentUtil.java   
@Deprecated
public abstract void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module);
项目:intellij-ce-playground    文件:DeploymentUtil.java   
@Nullable
public abstract String getConfigFileErrorMessage(ConfigFile configFile);
项目:intellij-ce-playground    文件:DeploymentUtil.java   
@Deprecated
public abstract void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module);
项目:intellij-ce-playground    文件:InspectionValidatorUtil.java   
public static void addDescriptor(@NotNull final Collection<VirtualFile> result, @Nullable final ConfigFile configFile) {
  if (configFile != null) {
    ContainerUtil.addIfNotNull(configFile.getVirtualFile(), result);
  }
}
项目:intellij-ce-playground    文件:PluginBuildConfiguration.java   
@Nullable
public ConfigFile getPluginXML() {
  return myPluginXmlContainer.getConfigFile(PluginDescriptorConstants.META_DATA);
}
项目:intellij-ce-playground    文件:PluginBuildConfiguration.java   
@Nullable
public ConfigFile getPluginXmlConfigFile() {
  return myPluginXmlContainer.getConfigFile(PluginDescriptorConstants.META_DATA);
}
项目:intellij-ce-playground    文件:PluginBuildConfiguration.java   
@Nullable
private String getPluginXmlUrl() {
  ConfigFile configFile = getPluginXmlConfigFile();
  return configFile != null ? configFile.getUrl() : null;
}
项目:tools-idea    文件:DeploymentUtil.java   
@Nullable
public abstract String getConfigFileErrorMessage(ConfigFile configFile);
项目:tools-idea    文件:InspectionValidatorUtil.java   
public static void addDescriptor(@NotNull final Collection<VirtualFile> result, @Nullable final ConfigFile configFile) {
  if (configFile != null) {
    ContainerUtil.addIfNotNull(configFile.getVirtualFile(), result);
  }
}
项目:tools-idea    文件:PluginBuildConfiguration.java   
@Nullable
public ConfigFile getPluginXML() {
  return myPluginXmlContainer.getConfigFile(PluginDescriptorConstants.META_DATA);
}
项目:tools-idea    文件:PluginBuildConfiguration.java   
@Nullable
public ConfigFile getPluginXmlConfigFile() {
  return myPluginXmlContainer.getConfigFile(PluginDescriptorConstants.META_DATA);
}
项目:tools-idea    文件:PluginBuildConfiguration.java   
@Nullable
private String getPluginXmlUrl() {
  ConfigFile configFile = getPluginXmlConfigFile();
  return configFile != null ? configFile.getUrl() : null;
}
项目:tools-idea    文件:DeploymentUtil.java   
public abstract void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module);
项目:tools-idea    文件:DeploymentUtil.java   
public abstract void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module);