public void clearCode() { setCode(""); }
public void setCode(String newCode) { setCode(newCode, false, -1); }
public void actionPerformed(ActionEvent e) { if (history.size() > 0 && historyIndex >= 0) { final int oldHistoryIndex = historyIndex; historyIndex--; setCode(history.get(oldHistoryIndex)); } } });
public void actionPerformed(ActionEvent e) { if (history.size() > 0 && historyIndex < history.size()) { historyIndex++; setCode(history.get(historyIndex)); } } });
public void undoLastEdit() { if (!undoBuffer.isEmpty()) { String code = undoBuffer.pop(); setCode(code); updateUIState(); codeArea.requestFocus(); } }
private void invokeExpressionEditor(final int colorIndex) { final Window window = SwingUtilities.getWindowAncestor(this); final String title = "Edit " + COLOR_COMP_NAMES[colorIndex] + " Expression"; if (product != null) { final ExpressionPane pane; pane = ProductExpressionPane.createGeneralExpressionPane(new Product[]{product}, 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()); } } }
private void invokeExpressionEditor() { final Window window = SwingUtilities.getWindowAncestor(VisatApp.getApp().getMainFrame()); final ExpressionPane pane = ProductExpressionPane.createBooleanExpressionPane(new Product[]{_product}, _product, VisatApp.getApp().getPreferences()); pane.setCode(_validMaskField.getText()); final int status = pane.showModalDialog(window, "Edit Valid Mask Expression"); /*I18N*/ if (status == ModalDialog.ID_OK) { _validMaskField.setText(pane.getCode()); _validMaskField.setCaretPosition(0); } }
setCode(sb.toString(), true, newCaretPos);