package jetbrains.mps.ide.java.sourceStubs;
/*Generated by MPS */
import org.jetbrains.mps.openapi.persistence.FindUsagesParticipant;
import com.intellij.openapi.components.ApplicationComponent;
import java.util.Collection;
import org.jetbrains.mps.openapi.model.SModel;
import java.util.Set;
import org.jetbrains.mps.openapi.model.SNode;
import org.jetbrains.mps.openapi.util.Consumer;
import org.jetbrains.mps.openapi.model.SReference;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import org.jetbrains.mps.openapi.model.SModelReference;
import org.jetbrains.mps.openapi.persistence.PersistenceFacade;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* Will be gone when I implement find usages for source stubs.
* For now MPS seems to do the default thing: goes through the model nodes which turns out to be very slow
*/
public class EmptyJavaSourcetubsFindUsages implements FindUsagesParticipant, ApplicationComponent {
public EmptyJavaSourcetubsFindUsages() {
}
public void findUsages(Collection<SModel> models, Set<SNode> set, Consumer<SReference> consumer, Consumer<SModel> processedConsumer) {
// just skipping java psi stub models from find usages
// usages in java should be found via idea ReferenceSearch
for (SModel model : models) {
if (model instanceof JavaSourceStubModelDescriptor) {
processedConsumer.consume(model);
}
}
}
public void findInstances(Collection<SModel> collection, Set<SAbstractConcept> set, Consumer<SNode> consumer, Consumer<SModel> consumer1) {
// let's not skip this, it's not going to slow down anything
}
public void findModelUsages(Collection<SModel> collection, Set<SModelReference> set, Consumer<SModel> consumer, Consumer<SModel> consumer1) {
// let's not skip this, it's not going to slow down anything
}
public void initComponent() {
PersistenceFacade.getInstance().addFindUsagesParticipant(this);
}
public void disposeComponent() {
PersistenceFacade.getInstance().removeFindUsagesParticipant(this);
}
@NonNls
@NotNull
public String getComponentName() {
return "Empty PSI java stub find usages participant";
}
}