Bug 4840 fixed: The more there was text in the console, the slower was the display
[scilab.git] / scilab / modules / console / src / java / org / scilab / modules / console / SelectAllAction.java
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2008 - DIGITEO - Allan CORNET
4  *
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10  *
11  */
12
13 package org.scilab.modules.console;
14
15 import java.awt.event.ActionEvent;
16 import javax.swing.JEditorPane;
17 import javax.swing.JTextPane;
18 import com.artenum.rosetta.core.action.AbstractConsoleAction;
19
20 /**
21  * Class used to select all in console
22  * @author Allan CORNET
23  */
24 public class SelectAllAction extends AbstractConsoleAction {
25         private static final long serialVersionUID = 1L;
26
27         /**
28          * Constructor
29          */
30         public SelectAllAction() {
31                 super();
32         }
33
34         /**
35          * Threats the event
36          * @param e the action event that occured
37          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
38          */
39         public void actionPerformed(ActionEvent e) {
40                 JEditorPane outputPane = (JEditorPane) configuration.getOutputView();
41                 JTextPane inputPane = (JTextPane) configuration.getInputCommandView();
42
43                 outputPane.setSelectionStart(0);
44                 outputPane.setSelectionEnd(outputPane.getText().length());
45
46                 inputPane.setSelectionStart(0);
47                 inputPane.setSelectionEnd(inputPane.getText().length());
48
49         }
50 }