001: /*
002: * TextSelectionCommand.java
003: *
004: * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: *
020: */
021:
022: package org.executequery.actions.editcommands;
023:
024: import java.awt.event.ActionEvent;
025:
026: import org.executequery.GUIUtilities;
027: import org.underworldlabs.swing.actions.ReflectiveAction;
028: import org.executequery.gui.text.TextEditor;
029:
030: /* ----------------------------------------------------------
031: * CVS NOTE: Changes to the CVS repository prior to the
032: * release of version 3.0.0beta1 has meant a
033: * resetting of CVS revision numbers.
034: * ----------------------------------------------------------
035: */
036:
037: /**
038: *
039: * @author Takis Diakoumis
040: * @version $Revision: 1.4 $
041: * @date $Date: 2006/05/14 06:56:54 $
042: */
043: public class TextSelectionCommand extends ReflectiveAction {
044:
045: public TextSelectionCommand() {
046: }
047:
048: public void selectAll(ActionEvent e) {
049: TextEditor textFunction = (TextEditor) GUIUtilities
050: .getTextEditorInFocus();
051: if (textFunction != null) {
052: textFunction.selectAll();
053: }
054: textFunction = null;
055: }
056:
057: public void selectNone(ActionEvent e) {
058: TextEditor textFunction = (TextEditor) GUIUtilities
059: .getTextEditorInFocus();
060: if (textFunction != null) {
061: textFunction.selectNone();
062: }
063: textFunction = null;
064: }
065:
066: public void insertAfter(ActionEvent e) {
067: TextEditor textFunction = (TextEditor) GUIUtilities
068: .getTextEditorInFocus();
069: if (textFunction != null) {
070: textFunction.insertLineAfter();
071: }
072: textFunction = null;
073: }
074:
075: public void insertBefore(ActionEvent e) {
076: TextEditor textFunction = (TextEditor) GUIUtilities
077: .getTextEditorInFocus();
078: if (textFunction != null) {
079: textFunction.insertLineBefore();
080: }
081: textFunction = null;
082: }
083:
084: public void insertFromFile(ActionEvent e) {
085: TextEditor textFunction = (TextEditor) GUIUtilities
086: .getTextEditorInFocus();
087: if (textFunction != null) {
088: textFunction.insertFromFile();
089: }
090: textFunction = null;
091: }
092:
093: public void deleteWord(ActionEvent e) {
094: TextEditor textFunction = (TextEditor) GUIUtilities
095: .getTextEditorInFocus();
096: if (textFunction != null) {
097: textFunction.deleteWord();
098: }
099: textFunction = null;
100: }
101:
102: public void deleteSelection(ActionEvent e) {
103: TextEditor textFunction = (TextEditor) GUIUtilities
104: .getTextEditorInFocus();
105: if (textFunction != null) {
106: textFunction.deleteSelection();
107: }
108: textFunction = null;
109: }
110:
111: public void deleteLine(ActionEvent e) {
112: TextEditor textFunction = (TextEditor) GUIUtilities
113: .getTextEditorInFocus();
114: if (textFunction != null) {
115: textFunction.deleteLine();
116: }
117: textFunction = null;
118: }
119:
120: public void toLowerCase(ActionEvent e) {
121: TextEditor textFunction = (TextEditor) GUIUtilities
122: .getTextEditorInFocus();
123: if (textFunction != null) {
124: textFunction.changeSelectionCase(false);
125: }
126: textFunction = null;
127: }
128:
129: public void toUpperCase(ActionEvent e) {
130: TextEditor textFunction = (TextEditor) GUIUtilities
131: .getTextEditorInFocus();
132: if (textFunction != null) {
133: textFunction.changeSelectionCase(true);
134: }
135: textFunction = null;
136: }
137:
138: }
|