[Jsxe-cvs] SF.net SVN: jsxe: [1108] trunk/sourceview
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-08-07 21:54:12
|
Revision: 1108 Author: ian_lewis Date: 2006-08-07 14:53:57 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1108&view=rev Log Message: ----------- Backed out changes for undo in the source view Modified Paths: -------------- trunk/sourceview/Changelog trunk/sourceview/src/sourceview/SourceView.java trunk/sourceview/src/sourceview/SourceViewDocument.java trunk/sourceview/src/sourceview/SourceViewPlugin.java Removed Paths: ------------- trunk/sourceview/src/sourceview/action/RedoAction.java trunk/sourceview/src/sourceview/action/UndoAction.java Modified: trunk/sourceview/Changelog =================================================================== --- trunk/sourceview/Changelog 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/Changelog 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,7 +1,3 @@ -08/05/2006 Ian Lewis <Ian...@me...> - - * Added undo to the source view - 07/26/2006 Ian Lewis <Ian...@me...> * Addded support for the findnext action Modified: trunk/sourceview/src/sourceview/SourceView.java =================================================================== --- trunk/sourceview/src/sourceview/SourceView.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceView.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -155,11 +155,13 @@ m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); m_editMenu.setMnemonic('E'); // These don't do anything yet. - menuItem = new JMenuItem(ActionManager.getAction("undo")); - m_editMenu.add( menuItem ); - menuItem = new JMenuItem(ActionManager.getAction("redo")); - m_editMenu.add(menuItem); - m_editMenu.addSeparator(); + // JMenuItem menuItem = new JMenuItem("Undo"); + // menuItem.addActionListener( new EditUndoAction() ); + // menu.add( menuItem ); + // menuItem = new JMenuItem("Redo"); + // menuItem.addActionListener( new EditRedoAction() ); + // menu.add(menuItem); + // menu.addSeparator(); menuItem = new JMenuItem(ActionManager.getAction("cut")); m_editMenu.add(menuItem); menuItem = new JMenuItem(ActionManager.getAction("copy")); Modified: trunk/sourceview/src/sourceview/SourceViewDocument.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceViewDocument.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -55,10 +55,6 @@ import javax.swing.text.GapContent; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleContext; -import javax.swing.event.DocumentEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.event.UndoableEditEvent; -import javax.swing.undo.*; //}}} //{{{ DOM classes @@ -100,103 +96,50 @@ //buffer is actually loaded in the text area at any //given time(?) super.insertString(0, document.getText(0,document.getLength()), null); - m_initialized = true; } catch (BadLocationException ble) { Log.log(Log.ERROR, this, ble); } } - - addUndoableEditListener(new UndoableEditListener() { - public void undoableEditHappened(UndoableEditEvent e) { - m_undoManager.addEdit(e.getEdit()); - } - }); }//}}} //{{{ DefaultStyledDocument methods - // //{{{ insertString() + //{{{ insertString() - // public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - // Log.log(Log.DEBUG, this, "insert: "+str); - // try { - // super.insertString(offs, str, a); - // m_document.insertText(offs, str); - // } catch (DOMException dome) { - // Log.log(Log.ERROR, this, dome); - // Toolkit.getDefaultToolkit().beep(); - // } catch (IOException ioe) { - // Log.log(Log.ERROR, this, ioe); - // } - - // }//}}} - - // //{{{ remove() - - // public void remove(int offs, int len) throws BadLocationException { - // Log.log(Log.DEBUG, this, "remove"); - // try { - // super.remove(offs, len); - // m_document.removeText(offs, len); - // } catch (DOMException dome) { - // Log.log(Log.ERROR, this, dome); - // Toolkit.getDefaultToolkit().beep(); - // } catch (IOException ioe) { - // Log.log(Log.ERROR, this, ioe); - // } + public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - // }//}}} - - protected void fireInsertUpdate(DocumentEvent e) { try { - Log.log(Log.DEBUG, this, "insert: "+getText(e.getOffset(), e.getLength())); - if (m_initialized) { - m_document.insertText(e.getOffset(), getText(e.getOffset(), e.getLength())); - } - super.fireInsertUpdate(e); + super.insertString(offs, str, a); + m_document.insertText(offs, str); + } catch (DOMException dome) { + Log.log(Log.ERROR, this, dome); + Toolkit.getDefaultToolkit().beep(); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); - } catch (BadLocationException ble) { - Log.log(Log.ERROR, this, ble); } - } + + }//}}} + + //{{{ remove() - protected void fireRemoveUpdate(DocumentEvent e) { + public void remove(int offs, int len) throws BadLocationException { + try { - Log.log(Log.DEBUG, this, "remove: "+e.getOffset()+":"+e.getLength()); - if (m_initialized) { - m_document.removeText(e.getOffset(), e.getLength()); - } - super.fireRemoveUpdate(e); + super.remove(offs, len); + m_document.removeText(offs, len); + } catch (DOMException dome) { + Log.log(Log.ERROR, this, dome); + Toolkit.getDefaultToolkit().beep(); } catch (IOException ioe) { Log.log(Log.ERROR, this, ioe); } - } - + + }//}}} + //}}} - //{{{ undo() - public void undo() { - try { - m_undoManager.undo(); - } catch (CannotUndoException e) { - Log.log(Log.WARNING, this, "Cannot undo"); - } - }//}}} - - //{{{ redo() - public void redo() throws CannotUndoException { - try { - m_undoManager.redo(); - } catch (CannotUndoException e) { - Log.log(Log.WARNING, this, "Cannot redo"); - } - }//}}} - //{{{ Private members - private boolean m_initialized = false; private XMLDocument m_document; - private UndoManager m_undoManager = new UndoManager(); //}}} } Modified: trunk/sourceview/src/sourceview/SourceViewPlugin.java =================================================================== --- trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/SourceViewPlugin.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -65,8 +65,6 @@ addAction(new EditPasteAction()); addAction(new EditFindAction()); addAction(new EditFindNextAction()); - addAction(new UndoAction()); - addAction(new RedoAction()); }//}}} //{{{ newDocumentView() Deleted: trunk/sourceview/src/sourceview/action/RedoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/RedoAction.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/action/RedoAction.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,74 +0,0 @@ -/* -RedoAction.java -:tabSize=4:indentSize=4:noTabs=true: -:folding=explicit:collapseFolds=1: - -Copyright (C) 2006 Ian Lewis (Ian...@me...) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -Optionally, you may find a copy of the GNU General Public License -from http://www.fsf.org/copyleft/gpl.txt -*/ - -package sourceview.action; - -//{{{ imports - -import sourceview.*; - -//{{{ jsXe classes -import net.sourceforge.jsxe.jsXe; -import net.sourceforge.jsxe.ActionManager; -import net.sourceforge.jsxe.LocalizedAction; -import net.sourceforge.jsxe.gui.TabbedView; -import net.sourceforge.jsxe.gui.Messages; -import net.sourceforge.jsxe.gui.DocumentView; -import net.sourceforge.jsxe.util.Log; -//}}} - -//{{{ AWT classes -import java.awt.event.ActionEvent; -//}}} - -//}}} - -/** - * This action that redoes the last action made in the source view. - * - * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) - * @version $Id$ - */ -public class RedoAction extends LocalizedAction { - - //{{{ RedoAction constructor - public RedoAction() { - super(SourceViewPlugin.PLUGIN_NAME+ActionManager.REDO_SUFFIX); - }//}}} - - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.redo"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - DocumentView docView = view.getDocumentView(); - if (docView instanceof SourceView) { - SourceView sourceView = (SourceView)docView; - ((SourceViewDocument)sourceView.getTextArea().getDocument()).redo(); - } - }//}}} - -} Deleted: trunk/sourceview/src/sourceview/action/UndoAction.java =================================================================== --- trunk/sourceview/src/sourceview/action/UndoAction.java 2006-08-07 19:50:51 UTC (rev 1107) +++ trunk/sourceview/src/sourceview/action/UndoAction.java 2006-08-07 21:53:57 UTC (rev 1108) @@ -1,74 +0,0 @@ -/* -UndoAction.java -:tabSize=4:indentSize=4:noTabs=true: -:folding=explicit:collapseFolds=1: - -Copyright (C) 2006 Ian Lewis (Ian...@me...) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -Optionally, you may find a copy of the GNU General Public License -from http://www.fsf.org/copyleft/gpl.txt -*/ - -package sourceview.action; - -//{{{ imports - -import sourceview.*; - -//{{{ jsXe classes -import net.sourceforge.jsxe.jsXe; -import net.sourceforge.jsxe.ActionManager; -import net.sourceforge.jsxe.LocalizedAction; -import net.sourceforge.jsxe.gui.TabbedView; -import net.sourceforge.jsxe.gui.Messages; -import net.sourceforge.jsxe.gui.DocumentView; -import net.sourceforge.jsxe.util.Log; -//}}} - -//{{{ AWT classes -import java.awt.event.ActionEvent; -//}}} - -//}}} - -/** - * This action that undoes the last action made in the source view. - * - * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) - * @version $Id$ - */ -public class UndoAction extends LocalizedAction { - - //{{{ UndoAction constructor - public UndoAction() { - super(SourceViewPlugin.PLUGIN_NAME+ActionManager.UNDO_SUFFIX); - }//}}} - - //{{{ getLabel() - public String getLabel() { - return Messages.getMessage("common.undo"); - }//}}} - - //{{{ invoke() - public void invoke(TabbedView view, ActionEvent evt) { - DocumentView docView = view.getDocumentView(); - if (docView instanceof SourceView) { - SourceView sourceView = (SourceView)docView; - ((SourceViewDocument)sourceView.getTextArea().getDocument()).undo(); - } - }//}}} - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |