Package org.python.pydev.navigator.elements

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


                    continue;
                }
            }

            if (pythonSourceFolder != null) {
                IWrappedResource r = doWrap(currentParent, pythonSourceFolder, child);
                if (r != null) {
                    child = r;
                }
            }
            currentParent = child;
View Full Code Here


            Object existing = getResourceInPythonModel((IResource) child, true);

            if (existing == null) {
                if (isAdd) {
                    //add
                    IWrappedResource w = doWrap(parent, pythonSourceFolder, child);
                    if (w != null) { //if it is null, it is not below a python source folder
                        childrenItr.remove();
                        convertedChildren.add(w);
                    }
                } else {
                    continue; //it has already been removed
                }

            } else { //existing != null
                childrenItr.remove();
                convertedChildren.add(existing);
                if (!isAdd) {
                    //also remove it from the model
                    IWrappedResource wrapped = (IWrappedResource) existing;
                    wrapped.getSourceFolder().removeChild((IResource) child);
                }
            }
        }

        //if we did have some wrapping... go on and add them to the out list (and return true)
View Full Code Here

                        continue;
                    }

                    Object pythonParent = getResourceInPythonModel(p, true);
                    if (pythonParent instanceof IWrappedResource) {
                        IWrappedResource parent = (IWrappedResource) pythonParent;

                        if (res instanceof IProject) {
                            throw new RuntimeException("A project's parent should never be an IWrappedResource!");

                        } else if (res instanceof IFolder) {
                            childrenItr.remove();
                            convertedChildren.add(new PythonFolder(parent, (IFolder) res, parent.getSourceFolder()));

                        } else if (res instanceof IFile) {
                            childrenItr.remove();
                            convertedChildren.add(new PythonFile(parent, (IFile) res, parent.getSourceFolder()));

                        } else if (child instanceof IResource) {
                            childrenItr.remove();
                            convertedChildren.add(new PythonResource(parent, (IResource) child, parent
                                    .getSourceFolder()));
                        }

                    } else if (res instanceof IFolder) {
                        //ok, still not in the model... could it be a PythonSourceFolder
View Full Code Here

            } else if (resource instanceof IProject || resource instanceof IWorkspaceRoot
                    || resource instanceof IWorkingSet) {
                break;

            } else if (resource instanceof IWrappedResource) {
                IWrappedResource w = (IWrappedResource) resource;
                resource = w.getParentElement();
                if (resource == null) {
                    break;
                }
                ret.add(0, resource);
View Full Code Here

                    return ((IProject) actualObject).isOpen() == toBoolean(expectedValue);
                }
            }
        } else if ("name".equals(property)) {
            if (receiver instanceof IWrappedResource) {
                IWrappedResource wrappedResource = (IWrappedResource) receiver;
                IResource resource = (IResource) wrappedResource.getAdapter(IResource.class);
                if (resource != null) {
                    return expectedValue.toString().equals(resource.getName());
                }
            }
        }
View Full Code Here

    /**
     * This is the main change (wherever it had a target, it tries to get the actual wrapped resource -- if it is wrapped)
     */
    private Object getActual(Object target) {
        if (target instanceof IWrappedResource) {
            IWrappedResource resource = (IWrappedResource) target;
            target = resource.getActualObject();
        }
        return target;
    }
View Full Code Here

            //as if they were the same thing.
            setComparer(new IElementComparer() {

                public int hashCode(Object element) {
                    if (element instanceof IWrappedResource) {
                        IWrappedResource wrappedResource = (IWrappedResource) element;
                        return wrappedResource.getActualObject().hashCode();
                    }
                    return element.hashCode();
                }

                public boolean equals(Object a, Object b) {
                    if (a instanceof IWrappedResource) {
                        IWrappedResource wrappedResource = (IWrappedResource) a;
                        a = wrappedResource.getActualObject();
                    }
                    if (b instanceof IWrappedResource) {
                        IWrappedResource wrappedResource = (IWrappedResource) b;
                        b = wrappedResource.getActualObject();
                    }
                    if (a == null) {
                        if (b == null) {
                            return true;
                        } else {
View Full Code Here

        return nature;
    }

    public static IResource getResourceFromObject(Object receiver) {
        if (receiver instanceof IWrappedResource) {
            IWrappedResource wrappedResource = (IWrappedResource) receiver;
            Object actualObject = wrappedResource.getActualObject();
            if (actualObject instanceof IResource) {
                return (IResource) actualObject;
            }
        }
        if (receiver instanceof IResource) {
View Full Code Here

        return null;
    }

    public static IContainer getContainerFromObject(Object receiver) {
        if (receiver instanceof IWrappedResource) {
            IWrappedResource wrappedResource = (IWrappedResource) receiver;
            Object actualObject = wrappedResource.getActualObject();
            if (actualObject instanceof IContainer) {
                return (IContainer) actualObject;
            }
        }
        if (receiver instanceof IContainer) {
View Full Code Here

TOP

Related Classes of org.python.pydev.navigator.elements.IWrappedResource

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.