~vil/pydev/upstream

« back to all changes in this revision

Viewing changes to org.python.pydev.debug/src/org/python/pydev/debug/model/PySourceLocator.java

  • Committer: Vladimír Lapáček
  • Date: 2006-08-30 18:38:44 UTC
  • Revision ID: vladimir.lapacek@gmail.com-20060830183844-f4d82c1239a7770a
Initial import of upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Author: atotic
 
3
 * Created on Apr 23, 2004
 
4
 * License: Common Public License v1.0
 
5
 */
 
6
package org.python.pydev.debug.model;
 
7
 
 
8
import org.eclipse.core.runtime.IPath;
 
9
import org.eclipse.debug.core.model.ISourceLocator;
 
10
import org.eclipse.debug.core.model.IStackFrame;
 
11
import org.eclipse.debug.ui.ISourcePresentation;
 
12
import org.eclipse.ui.IEditorInput;
 
13
import org.python.pydev.editor.PyEdit;
 
14
import org.python.pydev.plugin.PydevPlugin;
 
15
 
 
16
/**
 
17
 * Locates source files from stack elements
 
18
 * 
 
19
 */
 
20
public class PySourceLocator implements ISourceLocator, ISourcePresentation {
 
21
 
 
22
        public Object getSourceElement(IStackFrame stackFrame) {
 
23
                return stackFrame;
 
24
        }
 
25
 
 
26
        // Returns the file
 
27
        public IEditorInput getEditorInput(Object element) {
 
28
                IEditorInput edInput = null;
 
29
                if (element instanceof PyStackFrame) {
 
30
            
 
31
                        IPath path = ((PyStackFrame)element).getPath();                 
 
32
            
 
33
                        if (path != null && !path.toString().startsWith("<")){                                                          
 
34
                        edInput = PydevPlugin.createEditorInput(path);                
 
35
                        }
 
36
            
 
37
                }
 
38
                return edInput;
 
39
        }
 
40
 
 
41
 
 
42
        public String getEditorId(IEditorInput input, Object element) {
 
43
                return PyEdit.EDITOR_ID;
 
44
        }
 
45
 
 
46
    
 
47
 
 
48
}