use of org.jetbrains.plugins.ruby.motion.bridgesupport.Class in project intellij-plugins by JetBrains.
the class RubyMotionSymbolProvider method findClassOrStruct.
@Nullable
public static Symbol findClassOrStruct(Module module, Collection<Framework> frameworks, List<String> name) {
final List<Class> classes = new ArrayList<>();
for (Framework framework : frameworks) {
final Class clazz = framework.getClass(name);
ContainerUtil.addIfNotNull(classes, clazz);
}
if (!classes.isEmpty()) {
return new MotionClassSymbol(module, classes);
}
if (name.size() > 1)
return null;
for (Framework framework : frameworks) {
final Struct struct = framework.getStruct(name.get(0));
if (struct != null) {
return new StructSymbol(module, struct);
}
}
return null;
}
use of org.jetbrains.plugins.ruby.motion.bridgesupport.Class in project intellij-plugins by JetBrains.
the class RubyMotionParamdefsProvider method loadAvailableSelectors.
private static void loadAvailableSelectors(Framework framework, Map<String, Map<String, Collection<Function>>> mergedFunctions) {
final String version = framework.getVersion();
for (Class clazz : framework.getClasses()) {
for (Function function : clazz.getFunctions()) {
if (!canHaveParamdef(function))
continue;
final String name = clazz.getName() + "." + MotionSymbolUtil.getSelectorNames(function).get(0);
Map<String, Collection<Function>> allFunctions = mergedFunctions.get(name);
if (allFunctions == null) {
allFunctions = new HashMap<>();
mergedFunctions.put(name, allFunctions);
}
Collection<Function> frameworkFunctions = allFunctions.get(version);
if (frameworkFunctions == null) {
frameworkFunctions = new ArrayList<>();
allFunctions.put(version, frameworkFunctions);
}
frameworkFunctions.add(function);
}
}
}
use of org.jetbrains.plugins.ruby.motion.bridgesupport.Class in project intellij-plugins by JetBrains.
the class MotionClassSymbol method getChildren.
@NotNull
@Override
public Children getChildren() {
return new ChildrenImpl() {
@Override
public boolean processChildren(SymbolPsiProcessor processor, final PsiElement invocationPoint) {
final MotionClassSymbol parent = MotionClassSymbol.this;
for (Class clazz : myClasses) {
for (Function function : clazz.getFunctions()) {
for (RTypedSyntheticSymbol functionSymbol : MotionSymbolUtil.createSelectorSymbols(myModule, parent, function)) {
if (!processor.process(functionSymbol)) {
return false;
}
}
}
for (Class subClass : clazz.getSubClasses()) {
final MotionClassSymbol symbol = new MotionClassSymbol(myModule, Collections.singletonList(subClass));
if (!processor.process(symbol)) {
return false;
}
}
}
final Symbol superClass = getSuperClassSymbol(invocationPoint);
if (superClass != null) {
final Children children = superClass.getChildren();
if (!children.processChildren(processor, invocationPoint)) {
return false;
}
}
return true;
}
};
}
Aggregations