Package org.python.pydev.core

Examples of org.python.pydev.core.ModulesKey


                                    //TODO: This should be moved to somewhere else.
                                    String resourceOSString = PydevPlugin.getIResourceOSString(file.getActualObject());
                                    if (resourceOSString != null) {
                                        File f = new File(resourceOSString);
                                        if (f.exists()) {
                                            projectModulesManager.addModule(new ModulesKey(moduleName, f));
                                            module = projectModulesManager.getModuleInDirectManager(moduleName, nature,
                                                    true);
                                        }
                                    }
                                }
View Full Code Here


                        .getFoundPyFileInfos();
                for (PyFileInfo fileInfo : modulesBelow) {
                    File moduleFile = fileInfo.getFile();
                    String modName = pythonPathHelper.resolveModule(FileUtils.getFileAbsolutePath(moduleFile), true);
                    if (modName != null) {
                        expectedModuleNames.add(new ModulesKey(modName, moduleFile));
                        buffer.append(com.aptana.shared_core.string.StringUtils.format("Found module: %s - %s\n", modName, moduleFile));
                    } else {
                        if (PythonPathHelper.isValidModuleLastPart(StringUtils.stripExtension((moduleFile.getName())))) {
                            info.allOk = false;
                            buffer.append(com.aptana.shared_core.string.StringUtils.format(
View Full Code Here

                buffer.append(com.aptana.shared_core.string.StringUtils.format("ModulesKey %s exists in memory but not in the disk.\n", key));
            }
        }

        for (String s : allAdditionalInfoTrackedModules) {
            if (!expectedModuleNames.contains(new ModulesKey(s, null))) {
                info.allOk = false;
                info.additionalModulesNotInDisk.add(s);
                buffer.append(com.aptana.shared_core.string.StringUtils.format(
                        "The module %s exists in the additional info memory but not in the disk.\n", s));
            }
View Full Code Here

                        .getFoundPyFileInfos();
                for (PyFileInfo fileInfo : modulesBelow) {
                    File moduleFile = fileInfo.getFile();
                    String modName = pythonPathHelper.resolveModule(FileUtils.getFileAbsolutePath(moduleFile), true);
                    if (modName != null) {
                        expectedModuleNames.add(new ModulesKey(modName, moduleFile));
                    } else {
                        if (PythonPathHelper.isValidModuleLastPart(StringUtils.stripExtension((moduleFile.getName())))) {
                            addLeaf(com.aptana.shared_core.string.StringUtils.format("Unable to resolve module: %s (gotten null module name)",
                                    moduleFile));
                        }
                    }
                }
            } else {
                if (!file.exists()) {
                    addLeaf(com.aptana.shared_core.string.StringUtils.format("File %s is referenced in the pythonpath but does not exist.", file));
                } else {
                    addLeaf(com.aptana.shared_core.string.StringUtils
                            .format("File %s not handled (TODO: Fix zip files support in the viewer).", file));
                }
            }
        }

        IntegrityInfo info = new IntegrityInfo();
        info.nature = nature;

        ModulesKey[] onlyDirectModules = projectModulesManager.getOnlyDirectModules();
        TreeSet<ModulesKey> inModulesManager = new TreeSet<ModulesKey>(Arrays.asList(onlyDirectModules));

        Set<String> allAdditionalInfoModuleNames = new TreeSet<String>();
        List<Tuple<AbstractAdditionalTokensInfo, IPythonNature>> additionalInfoAndNature = AdditionalProjectInterpreterInfo
                .getAdditionalInfoAndNature(nature, false, false, false);
        AbstractAdditionalTokensInfo additionalProjectInfo;
        if (additionalInfoAndNature.size() == 0) {
            addChild(new LeafElement(this, "No additional infos found (1 expected) -- skipping other checks."));
            return;

        } else {
            if (additionalInfoAndNature.size() > 1) {
                addChild(new LeafElement(this, com.aptana.shared_core.string.StringUtils.format(
                        "%s additional infos found (only 1 expected) -- continuing checks but analysis may be wrong.",
                        additionalInfoAndNature.size())));
            }
            additionalProjectInfo = additionalInfoAndNature.get(0).o1;
            allAdditionalInfoModuleNames.addAll(additionalProjectInfo.getAllModulesWithTokens());
        }

        for (ModulesKey key : inModulesManager) {
            if (!expectedModuleNames.contains(key)) {
                info.modulesNotInDisk.add(key);
                addChild(new LeafElement(this, com.aptana.shared_core.string.StringUtils.format("%s exists in memory but not in the disk.", key)));
            }
        }

        ModulesKey tempKey = new ModulesKey(null, null);
        for (String s : allAdditionalInfoModuleNames) {
            tempKey.name = s;
            if (!expectedModuleNames.contains(tempKey)) {
                info.additionalModulesNotInDisk.add(s);
                addChild(new LeafElement(this, com.aptana.shared_core.string.StringUtils.format(
View Full Code Here

        //temporary
        CompleteIndexKey tempKey = new CompleteIndexKey((ModulesKey) null);

        Iterator<ModulesKey> it = keysFound.values().iterator();
        while (it.hasNext()) {
            ModulesKey next = it.next();
            if (next.file != null) {
                long lastModified = next.file.lastModified();
                if (lastModified != 0) {
                    tempKey.key = next;
                    CompleteIndexKey completeIndexKey = keys.get(tempKey);
View Full Code Here

        }

        //The actual values are always recreated lazily (in the case that it's really needed).
        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);
View Full Code Here

                    int j = tup.indexOf('\n', i + 1);

                    String modName = new String(tup.substring(0, i));
                    File file = new File(tup.substring(i + 1, j));

                    return new Tuple<ModulesKey, List>(new ModulesKey(modName, file), InfoStrFactory.strToInfo(tup
                            .substring(j + 1)));
                }
                if (arg.startsWith("LST")) {
                    //Backward compatibility
                    return InfoStrFactory.strToInfo(arg.substring(3));
                }

                throw new AssertionError("Expecting string starting with STR or LST");
            }
        },

        new ICallback<String, Object>() {

            /**
             * Here we'll convert the object we added to a string.
             *
             * The objects we can add are:
             * Tuple<String (module name), List<IInfo>) -- on addition
             * String (module name) -- on deletion
             */
            public String call(Object arg) {
                if (arg instanceof String) {
                    return "STR" + (String) arg;
                }
                if (arg instanceof Tuple) {
                    Tuple tuple = (Tuple) arg;
                    if (tuple.o1 instanceof ModulesKey && tuple.o2 instanceof List) {
                        ModulesKey modName = (ModulesKey) tuple.o1;
                        List<IInfo> l = (List<IInfo>) tuple.o2;
                        String infoToString = InfoStrFactory.infoToString(l);
                        String fileStr = modName.file.toString();

                        FastStringBuffer buf = new FastStringBuffer("TUP", modName.name.length() + fileStr.length()
View Full Code Here

                monitor.worked(1);
            }

            if (m != null) {
                //we don't load them at this time.
                ModulesKey modulesKey = new ModulesKey(m, f);

                //no conflict (easy)
                if (!keys.containsKey(modulesKey)) {
                    keys.put(modulesKey, modulesKey);
                } else {
                    //we have a conflict, so, let's resolve which one to keep (the old one or this one)
                    if (PythonPathHelper.isValidSourceFile(f.getName())) {
                        //source files have priority over other modules (dlls) -- if both are source, there is no real way to resolve
                        //this priority, so, let's just add it over.
                        keys.put(modulesKey, modulesKey);
                    }
                }
            }
        }

        for (ZipContents zipContents : modulesFound.zipContents) {
            if (monitor.isCanceled()) {
                break;
            }
            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
View Full Code Here

                //we don't want it to be backed up by the same set (because it may be changed, so, we may get
                //a java.util.ConcurrentModificationException on places that use it)
                return new PyPublicTreeMap<ModulesKey, ModulesKey>(modulesKeys);
            }
        }
        ModulesKey startingWith = new ModulesKey(strStartingWith, null);
        ModulesKey endingWith = new ModulesKey(startingWith + "z", null);
        synchronized (modulesKeysLock) {
            //we don't want it to be backed up by the same set (because it may be changed, so, we may get
            //a java.util.ConcurrentModificationException on places that use it)
            return new PyPublicTreeMap<ModulesKey, ModulesKey>(modulesKeys.subMap(startingWith, endingWith));
        }
View Full Code Here

                }
                return map.get(map.lastKey());
            }
        }
        AbstractModule n = null;
        ModulesKey keyForCacheAccess = new ModulesKey(null, null);

        if (!dontSearchInit) {
            if (n == null) {
                keyForCacheAccess.name = new StringBuffer(name).append(".__init__").toString();
                n = cache.getObj(keyForCacheAccess, this);
View Full Code Here

TOP

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

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.