forked from consulo/consulo-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpringMVCVariablesProvider.java
More file actions
39 lines (34 loc) · 1.49 KB
/
Copy pathSpringMVCVariablesProvider.java
File metadata and controls
39 lines (34 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.intellij.spring.web.mvc;
import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiType;
import com.intellij.psi.impl.source.jsp.JspImplicitVariableImpl;
import com.intellij.psi.impl.source.jsp.el.impl.ELElementProcessor;
import com.intellij.psi.impl.source.jsp.el.impl.ElVariablesProvider;
import com.intellij.psi.jsp.el.ELExpressionHolder;
import com.intellij.spring.web.mvc.jam.SpringMVCJamModel;
import com.intellij.spring.web.mvc.jam.SpringMVCModelAttribute;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author Dmitry Avdeev
*/
public class SpringMVCVariablesProvider extends ElVariablesProvider {
public boolean processImplicitVariables(@NotNull final PsiElement element, @NotNull final ELExpressionHolder containingFile, @NotNull final ELElementProcessor processor) {
final Module module = containingFile.getModule();
if (module != null) {
final Collection<SpringMVCModelAttribute> attributes = SpringMVCJamModel.getModel(module).getModelAttributes();
for (SpringMVCModelAttribute attribute : attributes) {
final PsiType type = attribute.getType();
if (type == null) {
continue;
}
final String name = attribute.getName();
if (name != null) {
processor.processVariable(new JspImplicitVariableImpl(containingFile, name, type, attribute.getAnnotation(), JspImplicitVariableImpl.NESTED_RANGE));
}
}
}
return true;
}
}