-
Notifications
You must be signed in to change notification settings - Fork 77
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
Remove the duplication nodes with the outline explorer #235
Conversation
ec90d83
to
46b3550
Compare
for (IJavaElement element : packageFragment.getChildren()) { | ||
if (element instanceof ITypeRoot) { | ||
// Filter out the inner class files | ||
if (element instanceof IClassFile && element.getElementName().contains("$")) { |
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.
packageFragment.getChildren() returns the immediate children of this package. Will it contain inner class?
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.
Yes, the Inner class will become: XXX$Inner.class
after compilation.
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.
Theoretically the java class name itself can use $, but i didn't find a good way to judge whether it's inner class. let's keep the current judge, if there is someone reporting the issue, then fix it.
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.
ok
} else if (typeRoot instanceof IClassFile) { | ||
typeRootNode.setUri(JDTUtils.toUri((IClassFile) typeRoot)); | ||
public static PackageNode createNodeForPrimaryType(IType type) { | ||
PackageNode primaryTypeNode = new PackageNode(type.getElementName(), type.getPath().toPortableString(), NodeKind.PRIMARYTYPE); |
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 create packageNode for IType?
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.
That's some unknown historical reason. The Java side code only has the following kinds of nodes:
- PackageNode
- ContainerNode
- PackageRootNode
I'm also confused about the naming. But the fact is that different kind of nodes are all named as PackageNode
in the current implementation. One solution could be renaming the PackageNode
to ExplorerNode
or something else.
This is the first step of #229: Remove the duplication in the dependency explorer with the outline explorer, which containing the following change:
showOutline
toshowMembers
, which can specify whether to show the class members under the primary class, so: