[Jsxe-cvs] SF.net SVN: jsxe: [1049] trunk/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-07-21 16:19:17
|
Revision: 1049 Author: ian_lewis Date: 2006-07-21 09:19:06 -0700 (Fri, 21 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1049&view=rev Log Message: ----------- Fixed bug 1509575 Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/messages/messages trunk/jsxe/src/net/sourceforge/jsxe/action/FileReloadAction.java trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-07-20 23:46:29 UTC (rev 1048) +++ trunk/jsxe/Changelog 2006-07-21 16:19:06 UTC (rev 1049) @@ -1,3 +1,8 @@ +07/21/2006 Ian Lewis <Ian...@me...> + + * Fixed bug 1509575. Files that are reloaded should always be loaded in a + view that can accep the reloaded file. + 07/20/2006 Ian Lewis <Ian...@me...> * Released 0.5pre1 Modified: trunk/jsxe/messages/messages =================================================================== --- trunk/jsxe/messages/messages 2006-07-20 23:46:29 UTC (rev 1048) +++ trunk/jsxe/messages/messages 2006-07-21 16:19:06 UTC (rev 1049) @@ -163,6 +163,8 @@ #{{{ Messages +DocumentView.Open.Message="Could not open buffer in any installed document views" + #{0} file name DocumentBuffer.Reload.Message={0} unsaved!\n You will lose all unsaved changes if you reload!\n\nContinue? DocumentBuffer.Reload.Message.Title=Document Modified Modified: trunk/jsxe/src/net/sourceforge/jsxe/action/FileReloadAction.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/action/FileReloadAction.java 2006-07-20 23:46:29 UTC (rev 1048) +++ trunk/jsxe/src/net/sourceforge/jsxe/action/FileReloadAction.java 2006-07-21 16:19:06 UTC (rev 1049) @@ -66,10 +66,7 @@ //{{{ invoke() public void invoke(TabbedView view, ActionEvent evt) { try { - DocumentView documentView = view.getDocumentView(); - DocumentBuffer buffer = view.getDocumentBuffer(); - buffer.reload(view); - documentView.setDocumentBuffer(buffer); //reload the buffer in the documentView + view.reload(); } catch (IOException ioe) { JOptionPane.showMessageDialog(view, ioe, Messages.getMessage("IO.Error.title"), JOptionPane.WARNING_MESSAGE); } Modified: trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-07-20 23:46:29 UTC (rev 1048) +++ trunk/jsxe/src/net/sourceforge/jsxe/gui/TabbedView.java 2006-07-21 16:19:06 UTC (rev 1049) @@ -33,7 +33,7 @@ //{{{ jsXe classes import net.sourceforge.jsxe.*; -import net.sourceforge.jsxe.msg.PropertyChanged; +import net.sourceforge.jsxe.msg.*; import net.sourceforge.jsxe.action.*; import net.sourceforge.jsxe.gui.menu.*; import net.sourceforge.jsxe.util.Log; @@ -201,7 +201,7 @@ } } - String msg = "Could not open buffer in any installed document views"; + String msg = Messages.getMessage("DocumentView.Open.Message"); String error = buf.toString(); if (!error.equals("")) { msg=msg+"\n\n"+error; @@ -267,6 +267,56 @@ return false; }//}}} + //{{{ reload() + /** + * Reloads the current DocumentBuffer and makes sure that the + * reloaded document is opened in an appropriate DocumentView. + * @param buffer the DocumentBuffer to reload. + */ + public void reload() throws IOException { + DocumentBuffer buffer = getDocumentBuffer(); + ViewPlugin plugin = getDocumentView().getViewPlugin(); + + /* + try to open it in the current view first. If that doesn't work + loop through the other views + */ + + StringBuffer buf = new StringBuffer(); + + buffer.reload(this); + + try { + DocumentView view = plugin.newDocumentView(buffer); + setDocumentView(view); + return; + } catch (IOException ioe) { + + buf.append(buffer.getName() + ": "+ioe.getMessage() + "\n"); + + Iterator types = jsXe.getPluginLoader().getViewPlugins().iterator(); + + while (types.hasNext()) { + plugin = (ViewPlugin)types.next(); + try { + DocumentView view = plugin.newDocumentView(buffer); + setDocumentView(view); + return; + } catch (IOException ioe2) { + buf.append(buffer.getName() + ": "+ioe.getMessage() + "\n"); + } + } + } + + String msg = Messages.getMessage("DocumentView.Open.Message"); + String error = buf.toString(); + if (!error.equals("")) { + msg=msg+"\n\n"+error; + } + throw new IOException(msg); + + }//}}} + //{{{ getBufferCount() /** * Gets the number of open buffers. @@ -501,6 +551,17 @@ updateMenuBar(); } } + + /* + Catch when a document is reloaded and make sure the view + can still handle the structure.. + */ + if (message instanceof DocumentBufferUpdate) { + DocumentBufferUpdate msg = (DocumentBufferUpdate)message; + if (DocumentBufferUpdate.LOADED.equals(msg.getWhat())) { + + } + } } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |