diff options
| author | Noopur Gupta | 2019-03-22 09:28:33 +0000 |
|---|---|---|
| committer | Noopur Gupta | 2019-03-22 09:28:33 +0000 |
| commit | 6d42a3fdd9a75e3dc3770d69421de9fab582d7d4 (patch) | |
| tree | 38e7a8281d7e27160ad2882fa756318af6347917 | |
| parent | 2ded7c5527a60a371495953435a86bb25ca7a51e (diff) | |
| download | eclipse.jdt.ui-6d42a3fdd9a75e3dc3770d69421de9fab582d7d4.tar.gz eclipse.jdt.ui-6d42a3fdd9a75e3dc3770d69421de9fab582d7d4.tar.xz eclipse.jdt.ui-6d42a3fdd9a75e3dc3770d69421de9fab582d7d4.zip | |
Bug 543781: [12][quick fix] Add quick fix to change project complianceI20190324-1800I20190323-1800I20190322-1800
and JRE to 12
Change-Id: Ia6eabecdaa8664025da539c28c30e2bc75a6a6a6
2 files changed, 15 insertions, 0 deletions
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java index 59f326e529..76520c428b 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/PreviewFeaturesSubProcessor.java @@ -45,6 +45,7 @@ import org.eclipse.jdt.internal.corext.util.Messages; import org.eclipse.jdt.ui.JavaElementLabels; import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.ui.text.java.correction.ChangeCorrectionProposal; import org.eclipse.jdt.ui.text.java.correction.ICommandAccess; @@ -221,4 +222,14 @@ public class PreviewFeaturesSubProcessor { } } + public static void getNeedHigherComplianceProposals(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { + String[] args= problem.getProblemArguments(); + if (args != null && args.length > 0) { + String arg= args[1]; + if (arg == "12") { //$NON-NLS-1$ + String version= JavaCore.VERSION_12; + ReorgCorrectionsSubProcessor.getNeedHigherComplianceProposals(context, problem, proposals, version); + } + } + } } diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java index 2c063f9d67..801d51360b 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java @@ -301,6 +301,7 @@ public class QuickFixProcessor implements IQuickFixProcessor { case IProblem.ProviderMethodOrConstructorRequiredForServiceImpl: case IProblem.ServiceImplDefaultConstructorNotPublic: case IProblem.PreviewFeatureDisabled: + case IProblem.PreviewFeatureNotSupported: return true; default: return SuppressWarningsSubProcessor.hasSuppressWarningsProposal(cu.getJavaProject(), problemId) @@ -846,6 +847,9 @@ public class QuickFixProcessor implements IQuickFixProcessor { PreviewFeaturesSubProcessor.getEnablePreviewFeaturesProposal(context, proposals); PreviewFeaturesSubProcessor.getOpenCompliancePageToEnablePreviewFeaturesProposal(context, proposals); break; + case IProblem.PreviewFeatureNotSupported: + PreviewFeaturesSubProcessor.getNeedHigherComplianceProposals(context, problem, proposals); + break; default: } if (JavaModelUtil.is50OrHigher(context.getCompilationUnit().getJavaProject())) { |
