package jetbrains.mps.lang.behavior.findUsages; /*Generated by MPS */ import jetbrains.mps.ide.findusages.findalgorithm.finders.GeneratedFinder; import org.jetbrains.mps.openapi.language.SAbstractConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import org.jetbrains.mps.openapi.module.SearchScope; import java.util.List; import org.jetbrains.mps.openapi.util.ProgressMonitor; import jetbrains.mps.ide.findusages.view.FindUtils; import jetbrains.mps.internal.collections.runtime.ListSequence; import jetbrains.mps.internal.collections.runtime.IWhereFilter; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import org.jetbrains.annotations.Nullable; import org.jetbrains.mps.openapi.model.SNodeReference; public class OverridingMethods_Finder extends GeneratedFinder { public OverridingMethods_Finder() { } @Override public String getDescription() { return "Overriding Methods"; } @Override public String getLongDescription() { return ""; } @Override public SAbstractConcept getSConcept() { return MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration"); } @Override public boolean isApplicable(SNode node) { return SNodeOperations.isInstanceOf(SNodeOperations.getParent(node), MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d43447b1aL, "jetbrains.mps.lang.behavior.structure.ConceptBehavior")); } @Override protected void doFind(SNode node, SearchScope scope, List<SNode> _results, ProgressMonitor monitor) { try { monitor.start("Overriding methods", 10); List<SNode> nodes = FindUtils.executeFinder("jetbrains.mps.lang.structure.findUsages.NodeUsages_Finder", node, scope, monitor.subTask(2)); ProgressMonitor sm = monitor.subTask(8); final SNode n = node; sm.start("", ListSequence.fromList(nodes).where(new IWhereFilter<SNode>() { public boolean accept(SNode it) { return SNodeOperations.isInstanceOf(it, MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration")) && SLinkOperations.getTarget(SNodeOperations.cast(it, MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration")), MetaAdapterFactory.getReferenceLink(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, 0x11d4348057fL, "overriddenMethod")) == n; } }).count()); for (SNode nodeUsage : ListSequence.fromList(nodes)) { if (SNodeOperations.isInstanceOf(nodeUsage, MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration")) && SLinkOperations.getTarget(SNodeOperations.cast(nodeUsage, MetaAdapterFactory.getConcept(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, "jetbrains.mps.lang.behavior.structure.ConceptMethodDeclaration")), MetaAdapterFactory.getReferenceLink(0xaf65afd8f0dd4942L, 0x87d963a55f2a9db1L, 0x11d4348057eL, 0x11d4348057fL, "overriddenMethod")) == node) { ListSequence.fromList(_results).addElement(nodeUsage); for (SNode overriding : ListSequence.fromList(FindUtils.executeFinder("jetbrains.mps.lang.behavior.findUsages.OverridingMethods_Finder", nodeUsage, scope, sm.subTask(1)))) { ListSequence.fromList(_results).addElement(overriding); } } } sm.done(); } finally { monitor.done(); } } @Nullable @Override public SNodeReference getDeclarationNode() { return buildNodePointer(FindUsagesDescriptor.DECLARING_MODEL, "1227530810320"); } }