+++ /dev/null
-package com.quantum.ui.dialog;
-
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import com.quantum.Messages;
-import com.quantum.QuantumPlugin;
-import com.quantum.util.JarUtil;
-
-/**
- * @author BC
- */
-public class AddDriverDialog extends Dialog {
-
- private FileDialog fileDialog;
-
- private Text driverFileName;
- private Text driverClassName;
-
-
- /**
- * @param parentShell
- */
- public AddDriverDialog(Shell parentShell) {
- super(parentShell);
- }
-
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(Messages.getString(getClass(), "title"));
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog
- */
- protected Control createDialogArea(Composite parent) {
- parent.setLayout(new GridLayout());
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- layout.numColumns = 3;
- GridData fullHorizontal = new GridData(
- GridData.HORIZONTAL_ALIGN_BEGINNING,
- GridData.VERTICAL_ALIGN_BEGINNING,
- true, false);
- composite.setLayoutData(fullHorizontal);
-
-
- this.fileDialog = new FileDialog(composite.getShell(), SWT.OPEN);
- this.fileDialog.setFilterExtensions(new String[] { "*.jar", "*.zip", "*.*" });
- this.fileDialog.setFilterNames(new String[] {
- Messages.getString("BookmarkWizard.JarFiles"),
- Messages.getString("BookmarkWizard.ZipFiles"),
- Messages.getString("BookmarkWizard.AllFiles") });
-
- Label label = new Label(composite, SWT.NULL);
- label.setText(Messages.getString(getClass(), "fileName"));
- this.driverFileName = new Text(composite, SWT.BORDER | SWT.SINGLE);
- fullHorizontal = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL,
- GridData.VERTICAL_ALIGN_BEGINNING,
- true, false);
- fullHorizontal.widthHint = 150;
- this.driverFileName.setLayoutData(fullHorizontal);
-
- Button button = new Button(composite, SWT.PUSH);
- button.setText(Messages.getString(getClass(), "browse"));
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- AddDriverDialog.this.fileDialog.setFilterPath(QuantumPlugin.getDefault()
- .getPreferenceStore().getString(
- "quantum.dialogs.bookmarkwizard.path"));
- String filename = AddDriverDialog.this.fileDialog.open();
- if (filename != null) {
- AddDriverDialog.this.driverFileName.setText(filename);
- QuantumPlugin.getDefault().getPreferenceStore().setValue(
- "quantum.dialogs.bookmarkwizard.path", filename);
- }
- }
- });
-
- label = new Label(composite, SWT.NULL);
- label.setText(Messages.getString(getClass(), "driverClassName"));
- this.driverClassName = new Text(composite, SWT.BORDER | SWT.SINGLE);
- fullHorizontal = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL,
- GridData.VERTICAL_ALIGN_BEGINNING,
- true, false);
- fullHorizontal.widthHint = 150;
- this.driverClassName.setLayoutData(fullHorizontal);
-
- button = new Button(composite, SWT.PUSH);
- button.setText(Messages.getString(getClass(), "browse"));
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- SimpleSelectionDialog dialog = new SimpleSelectionDialog(
- getShell(), "Select a Driver", JarUtil.getAllDriverNames(
- getDriverFile()), QuantumPlugin.getImage("class.gif"));
- if (dialog.open() == SimpleSelectionDialog.OK) {
- AddDriverDialog.this.driverClassName.setText(
- dialog.getSelectedElement());
- }
- }
- });
- return composite;
- }
-
- protected String getDriverFile() {
- return this.driverFileName.getText();
- }
-}
\ No newline at end of file