[Pydev-cvs] org.python.pydev/src_navigator/org/python/pydev/navigator/actions PythonLinkHelper.jav
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-08-06 16:23:11
|
Update of /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26629/src_navigator/org/python/pydev/navigator/actions Modified Files: PythonLinkHelper.java Log Message: - Refactoring the source locator - Linxing working with compare editor both ways Index: PythonLinkHelper.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator/actions/PythonLinkHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PythonLinkHelper.java 30 Jun 2008 00:29:06 -0000 1.3 --- PythonLinkHelper.java 6 Aug 2008 16:23:19 -0000 1.4 *************** *** 59,64 **** //and now, if it is really a file... if (firstElement instanceof IFile) { ! IEditorInput fileInput = new FileEditorInput((IFile) firstElement); IEditorPart editor = null; if ((editor = aPage.findEditor(fileInput)) != null){ aPage.bringToTop(editor); --- 59,79 ---- //and now, if it is really a file... if (firstElement instanceof IFile) { ! ! //ok, let's check if the active editor is already the selection, because although the findEditor(editorInput) method ! //may return an editor for the correct file, we may have multiple editors for the same file, and if the current ! //editor is already correct, we don't want to change it ! //@see bug: https://sourceforge.net/tracker/?func=detail&atid=577329&aid=2037682&group_id=85796 ! IEditorPart activeEditor = aPage.getActiveEditor(); ! if(activeEditor != null){ ! IEditorInput editorInput = activeEditor.getEditorInput(); ! IFile currFile = (IFile) editorInput.getAdapter(IFile.class); ! if(currFile != null && currFile.equals(firstElement)){ ! return; //the current editor is already the active editor. ! } ! } ! ! //if we got here, the active editor is not a match, so, let's find one and show it. IEditorPart editor = null; + IEditorInput fileInput = new FileEditorInput((IFile) firstElement); if ((editor = aPage.findEditor(fileInput)) != null){ aPage.bringToTop(editor); |