summaryrefslogtreecommitdiffstats
path: root/plugins/org.yocto.sdk.remotetools/src/org/yocto/sdk/remotetools/actions/SimpleSettingDialog.java
blob: 140d892e20adb1b29ee6eaf1405b5f2f855009ac (plain)
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
/*******************************************************************************
 * Copyright (c) 2010 Intel Corporation.
 * 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:
 * Intel - initial API and implementation
 *******************************************************************************/
package org.yocto.sdk.remotetools.actions;

import org.yocto.sdk.remotetools.Activator;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class SimpleSettingDialog extends BaseSettingDialog {
	
	private final String connPropName;
	/*
	protected SimpleSettingDialog(Shell parentShell, String title, String conn) {
		super(parentShell,title,conn);
	}
	*/
	
	public SimpleSettingDialog(Shell parentShell, String title, String connPropertyName) {
		super(parentShell,
				title,
				Activator.getDefault().getDialogSettings().get(connPropertyName)
				);
		connPropName=connPropertyName;
	}

	@Override
	protected Control createDialogArea(Composite parent) {
		return super.createDialogArea(parent);
	}

	@Override
	protected void okPressed() {
		IDialogSettings settings = Activator.getDefault().getDialogSettings();
	    // store the value of the generate sections checkbox
		if(getCurrentConnection()==null) {
			settings.put(connPropName,
					(String)null);
		}else {
			settings.put(connPropName, 
					getCurrentConnection().getAliasName());
		}
		super.okPressed();
	}	
}