[Jiemamy-notify:1449] commit [2678] ViewEditDialog整備。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 17日 (火) 01:10:32 JST


Revision: 2678
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2678
Author:   daisuke_m
Date:     2009-02-17 01:10:32 +0900 (Tue, 17 Feb 2009)

Log Message:
-----------
ViewEditDialog整備。

Modified Paths:
--------------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/Messages.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java

Added Paths:
-----------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/foreignkey/
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java
    vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/
    vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages.properties
    vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages_ja.properties

Removed Paths:
-------------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialog.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialogDomainTab.java


-------------- next part --------------
Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialog.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialog.java	2009-02-16 14:56:02 UTC (rev 2677)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialog.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -1,151 +0,0 @@
-package org.jiemamy.eclipse.editor.dialog.root;
-
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-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 org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.Text;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.jiemamy.dialect.Dialect;
-import org.jiemamy.eclipse.JiemamyPlugin;
-import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter;
-import org.jiemamy.eclipse.ui.tab.AbstractTab;
-import org.jiemamy.eclipse.ui.tab.TextEditTab;
-import org.jiemamy.model.RootModel;
-
-/**
- * Database設定ダイアログ。
- * 
- * @author daisuke
- */
-public class DatabaseEditDialog extends Dialog {
-	
-	private static Logger logger = LoggerFactory.getLogger(DatabaseEditDialog.class);
-	
-	/** 編集対象 */
-	private RootModel rootModel;
-	
-	/** スキーマ名入力欄 */
-	private Text txtSchema;
-	
-	/** Dialect選択 */
-	private Combo cmbDialect;
-	
-	/** 開始スクリプト入力欄 */
-	private Text txtBeginScript;
-	
-	/** 終了スクリプト入力欄 */
-	private Text txtEndScript;
-	
-	/** 説明文入力欄 */
-	private Text txtDescription;
-	
-
-	/**
-	 * インスタンスを生成する。
-	 * 
-	 * @param shell
-	 * @param rootModel
-	 */
-	public DatabaseEditDialog(Shell shell, RootModel rootModel) {
-		super(shell);
-		setShellStyle(getShellStyle() | SWT.RESIZE);
-		this.rootModel = rootModel;
-	}
-	
-	@Override
-	protected void constrainShellSize() {
-		Shell shell = getShell();
-		shell.pack();
-		int height = 400;
-		shell.setSize((int) (height * 1.618), height);
-	}
-	
-	@Override
-	protected Control createDialogArea(Composite parent) {
-		getShell().setText(Messages.Dialog_Title);
-		
-		Composite composite = new Composite(parent, SWT.NULL);
-		composite.setLayout(new GridLayout(4, false));
-		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-		
-		Label label;
-		
-		// ---- A-1. スキーマ名
-		label = new Label(composite, SWT.NULL);
-		label.setText(Messages.Label_SchemaName);
-		
-		txtSchema = new Text(composite, SWT.BORDER);
-		txtSchema.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		txtSchema.setText(StringUtils.defaultIfEmpty(rootModel.getSchemaName(), ""));
-		txtSchema.addFocusListener(new TextSelectionAdapter(txtSchema));
-		
-		// ---- A-2. RDBMS
-		label = new Label(composite, SWT.NULL);
-		label.setText(Messages.Label_RDBMS);
-		
-		cmbDialect = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
-		cmbDialect.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-		List<Dialect> dialects = JiemamyPlugin.getDialectResolver().getAllInstance();
-		for (Dialect dialect : dialects) {
-			cmbDialect.add(dialect.toString());
-			logger.debug("installed Dialect: " + dialect.toString());
-			
-		}
-		cmbDialect.setText(rootModel.getDialectClassName());
-		cmbDialect.setVisibleItemCount(20);
-		
-		// ---- B. タブ
-		TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
-		GridData gd = new GridData(GridData.FILL_BOTH);
-		gd.horizontalSpan = 4;
-		tabFolder.setLayoutData(gd);
-		
-		// ---- B-1. Domains
-		AbstractTab domainTab = new DatabaseEditDialogDomainTab(rootModel);
-		domainTab.createControlArea(tabFolder);
-		
-		// ---- B-2. BeginScript
-		AbstractTab beginScriptTab =
-				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getBeginScript(), ""), Messages.Tab_BeginScript);
-		txtBeginScript = (Text) beginScriptTab.createControlArea(tabFolder);
-		
-		// ---- B-3. EndScript
-		AbstractTab endScriptTab =
-				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getEndScript(), ""), Messages.Tab_EndScript);
-		txtEndScript = (Text) endScriptTab.createControlArea(tabFolder);
-		
-		// ---- B-4. Description
-		AbstractTab descriptionTab =
-				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getDescription(), ""), Messages.Tab_Description);
-		txtDescription = (Text) descriptionTab.createControlArea(tabFolder);
-		
-		return composite;
-	}
-	
-	/**
-	 * Override method.
-	 * 
-	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-	 */
-	@Override
-	protected void okPressed() {
-		rootModel.setDialectClassName(cmbDialect.getText());
-		rootModel.setSchemaName(StringUtils.defaultIfEmpty(txtSchema.getText(), null));
-		rootModel.setBeginScript(StringUtils.defaultIfEmpty(txtBeginScript.getText(), null));
-		rootModel.setEndScript(StringUtils.defaultIfEmpty(txtEndScript.getText(), null));
-		rootModel.setDescription(StringUtils.defaultIfEmpty(txtDescription.getText(), null));
-		super.okPressed();
-	}
-}

Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialogDomainTab.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialogDomainTab.java	2009-02-16 14:56:02 UTC (rev 2677)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialogDomainTab.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -1,644 +0,0 @@
-package org.jiemamy.eclipse.editor.dialog.root;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.lang.ObjectUtils;
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MenuAdapter;
-import org.eclipse.swt.events.MenuEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.jiemamy.JiemamyFactory;
-import org.jiemamy.dialect.Dialect;
-import org.jiemamy.eclipse.Images;
-import org.jiemamy.eclipse.JiemamyPlugin;
-import org.jiemamy.eclipse.editor.DisplayPlace;
-import org.jiemamy.eclipse.editor.DisplayTarget;
-import org.jiemamy.eclipse.editor.utils.LabelStringUtil;
-import org.jiemamy.eclipse.ui.AbstractTableViewerEditArea;
-import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter;
-import org.jiemamy.eclipse.ui.tab.AbstractTab;
-import org.jiemamy.editcommand.Command;
-import org.jiemamy.editcommand.CommandListener;
-import org.jiemamy.model.JiemamyElement;
-import org.jiemamy.model.RootModel;
-import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
-import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
-import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
-import org.jiemamy.model.datatype.BuiltinDataType;
-import org.jiemamy.model.datatype.DataType;
-import org.jiemamy.model.datatype.DataTypeCategory;
-import org.jiemamy.model.datatype.DomainModel;
-import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
-import org.jiemamy.utils.CollectionsUtil;
-import org.jiemamy.utils.ListUtils;
-import org.jiemamy.utils.model.DomainUtil;
-import org.jiemamy.utils.model.RootModelUtil;
-
-/**
- * データベース編集ダイアログの「ドメイン」タブ。
- * 
- * @author daisuke
- */
-public class DatabaseEditDialogDomainTab extends AbstractTab {
-	
-	private static Logger logger = LoggerFactory.getLogger(DatabaseEditDialogDomainTab.class);
-	
-	private final RootModel rootModel;
-	
-	private AbstractTableViewerEditArea domainEditArea;
-	
-	private Text txtDomainName;
-	
-	private Combo cmbColumnType;
-	
-	private Text txtColumnSize;
-	
-	private Text txtDescription;
-	
-	private Button chkIsNotNull;
-	
-	private Text txtCheck;
-	
-
-	/**
-	 * コンストラクタ。
-	 * 
-	 * @param rootModel
-	 */
-	public DatabaseEditDialogDomainTab(RootModel rootModel) {
-		this.rootModel = rootModel;
-	}
-	
-	public Composite createControlArea(TabFolder parentTabFolder) {
-		Composite composite = new Composite(parentTabFolder, SWT.NULL);
-		composite.setLayout(new GridLayout(1, false));
-		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-		
-		TabItem tabDomain = new TabItem(parentTabFolder, SWT.NONE);
-		tabDomain.setText(Messages.Tab_Domains);
-		tabDomain.setControl(composite);
-		
-		createDomainTab(composite);
-		domainEditArea.disableEditControls();
-		
-		return composite;
-	}
-	
-	private void createDomainTab(Composite parent) {
-		domainEditArea = new DomainEditTableArea(rootModel);
-		domainEditArea.setAddLabel(Messages.Label_Add);
-		domainEditArea.setInsertLabel(Messages.Label_Insert);
-		domainEditArea.setRemoveLabel(Messages.Label_Remove);
-		domainEditArea.createControlArea(parent);
-	}
-	
-
-	/**
-	 * Domain用ContentProvider
-	 * 
-	 * @author daisuke
-	 */
-	private class DomainContentProvider extends ArrayContentProvider implements CommandListener {
-		
-		private Viewer viewer;
-		
-
-		public void commandExecuted(Command command) {
-			logger.debug("DomainContentProvider: commandExecuted");
-//			if (evt.getPropertyName().equals(RootModel.P_DB_DOMAINS)) {
-			domainEditArea.refreshTable(); // レコードの変更を反映させる。
-//			} else if (evt.getSource() instanceof DefinitionModel) {
-//				domainEditArea.refreshTable(); // レコードの変更を反映させる。
-//				if (evt.getPropertyName().equals(DefinitionModel.P_CREATE)) {
-//					// nothing to do
-//				} else if (evt.getPropertyName().equals(DefinitionModel.P_DELETE)) {
-//					((DefinitionModel) evt.getSource()).removePropertyChangeListener(this);
-//				} else if (evt.getPropertyName().equals(DefinitionModel.P_REVERT)) {
-//					((DefinitionModel) evt.getSource()).addPropertyChangeListener(this);
-//				}
-//			}
-		}
-		
-		@Override
-		public void dispose() {
-			logger.debug("DomainContentProvider: disposed");
-//			rootModel.removePropertyChangeListener(this);
-//			for (DomainModel domain : rootModel.getDomains()) {
-//				domain.removePropertyChangeListener(this);
-//			}
-			super.dispose();
-		}
-		
-		public JiemamyElement getTargetModel() {
-			return (JiemamyElement) viewer.getInput();
-		}
-		
-		@Override
-		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-			logger.debug("DomainContentProvider: input changed");
-			logger.trace("oldInput: " + oldInput);
-			logger.trace("newInput: " + newInput);
-			this.viewer = viewer;
-			if (oldInput != null) {
-//				rootModel.removePropertyChangeListener(this);
-//				for (DomainModel domain : rootModel.getDomains()) {
-//					domain.removePropertyChangeListener(this);
-//				}
-			}
-			if (newInput != null) {
-//				rootModel.addPropertyChangeListener(this);
-//				for (DomainModel domain : rootModel.getDomains()) {
-//					domain.addPropertyChangeListener(this);
-//				}
-			}
-			
-			super.inputChanged(viewer, oldInput, newInput);
-		}
-		
-	}
-	
-	private class DomainEditTableArea extends AbstractTableViewerEditArea {
-		
-		private RootModel rootModel;
-		
-		private Table table;
-		
-
-		/**
-		 * コンストラクタ。
-		 * 
-		 * @param targetModel
-		 */
-		public DomainEditTableArea(RootModel targetModel) {
-			rootModel = targetModel;
-		}
-		
-		@Override
-		protected JiemamyElement addItem() {
-			JiemamyFactory factory = rootModel.getJiemamy().getFactory();
-			DomainModel domainModel = factory.newModel(DomainModel.class);
-			domainModel.setName("DOMAIN_" + (rootModel.getDomains().size() + 1));
-			
-			BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class);
-			builtinDataType.setCategory(DataTypeCategory.INTEGER);
-			domainModel.setDataType(builtinDataType);
-			
-			rootModel.getDomains().add(domainModel);
-			
-			int addedIndex = rootModel.getDomains().indexOf(domainModel);
-			table.setSelection(addedIndex);
-			enableEditControls(addedIndex);
-			txtDomainName.setFocus();
-			
-			return domainModel;
-		}
-		
-		@Override
-		protected void configureDetailEditControls() {
-			txtDomainName.addFocusListener(new TextSelectionAdapter(txtDomainName));
-			txtDomainName.addKeyListener(new KeyAdapter() {
-				
-				@Override
-				public void keyReleased(KeyEvent e) {
-					updateModel();
-				}
-			});
-			cmbColumnType.addSelectionListener(new SelectionAdapter() {
-				
-				@Override
-				public void widgetSelected(SelectionEvent e) {
-					int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
-					updateModel();
-					enableEditDetailControls(domainEditIndex);
-				}
-			});
-			txtColumnSize.addKeyListener(new KeyAdapter() {
-				
-				@Override
-				public void keyReleased(KeyEvent e) {
-					updateModel();
-				}
-			});
-			txtDescription.addFocusListener(new TextSelectionAdapter(txtDescription));
-			txtDescription.addKeyListener(new KeyAdapter() {
-				
-				@Override
-				public void keyReleased(KeyEvent e) {
-					updateModel();
-				}
-			});
-			chkIsNotNull.addSelectionListener(new SelectionAdapter() {
-				
-				@Override
-				public void widgetSelected(SelectionEvent e) {
-					int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
-					updateModel();
-					enableEditDetailControls(domainEditIndex);
-				}
-			});
-			txtCheck.addFocusListener(new TextSelectionAdapter(txtCheck));
-			txtCheck.addKeyListener(new KeyAdapter() {
-				
-				@Override
-				public void keyReleased(KeyEvent e) {
-					updateModel();
-				}
-			});
-		}
-		
-		@Override
-		protected void configureTable() {
-			super.configureTable();
-			table = getTableViewer().getTable();
-			
-			table.addSelectionListener(new SelectionAdapter() {
-				
-				@Override
-				public void widgetSelected(SelectionEvent e) {
-					int index = table.getSelectionIndex();
-					if (index >= 0) {
-						enableEditDetailControls(index);
-					} else {
-						disableEditDetailControls();
-					}
-				}
-			});
-			
-			final Menu menu = new Menu(table);
-			table.setMenu(menu);
-			menu.addMenuListener(new MenuAdapter() {
-				
-				@Override
-				public void menuShown(MenuEvent evt) {
-					for (MenuItem item : menu.getItems()) {
-						item.dispose();
-					}
-					int index = table.getSelectionIndex();
-					if (index == -1) {
-						return;
-					}
-					
-					MenuItem removeItem = new MenuItem(menu, SWT.PUSH);
-					removeItem.setText("&Remove"); // TODO 外部化せよ。
-					removeItem.addSelectionListener(new SelectionAdapter() {
-						
-						@Override
-						public void widgetSelected(SelectionEvent evt) {
-							removeTableSelectionItem();
-						}
-					});
-				}
-			});
-		}
-		
-		@Override
-		protected void configureTableViewer() {
-			TableViewer tableViewer = getTableViewer();
-			tableViewer.setLabelProvider(new DomainLabelProvider());
-			final DomainContentProvider domainContentProvider = new DomainContentProvider();
-			tableViewer.setContentProvider(domainContentProvider);
-			tableViewer.setInput(rootModel.getDomains());
-			
-			rootModel.getJiemamy().getEventBroker().addListener(domainContentProvider);
-			
-			// THINK んーーー?? このタイミングか?
-			tableViewer.getTable().addDisposeListener(new DisposeListener() {
-				
-				public void widgetDisposed(DisposeEvent e) {
-					rootModel.getJiemamy().getEventBroker().removeListener(domainContentProvider);
-				}
-				
-			});
-		}
-		
-		@Override
-		protected Composite createEditDetailControls(Composite parent) {
-			GridData gd;
-			Label label;
-			
-			Group group = new Group(parent, SWT.NULL);
-			group.setText(Messages.Label_GroupTitle_Domain);
-			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			group.setLayout(new GridLayout(1, false));
-			
-			Composite cmpNames = new Composite(group, SWT.NULL);
-			cmpNames.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			GridLayout layout = new GridLayout(2, false);
-			layout.marginHeight = 0;
-			layout.marginWidth = 0;
-			cmpNames.setLayout(layout);
-			
-			label = new Label(cmpNames, SWT.NULL);
-			label.setText(Messages.Label_Domain_Name);
-			
-			txtDomainName = new Text(cmpNames, SWT.BORDER);
-			txtDomainName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			
-			Composite cmpTypes = new Composite(group, SWT.NULL);
-			cmpTypes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			layout = new GridLayout(6, false);
-			layout.marginHeight = 0;
-			layout.marginWidth = 0;
-			cmpTypes.setLayout(layout);
-			
-			label = new Label(cmpTypes, SWT.NULL);
-			label.setText(Messages.Label_Domain_DataType);
-			
-			cmbColumnType = new Combo(cmpTypes, SWT.READ_ONLY);
-			cmbColumnType.setVisibleItemCount(20);
-			
-			Dialect dialect;
-			try {
-				dialect = RootModelUtil.getDialect(rootModel);
-			} catch (ClassNotFoundException e) {
-				// THINK どうにか。。。w
-				dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0);
-			}
-			for (String primitiveType : dialect.getAllDataTypes()) {
-				cmbColumnType.add(primitiveType);
-			}
-			
-			label = new Label(cmpTypes, SWT.NULL);
-			label.setText(Messages.Label_Domain_DataTypeSize);
-			
-			txtColumnSize = new Text(cmpTypes, SWT.BORDER);
-			gd = new GridData();
-			gd.widthHint = 60;
-			txtColumnSize.setLayoutData(gd);
-			txtColumnSize.addFocusListener(new TextSelectionAdapter(txtColumnSize));
-			
-			label = new Label(cmpTypes, SWT.NULL);
-			label.setText(Messages.Label_Domain_CheckConstraint);
-			
-			txtCheck = new Text(cmpTypes, SWT.BORDER);
-			txtCheck.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			
-			Composite cmpDesc = new Composite(group, SWT.NULL);
-			cmpDesc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-			layout = new GridLayout(2, false);
-			layout.marginHeight = 0;
-			layout.marginWidth = 0;
-			cmpDesc.setLayout(layout);
-			label = new Label(cmpDesc, SWT.NULL);
-			label.setText(Messages.Label_Domain_Description);
-			txtDescription = new Text(cmpDesc, SWT.MULTI | SWT.BORDER);
-			txtDescription.setLayoutData(new GridData(GridData.FILL_BOTH));
-			
-			Composite cmpChecks = new Composite(group, SWT.NULL);
-			RowLayout rowLayout = new RowLayout();
-			layout.marginHeight = 0;
-			layout.marginWidth = 0;
-			cmpChecks.setLayout(rowLayout);
-			cmpChecks.setLayoutData(new GridData());
-			
-			chkIsNotNull = new Button(cmpChecks, SWT.CHECK);
-			chkIsNotNull.setText(Messages.Label_Domain_NotNullConstraint);
-			
-			return group;
-		}
-		
-		@Override
-		protected void createTableColumns() {
-			TableColumn colName = new TableColumn(table, SWT.LEFT);
-			colName.setText(Messages.Column_Domain_Name);
-			colName.setWidth(100);
-			
-			TableColumn colType = new TableColumn(table, SWT.LEFT);
-			colType.setText(Messages.Column_Domain_DataType);
-			colType.setWidth(150);
-			
-			TableColumn colNotNull = new TableColumn(table, SWT.LEFT);
-			colNotNull.setText(Messages.Column_Domain_NotNullConstraint);
-			colNotNull.setWidth(50);
-			
-			TableColumn colUnique = new TableColumn(table, SWT.LEFT);
-			colUnique.setText(Messages.Column_Domain_CheckConstraint);
-			colUnique.setWidth(50);
-		}
-		
-		@Override
-		protected void disableEditDetailControls() {
-			txtDomainName.setText("");
-			
-			cmbColumnType.setText("");
-			txtColumnSize.setText("");
-			txtCheck.setText("");
-			txtDescription.setText("");
-			chkIsNotNull.setSelection(false);
-			
-			txtDomainName.setEnabled(false);
-			cmbColumnType.setEnabled(false);
-			txtColumnSize.setEnabled(false);
-			txtCheck.setEnabled(false);
-			txtDescription.setEnabled(false);
-			chkIsNotNull.setEnabled(false);
-		}
-		
-		@Override
-		protected void enableEditDetailControls(int index) {
-			DomainModel domain = rootModel.getDomains().get(index);
-			DataType columnType = domain.getDataType();
-			
-			txtDomainName.setText(domain.getName());
-//			cmbColumnType.setText(rootModel.getDialect().convertToPrimitiveType(columnType).getIdentifier());
-			txtColumnSize.setText(ObjectUtils.toString(domain.getDataType().getAdapter(SizedDataTypeAdapter.class)
-				.getSize(), ""));
-			txtDescription.setText(StringUtils.defaultIfEmpty(domain.getDescription(), ""));
-			chkIsNotNull.setSelection(DomainUtil.hasConstraint(domain, NotNullConstraintModel.class));
-			List<ValueConstraintModel> constraints = domain.getConstraints();
-			for (ValueConstraintModel valueConstraintModel : constraints) {
-				if (valueConstraintModel instanceof CheckConstraintModel) {
-					CheckConstraintModel checkConstraintModel = (CheckConstraintModel) valueConstraintModel;
-					txtCheck.setText(checkConstraintModel.getExpression());
-					break;
-				}
-			}
-			
-			txtDomainName.setEnabled(true);
-			cmbColumnType.setEnabled(true);
-			txtColumnSize.setEnabled(true);
-			txtDescription.setEnabled(true);
-			chkIsNotNull.setEnabled(true);
-			txtCheck.setEnabled(true);
-		}
-		
-		@Override
-		protected JiemamyElement insertTableSelectionItem() {
-			int index = table.getSelectionIndex();
-			
-			JiemamyFactory factory = rootModel.getJiemamy().getFactory();
-			DomainModel domainModel = factory.newModel(DomainModel.class);
-			
-			domainModel.setName("DOMAIN_" + (rootModel.getDomains().size() + 1));
-			
-			if (index < 0 || index > table.getItemCount()) {
-				rootModel.getDomains().add(domainModel);
-			} else {
-				rootModel.getDomains().add(index, domainModel);
-			}
-			
-			int addedIndex = rootModel.getDomains().indexOf(domainModel);
-			table.setSelection(addedIndex);
-			enableEditControls(addedIndex);
-			txtDomainName.setFocus();
-			
-			return domainModel;
-		}
-		
-		@Override
-		protected void moveDownTableSelectionItem() {
-			int index = table.getSelectionIndex();
-			if (index < 0 || index >= table.getItemCount()) {
-				return;
-			}
-			
-			ListUtils.moveUp(rootModel.getDomains(), index);
-			
-			table.setSelection(index + 1);
-			enableEditControls(index + 1);
-		}
-		
-		@Override
-		protected void moveUpTableSelectionItem() {
-			int index = table.getSelectionIndex();
-			if (index <= 0 || index > table.getItemCount()) {
-				return;
-			}
-			
-			ListUtils.moveUp(rootModel.getDomains(), index);
-			
-			table.setSelection(index - 1);
-			enableEditControls(index - 1);
-		}
-		
-		@Override
-		protected JiemamyElement removeTableSelectionItem() {
-			int index = table.getSelectionIndex();
-			if (index < 0 || index > table.getItemCount()) {
-				return null;
-			}
-			DomainModel domainToRemove = rootModel.getDomains().remove(table.getSelectionIndex());
-			TableViewer tableViewer = getTableViewer();
-			tableViewer.remove(domainToRemove);
-			
-			disableEditControls();
-			
-			return domainToRemove;
-		}
-		
-		private void updateModel() {
-			int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
-			int selectionInedx = cmbColumnType.getSelectionIndex();
-			
-			if (domainEditIndex != -1 && selectionInedx != -1) {
-				DomainModel domain = rootModel.getDomains().get(domainEditIndex);
-				domain.setName(txtDomainName.getText());
-				
-//				Dialect dialect = RootModelUtil.getDialect(rootModel);
-//				domain.setDataType(dialect.getDataTypeResolver().resolveDataType(cmbColumnType.getText()));
-//				// THINK ↑ cmbColumnType.getItem(selectionInedx)?
-//				if (dialect.convertToPrimitiveType(domain.getDataType()).getSizeSupportLevel() == DataType.SIZE.NOT_SUPPORTED) {
-//					domain.setSize("");
-//				} else {
-//					domain.setSize(txtColumnSize.getText());
-//				}
-				domain.setDescription(txtDescription.getText());
-				
-				if (chkIsNotNull.getSelection()) {
-					Collection<ValueConstraintModel> toRemove = CollectionsUtil.newArrayList();
-					List<ValueConstraintModel> constraints = domain.getConstraints();
-					for (ValueConstraintModel valueConstraintModel : constraints) {
-						if (valueConstraintModel instanceof NotNullConstraintModel) {
-							toRemove.add(valueConstraintModel);
-						}
-					}
-					constraints.removeAll(toRemove);
-				} else if (DomainUtil.hasConstraint(domain, NotNullConstraintModel.class) == false) {
-					JiemamyFactory factory = rootModel.getJiemamy().getFactory();
-					NotNullConstraintModel nnConstraint = factory.newModel(NotNullConstraintModel.class);
-					domain.getConstraints().add(nnConstraint);
-				}
-			}
-		}
-	}
-	
-	/**
-	 * Domain用LabelProvider
-	 * 
-	 * @author daisuke
-	 */
-	private class DomainLabelProvider implements ITableLabelProvider {
-		
-		public void addListener(ILabelProviderListener listener) {
-			// nothing to do
-		}
-		
-		public void dispose() {
-			// nothing to do
-		}
-		
-		public Image getColumnImage(Object element, int columnIndex) {
-			ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry();
-			DomainModel domain = (DomainModel) element;
-			
-			if (columnIndex == 3) {
-				boolean notNull = DomainUtil.hasConstraint(domain, NotNullConstraintModel.class);
-				return ir.get(notNull ? Images.CHECK_ON : Images.CHECK_OFF);
-			}
-			return null;
-		}
-		
-		public String getColumnText(Object element, int columnIndex) {
-			DomainModel domain = (DomainModel) element;
-			switch (columnIndex) {
-				case 0:
-					return LabelStringUtil.getString(rootModel, domain, DisplayTarget.NAME, DisplayPlace.FIGURE);
-				case 1:
-					return LabelStringUtil.getString(rootModel, domain, DisplayTarget.TYPE, DisplayPlace.FIGURE);
-					
-				default:
-					return "";
-			}
-		}
-		
-		public boolean isLabelProperty(Object element, String property) {
-			return false;
-		}
-		
-		public void removeListener(ILabelProviderListener listener) {
-			// nothing to do
-		}
-	}
-}

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/Messages.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/Messages.java	2009-02-16 14:56:02 UTC (rev 2677)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/Messages.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -21,7 +21,7 @@
 import org.eclipse.osgi.util.NLS;
 
 /**
- * DatabaseEditDialogメッセージリソースクラス。
+ * {@link RootEditDialog}用メッセージリソースクラス。
  * 
  * @author daisuke
  */

Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java (from rev 2676, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialog.java)
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,151 @@
+package org.jiemamy.eclipse.editor.dialog.root;
+
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+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 org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.Text;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.jiemamy.dialect.Dialect;
+import org.jiemamy.eclipse.JiemamyPlugin;
+import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter;
+import org.jiemamy.eclipse.ui.tab.AbstractTab;
+import org.jiemamy.eclipse.ui.tab.TextEditTab;
+import org.jiemamy.model.RootModel;
+
+/**
+ * {@link RootModel}設定ダイアログ。
+ * 
+ * @author daisuke
+ */
+public class RootEditDialog extends Dialog {
+	
+	private static Logger logger = LoggerFactory.getLogger(RootEditDialog.class);
+	
+	/** 編集対象 */
+	private RootModel rootModel;
+	
+	/** スキーマ名入力欄 */
+	private Text txtSchema;
+	
+	/** Dialect選択 */
+	private Combo cmbDialect;
+	
+	/** 開始スクリプト入力欄 */
+	private Text txtBeginScript;
+	
+	/** 終了スクリプト入力欄 */
+	private Text txtEndScript;
+	
+	/** 説明文入力欄 */
+	private Text txtDescription;
+	
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param shell
+	 * @param rootModel
+	 */
+	public RootEditDialog(Shell shell, RootModel rootModel) {
+		super(shell);
+		setShellStyle(getShellStyle() | SWT.RESIZE);
+		this.rootModel = rootModel;
+	}
+	
+	@Override
+	protected void constrainShellSize() {
+		Shell shell = getShell();
+		shell.pack();
+		int height = 400;
+		shell.setSize((int) (height * 1.618), height);
+	}
+	
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		getShell().setText(Messages.Dialog_Title);
+		
+		Composite composite = new Composite(parent, SWT.NULL);
+		composite.setLayout(new GridLayout(4, false));
+		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		Label label;
+		
+		// ---- A-1. スキーマ名
+		label = new Label(composite, SWT.NULL);
+		label.setText(Messages.Label_SchemaName);
+		
+		txtSchema = new Text(composite, SWT.BORDER);
+		txtSchema.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		txtSchema.setText(StringUtils.defaultIfEmpty(rootModel.getSchemaName(), ""));
+		txtSchema.addFocusListener(new TextSelectionAdapter(txtSchema));
+		
+		// ---- A-2. RDBMS
+		label = new Label(composite, SWT.NULL);
+		label.setText(Messages.Label_RDBMS);
+		
+		cmbDialect = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
+		cmbDialect.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		List<Dialect> dialects = JiemamyPlugin.getDialectResolver().getAllInstance();
+		for (Dialect dialect : dialects) {
+			cmbDialect.add(dialect.toString());
+			logger.debug("installed Dialect: " + dialect.toString());
+			
+		}
+		cmbDialect.setText(rootModel.getDialectClassName());
+		cmbDialect.setVisibleItemCount(20);
+		
+		// ---- B. タブ
+		TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
+		GridData gd = new GridData(GridData.FILL_BOTH);
+		gd.horizontalSpan = 4;
+		tabFolder.setLayoutData(gd);
+		
+		// ---- B-1. Domains
+		AbstractTab domainTab = new RootEditDialogDomainTab(rootModel);
+		domainTab.createControlArea(tabFolder);
+		
+		// ---- B-2. BeginScript
+		AbstractTab beginScriptTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getBeginScript(), ""), Messages.Tab_BeginScript);
+		txtBeginScript = (Text) beginScriptTab.createControlArea(tabFolder);
+		
+		// ---- B-3. EndScript
+		AbstractTab endScriptTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getEndScript(), ""), Messages.Tab_EndScript);
+		txtEndScript = (Text) endScriptTab.createControlArea(tabFolder);
+		
+		// ---- B-4. Description
+		AbstractTab descriptionTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(rootModel.getDescription(), ""), Messages.Tab_Description);
+		txtDescription = (Text) descriptionTab.createControlArea(tabFolder);
+		
+		return composite;
+	}
+	
+	/**
+	 * Override method.
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		rootModel.setDialectClassName(cmbDialect.getText());
+		rootModel.setSchemaName(StringUtils.defaultIfEmpty(txtSchema.getText(), null));
+		rootModel.setBeginScript(StringUtils.defaultIfEmpty(txtBeginScript.getText(), null));
+		rootModel.setEndScript(StringUtils.defaultIfEmpty(txtEndScript.getText(), null));
+		rootModel.setDescription(StringUtils.defaultIfEmpty(txtDescription.getText(), null));
+		super.okPressed();
+	}
+}


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java (from rev 2677, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/DatabaseEditDialogDomainTab.java)
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,644 @@
+package org.jiemamy.eclipse.editor.dialog.root;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.dialect.Dialect;
+import org.jiemamy.eclipse.Images;
+import org.jiemamy.eclipse.JiemamyPlugin;
+import org.jiemamy.eclipse.editor.DisplayPlace;
+import org.jiemamy.eclipse.editor.DisplayTarget;
+import org.jiemamy.eclipse.editor.utils.LabelStringUtil;
+import org.jiemamy.eclipse.ui.AbstractTableViewerEditArea;
+import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter;
+import org.jiemamy.eclipse.ui.tab.AbstractTab;
+import org.jiemamy.editcommand.Command;
+import org.jiemamy.editcommand.CommandListener;
+import org.jiemamy.model.JiemamyElement;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.constraint.CheckConstraintModel;
+import org.jiemamy.model.attribute.constraint.NotNullConstraintModel;
+import org.jiemamy.model.attribute.constraint.ValueConstraintModel;
+import org.jiemamy.model.datatype.BuiltinDataType;
+import org.jiemamy.model.datatype.DataType;
+import org.jiemamy.model.datatype.DataTypeCategory;
+import org.jiemamy.model.datatype.DomainModel;
+import org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter;
+import org.jiemamy.utils.CollectionsUtil;
+import org.jiemamy.utils.ListUtils;
+import org.jiemamy.utils.model.DomainUtil;
+import org.jiemamy.utils.model.RootModelUtil;
+
+/**
+ * データベース編集ダイアログの「ドメイン」タブ。
+ * 
+ * @author daisuke
+ */
+public class RootEditDialogDomainTab extends AbstractTab {
+	
+	private static Logger logger = LoggerFactory.getLogger(RootEditDialogDomainTab.class);
+	
+	private final RootModel rootModel;
+	
+	private AbstractTableViewerEditArea domainEditArea;
+	
+	private Text txtDomainName;
+	
+	private Combo cmbColumnType;
+	
+	private Text txtColumnSize;
+	
+	private Text txtDescription;
+	
+	private Button chkIsNotNull;
+	
+	private Text txtCheck;
+	
+
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param rootModel
+	 */
+	public RootEditDialogDomainTab(RootModel rootModel) {
+		this.rootModel = rootModel;
+	}
+	
+	public Composite createControlArea(TabFolder parentTabFolder) {
+		Composite composite = new Composite(parentTabFolder, SWT.NULL);
+		composite.setLayout(new GridLayout(1, false));
+		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		TabItem tabDomain = new TabItem(parentTabFolder, SWT.NONE);
+		tabDomain.setText(Messages.Tab_Domains);
+		tabDomain.setControl(composite);
+		
+		createDomainTab(composite);
+		domainEditArea.disableEditControls();
+		
+		return composite;
+	}
+	
+	private void createDomainTab(Composite parent) {
+		domainEditArea = new DomainEditTableArea(rootModel);
+		domainEditArea.setAddLabel(Messages.Label_Add);
+		domainEditArea.setInsertLabel(Messages.Label_Insert);
+		domainEditArea.setRemoveLabel(Messages.Label_Remove);
+		domainEditArea.createControlArea(parent);
+	}
+	
+
+	/**
+	 * Domain用ContentProvider
+	 * 
+	 * @author daisuke
+	 */
+	private class DomainContentProvider extends ArrayContentProvider implements CommandListener {
+		
+		private Viewer viewer;
+		
+
+		public void commandExecuted(Command command) {
+			logger.debug("DomainContentProvider: commandExecuted");
+//			if (evt.getPropertyName().equals(RootModel.P_DB_DOMAINS)) {
+			domainEditArea.refreshTable(); // レコードの変更を反映させる。
+//			} else if (evt.getSource() instanceof DefinitionModel) {
+//				domainEditArea.refreshTable(); // レコードの変更を反映させる。
+//				if (evt.getPropertyName().equals(DefinitionModel.P_CREATE)) {
+//					// nothing to do
+//				} else if (evt.getPropertyName().equals(DefinitionModel.P_DELETE)) {
+//					((DefinitionModel) evt.getSource()).removePropertyChangeListener(this);
+//				} else if (evt.getPropertyName().equals(DefinitionModel.P_REVERT)) {
+//					((DefinitionModel) evt.getSource()).addPropertyChangeListener(this);
+//				}
+//			}
+		}
+		
+		@Override
+		public void dispose() {
+			logger.debug("DomainContentProvider: disposed");
+//			rootModel.removePropertyChangeListener(this);
+//			for (DomainModel domain : rootModel.getDomains()) {
+//				domain.removePropertyChangeListener(this);
+//			}
+			super.dispose();
+		}
+		
+		public JiemamyElement getTargetModel() {
+			return (JiemamyElement) viewer.getInput();
+		}
+		
+		@Override
+		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+			logger.debug("DomainContentProvider: input changed");
+			logger.trace("oldInput: " + oldInput);
+			logger.trace("newInput: " + newInput);
+			this.viewer = viewer;
+			if (oldInput != null) {
+//				rootModel.removePropertyChangeListener(this);
+//				for (DomainModel domain : rootModel.getDomains()) {
+//					domain.removePropertyChangeListener(this);
+//				}
+			}
+			if (newInput != null) {
+//				rootModel.addPropertyChangeListener(this);
+//				for (DomainModel domain : rootModel.getDomains()) {
+//					domain.addPropertyChangeListener(this);
+//				}
+			}
+			
+			super.inputChanged(viewer, oldInput, newInput);
+		}
+		
+	}
+	
+	private class DomainEditTableArea extends AbstractTableViewerEditArea {
+		
+		private RootModel rootModel;
+		
+		private Table table;
+		
+
+		/**
+		 * コンストラクタ。
+		 * 
+		 * @param targetModel
+		 */
+		public DomainEditTableArea(RootModel targetModel) {
+			rootModel = targetModel;
+		}
+		
+		@Override
+		protected JiemamyElement addItem() {
+			JiemamyFactory factory = rootModel.getJiemamy().getFactory();
+			DomainModel domainModel = factory.newModel(DomainModel.class);
+			domainModel.setName("DOMAIN_" + (rootModel.getDomains().size() + 1));
+			
+			BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class);
+			builtinDataType.setCategory(DataTypeCategory.INTEGER);
+			domainModel.setDataType(builtinDataType);
+			
+			rootModel.getDomains().add(domainModel);
+			
+			int addedIndex = rootModel.getDomains().indexOf(domainModel);
+			table.setSelection(addedIndex);
+			enableEditControls(addedIndex);
+			txtDomainName.setFocus();
+			
+			return domainModel;
+		}
+		
+		@Override
+		protected void configureDetailEditControls() {
+			txtDomainName.addFocusListener(new TextSelectionAdapter(txtDomainName));
+			txtDomainName.addKeyListener(new KeyAdapter() {
+				
+				@Override
+				public void keyReleased(KeyEvent e) {
+					updateModel();
+				}
+			});
+			cmbColumnType.addSelectionListener(new SelectionAdapter() {
+				
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
+					updateModel();
+					enableEditDetailControls(domainEditIndex);
+				}
+			});
+			txtColumnSize.addKeyListener(new KeyAdapter() {
+				
+				@Override
+				public void keyReleased(KeyEvent e) {
+					updateModel();
+				}
+			});
+			txtDescription.addFocusListener(new TextSelectionAdapter(txtDescription));
+			txtDescription.addKeyListener(new KeyAdapter() {
+				
+				@Override
+				public void keyReleased(KeyEvent e) {
+					updateModel();
+				}
+			});
+			chkIsNotNull.addSelectionListener(new SelectionAdapter() {
+				
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
+					updateModel();
+					enableEditDetailControls(domainEditIndex);
+				}
+			});
+			txtCheck.addFocusListener(new TextSelectionAdapter(txtCheck));
+			txtCheck.addKeyListener(new KeyAdapter() {
+				
+				@Override
+				public void keyReleased(KeyEvent e) {
+					updateModel();
+				}
+			});
+		}
+		
+		@Override
+		protected void configureTable() {
+			super.configureTable();
+			table = getTableViewer().getTable();
+			
+			table.addSelectionListener(new SelectionAdapter() {
+				
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int index = table.getSelectionIndex();
+					if (index >= 0) {
+						enableEditDetailControls(index);
+					} else {
+						disableEditDetailControls();
+					}
+				}
+			});
+			
+			final Menu menu = new Menu(table);
+			table.setMenu(menu);
+			menu.addMenuListener(new MenuAdapter() {
+				
+				@Override
+				public void menuShown(MenuEvent evt) {
+					for (MenuItem item : menu.getItems()) {
+						item.dispose();
+					}
+					int index = table.getSelectionIndex();
+					if (index == -1) {
+						return;
+					}
+					
+					MenuItem removeItem = new MenuItem(menu, SWT.PUSH);
+					removeItem.setText("&Remove"); // TODO 外部化せよ。
+					removeItem.addSelectionListener(new SelectionAdapter() {
+						
+						@Override
+						public void widgetSelected(SelectionEvent evt) {
+							removeTableSelectionItem();
+						}
+					});
+				}
+			});
+		}
+		
+		@Override
+		protected void configureTableViewer() {
+			TableViewer tableViewer = getTableViewer();
+			tableViewer.setLabelProvider(new DomainLabelProvider());
+			final DomainContentProvider domainContentProvider = new DomainContentProvider();
+			tableViewer.setContentProvider(domainContentProvider);
+			tableViewer.setInput(rootModel.getDomains());
+			
+			rootModel.getJiemamy().getEventBroker().addListener(domainContentProvider);
+			
+			// THINK んーーー?? このタイミングか?
+			tableViewer.getTable().addDisposeListener(new DisposeListener() {
+				
+				public void widgetDisposed(DisposeEvent e) {
+					rootModel.getJiemamy().getEventBroker().removeListener(domainContentProvider);
+				}
+				
+			});
+		}
+		
+		@Override
+		protected Composite createEditDetailControls(Composite parent) {
+			GridData gd;
+			Label label;
+			
+			Group group = new Group(parent, SWT.NULL);
+			group.setText(Messages.Label_GroupTitle_Domain);
+			group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			group.setLayout(new GridLayout(1, false));
+			
+			Composite cmpNames = new Composite(group, SWT.NULL);
+			cmpNames.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			GridLayout layout = new GridLayout(2, false);
+			layout.marginHeight = 0;
+			layout.marginWidth = 0;
+			cmpNames.setLayout(layout);
+			
+			label = new Label(cmpNames, SWT.NULL);
+			label.setText(Messages.Label_Domain_Name);
+			
+			txtDomainName = new Text(cmpNames, SWT.BORDER);
+			txtDomainName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			
+			Composite cmpTypes = new Composite(group, SWT.NULL);
+			cmpTypes.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			layout = new GridLayout(6, false);
+			layout.marginHeight = 0;
+			layout.marginWidth = 0;
+			cmpTypes.setLayout(layout);
+			
+			label = new Label(cmpTypes, SWT.NULL);
+			label.setText(Messages.Label_Domain_DataType);
+			
+			cmbColumnType = new Combo(cmpTypes, SWT.READ_ONLY);
+			cmbColumnType.setVisibleItemCount(20);
+			
+			Dialect dialect;
+			try {
+				dialect = RootModelUtil.getDialect(rootModel);
+			} catch (ClassNotFoundException e) {
+				// THINK どうにか。。。w
+				dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0);
+			}
+			for (String primitiveType : dialect.getAllDataTypes()) {
+				cmbColumnType.add(primitiveType);
+			}
+			
+			label = new Label(cmpTypes, SWT.NULL);
+			label.setText(Messages.Label_Domain_DataTypeSize);
+			
+			txtColumnSize = new Text(cmpTypes, SWT.BORDER);
+			gd = new GridData();
+			gd.widthHint = 60;
+			txtColumnSize.setLayoutData(gd);
+			txtColumnSize.addFocusListener(new TextSelectionAdapter(txtColumnSize));
+			
+			label = new Label(cmpTypes, SWT.NULL);
+			label.setText(Messages.Label_Domain_CheckConstraint);
+			
+			txtCheck = new Text(cmpTypes, SWT.BORDER);
+			txtCheck.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			
+			Composite cmpDesc = new Composite(group, SWT.NULL);
+			cmpDesc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+			layout = new GridLayout(2, false);
+			layout.marginHeight = 0;
+			layout.marginWidth = 0;
+			cmpDesc.setLayout(layout);
+			label = new Label(cmpDesc, SWT.NULL);
+			label.setText(Messages.Label_Domain_Description);
+			txtDescription = new Text(cmpDesc, SWT.MULTI | SWT.BORDER);
+			txtDescription.setLayoutData(new GridData(GridData.FILL_BOTH));
+			
+			Composite cmpChecks = new Composite(group, SWT.NULL);
+			RowLayout rowLayout = new RowLayout();
+			layout.marginHeight = 0;
+			layout.marginWidth = 0;
+			cmpChecks.setLayout(rowLayout);
+			cmpChecks.setLayoutData(new GridData());
+			
+			chkIsNotNull = new Button(cmpChecks, SWT.CHECK);
+			chkIsNotNull.setText(Messages.Label_Domain_NotNullConstraint);
+			
+			return group;
+		}
+		
+		@Override
+		protected void createTableColumns() {
+			TableColumn colName = new TableColumn(table, SWT.LEFT);
+			colName.setText(Messages.Column_Domain_Name);
+			colName.setWidth(100);
+			
+			TableColumn colType = new TableColumn(table, SWT.LEFT);
+			colType.setText(Messages.Column_Domain_DataType);
+			colType.setWidth(150);
+			
+			TableColumn colNotNull = new TableColumn(table, SWT.LEFT);
+			colNotNull.setText(Messages.Column_Domain_NotNullConstraint);
+			colNotNull.setWidth(50);
+			
+			TableColumn colUnique = new TableColumn(table, SWT.LEFT);
+			colUnique.setText(Messages.Column_Domain_CheckConstraint);
+			colUnique.setWidth(50);
+		}
+		
+		@Override
+		protected void disableEditDetailControls() {
+			txtDomainName.setText("");
+			
+			cmbColumnType.setText("");
+			txtColumnSize.setText("");
+			txtCheck.setText("");
+			txtDescription.setText("");
+			chkIsNotNull.setSelection(false);
+			
+			txtDomainName.setEnabled(false);
+			cmbColumnType.setEnabled(false);
+			txtColumnSize.setEnabled(false);
+			txtCheck.setEnabled(false);
+			txtDescription.setEnabled(false);
+			chkIsNotNull.setEnabled(false);
+		}
+		
+		@Override
+		protected void enableEditDetailControls(int index) {
+			DomainModel domain = rootModel.getDomains().get(index);
+			DataType columnType = domain.getDataType();
+			
+			txtDomainName.setText(domain.getName());
+//			cmbColumnType.setText(rootModel.getDialect().convertToPrimitiveType(columnType).getIdentifier());
+			txtColumnSize.setText(ObjectUtils.toString(domain.getDataType().getAdapter(SizedDataTypeAdapter.class)
+				.getSize(), ""));
+			txtDescription.setText(StringUtils.defaultIfEmpty(domain.getDescription(), ""));
+			chkIsNotNull.setSelection(DomainUtil.hasConstraint(domain, NotNullConstraintModel.class));
+			List<ValueConstraintModel> constraints = domain.getConstraints();
+			for (ValueConstraintModel valueConstraintModel : constraints) {
+				if (valueConstraintModel instanceof CheckConstraintModel) {
+					CheckConstraintModel checkConstraintModel = (CheckConstraintModel) valueConstraintModel;
+					txtCheck.setText(checkConstraintModel.getExpression());
+					break;
+				}
+			}
+			
+			txtDomainName.setEnabled(true);
+			cmbColumnType.setEnabled(true);
+			txtColumnSize.setEnabled(true);
+			txtDescription.setEnabled(true);
+			chkIsNotNull.setEnabled(true);
+			txtCheck.setEnabled(true);
+		}
+		
+		@Override
+		protected JiemamyElement insertTableSelectionItem() {
+			int index = table.getSelectionIndex();
+			
+			JiemamyFactory factory = rootModel.getJiemamy().getFactory();
+			DomainModel domainModel = factory.newModel(DomainModel.class);
+			
+			domainModel.setName("DOMAIN_" + (rootModel.getDomains().size() + 1));
+			
+			if (index < 0 || index > table.getItemCount()) {
+				rootModel.getDomains().add(domainModel);
+			} else {
+				rootModel.getDomains().add(index, domainModel);
+			}
+			
+			int addedIndex = rootModel.getDomains().indexOf(domainModel);
+			table.setSelection(addedIndex);
+			enableEditControls(addedIndex);
+			txtDomainName.setFocus();
+			
+			return domainModel;
+		}
+		
+		@Override
+		protected void moveDownTableSelectionItem() {
+			int index = table.getSelectionIndex();
+			if (index < 0 || index >= table.getItemCount()) {
+				return;
+			}
+			
+			ListUtils.moveUp(rootModel.getDomains(), index);
+			
+			table.setSelection(index + 1);
+			enableEditControls(index + 1);
+		}
+		
+		@Override
+		protected void moveUpTableSelectionItem() {
+			int index = table.getSelectionIndex();
+			if (index <= 0 || index > table.getItemCount()) {
+				return;
+			}
+			
+			ListUtils.moveUp(rootModel.getDomains(), index);
+			
+			table.setSelection(index - 1);
+			enableEditControls(index - 1);
+		}
+		
+		@Override
+		protected JiemamyElement removeTableSelectionItem() {
+			int index = table.getSelectionIndex();
+			if (index < 0 || index > table.getItemCount()) {
+				return null;
+			}
+			DomainModel domainToRemove = rootModel.getDomains().remove(table.getSelectionIndex());
+			TableViewer tableViewer = getTableViewer();
+			tableViewer.remove(domainToRemove);
+			
+			disableEditControls();
+			
+			return domainToRemove;
+		}
+		
+		private void updateModel() {
+			int domainEditIndex = getTableViewer().getTable().getSelectionIndex();
+			int selectionInedx = cmbColumnType.getSelectionIndex();
+			
+			if (domainEditIndex != -1 && selectionInedx != -1) {
+				DomainModel domain = rootModel.getDomains().get(domainEditIndex);
+				domain.setName(txtDomainName.getText());
+				
+//				Dialect dialect = RootModelUtil.getDialect(rootModel);
+//				domain.setDataType(dialect.getDataTypeResolver().resolveDataType(cmbColumnType.getText()));
+//				// THINK ↑ cmbColumnType.getItem(selectionInedx)?
+//				if (dialect.convertToPrimitiveType(domain.getDataType()).getSizeSupportLevel() == DataType.SIZE.NOT_SUPPORTED) {
+//					domain.setSize("");
+//				} else {
+//					domain.setSize(txtColumnSize.getText());
+//				}
+				domain.setDescription(txtDescription.getText());
+				
+				if (chkIsNotNull.getSelection()) {
+					Collection<ValueConstraintModel> toRemove = CollectionsUtil.newArrayList();
+					List<ValueConstraintModel> constraints = domain.getConstraints();
+					for (ValueConstraintModel valueConstraintModel : constraints) {
+						if (valueConstraintModel instanceof NotNullConstraintModel) {
+							toRemove.add(valueConstraintModel);
+						}
+					}
+					constraints.removeAll(toRemove);
+				} else if (DomainUtil.hasConstraint(domain, NotNullConstraintModel.class) == false) {
+					JiemamyFactory factory = rootModel.getJiemamy().getFactory();
+					NotNullConstraintModel nnConstraint = factory.newModel(NotNullConstraintModel.class);
+					domain.getConstraints().add(nnConstraint);
+				}
+			}
+		}
+	}
+	
+	/**
+	 * Domain用LabelProvider
+	 * 
+	 * @author daisuke
+	 */
+	private class DomainLabelProvider implements ITableLabelProvider {
+		
+		public void addListener(ILabelProviderListener listener) {
+			// nothing to do
+		}
+		
+		public void dispose() {
+			// nothing to do
+		}
+		
+		public Image getColumnImage(Object element, int columnIndex) {
+			ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry();
+			DomainModel domain = (DomainModel) element;
+			
+			if (columnIndex == 3) {
+				boolean notNull = DomainUtil.hasConstraint(domain, NotNullConstraintModel.class);
+				return ir.get(notNull ? Images.CHECK_ON : Images.CHECK_OFF);
+			}
+			return null;
+		}
+		
+		public String getColumnText(Object element, int columnIndex) {
+			DomainModel domain = (DomainModel) element;
+			switch (columnIndex) {
+				case 0:
+					return LabelStringUtil.getString(rootModel, domain, DisplayTarget.NAME, DisplayPlace.FIGURE);
+				case 1:
+					return LabelStringUtil.getString(rootModel, domain, DisplayTarget.TYPE, DisplayPlace.FIGURE);
+					
+				default:
+					return "";
+			}
+		}
+		
+		public boolean isLabelProperty(Object element, String property) {
+			return false;
+		}
+		
+		public void removeListener(ILabelProviderListener listener) {
+			// nothing to do
+		}
+	}
+}


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2009/02/16
+ *
+ * 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.editor.dialog.view;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * {@link ViewEditDialog}用メッセージリソースクラス。
+ * 
+ * @author daisuke
+ */
+public class Messages extends NLS {
+	
+	/** Dialogのタイトル */
+	public static String Dialog_Title;
+	
+	/** ビュー編集コントロールグループタイトル */
+	public static String Message;
+	
+	/** ビュー名ラベル */
+	public static String Label_View_Name;
+	
+	/** ビュー名ラベル */
+	public static String Label_View_LogicalName;
+	
+	/** 定義タブ */
+	public static String Tab_View_Definition;
+	
+	/** 開始スクリプトタブ */
+	public static String Tab_View_BeginScript;
+	
+	/** 終了スクリプトタブ */
+	public static String Tab_View_EndScript;
+	
+	/** 説明タブ */
+	public static String Tab_View_Description;
+	
+	private static final String BUNDLE_NAME = Messages.class.getName().toLowerCase();
+	
+	static {
+		reloadMessages();
+	}
+	
+
+	/**
+	 * load message values from bundle file
+	 */
+	public static void reloadMessages() {
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+	
+}


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,174 @@
+package org.jiemamy.eclipse.editor.dialog.view;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.ColorDialog;
+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 org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.Text;
+
+import org.jiemamy.eclipse.Images;
+import org.jiemamy.eclipse.JiemamyPlugin;
+import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter;
+import org.jiemamy.eclipse.ui.tab.AbstractTab;
+import org.jiemamy.eclipse.ui.tab.TextEditTab;
+import org.jiemamy.model.entity.ViewModel;
+
+/**
+ * View設定ダイアログ
+ * 
+ * @author daisuke
+ */
+public class ViewEditDialog extends Dialog {
+	
+	private ViewModel viewModel;
+	
+	private Text txtName;
+	
+	private Text txtLogicalName;
+	
+	private Text txtDefinition;
+	
+	private Text txtBeginScript;
+	
+	private Text txtEndScript;
+	
+	private Text txtDescription;
+	
+
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param shell
+	 * @param viewModel
+	 */
+	public ViewEditDialog(Shell shell, ViewModel viewModel) {
+		super(shell);
+		setShellStyle(getShellStyle() | SWT.RESIZE);
+		
+		this.viewModel = viewModel;
+	}
+	
+	@Override
+	protected void constrainShellSize() {
+		Shell shell = getShell();
+		shell.pack();
+		int height = 370;
+		shell.setSize((int) (height * 1.618), height);
+	}
+	
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		getShell().setText(Messages.Dialog_Title);
+		
+		Composite composite = new Composite(parent, SWT.NULL);
+		composite.setLayout(new GridLayout(6, false));
+		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+		
+		// ---- A-1. ビュー名
+		Label label = new Label(composite, SWT.NULL);
+		label.setText(Messages.Label_View_Name);
+		
+		txtName = new Text(composite, SWT.BORDER);
+		txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		txtName.setText(StringUtils.defaultIfEmpty(viewModel.getName(), ""));
+		txtName.addFocusListener(new TextSelectionAdapter(txtName));
+		
+		// ---- A-2. 論理名
+		label = new Label(composite, SWT.NULL);
+		label.setText(Messages.Label_View_LogicalName);
+		
+		txtLogicalName = new Text(composite, SWT.BORDER);
+		txtLogicalName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+		txtLogicalName.setText(StringUtils.defaultIfEmpty(viewModel.getLogicalName(), ""));
+		txtLogicalName.addFocusListener(new TextSelectionAdapter(txtLogicalName));
+		
+		// ---- A-3. 色
+		ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry();
+		
+		Button btnColor = new Button(composite, SWT.PUSH);
+		btnColor.setImage(ir.get(Images.ICON_COLOR_PALETTE));
+		btnColor.addSelectionListener(new SelectionAdapter() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent evt) {
+				ColorDialog colorDialog = new ColorDialog(getShell(), SWT.NULL);
+				RGB rgb = colorDialog.open();
+				if (rgb != null) {
+					// TODO
+//					viewModel.setBgColor(new JmColor(rgb.red, rgb.green, rgb.blue));
+				}
+			}
+		});
+		
+		Button btnDefaultColor = new Button(composite, SWT.PUSH);
+		btnDefaultColor.setText("default color"); // TODO 外部化せよ
+		btnDefaultColor.addSelectionListener(new SelectionAdapter() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent evt) {
+				// TODO
+//				viewModel.setBgColor(null);
+			}
+		});
+		
+		// ---- A-4. ラベル
+		label = new Label(composite, SWT.NULL);
+		label.setText(Messages.Message);
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 6;
+		label.setLayoutData(gd);
+		
+		// ---- B. タブ
+		TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
+		gd = new GridData(GridData.FILL_BOTH);
+		gd.horizontalSpan = 6;
+		tabFolder.setLayoutData(gd);
+		
+		// ---- B-1. Definition
+		AbstractTab definitionTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(viewModel.getDefinition(), ""), Messages.Tab_View_Definition);
+		txtDefinition = (Text) definitionTab.createControlArea(tabFolder);
+		
+		// ---- B-2. BeginScript
+		AbstractTab beginScriptTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(viewModel.getBeginScript(), ""),
+						Messages.Tab_View_BeginScript);
+		txtBeginScript = (Text) beginScriptTab.createControlArea(tabFolder);
+		
+		// ---- B-3. EndScript
+		AbstractTab endScriptTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(viewModel.getEndScript(), ""), Messages.Tab_View_EndScript);
+		txtEndScript = (Text) endScriptTab.createControlArea(tabFolder);
+		
+		// ---- B-4. Description
+		AbstractTab descriptionTab =
+				new TextEditTab(StringUtils.defaultIfEmpty(viewModel.getDescription(), ""),
+						Messages.Tab_View_Description);
+		txtDescription = (Text) descriptionTab.createControlArea(tabFolder);
+		
+		return composite;
+	}
+	
+	@Override
+	protected void okPressed() {
+		viewModel.setName(txtName.getText());
+		viewModel.setLogicalName(StringUtils.defaultIfEmpty(txtLogicalName.getText(), null));
+		viewModel.setDefinition(StringUtils.defaultIfEmpty(txtDefinition.getText(), null));
+		viewModel.setBeginScript(StringUtils.defaultIfEmpty(txtBeginScript.getText(), null));
+		viewModel.setEndScript(StringUtils.defaultIfEmpty(txtEndScript.getText(), null));
+		viewModel.setDescription(StringUtils.defaultIfEmpty(txtDescription.getText(), null));
+		super.okPressed();
+	}
+}


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java	2009-02-16 14:56:02 UTC (rev 2677)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -36,7 +36,7 @@
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.JiemamyPlugin;
-import org.jiemamy.eclipse.editor.dialog.root.DatabaseEditDialog;
+import org.jiemamy.eclipse.editor.dialog.root.RootEditDialog;
 import org.jiemamy.eclipse.editor.editpart.EditDialogSupport;
 import org.jiemamy.eclipse.editor.editpolicy.JmXYLayoutEditPolicy;
 import org.jiemamy.eclipse.preference.JiemamyPreference;
@@ -129,7 +129,7 @@
 		logger.debug("openEditDialog");
 		RootModel rootModel = getModel();
 		
-		DatabaseEditDialog dialog = new DatabaseEditDialog(getViewer().getControl().getShell(), rootModel);
+		RootEditDialog dialog = new RootEditDialog(getViewer().getControl().getShell(), rootModel);
 //		
 //		// 編集前のスナップショットを保存
 //		Memento beforeEditMemento = dialog.createMemento();

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java	2009-02-16 14:56:02 UTC (rev 2677)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java	2009-02-16 16:10:32 UTC (rev 2678)
@@ -24,12 +24,14 @@
 import org.eclipse.draw2d.Panel;
 import org.eclipse.draw2d.StackLayout;
 import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.jface.dialogs.Dialog;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.editor.DisplayPlace;
 import org.jiemamy.eclipse.editor.DisplayTarget;
+import org.jiemamy.eclipse.editor.dialog.view.ViewEditDialog;
 import org.jiemamy.eclipse.editor.figure.ViewFigure;
 import org.jiemamy.eclipse.editor.utils.LabelStringUtil;
 import org.jiemamy.eclipse.utils.ConvertUtil;
@@ -70,22 +72,22 @@
 		NodeAdapter node = getModel();
 		ViewModel viewModel = (ViewModel) node.unwrap();
 		
-//		ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel);
+		ViewEditDialog dialog = new ViewEditDialog(getViewer().getControl().getShell(), viewModel);
 //		
 //		// 編集前のスナップショットを保存
 //		Memento beforeEditMemento = dialog.createMemento(); // 編集前のスナップショットを保存
 //		
-//		if (dialog.open() == Dialog.OK) {
+		if (dialog.open() == Dialog.OK) {
 //			// 編集後のスナップショットを保存
 //			Memento afterEditMemento = dialog.createMemento();
 //			
 //			GraphicalViewer viewer = (GraphicalViewer) getViewer();
 //			viewer.getEditDomain().getCommandStack().execute(
 //					new EditViewModelCommand(viewModel, beforeEditMemento, afterEditMemento));
-//		} else {
+		} else {
 //			// 編集前にロールバック
 //			dialog.setMemento(beforeEditMemento);
-//		}
+		}
 	}
 	
 	/**

Added: vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages.properties
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages.properties	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages.properties	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,8 @@
+Dialog_Title = View Information
+Message = <<<TODO Message>>>
+Label_View_Name = View Name
+Label_View_LogicalName = Logical Name
+Tab_View_Definition = Definition
+Tab_View_BeginScript = Begin Script
+Tab_View_EndScript = End Script
+Tab_View_Description = Description


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages_ja.properties
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages_ja.properties	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages_ja.properties	2009-02-16 16:10:32 UTC (rev 2678)
@@ -0,0 +1,8 @@
+Dialog_Title = \u30d3\u30e5\u30fc\u60c5\u5831\u7de8\u96c6
+Message = <<<TODO Message>>>
+Label_View_Name = \u30d3\u30e5\u30fc\u540d
+Label_View_LogicalName = \u8ad6\u7406\u540d
+Tab_View_Definition = \u5b9a\u7fa9
+Tab_View_BeginScript = \u958b\u59cb\u30b9\u30af\u30ea\u30d7\u30c8
+Tab_View_EndScript = \u7d42\u4e86\u30b9\u30af\u30ea\u30d7\u30c8
+Tab_View_Description = \u8aac\u660e


Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/resources/org/jiemamy/eclipse/editor/dialog/view/messages_ja.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain



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