private void addLayoutProperties(@NotNull Container component) {
    LayoutManager layout = component.getLayout();
    if (layout instanceof GridBagLayout bagLayout) {
      GridBagConstraints defaultConstraints =
        ReflectionUtil.getField(GridBagLayout.class, bagLayout, GridBagConstraints.class, "defaultConstraints");

      myProperties.add(new PropertyBean("GridBagLayout constraints",
                                        String.format("defaultConstraints - %s", toString(defaultConstraints))));
      if (bagLayout.columnWidths != null) addSubValue("columnWidths", Arrays.toString(bagLayout.columnWidths));
      if (bagLayout.rowHeights != null) addSubValue("rowHeights", Arrays.toString(bagLayout.rowHeights));
      if (bagLayout.columnWeights != null) addSubValue("columnWeights", Arrays.toString(bagLayout.columnWeights));
      if (bagLayout.rowWeights != null) addSubValue("rowWeights", Arrays.toString(bagLayout.rowWeights));

      for (Component child : component.getComponents()) {
        addSubValue(UiInspectorUtil.getComponentName(child), toString(bagLayout.getConstraints(child)));
      }
    }
    else if (layout instanceof BorderLayout borderLayout) {

      myProperties.add(new PropertyBean("BorderLayout constraints",
                                        String.format("hgap - %s, vgap - %s", borderLayout.getHgap(), borderLayout.getVgap())));

      for (Component child : component.getComponents()) {
        addSubValue(UiInspectorUtil.getComponentName(child), borderLayout.getConstraints(child));
      }
    }
    else if (layout instanceof CardLayout cardLayout) {
      Integer currentCard = ReflectionUtil.getField(CardLayout.class, cardLayout, null, "currentCard");
      //noinspection UseOfObsoleteCollectionType
      Vector<?> vector = ReflectionUtil.getField(CardLayout.class, cardLayout, Vector.class, "vector");
      String cardDescription = "???";
      if (vector != null && currentCard != null) {
        Object card = vector.get(currentCard);
        cardDescription = ReflectionUtil.getField(card.getClass(), card, String.class, "name");
      }

      myProperties.add(new PropertyBean("CardLayout constraints",
                                        String.format("card - %s, hgap - %s, vgap - %s",
                                                      cardDescription, cardLayout.getHgap(), cardLayout.getVgap())));

      if (vector != null) {
        for (Object card : vector) {
          String cardName = ReflectionUtil.getField(card.getClass(), card, String.class, "name");
          Component child = ReflectionUtil.getField(card.getClass(), card, Component.class, "comp");
          if (child != null) {
            addSubValue(UiInspectorUtil.getComponentName(child), cardName);
          }
        }
      }
    }
    else if (layout instanceof MigLayout migLayout) {

      Object constraints = migLayout.getLayoutConstraints();
      if (constraints instanceof LC) {
        addMigLayoutLayoutConstraints((LC)constraints);
      }
      else {
        myProperties.add(new PropertyBean("MigLayout layout constraints", constraints));
      }

      constraints = migLayout.getColumnConstraints();
      if (constraints instanceof AC) {
        addMigLayoutAxisConstraints("MigLayout column constraints", (AC)constraints);
      }
      else {
        myProperties.add(new PropertyBean("MigLayout column constraints", constraints));
      }

      constraints = migLayout.getRowConstraints();
      if (constraints instanceof AC) {
        addMigLayoutAxisConstraints("MigLayout row constraints", (AC)constraints);
      }
      else {
        myProperties.add(new PropertyBean("MigLayout row constraints", constraints));
      }

      for (Component child : component.getComponents()) {
        addSubValue(UiInspectorUtil.getComponentName(child), migLayout.getComponentConstraints(child));
      }
    }
    else if (layout instanceof com.intellij.ui.layout.migLayout.patched.MigLayout migLayout) {

      addMigLayoutLayoutConstraints(migLayout.getLayoutConstraints());
      addMigLayoutAxisConstraints("MigLayout column constraints", migLayout.getColumnConstraints());
      addMigLayoutAxisConstraints("MigLayout row constraints", migLayout.getRowConstraints());
    }
    else if (layout instanceof com.intellij.ui.dsl.gridLayout.GridLayout) {
      Grid grid = ((GridLayout)layout).getRootGrid();
      myProperties.add(new PropertyBean("GridLayout", null));
      addSubValue("resizableColumns", grid.getResizableColumns());
      addSubValue("columnsGaps", grid.getColumnsGaps());
      addSubValue("resizableRows", grid.getResizableRows());
      addSubValue("rowsGaps", grid.getRowsGaps());
    }
  }
private void addLayoutProperties(@NotNull Container component)