mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master'
This commit is contained in:
@@ -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<String>() {
|
||||
@Override
|
||||
public boolean process(final String annoName) {
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
+15
-15
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,6 @@ public final class Annotation implements Segment {
|
||||
public final IntentionAction quickFix;
|
||||
public final TextRange textRange;
|
||||
public final List<IntentionAction> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<IntentionAction> options, final String displayName) {
|
||||
this(action, options, displayName, null);
|
||||
}
|
||||
|
||||
+6
-1
@@ -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<? extends IntentionAction> 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<IntentionAction> 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<IntentionAction> condition) {
|
||||
for (Iterator<Pair<HighlightInfo.IntentionActionDescriptor, TextRange>> it = info.quickFixActionRanges.iterator(); it.hasNext();) {
|
||||
Pair<HighlightInfo.IntentionActionDescriptor, TextRange> pair = it.next();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user