[Jsxe-cvs] SF.net SVN: jsxe: [1157] tags/05pre3/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-08-18 18:38:30
|
Revision: 1157 Author: ian_lewis Date: 2006-08-18 11:38:21 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1157&view=rev Log Message: ----------- Added a hack to disable actions that aren't implemented by the current view from the menus Modified Paths: -------------- tags/05pre3/jsxe/Changelog tags/05pre3/jsxe/src/net/sourceforge/jsxe/ActionManager.java tags/05pre3/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java Modified: tags/05pre3/jsxe/Changelog =================================================================== --- tags/05pre3/jsxe/Changelog 2006-08-18 16:07:10 UTC (rev 1156) +++ tags/05pre3/jsxe/Changelog 2006-08-18 18:38:21 UTC (rev 1157) @@ -1,3 +1,8 @@ +08/18/2006 Ian Lewis <Ian...@me...> + + * Added a hack to disable view specific actions that aren't implemented by + the view. + 08/17/2006 Ian Lewis <Ian...@me...> * Updated the German translation thanks to Dieter Steiner Modified: tags/05pre3/jsxe/src/net/sourceforge/jsxe/ActionManager.java =================================================================== --- tags/05pre3/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-18 16:07:10 UTC (rev 1156) +++ tags/05pre3/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-08-18 18:38:21 UTC (rev 1157) @@ -33,6 +33,7 @@ import net.sourceforge.jsxe.util.Log; import net.sourceforge.jsxe.util.MiscUtilities; import net.sourceforge.jsxe.msg.PropertyChanged; +import net.sourceforge.jsxe.action.ViewSpecificAction; //}}} //{{{ Java classes Modified: tags/05pre3/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- tags/05pre3/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-18 16:07:10 UTC (rev 1156) +++ tags/05pre3/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-08-18 18:38:21 UTC (rev 1157) @@ -428,6 +428,7 @@ menubar.add(m_fileMenu); + createEditMenu(); menubar.add(m_editMenu); //Add View Specific Menus @@ -572,6 +573,86 @@ }//}}} + //{{{ createEditMenu() + + private void createEditMenu() { + m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); + m_editMenu.setMnemonic('E'); + + DocumentView view = getDocumentView(); + JMenuItem menuItem = new JMenuItem(ActionManager.getAction("undo")); + m_editMenu.add(menuItem); + menuItem = new JMenuItem(ActionManager.getAction("redo")); + m_editMenu.add(menuItem); + m_editMenu.addSeparator(); + Action action = ActionManager.getAction("cut"); + if (view != null) { + String name = jsXe.getPluginLoader().getPluginProperty(view.getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".cut"; + if (ActionManager.getLocalizedAction(name) == null) { + action.setEnabled(false); + } else { + action.setEnabled(true); + } + } else { + action.setEnabled(false); + } + menuItem = new JMenuItem(action); + m_editMenu.add(menuItem); + action = ActionManager.getAction("copy"); + if (view != null) { + String name = jsXe.getPluginLoader().getPluginProperty(view.getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".copy"; + if (ActionManager.getLocalizedAction(name) == null) { + action.setEnabled(false); + } else { + action.setEnabled(true); + } + } else { + action.setEnabled(false); + } + menuItem = new JMenuItem(action); + m_editMenu.add(menuItem); + action = ActionManager.getAction("paste"); + if (view != null) { + String name = jsXe.getPluginLoader().getPluginProperty(view.getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".paste"; + if (ActionManager.getLocalizedAction(name) == null) { + action.setEnabled(false); + } else { + action.setEnabled(true); + } + } else { + action.setEnabled(false); + } + menuItem = new JMenuItem(action); + m_editMenu.add(menuItem); + m_editMenu.addSeparator(); + action = ActionManager.getAction("find"); + if (view != null) { + String name = jsXe.getPluginLoader().getPluginProperty(view.getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".find"; + if (ActionManager.getLocalizedAction(name) == null) { + action.setEnabled(false); + } else { + action.setEnabled(true); + } + } else { + action.setEnabled(false); + } + menuItem = new JMenuItem(action); + m_editMenu.add(menuItem); + action = ActionManager.getAction("findnext"); + if (view != null) { + String name = jsXe.getPluginLoader().getPluginProperty(view.getViewPlugin(), JARClassLoader.PLUGIN_NAME)+".findnext"; + if (ActionManager.getLocalizedAction(name) == null) { + action.setEnabled(false); + } else { + action.setEnabled(true); + } + } else { + action.setEnabled(false); + } + menuItem = new JMenuItem(action); + m_editMenu.add(menuItem); + }//}}} + //{{{ createDefaultMenuItems() private void createDefaultMenuItems() { @@ -606,24 +687,7 @@ //}}} //{{{ Create Edit Menu - m_editMenu = new JMenu(Messages.getMessage("Edit.Menu")); - m_editMenu.setMnemonic('E'); - menuItem = new JMenuItem(ActionManager.getAction("undo")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("redo")); - m_editMenu.add(menuItem); - m_editMenu.addSeparator(); - menuItem = new JMenuItem(ActionManager.getAction("cut")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("copy")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("paste")); - m_editMenu.add(menuItem); - m_editMenu.addSeparator(); - menuItem = new JMenuItem(ActionManager.getAction("find")); - m_editMenu.add(menuItem); - menuItem = new JMenuItem(ActionManager.getAction("findnext")); - m_editMenu.add(menuItem); + createEditMenu(); //}}} //{{{ Create View Menu This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |