Пример #1
0
 private void loadState(final Element element) {
   setInstrumentationType(JDOMExternalizerUtil.readField(element, INSTRUMENTATION_TYPE_NAME));
   setLanguageAnnotation(JDOMExternalizerUtil.readField(element, LANGUAGE_ANNOTATION_NAME));
   setPatternAnnotation(JDOMExternalizerUtil.readField(element, PATTERN_ANNOTATION_NAME));
   setSubstAnnotation(JDOMExternalizerUtil.readField(element, SUBST_ANNOTATION_NAME));
   if (readBoolean(element, RESOLVE_REFERENCES, true)) {
     setDfaOption(DfaOption.RESOLVE);
   }
   if (readBoolean(element, LOOK_FOR_VAR_ASSIGNMENTS, false)) {
     setDfaOption(DfaOption.ASSIGNMENTS);
   }
   if (readBoolean(element, USE_DFA_IF_AVAILABLE, false)) {
     setDfaOption(DfaOption.DFA);
   }
   setIncludeUncomputablesAsLiterals(
       readBoolean(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, false));
   setSourceModificationAllowed(readBoolean(element, SOURCE_MODIFICATION_ALLOWED, false));
 }
Пример #2
0
  public void loadState(final Element element, final boolean mergeWithOriginalAndCompile) {
    final THashMap<String, LanguageInjectionSupport> supports =
        new THashMap<String, LanguageInjectionSupport>();
    for (LanguageInjectionSupport support :
        Extensions.getExtensions(LanguageInjectionSupport.EP_NAME)) {
      supports.put(support.getId(), support);
    }
    loadStateOld(
        element,
        supports.get(LanguageInjectionSupport.XML_SUPPORT_ID),
        supports.get(LanguageInjectionSupport.JAVA_SUPPORT_ID));
    for (Element child : (List<Element>) element.getChildren("injection")) {
      final String key = child.getAttributeValue("injector-id");
      final LanguageInjectionSupport support = supports.get(key);
      final BaseInjection injection =
          support == null ? new BaseInjection(key) : support.createInjection(child);
      injection.loadState(child);
      myInjections.get(key).add(injection);
    }
    setInstrumentationType(JDOMExternalizerUtil.readField(element, INSTRUMENTATION_TYPE_NAME));
    setLanguageAnnotation(JDOMExternalizerUtil.readField(element, LANGUAGE_ANNOTATION_NAME));
    setPatternAnnotation(JDOMExternalizerUtil.readField(element, PATTERN_ANNOTATION_NAME));
    setSubstAnnotation(JDOMExternalizerUtil.readField(element, SUBST_ANNOTATION_NAME));
    setResolveReferences(readBoolean(element, RESOLVE_REFERENCES, true));
    setUseDfaIfAvailable(readBoolean(element, USE_DFA_IF_AVAILABLE, false));
    setIncludeUncomputablesAsLiterals(
        readBoolean(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, false));

    if (mergeWithOriginalAndCompile) {
      mergeWithDefaultConfiguration();

      for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) {
        for (BaseInjection injection : getInjections(supportId)) {
          injection.initializePlaces(true);
        }
      }
    }
  }
Пример #3
0
 private static boolean readBoolean(Element element, String key, boolean defValue) {
   final String value = JDOMExternalizerUtil.readField(element, key);
   if (value == null) return defValue;
   return Boolean.parseBoolean(value);
 }