[Jiemamy-notify:1527] commit [2739] DiagramEditorからのSqlExporter起動成功。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 26日 (木) 01:37:46 JST


Revision: 2739
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2739
Author:   daisuke_m
Date:     2009-02-26 01:37:46 +0900 (Thu, 26 Feb 2009)

Log Message:
-----------
DiagramEditorからのSqlExporter起動成功。

Modified Paths:
--------------
    artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java

Added Paths:
-----------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/FileSelectWizardPage.java


-------------- next part --------------
Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java
===================================================================
--- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java	2009-02-25 15:40:17 UTC (rev 2738)
+++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java	2009-02-25 16:37:46 UTC (rev 2739)
@@ -83,6 +83,7 @@
 
 	/**
 	 * インスタンスを生成する。
+	 * 
 	 * @param jiemamy インスタンス空間を表すオブジェクト
 	 * @throws IllegalArgumentException 引数に{@code null}を与えた場合
 	 */

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java	2009-02-25 15:40:17 UTC (rev 2738)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/ExportAction.java	2009-02-25 16:37:46 UTC (rev 2739)
@@ -71,8 +71,8 @@
 	 * @throws NullPointerException 引数importerに{@code null}を与えた場合
 	 * @throws IllegalArgumentException その他引数に{@code null}を与えた場合
 	 */
-	public ExportAction(Exporter<ExportConfig> exporter,
-			ExporterWizard<Exporter<ExportConfig>, ExportConfig> wizard, GraphicalViewer viewer, JiemamyEditor editor) {
+	public ExportAction(Exporter<ExportConfig> exporter, ExporterWizard<Exporter<ExportConfig>, ExportConfig> wizard,
+			GraphicalViewer viewer, JiemamyEditor editor) {
 		super(exporter.getName(), viewer);
 		
 		Validate.notNull(wizard);
@@ -82,7 +82,7 @@
 		this.exporter = exporter;
 		this.wizard = wizard;
 		this.editor = editor;
-		logger.debug(LogMarker.LIFECYCLE, "instanciated" + exporter.getName());
+		logger.debug(LogMarker.LIFECYCLE, "instanciated " + exporter.getName());
 	}
 	
 	@Override

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/FileSelectWizardPage.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/FileSelectWizardPage.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/FileSelectWizardPage.java	2009-02-25 16:37:46 UTC (rev 2739)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/26
+ *
+ * This file is part of Jiemamy.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.jiemamy.eclipse.composer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * TODO for daisuke
+ * 
+ * @author daisuke
+ */
+public class FileSelectWizardPage extends WizardPage {
+	
+	private Text text;
+	
+	private Button chkOverwrite;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 */
+	protected FileSelectWizardPage() {
+		super("出力ファイル選択pageName", "出力ファイル選択", (ImageDescriptor) null);
+	}
+	
+	public void createControl(final Composite parent) {
+		Composite composite = new Composite(parent, SWT.NULL);
+		composite.setLayout(new GridLayout(3, false));
+		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		Label label = new Label(composite, SWT.NONE);
+		label.setText("出力先:");
+		
+		text = new Text(composite, SWT.BORDER);
+		text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		text.setText("");
+		
+		Button btnBrowse = new Button(composite, SWT.PUSH);
+		btnBrowse.setText("参照(&B)"); // RESOURCE
+		btnBrowse.addSelectionListener(new SelectionAdapter() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
+				dialog.setFilterNames(new String[] {
+					"SQLファイル(.sql)",
+					"すべて"
+				});
+				dialog.setFilterExtensions(new String[] {
+					"*.sql",
+					"*.*"
+				});
+				dialog.setText("保存先");
+				String fileName = dialog.open();
+				text.setText(fileName);
+			}
+		});
+		
+		chkOverwrite = new Button(composite, SWT.CHECK);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		chkOverwrite.setLayoutData(gd);
+		chkOverwrite.setText("存在したら上書きする");
+		
+		setControl(composite);
+	}
+	
+	/**
+	 * TODO for daisuke
+	 * 
+	 * @return
+	 */
+	public boolean getOverwrite() {
+		return chkOverwrite.getSelection();
+	}
+	
+	public String getPath() {
+		return text.getText();
+	}
+}


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/FileSelectWizardPage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java	2009-02-25 15:40:17 UTC (rev 2738)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/composer/SqlExportWizard.java	2009-02-25 16:37:46 UTC (rev 2739)
@@ -18,15 +18,16 @@
  */
 package org.jiemamy.eclipse.composer;
 
-import org.eclipse.core.resources.IProject;
+import java.io.File;
+
 import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.ui.IFileEditorInput;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
 
+import org.jiemamy.composer.exporter.DefaultSqlExportConfig;
 import org.jiemamy.composer.exporter.SqlExportConfig;
 import org.jiemamy.composer.exporter.SqlExporter;
 import org.jiemamy.eclipse.JiemamyPlugin;
@@ -46,6 +47,10 @@
 	
 	private String defaultFolder = "/";
 	
+	private FileSelectWizardPage page1;
+	
+	private DefaultSqlExportConfig config;
+	
 
 	/**
 	 * Creates a wizard for exporting SQL to the local file system.
@@ -62,24 +67,25 @@
 	@Override
 	public void addPages() {
 		super.addPages();
-		IProject project = input.getFile().getProject();
-		mainPage = new FolderSelectWizardPage(project, "出力先選択", defaultFolder);
-		addPage(mainPage);
+		page1 = new FileSelectWizardPage();
+		addPage(page1);
 	}
 	
 	public SqlExportConfig getConfig() {
-		// TODO Auto-generated method stub
-		return null;
+		return config;
 	}
 	
 	public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
 		setWindowTitle("SQLにエクスポート"); // RESOURCE
-		setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png")); // $NON-NLS-1$
+//		setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png")); // $NON-NLS-1$
 		setNeedsProgressMonitor(true);
 	}
 	
 	@Override
 	public boolean performFinish() {
+		config = new DefaultSqlExportConfig();
+		config.setOutputFile(new File(page1.getPath()));
+		config.setOverwrite(page1.getOverwrite());
 		return true;
 	}
 	



Jiemamy-notify メーリングリストの案内
Back to archive index