[Pydev-cvs] org.python.pydev/src/org/python/pydev/plugin PydevPlugin.java,1.12,1.13
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2004-10-08 16:39:17
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11038/src/org/python/pydev/plugin Modified Files: PydevPlugin.java Log Message: Index: PydevPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PydevPlugin.java 25 Aug 2004 17:25:23 -0000 1.12 --- PydevPlugin.java 8 Oct 2004 16:39:01 -0000 1.13 *************** *** 1,5 **** --- 1,7 ---- package org.python.pydev.plugin; + import java.io.File; import java.io.IOException; + import java.net.URL; import java.util.MissingResourceException; import java.util.ResourceBundle; *************** *** 9,14 **** --- 11,19 ---- import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; + import org.eclipse.core.runtime.Path; + import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Status; *************** *** 26,29 **** --- 31,35 ---- import org.eclipse.ui.ide.IDE; import org.eclipse.ui.plugin.AbstractUIPlugin; + import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.python.pydev.editor.codecompletion.PyCodeCompletionPreferencesPage; *************** *** 191,193 **** --- 197,245 ---- } + /** + * + * @return the script to get the variables. + * + * @throws CoreException + */ + public static File getScriptWithinPySrc(String targetExec) + throws CoreException { + + IPath relative = new Path("PySrc").addTrailingSeparator().append( + targetExec); + + Bundle bundle = getDefault().getBundle(); + + URL bundleURL = Platform.find(bundle, relative); + URL fileURL; + try { + fileURL = Platform.asLocalURL(bundleURL); + File f = new File(fileURL.getPath()); + + return f; + } catch (IOException e) { + throw new CoreException(makeStatus(IStatus.ERROR, + "Can't find python debug script", null)); + } + } + + public static File getImageWithinIcons(String icon) throws CoreException { + + IPath relative = new Path("icons").addTrailingSeparator().append(icon); + + Bundle bundle = getDefault().getBundle(); + + URL bundleURL = Platform.find(bundle, relative); + URL fileURL; + try { + fileURL = Platform.asLocalURL(bundleURL); + File f = new File(fileURL.getPath()); + + return f; + } catch (IOException e) { + throw new CoreException(makeStatus(IStatus.ERROR, + "Can't find image", null)); + } + } + } |