[Pydev-cvs] org.python.pydev.core/src/org/python/pydev/core/bundle BundleUtils.java, 1.2, 1.3 Bundl
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 19:57:55
|
Update of /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/bundle In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19948/src/org/python/pydev/core/bundle Modified Files: BundleUtils.java BundleInfo.java ImageCache.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: BundleUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/bundle/BundleUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BundleUtils.java 12 Apr 2008 18:38:11 -0000 1.2 --- BundleUtils.java 27 Sep 2008 19:57:34 -0000 1.3 *************** *** 10,25 **** public class BundleUtils { ! public static File getRelative(IPath relative, Bundle bundle) { ! try { ! URL bundleURL = FileLocator.find(bundle, relative, null); ! URL fileURL; ! fileURL = FileLocator.toFileURL(bundleURL); ! File f = new File(fileURL.getPath()); ! ! return f; ! } catch (Exception e) { ! throw new RuntimeException("Can't find relative path:"+relative+" within:"+bundle, e); ! } ! } } --- 10,25 ---- public class BundleUtils { ! public static File getRelative(IPath relative, Bundle bundle) { ! try { ! URL bundleURL = FileLocator.find(bundle, relative, null); ! URL fileURL; ! fileURL = FileLocator.toFileURL(bundleURL); ! File f = new File(fileURL.getPath()); ! ! return f; ! } catch (Exception e) { ! throw new RuntimeException("Can't find relative path:"+relative+" within:"+bundle, e); ! } ! } } Index: ImageCache.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/bundle/ImageCache.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageCache.java 17 Apr 2006 16:25:28 -0000 1.2 --- ImageCache.java 27 Sep 2008 19:57:34 -0000 1.3 *************** *** 19,83 **** */ public class ImageCache { ! ! ! private Map<String, Image> imageHash = new HashMap<String, Image>(10); ! private URL baseURL; ! private Image missing = null; ! ! public ImageCache(URL baseURL) { ! this.baseURL = baseURL; ! } ! ! ! protected ImageCache() { } public void dispose() { ! Iterator e = imageHash.values().iterator(); ! while (e.hasNext()) ! ((Image) e.next()).dispose(); ! if (missing != null) { ! missing.dispose(); ! } ! } ! /** ! * @param key - relative path to the plugin directory ! * @return the image ! */ ! public Image get(String key) { ! Image image = (Image)imageHash.get(key); ! if (image == null) { ! ImageDescriptor desc; ! try { ! desc = getDescriptor(key); ! image = desc.createImage(); ! imageHash.put(key, image); ! } catch (NoClassDefFoundError e) { ! //we're in tests... ! return null; ! } catch (UnsatisfiedLinkError e) { ! //we're in tests... ! return null; ! } catch (MalformedURLException e) { ! // If image is missing, create a default missing one ! System.err.println("ERROR: Missing image: " + key); ! if (missing == null) { ! desc = ImageDescriptor.getMissingImageDescriptor(); ! missing = desc.createImage(); ! } ! image = missing; ! } ! } ! return image; ! } ! /** ! * like get, but returns ImageDescription instead of image ! */ ! public ImageDescriptor getDescriptor(String key) throws MalformedURLException { ! URL url = new URL(baseURL, key); ! return ImageDescriptor.createFromURL(url); ! } } --- 19,83 ---- */ public class ImageCache { ! ! ! private Map<String, Image> imageHash = new HashMap<String, Image>(10); ! private URL baseURL; ! private Image missing = null; ! ! public ImageCache(URL baseURL) { ! this.baseURL = baseURL; ! } ! ! ! protected ImageCache() { } public void dispose() { ! Iterator e = imageHash.values().iterator(); ! while (e.hasNext()) ! ((Image) e.next()).dispose(); ! if (missing != null) { ! missing.dispose(); ! } ! } ! /** ! * @param key - relative path to the plugin directory ! * @return the image ! */ ! public Image get(String key) { ! Image image = (Image)imageHash.get(key); ! if (image == null) { ! ImageDescriptor desc; ! try { ! desc = getDescriptor(key); ! image = desc.createImage(); ! imageHash.put(key, image); ! } catch (NoClassDefFoundError e) { ! //we're in tests... ! return null; ! } catch (UnsatisfiedLinkError e) { ! //we're in tests... ! return null; ! } catch (MalformedURLException e) { ! // If image is missing, create a default missing one ! System.err.println("ERROR: Missing image: " + key); ! if (missing == null) { ! desc = ImageDescriptor.getMissingImageDescriptor(); ! missing = desc.createImage(); ! } ! image = missing; ! } ! } ! return image; ! } ! /** ! * like get, but returns ImageDescription instead of image ! */ ! public ImageDescriptor getDescriptor(String key) throws MalformedURLException { ! URL url = new URL(baseURL, key); ! return ImageDescriptor.createFromURL(url); ! } } Index: BundleInfo.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.core/src/org/python/pydev/core/bundle/BundleInfo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BundleInfo.java 15 Mar 2006 00:16:14 -0000 1.1 --- BundleInfo.java 27 Sep 2008 19:57:34 -0000 1.2 *************** *** 31,35 **** } ! /** * @see org.python.pydev.core.bundle.IBundleInfo#getPluginID() */ --- 31,35 ---- } ! /** * @see org.python.pydev.core.bundle.IBundleInfo#getPluginID() */ |