private void initContentPanel() {

    moreOptionsPane = new MoreOptionsPane(this, formModel.isMoreOptionsFormCollapsedOnInit());

    resetButton = createButton("org/esa/snap/rcp/icons/Undo24.gif");
    resetButton.setName("ResetButton");
    resetButton.setToolTipText("Reset to defaults"); /*I18N*/
    resetButton.addActionListener(wrapWithAutoApplyActionListener(e -> resetToDefaults()));

    multiApplyButton = createButton("org/esa/snap/rcp/icons/MultiAssignBands24.gif");
    multiApplyButton.setName("MultiApplyButton");
    multiApplyButton.setToolTipText("Apply to other bands"); /*I18N*/
    multiApplyButton.addActionListener(e -> applyMultipleColorPaletteDef());

    importButton = createButton("tango/22x22/actions/document-open.png");
    importButton.setName("ImportButton");
    importButton.setToolTipText("Import colour palette from text file."); /*I18N*/
    importButton.addActionListener(
        e -> {
          importColorPaletteDef();
          applyChanges();
        });
    importButton.setEnabled(true);

    exportButton = createButton("tango/22x22/actions/document-save-as.png");
    exportButton.setName("ExportButton");
    exportButton.setToolTipText("Save colour palette to text file."); /*I18N*/
    exportButton.addActionListener(
        e -> {
          exportColorPaletteDef();
          childForm.updateFormModel(getFormModel());
        });
    exportButton.setEnabled(true);

    helpButton = createButton("tango/22x22/apps/help-browser.png");
    helpButton.setToolTipText("Help."); /*I18N*/
    helpButton.setName("helpButton");
    helpButton.addActionListener(e -> toolView.getHelpCtx().display());

    editorPanel = new JPanel(new BorderLayout(4, 4));
    toolButtonsPanel = GridBagUtils.createPanel();

    contentPanel = new JPanel(new BorderLayout(4, 4));
    contentPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    contentPanel.setPreferredSize(new Dimension(320, 200));
    contentPanel.add(editorPanel, BorderLayout.CENTER);
    contentPanel.add(toolButtonsPanel, BorderLayout.EAST);

    setProductSceneView(SnapApp.getDefault().getSelectedProductSceneView());

    SnapApp.getDefault().getSelectionSupport(ProductSceneView.class).addHandler(this);
  }
  private void applyMultipleColorPaletteDef() {
    if (!getFormModel().isValid()) {
      return;
    }

    final Product selectedProduct = getFormModel().getProduct();
    final ProductManager productManager = selectedProduct.getProductManager();
    final RasterDataNode[] protectedRasters = getFormModel().getRasters();
    final ArrayList<Band> availableBandList = new ArrayList<>();
    for (int i = 0; i < productManager.getProductCount(); i++) {
      final Product product = productManager.getProduct(i);
      final Band[] bands = product.getBands();
      for (final Band band : bands) {
        boolean validBand = false;
        if (band.getImageInfo() != null) {
          validBand = true;
          for (RasterDataNode protectedRaster : protectedRasters) {
            if (band == protectedRaster) {
              validBand = false;
            }
          }
        }
        if (validBand) {
          availableBandList.add(band);
        }
      }
    }
    final Band[] availableBands = new Band[availableBandList.size()];
    availableBandList.toArray(availableBands);
    availableBandList.clear();

    if (availableBands.length == 0) {
      JOptionPane.showMessageDialog(
          getToolViewPaneControl(),
          "No other bands available.", /*I18N*/
          titlePrefix,
          JOptionPane.WARNING_MESSAGE);
      return;
    }

    final BandChooser bandChooser =
        new BandChooser(
            SwingUtilities.getWindowAncestor(toolView),
            "Apply to other bands", /*I18N*/
            toolView.getHelpCtx().getHelpID(),
            availableBands,
            bandsToBeModified,
            false);

    final Set<RasterDataNode> modifiedRasters = new HashSet<>(availableBands.length);
    if (bandChooser.show() == BandChooser.ID_OK) {
      bandsToBeModified = bandChooser.getSelectedBands();
      for (final Band band : bandsToBeModified) {
        applyColorPaletteDef(
            getFormModel().getModifiedImageInfo().getColorPaletteDef(), band, band.getImageInfo());
        modifiedRasters.add(band);
      }
    }

    // This code replaces visatApp.updateImages(rasters) from BEAM code.
    WindowUtilities.getOpened(ProductSceneViewTopComponent.class)
        .forEach(
            tc -> {
              final ProductSceneView view = tc.getView();
              for (RasterDataNode raster : view.getRasters()) {
                if (modifiedRasters.contains(raster)) {
                  view.updateImage();
                  return;
                }
              }
            });
  }