⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deviceselectdialog.java

📁 eclipseme的最新版本的source,欢迎j2me程序员使用
💻 JAVA
字号:
/**
 * Copyright (c) 2003-2006 Craig Setera
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 */
package eclipseme.ui.internal.dialog;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

import eclipseme.core.model.device.IDevice;
import eclipseme.ui.devices.DeviceSelector;

/**
 * A dialog implementation for use in selecting a device
 * from the registry.
 * <p />
 * Copyright (c) 2003-2006 Craig Setera<br>
 * All Rights Reserved.<br>
 * Licensed under the Eclipse Public License - v 1.0<p/>
 * <br>
 * $Revision: 1.1 $
 * <br>
 * $Date: 2006/02/13 01:16:48 $
 * <br>
 * @author Craig Setera
 */
public class DeviceSelectDialog extends Dialog {
	private DeviceSelector deviceSelector;
	private IDevice selectedDevice;
	
	/**
	 * Construct a dialog
	 * 
	 * @param parentShell
	 */
	public DeviceSelectDialog(Shell parentShell) {
		super(parentShell);
	}

	/**
	 * Construct a dialog
	 * 
	 * @param parentShell
	 */
	public DeviceSelectDialog(IShellProvider parentShell) {
		super(parentShell);
	}

	/**
	 * Return the device selected by the user.
	 * 
	 * @return
	 */
	public IDevice getSelectedDevice() {
		return selectedDevice;
	}

	/**
	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
	 */
	protected void buttonPressed(int buttonId) {
		if (buttonId == IDialogConstants.OK_ID) {
			selectedDevice = deviceSelector.getSelectedDevice();
		}
		
		super.buttonPressed(buttonId);
	}

	/**
	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
	 */
	protected void configureShell(Shell newShell) {
		super.configureShell(newShell);
		newShell.setText("Select Device for Project");
	}

	/**
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
	protected Control createDialogArea(Composite parent) {
		deviceSelector = new DeviceSelector();
		
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayout(new GridLayout(1, true));
		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
		deviceSelector.createContents(parent, false);
		
		return composite;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -