diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java index 91f53fdd8813..d1d227c8b9f2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java @@ -414,7 +414,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { HighlightInfo highlightInfo = suggestionsToMakeFieldUsed(field, identifier, message); if (!field.hasInitializer()) { - QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field), null); + QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field)); } return highlightInfo; } @@ -434,7 +434,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { final HighlightInfo info = createUnusedSymbolInfo(identifier, message, HighlightInfoType.UNUSED_SYMBOL); QuickFixAction.registerQuickFixAction(info, new CreateGetterOrSetterFix(false, true, field), myUnusedSymbolKey); - QuickFixAction.registerQuickFixAction(info, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field), null); + QuickFixAction.registerQuickFixAction(info, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field)); SpecialAnnotationsUtil.createAddToSpecialAnnotationFixes(field, new Processor() { @Override public boolean process(final String annoName) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java index b36c101d74b5..fd57237a8a6e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java @@ -287,7 +287,7 @@ public class HighlightControlFlowUtil { String description = JavaErrorMessages.message("variable.not.initialized", field.getName()); TextRange range = HighlightNamesUtil.getFieldDeclarationTextRange(field); final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, range.getStartOffset(), range.getEndOffset(), description); - QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field), null); + QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field), new CreateConstructorParameterFromFieldFix(field)); final PsiClass containingClass = field.getContainingClass(); if (containingClass != null && !containingClass.isInterface()) { IntentionAction fix = QUICK_FIX_FACTORY.createModifierListFix(field, PsiModifier.FINAL, false, false); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java index 0c0bf04ff2f5..72329e551a56 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java @@ -359,9 +359,9 @@ public class HighlightMethodUtil { } else { TextRange range = getFixRange(methodCall); - QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreateMethodFromUsageFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreateAbstractMethodFromUsageFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreatePropertyFromUsageFix(methodCall), null); + QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreateMethodFromUsageFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreateAbstractMethodFromUsageFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, range, new CreatePropertyFromUsageFix(methodCall)); } } } @@ -487,11 +487,11 @@ public class HighlightMethodUtil { PsiMethodCallExpression methodCall, PsiExpressionList list, PsiResolveHelper resolveHelper) { TextRange fixRange = getFixRange(methodCall); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateMethodFromUsageFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateAbstractMethodFromUsageFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateConstructorFromSuperFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateConstructorFromThisFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreatePropertyFromUsageFix(methodCall), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateMethodFromUsageFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateAbstractMethodFromUsageFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateConstructorFromSuperFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreateConstructorFromThisFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new CreatePropertyFromUsageFix(methodCall)); CandidateInfo[] methodCandidates = resolveHelper.getReferencedMethodCandidates(methodCall, false); CastMethodArgumentFix.REGISTRAR.registerCastActions(methodCandidates, methodCall, highlightInfo, fixRange); PermuteArgumentsFix.registerFix(highlightInfo, methodCall, methodCandidates, fixRange); @@ -502,11 +502,11 @@ public class HighlightMethodUtil { WrapExpressionFix.registerWrapAction(methodCandidates, list.getExpressions(), highlightInfo); ChangeParameterClassFix.registerQuickFixActions(methodCall, list, highlightInfo); if (methodCandidates.length == 0) { - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new StaticImportMethodFix(methodCall), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new StaticImportMethodFix(methodCall)); } VariableTypeFromCallFix.registerQuickFixActions(methodCall, list, highlightInfo); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ReplaceAddAllArrayToCollectionFix(methodCall), null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new SurroundWithArrayFix(methodCall), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ReplaceAddAllArrayToCollectionFix(methodCall)); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new SurroundWithArrayFix(methodCall)); QualifyThisArgumentFix.registerQuickFixAction(methodCandidates, methodCall, highlightInfo, fixRange); CandidateInfo[] candidates = resolveHelper.getReferencedMethodCandidates(methodCall, true); @@ -1209,7 +1209,7 @@ public class HighlightMethodUtil { String description = JavaErrorMessages.message("wrong.constructor.arguments", constructorName+"()", argTypes); String tooltip = createMismatchedArgumentsHtmlTooltip(list, PsiParameter.EMPTY_ARRAY, constructorName, PsiSubstitutor.EMPTY, aClass); HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, list, description, tooltip); - QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall), null); + QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall)); if (classReference != null) { ConstructorParametersFixer.registerFixActions(classReference, constructorCall, info,getFixRange(list)); } @@ -1247,7 +1247,7 @@ public class HighlightMethodUtil { name += buildArgTypesList(list); String description = JavaErrorMessages.message("cannot.resolve.constructor", name); HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, list, description, XmlStringUtil.escapeString(description)); - QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall), null); + QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall)); if (classReference != null) { ConstructorParametersFixer.registerFixActions(classReference, constructorCall, info,getFixRange(list)); PermuteArgumentsFix.registerFix(info, constructorCall, toMethodCandidates(results), getFixRange(list)); @@ -1270,14 +1270,14 @@ public class HighlightMethodUtil { String toolTip = createMismatchedArgumentsHtmlTooltip(result, list); PsiElement infoElement = list.getTextLength() > 0 ? list : constructorCall; HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, infoElement, description, toolTip); - QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall), null); + QuickFixAction.registerQuickFixAction(info, constructorCall.getTextRange(), new CreateConstructorFromCallFix(constructorCall)); if (classReference != null) { ConstructorParametersFixer.registerFixActions(classReference, constructorCall, info, getFixRange(infoElement)); ChangeMethodSignatureFromUsageFix.registerIntentions(results, list, info, null); ConvertDoubleToFloatFix.registerIntentions(results, list, info, null); PermuteArgumentsFix.registerFix(info, constructorCall, toMethodCandidates(results), getFixRange(list)); ChangeParameterClassFix.registerQuickFixActions(constructorCall, list, info); - QuickFixAction.registerQuickFixAction(info, getFixRange(list), new SurroundWithArrayFix(constructorCall), null); + QuickFixAction.registerQuickFixAction(info, getFixRange(list), new SurroundWithArrayFix(constructorCall)); } info.navigationShift = +1; holder.add(info); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index fb0f18254196..99483109d7c4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -288,7 +288,7 @@ public class HighlightUtil { if (ref != null) { fixRange = fixRange.union(ref.getTextRange()); } - QuickFixAction.registerQuickFixAction(errorResult, fixRange, fix, null); + QuickFixAction.registerQuickFixAction(errorResult, fixRange, fix); } } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java index f1392ed12460..4457e5d47c40 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java @@ -145,7 +145,7 @@ public class AddTypeArgumentsConditionalFix implements IntentionAction { if (substitutedType != null && TypeConversionUtil.isAssignable(lType, substitutedType)) { QuickFixAction.registerQuickFixAction(highlightInfo, thenExpression.getTextRange(), - new AddTypeArgumentsConditionalFix(substitutor, (PsiMethodCallExpression)thenExpression, method), null); + new AddTypeArgumentsConditionalFix(substitutor, (PsiMethodCallExpression)thenExpression, method)); } } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ArgumentFixerActionFactory.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ArgumentFixerActionFactory.java index 2a2faab25642..76bf6ae59e1b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ArgumentFixerActionFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ArgumentFixerActionFactory.java @@ -99,7 +99,7 @@ public abstract class ArgumentFixerActionFactory { JavaResolveResult resolveResult = newCall.resolveMethodGenerics(); if (resolveResult.getElement() != null && resolveResult.isValidResult()) { suggestedCasts.add(parameterType.getCanonicalText()); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, createFix(list, i, parameterType),null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, createFix(list, i, parameterType)); } } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java index 4edcb73e9726..1aef4d76d167 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeMethodSignatureFromUsageFix.java @@ -479,8 +479,8 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction, HighP PsiSubstitutor substitutor = candidate.getSubstitutor(); if (method != null && context.getManager().isInProject(method)) { ChangeMethodSignatureFromUsageFix fix = new ChangeMethodSignatureFromUsageFix(method, expressions, substitutor, context, false, 2); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, fix, null); - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ChangeMethodSignatureFromUsageReverseOrderFix(method, expressions, substitutor, context, false, 2), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, fix); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ChangeMethodSignatureFromUsageReverseOrderFix(method, expressions, substitutor, context, false, 2)); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConvertDoubleToFloatFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConvertDoubleToFloatFix.java index f23d99ba2d88..0b5d26e71334 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConvertDoubleToFloatFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ConvertDoubleToFloatFix.java @@ -105,7 +105,7 @@ public class ConvertDoubleToFloatFix implements IntentionAction { PsiParameter parameter = parameters[i]; final PsiExpression expression = expressions[i]; if (expression instanceof PsiLiteralExpression && PsiType.FLOAT.equals(parameter.getType()) && PsiType.DOUBLE.equals(expression.getType())) { - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ConvertDoubleToFloatFix(expression), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new ConvertDoubleToFloatFix(expression)); } } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/PermuteArgumentsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/PermuteArgumentsFix.java index 2ca479214bcc..bbc308939257 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/PermuteArgumentsFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/PermuteArgumentsFix.java @@ -114,7 +114,7 @@ public class PermuteArgumentsFix implements IntentionAction { } if (permutations.size() == 1) { PermuteArgumentsFix fix = new PermuteArgumentsFix(callExpression, permutations.get(0)); - QuickFixAction.registerQuickFixAction(info, fixRange, fix, null); + QuickFixAction.registerQuickFixAction(info, fixRange, fix); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java index a5cfce5dd068..bb54763bbd0e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java @@ -111,7 +111,7 @@ public class QualifyThisArgumentFix extends PsiElementBaseIntentionAction { if (!TypeConversionUtil.isAssignable(parameterType, exprType)) { final PsiClass psiClass = PsiUtil.resolveClassInClassTypeOnly(parameterType); if (psiClass != null && containingClasses.contains(psiClass)) { - QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new QualifyThisArgumentFix((PsiThisExpression)expression, psiClass), null); + QuickFixAction.registerQuickFixAction(highlightInfo, fixRange, new QualifyThisArgumentFix((PsiThisExpression)expression, psiClass)); } } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapExpressionFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapExpressionFix.java index 36fc33f602a0..e03214da210f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapExpressionFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/WrapExpressionFix.java @@ -158,7 +158,7 @@ public class WrapExpressionFix implements IntentionAction { } if (expectedType != null) { - QuickFixAction.registerQuickFixAction(highlightInfo, expr.getTextRange(), new WrapExpressionFix(expectedType, expr), null); + QuickFixAction.registerQuickFixAction(highlightInfo, expr.getTextRange(), new WrapExpressionFix(expectedType, expr)); } } diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index 5a00b75a97f0..7a1b3d99a552 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -373,6 +373,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool { @Override public void visitClass(RefClass aClass) { final PsiClass psiClass = aClass.getElement(); + if (psiClass == null) return; if ( isAddAppletEnabled() && aClass.isApplet() || isAddServletEnabled() && aClass.isServlet()) { diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass.log b/java/java-tests/testData/compileServer/incremental/common/addClass.log new file mode 100644 index 000000000000..5aaf6b1395b6 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass.log @@ -0,0 +1,9 @@ +Compiling files: +src/Util.java +End of files +Cleaning output files: +out/production/addClass/Client.class +End of files +Compiling files: +src/Client.java +End of files diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/.name b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/.name new file mode 100644 index 000000000000..d13bc4b0b367 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/.name @@ -0,0 +1 @@ +addClass \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/ant.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/ant.xml new file mode 100644 index 000000000000..2581ca3fe84c --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/ant.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/compiler.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/compiler.xml new file mode 100644 index 000000000000..a1b41c52c724 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/copyright/profiles_settings.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/copyright/profiles_settings.xml new file mode 100644 index 000000000000..3572571ad83c --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/encodings.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/encodings.xml new file mode 100644 index 000000000000..e206d70d8595 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/misc.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/misc.xml new file mode 100644 index 000000000000..9a249d2930c5 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + http://www.w3.org/1999/xhtml + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/modules.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/modules.xml new file mode 100644 index 000000000000..ecefc643826b --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/scopes/scope_settings.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000000..922003b8433b --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/uiDesigner.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/uiDesigner.xml new file mode 100644 index 000000000000..3b0002030884 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/vcs.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/vcs.xml new file mode 100644 index 000000000000..def6a6a18457 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/workspace.xml b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/workspace.xml new file mode 100644 index 000000000000..1ce5e7bc1f83 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/.idea/workspace.xml @@ -0,0 +1,559 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + + 1334130093404 + 1334130093404 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No facets are configured + + + + + + + + Gant + + + + + + + + IDEA jdk + + + + + + + + addClass + + + + + + + + IDEA jdk + + + + + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/Util.java.new b/java/java-tests/testData/compileServer/incremental/common/addClass/Util.java.new new file mode 100644 index 000000000000..1141151cae45 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/Util.java.new @@ -0,0 +1,5 @@ +public class Util { + public static void foo (int x) { + + } +} \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/addClass.iml b/java/java-tests/testData/compileServer/incremental/common/addClass/addClass.iml new file mode 100644 index 000000000000..0898b5451031 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/addClass.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/common/common.iml b/java/java-tests/testData/compileServer/incremental/common/addClass/common/common.iml new file mode 100644 index 000000000000..d5c074327501 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/common/common.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/common/src/Util.java b/java/java-tests/testData/compileServer/incremental/common/addClass/common/src/Util.java new file mode 100644 index 000000000000..ce35affc1568 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/common/src/Util.java @@ -0,0 +1,12 @@ +/** + * Created with IntelliJ IDEA. + * User: db + * Date: 11.04.12 + * Time: 11:43 + * To change this template use File | Settings | File Templates. + */ +public class Util { + public static void foo () { + + } +} diff --git a/java/java-tests/testData/compileServer/incremental/common/addClass/src/Client.java b/java/java-tests/testData/compileServer/incremental/common/addClass/src/Client.java new file mode 100644 index 000000000000..04b7ad769077 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/common/addClass/src/Client.java @@ -0,0 +1,12 @@ +/** + * Created with IntelliJ IDEA. + * User: db + * Date: 11.04.12 + * Time: 11:43 + * To change this template use File | Settings | File Templates. + */ +public class Client { + { + Util.foo(); + } +} diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/CommonTest.java b/jps/jps-builders/testSrc/org/jetbrains/ether/CommonTest.java index 6d9596c3b71c..9a36f6d40ee7 100644 --- a/jps/jps-builders/testSrc/org/jetbrains/ether/CommonTest.java +++ b/jps/jps-builders/testSrc/org/jetbrains/ether/CommonTest.java @@ -77,6 +77,10 @@ public class CommonTest extends IncrementalTestCase { } public void testDeleteClass4() throws Exception { - doTest(); + doTest(); + } + + public void testAddClass() throws Exception { + doTest(); } } diff --git a/jps/src/org/jetbrains/jps/builders/StandardBuilders.groovy b/jps/src/org/jetbrains/jps/builders/StandardBuilders.groovy index 07f6afb6d8f5..8f5e8f5b0671 100644 --- a/jps/src/org/jetbrains/jps/builders/StandardBuilders.groovy +++ b/jps/src/org/jetbrains/jps/builders/StandardBuilders.groovy @@ -4,7 +4,6 @@ import com.intellij.ant.InstrumentationUtil import com.intellij.ant.InstrumentationUtil.FormInstrumenter import com.intellij.ant.PrefixedPath import com.intellij.compiler.instrumentation.InstrumentationClassFinder -import org.jetbrains.jps.builders.javacApi.Java16ApiCompilerRunner import org.jetbrains.jps.* /** @@ -26,17 +25,6 @@ class JavacBuilder implements ModuleBuilder, ModuleCycleBuilder { String sourceLevel = module.languageLevel String targetLevel = module.languageLevel String customArgs = module["javac_args"]; // it seems javac_args property is not set, can we drop it? - if (projectBuilder.useInProcessJavac) { - String version = System.getProperty("java.version") - if (true) { - if (Java16ApiCompilerRunner.compile(module, projectBuilder, state, sourceLevel, targetLevel, customArgs)) { - return - } - } - else { - projectBuilder.info("In-process Javac won't be used for '${module.name}', because Java version ($version) doesn't match to source level ($sourceLevel)") - } - } def params = [:] params.destdir = state.targetFolder diff --git a/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompiler.groovy b/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompiler.groovy deleted file mode 100644 index b8775dc5320b..000000000000 --- a/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompiler.groovy +++ /dev/null @@ -1,112 +0,0 @@ -package org.jetbrains.jps.builders.javacApi - -import org.jetbrains.jps.ModuleBuildState -import org.jetbrains.jps.ModuleChunk -import org.jetbrains.jps.ProjectBuilder -import org.jetbrains.jps.Sdk -import org.jetbrains.jps.builders.JavaFileCollector - -import javax.tools.JavaCompiler -import javax.tools.JavaCompiler.CompilationTask -import javax.tools.JavaFileObject -import javax.tools.StandardLocation -import javax.tools.ToolProvider - -/** - * @author nik - */ -class Java16ApiCompiler { - private static instance - private OptimizedFileManager fileManager - private JavaCompiler compiler - - static Java16ApiCompiler getInstance() { - if (instance == null) { - instance = new Java16ApiCompiler() - } - return instance - } - - def Java16ApiCompiler() { - compiler = ToolProvider.getSystemJavaCompiler() - fileManager = new OptimizedFileManager(); - } - - def compile(ModuleChunk chunk, ProjectBuilder projectBuilder, ModuleBuildState state, String sourceLevel, String targetLevel, String customArgs) { - List options = [] - - if (customArgs != null) { - options << customArgs - } - - if (sourceLevel != null) { - options << "-source" - options << sourceLevel - } - if (targetLevel != null) { - options << "-target" - options << targetLevel - } - options << "-g" - options << "-nowarn" - - List filesToCompile = [] - - Set excluded = state.excludes.collect { new File(it.toString()) } - state.sourceRoots.each { - JavaFileCollector.collectRecursively(new File(it.toString()), filesToCompile, excluded) - } - - if (filesToCompile.size() > 0) { - fileManager.setLocation(StandardLocation.CLASS_OUTPUT, [new File(state.targetFolder)]) - List classpath = [] - List bootclasspath = [] - StringBuilder cp = new StringBuilder() - - Sdk sdk = chunk.getSdk() - - if (sdk != null) { - sdk.classpath.each { bootclasspath << new File(String.valueOf(it)) } - - fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootclasspath) - } - - state.classpath.each { - classpath << new File(String.valueOf(it)) - cp.append(String.valueOf(it)) - cp.append(File.pathSeparator) - } - - cp.append(state.targetFolder) - - fileManager.setLocation(StandardLocation.CLASS_PATH, classpath) - fileManager.setProperties(state.callback, toURLs(cp.toString())) - - Iterable toCompile = fileManager.getJavaFileObjectsFromFiles(filesToCompile) - StringWriter out = new StringWriter() - CompilationTask task = compiler.getTask(new PrintWriter(out), fileManager, null, options, null, toCompile) - - if (!task.call()) { - projectBuilder.buildInfoPrinter.printCompilationErrors(projectBuilder, "javac", out.toString()) - projectBuilder.error("Compilation failed") - } - else { - System.out.println(out.toString()); - } - projectBuilder.listeners*.onJavaFilesCompiled(chunk, filesToCompile.size()) - } - else { - projectBuilder.info("No java source files found in '${chunk.name}', skipping compilation") - } - } - - private URL[] toURLs(final String classPath) { - final List urls = new ArrayList(); - for (StringTokenizer tokenizer = new StringTokenizer(classPath, File.pathSeparator); tokenizer.hasMoreTokens();) { - final String s = tokenizer.nextToken(); - urls.add(new File(s).toURL()); - } - return (URL[])urls.toArray(new URL[urls.size()]); - } - -} diff --git a/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompilerRunner.groovy b/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompilerRunner.groovy deleted file mode 100644 index 752500f7294a..000000000000 --- a/jps/src/org/jetbrains/jps/builders/javacApi/Java16ApiCompilerRunner.groovy +++ /dev/null @@ -1,34 +0,0 @@ -package org.jetbrains.jps.builders.javacApi - -import org.jetbrains.jps.ModuleBuildState -import org.jetbrains.jps.ModuleChunk -import org.jetbrains.jps.ProjectBuilder - -/** - * @author nik - */ -class Java16ApiCompilerRunner { - private static boolean notAvailable - - static boolean compile(ModuleChunk chunk, ProjectBuilder projectBuilder, ModuleBuildState state, String sourceLevel, String targetLevel, String customArgs) { - if (notAvailable) { - return false - } - - try { - Java16ApiCompiler compiler = Java16ApiCompiler.getInstance() - compiler.compile(chunk, projectBuilder, state, sourceLevel, targetLevel, customArgs) - return true - } - catch (NoClassDefFoundError error) { - projectBuilder.warning("Java 1.6 API compiler is not available") - notAvailable = true - } - catch (Exception e) { - e.printStackTrace() - projectBuilder.warning("Compilation failed with exception for '${chunk.name}'") - throw e - } - return false - } -} diff --git a/jps/src/org/jetbrains/jps/builders/javacApi/OptimizedFileManager.java b/jps/src/org/jetbrains/jps/builders/javacApi/OptimizedFileManager.java deleted file mode 100644 index cd981d9fc2d2..000000000000 --- a/jps/src/org/jetbrains/jps/builders/javacApi/OptimizedFileManager.java +++ /dev/null @@ -1,257 +0,0 @@ -package org.jetbrains.jps.builders.javacApi; - -import com.intellij.ant.InstrumentationUtil; -import com.intellij.compiler.instrumentation.InstrumentationClassFinder; -import com.sun.tools.javac.util.Context; -import com.sun.tools.javac.util.DefaultFileManager; -import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.ListBuffer; -import org.jetbrains.asm4.ClassReader; -import org.jetbrains.ether.dependencyView.Callbacks; -import org.jetbrains.jps.PathUtil; - -import javax.lang.model.SourceVersion; -import javax.tools.*; -import java.io.*; -import java.lang.reflect.Field; -import java.net.URL; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -/** - * @author nik - */ -public class OptimizedFileManager extends DefaultFileManager { - private interface DelayedClassFileWriter { - public void commit() throws IOException; - } - - private java.util.List myWriters = new ArrayList(); - private boolean myUseZipFileIndex; - private final Map myArchives; - private final Map myIsFile = new ConcurrentHashMap(); - private Callbacks.Backend callback; - private InstrumentationClassFinder classFinder; - private Map myCompiledClasses = new HashMap(); - - public void setProperties(final Callbacks.Backend c, final URL[] classpath) { - callback = c; - classFinder = new InstrumentationClassFinder(classpath) { - protected InputStream lookupClassBeforeClasspath(String internalClassName) { - final byte[] bytes = myCompiledClasses.get(internalClassName); - return bytes != null? new ByteArrayInputStream(bytes) : null; - } - }; - } - - public OptimizedFileManager() { - super(new Context(), true, null); - try { - final Field archivesField = DefaultFileManager.class.getDeclaredField("archives"); - archivesField.setAccessible(true); - myArchives = (Map) archivesField.get(this); - } catch (Exception e) { - throw new RuntimeException(e); - } - - try { - final Field useZipFileIndexField = DefaultFileManager.class.getDeclaredField("useZipFileIndex"); - useZipFileIndexField.setAccessible(true); - myUseZipFileIndex = (Boolean) useZipFileIndexField.get(this); - } catch (Exception e) { - myUseZipFileIndex = false; - } - } - - @Override - public Iterable list(Location location, String packageName, Set kinds, boolean recurse) throws IOException { - Iterable path = getLocation(location); - if (path == null) return Collections.emptyList(); - - String relativePath = packageName.replace('.', File.separatorChar); - ListBuffer results = new ListBuffer(); - - for (File root : path) { - Archive archive = myArchives.get(root); - final boolean isFile; - if (archive != null) { - isFile = true; - } else { - Boolean cachedIsFile = myIsFile.get(root); - if (cachedIsFile == null) { - cachedIsFile = root.isFile(); - myIsFile.put(root, cachedIsFile); - } - isFile = cachedIsFile.booleanValue(); - } - if (isFile) { - collectFromArchive(root, archive, relativePath, kinds, recurse, results); - } else { - File directory = relativePath.length() != 0 ? new File(root, relativePath) : root; - collectFromDirectory(directory, kinds, recurse, results); - } - } - - return results.toList(); - } - - private void collectFromArchive(File root, Archive archive, String relativePath, Set kinds, boolean recurse, ListBuffer result) { - if (archive == null) { - try { - archive = openArchive(root); - } catch (IOException ex) { - log.error("error.reading.file", root, ex.getLocalizedMessage()); - return; - } - } - String separator = myUseZipFileIndex ? File.separator : "/"; - if (relativePath.length() != 0) { - if (!myUseZipFileIndex) { - relativePath = relativePath.replace('\\', '/'); - } - if (!relativePath.endsWith(separator)) relativePath = relativePath + separator; - } - - collectArchiveFiles(archive, relativePath, kinds, result); - if (recurse) { - for (String s : archive.getSubdirectories()) { - if (s.startsWith(relativePath) && !s.equals(relativePath)) { - if (!s.endsWith(separator)) { - s += separator; - } - collectArchiveFiles(archive, s, kinds, result); - } - } - } - } - - private void collectFromDirectory(File directory, Set fileKinds, - boolean recurse, ListBuffer result) { - File[] children = directory.listFiles(); - if (children == null) return; - - for (File child : children) { - String name = child.getName(); - if (child.isDirectory()) { - if (recurse && SourceVersion.isIdentifier(name)) { - collectFromDirectory(directory, fileKinds, recurse, result); - } - } else { - if (isValidFile(name, fileKinds)) { - JavaFileObject fe = getRegularFile(child); - result.append(fe); - } - } - } - } - - private void collectArchiveFiles(Archive archive, String relativePath, Set fileKinds, ListBuffer result) { - List files = archive.getFiles(relativePath); - if (files != null) { - for (String file; !files.isEmpty(); files = files.tail) { - file = files.head; - if (isValidFile(file, fileKinds)) { - result.append(archive.getFileObject(relativePath, file)); - } - } - } - } - - private boolean isValidFile(String name, Set fileKinds) { - int dot = name.lastIndexOf("."); - JavaFileObject.Kind kind = getKind(dot == -1 ? name : name.substring(dot)); - return fileKinds.contains(kind); - } - - //actually Javac doesn't check if this method returns null. It always get substring of the returned string starting from the last dot. - @Override - public String inferBinaryName(Location location, JavaFileObject file) { - final String name = file.getName(); - int dot = name.lastIndexOf('.'); - final String relativePath = dot != -1 ? name.substring(0, dot) : name; - return relativePath.replace(File.separatorChar, '.'); - } - - @Override - public JavaFileObject getJavaFileForOutput(Location location, final String className, final JavaFileObject.Kind kind, FileObject fileObject) throws IOException { - final JavaFileObject result = super.getJavaFileForOutput(location, className, kind, fileObject); - final String classFileName = PathUtil.toPath(result.toUri()); - final String sourceFileName = PathUtil.toPath(fileObject.toUri()); - - return new ForwardingJavaFileObject(result) { - private OutputStream superOpenOutputStream() throws IOException { - return super.openOutputStream(); - } - - @Override - public OutputStream openOutputStream() throws IOException { - return new OutputStream() { - public void flush() throws IOException { - } - - public void close() throws IOException { - } - - public void write(int b) throws IOException { - assert (false); - } - - public void write(byte[] b) throws IOException { - assert (false); - } - - public void write(final byte[] b, final int off, final int len) throws IOException { - final byte[] buffer = Arrays.copyOfRange(b, off, len); - - if (kind.equals(JavaFileObject.Kind.CLASS)) { - myCompiledClasses.put(className.replace('.', '/'), buffer); - - if (callback != null) { - final ClassReader reader = new ClassReader(buffer); - callback.associate(classFileName, sourceFileName, reader); - } - - myWriters.add(new DelayedClassFileWriter() { - public void commit() throws IOException { - final OutputStream result = superOpenOutputStream(); - - final byte[] instrumented = InstrumentationUtil.instrumentNotNull(buffer, classFinder); - - if (instrumented != null) { - result.write(instrumented); - } else { - result.write(buffer); - } - - result.close(); - } - }); - } else { - final OutputStream result = superOpenOutputStream(); - result.write(buffer); - result.close(); - } - } - }; - } - }; - } - - @Override - public void flush() { - super.flush(); - - for (DelayedClassFileWriter f : myWriters) { - try { - f.commit(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - myWriters.clear(); - if (classFinder != null) { - classFinder.releaseResources(); - } - } -} diff --git a/platform/lang-api/src/com/intellij/lang/annotation/Annotation.java b/platform/lang-api/src/com/intellij/lang/annotation/Annotation.java index c28abf6312a2..882ad555d758 100644 --- a/platform/lang-api/src/com/intellij/lang/annotation/Annotation.java +++ b/platform/lang-api/src/com/intellij/lang/annotation/Annotation.java @@ -62,8 +62,6 @@ public final class Annotation implements Segment { public final IntentionAction quickFix; public final TextRange textRange; public final List options; - @Deprecated - public final String displayName; public final HighlightDisplayKey key; @Deprecated @@ -71,7 +69,6 @@ public final class Annotation implements Segment { key = null; this.quickFix = quickFix; this.textRange = textRange; - this.displayName = quickFix.getText(); this.options = options; } @@ -79,7 +76,6 @@ public final class Annotation implements Segment { this.key = key; quickFix = fix; textRange = range; - displayName = key != null ? HighlightDisplayKey.getDisplayNameByKey(key) : fix.getText(); options = null; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java index 9f66eb717f2f..000f232fe93a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java @@ -468,11 +468,6 @@ public class HighlightInfo implements Segment { private final String myDisplayName; private final Icon myIcon; - public IntentionActionDescriptor(@NotNull IntentionAction action, final HighlightDisplayKey key) { - this(action, null, HighlightDisplayKey.getDisplayNameByKey(key), null); - myKey = key; - } - public IntentionActionDescriptor(@NotNull IntentionAction action, final List options, final String displayName) { this(action, options, displayName, null); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QuickFixAction.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QuickFixAction.java index ffb3c91d618a..70d351d6092e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QuickFixAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QuickFixAction.java @@ -50,7 +50,7 @@ public final class QuickFixAction { } public static void registerQuickFixAction(HighlightInfo info, IntentionAction action) { - registerQuickFixAction(info, null, action, null); + registerQuickFixAction(info, null, action); } public static void registerQuickFixActions(final HighlightInfo info, final Collection actions) { @@ -59,6 +59,7 @@ public final class QuickFixAction { } } + /** This is used by TeamCity plugin */ @Deprecated public static void registerQuickFixAction(HighlightInfo info, IntentionAction action, List options, String displayName) { doRegister(info, action, options, displayName, null, null); @@ -88,6 +89,10 @@ public final class QuickFixAction { doRegister(info, action, null, HighlightDisplayKey.getDisplayNameByKey(key), fixRange, key); } + public static void registerQuickFixAction(HighlightInfo info, TextRange fixRange, IntentionAction action) { + doRegister(info, action, null, null, fixRange, null); + } + public static void unregisterQuickFixAction(HighlightInfo info, Condition condition) { for (Iterator> it = info.quickFixActionRanges.iterator(); it.hasNext();) { Pair pair = it.next(); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java index 4823bdf64a5c..f24065b8c55f 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java @@ -45,16 +45,13 @@ import org.jetbrains.annotations.NotNull; */ public class RunInspectionIntention implements IntentionAction, HighPriorityAction { private final String myShortName; - private final String myDisplayName; public RunInspectionIntention(final InspectionProfileEntry tool) { myShortName = tool.getShortName(); - myDisplayName = tool.getDisplayName(); } public RunInspectionIntention(final HighlightDisplayKey key) { myShortName = key.toString(); - myDisplayName = HighlightDisplayKey.getDisplayNameByKey(key); } @NotNull diff --git a/platform/platform-api/src/com/intellij/ui/components/FixedColumnsModel.java b/platform/platform-api/src/com/intellij/ui/components/FixedColumnsModel.java new file mode 100644 index 000000000000..dda70558e03b --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/components/FixedColumnsModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.components; + +import javax.swing.*; + +/** + * @author Konstantin Bulenkov + */ +public class FixedColumnsModel extends MultiColumnListModel { + private final int myMaxColumns; + + public FixedColumnsModel(ListModel model, int maxColumns) { + super(model); + myMaxColumns = maxColumns; + } + + @Override + public int getRowCount() { + final int columns = getColumnCount(); + return columns == 0 ? 0 : getSize() / columns + 1; + } + + @Override + public int getColumnCount() { + return Math.min(myMaxColumns, getSize()); + } + + @Override + public int toListIndex(int row, int column) { + final int columns = getColumnCount(); + return columns == 0 ? -1 : row * columns + column; + } +} diff --git a/platform/platform-api/src/com/intellij/ui/components/FixedRowsModel.java b/platform/platform-api/src/com/intellij/ui/components/FixedRowsModel.java new file mode 100644 index 000000000000..45043e514c89 --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/components/FixedRowsModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.components; + +import javax.swing.*; + +/** +* @author Konstantin Bulenkov +*/ +class FixedRowsModel extends MultiColumnListModel { + private final int myMaxRows; + + public FixedRowsModel(ListModel model, int rows) { + super(model); + myMaxRows = rows; + } + + @Override + public int getRowCount() { + return Math.min(myMaxRows, getSize()); + } + + @Override + public int getColumnCount() { + final int rows = getRowCount(); + return rows == 0 ? 0 : getSize() / rows + 1; + } + + @Override + public int toListIndex(int row, int column) { + final int rows = getRowCount(); + return rows == 0 ? -1 : column * rows + row; + } +} diff --git a/platform/platform-api/src/com/intellij/ui/components/MultiColumnList.java b/platform/platform-api/src/com/intellij/ui/components/MultiColumnList.java new file mode 100644 index 000000000000..82a7fef7a469 --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/components/MultiColumnList.java @@ -0,0 +1,162 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.components; + +import javax.swing.*; +import javax.swing.border.Border; +import javax.swing.table.TableCellRenderer; +import java.awt.*; + +/** + * @author Konstantin Bulenkov + */ +public class MultiColumnList extends JTable { + private final ListModel myModel; + private ListCellRenderer myRenderer; + private JList myList; + private Dimension myPrefSize; + + public MultiColumnList(ListModel model) { + super(new FixedRowsModel(model, 25)); + myModel = model; + setRowHeight(20); + setShowGrid(false); + setCellSelectionEnabled(true); + setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + //noinspection UndesirableClassUsage + myList = new JList(model) { + @Override + public void setBorder(Border border) { + super.setBorder(border); + MultiColumnList.this.setBorder(border); + } + + @Override + public void repaint() { + MultiColumnList.this.repaint(); + } + + @Override + public void setCellRenderer(ListCellRenderer cellRenderer) { + super.setCellRenderer(cellRenderer); + if (myRenderer != cellRenderer) { + MultiColumnList.this.setCellRenderer(cellRenderer); + } + } + }; + getColumnModel().setColumnMargin(0); + } + + public MultiColumnList(Object...elements) { + this(createListModel(elements)); + } + + private static ListModel createListModel(Object...elements) { + final DefaultListModel model = new DefaultListModel(); + for (Object element : elements) { + model.addElement(element); + } + + return model; + } + + public void setCellRenderer(ListCellRenderer renderer) { + myRenderer = renderer; + setDefaultRenderer(Object.class, new TableCellRenderer() { + @Override + public Component getTableCellRendererComponent(JTable table, + Object value, + boolean isSelected, + boolean hasFocus, + int row, + int column) { + final int index = getModel().toListIndex(row, column); + if (isSelected) { + myList.addSelectionInterval(index, index); + } else { + myList.removeSelectionInterval(index, index); + } + return myRenderer.getListCellRendererComponent(myList, value, index, isSelected, hasFocus); + } + }); + } + + public void setFixedRowsMode(int maxRows) { + if (maxRows < 1) { + throw new IllegalArgumentException("Should be greater than 0"); + } + + setModel(new FixedRowsModel(myModel, maxRows)); + getModel().fireTableStructureChanged(); + } + + @Override + public MultiColumnListModel getModel() { + return (MultiColumnListModel)super.getModel(); + } + + public void setFixedColumnsMode(int maxColumns) { + if (maxColumns < 1) { + throw new IllegalArgumentException("Should be greater than 0"); + } + + setModel(new FixedColumnsModel(myModel, maxColumns)); + getModel().fireTableStructureChanged(); + } + + public JList getDelegate() { + return myList; + } + + @Override + public Dimension getPreferredSize() { + if (myPrefSize == null) { + Dimension dimension = new Dimension(); + int rowHeight = 0; + for (int column = 0; column < getColumnCount(); column++) { + int columnWidth = 0; + for (int row = 0; row < getRowCount(); row++) { + final TableCellRenderer renderer = getCellRenderer(row, column); + if (renderer != null) { + final Object value = getValueAt(row, column); + final Component component = renderer.getTableCellRendererComponent(this, value, true, true, row, column); + if (component != null) { + final Dimension size = component.getPreferredSize(); + rowHeight = Math.max(size.height, rowHeight); + columnWidth = Math.max(size.width, columnWidth); + } + } + } + getColumnModel().getColumn(column).setWidth(columnWidth + 5); + dimension.width += columnWidth + 5; + } + dimension.height = getRowCount() * rowHeight; + myPrefSize = dimension; + } + return myPrefSize; + } + + public static void main(String[] args) { + final JFrame frame = new JFrame("Test"); + frame.setSize(300, 300); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + + final MultiColumnList list = new MultiColumnList("1", 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13); + list.setFixedColumnsMode(5); + frame.getContentPane().add(list); + frame.setVisible(true); + } +} diff --git a/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java b/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java new file mode 100644 index 000000000000..a3189213d09a --- /dev/null +++ b/platform/platform-api/src/com/intellij/ui/components/MultiColumnListModel.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.ui.components; + +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.TableModel; + +/** + * @author Konstantin Bulenkov + */ +public abstract class MultiColumnListModel extends AbstractTableModel implements TableModel { + private final ListModel myModel; + + public MultiColumnListModel(ListModel model) { + myModel = model; + } + + public abstract int toListIndex(int row, int column); + + public int getSize() { + return myModel.getSize(); + } + + @Nullable + @Override + public Object getValueAt(int row, int column) { + final int index = toListIndex(row, column); + return index == -1 || index >= myModel.getSize() ? null + : myModel.getElementAt(index); + } +} diff --git a/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java b/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java index 833b4dccd418..67d0eed69bbc 100644 --- a/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/AbstractVcsTestCase.java @@ -381,15 +381,18 @@ public abstract class AbstractVcsTestCase { } protected VirtualFile copyFileInCommand(final VirtualFile file, final VirtualFile newParent) { - return copyFileInCommand(myProject, file, newParent); + return copyFileInCommand(myProject, file, newParent, file.getName()); } - public static VirtualFile copyFileInCommand(final Project project, final VirtualFile file, final VirtualFile newParent) { + public static VirtualFile copyFileInCommand(final Project project, + final VirtualFile file, + final VirtualFile newParent, + final String newName) { return new WriteCommandAction(project) { @Override protected void run(Result result) throws Throwable { try { - result.setResult(file.copy(this, newParent, file.getName())); + result.setResult(file.copy(this, newParent, newName)); } catch (IOException e) { throw new RuntimeException(e); diff --git a/platform/util/src/com/intellij/openapi/util/UserDataHolderBase.java b/platform/util/src/com/intellij/openapi/util/UserDataHolderBase.java index d9d541032c61..01f2d081612b 100644 --- a/platform/util/src/com/intellij/openapi/util/UserDataHolderBase.java +++ b/platform/util/src/com/intellij/openapi/util/UserDataHolderBase.java @@ -16,44 +16,26 @@ package com.intellij.openapi.util; +import com.intellij.util.SmartFMap; import com.intellij.util.concurrency.AtomicFieldUpdater; -import com.intellij.util.containers.StripedLockConcurrentHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; -import java.util.ConcurrentModificationException; import java.util.Map; -import java.util.concurrent.ConcurrentMap; public class UserDataHolderBase implements UserDataHolderEx, Cloneable { - private static final Key> COPYABLE_USER_MAP_KEY = Key.create("COPYABLE_USER_MAP_KEY"); + private static final Key> COPYABLE_USER_MAP_KEY = Key.create("COPYABLE_USER_MAP_KEY"); /** * Concurrent writes to this field are via CASes only, using the {@link #updater} - * When map becomes empty, this field set to null atomically - * - * Basic state transitions are as follows: - * - * (adding keyvalue) (putUserData(key,value)) - * [myUserMap=null] -> [myUserMap=(key->value)] - * - * (adding another) (putUserData(key2,value2)) - * [myUserMap=(key->value)] -> [myUserMap=(key->value, key2->value2)] - * - * (removing keyvalue) (putUserData(k2,null)) - * [myUserMap=(key->value, k2->v2)] -> [myUserMap=(key->value)] - * - * (removing last entry) (putUserData(key,null)) - * [myUserMap=(key->value)] -> [myUserMap=null] - * */ - private volatile ConcurrentMap myUserMap = null; + @NotNull private volatile SmartFMap myUserMap = SmartFMap.emptyMap(); protected Object clone() { try { UserDataHolderBase clone = (UserDataHolderBase)super.clone(); - clone.myUserMap = null; + clone.myUserMap = SmartFMap.emptyMap(); copyCopyableDataTo(clone); return clone; } @@ -65,207 +47,86 @@ public class UserDataHolderBase implements UserDataHolderEx, Cloneable { @TestOnly public String getUserDataString() { - final ConcurrentMap userMap = myUserMap; - if (userMap == null) { - return ""; - } + final SmartFMap userMap = myUserMap; final Map copyableMap = getUserData(COPYABLE_USER_MAP_KEY); return userMap.toString() + (copyableMap == null ? "" : copyableMap.toString()); } public void copyUserDataTo(UserDataHolderBase other) { - ConcurrentMap map = myUserMap; - if (map == null) { - other.myUserMap = null; - } - else { - ConcurrentMap fresh = createDataMap(map.size()); - fresh.putAll(map); - other.myUserMap = fresh; - } + other.myUserMap = myUserMap; } public T getUserData(@NotNull Key key) { - final Map map = myUserMap; //noinspection unchecked - return map == null ? null : (T)map.get(key); + return (T)myUserMap.get(key); } public void putUserData(@NotNull Key key, @Nullable T value) { while (true) { - try { - if (value == null) { - ConcurrentMap map = myUserMap; - if (map == null) break; - @SuppressWarnings("unchecked") - T previous = (T)map.remove(key); - boolean removed = previous != null; - if (removed) { - nullifyMapFieldIfEmpty(); - } - } - else { - getOrCreateMap().put(key, value); - } - break; - } - catch (ConcurrentModificationException ignored) { + SmartFMap map = myUserMap; + SmartFMap newMap = value == null ? map.minus(key) : map.plus(key, value); + if (newMap == map || updater.compareAndSet(this, map, newMap)) { + return; } } } - private static ConcurrentMap createDataMap(int initialCapacity) { - return new StripedLockConcurrentHashMap(initialCapacity); - } - public T getCopyableUserData(Key key) { - return getCopyableUserDataImpl(key); - } - - protected final T getCopyableUserDataImpl(Key key) { - Map map = getUserData(COPYABLE_USER_MAP_KEY); - //noinspection unchecked + SmartFMap map = getUserData(COPYABLE_USER_MAP_KEY); + //noinspection unchecked,ConstantConditions return map == null ? null : (T)map.get(key); } public void putCopyableUserData(Key key, T value) { - putCopyableUserDataImpl(key, value); - } - - private Map getOrCreateCopyableMap(boolean create) { - Map copyMap = getUserData(COPYABLE_USER_MAP_KEY); - if (copyMap == null && create) { - copyMap = createDataMap(1); - copyMap = putUserDataIfAbsent(COPYABLE_USER_MAP_KEY, copyMap); - } - - return copyMap; - } - - protected final void putCopyableUserDataImpl(Key key, T value) { while (true) { - try { - Map copyMap = getOrCreateCopyableMap(value != null); - if (copyMap == null) break; - - if (value == null) { - copyMap.remove(key); - if (copyMap.isEmpty()) { - ((StripedLockConcurrentHashMap)copyMap).blockModification(); - ConcurrentMap newCopyMap; - if (copyMap.isEmpty()) { - newCopyMap = null; - } - else { - newCopyMap = createDataMap(copyMap.size()); - newCopyMap.putAll(copyMap); - } - boolean replaced = replace(COPYABLE_USER_MAP_KEY, copyMap, newCopyMap); - if (!replaced) continue; - } - } - else { - copyMap.put(key, value); - } - break; + SmartFMap map = myUserMap; + @SuppressWarnings("unchecked") SmartFMap copyableMap = (SmartFMap)map.get(COPYABLE_USER_MAP_KEY); + if (copyableMap == null) { + copyableMap = SmartFMap.emptyMap(); } - catch (ConcurrentModificationException ignored) { - // someone blocked modification, retry - } - } - } - - private ConcurrentMap getOrCreateMap() { - while (true) { - ConcurrentMap map = myUserMap; - if (map != null) return map; - map = createDataMap(2); - boolean updated = updater.compareAndSet(this, null, map); - if (updated) { - return map; + SmartFMap newCopyableMap = value == null ? copyableMap.minus(key) : copyableMap.plus(key, value); + SmartFMap newMap = newCopyableMap.isEmpty() ? map.minus(COPYABLE_USER_MAP_KEY) : map.plus(COPYABLE_USER_MAP_KEY, newCopyableMap); + if (newMap == map || updater.compareAndSet(this, map, newMap)) { + return; } } } public boolean replace(@NotNull Key key, @Nullable T oldValue, @Nullable T newValue) { while (true) { - try { - ConcurrentMap map = getOrCreateMap(); - if (oldValue == null) { - return newValue == null || map.putIfAbsent(key, newValue) == null; - } - if (newValue == null) { - boolean removed = map.remove(key, oldValue); - if (removed) { - nullifyMapFieldIfEmpty(); - } - return removed; - } - return map.replace(key, oldValue, newValue); + SmartFMap map = myUserMap; + if (map.get(key) != oldValue) { + return false; } - catch (ConcurrentModificationException ignored) { - // someone blocked modification, retry + SmartFMap newMap = newValue == null ? map.minus(key) : map.plus(key, newValue); + if (newMap == map || updater.compareAndSet(this, map, newMap)) { + return true; } } } @NotNull public T putUserDataIfAbsent(@NotNull final Key key, @NotNull final T value) { - Object v = getOrCreateMap().get(key); - if (v != null) { - //noinspection unchecked - return (T)v; - } while (true) { - try { - @SuppressWarnings("unchecked") - T prev = (T)getOrCreateMap().putIfAbsent(key, value); - return prev == null ? value : prev; + SmartFMap map = myUserMap; + @SuppressWarnings("unchecked") T oldValue = (T)map.get(key); + if (oldValue != null) { + return oldValue; } - catch (ConcurrentModificationException ignored) { - // someone blocked modification, retry + SmartFMap newMap = map.plus(key, value); + if (newMap == map || updater.compareAndSet(this, map, newMap)) { + return value; } } } public void copyCopyableDataTo(@NotNull UserDataHolderBase clone) { - Map copyableMap = getUserData(COPYABLE_USER_MAP_KEY); - if (copyableMap != null) { - ConcurrentMap copy = createDataMap(copyableMap.size()); - copy.putAll(copyableMap); - copyableMap = copy; - } - clone.putUserData(COPYABLE_USER_MAP_KEY, copyableMap); + clone.putUserData(COPYABLE_USER_MAP_KEY, getUserData(COPYABLE_USER_MAP_KEY)); } protected void clearUserData() { - myUserMap = null; + myUserMap = SmartFMap.emptyMap(); } - private static final AtomicFieldUpdater updater = AtomicFieldUpdater.forFieldOfType(UserDataHolderBase.class, ConcurrentMap.class); - private void nullifyMapFieldIfEmpty() { - try { - while (true) { - StripedLockConcurrentHashMap map = (StripedLockConcurrentHashMap)myUserMap; - if (map == null || !map.isEmpty()) break; - map.blockModification(); // we block the map and either replace it with null or fail with replace, in both cases the map is thrown away - ConcurrentMap newMap; - if (map.isEmpty()) { - newMap = null; - } - else { - // someone managed to add something in the meantime - // atomically replace the blocked map with newly created map filled with the data sneaked in - newMap = createDataMap(map.size()); - newMap.putAll(map); - } - boolean replaced = updater.compareAndSet(this, map, newMap); - if (replaced) break; - // else someone has replaced map already and pushing back the changes is his responsibility - } - } - catch (ConcurrentModificationException ignored) { - // somebody has already blocked the map, back off - } - } + private static final AtomicFieldUpdater updater = AtomicFieldUpdater.forFieldOfType(UserDataHolderBase.class, SmartFMap.class); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java index e921957a81e8..d52e8aafbf25 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/UpdatingChangeListBuilder.java @@ -164,6 +164,10 @@ class UpdatingChangeListBuilder implements ChangelistBuilder { checkIfDisposed(); if (isExcluded(file)) return; if (myScope.belongsTo(new FilePathImpl(file))) { + if (ChangeListManagerImpl.DEBUG) { + System.out.println("UpdatingChangeListBuilder.processModifiedWithoutCheckout"); + System.out.println("file = " + file); + } myComposite.getVFHolder(FileHolder.HolderType.MODIFIED_WITHOUT_EDITING).addFile(file); } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/DefaultGroovyShellRunner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/DefaultGroovyShellRunner.java index 7b4fc5337659..dd6cc8974372 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/DefaultGroovyShellRunner.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/DefaultGroovyShellRunner.java @@ -21,6 +21,8 @@ import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.ModuleRootManager; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.JavaPsiFacade; +import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.PathsList; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.config.AbstractConfigUtils; @@ -46,13 +48,13 @@ public class DefaultGroovyShellRunner extends GroovyShellRunner { @Override public JavaParameters createJavaParameters(@NotNull Module module) throws ExecutionException { JavaParameters res = GroovyScriptRunConfiguration.createJavaParametersWithSdk(module); - DefaultGroovyScriptRunner.configureGenericGroovyRunner(res, module, "groovy.ui.GroovyMain", true); + DefaultGroovyScriptRunner.configureGenericGroovyRunner(res, module, "groovy.ui.GroovyMain", !hasGroovyAll(module)); PathsList list = GroovyScriptRunner.getClassPathFromRootModel(module, true, res, true); if (list != null) { res.getClassPath().addAll(list.getPathList()); } res.getProgramParametersList().addAll("-p", GroovyScriptRunner.getPathInConf("console.txt")); - //javaParameters.getVMParametersList().add("-Xdebug"); javaParameters.getVMParametersList().add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239"); + //res.getVMParametersList().add("-Xdebug"); res.getVMParametersList().add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239"); res.setWorkingDirectory(getWorkingDirectory(module)); return res; @@ -69,7 +71,7 @@ public class DefaultGroovyShellRunner extends GroovyShellRunner { public String getTitle(@NotNull Module module) { String homePath = LibrariesUtil.getGroovyHomePath(module); boolean bundled = false; - if (homePath == null) { + if (homePath == null || !hasGroovyAll(module)) { homePath = GroovyUtils.getBundledGroovyJar().getParentFile().getParent(); bundled = true; } @@ -77,6 +79,13 @@ public class DefaultGroovyShellRunner extends GroovyShellRunner { return version == AbstractConfigUtils.UNDEFINED_VERSION ? "" : " (" + (bundled ? "Bundled " : "") + "Groovy " + version + ")"; } + private static boolean hasGroovyAll(Module module) { + GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module); + JavaPsiFacade facade = JavaPsiFacade.getInstance(module.getProject()); + return facade.findClass("org.apache.commons.cli.CommandLineParser", scope) != null && + facade.findClass("groovy.ui.GroovyMain", scope) != null; + } + @NotNull @Override public String transformUserInput(@NotNull String userInput) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/DefaultGroovyScriptRunner.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/DefaultGroovyScriptRunner.java index e958e7c7ed26..729c5a0469aa 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/DefaultGroovyScriptRunner.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/runner/DefaultGroovyScriptRunner.java @@ -81,21 +81,20 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner { params.getProgramParametersList().addParametersString(configuration.getScriptParameters()); } - public static void configureGenericGroovyRunner(@NotNull JavaParameters params, @NotNull Module module, @NotNull String mainClass, boolean mayUseBundled) { + public static void configureGenericGroovyRunner(@NotNull JavaParameters params, @NotNull Module module, @NotNull String mainClass, boolean useBundled) { final VirtualFile groovyJar = findGroovyJar(module); - if (groovyJar != null) { - params.getClassPath().add(groovyJar); - } else if (mayUseBundled) { + if (useBundled) { params.getClassPath().add(GroovyUtils.getBundledGroovyJar()); } + else if (groovyJar != null) { + params.getClassPath().add(groovyJar); + } setToolsJar(params); - String groovyHome = LibrariesUtil.getGroovyHomePath(module); + String groovyHome = useBundled ? FileUtil.toCanonicalPath(GroovyUtils.getBundledGroovyJar().getParentFile().getParent()) : LibrariesUtil.getGroovyHomePath(module); if (groovyHome != null) { groovyHome = FileUtil.toSystemDependentName(groovyHome); - } else if (mayUseBundled) { - groovyHome = FileUtil.toCanonicalPath(GroovyUtils.getBundledGroovyJar().getParentFile().getParent()); } setGroovyHome(params, groovyHome); diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java index 669b0d42c469..9708c56408dd 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java @@ -242,7 +242,7 @@ public class XmlHighlightVisitor extends XmlElementVisitor implements HighlightV for (final IntentionAction quickFixAction : quickFixActions) { if (quickFixAction == null) continue; - QuickFixAction.registerQuickFixAction(highlightInfo, textRange, quickFixAction, null); + QuickFixAction.registerQuickFixAction(highlightInfo, textRange, quickFixAction); } addToResults(highlightInfo); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java index 9f2dc714f444..10c37222bdb9 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngParser.java @@ -42,7 +42,7 @@ import org.kohsuke.rngom.ast.builder.BuildException; import org.kohsuke.rngom.ast.builder.IncludedGrammar; import org.kohsuke.rngom.ast.builder.SchemaBuilder; import org.kohsuke.rngom.ast.om.ParsedPattern; -import org.kohsuke.rngom.ast.util.CheckingSchemaBuilder; +import org.kohsuke.rngom.binary.SchemaBuilderImpl; import org.kohsuke.rngom.digested.DPattern; import org.kohsuke.rngom.digested.DSchemaBuilderImpl; import org.kohsuke.rngom.parse.IllegalSchemaException; @@ -90,9 +90,11 @@ public class RngParser { public static DPattern parsePattern(final PsiFile file, final ErrorHandler eh, boolean checking) { try { final Parseable p = createParsable(file, eh); - final SchemaBuilder sb = new DSchemaBuilderImpl(); - - return (DPattern)p.parse(checking ? new CheckingSchemaBuilder(sb, eh) : sb); + if (checking) { + p.parse(new SchemaBuilderImpl(eh)); + } else { + return p.parse(new DSchemaBuilderImpl()); + } } catch (BuildException e) { LOG.info(e); } catch (IllegalSchemaException e) {