Java Code Examples for consulo.roots.impl.ModuleRootLayerImpl#loadState()

The following examples show how to use consulo.roots.impl.ModuleRootLayerImpl#loadState() . 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: RootModelImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
private void loadState(Element element, @Nullable ProgressIndicator progressIndicator) {
  String currentLayer = element.getAttributeValue("current-layer");
  if (currentLayer != null) {
    setCurrentLayerSafe(currentLayer);

    for (Element moduleLayerElement : element.getChildren("module-layer")) {
      String name = moduleLayerElement.getAttributeValue("name");

      ModuleRootLayerImpl moduleRootLayer = new ModuleRootLayerImpl(null, this);
      moduleRootLayer.loadState(moduleLayerElement, progressIndicator);

      ModuleRootLayerImpl layer = myLayers.put(name, moduleRootLayer);
      if (layer != null) {
        // dispose old layout
        Disposer.dispose(layer);
      }
    }
  }

  // old format - create default profile and load it
  if (myLayers.isEmpty()) {
    initDefaultLayer(element);
  }
}
 
Example 2
Source File: RootModelImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
private void initDefaultLayer(Element element) {
  setCurrentLayerSafe(DEFAULT_LAYER_NAME);

  ModuleRootLayerImpl moduleRootLayer = new ModuleRootLayerImpl(null, this);
  myLayers.put(myCurrentLayerName, moduleRootLayer);

  if (element != null) {
    moduleRootLayer.loadState(element, null);
  }
}