mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -215,7 +215,8 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
" x--;\n" +
|
||||
" } while (x > 10) \n" +
|
||||
" }\n" +
|
||||
" public static void test() { \n" +
|
||||
" public static void test() \n" +
|
||||
" throws Exception { \n" +
|
||||
" foo.foo().bar(\"arg1\", \n" +
|
||||
" \"arg2\"); \n" +
|
||||
" } \n" +
|
||||
|
||||
@@ -823,6 +823,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
if (role == ChildRole.TYPE_PARAMETER_LIST) return defaultAlignment;
|
||||
if (role == ChildRole.TYPE) return defaultAlignment;
|
||||
if (role == ChildRole.NAME) return defaultAlignment;
|
||||
if (role == ChildRole.THROWS_LIST && mySettings.ALIGN_THROWS_KEYWORD) return defaultAlignment;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,10 +78,13 @@ public class InlineUtil {
|
||||
final PsiReferenceExpression methodExpression = ((PsiMethodCallExpression)expr).getMethodExpression();
|
||||
final PsiExpression qualifierExpression = methodExpression.getQualifierExpression();
|
||||
if (qualifierExpression == null) {
|
||||
if (((PsiMethod)resolved).getModifierList().hasModifierProperty(PsiModifier.STATIC)) {
|
||||
methodExpression.setQualifierExpression(elementFactory.createReferenceExpression(thisClass));
|
||||
final PsiMethod method = (PsiMethod)resolved;
|
||||
final PsiClass containingClass = method.getContainingClass();
|
||||
LOG.assertTrue(containingClass != null);
|
||||
if (method.getModifierList().hasModifierProperty(PsiModifier.STATIC)) {
|
||||
methodExpression.setQualifierExpression(elementFactory.createReferenceExpression(containingClass));
|
||||
} else {
|
||||
methodExpression.setQualifierExpression(createThisExpression(manager, thisClass, refParent));
|
||||
methodExpression.setQualifierExpression(createThisExpression(manager, containingClass, refParent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static Statics._emptyList;
|
||||
|
||||
public class Statics {
|
||||
|
||||
public static <T> List<T> _emptyList() {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Foo {
|
||||
public static void main(String[] args) {
|
||||
List<String> v1 = _emptyList();
|
||||
doSomething(v<caret>1);
|
||||
}
|
||||
|
||||
public static void doSomething(List<String> list) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static Statics._emptyList;
|
||||
|
||||
public class Statics {
|
||||
|
||||
public static <T> List<T> _emptyList() {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Foo {
|
||||
public static void main(String[] args) {
|
||||
doSomething(Statics.<String>_emptyList());
|
||||
}
|
||||
|
||||
public static void doSomething(List<String> list) {
|
||||
|
||||
}
|
||||
}
|
||||
+22
@@ -251,4 +251,26 @@ public class JavaFormatterAlignmentTest extends AbstractJavaFormatterTest {
|
||||
"}"
|
||||
);
|
||||
}
|
||||
|
||||
public void testAlignThrowsKeyword() throws Exception {
|
||||
// Inspired by IDEA-63820
|
||||
|
||||
getSettings().ALIGN_THROWS_KEYWORD = true;
|
||||
doClassTest(
|
||||
"public void test()\n" +
|
||||
" throws Exception {}",
|
||||
"public void test()\n" +
|
||||
"throws Exception {\n" +
|
||||
"}"
|
||||
);
|
||||
|
||||
getSettings().ALIGN_THROWS_KEYWORD = false;
|
||||
doClassTest(
|
||||
"public void test()\n" +
|
||||
" throws Exception {}",
|
||||
"public void test()\n" +
|
||||
" throws Exception {\n" +
|
||||
"}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,10 @@ public class InlineLocalTest extends LightCodeInsightTestCase {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testStaticImported() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
private void doTest(final boolean inlineDef, String conflictMessage) throws Exception {
|
||||
try {
|
||||
doTest(inlineDef);
|
||||
|
||||
@@ -299,6 +299,7 @@ public class CommonCodeStyleSettings {
|
||||
public boolean ALIGN_MULTILINE_ASSIGNMENT = false;
|
||||
public boolean ALIGN_MULTILINE_TERNARY_OPERATION = false;
|
||||
public boolean ALIGN_MULTILINE_THROWS_LIST = false;
|
||||
public boolean ALIGN_THROWS_KEYWORD = false;
|
||||
|
||||
public boolean ALIGN_MULTILINE_EXTENDS_LIST = false;
|
||||
public boolean ALIGN_MULTILINE_METHOD_BRACKETS = false;
|
||||
|
||||
+1
@@ -49,6 +49,7 @@ public class WrappingAndBracesPanel extends OptionTableWithPreviewPanel {
|
||||
|
||||
addOption("THROWS_LIST_WRAP", WRAPPING_THROWS_LIST, WRAP_OPTIONS, WRAP_VALUES);
|
||||
addOption("ALIGN_MULTILINE_THROWS_LIST", ApplicationBundle.message("wrapping.align.when.multiline"), WRAPPING_THROWS_LIST);
|
||||
addOption("ALIGN_THROWS_KEYWORD", ApplicationBundle.message("wrapping.align.throws.keyword"), WRAPPING_THROWS_LIST);
|
||||
addOption("THROWS_KEYWORD_WRAP", WRAPPING_THROWS_KEYWORD, WRAP_OPTIONS_FOR_SINGLETON, WRAP_VALUES_FOR_SINGLETON);
|
||||
|
||||
addOption("METHOD_PARAMETERS_WRAP", WRAPPING_METHOD_PARAMETERS, WRAP_OPTIONS, WRAP_VALUES);
|
||||
|
||||
+25
@@ -47,6 +47,7 @@ public class ScriptingLibraryMappings extends LanguagePerFileMappings<ScriptingL
|
||||
private final ScriptingLibraryManager myLibraryManager;
|
||||
private final Map<VirtualFile, CompoundLibrary> myCompoundLibMap = new HashMap<VirtualFile, CompoundLibrary>();
|
||||
private CompoundLibrary myProjectLibs = new CompoundLibrary();
|
||||
private Set<VirtualFile> myProjectLibFiles;
|
||||
|
||||
public ScriptingLibraryMappings(final Project project, final LibraryType libraryType) {
|
||||
super(project);
|
||||
@@ -95,6 +96,7 @@ public class ScriptingLibraryMappings extends LanguagePerFileMappings<ScriptingL
|
||||
public void setMappings(Map<VirtualFile, ScriptingLibraryTable.LibraryModel> mappings) {
|
||||
super.setMappings(mappings);
|
||||
updateDependencies(mappings);
|
||||
updateProjectLibraryFiles();
|
||||
}
|
||||
|
||||
private static boolean dependencyExists(ModuleRootManager rootManager, Library library) {
|
||||
@@ -171,6 +173,7 @@ public class ScriptingLibraryMappings extends LanguagePerFileMappings<ScriptingL
|
||||
setMapping(file, container);
|
||||
}
|
||||
updateDependencies(getMappings());
|
||||
updateProjectLibraryFiles();
|
||||
}
|
||||
|
||||
public boolean isAssociatedWith(VirtualFile file, String libName) {
|
||||
@@ -401,5 +404,27 @@ public class ScriptingLibraryMappings extends LanguagePerFileMappings<ScriptingL
|
||||
return isApplicable(libFile, srcFile.getParent());
|
||||
}
|
||||
|
||||
private void updateProjectLibraryFiles() {
|
||||
myProjectLibFiles = new HashSet<VirtualFile>();
|
||||
for (CompoundLibrary container : myCompoundLibMap.values()) {
|
||||
for (ScriptingLibraryTable.LibraryModel libModel : container.getLibraries()) {
|
||||
myProjectLibFiles.addAll(Arrays.asList(libModel.getSourceFiles()));
|
||||
myProjectLibFiles.addAll(Arrays.asList(libModel.getCompactFiles()));
|
||||
}
|
||||
}
|
||||
for (ScriptingLibraryTable.LibraryModel libModel : myProjectLibs.getLibraries()) {
|
||||
myProjectLibFiles.addAll(Arrays.asList(libModel.getSourceFiles()));
|
||||
myProjectLibFiles.addAll(Arrays.asList(libModel.getCompactFiles()));
|
||||
}
|
||||
}
|
||||
|
||||
public Set<VirtualFile> getProjectLibraryFiles() {
|
||||
if (myProjectLibFiles == null) {
|
||||
updateProjectLibraryFiles();
|
||||
}
|
||||
return myProjectLibFiles;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+4
-9
@@ -30,7 +30,7 @@ public class ScriptingLibrariesScope extends GlobalSearchScope {
|
||||
|
||||
private GlobalSearchScope myBaseScope;
|
||||
private ScriptingIndexableSetContributor myContributor;
|
||||
private Set<VirtualFile> myLibraryFiles;
|
||||
protected Set<VirtualFile> myLibraryFiles;
|
||||
|
||||
public ScriptingLibrariesScope(GlobalSearchScope baseScope, Class<? extends IndexableSetContributor> providerClass) {
|
||||
super(baseScope.getProject());
|
||||
@@ -38,21 +38,16 @@ public class ScriptingLibrariesScope extends GlobalSearchScope {
|
||||
IndexableSetContributor contributor = IndexableSetContributor.EP_NAME.findExtension(providerClass);
|
||||
if (contributor instanceof ScriptingIndexableSetContributor) {
|
||||
myContributor = (ScriptingIndexableSetContributor)contributor;
|
||||
updateLibraryFiles();
|
||||
setLibraryFiles();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLibraryFiles() {
|
||||
public void setLibraryFiles() {
|
||||
myLibraryFiles = myContributor.getLibraryFiles(myBaseScope.getProject());
|
||||
}
|
||||
|
||||
public boolean contains(VirtualFile file) {
|
||||
return myBaseScope.contains(file) | contributorContains(file);
|
||||
}
|
||||
|
||||
private boolean contributorContains(VirtualFile file) {
|
||||
if (myContributor == null) return false;
|
||||
return myLibraryFiles.contains(file);
|
||||
return myBaseScope.contains(file) | (myLibraryFiles == null ? false : myLibraryFiles.contains(file));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1015,7 +1015,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
charWidth = EditorUtil.charWidth(c, fontType, this);
|
||||
}
|
||||
|
||||
if (charWidth <= 0) {
|
||||
if (charWidth < 0) {
|
||||
charWidth = spaceSize;
|
||||
}
|
||||
|
||||
|
||||
+21
-1
@@ -311,7 +311,13 @@ public class SelectionModelImpl implements SelectionModel, PrioritizedDocumentLi
|
||||
|
||||
FoldRegion endFold = foldingModel.getCollapsedRegionAtOffset(endOffset);
|
||||
if (endFold != null) {
|
||||
endOffset = endFold.getEndOffset();
|
||||
VisualPosition visualFoldStart = myEditor.offsetToVisualPosition(endFold.getStartOffset());
|
||||
// All visual positions that lay at collapsed fold region placeholder are mapped to the same offset. Hence, there are
|
||||
// at least two distinct situations - selection end is located inside collapsed fold region placeholder and just before it.
|
||||
// We want to expand selection to the fold region end at the former case and keep selection as-is at the latest one.
|
||||
if (visualFoldStart.column < endPosition.column) {
|
||||
endOffset = endFold.getEndOffset();
|
||||
}
|
||||
}
|
||||
|
||||
int oldSelectionStart;
|
||||
@@ -583,6 +589,20 @@ public class SelectionModelImpl implements SelectionModel, PrioritizedDocumentLi
|
||||
if (marker != null) {
|
||||
int startOffset = marker.getStartOffset();
|
||||
int endOffset = marker.getEndOffset();
|
||||
if (caretOffset != startOffset && caretOffset != endOffset) {
|
||||
// Try to check if current selection is tweaked by fold region.
|
||||
FoldingModelEx foldingModel = myEditor.getFoldingModel();
|
||||
FoldRegion foldRegion = foldingModel.getCollapsedRegionAtOffset(caretOffset);
|
||||
if (foldRegion != null) {
|
||||
if (foldRegion.getStartOffset() == startOffset) {
|
||||
return endOffset;
|
||||
}
|
||||
else if (foldRegion.getEndOffset() == endOffset) {
|
||||
return startOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caretOffset == endOffset) {
|
||||
return startOffset;
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ wrapping.extends.implements.list=Extends/implements list
|
||||
wrapping.extends.implements.keyword=Extends/implements keyword
|
||||
wrapping.throws.list=Throws list
|
||||
wrapping.throws.keyword=Throws keyword
|
||||
wrapping.align.throws.keyword=Align 'throws' to method start
|
||||
wrapping.ternary.operation=Ternary operation
|
||||
wrapping.assignment.variables.groups=Fields/variables groups
|
||||
wrapping.assignment.statement=Assignment statement
|
||||
|
||||
+4
-2
@@ -24,6 +24,7 @@ import com.intellij.lang.documentation.CodeDocumentationProvider;
|
||||
import com.intellij.lang.documentation.ExternalDocumentationProvider;
|
||||
import com.intellij.lang.java.JavaDocumentationProvider;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.javadoc.PsiDocParamRef;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
@@ -162,7 +163,8 @@ public class GroovyDocumentationProvider implements CodeDocumentationProvider, E
|
||||
if (originalElement instanceof GrReferenceExpression) {
|
||||
final PsiType inferredType = ((GrReferenceExpression)originalElement).getType();
|
||||
if (inferredType != null) {
|
||||
buffer.append("[inferred type] ").append(inferredType.getCanonicalText());
|
||||
buffer.append("[inferred type] ");
|
||||
appendTypeString(buffer, inferredType);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +258,7 @@ public class GroovyDocumentationProvider implements CodeDocumentationProvider, E
|
||||
|
||||
private static void appendTypeString(StringBuffer buffer, PsiType type) {
|
||||
if (type != null) {
|
||||
buffer.append(type.getCanonicalText());
|
||||
buffer.append(StringUtil.escapeXml(type.getCanonicalText()));
|
||||
}
|
||||
else {
|
||||
buffer.append(GrModifier.DEF);
|
||||
|
||||
@@ -33,8 +33,7 @@ import com.intellij.xml.util.XmlTagUtil;
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class XMLExternalAnnotator implements ExternalAnnotator, Validator.ValidationHost {
|
||||
private AnnotationHolder myHolder;
|
||||
public class XMLExternalAnnotator implements ExternalAnnotator {
|
||||
|
||||
public void annotate(PsiFile file, AnnotationHolder holder) {
|
||||
if (!(file instanceof XmlFile)) return;
|
||||
@@ -44,64 +43,68 @@ public class XMLExternalAnnotator implements ExternalAnnotator, Validator.Valida
|
||||
XmlNSDescriptor nsDescriptor = rootTag == null ? null : rootTag.getNSDescriptor(rootTag.getNamespace(), false);
|
||||
|
||||
if (nsDescriptor instanceof Validator && !HtmlUtil.isHtml5Document(document)) {
|
||||
myHolder = holder;
|
||||
try {
|
||||
//noinspection unchecked
|
||||
((Validator<XmlDocument>)nsDescriptor).validate(document, this);
|
||||
}
|
||||
finally {
|
||||
myHolder = null;
|
||||
}
|
||||
((Validator<XmlDocument>)nsDescriptor).validate(document, new MyHost(holder));
|
||||
}
|
||||
}
|
||||
|
||||
private static final ErrorType[] types = ErrorType.values();
|
||||
|
||||
public void addMessage(PsiElement context, String message, int type) {
|
||||
addMessage(context, message, types[type]);
|
||||
}
|
||||
|
||||
public void addMessage(final PsiElement context, final String message, final ErrorType type, final IntentionAction... fixes) {
|
||||
if (message != null && message.length() > 0) {
|
||||
if (context instanceof XmlTag) {
|
||||
addMessagesForTag((XmlTag)context, message, type, fixes);
|
||||
}
|
||||
else {
|
||||
if (type == Validator.ValidationHost.ErrorType.ERROR) {
|
||||
appendFixes(myHolder.createErrorAnnotation(context, message), fixes);
|
||||
} else {
|
||||
appendFixes(myHolder.createWarningAnnotation(context, message), fixes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addMessagesForTag(XmlTag tag, String message, ErrorType type, IntentionAction... actions) {
|
||||
XmlToken childByRole = XmlTagUtil.getStartTagNameElement(tag);
|
||||
|
||||
addMessagesForTreeChild(childByRole, type, message, actions);
|
||||
|
||||
childByRole = XmlTagUtil.getEndTagNameElement(tag);
|
||||
addMessagesForTreeChild(childByRole, type, message, actions);
|
||||
}
|
||||
|
||||
private void addMessagesForTreeChild(final XmlToken childByRole, final ErrorType type, final String message, IntentionAction... actions) {
|
||||
if (childByRole != null) {
|
||||
Annotation annotation;
|
||||
if (type == ErrorType.ERROR) {
|
||||
annotation = myHolder.createErrorAnnotation(childByRole, message);
|
||||
}
|
||||
else {
|
||||
annotation = myHolder.createWarningAnnotation(childByRole, message);
|
||||
}
|
||||
|
||||
appendFixes(annotation, actions);
|
||||
}
|
||||
}
|
||||
private static final Validator.ValidationHost.ErrorType[] types = Validator.ValidationHost.ErrorType.values();
|
||||
|
||||
private static void appendFixes(final Annotation annotation, final IntentionAction... actions) {
|
||||
if (actions != null) {
|
||||
for(IntentionAction action:actions) annotation.registerFix(action);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyHost implements Validator.ValidationHost {
|
||||
|
||||
private final AnnotationHolder myHolder;
|
||||
|
||||
public MyHost(AnnotationHolder holder) {
|
||||
|
||||
myHolder = holder;
|
||||
}
|
||||
|
||||
public void addMessage(PsiElement context, String message, int type) {
|
||||
addMessage(context, message, types[type]);
|
||||
}
|
||||
|
||||
public void addMessage(final PsiElement context, final String message, final ErrorType type, final IntentionAction... fixes) {
|
||||
if (message != null && message.length() > 0) {
|
||||
if (context instanceof XmlTag) {
|
||||
addMessagesForTag((XmlTag)context, message, type, fixes);
|
||||
}
|
||||
else {
|
||||
if (type == Validator.ValidationHost.ErrorType.ERROR) {
|
||||
appendFixes(myHolder.createErrorAnnotation(context, message), fixes);
|
||||
} else {
|
||||
appendFixes(myHolder.createWarningAnnotation(context, message), fixes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addMessagesForTag(XmlTag tag, String message, ErrorType type, IntentionAction... actions) {
|
||||
XmlToken childByRole = XmlTagUtil.getStartTagNameElement(tag);
|
||||
|
||||
addMessagesForTreeChild(childByRole, type, message, actions);
|
||||
|
||||
childByRole = XmlTagUtil.getEndTagNameElement(tag);
|
||||
addMessagesForTreeChild(childByRole, type, message, actions);
|
||||
}
|
||||
|
||||
private void addMessagesForTreeChild(final XmlToken childByRole, final ErrorType type, final String message, IntentionAction... actions) {
|
||||
if (childByRole != null) {
|
||||
Annotation annotation;
|
||||
if (type == ErrorType.ERROR) {
|
||||
annotation = myHolder.createErrorAnnotation(childByRole, message);
|
||||
}
|
||||
else {
|
||||
annotation = myHolder.createWarningAnnotation(childByRole, message);
|
||||
}
|
||||
|
||||
appendFixes(annotation, actions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.intellij.psi.ResolveState;
|
||||
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceUtil;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.PsiElementProcessor;
|
||||
import com.intellij.psi.util.CachedValue;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.xml.*;
|
||||
import com.intellij.xml.XmlElementDescriptor;
|
||||
import com.intellij.xml.util.HtmlUtil;
|
||||
@@ -35,7 +37,7 @@ import java.util.List;
|
||||
* @author Maxim.Mossienko
|
||||
*/
|
||||
public class ScriptSupportUtil {
|
||||
private static final Key<XmlTag[]> CachedScriptTagsKey = Key.create("script tags");
|
||||
private static final Key<CachedValue<XmlTag[]>> CachedScriptTagsKey = Key.create("script tags");
|
||||
private static final ThreadLocal<String> ProcessingDeclarationsFlag = new ThreadLocal<String>();
|
||||
private static final @NonNls String SCRIPT_TAG = "script";
|
||||
|
||||
@@ -46,61 +48,71 @@ public class ScriptSupportUtil {
|
||||
element.putUserData(CachedScriptTagsKey,null);
|
||||
}
|
||||
|
||||
public static boolean processDeclarations(XmlFile element, PsiScopeProcessor processor, ResolveState state, PsiElement lastParent, PsiElement place) {
|
||||
XmlTag[] myCachedScriptTags = element.getUserData(CachedScriptTagsKey);
|
||||
|
||||
public static boolean processDeclarations(final XmlFile element,
|
||||
PsiScopeProcessor processor,
|
||||
ResolveState state,
|
||||
PsiElement lastParent,
|
||||
PsiElement place) {
|
||||
CachedValue<XmlTag[]> myCachedScriptTags = element.getUserData(CachedScriptTagsKey);
|
||||
if (myCachedScriptTags == null) {
|
||||
final List<XmlTag> scriptTags = new ArrayList<XmlTag>();
|
||||
final XmlDocument document = HtmlUtil.getRealXmlDocument(element.getDocument());
|
||||
myCachedScriptTags = element.getManager().getCachedValuesManager().createCachedValue(new CachedValueProvider<XmlTag[]>() {
|
||||
@Override
|
||||
public Result<XmlTag[]> compute() {
|
||||
final List<XmlTag> scriptTags = new ArrayList<XmlTag>();
|
||||
final XmlDocument document = HtmlUtil.getRealXmlDocument(element.getDocument());
|
||||
|
||||
if (document != null) {
|
||||
XmlUtil.processXmlElements(document,
|
||||
new PsiElementProcessor() {
|
||||
public boolean execute(final PsiElement element) {
|
||||
if (element instanceof XmlTag) {
|
||||
final XmlTag tag = (XmlTag)element;
|
||||
if (document != null) {
|
||||
PsiElementProcessor psiElementProcessor = new PsiElementProcessor() {
|
||||
public boolean execute(final PsiElement element) {
|
||||
if (element instanceof XmlTag) {
|
||||
final XmlTag tag = (XmlTag)element;
|
||||
|
||||
if (SCRIPT_TAG.equalsIgnoreCase(tag.getName())) {
|
||||
final XmlElementDescriptor descriptor = tag.getDescriptor();
|
||||
if (descriptor != null && SCRIPT_TAG.equals(descriptor.getName())) {
|
||||
scriptTags.add(tag);
|
||||
if (SCRIPT_TAG.equalsIgnoreCase(tag.getName())) {
|
||||
final XmlElementDescriptor descriptor = tag.getDescriptor();
|
||||
if (descriptor != null && SCRIPT_TAG.equals(descriptor.getName())) {
|
||||
scriptTags.add(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
XmlUtil.processXmlElements(document,psiElementProcessor, true);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
myCachedScriptTags = scriptTags.toArray(new XmlTag[scriptTags.size()]);
|
||||
return new Result<XmlTag[]>(scriptTags.toArray(new XmlTag[scriptTags.size()]), element);
|
||||
}
|
||||
}, false);
|
||||
element.putUserData(CachedScriptTagsKey, myCachedScriptTags);
|
||||
}
|
||||
|
||||
if (ProcessingDeclarationsFlag.get() != null) return true;
|
||||
|
||||
|
||||
try {
|
||||
ProcessingDeclarationsFlag.set("");
|
||||
|
||||
for (XmlTag tag : myCachedScriptTags) {
|
||||
for (XmlTag tag : myCachedScriptTags.getValue()) {
|
||||
final XmlTagChild[] children = tag.getValue().getChildren();
|
||||
for (XmlTagChild child : children) {
|
||||
if (!child.processDeclarations(processor, state, null, place)) return false;
|
||||
}
|
||||
|
||||
if(tag.getAttributeValue("src") != null) {
|
||||
if (tag.getAttributeValue("src") != null) {
|
||||
final XmlAttribute attribute = tag.getAttribute("src", null);
|
||||
|
||||
if (attribute != null) {
|
||||
final PsiFile psiFile = FileReferenceUtil.findFile(attribute.getValueElement());
|
||||
|
||||
if (psiFile != null && psiFile.isValid()) {
|
||||
if(!psiFile.processDeclarations(processor, state, null, place))
|
||||
if (!psiFile.processDeclarations(processor, state, null, place)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
ProcessingDeclarationsFlag.set(null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user