Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 147908 Details for
Bug 235750
[clean up] 'Save Actions' doesn't add override annotation for interface method implementations (Java6)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
235750_patch.txt (text/plain), 23.76 KB, created by
Markus Keller
on 2009-09-23 13:09:35 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2009-09-23 13:09:35 EDT
Size:
23.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/fix/Java50CleanUp.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/Java50CleanUp.java,v >retrieving revision 1.28 >diff -u -r1.28 Java50CleanUp.java >--- ui/org/eclipse/jdt/internal/ui/fix/Java50CleanUp.java 23 Sep 2009 08:54:18 -0000 1.28 >+++ ui/org/eclipse/jdt/internal/ui/fix/Java50CleanUp.java 23 Sep 2009 17:07:10 -0000 >@@ -66,8 +66,10 @@ > */ > protected ICleanUpFix createFix(CompilationUnit compilationUnit) throws CoreException { > boolean addAnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); >+ boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); > return Java50Fix.createCleanUp(compilationUnit, >- addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE), >+ addAnotations && addOverride, >+ addAnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), > addAnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), > isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); > } >@@ -79,16 +81,23 @@ > if (compilationUnit == null) > return null; > >+ boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); >+ boolean addOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); > return Java50Fix.createCleanUp(compilationUnit, problems, >- isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE), >- isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), >+ addAnnotations && addOverride, >+ addAnnotations && addOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION), >+ addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED), > isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)); > } > > private Map getRequiredOptions() { > Map result= new Hashtable(); >- if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { > result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, JavaCore.WARNING); >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { >+ result.put(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION, JavaCore.ENABLED); >+ } >+ } > > if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) > result.put(JavaCore.COMPILER_PB_MISSING_DEPRECATED_ANNOTATION, JavaCore.WARNING); >@@ -104,8 +113,12 @@ > */ > public String[] getStepDescriptions() { > List result= new ArrayList(); >- if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { > result.add(MultiFixMessages.Java50MultiFix_AddMissingOverride_description); >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { >+ result.add("Add missing '@Override' annotations to implementations of interface methods"); >+ } >+ } > if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED)) > result.add(MultiFixMessages.Java50MultiFix_AddMissingDeprecated_description); > if (isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES)) >@@ -128,11 +141,17 @@ > } > buf.append(" public void foo() {}\n"); //$NON-NLS-1$ > buf.append("}\n"); //$NON-NLS-1$ >- buf.append("class ESub extends E {\n"); //$NON-NLS-1$ >+ buf.append("class ESub extends E implements Runnable {\n"); //$NON-NLS-1$ > if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { > buf.append(" @Override\n"); //$NON-NLS-1$ > } > buf.append(" public void foo() {}\n"); //$NON-NLS-1$ >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) >+ && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE) >+ && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION)) { >+ buf.append(" @Override\n"); //$NON-NLS-1$ >+ } >+ buf.append(" public void run() {}\n"); //$NON-NLS-1$ > buf.append("}\n"); //$NON-NLS-1$ > > return buf.toString(); >@@ -144,14 +163,17 @@ > public boolean canFix(ICompilationUnit compilationUnit, IProblemLocation problem) { > int id= problem.getProblemId(); > >- if (Java50Fix.isMissingOverrideAnnotationProblem(id)) >- return isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); >- >- if (Java50Fix.isMissingDeprecationProblem(id)) >+ if (Java50Fix.isMissingOverrideAnnotationProblem(id)) { >+ if (isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE)) { >+ return ! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); >+ } >+ >+ } else if (Java50Fix.isMissingDeprecationProblem(id)) { > return isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); >- >- if (Java50Fix.isRawTypeReferenceProblem(id)) >+ >+ } else if (Java50Fix.isRawTypeReferenceProblem(id)) { > return isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); >+ } > > return false; > } >@@ -162,15 +184,18 @@ > public int computeNumberOfFixes(CompilationUnit compilationUnit) { > int result= 0; > >- boolean addMissingOverride= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); >- boolean addMissingDeprecated= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS) && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); >+ boolean addAnnotations= isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS); >+ boolean addMissingOverride= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE); >+ boolean addMissingOverrideInterfaceMethods= addMissingOverride && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION); >+ boolean addMissingDeprecated= addAnnotations && isEnabled(CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED); > boolean useTypeArgs= isEnabled(CleanUpConstants.VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES); > > IProblem[] problems= compilationUnit.getProblems(); > for (int i= 0; i < problems.length; i++) { > int id= problems[i].getID(); > if (addMissingOverride && Java50Fix.isMissingOverrideAnnotationProblem(id)) >- result++; >+ if (! Java50Fix.isMissingOverrideAnnotationInterfaceProblem(id) || addMissingOverrideInterfaceMethods) >+ result++; > if (addMissingDeprecated && Java50Fix.isMissingDeprecationProblem(id)) > result++; > if (useTypeArgs && Java50Fix.isRawTypeReferenceProblem(id)) >Index: ui/org/eclipse/jdt/internal/ui/fix/PotentialProgrammingProblemsCleanUp.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/PotentialProgrammingProblemsCleanUp.java,v >retrieving revision 1.20 >diff -u -r1.20 PotentialProgrammingProblemsCleanUp.java >--- ui/org/eclipse/jdt/internal/ui/fix/PotentialProgrammingProblemsCleanUp.java 16 Oct 2008 12:09:06 -0000 1.20 >+++ ui/org/eclipse/jdt/internal/ui/fix/PotentialProgrammingProblemsCleanUp.java 23 Sep 2009 17:07:10 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -115,7 +115,7 @@ > public String getPreview() { > StringBuffer buf= new StringBuffer(); > >- buf.append("class E implements java.io.Serializable{\n"); //$NON-NLS-1$ >+ buf.append("class E implements java.io.Serializable {\n"); //$NON-NLS-1$ > if ((isEnabled(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID) && isEnabled(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID_GENERATED))) { > buf.append(" private static final long serialVersionUID = -391484377137870342L;\n"); //$NON-NLS-1$ > } else if ((isEnabled(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID) && isEnabled(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID_DEFAULT))) { >Index: core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java,v >retrieving revision 1.27 >diff -u -r1.27 CleanUpConstants.java >--- core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java 23 Sep 2009 09:56:49 -0000 1.27 >+++ core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java 23 Sep 2009 17:07:10 -0000 >@@ -832,6 +832,31 @@ > public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE= "cleanup.add_missing_override_annotations"; //$NON-NLS-1$ > > /** >+ * Add '@Override' annotation in front of methods that override or implement a superinterface method. >+ * <p> >+ * Example: >+ * >+ * <pre> >+ * interface I {void foo();} >+ * class E implements I { >+ * void foo(); -> @Override void foo(); >+ * } >+ * </pre> >+ * >+ * Only has an effect if {@link #ADD_MISSING_ANNOTATIONS} and {@link #ADD_MISSING_ANNOTATIONS_OVERRIDE} are TRUE and >+ * the compiler compliance is 1.6 or higher.<br> >+ * <br> >+ * Possible values: {TRUE, FALSE}<br> >+ * >+ * <br> >+ * >+ * @see CleanUpOptions#TRUE >+ * @see CleanUpOptions#FALSE >+ * @since 3.6 >+ */ >+ public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION= "cleanup.add_missing_override_annotations_interface_methods"; //$NON-NLS-1$ >+ >+ /** > * Add '@Deprecated' annotation in front of deprecated members. > * <p> > * Example: >@@ -1127,6 +1152,7 @@ > //Missing Code > options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE); > options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE); >+ options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE); > options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE); > > options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE); >@@ -1206,6 +1232,7 @@ > //Missing Code > options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE); > options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE); >+ options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE); > options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE); > > options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE); >Index: core extension/org/eclipse/jdt/internal/corext/fix/Java50Fix.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/Java50Fix.java,v >retrieving revision 1.43 >diff -u -r1.43 Java50Fix.java >--- core extension/org/eclipse/jdt/internal/corext/fix/Java50Fix.java 23 Sep 2009 08:54:17 -0000 1.43 >+++ core extension/org/eclipse/jdt/internal/corext/fix/Java50Fix.java 23 Sep 2009 17:07:10 -0000 >@@ -157,6 +157,10 @@ > return createFix(compilationUnit, problem, OVERRIDE, FixMessages.Java50Fix_AddOverride_description); > } > >+ public static boolean isMissingOverrideAnnotationInterfaceProblem(int id) { >+ return id == IProblem.MissingOverrideAnnotationForInterfaceMethodImplementation; >+ } >+ > public static boolean isMissingOverrideAnnotationProblem(int id) { > return id == IProblem.MissingOverrideAnnotation || id == IProblem.MissingOverrideAnnotationForInterfaceMethodImplementation; > } >@@ -205,6 +209,7 @@ > > public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, > boolean addOverrideAnnotation, >+ boolean addOverrideInterfaceAnnotation, > boolean addDeprecatedAnnotation, > boolean rawTypeReference) { > >@@ -224,7 +229,7 @@ > } > > if (addOverrideAnnotation) >- createAddOverrideAnnotationOperations(compilationUnit, locations, operations); >+ createAddOverrideAnnotationOperations(compilationUnit, addOverrideInterfaceAnnotation, locations, operations); > > if (addDeprecatedAnnotation) > createAddDeprecatedAnnotationOperations(compilationUnit, locations, operations); >@@ -248,6 +253,7 @@ > > public static ICleanUpFix createCleanUp(CompilationUnit compilationUnit, IProblemLocation[] problems, > boolean addOverrideAnnotation, >+ boolean addOverrideInterfaceAnnotation, > boolean addDeprecatedAnnotation, > boolean rawTypeReferences) { > >@@ -261,7 +267,7 @@ > List/*<CompilationUnitRewriteOperation>*/ operations= new ArrayList(); > > if (addOverrideAnnotation) >- createAddOverrideAnnotationOperations(compilationUnit, problems, operations); >+ createAddOverrideAnnotationOperations(compilationUnit, addOverrideInterfaceAnnotation, problems, operations); > > if (addDeprecatedAnnotation) > createAddDeprecatedAnnotationOperations(compilationUnit, problems, operations); >@@ -296,19 +302,22 @@ > } > } > >- private static void createAddOverrideAnnotationOperations(CompilationUnit compilationUnit, IProblemLocation[] locations, List result) { >+ private static void createAddOverrideAnnotationOperations(CompilationUnit compilationUnit, boolean addOverrideInterfaceAnnotation, IProblemLocation[] locations, List result) { > for (int i= 0; i < locations.length; i++) { > IProblemLocation problem= locations[i]; >+ int problemId= problem.getProblemId(); > >- if (isMissingOverrideAnnotationProblem(problem.getProblemId())) { >- ASTNode selectedNode= problem.getCoveringNode(compilationUnit); >- if (selectedNode != null) { >- >- ASTNode declaringNode= getDeclaringNode(selectedNode); >- if (declaringNode instanceof BodyDeclaration) { >- BodyDeclaration declaration= (BodyDeclaration) declaringNode; >- AnnotationRewriteOperation operation= new AnnotationRewriteOperation(declaration, OVERRIDE); >- result.add(operation); >+ if (isMissingOverrideAnnotationProblem(problemId)) { >+ if (!isMissingOverrideAnnotationInterfaceProblem(problemId) || addOverrideInterfaceAnnotation) { >+ ASTNode selectedNode= problem.getCoveringNode(compilationUnit); >+ if (selectedNode != null) { >+ >+ ASTNode declaringNode= getDeclaringNode(selectedNode); >+ if (declaringNode instanceof BodyDeclaration) { >+ BodyDeclaration declaration= (BodyDeclaration) declaringNode; >+ AnnotationRewriteOperation operation= new AnnotationRewriteOperation(declaration, OVERRIDE); >+ result.add(operation); >+ } > } > } > } >Index: ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties,v >retrieving revision 1.23 >diff -u -r1.23 CleanUpMessages.properties >--- ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties 31 Dec 2008 21:13:30 -0000 1.23 >+++ ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.properties 23 Sep 2009 17:07:10 -0000 >@@ -68,6 +68,7 @@ > MissingCodeTabPage_GroupName_PotentialProgrammingProblems=Potential programming problems > MissingCodeTabPage_CheckboxName_AddMissingAnnotations=Add missing &Annotations > MissingCodeTabPage_CheckboxName_AddMissingOverrideAnnotations='@Overr&ide' >+MissingCodeTabPage_CheckboxName_AddMissingOverrideInterfaceAnnotations=Implemen&tations of interface methods (1.6 or higher) > MissingCodeTabPage_CheckboxName_AddMissingDeprecatedAnnotations='@&Deprecated' > MissingCodeTabPage_CheckboxName_AddMethods=Add u&nimplemented methods > MissingCodeTabPage_CheckboxName_AddSUID=Add &serial version ID >Index: ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java,v >retrieving revision 1.17 >diff -u -r1.17 CleanUpMessages.java >--- ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java 16 Oct 2008 12:09:42 -0000 1.17 >+++ ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpMessages.java 23 Sep 2009 17:07:10 -0000 >@@ -83,6 +83,8 @@ > public static String MissingCodeTabPage_CheckboxName_AddMissingAnnotations; > public static String MissingCodeTabPage_CheckboxName_AddMissingDeprecatedAnnotations; > public static String MissingCodeTabPage_CheckboxName_AddMissingOverrideAnnotations; >+ >+ public static String MissingCodeTabPage_CheckboxName_AddMissingOverrideInterfaceAnnotations; > public static String MissingCodeTabPage_CheckboxName_AddMethods; > public static String MissingCodeTabPage_CheckboxName_AddSUID; > public static String MissingCodeTabPage_GroupName_Annotations; >Index: ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpTabPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpTabPage.java,v >retrieving revision 1.12 >diff -u -r1.12 CleanUpTabPage.java >--- ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpTabPage.java 29 Oct 2008 09:05:19 -0000 1.12 >+++ ui/org/eclipse/jdt/internal/ui/preferences/cleanup/CleanUpTabPage.java 23 Sep 2009 17:07:10 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2008 IBM Corporation and others. >+ * Copyright (c) 2005, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >Index: ui/org/eclipse/jdt/internal/ui/preferences/cleanup/MissingCodeTabPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/cleanup/MissingCodeTabPage.java,v >retrieving revision 1.13 >diff -u -r1.13 MissingCodeTabPage.java >--- ui/org/eclipse/jdt/internal/ui/preferences/cleanup/MissingCodeTabPage.java 10 Oct 2008 17:27:19 -0000 1.13 >+++ ui/org/eclipse/jdt/internal/ui/preferences/cleanup/MissingCodeTabPage.java 23 Sep 2009 17:07:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -11,6 +11,8 @@ > package org.eclipse.jdt.internal.ui.preferences.cleanup; > > import java.util.Map; >+import java.util.Observable; >+import java.util.Observer; > > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Group; >@@ -38,12 +40,32 @@ > > Group annotationsGroup= createGroup(numColumns, composite, CleanUpMessages.MissingCodeTabPage_GroupName_Annotations); > >- final CheckboxPreference annotationsPref= createCheckboxPref(annotationsGroup, numColumns, CleanUpMessages.MissingCodeTabPage_CheckboxName_AddMissingAnnotations, CleanUpConstants.ADD_MISSING_ANNOTATIONS, CleanUpModifyDialog.FALSE_TRUE); >- intent(annotationsGroup); >+ final CheckboxPreference annotationsPref= createCheckboxPref(annotationsGroup, numColumns, CleanUpMessages.MissingCodeTabPage_CheckboxName_AddMissingAnnotations, CleanUpConstants.ADD_MISSING_ANNOTATIONS, CleanUpModifyDialog.FALSE_TRUE); >+ >+ intent(annotationsGroup); > final CheckboxPreference overridePref= createCheckboxPref(annotationsGroup, numColumns - 1, CleanUpMessages.MissingCodeTabPage_CheckboxName_AddMissingOverrideAnnotations, CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpModifyDialog.FALSE_TRUE); > intent(annotationsGroup); >+ intent(annotationsGroup); >+ final CheckboxPreference overrideInterfacePref= createCheckboxPref(annotationsGroup, numColumns - 2, CleanUpMessages.MissingCodeTabPage_CheckboxName_AddMissingOverrideInterfaceAnnotations, CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpModifyDialog.FALSE_TRUE); >+ >+ intent(annotationsGroup); > final CheckboxPreference deprecatedPref= createCheckboxPref(annotationsGroup, numColumns - 1, CleanUpMessages.MissingCodeTabPage_CheckboxName_AddMissingDeprecatedAnnotations, CleanUpConstants.ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpModifyDialog.FALSE_TRUE); >+ >+ /* This observable preferences framework is over-designed but under-performing. >+ * I didn't find an easy way to make it work for non-trivial (3-level) dependencies, so I just do it by hand for now... >+ */ >+ // Need to add observer before registering slaves below, since java.util.Observable notifies in wrong order! >+ annotationsPref.addObserver(new Observer() { >+ public void update(Observable o, Object arg) { >+ boolean enabled= overridePref.getEnabled() && overridePref.getChecked(); >+ overrideInterfacePref.setEnabled(enabled); >+ } >+ }); >+ > registerSlavePreference(annotationsPref, new CheckboxPreference[] {overridePref, deprecatedPref}); >+ registerSlavePreference(overridePref, new CheckboxPreference[] {overrideInterfacePref}); >+ >+ overrideInterfacePref.setEnabled(overridePref.getEnabled() && overridePref.getChecked()); > > if (!isSaveAction()) { > Group pppGroup= createGroup(numColumns, composite, CleanUpMessages.MissingCodeTabPage_GroupName_PotentialProgrammingProblems); >Index: ui/org/eclipse/jdt/internal/ui/text/correction/ModifierCorrectionSubProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ModifierCorrectionSubProcessor.java,v >retrieving revision 1.104 >diff -u -r1.104 ModifierCorrectionSubProcessor.java >--- ui/org/eclipse/jdt/internal/ui/text/correction/ModifierCorrectionSubProcessor.java 16 Jul 2009 13:33:11 -0000 1.104 >+++ ui/org/eclipse/jdt/internal/ui/text/correction/ModifierCorrectionSubProcessor.java 23 Sep 2009 17:07:11 -0000 >@@ -690,6 +690,7 @@ > Map options= new Hashtable(); > options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE); > options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE); >+ options.put(CleanUpConstants.ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE); > FixCorrectionProposal proposal= new FixCorrectionProposal(fix, new Java50CleanUp(options), 15, image, context); > proposals.add(proposal); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235750
: 147908