Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
7f14bdea
Commit
7f14bdea
authored
7 years ago
by
Roman Shevchenko
Browse files
Options
Download
Email Patches
Plain Diff
[java] fixes module-info.class -> .java navigation in libraries
parent
b3522362
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
+11
-3
...om/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java
+2
-16
...src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java
with
13 additions
and
19 deletions
+13
-19
java/java-impl/src/com/intellij/psi/impl/JavaPsiImplementationHelperImpl.java
+
11
-
3
View file @
7f14bdea
...
...
@@ -21,6 +21,7 @@ import com.intellij.openapi.roots.impl.LibraryScopeCache;
import
com.intellij.openapi.util.text.StringUtil
;
import
com.intellij.openapi.vfs.VfsUtilCore
;
import
com.intellij.openapi.vfs.VirtualFile
;
import
com.intellij.openapi.vfs.jrt.JrtFileSystem
;
import
com.intellij.pom.java.LanguageLevel
;
import
com.intellij.psi.*
;
import
com.intellij.psi.codeStyle.CodeStyleSettings
;
...
...
@@ -40,6 +41,7 @@ import org.jetbrains.annotations.Nullable;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.stream.Stream
;
/**
...
...
@@ -103,6 +105,7 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
@Override
public
PsiElement
getClsFileNavigationElement
(
@NotNull
PsiJavaFile
clsFile
)
{
Function
<
VirtualFile
,
VirtualFile
>
finder
=
null
;
Predicate
<
PsiFile
>
filter
=
null
;
PsiClass
[]
classes
=
clsFile
.
getClasses
();
if
(
classes
.
length
>
0
)
{
...
...
@@ -110,12 +113,17 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
String
packageName
=
clsFile
.
getPackageName
();
String
relativePath
=
packageName
.
isEmpty
()
?
sourceFileName
:
packageName
.
replace
(
'.'
,
'/'
)
+
'/'
+
sourceFileName
;
finder
=
root
->
root
.
findFileByRelativePath
(
relativePath
);
filter
=
PsiClassOwner
.
class
::
isInstance
;
}
else
{
PsiJavaModule
module
=
clsFile
.
getModuleDeclaration
();
if
(
module
!=
null
)
{
String
moduleName
=
module
.
getName
();
finder
=
root
->
moduleName
.
equals
(
root
.
getName
())
?
root
.
findChild
(
PsiJavaModule
.
MODULE_INFO_FILE
)
:
null
;
finder
=
root
->
!
JrtFileSystem
.
isModuleRoot
(
root
)
||
moduleName
.
equals
(
root
.
getName
())
?
root
.
findChild
(
PsiJavaModule
.
MODULE_INFO_FILE
)
:
null
;
filter
=
psi
->
{
PsiJavaModule
candidate
=
psi
instanceof
PsiJavaFile
?
((
PsiJavaFile
)
psi
).
getModuleDeclaration
()
:
null
;
return
candidate
!=
null
&&
moduleName
.
equals
(
candidate
.
getName
());
};
}
}
...
...
@@ -124,8 +132,8 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
return
findSourceRoots
(
clsFile
.
getContainingFile
().
getVirtualFile
())
.
map
(
finder
)
.
filter
(
source
->
source
!=
null
&&
source
.
isValid
())
.
map
(
clsFile
.
getManager
(
)::
findFile
)
.
filter
(
PsiClassOwner
.
class
::
isInstance
)
.
map
(
PsiManager
.
getInstance
(
myProject
)::
findFile
)
.
filter
(
filter
)
.
findFirst
()
.
orElse
(
clsFile
);
}
...
...
This diff is collapsed.
Click to expand it.
java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsJavaModuleImpl.java
+
2
-
16
View file @
7f14bdea
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package
com.intellij.psi.impl.compiled
;
import
com.intellij.navigation.ItemPresentation
;
...
...
@@ -171,7 +157,7 @@ public class ClsJavaModuleImpl extends ClsRepositoryPsiElement<PsiJavaModuleStub
}
}
return
getNameIdentifier
()
;
return
this
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment