📄 selectuiddialog.java
字号:
/* * Created on 2003-9-16 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */package com.tanghan.plugin.hibernate.popup;import java.util.Iterator;import java.util.List;import java.util.ResourceBundle;import org.eclipse.jface.dialogs.Dialog;import org.eclipse.swt.SWT;import org.eclipse.swt.events.SelectionAdapter;import org.eclipse.swt.events.SelectionEvent;import org.eclipse.swt.layout.GridData;import org.eclipse.swt.layout.GridLayout;import org.eclipse.swt.widgets.Combo;import org.eclipse.swt.widgets.Composite;import org.eclipse.swt.widgets.Control;import org.eclipse.swt.widgets.Label;import org.eclipse.swt.widgets.Shell;import com.tanghan.plugin.TanghanPlugin;/** * @author jerry * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */public class SelectUIDDialog extends Dialog { List fields; /**资源文件*/ private static ResourceBundle res = TanghanPlugin.getDefault().getResourceBundle(); String selectedUID ; /** * @param parentShell */ public SelectUIDDialog(Shell parentShell,final List fields) { super(parentShell); this.fields = fields; selectedUID = (String)(fields.get(0)); } /* (非 Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea(Composite parent) { getShell().setText(res.getString("Tanghan.Plugin.Hibernate.menu.SelectField")); getShell().setMaximized(false); getShell().setMinimized(false); // create the top level composite for the dialog area Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 5; layout.marginWidth = 5; layout.numColumns = 2; composite.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); Label lb = new Label(composite,SWT.NORMAL); lb.setText(res.getString("Tanghan.Plugin.Hibernate.menu.SelectField")); final Combo cb = new Combo(composite,SWT.NORMAL|SWT.READ_ONLY); for(Iterator it = fields.iterator(); it.hasNext(); ){ cb.add((String)(it.next())); } cb.setText(selectedUID); cb.addSelectionListener(new SelectionAdapter(){ public void widgetSelected(SelectionEvent e){ selectedUID = cb.getItem(cb.getSelectionIndex()); } }); //this.createButtonBar() return super.createDialogArea(parent); } /** * @return */ public String getSelectedUID() { return selectedUID; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -