]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/actions/MultiOrganizeImportAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / actions / MultiOrganizeImportAction.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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;
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.ui.cleanup.CleanUpOptions;
24 import org.eclipse.jdt.ui.cleanup.ICleanUp;
25
26 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
27 import org.eclipse.jdt.internal.ui.fix.ImportsCleanUp;
28 import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
29
30 public class MultiOrganizeImportAction extends CleanUpAction {
31
32         public MultiOrganizeImportAction(IWorkbenchSite site) {
33                 super(site);
34
35                 setText(ActionMessages.OrganizeImportsAction_label);
36                 setToolTipText(ActionMessages.OrganizeImportsAction_tooltip);
37                 setDescription(ActionMessages.OrganizeImportsAction_description);
38
39                 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION);
40         }
41
42         public MultiOrganizeImportAction(JavaEditor editor) {
43                 super(editor);
44
45                 setText(ActionMessages.OrganizeImportsAction_label);
46                 setToolTipText(ActionMessages.OrganizeImportsAction_tooltip);
47                 setDescription(ActionMessages.OrganizeImportsAction_description);
48
49                 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION);
50         }
51
52         @Override
53         protected ICleanUp[] getCleanUps(ICompilationUnit[] units) {
54                 Map<String, String> settings= new Hashtable<String, String>();
55                 settings.put(CleanUpConstants.ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
56                 ImportsCleanUp importsCleanUp= new ImportsCleanUp(settings);
57
58                 return new ICleanUp[] {
59                         importsCleanUp
60                 };
61         }
62
63         @Override
64         protected String getActionName() {
65                 return ActionMessages.OrganizeImportsAction_error_title;
66         }
67 }