Examples of IWrappedResource


Examples of org.python.pydev.navigator.elements.IWrappedResource

        return false;
    }

    private IFile getIFile(Object receiver) {
        if (receiver instanceof IWrappedResource) {
            IWrappedResource wrappedResource = (IWrappedResource) receiver;
            Object actualObject = wrappedResource.getActualObject();
            if (actualObject instanceof IFile) {
                return (IFile) actualObject;
            }
        }
        if (receiver instanceof IAdaptable) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        if (p != null) {
            parent = p;

        } else if (element instanceof IWrappedResource) {
            // just return the parent
            IWrappedResource resource = (IWrappedResource) element;
            parent = resource.getParentElement();

        } else if (element instanceof IWorkingSet) {
            parent = ResourcesPlugin.getWorkspace().getRoot();

        } else if (element instanceof TreeNode) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        if (oldInput instanceof IWorkspace) {
            oldWorkspace = new IWorkspace[] { (IWorkspace) oldInput };
        } else if (oldInput instanceof IResource) {
            oldWorkspace = new IWorkspace[] { ((IResource) oldInput).getWorkspace() };
        } else if (oldInput instanceof IWrappedResource) {
            IWrappedResource iWrappedResource = (IWrappedResource) oldInput;
            Object actualObject = iWrappedResource.getActualObject();
            if (actualObject instanceof IResource) {
                IResource iResource = (IResource) actualObject;
                oldWorkspace = new IWorkspace[] { iResource.getWorkspace() };
            }
        } else if (oldInput instanceof IWorkingSet) {
            IWorkingSet oldWorkingSet = (IWorkingSet) oldInput;
            oldWorkspace = getWorkspaces(oldWorkingSet);
        }

        //and the new
        if (newInput instanceof IWorkspace) {
            newWorkspace = new IWorkspace[] { (IWorkspace) newInput };
        } else if (newInput instanceof IResource) {
            newWorkspace = new IWorkspace[] { ((IResource) newInput).getWorkspace() };
        } else if (newInput instanceof IWrappedResource) {
            IWrappedResource iWrappedResource = (IWrappedResource) newInput;
            Object actualObject = iWrappedResource.getActualObject();
            if (actualObject instanceof IResource) {
                IResource iResource = (IResource) actualObject;
                newWorkspace = new IWorkspace[] { iResource.getWorkspace() };
            }
        } else if (newInput instanceof IWorkingSet) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        if (element instanceof PythonNode) {
            PythonNode node = (PythonNode) element;
            return node.entry.getImage();
        }
        if (element instanceof IWrappedResource) {
            IWrappedResource resource = (IWrappedResource) element;
            Object actualObject = resource.getActualObject();
            if (actualObject instanceof IFile) {
                IFile iFile = (IFile) actualObject;
                final String name = iFile.getName();

                if (name.indexOf('.') == -1) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

     * @param validInitFiles the valid names for the __init__ files (because we can have more than one matching extension)
     *
     * @return true if all the parents have the __init__ files and false otherwise.
     */
    private final boolean checkParentsHaveInit(final PythonFolder pythonFolder, final String[] validInitFiles) {
        IWrappedResource parentElement = pythonFolder.getParentElement();
        while (parentElement != null) {
            if (parentElement instanceof PythonSourceFolder) {
                //gotten to the source folder: this one doesn't need to have an __init__.py
                return true;
            }

            Object actualObject = parentElement.getActualObject();
            if (actualObject instanceof IFolder) {
                IFolder folder = (IFolder) actualObject;
                boolean foundInit = false;
                for (String init : validInitFiles) {
                    final IFile file = folder.getFile(init);
                    if (file.exists()) {
                        foundInit = true;
                        break;
                    }
                }
                if (!foundInit) {
                    return false;
                }
            }

            Object tempParent = parentElement.getParentElement();
            if (!(tempParent instanceof IWrappedResource)) {
                break;
            }
            parentElement = (IWrappedResource) tempParent;

View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

            PythonSourceFolder sourceFolder = (PythonSourceFolder) element;
            return provider.getText(sourceFolder.container);
        }

        if (element instanceof IWrappedResource) {
            IWrappedResource resource = (IWrappedResource) element;
            return provider.getText(resource.getActualObject());
        }
        if (element instanceof TreeNode<?>) {
            TreeNode<?> treeNode = (TreeNode<?>) element;
            LabelAndImage data = (LabelAndImage) treeNode.getData();
            return data.label;
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        Object firstElement = aSelection.getFirstElement();

        //if it is a python element, let's first get the actual object for finding the editor
        if (firstElement instanceof IWrappedResource) {
            IWrappedResource resource = (IWrappedResource) firstElement;
            firstElement = resource.getActualObject();
        }

        //and now, if it is really a file...
        if (firstElement instanceof IFile) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

                    }
                    if (object.equals(a)) {
                        return w;
                    }
                    if (object instanceof IWrappedResource) {
                        IWrappedResource wrappedResource = (IWrappedResource) object;
                        if (wrappedResource.getActualObject().equals(a)) {
                            return w;
                        }
                    }
                }
            }
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        Object p = this.topLevelChoice.getWorkingSetParentIfAvailable(object, getWorkingSetsCallback);
        if (p != null) {
            aSuggestedParent = p;

        } else if (object instanceof IWrappedResource) {
            IWrappedResource resource = (IWrappedResource) object;
            Object parentElement = resource.getParentElement();
            if (parentElement != null) {
                aSuggestedParent = parentElement;
            }

        } else if (object instanceof TreeNode<?>) {
View Full Code Here

Examples of org.python.pydev.navigator.elements.IWrappedResource

        if (parent instanceof IContainer) {
            IContainer parentContainer = (IContainer) parent;
            Object pythonParent = getResourceInPythonModel(parentContainer, true);

            if (pythonParent instanceof IWrappedResource) {
                IWrappedResource parentResource = (IWrappedResource) pythonParent;
                modification.setParent(parentResource);
                wrapChildren(parentResource, parentResource.getSourceFolder(), modification.getChildren(), isAdd);

            } else if (pythonParent == null) {

                Object parentInWrap = parentContainer;
                PythonSourceFolder sourceFolderInWrap = null;

                //this may happen when a source folder is added or some element that still doesn't have it's parent in the model...
                //so, we have to get the parent's parent until we actually 'know' that it is not in the model (or until we run
                //out of parents to try)
                //the case in which we reproduce this is Test 1 (described in the class)
                FastStack<Object> found = new FastStack<Object>(20);
                while (true) {

                    //add the current to the found
                    if (parentContainer == null) {
                        break;
                    }

                    found.push(parentContainer);
                    if (parentContainer instanceof IProject) {
                        //we got to the project without finding any part of a python model already there, so, let's see
                        //if any of the parts was actually a source folder (that was still not added)
                        tryCreateModelFromProject((IProject) parentContainer, found);
                        //and now, if it was created, try to convert it to the python model (without any further add)
                        convertToPythonElementsUpdateOrRefresh(modification.getChildren());
                        return;
                    }

                    Object p = getResourceInPythonModel(parentContainer, true);

                    if (p instanceof IWrappedResource) {
                        IWrappedResource wrappedResource = (IWrappedResource) p;
                        sourceFolderInWrap = wrappedResource.getSourceFolder();

                        while (found.size() > 0) {
                            Object f = found.pop();
                            if (f instanceof IResource) {
                                //no need to create it if it's already in the model!
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.