[Jsxe-cvs] SF.net SVN: jsxe: [1105] trunk/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-08-05 20:24:20
|
Revision: 1105 Author: ian_lewis Date: 2006-08-05 13:24:09 -0700 (Sat, 05 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1105&view=rev Log Message: ----------- Added core support for Undo/Redo Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/build.xml trunk/jsxe/messages/messages trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java trunk/jsxe/src/net/sourceforge/jsxe/properties Added Paths: ----------- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/Changelog 2006-08-05 20:24:09 UTC (rev 1105) @@ -1,3 +1,9 @@ +08/05/2006 Ian Lewis <Ian...@me...> + + * Added core support for Undo/Redo. Undo/Redo will temporarily be view + specific. Eventually it will be entirely part of core after the + new data model is complete. + 08/03/2006 Ian Lewis <Ian...@me...> * Added Russian translation thanks to Segrer. Modified: trunk/jsxe/build.xml =================================================================== --- trunk/jsxe/build.xml 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/build.xml 2006-08-05 20:24:09 UTC (rev 1105) @@ -459,4 +459,4 @@ <ant inheritAll="false" dir="${plugin.dir}/sourceview/" target="clean"/> </target>--> <!-- }}} --> -</project> +</project> \ No newline at end of file Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/messages/messages 2006-08-05 20:24:09 UTC (rev 1105) @@ -25,6 +25,8 @@ common.paste=Paste common.find=Find common.findnext=Find Next +common.undo=Undo +common.redo=Redo common.ctrl=Ctrl common.alt=Alt Modified: trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -79,6 +79,8 @@ public static final String PASTE_SUFFIX = ".paste"; public static final String FIND_SUFFIX = ".find"; public static final String FIND_NEXT_SUFFIX = ".findnext"; + public static final String UNDO_SUFFIX = ".undo"; + public static final String REDO_SUFFIX = ".redo"; //}}} @@ -272,7 +274,9 @@ actionName.endsWith(COPY_SUFFIX) || actionName.endsWith(PASTE_SUFFIX) || actionName.endsWith(FIND_SUFFIX) || - actionName.endsWith(FIND_NEXT_SUFFIX)); + actionName.endsWith(FIND_NEXT_SUFFIX) || + actionName.endsWith(UNDO_SUFFIX) || + actionName.endsWith(REDO_SUFFIX)); }//}}} //{{{ Wrapper class Added: trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/RedoAction.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -0,0 +1,77 @@ +/* +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 net.sourceforge.jsxe.action; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +//}}} + +//{{{ Java classes +import java.io.IOException; +//}}} + +//{{{ AWT components +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * The redo action invokes a DocumentView specific action defined for redo. + * The action should be defined by the view as <i>viewname</i>.redo + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class RedoAction extends LocalizedAction { + + //{{{ RedoAction constructor + public RedoAction() { + super("redo"); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.redo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + /* + invoke the action registered for the current DocumentView named + viewname.redo if there is one. + */ + ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.REDO_SUFFIX, evt); + }//}}} + +} Added: trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java (rev 0) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/UndoAction.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -0,0 +1,77 @@ +/* +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 net.sourceforge.jsxe.action; + +//{{{ imports + +//{{{ jsXe classes +import net.sourceforge.jsxe.jsXe; +import net.sourceforge.jsxe.JARClassLoader; +import net.sourceforge.jsxe.ActionManager; +import net.sourceforge.jsxe.LocalizedAction; +import net.sourceforge.jsxe.gui.TabbedView; +import net.sourceforge.jsxe.gui.Messages; +//}}} + +//{{{ Java classes +import java.io.IOException; +//}}} + +//{{{ AWT components +import java.awt.event.ActionEvent; +//}}} + +//}}} + +/** + * The undo action invokes a DocumentView specific action defined for undo. + * The action should be defined by the view as <i>viewname</i>.undo + * + * @author Ian Lewis (<a href="mailto:Ian...@me...">Ian...@me...</a>) + * @version $Id$ + * @since jsXe 0.5 pre3 + */ +public class UndoAction extends LocalizedAction { + + //{{{ UndoAction constructor + public UndoAction() { + super("undo"); + }//}}} + + //{{{ getLabel() + public String getLabel() { + return Messages.getMessage("common.undo"); + }//}}} + + //{{{ invoke() + public void invoke(TabbedView view, ActionEvent evt) { + /* + invoke the action registered for the current DocumentView named + viewname.undo if there is one. + */ + ActionManager.invokeAction(jsXe.getPluginLoader().getPluginProperty(view.getDocumentView().getViewPlugin(), JARClassLoader.PLUGIN_NAME)+ActionManager.UNDO_SUFFIX, evt); + }//}}} + +} Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-05 20:24:09 UTC (rev 1105) @@ -512,6 +512,8 @@ set.addAction(new PasteAction()); set.addAction(new FindAction()); set.addAction(new FindNextAction()); + set.addAction(new UndoAction()); + set.addAction(new RedoAction()); ActionManager.addActionSet(set); //}}} Modified: trunk/jsxe/src/net/sourceforge/jsxe/properties =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-04 19:17:41 UTC (rev 1104) +++ trunk/jsxe/src/net/sourceforge/jsxe/properties 2006-08-05 20:24:09 UTC (rev 1105) @@ -62,4 +62,6 @@ paste.shortcut=C+v find.shortcut=C+v findnext.shortcut=C+g +undo.shortcut=C+z +redo.shortcut=C+y #}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |