protected void storeState() {
    if (myRootComponent != null && myExpandedState == null && mySelectionState == null) {
      myExpandedState = new int[myExpandedComponents == null ? 0 : myExpandedComponents.size()][];
      for (int i = 0; i < myExpandedState.length; i++) {
        IntArrayList path = new IntArrayList();
        componentToPath((RadComponent) myExpandedComponents.get(i), path);
        myExpandedState[i] = path.toArray();
      }

      mySelectionState = getSelectionState();

      myExpandedComponents = null;
      myToolProvider.loadDefaultTool();

      mySurfaceArea.removeSelectionListener(mySourceSelectionListener);
      mySurfaceArea.deselectAll();
      mySurfaceArea.addSelectionListener(mySourceSelectionListener);
    }
  }