Package org.python.pydev.editorinput

Examples of org.python.pydev.editorinput.PySourceLocatorBase


                if (fileTransfer.isSupportedType(event.currentDataType)) {
                    String[] files = (String[]) event.data;
                    if (files.length == 1) {
                        File file = new File(files[0]);
                        if (file.isDirectory()) {
                            PySourceLocatorBase locator = new PySourceLocatorBase();
                            IContainer container = locator.getWorkspaceContainer(file);
                            if (container != null && container.exists()) {
                                setSelectedContainer(container);
                            }
                        }
                    }
View Full Code Here


            itemPointer = new ItemPointer(file, testNode);
        } else {
            //Ok, it's not defined directly here (it's probably in a superclass), so, let's go on and
            //do an actual (more costly) find definition.
            try {
                PySourceLocatorBase locator = new PySourceLocatorBase();
                IFile workspaceFile = locator.getWorkspaceFile(file);
                if (workspaceFile != null && workspaceFile.exists()) {
                    IProject project = workspaceFile.getProject();
                    if (project != null && project.exists()) {
                        PythonNature nature = PythonNature.getPythonNature(project);
                        String moduleName = nature.resolveModule(file);
View Full Code Here

            parents.add(f);
            f = f.getParentFile();
        }
        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        IContainer[] containers = workspace.getRoot().findContainersForLocationURI(f.toURI());
        containers = new PySourceLocatorBase().filterNonExistentContainers(containers);
        if (containers.length == 0) {
            return;
        }
        IContainer container = (IContainer) containers[0];
        Collections.reverse(parents);
View Full Code Here

                    foundOffsets.clear();

                    IFile workspaceFile = null;
                    try {
                        workspaceFile = new PySourceLocatorBase().getWorkspaceFile(o.getKey().o2);
                        if (workspaceFile == null) {
                            Log.logInfo(com.aptana.shared_core.string.StringUtils.format("Ignoring: %s. "
                                    + "Unable to resolve to a file in the Eclipse workspace.", o.getKey().o2));
                            continue;
                        }
View Full Code Here

            Tuple<String, File> tup = entry.getKey();

            //now, let's make the mapping from the filesystem to the Eclipse workspace
            IFile workspaceFile = null;
            try {
                workspaceFile = new PySourceLocatorBase().getWorkspaceFile(tup.o2);
                if (workspaceFile == null) {
                    status.addWarning(com.aptana.shared_core.string.StringUtils.format("Error. Unable to resolve the file:\n" + "%s\n"
                            + "to a file in the Eclipse workspace.", tup.o2));
                    continue;
                }
View Full Code Here

    public void testSourceLocator() throws Exception {
        final Boolean[] called = new Boolean[] { false };
        final IPath madeUpPath = mod1.getLocation().append("inexistent");

        PySourceLocatorBase locator = new PySourceLocatorBase() {
            @Override
            protected IEditorInput selectFilesystemFileForPath(IPath path) {
                called[0] = true;
                assertEquals(path, madeUpPath);
                return PydevFileEditorInput.create(new File(path.removeLastSegments(1).toOSString()), true);
            }
        };
        IEditorInput editorInput = locator.createEditorInput(madeUpPath);
        assertTrue(editorInput != null);
        assertTrue(called[0]);
        called[0] = false;

        editorInput = locator.createEditorInput(madeUpPath);
        assertTrue(!called[0]);
        assertTrue(editorInput != null);

        PySourceLocatorPrefs.setIgnorePathTranslation(madeUpPath);
        editorInput = locator.createEditorInput(madeUpPath);
        assertTrue(!called[0]);
        assertTrue(editorInput == null);

    }
View Full Code Here

TOP

Related Classes of org.python.pydev.editorinput.PySourceLocatorBase

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.