Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14105/src/org/python/pydev/editor/actions
Modified Files:
PyOpenAction.java
Log Message:
Lots of minor changes: double-clicking, more hyperlink navigation,
making editor more useable.
Moved some files here from debug, and pruned some obsolete ones.
Index: PyOpenAction.java
===================================================================
RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyOpenAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PyOpenAction.java 15 Apr 2004 23:19:21 -0000 1.1
--- PyOpenAction.java 22 Apr 2004 10:35:24 -0000 1.2
***************
*** 62,67 ****
} catch (PartInitException e) {
PydevPlugin.log(IStatus.ERROR, "Unexpected error opening file", e);
- } catch (BadLocationException e1) {
- PydevPlugin.log(IStatus.ERROR, "Error setting selection", e1);
}
}
--- 62,65 ----
***************
*** 77,80 ****
--- 75,83 ----
try {
IEditorPart editor = p.openEditor(input, desc.getId());
+ if (start != null &&
+ editor instanceof ITextEditor) {
+ ITextEditor textEdit = (ITextEditor)editor;
+ showInEditor(textEdit, start, end);
+ }
} catch (PartInitException e) {
PydevPlugin.log(IStatus.ERROR, "Unexpected error opening external file", e);
***************
*** 82,93 ****
}
! private void showInEditor(ITextEditor textEdit, Location start, Location end)
! throws BadLocationException {
! IDocument doc = textEdit.getDocumentProvider().getDocument(textEdit.getEditorInput());
! int s;
s = start.toOffset(doc);
! int e = end == null ? s : end.toOffset(doc);
! TextSelection sel = new TextSelection(s, e - s);
! textEdit.getSelectionProvider().setSelection(sel);
}
--- 85,104 ----
}
! private void showInEditor(
! ITextEditor textEdit,
! Location start,
! Location end) {
! try {
! IDocument doc =
! textEdit.getDocumentProvider().getDocument(
! textEdit.getEditorInput());
! int s;
s = start.toOffset(doc);
! int e = end == null ? s : end.toOffset(doc);
! TextSelection sel = new TextSelection(s, e - s);
! textEdit.getSelectionProvider().setSelection(sel);
! } catch (BadLocationException e1) {
! PydevPlugin.log(IStatus.ERROR, "Error setting selection", e1);
! }
}
|