1 11 package org.eclipse.jdt.internal.ui.actions; 12 13 import java.util.Hashtable ; 14 import java.util.Map ; 15 16 import org.eclipse.ui.IWorkbenchSite; 17 import org.eclipse.ui.PlatformUI; 18 19 import org.eclipse.jdt.core.ICompilationUnit; 20 21 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; 22 23 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; 24 import org.eclipse.jdt.internal.ui.fix.ICleanUp; 25 import org.eclipse.jdt.internal.ui.fix.ImportsCleanUp; 26 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; 27 28 public class MultiOrganizeImportAction extends CleanUpAction { 29 30 public MultiOrganizeImportAction(IWorkbenchSite site) { 31 super(site); 32 33 setText(ActionMessages.OrganizeImportsAction_label); 34 setToolTipText(ActionMessages.OrganizeImportsAction_tooltip); 35 setDescription(ActionMessages.OrganizeImportsAction_description); 36 37 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION); 38 } 39 40 public MultiOrganizeImportAction(JavaEditor editor) { 41 super(editor); 42 43 setText(ActionMessages.OrganizeImportsAction_label); 44 setToolTipText(ActionMessages.OrganizeImportsAction_tooltip); 45 setDescription(ActionMessages.OrganizeImportsAction_description); 46 47 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION); 48 } 49 50 protected ICleanUp[] createCleanUps(ICompilationUnit[] units) { 51 Map settings= new Hashtable (); 52 settings.put(CleanUpConstants.ORGANIZE_IMPORTS, CleanUpConstants.TRUE); 53 ImportsCleanUp importsCleanUp= new ImportsCleanUp(settings); 54 55 return new ICleanUp[] { 56 importsCleanUp 57 }; 58 } 59 60 protected String getActionName() { 61 return ActionMessages.OrganizeImportsAction_error_title; 62 } 63 } 64 | Popular Tags |