Java 类com.intellij.lang.ant.ReflectedProject 实例源码

项目:intellij-ce-playground    文件:AntDomProject.java   
private Map<String, String> getProperties() {
  Map<String, String> properties = myProperties;
  if (properties == null) {
    final ReflectedProject reflected = ReflectedProject.getProject(getClassLoader());
    Map<String, String> externals = Collections.emptyMap();
    final PsiFile containingFile = getXmlTag().getContainingFile();
    if (containingFile != null) {
      final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
      if (buildFile != null) {
        externals = buildFile.getExternalProperties();
      }
    }
    myProperties = (properties = loadPredefinedProperties(reflected.getProperties(), externals));
  }
  return properties;
}
项目:tools-idea    文件:AntDomProject.java   
private Map<String, String> getProperties() {
  Map<String, String> properties = myProperties;
  if (properties == null) {
    final ReflectedProject reflected = ReflectedProject.getProject(getClassLoader());
    Map<String, String> externals = Collections.emptyMap();
    final PsiFile containingFile = getXmlTag().getContainingFile();
    if (containingFile != null) {
      final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
      if (buildFile != null) {
        externals = buildFile.getExternalProperties();
      }
    }
    myProperties = (properties = loadPredefinedProperties(reflected.getProperties(), externals));
  }
  return properties;
}
项目:consulo-apache-ant    文件:AntDomProject.java   
private Map<String, String> getProperties() {
  Map<String, String> properties = myProperties;
  if (properties == null) {
    final ReflectedProject reflected = ReflectedProject.getProject(getClassLoader());
    Map<String, String> externals = Collections.emptyMap();
    final PsiFile containingFile = getXmlTag().getContainingFile();
    if (containingFile != null) {
      final AntBuildFileImpl buildFile = (AntBuildFileImpl)AntConfigurationBase.getInstance(containingFile.getProject()).getAntBuildFile(containingFile);
      if (buildFile != null) {
        externals = buildFile.getExternalProperties();
      }
    }
    myProperties = (properties = loadPredefinedProperties(reflected.getProperties(), externals));
  }
  return properties;
}
项目:intellij-ce-playground    文件:AntTasksProvider.java   
public AntClassLoader(ArrayList<URL> urls) {
  super(build().urls(urls).allowUnescaped().noPreload());
  myFuture = ApplicationManager.getApplication().executeOnPooledThread(new Callable<Map<String, Class>>() {
    @Override
    public Map<String, Class> call() throws Exception {
      try {
        final ReflectedProject antProject = ReflectedProject.getProject(AntClassLoader.this);
        final Map<String, Class> result = new HashMap<String, Class>();
        if (antProject != null) {
          final Map<String, Class> taskDefinitions = antProject.getTaskDefinitions();
          if (taskDefinitions != null) {
            result.putAll(taskDefinitions);
          }
          final Map<String, Class> dataTypeDefinitions = antProject.getDataTypeDefinitions();
          if (dataTypeDefinitions != null) {
            result.putAll(dataTypeDefinitions);
          }
        }
        return result;
      }
      catch (Exception e) {
        LOG.error(e);
        return null;
      }
    }
  });
}
项目:tools-idea    文件:AntTasksProvider.java   
public AntClassLoader(ArrayList<URL> urls) {
  super(urls, null, false, false, true, false);
  myFuture = ApplicationManager.getApplication().executeOnPooledThread(new Callable<Map<String, Class>>() {
    @Override
    public Map<String, Class> call() throws Exception {
      try {
        final ReflectedProject antProject = ReflectedProject.getProject(AntClassLoader.this);
        final Map<String, Class> result = new HashMap<String, Class>();
        if (antProject != null) {
          final Map<String, Class> taskDefinitions = antProject.getTaskDefinitions();
          if (taskDefinitions != null) {
            result.putAll(taskDefinitions);
          }
          final Map<String, Class> dataTypeDefinitions = antProject.getDataTypeDefinitions();
          if (dataTypeDefinitions != null) {
            result.putAll(dataTypeDefinitions);
          }
        }
        return result;
      }
      catch (Exception e) {
        LOG.error(e);
        return null;
      }
    }
  });
}
项目:intellij-ce-playground    文件:CustomAntElementsRegistry.java   
public void visitScriptDef(AntDomScriptDef scriptdef) {
  final String customTagName = scriptdef.getName().getStringValue();
  if (customTagName != null) {
    final String nsUri = scriptdef.getUri().getStringValue();
    final ClassLoader classLoader = getClassLoader(scriptdef, myAntProject);
    // register the scriptdef
    addCustomDefinition(scriptdef, customTagName, nsUri, ClassProvider.EMPTY);
    // registering nested elements
    ReflectedProject reflectedProject = null;
    for (AntDomScriptdefElement element : scriptdef.getScriptdefElements()) {
      final String customSubTagName = element.getName().getStringValue();
      if (customSubTagName != null) {
        final String classname = element.getClassname().getStringValue();
        if (classname != null) {
          addCustomDefinition(element, customTagName, nsUri, ClassProvider.create(classname, classLoader));
        }
        else {
          Class clazz = null;
          final String typeName = element.getElementType().getStringValue();
          if (typeName != null) {
            clazz = lookupClass(new XmlName(typeName));
            if (clazz == null) {
              if (reflectedProject == null) { // lazy init
                reflectedProject = ReflectedProject.getProject(myAntProject.getClassLoader());
              }
              final Hashtable<String, Class> coreTasks = reflectedProject.getTaskDefinitions();
              if (coreTasks != null) {
                clazz = coreTasks.get(typeName);
              }
              if (clazz == null) {
                final Hashtable<String, Class> coreTypes = reflectedProject.getDataTypeDefinitions();
                if (coreTypes != null) {
                  clazz = coreTypes.get(typeName);
                }
              }
            }
          }
          addCustomDefinition(element, customSubTagName, nsUri, ClassProvider.create(clazz));
        }
      }
    }
  }
}
项目:tools-idea    文件:CustomAntElementsRegistry.java   
public void visitScriptDef(AntDomScriptDef scriptdef) {
  final String customTagName = scriptdef.getName().getStringValue();
  if (customTagName != null) {
    final String nsUri = scriptdef.getUri().getStringValue();
    final ClassLoader classLoader = getClassLoader(scriptdef, myAntProject);
    // register the scriptdef
    addCustomDefinition(scriptdef, customTagName, nsUri, ClassProvider.EMPTY);
    // registering nested elements
    ReflectedProject reflectedProject = null;
    for (AntDomScriptdefElement element : scriptdef.getScriptdefElements()) {
      final String customSubTagName = element.getName().getStringValue();
      if (customSubTagName != null) {
        final String classname = element.getClassname().getStringValue();
        if (classname != null) {
          addCustomDefinition(element, customTagName, nsUri, ClassProvider.create(classname, classLoader));
        }
        else {
          Class clazz = null;
          final String typeName = element.getElementType().getStringValue();
          if (typeName != null) {
            clazz = lookupClass(new XmlName(typeName));
            if (clazz == null) {
              if (reflectedProject == null) { // lazy init
                reflectedProject = ReflectedProject.getProject(myAntProject.getClassLoader());
              }
              final Hashtable<String, Class> coreTasks = reflectedProject.getTaskDefinitions();
              if (coreTasks != null) {
                clazz = coreTasks.get(typeName);
              }
              if (clazz == null) {
                final Hashtable<String, Class> coreTypes = reflectedProject.getDataTypeDefinitions();
                if (coreTypes != null) {
                  clazz = coreTypes.get(typeName);
                }
              }
            }
          }
          addCustomDefinition(element, customSubTagName, nsUri, ClassProvider.create(clazz));
        }
      }
    }
  }
}
项目:consulo-apache-ant    文件:CustomAntElementsRegistry.java   
public void visitScriptDef(AntDomScriptDef scriptdef) {
  final String customTagName = scriptdef.getName().getStringValue();
  if (customTagName != null) {
    final String nsUri = scriptdef.getUri().getStringValue();
    final ClassLoader classLoader = getClassLoader(scriptdef, myAntProject);
    // register the scriptdef
    addCustomDefinition(scriptdef, customTagName, nsUri, ClassProvider.EMPTY);
    // registering nested elements
    ReflectedProject reflectedProject = null;
    for (AntDomScriptdefElement element : scriptdef.getScriptdefElements()) {
      final String customSubTagName = element.getName().getStringValue();
      if (customSubTagName != null) {
        final String classname = element.getClassname().getStringValue();
        if (classname != null) {
          addCustomDefinition(element, customTagName, nsUri, ClassProvider.create(classname, classLoader));
        }
        else {
          Class clazz = null;
          final String typeName = element.getElementType().getStringValue();
          if (typeName != null) {
            clazz = lookupClass(new XmlName(typeName));
            if (clazz == null) {
              if (reflectedProject == null) { // lazy init
                reflectedProject = ReflectedProject.getProject(myAntProject.getClassLoader());
              }
              final Hashtable<String, Class> coreTasks = reflectedProject.getTaskDefinitions();
              if (coreTasks != null) {
                clazz = coreTasks.get(typeName);
              }
              if (clazz == null) {
                final Hashtable<String, Class> coreTypes = reflectedProject.getDataTypeDefinitions();
                if (coreTypes != null) {
                  clazz = coreTypes.get(typeName);
                }
              }
            }
          }
          addCustomDefinition(element, customSubTagName, nsUri, ClassProvider.create(clazz));
        }
      }
    }
  }
}