1 11 package org.eclipse.jdt.internal.ui.text.correction; 12 13 import java.util.Collection ; 14 import java.util.Hashtable ; 15 import java.util.Map ; 16 17 import org.eclipse.core.runtime.Assert; 18 import org.eclipse.core.runtime.CoreException; 19 20 import org.eclipse.swt.graphics.Image; 21 22 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; 23 import org.eclipse.jdt.internal.corext.fix.IFix; 24 import org.eclipse.jdt.internal.corext.fix.PotentialProgrammingProblemsFix; 25 26 import org.eclipse.jdt.ui.text.java.IInvocationContext; 27 import org.eclipse.jdt.ui.text.java.IProblemLocation; 28 29 import org.eclipse.jdt.internal.ui.JavaPluginImages; 30 import org.eclipse.jdt.internal.ui.fix.PotentialProgrammingProblemsCleanUp; 31 32 37 public final class SerialVersionSubProcessor { 38 39 50 public static final void getSerialVersionProposals(final IInvocationContext context, final IProblemLocation location, final Collection proposals) throws CoreException { 51 52 Assert.isNotNull(context); 53 Assert.isNotNull(location); 54 Assert.isNotNull(proposals); 55 56 IFix[] fixes= PotentialProgrammingProblemsFix.createMissingSerialVersionFixes(context.getASTRoot(), location); 57 if (fixes != null) { 58 Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_ADD); 59 Map options= new Hashtable (); 60 options.put(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID, CleanUpConstants.TRUE); 61 options.put(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpConstants.TRUE); 62 FixCorrectionProposal prop1= new SerialVersionDefaultProposal(fixes[0], new PotentialProgrammingProblemsCleanUp(options), 9, image, context); 63 proposals.add(prop1); 64 options= new Hashtable (); 65 options.put(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID, CleanUpConstants.TRUE); 66 options.put(CleanUpConstants.ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpConstants.TRUE); 67 FixCorrectionProposal prop2= new SerialVersionHashProposal(fixes[1], new PotentialProgrammingProblemsCleanUp(options), 9, image, context); 68 proposals.add(prop2); 69 } 70 } 71 } 72 | Popular Tags |