mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Debugging GSP pages.
This commit is contained in:
@@ -28,6 +28,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.sun.jdi.Location;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -164,7 +165,22 @@ public class ContextUtil {
|
||||
}
|
||||
|
||||
PsiElement element;
|
||||
final PsiElement rootElement = JspPsiUtil.isInJspFile(psiFile) ? (JspPsiUtil.getJspFile(psiFile)).getJavaClass() : psiFile;
|
||||
|
||||
PsiElement rootElement = psiFile;
|
||||
|
||||
List<PsiFile> allFiles = psiFile.getViewProvider().getAllFiles();
|
||||
if (allFiles.size() > 1) { // jsp & gsp
|
||||
PsiClassOwner owner = ContainerUtil.findInstance(allFiles, PsiClassOwner.class);
|
||||
if (owner != null) {
|
||||
PsiClass[] classes = owner.getClasses();
|
||||
if (classes.length == 1 && classes[0] instanceof SyntheticElement) {
|
||||
rootElement = classes[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//final PsiElement rootElement = JspPsiUtil.isInJspFile(psiFile) ? (JspPsiUtil.getJspFile(psiFile)).getJavaClass() : psiFile;
|
||||
|
||||
while(true) {
|
||||
final CharSequence charsSequence = document.getCharsSequence();
|
||||
for (; startOffset < charsSequence.length(); startOffset++) {
|
||||
|
||||
+2
-6
@@ -89,7 +89,7 @@ public class GroovyCodeFragmentFactory implements CodeFragmentFactory {
|
||||
|
||||
PsiClass contextClass = PsiUtil.getContextClass(context);
|
||||
boolean isStatic = isStaticContext(context);
|
||||
StringBuffer javaText = new StringBuffer();
|
||||
StringBuilder javaText = new StringBuilder();
|
||||
|
||||
javaText.append("groovy.lang.MetaClass |mc;\n");
|
||||
javaText.append("java.lang.Class |clazz;\n");
|
||||
@@ -256,11 +256,7 @@ public class GroovyCodeFragmentFactory implements CodeFragmentFactory {
|
||||
}
|
||||
|
||||
public boolean isContextAccepted(PsiElement context) {
|
||||
return context != null && context.getLanguage().equals(GroovyFileType.GROOVY_FILE_TYPE.getLanguage());
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return "Groovy";
|
||||
return context != null && context.getLanguage().equals(GroovyFileType.GROOVY_LANGUAGE);
|
||||
}
|
||||
|
||||
public LanguageFileType getFileType() {
|
||||
|
||||
Reference in New Issue
Block a user