bundleutils.java

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

JAVA
26
字号
package org.python.pydev.core.bundle;

import java.io.File;
import java.net.URL;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class BundleUtils {

	public static File getRelative(IPath relative, Bundle bundle) {
		try {
			URL bundleURL = Platform.find(bundle, relative);
		    URL fileURL;
	        fileURL = Platform.asLocalURL(bundleURL);
	        File f = new File(fileURL.getPath());
	
	        return f;
	    } catch (Exception e) {
	        throw new RuntimeException("Can't find relative path:"+relative+" within:"+bundle, e);
	    }
	}

}

⌨️ 快捷键说明

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