mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 07:54:54 +07:00
clean: simplify method and move duplicates to upper class
GitOrigin-RevId: c542568e7d50b00df6fa00668a31537462a8dc51
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e2e7ecd91e
commit
3edf214b65
@@ -48,7 +48,11 @@ public abstract class DuplicatesProfile {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract boolean isMyDuplicate(@NotNull DupInfo info, int index);
|
||||
public boolean isMyDuplicate(@NotNull DupInfo info, int index) {
|
||||
PsiFragment[] fragments = info.getFragmentOccurences(index);
|
||||
Language language = fragments.length > 0 ? fragments[0].getLanguage() : null;
|
||||
return language != null && isMyLanguage(language);
|
||||
}
|
||||
|
||||
public boolean supportIndex() {
|
||||
return true;
|
||||
@@ -95,7 +99,6 @@ public abstract class DuplicatesProfile {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static DuplicatesProfile findProfileForDuplicate(@NotNull DupInfo dupInfo, int index) {
|
||||
for (DuplicatesProfile profile : EP_NAME.getExtensionList()) {
|
||||
|
||||
@@ -30,19 +30,4 @@ public abstract class DuplicatesProfileBase extends DuplicatesProfile {
|
||||
return DuplocatorUtil.registerAndGetState(language);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMyDuplicate(@NotNull DupInfo info, int index) {
|
||||
PsiFragment[] fragments = info.getFragmentOccurences(index);
|
||||
if (fragments.length > 0) {
|
||||
PsiElement[] elements = fragments[0].getElements();
|
||||
if (elements.length > 0) {
|
||||
final PsiElement first = elements[0];
|
||||
if (first != null) {
|
||||
Language language = first.getLanguage();
|
||||
return isMyLanguage(language);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user