svnno****@sourc*****
svnno****@sourc*****
2009年 5月 13日 (水) 00:26:34 JST
Revision: 3400 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=3400 Author: daisuke_m Date: 2009-05-13 00:26:34 +0900 (Wed, 13 May 2009) Log Message: ----------- [ECL-50] DBインポートダイアログで、前回「接続テスト」に成功した値を保存し、新たにダイアログを開いた時に、その値をあらかじめ入力しておくようにした。 Modified Paths: -------------- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizard.java hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizardPage.java -------------- next part -------------- Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizard.java =================================================================== --- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizard.java 2009-05-10 15:27:52 UTC (rev 3399) +++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizard.java 2009-05-12 15:26:34 UTC (rev 3400) @@ -43,23 +43,25 @@ private DefaultDatabaseImportConfig config; + private IDialogSettings settings; + /** * Creates a wizard for exporting SQL to the local file system. */ public DatabaseImportWizard() { IDialogSettings workbenchSettings = JiemamyUIPlugin.getDefault().getDialogSettings(); - IDialogSettings section = workbenchSettings.getSection("ImportWizard"); // $NON-NLS-1$ - if (section == null) { - section = workbenchSettings.addNewSection("ImportWizard"); // $NON-NLS-1$ + settings = workbenchSettings.getSection("ImportWizard"); + if (settings == null) { + settings = workbenchSettings.addNewSection("ImportWizard"); // $NON-NLS-1$ } - setDialogSettings(section); + setDialogSettings(settings); } @Override public void addPages() { super.addPages(); - page = new DatabaseImportWizardPage(); + page = new DatabaseImportWizardPage(settings); addPage(page); } Modified: hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizardPage.java =================================================================== --- hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizardPage.java 2009-05-10 15:27:52 UTC (rev 3399) +++ hestia/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/composer/DatabaseImportWizardPage.java 2009-05-12 15:26:34 UTC (rev 3400) @@ -33,6 +33,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.wizard.WizardPage; @@ -95,14 +96,18 @@ private ExtensionResolver<Dialect> dialectResolver; + private final IDialogSettings settings; + /** * インスタンスを生成する。 + * @param settings ダイアログセッティング */ - DatabaseImportWizardPage() { + DatabaseImportWizardPage(IDialogSettings settings) { super(Messages.DatabaseImportWizardPage_title, Messages.DatabaseImportWizardPage_title, (ImageDescriptor) null); dialectResolver = JiemamyCorePlugin.getDialectResolver(); setPageComplete(false); + this.settings = settings; } public void createControl(final Composite parent) { @@ -132,14 +137,21 @@ txtUri.setText(StringUtils.defaultIfEmpty(connectionUriTemplate, txtUri.getText())); } }); - // TODO RootModelに設定されたDialectを設定する。 + // THINK RootModelに設定されたDialectを設定する? // cmbDialect.setText(rootModel.getDialectClassName()); + cmbDialect.setText(StringUtils.defaultIfEmpty(settings.get("cmbDialect"), "")); label = new Label(composite, SWT.NONE); label.setText("JDBCドライバjar(&J)"); // RESOURCE lstDriverJars = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI); lstDriverJars.setLayoutData(new GridData(GridData.FILL_BOTH)); + String pathsString = StringUtils.defaultIfEmpty(settings.get("lstDriverJars"), ""); + for (String path : pathsString.split(File.pathSeparator)) { + if (new File(path).exists()) { + lstDriverJars.add(path); + } + } Composite cmpButtons = new Composite(composite, SWT.NULL); cmpButtons.setLayout(new RowLayout(SWT.VERTICAL)); @@ -152,6 +164,10 @@ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; cmbDriverClass.setLayoutData(gd); + if (lstDriverJars.getItemCount() > 0) { + driverListChanged(); + } + cmbDriverClass.setText(StringUtils.defaultIfEmpty(settings.get("cmbDriverClass"), "")); label = new Label(composite, SWT.NONE); label.setText("接続URI(&I)"); // RESOURCE @@ -161,6 +177,7 @@ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; txtUri.setLayoutData(gd); + txtUri.setText(StringUtils.defaultIfEmpty(settings.get("txtUri"), "")); label = new Label(composite, SWT.NONE); label.setText("接続ユーザ名(&U)"); // RESOURCE @@ -171,6 +188,7 @@ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; txtUsername.setLayoutData(gd); + txtUsername.setText(StringUtils.defaultIfEmpty(settings.get("txtUsername"), "")); label = new Label(composite, SWT.NONE); label.setText("接続パスワード(&P)"); // RESOURCE @@ -180,6 +198,7 @@ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; txtPassword.setLayoutData(gd); + txtPassword.setText(StringUtils.defaultIfEmpty(settings.get("txtPassword"), "")); label = new Label(composite, SWT.NONE); label.setText("スキーマ名(&S)"); // RESOURCE @@ -189,6 +208,7 @@ gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; txtSchema.setLayoutData(gd); + txtSchema.setText(StringUtils.defaultIfEmpty(settings.get("txtSchema"), "")); new Label(composite, SWT.NONE); // dummy @@ -197,7 +217,8 @@ btnImportDataSet.setEnabled(false); // TODO 現在サポートしていない gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; - txtSchema.setLayoutData(gd); + btnImportDataSet.setLayoutData(gd); + btnImportDataSet.setSelection(settings.getBoolean("btnImportDataSet")); createTestButton(composite); setControl(composite); @@ -322,6 +343,15 @@ txtSchema.setEnabled(false); btnImportDataSet.setEnabled(false); + settings.put("cmbDialect", cmbDialect.getText()); + settings.put("lstDriverJars", StringUtils.join(lstDriverJars.getItems(), File.pathSeparator)); + settings.put("cmbDriverClass", cmbDriverClass.getText()); + settings.put("txtUri", txtUri.getText()); + settings.put("txtUsername", txtUsername.getText()); + settings.put("txtPassword", txtPassword.getText()); + settings.put("txtSchema", txtSchema.getText()); + settings.put("btnImportDataSet", btnImportDataSet.getSelection()); + setPageComplete(true); }