Package org.python.pydev.core

Examples of org.python.pydev.core.ModulesKeyForZip


        return null;
    }

    public List<IInfo> addAstInfo(ModulesKey key, boolean generateDelta) throws Exception {
        boolean isZipModule = key instanceof ModulesKeyForZip;
        ModulesKeyForZip modulesKeyForZip = null;
        if (isZipModule) {
            modulesKeyForZip = (ModulesKeyForZip) key;
        }

        Object doc;
View Full Code Here


        if (obj.entries == null) {
            FastStringBuffer buf;
            ModulesKey key = indexKey.key;
            try {
                if (key instanceof ModulesKeyForZip) {
                    ModulesKeyForZip modulesKeyForZip = (ModulesKeyForZip) key;
                    buf = (FastStringBuffer) FileUtilsFileBuffer.getCustomReturnFromZip(modulesKeyForZip.file,
                            modulesKeyForZip.zipModulePath, FastStringBuffer.class);
                } else {
                    buf = (FastStringBuffer) FileUtils.getFileContentsCustom(key.file, FastStringBuffer.class);
                }
View Full Code Here

                ModulesKey next = iter.next();
                buf.append(next.name);
                if (next.file != null) {
                    buf.append("|");
                    if (next instanceof ModulesKeyForZip) {
                        ModulesKeyForZip modulesKeyForZip = (ModulesKeyForZip) next;
                        if (modulesKeyForZip.zipModulePath != null) {
                            String fileStr = next.file.toString();
                            Integer t = commonTokens.get(fileStr);
                            if (t == null) {
                                t = commonTokens.size();
View Full Code Here

                //restore with empty modules.
                lst.add(key);

            } else if (size == 4) {
                try {
                    key = new ModulesKeyForZip(split[0], //module name
                            new File(intToString.get(Integer.parseInt(split[1]))), //zip file (usually repeated over and over again)
                            split[2], //path in zip
                            split[3].equals("1")); //is file (false = folder)
                    //restore with empty modules.
                    lst.add(key);
View Full Code Here

            for (String filePathInZip : zipContents.foundFileZipPaths) {
                String modName = StringUtils.stripExtension(filePathInZip).replace('/', '.');
                if (DEBUG_ZIP) {
                    System.out.println("Found in zip:" + modName);
                }
                ModulesKey k = new ModulesKeyForZip(modName, zipContents.zipFile, filePathInZip, true);
                keys.put(k, k);

                if (zipContents.zipContentsType == ZipContents.ZIP_CONTENTS_TYPE_JAR) {
                    //folder modules are only created for jars (because for python files, the __init__.py is required).
                    for (String s : new FullRepIterable(FullRepIterable.getWithoutLastPart(modName))) { //the one without the last part was already added
                        k = new ModulesKeyForZip(s, zipContents.zipFile, s.replace('.', '/'), false);
                        keys.put(k, k);
                    }
                }
            }
        }
View Full Code Here

    /**
     * @return
     */
    public ModulesKey getModulesKey() {
        if (zipFilePath != null && zipFilePath.length() > 0) {
            return new ModulesKeyForZip(name, file, zipFilePath, true);
        }
        return new ModulesKey(name, file);
    }
View Full Code Here

                return true;
            }

            boolean isZipModule = key instanceof ModulesKeyForZip;
            if (isZipModule) {
                ModulesKeyForZip modulesKeyForZip = (ModulesKeyForZip) key;
                if (PythonPathHelper.isValidSourceFile(modulesKeyForZip.zipModulePath)) {
                    return true;
                }
            }
        }
View Full Code Here

    /**
     * @return an empty module representing the key passed.
     */
    public static AbstractModule createEmptyModule(ModulesKey key) {
        if (key instanceof ModulesKeyForZip) {
            ModulesKeyForZip e = ((ModulesKeyForZip) key);
            return new EmptyModuleForZip(key.name, key.file, e.zipModulePath, e.isFile);

        } else {
            return new EmptyModule(key.name, key.file);
        }
View Full Code Here

    public void testLoad() throws Exception {
        SystemModulesManager manager = new SystemModulesManager(null);
        manager.addModule(new ModulesKey("bar", new File("bar.py")));
        manager.addModule(new ModulesKey("foo", new File("foo.py")));
        manager.addModule(new ModulesKey("empty", null));
        manager.addModule(new ModulesKeyForZip("zip", new File("zip.zip"), "path", true));

        PythonPathHelper pythonPathHelper = manager.getPythonPathHelper();
        pythonPathHelper.setPythonPath("rara|boo");
        assertEquals(Arrays.asList("rara", "boo"), manager.getPythonPathHelper().getPythonpath());

        File f = new File("modules_manager_testing.temporary_dir");
        try {
            FileUtils.deleteDirectoryTree(f);
        } catch (Exception e1) {
            //ignore
        }
        try {
            manager.saveToFile(f);

            SystemModulesManager loaded = new SystemModulesManager(null);
            SystemModulesManager.loadFromFile(loaded, f);
            ModulesKey[] onlyDirectModules = loaded.getOnlyDirectModules();
            boolean found = false;
            for (ModulesKey modulesKey : onlyDirectModules) {
                if (modulesKey.name.equals("zip")) {
                    ModulesKeyForZip z = (ModulesKeyForZip) modulesKey;
                    assertEquals(z.zipModulePath, "path");
                    assertEquals(z.file, new File("zip.zip"));
                    assertEquals(z.isFile, true);
                    found = true;
                }
View Full Code Here

        key = manager.modulesKeys.get(new ModulesKey("D", null));
        assertEquals(key, new ModulesKey("D", null));
        assertEquals(key.file, new File("W.py"));
        assertTrue(key instanceof ModulesKeyForZip);
        ModulesKeyForZip kz = (ModulesKeyForZip) key;
        assertTrue(kz.isFile);
        assertEquals(kz.zipModulePath, "E");

    }
View Full Code Here

TOP

Related Classes of org.python.pydev.core.ModulesKeyForZip

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.