Strange method toProjectRelativePaths / duplicated 3 times in the code base ?

From: Sébastien Sahuc (lis..ahuc.net)
Date: Tue Mar 28 2006 - 19:57:38 EST

  • Next message: Sébastien Sahuc: "How do I enable Eclipse/WOLips Logging ?"

    Guys,

    I'm hitting a bug with the new code that Ulrich committed to remove
    the .WOLips dependencies. While debugging I noticed the following
    SAME method in exactly three different location. On top of that I do
    not understand what is the purpose of this method, but I do know that
    is the cause of my matching problem I'd like to fix. Please throw in
    any hints you have you this method .

    this method appears in the classes:
    org.objectstyle.wolips.core.resources.internal.build.AbstractBuildVisito
    r
    org.objectstyle.wolips.core.resources.internal.types.file.ProjectPattern
    sets
    org.objectstyle.wolips.datasets.adaptable.ProjectPatternsets

            private String[] toProjectRelativePaths(IResource resource) {
                    String[] returnValue = null;
                    if (resource.getParent().getType() != IResource.ROOT
                    /* && resource.getParent().getType() != IResource.PROJECT */) {
                            returnValue = new String[2];
                            String string = null;
                            if (resource.getType() != IResource.FOLDER) {
                                    IPath path = resource.getParent().getProjectRelativePath();
                                    /*
                                     * String string = resource.getProject().getName() + "/" +
                                     * path.toString() + "/";
                                     */
                                    string = path.toString() + "/";
                            } else {
                                    string = "/" + resource.getName() + "/";
                            }
                            returnValue[0] = string;
                    } else {
                            returnValue = new String[1];
                    }
                    IPath path = resource.getProjectRelativePath();
                    //String string = resource.getProject().getName() + "/" +
                    // path.toString();
                    String string = path.toString();
                    if (returnValue.length == 2) {
                            returnValue[1] = string;
                    } else {
                            returnValue[0] = string;
                    }
                    return returnValue;
            }

    Thanks,

    Sebastien



    This archive was generated by hypermail 2.0.0 : Tue Mar 28 2006 - 19:57:41 EST