use of com.intellij.lang.DependentLanguage in project intellij-community by JetBrains.
the class ChooseByNameLanguageFilter method getAllFilterValues.
@NotNull
@Override
protected Collection<Language> getAllFilterValues() {
final Collection<Language> registeredLanguages = Language.getRegisteredLanguages();
List<Language> accepted = new ArrayList<>();
for (Language language : registeredLanguages) {
if (language != Language.ANY && !(language instanceof DependentLanguage)) {
accepted.add(language);
}
}
Collections.sort(accepted, LanguageUtil.LANGUAGE_COMPARATOR);
return accepted;
}
use of com.intellij.lang.DependentLanguage in project intellij-community by JetBrains.
the class BaseMoveHandler method getRoot.
@Nullable
private static PsiFile getRoot(final PsiFile file, final Editor editor) {
if (file == null)
return null;
int offset = editor.getCaretModel().getOffset();
if (offset == editor.getDocument().getTextLength())
offset--;
if (offset < 0)
return null;
PsiElement leafElement = file.findElementAt(offset);
if (leafElement == null)
return null;
if (leafElement.getLanguage() instanceof DependentLanguage) {
leafElement = file.getViewProvider().findElementAt(offset, file.getViewProvider().getBaseLanguage());
if (leafElement == null)
return null;
}
ASTNode node = leafElement.getNode();
if (node == null)
return null;
return (PsiFile) PsiUtilBase.getRoot(node).getPsi();
}
Aggregations