[Jiemamy-notify:1537] commit [2745] GEFコマンドまわりを整備。

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 27日 (金) 18:58:00 JST


Revision: 2745
          http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2745
Author:   daisuke_m
Date:     2009-02-27 18:58:00 +0900 (Fri, 27 Feb 2009)

Log Message:
-----------
GEFコマンドまわりを整備。

Modified Paths:
--------------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateBendpointCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteBendpointCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java

Added Paths:
-----------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/AbstractMovePositionCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmLayoutEditPolicy.java

Removed Paths:
-------------
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditDatabaseModelCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmXYLayoutEditPolicy.java


-------------- next part --------------
Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/AbstractMovePositionCommand.java (from rev 2743, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java)
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/AbstractMovePositionCommand.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/AbstractMovePositionCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2008/08/03
+ *
+ * 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.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+
+import org.jiemamy.Migration;
+import org.jiemamy.eclipse.editor.JiemamyEditor;
+import org.jiemamy.eclipse.utils.EditorUtil;
+import org.jiemamy.model.DiagramPresentationModel;
+import org.jiemamy.model.DiagramPresentations;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.connection.ConnectionAdapter;
+import org.jiemamy.model.geometory.JmPoint;
+import org.jiemamy.model.geometory.JmRectangle;
+import org.jiemamy.model.node.NodeAdapter;
+
+/**
+ * ノードを移動させるGEFコマンドの抽象クラス。
+ * 
+ * @author daisuke
+ */
+public abstract class AbstractMovePositionCommand extends Command {
+	
+	private JmPoint shift;
+	
+
+	/**
+	 * shiftを取得する。
+	 * 
+	 * @return shift
+	 */
+	public JmPoint getShift() {
+		return shift;
+	}
+	
+	/**
+	 * shiftを設定する。
+	 * 
+	 * @param shift shift
+	 */
+	public void setShift(JmPoint shift) {
+		this.shift = shift;
+	}
+	
+	/**
+	 * ダイアグラムを全体的に移動させる。
+	 * 
+	 * @param negative 正方向に移動させる場合{@code true}、負方向の場合{@code false}
+	 */
+	protected void shiftPosition(boolean negative) {
+		JiemamyEditor editor = (JiemamyEditor) EditorUtil.getActiveEditor();
+		RootModel rootModel = editor.getRootModel();
+		
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		for (NodeAdapter node : presentation.getFigureProfiles().keySet()) {
+			// エンティティの移動
+			
+			JmRectangle rect = presentation.getFigureProfiles().get(node).getLayout();
+			JmRectangle newRect;
+			if (negative) {
+				newRect = new JmRectangle(rect.x - shift.x, rect.y - shift.y, rect.width, rect.height);
+			} else {
+				newRect = new JmRectangle(rect.x + shift.x, rect.y + shift.y, rect.width, rect.height);
+			}
+			presentation.getFigureProfiles().get(node).setLayout(newRect);
+			
+			// ベンドポイントの移動
+			for (ConnectionAdapter connection : node.getSourceConnections()) {
+				List<JmPoint> newBendpoints = new ArrayList<JmPoint>();
+				List<JmPoint> oldBendpoints = presentation.getConnectionLayouts().get(connection);
+				for (JmPoint bendpoint : oldBendpoints) {
+					JmPoint newBendpoint;
+					if (negative) {
+						newBendpoint = new JmPoint(bendpoint.x - shift.x, bendpoint.y - shift.y);
+					} else {
+						newBendpoint = new JmPoint(bendpoint.x + shift.x, bendpoint.y + shift.y);
+					}
+					
+					newBendpoints.add(newBendpoint);
+				}
+				presentation.getConnectionLayouts().put(connection, newBendpoints);
+			}
+			// FIXME
+		}
+	}
+}


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

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -21,6 +21,7 @@
 import org.eclipse.gef.commands.Command;
 
 import org.jiemamy.Migration;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
@@ -28,7 +29,7 @@
 import org.jiemamy.model.node.NodeAdapter;
 
 /**
- * ノードの背景色変更コマンド。
+ * ノードの背景色変更GEFコマンド。
  * 
  * @author daisuke
  */
@@ -42,6 +43,8 @@
 	
 	private JmColor oldColor;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -57,6 +60,8 @@
 		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
 		oldColor = presentation.getFigureProfiles().get(nodeAdapter).getColor();
 		this.newColor = newColor;
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -41,11 +41,11 @@
 import org.jiemamy.utils.LogMarker;
 
 /**
- * ノードの位置・サイズ変更コマンド。
+ * ノードの位置・サイズ変更GEFコマンド。
  * 
  * @author daisuke
  */
-public class ChangeNodeConstraintCommand extends MovePositionCommand {
+public class ChangeNodeConstraintCommand extends AbstractMovePositionCommand {
 	
 	private static Logger logger = LoggerFactory.getLogger(ChangeNodeConstraintCommand.class);
 	

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateBendpointCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateBendpointCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateBendpointCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -22,6 +22,7 @@
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.utils.ConvertUtil;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
@@ -29,11 +30,11 @@
 import org.jiemamy.model.geometory.JmPoint;
 
 /**
- * ベンドポイント追加コマンド。
+ * ベンドポイント追加GEFコマンド。
  * 
  * @author daisuke
  */
-public class CreateBendpointCommand extends MovePositionCommand {
+public class CreateBendpointCommand extends AbstractMovePositionCommand {
 	
 	private RootModel rootModel;
 	
@@ -43,6 +44,8 @@
 	
 	private int index;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -62,6 +65,8 @@
 		int shiftX = location.x < 0 ? Math.abs(location.x) : 0;
 		int shiftY = location.y < 0 ? Math.abs(location.y) : 0;
 		setShift(new JmPoint(shiftX, shiftY));
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -19,25 +19,33 @@
 package org.jiemamy.eclipse.editor.command;
 
 import java.util.Collection;
+import java.util.List;
 
 import org.eclipse.draw2d.geometry.Dimension;
 import org.eclipse.gef.commands.Command;
 import org.seasar.eclipse.common.util.LogUtil;
 
+import org.jiemamy.Jiemamy;
+import org.jiemamy.JiemamyFactory;
+import org.jiemamy.ReferenceResolver;
 import org.jiemamy.eclipse.JiemamyPlugin;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.RootModel;
+import org.jiemamy.model.attribute.ColumnModel;
+import org.jiemamy.model.attribute.ColumnRef;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
+import org.jiemamy.model.attribute.constraint.LocalKeyModel;
 import org.jiemamy.model.connection.ConnectionAdapter;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.entity.TableModel;
 import org.jiemamy.model.entity.ViewModel;
 import org.jiemamy.model.node.NodeAdapter;
 import org.jiemamy.model.node.StickyModel;
-import org.jiemamy.utils.model.AttributeUtil;
 import org.jiemamy.utils.model.EntityUtil;
+import org.jiemamy.utils.model.TableUtil;
 
 /**
- * コネクション作成コマンド。
+ * コネクション作成GEFコマンド。
  * 
  * @author daisuke
  */
@@ -55,6 +63,8 @@
 	@SuppressWarnings("unused")
 	private Dimension figureSize;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -67,6 +77,8 @@
 		this.connection = connection;
 		source = connection.getSource();
 		target = connection.getTarget();
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override
@@ -103,12 +115,30 @@
 	@Override
 	public void execute() {
 		if (connection.unwrap() != null) {
-			ForeignKeyModel fk = connection.unwrap();
+			ForeignKeyModel foreignKeyModel = connection.unwrap();
+			Jiemamy jiemamy = foreignKeyModel.getJiemamy();
 //			AttributeUtil.autoDenominate(fk, rootModel);
+			TableModel sourceTable = (TableModel) source.unwrap();
+			TableModel targetTable = (TableModel) target.unwrap();
+			ReferenceResolver referenceResolver = jiemamy.getReferenceResolver();
+			JiemamyFactory factory = jiemamy.getFactory();
 			
-			// TODO その他属性の設定
+			LocalKeyModel key;
+			key = TableUtil.getPrimaryKey(targetTable);
+			if (key == null) {
+				key = TableUtil.getAttributes(targetTable, LocalKeyModel.class).get(0);
+			}
 			
-			((TableModel) source.unwrap()).getAttributes().add(fk);
+			List<ColumnModel> sourceColumns = TableUtil.getColumns(sourceTable);
+			
+			for (ColumnRef columnRef : key.getKeyColumns()) {
+				ColumnModel refColumn = referenceResolver.resolve(columnRef);
+				foreignKeyModel.getReferenceColumns().add(factory.newReference(refColumn));
+				
+				foreignKeyModel.getKeyColumns().add(factory.newReference(sourceColumns.get(0)));
+			}
+			
+			jiemamyFacade.addForeignKey(sourceTable, foreignKeyModel);
 		}
 		
 //		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
@@ -145,9 +175,7 @@
 	@Override
 	public void undo() {
 		if (connection.unwrap() != null) {
-			ForeignKeyModel fk = connection.unwrap();
-			AttributeUtil.autoDenominate(fk, rootModel);
-			((TableModel) source.unwrap()).getAttributes().remove(fk);
+			jiemamyFacade.undo();
 		}
 	}
 }

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -26,14 +26,12 @@
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.utils.ConvertUtil;
 import org.jiemamy.facade.JiemamyViewFacadeImpl;
-import org.jiemamy.model.JiemamyElement;
 import org.jiemamy.model.NodeProfile;
 import org.jiemamy.model.RootModel;
-import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.node.NodeAdapter;
 
 /**
- * ノード作成コマンド。
+ * ノード作成GEFコマンド。
  * 
  * @author daisuke
  */
@@ -43,7 +41,7 @@
 	
 	private RootModel rootModel;
 	
-	private JiemamyElement model;
+	private NodeAdapter nodeAdapter;
 	
 	private Rectangle rectangle;
 	
@@ -54,23 +52,23 @@
 	 * インスタンスを生成する。
 	 * 
 	 * @param rootModel 作成ノードの親モデル
-	 * @param model 作成するノード
+	 * @param nodeAdapter 作成するノード
 	 * @param rectangle 
 	 */
-	public CreateNodeCommand(RootModel rootModel, JiemamyElement model, Rectangle rectangle) {
+	public CreateNodeCommand(RootModel rootModel, NodeAdapter nodeAdapter, Rectangle rectangle) {
 		this.rootModel = rootModel;
-		this.model = model;
+		this.nodeAdapter = nodeAdapter;
 		this.rectangle = rectangle;
-		jiemamyFacade = new JiemamyViewFacadeImpl(model.getJiemamy());
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override
 	public void execute() {
-		if (model instanceof EntityModel) {
-			EntityModel entityModel = (EntityModel) model;
-			jiemamyFacade.addEntity(entityModel);
-			NodeProfile nodeProfile = model.getJiemamy().getFactory().newModel(NodeProfile.class);
-			NodeAdapter nodeAdapter = model.getAdapter(NodeAdapter.class);
+		if (nodeAdapter.unwrap() != null) {
+			jiemamyFacade.addEntity(nodeAdapter.unwrap());
+			
+			NodeProfile nodeProfile = rootModel.getJiemamy().getFactory().newModel(NodeProfile.class);
 			jiemamyFacade.addNodeProfile(Migration.DIAGRAM_INDEX, nodeAdapter, nodeProfile);
 			jiemamyFacade.changeNodeConstraint(Migration.DIAGRAM_INDEX, nodeAdapter, ConvertUtil.convert(rectangle));
 		} else {

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteBendpointCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteBendpointCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteBendpointCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -23,6 +23,7 @@
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.utils.ConvertUtil;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
@@ -30,7 +31,7 @@
 import org.jiemamy.model.geometory.JmPoint;
 
 /**
- * ベンドポイント削除コマンド。
+ * ベンドポイント削除GEFコマンド。
  * 
  * @author daisuke
  */
@@ -44,6 +45,8 @@
 	
 	private int index;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -55,6 +58,8 @@
 		this.rootModel = rootModel;
 		this.relation = relation;
 		this.index = index;
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteConnectionCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -20,6 +20,7 @@
 
 import org.eclipse.gef.commands.Command;
 
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 import org.jiemamy.model.connection.ConnectionAdapter;
@@ -28,7 +29,7 @@
 import org.jiemamy.utils.model.RootModelUtil;
 
 /**
- * コネクション削除コマンド。
+ * コネクション削除GEFコマンド。
  * 
  * @author daisuke
  */
@@ -38,7 +39,7 @@
 	
 	private ConnectionAdapter connection;
 	
-	private TableModel definedTable;
+	private JiemamyViewFacadeImpl jiemamyFacade;
 	
 
 	/**
@@ -48,22 +49,23 @@
 	 * @param connection 削除対象のコネクション
 	 */
 	public DeleteConnectionCommand(RootModel rootModel, ConnectionAdapter connection) {
-		super();
 		this.rootModel = rootModel;
 		this.connection = connection;
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override
 	public void execute() {
 		ForeignKeyModel foreignKeyModel = connection.unwrap();
-		definedTable = AttributeUtil.getDefinedTable(foreignKeyModel);
-		definedTable.getAttributes().remove(foreignKeyModel);
+		TableModel definedTable = AttributeUtil.getDefinedTable(foreignKeyModel);
+		
+		jiemamyFacade.removeForeignKey(definedTable, foreignKeyModel);
 	}
 	
 	@Override
 	public void undo() {
-		ForeignKeyModel foreignKeyModel = connection.unwrap();
-		definedTable.getAttributes().add(foreignKeyModel);
+		jiemamyFacade.undo();
 		RootModelUtil.normalize(rootModel);
 	}
 }

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -23,6 +23,7 @@
 import org.eclipse.gef.commands.Command;
 
 import org.jiemamy.Migration;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
@@ -31,7 +32,7 @@
 import org.jiemamy.utils.CollectionsUtil;
 
 /**
- * ノード削除コマンド。
+ * ノード削除GEFコマンド。
  * 
  * @author daisuke
  */
@@ -49,6 +50,8 @@
 	/** 削除対象のモデルをターゲットとするコネクションのリスト */
 	private List<ConnectionAdapter> targetConnections;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -59,6 +62,7 @@
 	public DeleteNodeCommand(RootModel rootModel, NodeAdapter nodeAdapter) {
 		this.rootModel = rootModel;
 		targetNode = nodeAdapter;
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override
@@ -66,6 +70,11 @@
 		sourceConnections = CollectionsUtil.newArrayList(targetNode.getSourceConnections());
 		targetConnections = CollectionsUtil.newArrayList(targetNode.getTargetConnections());
 		
+		if (targetNode.unwrap() != null) {
+			jiemamyFacade.removeEntity(targetNode.unwrap());
+			
+		}
+		
 		// FIXME
 //		for (ConnectionModel connection : sourceConnections) {
 //			rootModel.removeConnection(connection);

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -32,7 +32,7 @@
 import org.jiemamy.model.node.StickyModel;
 
 /**
- * ノードのダイレクト編集コマンド。
+ * ノードのダイレクト編集GEFコマンド。
  * 
  * @author daisuke
  */

Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditDatabaseModelCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditDatabaseModelCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditDatabaseModelCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -1,69 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/08/03
- *
- * 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.command;
-
-import org.eclipse.gef.commands.Command;
-
-import org.jiemamy.eclipse.editor.dialog.Memento;
-import org.jiemamy.model.RootModel;
-
-/**
- * モデル編集コマンド。
- * 
- * @author daisuke
- */
-public class EditDatabaseModelCommand extends Command {
-	
-	/** 編集対象モデル */
-	private RootModel targetModel;
-	
-	/** 編集前のmemento */
-	private Memento beforeEditMemento;
-	
-	/** 編集後のmemento */
-	private Memento afterEditMemento;
-	
-
-	/**
-	 * インスタンスを生成する。
-	 * 
-	 * @param targetModel 編集対象モデル
-	 * @param beforeEditMemento 編集前のmemento
-	 * @param afterEditMemento 編集後のmemento
-	 */
-	public EditDatabaseModelCommand(RootModel targetModel, Memento beforeEditMemento, Memento afterEditMemento) {
-		
-		super();
-		this.targetModel = targetModel;
-		this.beforeEditMemento = beforeEditMemento;
-		this.afterEditMemento = afterEditMemento;
-	}
-	
-	@Override
-	public void redo() {
-		// 編集後のスナップショットをオリジナルに反映
-//		BeanUtil.copyBean(targetModel, afterEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter());
-	}
-	
-	@Override
-	public void undo() {
-		// 編集前のスナップショットをオリジナルに反映
-//		BeanUtil.copyBean(targetModel, beforeEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter());
-	}
-}

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditForeignKeyModelCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -24,7 +24,7 @@
 import org.jiemamy.model.attribute.constraint.ForeignKeyModel;
 
 /**
- * モデル編集コマンド。
+ * モデル編集GEFコマンド。
  * 
  * @author daisuke
  */

Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java (from rev 2743, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditDatabaseModelCommand.java)
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditRootModelCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2008/08/03
+ *
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+
+import org.jiemamy.eclipse.editor.dialog.Memento;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
+import org.jiemamy.model.RootModel;
+
+/**
+ * モデル編集GEFコマンド。
+ * 
+ * @author daisuke
+ */
+public class EditRootModelCommand extends Command {
+	
+	/** 編集対象モデル */
+	private RootModel rootModel;
+	
+	/** 編集前のmemento */
+	private Memento beforeEditMemento;
+	
+	/** 編集後のmemento */
+	private Memento afterEditMemento;
+	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+
+	/**
+	 * インスタンスを生成する。
+	 * 
+	 * @param rootModel 編集対象モデル
+	 * @param beforeEditMemento 編集前のmemento
+	 * @param afterEditMemento 編集後のmemento
+	 */
+	public EditRootModelCommand(RootModel rootModel, Memento beforeEditMemento, Memento afterEditMemento) {
+		this.rootModel = rootModel;
+		this.beforeEditMemento = beforeEditMemento;
+		this.afterEditMemento = afterEditMemento;
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
+	}
+	
+	@Override
+	public void redo() {
+		// 編集後のスナップショットをオリジナルに反映
+//		BeanUtil.copyBean(targetModel, afterEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter());
+	}
+	
+	@Override
+	public void undo() {
+		// 編集前のスナップショットをオリジナルに反映
+//		BeanUtil.copyBean(targetModel, beforeEditMemento, new DatabaseEditDialogMemento.DatabaseModelFilter());
+	}
+}


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

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditTableModelCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -21,17 +21,18 @@
 import org.eclipse.gef.commands.Command;
 
 import org.jiemamy.eclipse.editor.dialog.Memento;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.entity.TableModel;
 
 /**
- * モデル編集コマンド。
+ * モデル編集GEFコマンド。
  * 
  * @author daisuke
  */
 public class EditTableModelCommand extends Command {
 	
 	/** 編集対象モデル */
-	private TableModel targetModel;
+	private TableModel tableModel;
 	
 	/** 編集前のmemento */
 	private Memento beforeEditMemento;
@@ -39,19 +40,21 @@
 	/** 編集後のmemento */
 	private Memento afterEditMemento;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
 	 * 
-	 * @param targetModel 編集対象モデル
+	 * @param tableModel 編集対象モデル
 	 * @param beforeEditMemento 編集前のmemento
 	 * @param afterEditMemento 編集後のmemento
 	 */
-	public EditTableModelCommand(TableModel targetModel, Memento beforeEditMemento, Memento afterEditMemento) {
-		super();
-		this.targetModel = targetModel;
+	public EditTableModelCommand(TableModel tableModel, Memento beforeEditMemento, Memento afterEditMemento) {
+		this.tableModel = tableModel;
 		this.beforeEditMemento = beforeEditMemento;
 		this.afterEditMemento = afterEditMemento;
+		jiemamyFacade = new JiemamyViewFacadeImpl(tableModel.getJiemamy());
 	}
 	
 	@Override

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/EditViewModelCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -21,17 +21,18 @@
 import org.eclipse.gef.commands.Command;
 
 import org.jiemamy.eclipse.editor.dialog.Memento;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.entity.ViewModel;
 
 /**
- * モデル編集コマンド。
+ * モデル編集GEFコマンド。
  * 
  * @author daisuke
  */
 public class EditViewModelCommand extends Command {
 	
 	/** 編集対象モデル */
-	private ViewModel targetModel;
+	private ViewModel viewModel;
 	
 	/** 編集前のmemento */
 	private Memento beforeEditMemento;
@@ -39,19 +40,21 @@
 	/** 編集後のmemento */
 	private Memento afterEditMemento;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
 	 * 
-	 * @param targetModel 編集対象モデル
+	 * @param viewModel 編集対象モデル
 	 * @param beforeEditMemento 編集前のmemento
 	 * @param afterEditMemento 編集後のmemento
 	 */
-	public EditViewModelCommand(ViewModel targetModel, Memento beforeEditMemento, Memento afterEditMemento) {
-		super();
-		this.targetModel = targetModel;
+	public EditViewModelCommand(ViewModel viewModel, Memento beforeEditMemento, Memento afterEditMemento) {
+		this.viewModel = viewModel;
 		this.beforeEditMemento = beforeEditMemento;
 		this.afterEditMemento = afterEditMemento;
+		jiemamyFacade = new JiemamyViewFacadeImpl(viewModel.getJiemamy());
 	}
 	
 	@Override

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MoveBendpointCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -22,6 +22,7 @@
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.utils.ConvertUtil;
+import org.jiemamy.facade.JiemamyViewFacadeImpl;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.RootModel;
@@ -29,11 +30,11 @@
 import org.jiemamy.model.geometory.JmPoint;
 
 /**
- * ベンドポイント移動コマンド。
+ * ベンドポイント移動GEFコマンド。
  * 
  * @author daisuke
  */
-public class MoveBendpointCommand extends MovePositionCommand {
+public class MoveBendpointCommand extends AbstractMovePositionCommand {
 	
 	private RootModel rootModel;
 	
@@ -45,6 +46,8 @@
 	
 	private int index;
 	
+	private JiemamyViewFacadeImpl jiemamyFacade;
+	
 
 	/**
 	 * インスタンスを生成する。
@@ -68,6 +71,8 @@
 		int shiftX = newLocation.x < 0 ? Math.abs(newLocation.x) : 0;
 		int shiftY = newLocation.y < 0 ? Math.abs(newLocation.y) : 0;
 		setShift(new JmPoint(shiftX, shiftY));
+		
+		jiemamyFacade = new JiemamyViewFacadeImpl(rootModel.getJiemamy());
 	}
 	
 	@Override

Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -1,107 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/08/03
- *
- * 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.command;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.gef.commands.Command;
-
-import org.jiemamy.Migration;
-import org.jiemamy.eclipse.editor.JiemamyEditor;
-import org.jiemamy.eclipse.utils.EditorUtil;
-import org.jiemamy.model.DiagramPresentationModel;
-import org.jiemamy.model.DiagramPresentations;
-import org.jiemamy.model.RootModel;
-import org.jiemamy.model.connection.ConnectionAdapter;
-import org.jiemamy.model.geometory.JmPoint;
-import org.jiemamy.model.geometory.JmRectangle;
-import org.jiemamy.model.node.NodeAdapter;
-
-/**
- * ノードを移動させるコマンドの抽象クラス。
- * 
- * @author daisuke
- */
-public abstract class MovePositionCommand extends Command {
-	
-	private JmPoint shift;
-	
-
-	/**
-	 * shiftを取得する。
-	 * 
-	 * @return shift
-	 */
-	public JmPoint getShift() {
-		return shift;
-	}
-	
-	/**
-	 * shiftを設定する。
-	 * 
-	 * @param shift shift
-	 */
-	public void setShift(JmPoint shift) {
-		this.shift = shift;
-	}
-	
-	/**
-	 * ダイアグラムを全体的に移動させる。
-	 * 
-	 * @param negative 正方向に移動させる場合{@code true}、負方向の場合{@code false}
-	 */
-	protected void shiftPosition(boolean negative) {
-		JiemamyEditor editor = (JiemamyEditor) EditorUtil.getActiveEditor();
-		RootModel rootModel = editor.getRootModel();
-		
-		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
-		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
-		for (NodeAdapter node : presentation.getFigureProfiles().keySet()) {
-			// エンティティの移動
-			
-			JmRectangle rect = presentation.getFigureProfiles().get(node).getLayout();
-			JmRectangle newRect;
-			if (negative) {
-				newRect = new JmRectangle(rect.x - shift.x, rect.y - shift.y, rect.width, rect.height);
-			} else {
-				newRect = new JmRectangle(rect.x + shift.x, rect.y + shift.y, rect.width, rect.height);
-			}
-			presentation.getFigureProfiles().get(node).setLayout(newRect);
-			
-			// ベンドポイントの移動
-			for (ConnectionAdapter connection : node.getSourceConnections()) {
-				List<JmPoint> newBendpoints = new ArrayList<JmPoint>();
-				List<JmPoint> oldBendpoints = presentation.getConnectionLayouts().get(connection);
-				for (JmPoint bendpoint : oldBendpoints) {
-					JmPoint newBendpoint;
-					if (negative) {
-						newBendpoint = new JmPoint(bendpoint.x - shift.x, bendpoint.y - shift.y);
-					} else {
-						newBendpoint = new JmPoint(bendpoint.x + shift.x, bendpoint.y + shift.y);
-					}
-					
-					newBendpoints.add(newBendpoint);
-				}
-				presentation.getConnectionLayouts().put(connection, newBendpoints);
-			}
-			// FIXME
-		}
-	}
-}

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-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -38,7 +38,7 @@
 import org.jiemamy.eclipse.JiemamyPlugin;
 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.editor.editpolicy.JmLayoutEditPolicy;
 import org.jiemamy.eclipse.preference.JiemamyPreference;
 import org.jiemamy.editcommand.Command;
 import org.jiemamy.editcommand.CommandListener;
@@ -146,7 +146,7 @@
 	
 	@Override
 	protected void createEditPolicies() {
-		installEditPolicy(EditPolicy.LAYOUT_ROLE, new JmXYLayoutEditPolicy());
+		installEditPolicy(EditPolicy.LAYOUT_ROLE, new JmLayoutEditPolicy());
 	}
 	
 	@Override

Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmLayoutEditPolicy.java (from rev 2743, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmXYLayoutEditPolicy.java)
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmLayoutEditPolicy.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmLayoutEditPolicy.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2007-2009 Jiemamy Project and the Others.
+ * Created on 2008/08/03
+ *
+ * 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.editpolicy;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+
+import org.jiemamy.eclipse.editor.command.ChangeNodeConstraintCommand;
+import org.jiemamy.eclipse.editor.command.CreateNodeCommand;
+import org.jiemamy.model.JiemamyElement;
+import org.jiemamy.model.RootModel;
+import org.jiemamy.model.entity.EntityModel;
+import org.jiemamy.model.node.NodeAdapter;
+import org.jiemamy.model.node.StickyModel;
+import org.jiemamy.utils.model.EntityUtil;
+
+/**
+ * グラフィックXYレイアウトのEditPolicy。
+ * 
+ * @author daisuke
+ */
+public class JmLayoutEditPolicy extends XYLayoutEditPolicy {
+	
+	@Override
+	protected Command createAddCommand(EditPart child, Object constraint) {
+		return null;
+	}
+	
+	@Override
+	protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
+		RootModel rootModel = (RootModel) getHost().getModel();
+		NodeAdapter nodeAdapter = (NodeAdapter) child.getModel();
+		Rectangle rectangle = (Rectangle) constraint;
+		return new ChangeNodeConstraintCommand(rootModel, nodeAdapter, rectangle, child.getViewer());
+	}
+	
+	@Override
+	protected Command getCreateCommand(CreateRequest request) {
+		JiemamyElement model = (JiemamyElement) request.getNewObject();
+		RootModel rootModel = (RootModel) getHost().getModel();
+		
+		NodeAdapter node = null;
+		if (model instanceof EntityModel) {
+			EntityModel entityModel = (EntityModel) model;
+			EntityUtil.autoDenominate(entityModel, rootModel);
+			node = entityModel.getAdapter(NodeAdapter.class);
+		} else if (model instanceof StickyModel) {
+			StickyModel stickyModel = (StickyModel) model;
+			stickyModel.setContents("default contents"); // TODO
+			node = stickyModel;
+		}
+		
+		return new CreateNodeCommand(rootModel, node, (Rectangle) getConstraintFor(request));
+	}
+	
+	@Override
+	protected Command getDeleteDependantCommand(Request request) {
+		return null;
+	}
+}


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

Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmXYLayoutEditPolicy.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmXYLayoutEditPolicy.java	2009-02-27 04:10:48 UTC (rev 2744)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmXYLayoutEditPolicy.java	2009-02-27 09:58:00 UTC (rev 2745)
@@ -1,77 +0,0 @@
-/*
- * Copyright 2007-2009 Jiemamy Project and the Others.
- * Created on 2008/08/03
- *
- * 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.editpolicy;
-
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
-import org.eclipse.gef.requests.CreateRequest;
-
-import org.jiemamy.eclipse.editor.command.ChangeNodeConstraintCommand;
-import org.jiemamy.eclipse.editor.command.CreateNodeCommand;
-import org.jiemamy.model.JiemamyElement;
-import org.jiemamy.model.RootModel;
-import org.jiemamy.model.entity.EntityModel;
-import org.jiemamy.model.node.NodeAdapter;
-import org.jiemamy.model.node.StickyModel;
-import org.jiemamy.utils.model.EntityUtil;
-
-/**
- * グラフィックXYレイアウトのEditPolicy。
- * 
- * @author daisuke
- */
-public class JmXYLayoutEditPolicy extends XYLayoutEditPolicy {
-	
-	@Override
-	protected Command createAddCommand(EditPart child, Object constraint) {
-		return null;
-	}
-	
-	@Override
-	protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
-		RootModel rootModel = (RootModel) getHost().getModel();
-		NodeAdapter nodeAdapter = (NodeAdapter) child.getModel();
-		Rectangle rectangle = (Rectangle) constraint;
-		return new ChangeNodeConstraintCommand(rootModel, nodeAdapter, rectangle, child.getViewer());
-	}
-	
-	@Override
-	protected Command getCreateCommand(CreateRequest request) {
-		JiemamyElement model = (JiemamyElement) request.getNewObject();
-		RootModel rootModel = (RootModel) getHost().getModel();
-		
-		if (model instanceof EntityModel) {
-			EntityModel entityModel = (EntityModel) model;
-			EntityUtil.autoDenominate(entityModel, rootModel);
-		} else if (model instanceof StickyModel) {
-			StickyModel stickyModel = (StickyModel) model;
-			stickyModel.setContents("default contents");
-		}
-		
-		return new CreateNodeCommand(rootModel, model, (Rectangle) getConstraintFor(request));
-	}
-	
-	@Override
-	protected Command getDeleteDependantCommand(Request request) {
-		return null;
-	}
-}



Jiemamy-notify メーリングリストの案内
Zurück zum Archiv-Index