pysourcelocator.java

来自「Python Development Environment (Python I」· Java 代码 · 共 49 行

JAVA
49
字号
/*
 * Author: atotic
 * Created on Apr 23, 2004
 * License: Common Public License v1.0
 */
package org.python.pydev.debug.model;

import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.model.ISourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.ui.ISourcePresentation;
import org.eclipse.ui.IEditorInput;
import org.python.pydev.editor.PyEdit;
import org.python.pydev.plugin.PydevPlugin;

/**
 * Locates source files from stack elements
 * 
 */
public class PySourceLocator implements ISourceLocator, ISourcePresentation {

	public Object getSourceElement(IStackFrame stackFrame) {
		return stackFrame;
	}

	// Returns the file
	public IEditorInput getEditorInput(Object element) {
		IEditorInput edInput = null;
		if (element instanceof PyStackFrame) {
            
			IPath path = ((PyStackFrame)element).getPath();			
            
			if (path != null && !path.toString().startsWith("<")){								
		        edInput = PydevPlugin.createEditorInput(path);                
			}
            
		}
		return edInput;
	}


	public String getEditorId(IEditorInput input, Object element) {
		return PyEdit.EDITOR_ID;
	}

    

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?