-
Notifications
You must be signed in to change notification settings - Fork 82
Fix the sync issue with non-java files #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
|
||
public static IJarEntryResource createJarResource(URI uri) throws JavaModelException { | ||
String handleId = uri.getQuery(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null check or compatible check for URI getQuery here.
return uri != null && JDT_SCHEME.equals(uri.getScheme()) && CONTENTS_AUTHORITY.equals(uri.getAuthority()); | ||
} | ||
|
||
public static IJarEntryResource createJarResource(URI uri) throws JavaModelException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function name is misleading. You didn't create any resource here. The function just enumerate all resource files and return the list.
} | ||
} | ||
if (resource instanceof JarEntryDirectory) { | ||
JarEntryDirectory directory = (JarEntryDirectory) resource; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the first one failed, it will not continue the search in other folders. Is this by design?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
public static IPath removeProjectSegment(String projectElementName, IPath path) { | ||
if (projectElementName.equals(path.segment(0))) { | ||
return path.removeFirstSegments(1).makeRelative(); | ||
} | ||
return path; | ||
} | ||
|
||
public static PackageNode createNodeForProject(IJavaElement javaElement) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all these functions are in the utility class? The file will be bloated with static methods. Please organize the logic clearly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return projectNode; | ||
} | ||
|
||
public static PackageNode createNodeForResource(IResource resource) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the resource operation in well organized manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the item 1 of Effecitve Java 3rd for your reference: https://www.safaribooksonline.com/library/view/effective-java-3rd/9780134686097/ch2.xhtml#lev1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
return result; | ||
} | ||
|
||
|
||
/** | ||
* Create the node list from buttom to top until project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: buttom ==> bottom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @return | ||
* @throws JavaModelException | ||
*/ | ||
private static List<PackageNode> getParentListToProject(IResource element) throws JavaModelException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not parent list, but ancestor or path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @return | ||
* @throws JavaModelException | ||
*/ | ||
private static List<PackageNode> getParentAncestorNodes(IResource element) throws JavaModelException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAncestors is enough
No description provided.