Skip to content
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

Merged
merged 1 commit into from
Feb 14, 2020

Conversation

jdneo
Copy link
Member

@jdneo jdneo commented Feb 13, 2020

Screen Shot 2020-02-13 at 10 45 49 AM

This is the first step of #229: Remove the duplication in the dependency explorer with the outline explorer, which containing the following change:

  • Remove the ITypeRoot level of in the dependency explorer. Instead, the explorer will directly show the primary class under the packages.
  • Change the configuration showOutline to showMembers, which can specify whether to show the class members under the primary class, so:
    • The package declaration will not show now, which is duplicated.
    • The primary type itself won't show now.

@jdneo jdneo force-pushed the cs/explorer-member branch from ec90d83 to 46b3550 Compare February 13, 2020 06:04
@jdneo jdneo added this to the 0.8.1 milestone Feb 13, 2020
@jdneo jdneo marked this pull request as ready for review February 13, 2020 08:16
for (IJavaElement element : packageFragment.getChildren()) {
if (element instanceof ITypeRoot) {
// Filter out the inner class files
if (element instanceof IClassFile && element.getElementName().contains("$")) {
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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);
Copy link
Contributor

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?

Copy link
Member Author

@jdneo jdneo Feb 13, 2020

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.

@jdneo jdneo merged commit 652790c into master Feb 14, 2020
@jdneo jdneo deleted the cs/explorer-member branch February 14, 2020 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants