[Jiemamy-notify:1450] commit [2679] エンティティ名・付箋内容のダイレクト編集を実装。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 17日 (火) 02:34:06 JST


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

Log Message:
-----------
エンティティ名・付箋内容のダイレクト編集を実装。

Modified Paths:
--------------
    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/editpart/diagram/AbstractEntityEditPart.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java
    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/figure/EntityFigure.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java

Added Paths:
-----------
    vesta/trunk/jiemamy-vesta/pull.bat
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/EntityDirectEditManager.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyDirectEditManager.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/MultiLineTextCellEditor.java
    vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/NodeCellEditorLocator.java


-------------- next part --------------
Added: vesta/trunk/jiemamy-vesta/pull.bat
===================================================================
--- vesta/trunk/jiemamy-vesta/pull.bat	                        (rev 0)
+++ vesta/trunk/jiemamy-vesta/pull.bat	2009-02-16 17:34:06 UTC (rev 2679)
@@ -0,0 +1,39 @@
+ @ echo off
+
+:CHANGE_DIR
+REM ==== change to root directory of jiemamy-specs
+cd /d %~dp0
+
+IF DEFINED JAVA6_HOME GOTO SET_JAVA_HOME
+
+:JAVA_CHECK
+REM ==== search Java6
+FOR /d %%J IN ("C:\Program Files\Java\jdk1.6.*") DO set JAVA6_HOME=%%J
+IF DEFINED JAVA6_HOME goto SET_JAVA_HOME
+
+echo Java6 not found.
+pause
+exit
+
+:SET_JAVA_HOME
+REM ==== set environment JAVA_HOME as Java6
+set JAVA_HOME=%JAVA6_HOME%
+
+:RUN_MAVEN
+REM ==== build jiemamy
+IF DEFINED MAVEN_OPTS (
+  SET MAVEN_OPTS=%MAVEN_OPTS% -Xmx512M
+) ELSE (
+  SET MAVEN_OPTS=-Xmx512M
+)
+
+cd ..\jiemamy-specs\
+call mvn clean install -Dmaven.test.skip=true
+
+cd ..\jiemamy-artemis\
+call mvn clean install -Dmaven.test.skip=true
+
+cd ..\jiemamy-vesta\
+call mvn clean install -Dmaven.test.skip=true
+
+pause

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-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DirectEditNodeCommand.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -51,8 +51,8 @@
 	 */
 	@Override
 	public void execute() {
-		if (nodeAdapter instanceof EntityModel) {
-			EntityModel entityModel = (EntityModel) nodeAdapter;
+		EntityModel entityModel = nodeAdapter.unwrap();
+		if (entityModel != null) {
 //			if ((displayMode & DatabaseModel.MODE_PHYSICAL) != 0) {
 			oldValue = entityModel.getName();
 			entityModel.setName(newValue);
@@ -66,7 +66,7 @@
 			StickyModel stickyModel = (StickyModel) nodeAdapter;
 			stickyModel.setContents(newValue);
 		} else {
-			throw new IllegalImplementationException(nodeAdapter, "Unknown node");
+			throw new IllegalImplementationException(nodeAdapter, "Unknown node: " + nodeAdapter.getClass());
 		}
 	}
 	

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java	2009-02-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -18,14 +18,19 @@
  */
 package org.jiemamy.eclipse.editor.editpart.diagram;
 
+import org.eclipse.gef.tools.CellEditorLocator;
 import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.TextCellEditor;
 
+import org.jiemamy.eclipse.editor.figure.EntityFigure;
+import org.jiemamy.eclipse.editor.tools.NodeCellEditorLocator;
 import org.jiemamy.model.JiemamyElement;
 import org.jiemamy.model.entity.EntityModel;
 import org.jiemamy.model.node.NodeAdapter;
 
 /**
  * {@link EntityModel}に対するDiagram用EditPart(コントローラ)の抽象クラス。
+ * 
  * @author daisuke
  */
 public abstract class AbstractEntityEditPart extends AbstractJmNodeEditPart {
@@ -53,9 +58,8 @@
 	 */
 	@Override
 	protected DirectEditManager getDirectEditManager() {
-//		EntityFigure figure = (EntityFigure) getFigure();
-//		CellEditorLocator locator = new NodeCellEditorLocator(figure.getEntityNameLabel());
-//		return new EntityDirectEditManager(this, TextCellEditor.class, locator);
-		return null;
+		EntityFigure figure = (EntityFigure) getFigure();
+		CellEditorLocator locator = new NodeCellEditorLocator(figure.getEntityNameLabel());
+		return new EntityDirectEditManager(this, TextCellEditor.class, locator);
 	}
 }

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/EntityDirectEditManager.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/EntityDirectEditManager.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/EntityDirectEditManager.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -0,0 +1,53 @@
+package org.jiemamy.eclipse.editor.editpart.diagram;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.jiemamy.model.entity.EntityModel;
+import org.jiemamy.model.node.NodeAdapter;
+
+/**
+ * エンティティのダイレクト編集マネージャ。
+ * 
+ * @author daisuke
+ */
+public class EntityDirectEditManager extends DirectEditManager {
+	
+	private EntityModel entity;
+	
+
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param source
+	 * @param editorType
+	 * @param locator
+	 */
+	public EntityDirectEditManager(GraphicalEditPart source, Class<? extends CellEditor> editorType,
+			CellEditorLocator locator) {
+		
+		super(source, editorType, locator);
+		NodeAdapter node = (NodeAdapter) source.getModel();
+		entity = node.unwrap();
+	}
+	
+	/**
+	 * Override method.
+	 * 
+	 * @see org.eclipse.gef.tools.DirectEditManager#initCellEditor()
+	 */
+	@Override
+	protected void initCellEditor() {
+		// CellEditorを表示する前に、現在モデルに設定されているテキストをCellEditorの初期値として設定する
+//		RootModel rootModel = (RootModel) getEditPart().getRoot().getContents().getModel();
+//		int displayMode = rootModel.getDisplayMode();
+//		
+//		if ((displayMode & DatabaseModel.MODE_PHYSICAL) != 0) {
+		getCellEditor().setValue(entity.getName());
+//		} else if ((displayMode & DatabaseModel.MODE_LOGICAL) != 0) {
+//			getCellEditor().setValue(entity.getLogicalName());
+//		}
+	}
+}


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

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyDirectEditManager.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyDirectEditManager.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyDirectEditManager.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -0,0 +1,39 @@
+package org.jiemamy.eclipse.editor.editpart.diagram;
+
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.jiemamy.model.node.StickyModel;
+
+/**
+ * 付箋のダイレクト編集マネージャ。
+ * 
+ * @author daisuke
+ */
+public class StickyDirectEditManager extends DirectEditManager {
+	
+	private StickyModel sticky;
+	
+
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param source
+	 * @param editorType
+	 * @param locator
+	 */
+	public StickyDirectEditManager(GraphicalEditPart source, Class<? extends CellEditor> editorType,
+			CellEditorLocator locator) {
+		
+		super(source, editorType, locator);
+		sticky = (StickyModel) source.getModel();
+	}
+	
+	@Override
+	protected void initCellEditor() {
+		// CellEditorを表示する前に、現在モデルに設定されているテキストをCellEditorの初期値として設定する
+		getCellEditor().setValue(sticky.getContents());
+	}
+}


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

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java	2009-02-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -24,16 +24,20 @@
 import org.eclipse.draw2d.Panel;
 import org.eclipse.draw2d.StackLayout;
 import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.tools.CellEditorLocator;
 import org.eclipse.gef.tools.DirectEditManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.jiemamy.Migration;
 import org.jiemamy.eclipse.editor.figure.StickyFigure;
+import org.jiemamy.eclipse.editor.tools.MultiLineTextCellEditor;
+import org.jiemamy.eclipse.editor.tools.NodeCellEditorLocator;
 import org.jiemamy.eclipse.utils.ConvertUtil;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
 import org.jiemamy.model.JiemamyElement;
+import org.jiemamy.model.NodeProfile;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.geometory.JmColor;
 import org.jiemamy.model.geometory.JmRectangle;
@@ -119,10 +123,9 @@
 	 */
 	@Override
 	protected DirectEditManager getDirectEditManager() {
-//		StickyFigure figure = (StickyFigure) getFigure();
-//		CellEditorLocator locator = new NodeCellEditorLocator(figure.getContentsLabel());
-//		return new StickyDirectEditManager(this, MultiLineTextCellEditor.class, locator);
-		return null;
+		StickyFigure figure = (StickyFigure) getFigure();
+		CellEditorLocator locator = new NodeCellEditorLocator(figure.getContentsLabel());
+		return new StickyDirectEditManager(this, MultiLineTextCellEditor.class, locator);
 	}
 	
 	/**
@@ -134,10 +137,15 @@
 		StickyModel stickyModel = (StickyModel) getModel();
 		GraphicalEditPart editPart = (GraphicalEditPart) getParent();
 		
-		DiagramPresentationModel presentation =
-				rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX);
-		JmRectangle constraint = presentation.getFigureProfiles().get(stickyModel).getLayout();
-		editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		NodeProfile nodeProfile = presentation.getFigureProfiles().get(stickyModel);
+		if (nodeProfile == null) {
+			// TODO 表示しない
+		} else {
+			JmRectangle constraint = nodeProfile.getLayout();
+			editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
+		}
 		
 		updateFigure(getFigure());
 	}

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java	2009-02-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -40,6 +40,7 @@
 import org.jiemamy.exception.TooManyElementsException;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
+import org.jiemamy.model.NodeProfile;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.DiagramPresentationModel.DisplayItem;
 import org.jiemamy.model.attribute.ColumnModel;
@@ -128,11 +129,15 @@
 		NodeAdapter node = getModel();
 		GraphicalEditPart editPart = (GraphicalEditPart) getParent();
 		
-		DiagramPresentationModel presentation =
-				rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX);
-		JmRectangle constraint = presentation.getFigureProfiles().get(node).getLayout();
-		editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
-		
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		NodeProfile nodeProfile = presentation.getFigureProfiles().get(node);
+		if (nodeProfile == null) {
+			// TODO 表示しない
+		} else {
+			JmRectangle constraint = nodeProfile.getLayout();
+			editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
+		}
 		updateFigure(getFigure());
 	}
 	
@@ -147,13 +152,20 @@
 		TableFigure tableFigure = (TableFigure) figure;
 		
 		String labelString = LabelStringUtil.getString(rootModel, tableModel, DisplayTarget.NAME, DisplayPlace.FIGURE);
-		DiagramPresentationModel presentation =
-				rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX);
-		JmColor color = presentation.getFigureProfiles().get(node).getColor();
 		
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		NodeProfile nodeProfile = presentation.getFigureProfiles().get(node);
+		
 		tableFigure.setTableName(labelString);
-		tableFigure.setBgColor(ConvertUtil.convert(color));
 		
+		if (nodeProfile == null) {
+			tableFigure.setBgColor(null);
+		} else {
+			JmColor color = nodeProfile.getColor();
+			tableFigure.setBgColor(ConvertUtil.convert(color));
+		}
+		
 		tableFigure.removeAllColumns();
 		
 		for (ColumnModel column : TableUtil.getColumns(tableModel)) {

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 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -37,6 +37,7 @@
 import org.jiemamy.eclipse.utils.ConvertUtil;
 import org.jiemamy.model.DiagramPresentationModel;
 import org.jiemamy.model.DiagramPresentations;
+import org.jiemamy.model.NodeProfile;
 import org.jiemamy.model.RootModel;
 import org.jiemamy.model.entity.ViewModel;
 import org.jiemamy.model.geometory.JmColor;
@@ -122,10 +123,15 @@
 		NodeAdapter node = getModel();
 		GraphicalEditPart editPart = (GraphicalEditPart) getParent();
 		
-		DiagramPresentationModel presentation =
-				rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX);
-		JmRectangle constraint = presentation.getFigureProfiles().get(node).getLayout();
-		editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		NodeProfile nodeProfile = presentation.getFigureProfiles().get(node);
+		if (nodeProfile == null) {
+			// TODO 表示しない
+		} else {
+			JmRectangle constraint = nodeProfile.getLayout();
+			editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint));
+		}
 		
 		updateFigure(getFigure());
 	}
@@ -141,13 +147,19 @@
 		ViewFigure viewFigure = (ViewFigure) figure;
 		
 		String labelString = LabelStringUtil.getString(rootModel, viewModel, DisplayTarget.NAME, DisplayPlace.FIGURE);
-		DiagramPresentationModel presentation =
-				rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX);
-		JmColor color = presentation.getFigureProfiles().get(node).getColor();
+		DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class);
+		DiagramPresentationModel presentation = diagramPresentations.get(Migration.DIAGRAM_INDEX);
+		NodeProfile nodeProfile = presentation.getFigureProfiles().get(node);
 		
 		viewFigure.setEntityName(labelString);
-		viewFigure.setBgColor(ConvertUtil.convert(color));
 		
+		if (nodeProfile == null) {
+			viewFigure.setBgColor(null);
+		} else {
+			JmColor color = nodeProfile.getColor();
+			viewFigure.setBgColor(ConvertUtil.convert(color));
+		}
+		
 		viewFigure.removeAllColumns();
 		
 		// TODO カラム部の表示

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/EntityFigure.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/EntityFigure.java	2009-02-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/EntityFigure.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -85,7 +85,7 @@
 	
 	/**
 	 * 背景色を設定する。
-	 * @param bgColor
+	 * @param bgColor 背景色  {@code null}の場合、デフォルトの色を設定する。
 	 */
 	public void setBgColor(Color bgColor) {
 		setBackgroundColor(bgColor == null ? defaultColor : bgColor);

Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java	2009-02-16 16:10:32 UTC (rev 2678)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/figure/ViewFigure.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -91,7 +91,9 @@
 	/**
 	 * 背景色を設定する。
 	 * 
-	 * @param bgColor 背景色
+	 * 背景色に合わせて、文字色も調整する。
+	 * 
+	 * @param bgColor 背景色  {@code null}の場合、デフォルトの色を設定する。
 	 */
 	@Override
 	public void setBgColor(Color bgColor) {

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/MultiLineTextCellEditor.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/MultiLineTextCellEditor.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/MultiLineTextCellEditor.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -0,0 +1,38 @@
+package org.jiemamy.eclipse.editor.tools;
+
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * multi-lineテキスト用セルエディタ。 編集中に、CTRL+Enterで改行が入力できる。
+ * 
+ * @author daisuke
+ */
+public class MultiLineTextCellEditor extends TextCellEditor {
+	
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param parent
+	 */
+	public MultiLineTextCellEditor(Composite parent) {
+		super(parent, SWT.MULTI);
+	}
+	
+	@Override
+	protected void keyReleaseOccured(KeyEvent keyEvent) {
+		if (keyEvent.character == '\r') { // Return key
+			if (text != null && !text.isDisposed() && (text.getStyle() & SWT.MULTI) != 0) {
+				if ((keyEvent.stateMask & SWT.CTRL) == 0) {
+					fireApplyEditorValue();
+					deactivate();
+				}
+			}
+			return;
+		}
+		super.keyReleaseOccured(keyEvent);
+	}
+	
+}


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

Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/NodeCellEditorLocator.java
===================================================================
--- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/NodeCellEditorLocator.java	                        (rev 0)
+++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/tools/NodeCellEditorLocator.java	2009-02-16 17:34:06 UTC (rev 2679)
@@ -0,0 +1,35 @@
+package org.jiemamy.eclipse.editor.tools;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * TODO describe
+ * 
+ * @author daisuke
+ */
+public class NodeCellEditorLocator implements CellEditorLocator {
+	
+	private IFigure figure;
+	
+
+	/**
+	 * コンストラクタ。
+	 * 
+	 * @param figure
+	 */
+	public NodeCellEditorLocator(IFigure figure) {
+		this.figure = figure;
+	}
+	
+	public void relocate(CellEditor celleditor) {
+		Text text = (Text) celleditor.getControl();
+		/* Point pref = */text.computeSize(-1, -1);
+		Rectangle rect = figure.getBounds().getCopy();
+		figure.translateToAbsolute(rect);
+		text.setBounds(rect.x, rect.y, rect.width, rect.height);
+	}
+}


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



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