Exemplo n.º 1
0
    public String getText() {
      setClean();

      try {
        return m_syntaxDocument.getText(0, m_syntaxDocument.getLength());
      } catch (BadLocationException bl) {
        bl.printStackTrace();
        return "";
      }
    }
Exemplo n.º 2
0
    public void setText(String text) {
      try {
        m_syntaxDocument.beginCompoundEdit();
        m_syntaxDocument.remove(0, m_syntaxDocument.getLength());
        m_syntaxDocument.insertString(0, text, null);
      } catch (BadLocationException bl) {
        bl.printStackTrace();
      } finally {
        m_syntaxDocument.endCompoundEdit();
      }

      setClean();
    }
Exemplo n.º 3
0
  /** Creates new form TotalObjectDialog */
  public TotalObjectDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();

    this.setSize(400, 450);

    this.setModal(true);

    org.syntax.jedit.SyntaxDocument sd = new org.syntax.jedit.SyntaxDocument();
    sd.setTokenMarker(new org.syntax.jedit.tokenmarker.JavaTokenMarker());

    this.jRTextExpressionAreaDefaultExpression.setDocument(sd);

    jTree1.setCellRenderer(new DocumentExpressionEditorTreeCellRenderer());
    updateAllTree();

    this.dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;

    it.businesslogic.ireport.util.Misc.centerFrame(this);

    javax.swing.KeyStroke escape =
        javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false);
    javax.swing.Action escapeAction =
        new javax.swing.AbstractAction() {
          public void actionPerformed(java.awt.event.ActionEvent e) {
            jButtonCancelActionPerformed(e);
          }
        };

    getRootPane().getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
    getRootPane().getActionMap().put("ESCAPE", escapeAction);

    applyI18n();
    // to make the default button ...
    this.getRootPane().setDefaultButton(this.jButtonOK);
  }
Exemplo n.º 4
0
    JEditSyntaxTextSource() {

      m_syntaxDocument.addDocumentListener(
          new DocumentListener() {
            public void insertUpdate(DocumentEvent event) {
              documentChanged();
            }

            public void removeUpdate(DocumentEvent event) {
              documentChanged();
            }

            public void changedUpdate(DocumentEvent event) {
              documentChanged();
            }

            private void documentChanged() {
              setChanged();
            }
          });
    }