Java 类com.intellij.openapi.components.ComponentSerializationUtil 实例源码

项目:tools-idea    文件:DeployToServerRunConfiguration.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  ConfigurationState state = XmlSerializer.deserialize(element, ConfigurationState.class);
  myServerName =  null;
  myDeploymentSource = null;
  if (state != null) {
    myServerName = state.myServerName;
    if (!state.myDeploymentItemState.isEmpty()) {
      DeploymentItemState itemState = state.myDeploymentItemState.get(0);
      myDeploymentSource = itemState.createSource(getProject());
      myDeploymentConfiguration = myDeploymentConfigurator.createDefaultConfiguration(myDeploymentSource);
      if (itemState.mySettings != null) {
        ComponentSerializationUtil.loadComponentState(myDeploymentConfiguration.getSerializer(), itemState.mySettings);
      }
    }
  }
}
项目:consulo    文件:DeployToServerRunConfiguration.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  ConfigurationState state = XmlSerializer.deserialize(element, ConfigurationState.class);
  myServerName =  null;
  myDeploymentSource = null;
  if (state != null) {
    myServerName = state.myServerName;
    Element deploymentTag = state.myDeploymentTag;
    if (deploymentTag != null) {
      String typeId = deploymentTag.getAttributeValue(DEPLOYMENT_SOURCE_TYPE_ATTRIBUTE);
      DeploymentSourceType<?> type = findDeploymentSourceType(typeId);
      if (type != null) {
        myDeploymentSource = type.load(deploymentTag, getProject());
        myDeploymentConfiguration = myDeploymentConfigurator.createDefaultConfiguration(myDeploymentSource);
        ComponentSerializationUtil.loadComponentState(myDeploymentConfiguration.getSerializer(), deploymentTag.getChild(SETTINGS_ELEMENT));
      }
      else {
        LOG.warn("Cannot load deployment source for '" + getName() + "' run configuration: unknown deployment type '" + typeId + "'");
      }
    }
  }
}
项目:consulo    文件:LocalServerRunConfiguration.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  ConfigurationState state = XmlSerializer.deserialize(element, ConfigurationState.class);
  myDeploymentSource = null;
  if (state != null) {
    Element deploymentTag = state.myDeploymentTag;
    if (deploymentTag != null) {
      String typeId = deploymentTag.getAttributeValue(DEPLOYMENT_SOURCE_TYPE_ATTRIBUTE);
      DeploymentSourceType<?> type = findDeploymentSourceType(typeId);
      if (type != null) {
        myDeploymentSource = type.load(deploymentTag, getProject());
        myDeploymentConfiguration = myDeploymentConfigurator.createDefaultConfiguration(myDeploymentSource);
        ComponentSerializationUtil.loadComponentState(myDeploymentConfiguration.getSerializer(), deploymentTag.getChild(SETTINGS_ELEMENT));
      }
      else {
        LOG.warn("Cannot load deployment source for '" + getName() + "' run configuration: unknown deployment type '" + typeId + "'");
      }
    }
  }
}
项目:intellij-ce-playground    文件:LibraryImpl.java   
private void readProperties(Element element) {
  final String typeId = element.getAttributeValue(LIBRARY_TYPE_ATTR);
  if (typeId == null) return;

  myKind = (PersistentLibraryKind<?>) LibraryKind.findById(typeId);
  if (myKind == null) return;

  myProperties = myKind.createDefaultProperties();
  final Element propertiesElement = element.getChild(PROPERTIES_ELEMENT);
  if (propertiesElement != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, propertiesElement);
  }
}
项目:intellij-ce-playground    文件:DeployToServerRunConfiguration.java   
@Override
public void readExternal(Element element) throws InvalidDataException {
  super.readExternal(element);
  ConfigurationState state = XmlSerializer.deserialize(element, ConfigurationState.class);
  myServerName =  null;
  myDeploymentSource = null;
  if (state != null) {
    myServerName = state.myServerName;
    final Element deploymentTag = state.myDeploymentTag;
    if (deploymentTag != null) {
      String typeId = deploymentTag.getAttributeValue(DEPLOYMENT_SOURCE_TYPE_ATTRIBUTE);
      final DeploymentSourceType<?> type = findDeploymentSourceType(typeId);
      if (type != null) {
        myDeploymentSource = new ReadAction<DeploymentSource>() {
          protected void run(final @NotNull Result<DeploymentSource> result) {
            result.setResult(type.load(deploymentTag, getProject()));
          }
        }.execute().getResultObject();
        myDeploymentConfiguration = myDeploymentConfigurator.createDefaultConfiguration(myDeploymentSource);
        ComponentSerializationUtil.loadComponentState(myDeploymentConfiguration.getSerializer(), deploymentTag.getChild(SETTINGS_ELEMENT));
      }
      else {
        LOG.warn("Cannot load deployment source for '" + getName() + "' run configuration: unknown deployment type '" + typeId + "'");
      }
    }
  }
}
项目:intellij-ce-playground    文件:XBreakpointBase.java   
protected XBreakpointBase(final XBreakpointType<Self, P> type, XBreakpointManagerImpl breakpointManager, S breakpointState) {
  myState = breakpointState;
  myType = type;
  myBreakpointManager = breakpointManager;
  myProperties = type.createProperties();
  if (myProperties != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, myState.getPropertiesElement());
  }
  initExpressions();
}
项目:intellij-ce-playground    文件:FacetUtil.java   
public static void loadFacetConfiguration(final @NotNull FacetConfiguration configuration, final @Nullable Element config)
    throws InvalidDataException {
  if (config != null) {
    if (configuration instanceof PersistentStateComponent) {
      ComponentSerializationUtil.loadComponentState((PersistentStateComponent)configuration, config);
    }
    else {
      configuration.readExternal(config);
    }
  }
}
项目:tools-idea    文件:LibraryImpl.java   
private void readProperties(Element element) {
  final String typeId = element.getAttributeValue(LIBRARY_TYPE_ATTR);
  if (typeId == null) return;

  myKind = (PersistentLibraryKind<?>) LibraryKind.findById(typeId);
  if (myKind == null) return;

  myProperties = myKind.createDefaultProperties();
  final Element propertiesElement = element.getChild(PROPERTIES_ELEMENT);
  if (propertiesElement != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, propertiesElement);
  }
}
项目:tools-idea    文件:XBreakpointBase.java   
protected XBreakpointBase(final XBreakpointType<Self, P> type, XBreakpointManagerImpl breakpointManager, S breakpointState) {
  myState = breakpointState;
  myType = type;
  myBreakpointManager = breakpointManager;
  myProperties = type.createProperties();
  if (myProperties != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, myState.getPropertiesElement());
  }
}
项目:tools-idea    文件:FacetUtil.java   
public static void loadFacetConfiguration(final @NotNull FacetConfiguration configuration, final @Nullable Element config)
    throws InvalidDataException {
  if (config != null) {
    if (configuration instanceof PersistentStateComponent) {
      ComponentSerializationUtil.loadComponentState((PersistentStateComponent)configuration, config);
    }
    else {
      configuration.readExternal(config);
    }
  }
}
项目:consulo    文件:LibraryImpl.java   
private void readProperties(Element element) {
  final String typeId = element.getAttributeValue(LIBRARY_TYPE_ATTR);
  if (typeId == null) return;

  myKind = (PersistentLibraryKind<?>)LibraryKind.findById(typeId);
  if (myKind == null) return;

  myProperties = myKind.createDefaultProperties();
  final Element propertiesElement = element.getChild(PROPERTIES_ELEMENT);
  if (propertiesElement != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, propertiesElement);
  }
}
项目:consulo    文件:XBreakpointBase.java   
protected XBreakpointBase(final XBreakpointType<Self, P> type, XBreakpointManagerImpl breakpointManager, S breakpointState) {
  myState = breakpointState;
  myType = type;
  myBreakpointManager = breakpointManager;
  myProperties = type.createProperties();
  if (myProperties != null) {
    ComponentSerializationUtil.loadComponentState(myProperties, myState.getPropertiesElement());
  }
  initExpressions();
}