svnno****@sourc*****
svnno****@sourc*****
2009年 2月 13日 (金) 01:23:18 JST
Revision: 2660 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2660 Author: daisuke_m Date: 2009-02-13 01:23:18 +0900 (Fri, 13 Feb 2009) Log Message: ----------- vestaのコネクションまわりのエラーに対処。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.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/editpart/diagram/AbstractRelationEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmBendpointEditPolicy.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmGraphicalNodeEditPolicy.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java 2009-02-12 14:53:32 UTC (rev 2659) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/EventBrokerImpl.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -21,6 +21,9 @@ import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.jiemamy.editcommand.Command; import org.jiemamy.editcommand.CommandListener; import org.jiemamy.editcommand.CommandProcessorImpl; @@ -37,6 +40,8 @@ */ public class EventBrokerImpl implements EventBroker { + private static Logger logger = LoggerFactory.getLogger(EventBrokerImpl.class); + private List<CommandListener> listeners = new ArrayList<CommandListener>(); @@ -45,16 +50,19 @@ */ public void addListener(CommandListener listener) { listeners.add(listener); + logger.debug("CommandListener is registered: " + listener.toString()); } /** * {@inheritDoc} */ public void fireCommandProcess(Command command) { + logger.debug("EventBroker is kicked: " + command.toString()); JiemamyElement target = command.getTarget(); for (CommandListener l : listeners) { if (requireNotification(l, target)) { l.commandProcess(command); + logger.debug("Listener is kicked: " + l.toString()); } } } @@ -64,6 +72,7 @@ */ public void removeListener(CommandListener listener) { listeners.remove(listener); + logger.debug("CommandListener is unregistered: " + listener.toString()); } /** Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java 2009-02-12 14:53:32 UTC (rev 2659) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -39,7 +39,6 @@ import org.jiemamy.exception.JiemamyRuntimeException; import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; -import org.jiemamy.model.RootModelImpl; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.attribute.ColumnRef; import org.jiemamy.model.attribute.ColumnRefImpl; @@ -134,7 +133,7 @@ */ public void process(AddTableCommand newTableCommand) { TableModel table = newTableCommand.getTable(); - RootModelImpl.class.cast(newTableCommand.getTarget()).getEntities().add(table); + RootModel.class.cast(newTableCommand.getTarget()).getEntities().add(table); // 面倒だけど、全部のprocessメソッドに入れる(Interceptorで手を抜きたい)。 eventBroker.fireCommandProcess(newTableCommand); 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-12 14:53:32 UTC (rev 2659) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -24,9 +24,7 @@ import org.eclipse.gef.commands.Command; import org.seasar.eclipse.common.util.LogUtil; -import org.jiemamy.Migration; import org.jiemamy.eclipse.JiemamyPlugin; -import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.connection.ConnectionAdapter; @@ -109,14 +107,14 @@ public void execute() { if (connection.unwrap() != null) { ForeignKeyModel fk = connection.unwrap(); - AttributeUtil.autoDenominate(fk, rootModel); +// AttributeUtil.autoDenominate(fk, rootModel); - // その他属性の設定 + // TODO その他属性の設定 ((TableModel) source.unwrap()).getAttributes().add(fk); } - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).resetBendpoints(connection); +// rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).resetBendpoints(connection); } /** Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractRelationEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractRelationEditPart.java 2009-02-12 14:53:32 UTC (rev 2659) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractRelationEditPart.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.eclipse.draw2d.AbsoluteBendpoint; import org.eclipse.draw2d.geometry.Point; @@ -96,8 +97,12 @@ RootModel rootModel = (RootModel) getRoot().getContents().getModel(); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(Migration.DIAGRAM_INDEX); - - List<JmPoint> bendpoints = diagramPresentationModel.getConnectionLayouts().get(getModel()); + Map<ConnectionAdapter, List<JmPoint>> connectionLayouts = diagramPresentationModel.getConnectionLayouts(); + ConnectionAdapter connection = (ConnectionAdapter) getModel(); + if (connectionLayouts.containsKey(connection) == false) { + diagramPresentationModel.getConnectionLayouts().put(connection, new ArrayList<JmPoint>()); + } + List<JmPoint> bendpoints = diagramPresentationModel.getConnectionLayouts().get(connection); List<AbsoluteBendpoint> constraint = new ArrayList<AbsoluteBendpoint>(bendpoints.size()); for (JmPoint bendpoint : bendpoints) { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-02-12 14:53:32 UTC (rev 2659) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -65,7 +65,8 @@ * {@inheritDoc} */ public void openEditDialog() { - ForeignKeyModel fkModel = (ForeignKeyModel) getModel(); + ConnectionAdapter connection = (ConnectionAdapter) getModel(); + ForeignKeyModel fkModel = connection.unwrap(); // ForeignKeyEditDialog dialog = new ForeignKeyEditDialog(getViewer().getControl().getShell(), fkModel); // @@ -117,7 +118,8 @@ */ private void updateLabel() { RootModel rootModel = (RootModel) getRoot().getContents().getModel(); - ForeignKeyModel fkModel = (ForeignKeyModel) getModel(); + ConnectionAdapter connection = (ConnectionAdapter) getModel(); + ForeignKeyModel fkModel = connection.unwrap(); String labelString = ProcessorUtil.process(rootModel, new LabelStringProcessor(fkModel)); label.setText(labelString); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmBendpointEditPolicy.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmBendpointEditPolicy.java 2009-02-12 14:53:32 UTC (rev 2659) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmBendpointEditPolicy.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -27,6 +27,7 @@ import org.jiemamy.eclipse.editor.command.DeleteBendpointCommand; import org.jiemamy.eclipse.editor.command.MoveBendpointCommand; import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.connection.ConnectionAdapter; /** @@ -44,10 +45,10 @@ Point point = request.getLocation(); getConnection().translateToRelative(point); - RootModel rootModel = (RootModel) getHost().getParent().getModel(); - CreateBendpointCommand command = - new CreateBendpointCommand(rootModel, (ConnectionAdapter) getHost().getModel(), point, request - .getIndex()); + ConnectionAdapter connection = (ConnectionAdapter) getHost().getModel(); + ForeignKeyModel fk = connection.unwrap(); + RootModel rootModel = fk.getJiemamy().getFactory().getRootModel(); + CreateBendpointCommand command = new CreateBendpointCommand(rootModel, connection, point, request.getIndex()); return command; } @@ -57,9 +58,10 @@ */ @Override protected Command getDeleteBendpointCommand(BendpointRequest request) { - RootModel rootModel = (RootModel) getHost().getParent().getModel(); - DeleteBendpointCommand command = - new DeleteBendpointCommand(rootModel, (ConnectionAdapter) getHost().getModel(), request.getIndex()); + ConnectionAdapter connection = (ConnectionAdapter) getHost().getModel(); + ForeignKeyModel fk = connection.unwrap(); + RootModel rootModel = fk.getJiemamy().getFactory().getRootModel(); + DeleteBendpointCommand command = new DeleteBendpointCommand(rootModel, connection, request.getIndex()); return command; } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmGraphicalNodeEditPolicy.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmGraphicalNodeEditPolicy.java 2009-02-12 14:53:32 UTC (rev 2659) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpolicy/JmGraphicalNodeEditPolicy.java 2009-02-12 16:23:18 UTC (rev 2660) @@ -24,6 +24,7 @@ import org.eclipse.gef.requests.ReconnectRequest; import org.jiemamy.eclipse.editor.command.CreateConnectionCommand; +import org.jiemamy.model.JiemamyElement; import org.jiemamy.model.RootModel; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.node.NodeAdapter; @@ -50,9 +51,10 @@ */ @Override protected Command getConnectionCreateCommand(CreateConnectionRequest request) { + JiemamyElement model = (JiemamyElement) request.getNewObject(); RootModel rootModel = (RootModel) getHost().getRoot().getContents().getModel(); CreateConnectionCommand command = - new CreateConnectionCommand(rootModel, (ConnectionAdapter) request.getNewObject()); + new CreateConnectionCommand(rootModel, model.getAdapter(ConnectionAdapter.class)); command.setSource((NodeAdapter) getHost().getModel()); command.setFigureSize(getHostFigure().getSize()); request.setStartCommand(command);