From: <ez...@us...> - 2014-04-21 01:25:57
|
Revision: 23511 http://sourceforge.net/p/jedit/svn/23511 Author: ezust Date: 2014-04-21 01:25:54 +0000 (Mon, 21 Apr 2014) Log Message: ----------- refactored _openFile Modified Paths: -------------- plugins/ErrorList/trunk/errorlist/ErrorList.java Modified: plugins/ErrorList/trunk/errorlist/ErrorList.java =================================================================== --- plugins/ErrorList/trunk/errorlist/ErrorList.java 2014-04-21 01:06:22 UTC (rev 23510) +++ plugins/ErrorList/trunk/errorlist/ErrorList.java 2014-04-21 01:25:54 UTC (rev 23511) @@ -46,6 +46,7 @@ import org.gjt.sp.jedit.EditAction; import org.gjt.sp.jedit.EditBus; import org.gjt.sp.jedit.GUIUtilities; +import org.gjt.sp.jedit.MiscUtilities; import org.gjt.sp.jedit.OperatingSystem; import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.jEdit; @@ -327,8 +328,7 @@ TreePath path = new TreePath(new TreeNode[] { errorRoot, next }); errorTree.setSelectionPath(path); errorTree.scrollPathToVisible(path); - - jEdit.openFile(view,(String)next.getUserObject()); + _openFile((String)next.getUserObject()); } //}}} //{{{ prevErrorFile() method @@ -384,7 +384,7 @@ errorTree.setSelectionPath(path); errorTree.scrollPathToVisible(path); - jEdit.openFile(view,(String)prev.getUserObject()); + _openFile((String)prev.getUserObject()); } //}}} //{{{ nextError() method @@ -875,33 +875,33 @@ } } //}}} - //{{{ openError() method - private void openError(final ErrorSource.Error error) - { - - - String fullPath = error.getFilePath(); - - if (view.getBuffer().isNewFile() || !view.getBuffer().getName().equals(error.getFileName())) try { - VFS vfs = VFSManager.getVFSForPath(fullPath); - VFSFile file = vfs._getFile(null, fullPath, null); + //{{{ _openFile() method + private void _openFile(String vfsPath) { + try { + VFS vfs = VFSManager.getVFSForPath(vfsPath); + VFSFile file = vfs._getFile(null, vfsPath, null); if (file == null || file.getLength() == 0) { - FileOpenerService.open(error.getFileName(), view); - return; + FileOpenerService.open(MiscUtilities.getFileName(vfsPath), view); } - else jEdit.openFile(view,fullPath); + else { + jEdit.openFile(view,vfsPath); + } } catch (IOException ioe) { Log.log(Log.ERROR, "WTF?", ioe); } + }//}}} + + //{{{ openError() method + private void openError(final ErrorSource.Error error) + { + String fullPath = error.getFilePath(); + _openFile(fullPath); -/* if (error.getFilePath().equals(error.getFileName())) { - FileOpenerService.open(error.getFileName(), view); - return; - } -*/ final Buffer buffer = error.getBuffer() != null? error.getBuffer() : view.getEditPane().getBuffer(); + if (buffer.isNewFile() || !buffer.getName().equals(error.getFileName())) return; + ThreadUtilities.runInDispatchThread(new Runnable() { public void run() @@ -956,7 +956,7 @@ } else if(object instanceof String) { - jEdit.openFile(view,(String)object); + _openFile((String)object); } else if(object instanceof Extra) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |