private void invokeExpressionEditor(final int colorIndex) { final Window window = SwingUtilities.getWindowAncestor(this); final String title = "Edit " + getComponentName(colorIndex) + " Expression"; if (product != null) { final ExpressionPane pane; final Product[] products = getCompatibleProducts(product, openedProducts); pane = ProductExpressionPane.createGeneralExpressionPane(products, product, preferences); pane.setCode(getExpression(colorIndex)); int status = pane.showModalDialog(window, title); if (status == ModalDialog.ID_OK) { setExpression(colorIndex, pane.getCode()); } } else { final JTextArea textArea = new JTextArea(8, 48); textArea.setFont(EXPRESSION_FONT); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setText(getExpression(colorIndex)); final ModalDialog modalDialog = new ModalDialog(window, title, ModalDialog.ID_OK_CANCEL, ""); final JPanel panel = new JPanel(new BorderLayout(2, 2)); panel.add(new JLabel("Expression:"), BorderLayout.NORTH); panel.add(new JScrollPane(textArea), BorderLayout.CENTER); modalDialog.setContent(panel); final int status = modalDialog.show(); if (status == ModalDialog.ID_OK) { setExpression(colorIndex, textArea.getText()); } } }