Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8587f0f91e5bc0898cd59f38d07fdafa018788fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*****************************************************************************
 * Copyright (c) 2010 CEA LIST.
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.dialog;

import java.util.ArrayList;

/**
 * The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys
 */
public class ApplyValueOnPreferenceKeyDialog extends AbstractPreferenceKeyDialog {

	/** The checked key. */
	protected ArrayList<String> checkedKey;

	/**
	 * Instantiates a new apply value on preference key dialog.
	 * 
	 * @param keys
	 *        the keys
	 */
	public ApplyValueOnPreferenceKeyDialog(String[] keys) {
		super(keys);
		checkedKey = new ArrayList<String>();
		// TODO Auto-generated constructor stub
	}

	/**
	 * Gets the key to remove.
	 * 
	 * @return the key to remove
	 */
	public ArrayList<String> getKeyToRemove() {
		return checkedKey;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
	 */
	@Override
	protected void okPressed() {



		for(int i = 0; i < keyTable.getItems().length; i++) {
			if(keyTable.getItems()[i].getChecked()) {
				checkedKey.add((String)keyTable.getItems()[i].getData());
			}
		}
		super.okPressed();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
	 */
	@Override
	protected void cancelPressed() {
		super.cancelPressed();
		checkedKey = new ArrayList<String>();
	}
}

Back to the top