mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: use utility method
This commit is contained in:
+1
-4
@@ -15,10 +15,7 @@ public final class ReferencePredicate extends SubstitutionHandler {
|
||||
}
|
||||
|
||||
public boolean match(PsiElement node, PsiElement match, MatchContext context) {
|
||||
if (StructuralSearchUtil.isIdentifier(match)) {
|
||||
// since we pickup tokens
|
||||
match = match.getParent();
|
||||
}
|
||||
match = StructuralSearchUtil.getParentIfIdentifier(match);
|
||||
|
||||
PsiElement result = MatchUtils.getReferencedElement(match);
|
||||
if (result == null) {
|
||||
|
||||
+1
-3
@@ -102,9 +102,7 @@ public final class RegExpPredicate extends MatchPredicate {
|
||||
|
||||
if (!result) {
|
||||
|
||||
if(StructuralSearchUtil.isIdentifier(matchedNode)) {
|
||||
matchedNode = matchedNode.getParent();
|
||||
}
|
||||
matchedNode = StructuralSearchUtil.getParentIfIdentifier(matchedNode);
|
||||
|
||||
String alternativeText = context.getPattern().getAlternativeTextToMatch(matchedNode, text);
|
||||
if (alternativeText != null) {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class ReplacementContext {
|
||||
for (String s : variableMap.keySet()) {
|
||||
final MatchResult matchResult = replacementInfo.getVariableMap().get(s);
|
||||
PsiElement match = matchResult.getMatchRef() != null ? matchResult.getMatch() : null;
|
||||
if (StructuralSearchUtil.isIdentifier(match)) match = match.getParent();
|
||||
match = StructuralSearchUtil.getParentIfIdentifier(match);
|
||||
|
||||
if (match instanceof PsiNamedElement) {
|
||||
final String name = ((PsiNamedElement)match).getName();
|
||||
|
||||
Reference in New Issue
Block a user