]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-after/ui/org/eclipse/jdt/internal/ui/fix/SaveActionSelectionDialog.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui / org / eclipse / jdt / internal / ui / fix / SaveActionSelectionDialog.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2007, 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 *******************************************************************************/
11package org.eclipse.jdt.internal.ui.fix;
12
13import java.util.Map;
14
15import org.eclipse.swt.SWT;
16import org.eclipse.swt.layout.GridData;
17import org.eclipse.swt.layout.GridLayout;
18import org.eclipse.swt.widgets.Composite;
19import org.eclipse.swt.widgets.Label;
20import org.eclipse.swt.widgets.Shell;
21
22import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
23import org.eclipse.jdt.internal.corext.fix.CleanUpRegistry.CleanUpTabPageDescriptor;
24import org.eclipse.jdt.internal.corext.util.Messages;
25
26import org.eclipse.jdt.internal.ui.JavaPlugin;
27import org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpTabPage;
28
29public class SaveActionSelectionDialog extends CleanUpSelectionDialog {
30
31 private static final String PREFERENCE_KEY= "clean_up_save_particpant_modify_dialog"; //$NON-NLS-1$
32
33 public SaveActionSelectionDialog(Shell parentShell, Map<String, String> settings) {
34 super(parentShell, settings, SaveParticipantMessages.CleanUpSaveParticipantPreferenceConfiguration_CleanUpSaveParticipantConfiguration_Title);
35 }
36
37 @Override
38 protected NamedCleanUpTabPage[] createTabPages(Map<String, String> workingValues) {
39 CleanUpTabPageDescriptor[] descriptors= JavaPlugin.getDefault().getCleanUpRegistry().getCleanUpTabPageDescriptors(CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS);
40
41 NamedCleanUpTabPage[] result= new NamedCleanUpTabPage[descriptors.length];
42
43 for (int i= 0; i < descriptors.length; i++) {
44 String name= descriptors[i].getName();
45 CleanUpTabPage page= descriptors[i].createTabPage();
46
47 page.generated_4403476912531791142(workingValues, this);
48
49 result[i]= new NamedCleanUpTabPage(name, page);
50 }
51
52 return result;
53 }
54
55 @Override
56 protected void createButtonsForButtonBar(Composite parent) {
57 GridLayout layout= (GridLayout)parent.getLayout();
58 layout.numColumns++;
59 layout.makeColumnsEqualWidth= false;
60 Label label= new Label(parent, SWT.NONE);
61 GridData data= new GridData();
62 data.widthHint= layout.horizontalSpacing;
63 label.setLayoutData(data);
64 super.createButtonsForButtonBar(parent);
65 }
66
67 @Override
68 protected String getEmptySelectionMessage() {
69 return SaveParticipantMessages.CleanUpSaveParticipantConfigurationModifyDialog_SelectAnAction_Error;
70 }
71
72 @Override
73 protected String getSelectionCountMessage(int selectionCount, int size) {
74 return Messages.format(SaveParticipantMessages.CleanUpSaveParticipantConfigurationModifyDialog_XofYSelected_Label, new Object[] {new Integer(selectionCount), new Integer(size)});
75 }
76
77 @Override
78 protected String getPreferenceKeyPrefix() {
79 return PREFERENCE_KEY;
80 }
81}