KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > actions > MultiOrganizeImportAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.actions;
12
13 import java.util.Hashtable JavaDoc;
14 import java.util.Map JavaDoc;
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 JavaDoc settings= new Hashtable JavaDoc();
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 JavaDoc getActionName() {
61         return ActionMessages.OrganizeImportsAction_error_title;
62     }
63 }
64
Popular Tags