svnno****@sourc*****
svnno****@sourc*****
2009年 2月 18日 (水) 03:03:22 JST
Revision: 2682 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2682 Author: daisuke_m Date: 2009-02-18 03:03:22 +0900 (Wed, 18 Feb 2009) Log Message: ----------- TableEditDialogの整備中。まだ真っ赤なので、コメントアウトコミット。 / pluginプロジェクトのq4e管理をハズしてみた。 / freeStringとかいう奇天烈なモデルフィールドがあったので削除。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java vesta/trunk/org.jiemamy.eclipse/.classpath vesta/trunk/org.jiemamy.eclipse/.project vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DisplayPlace.java 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/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/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/java/org/jiemamy/eclipse/ui/tab/TextEditTab.java vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.classpath vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.project zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd zeus/trunk/jiemamy-spec-core/src/main/resources/sample2.xml Added Paths: ----------- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/ColumnSelectDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/Messages.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab2.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogRecordTab.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2009-02-17 13:48:44 UTC (rev 2681) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -25,14 +25,12 @@ import org.jiemamy.Jiemamy; import org.jiemamy.model.datatype.DataType; -import org.jiemamy.model.datatype.DomainModel; /** * カラム定義モデル。Artemisにおける{@link ColumnModel}の実装クラス。 * * @author daisuke */ - @ SuppressWarnings("serial") public class ColumnModelImpl extends AbstractAttributeModel implements ColumnModel { /** 型記述子 */ @@ -41,9 +39,6 @@ /** デフォルト値 */ private String defaultValue; - /** 自由文字列 */ - private String freeString; - /** * インスタンスを生成する。 @@ -72,19 +67,6 @@ /** * {@inheritDoc} */ - public String getFreeString() { - if (dataType instanceof DomainModel && freeString == null) { - synchronized (dataType) { - DomainModel domainModel = (DomainModel) dataType; - return domainModel.getFreeString(); - } - } - return freeString; - } - - /** - * {@inheritDoc} - */ public void setDataType(DataType dataType) { this.dataType = dataType; } @@ -99,13 +81,6 @@ /** * {@inheritDoc} */ - public void setFreeString(String freeString) { - this.freeString = freeString; - } - - /** - * {@inheritDoc} - */ @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2009-02-17 13:48:44 UTC (rev 2681) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -47,9 +47,6 @@ /** 制約のリスト */ private List<ValueConstraintModel> constraints; - /** 自由文字列 */ - private String freeString; - /** 説明文 */ private String description; @@ -111,13 +108,6 @@ /** * {@inheritDoc} */ - public String getFreeString() { - return freeString; - } - - /** - * {@inheritDoc} - */ public String getLogicalName() { return logicalName; } @@ -177,13 +167,6 @@ /** * {@inheritDoc} */ - public void setFreeString(String freeString) { - this.freeString = freeString; - } - - /** - * {@inheritDoc} - */ public void setLogicalName(String logicalName) { this.logicalName = logicalName; } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java 2009-02-17 13:48:44 UTC (rev 2681) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomBuilder.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -39,7 +39,6 @@ import static org.jiemamy.xml.CoreQName.END_SCRIPT; import static org.jiemamy.xml.CoreQName.ENTITIES; import static org.jiemamy.xml.CoreQName.EXPRESSION; -import static org.jiemamy.xml.CoreQName.FREE_STRING; import static org.jiemamy.xml.CoreQName.INITIALLY_CHECK_TIME; import static org.jiemamy.xml.CoreQName.LOGICAL_NAME; import static org.jiemamy.xml.CoreQName.MATCH_TYPE; @@ -298,8 +297,6 @@ } } } - - DomUtil.newChild(domainElement, FREE_STRING, domainModel.getFreeString()); // dataType要素で既にadapterは処理済みの為、ここではアダプタ出力をしない。 } } @@ -337,7 +334,6 @@ ColumnModel columnModel = (ColumnModel) attributeModel; newDataTypeElement(attributeElement, columnModel.getDataType()); DomUtil.newChild(attributeElement, DEFAULT_VALUE, columnModel.getDefaultValue()); - DomUtil.newChild(attributeElement, FREE_STRING, columnModel.getFreeString()); } else if (attributeModel instanceof KeyConstraintModel) { KeyConstraintModel keyeyModel = (KeyConstraintModel) attributeModel; Element columnRefsElement = DomUtil.newChild(attributeElement, COLUMN_REFS); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java 2009-02-17 13:48:44 UTC (rev 2681) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/DomParser.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -259,7 +259,6 @@ columnModel.setLogicalName(XpathUtil.getTextContent(columnElement, "core:logicalName")); columnModel.setDataType(getDataType((Element) XpathUtil.getNode(columnElement, "core:dataType"))); columnModel.setDefaultValue(XpathUtil.getTextContent(columnElement, "core:defaultValue")); - columnModel.setFreeString(XpathUtil.getTextContent(columnElement, "core:freeString")); columnModel.setDescription(XpathUtil.getTextContent(columnElement, "core:description")); readAdapter(columnElement, columnModel); tableModel.getAttributes().add(columnModel); @@ -365,7 +364,6 @@ domainModel.getConstraints().add(constraint); } - domainModel.setFreeString(XpathUtil.getTextContent(domainNode, "core:freeString")); domainModel.setDescription(XpathUtil.getTextContent(domainNode, "core:description")); readAdapter((Element) domainNode, domainModel); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-02-17 13:48:44 UTC (rev 2681) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/model/ColumnUtil.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -18,9 +18,17 @@ */ package org.jiemamy.utils.model; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.jiemamy.JiemamyFactory; +import org.jiemamy.exception.TooManyElementsException; import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.attribute.ColumnRef; +import org.jiemamy.model.attribute.constraint.PrimaryKeyModel; import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.datatype.DomainRef; import org.jiemamy.model.entity.TableModel; @@ -32,6 +40,9 @@ */ public final class ColumnUtil { + private static Logger logger = LoggerFactory.getLogger(ColumnUtil.class); + + /** * このカラムが定義されているテーブルを取得する。 * @@ -48,6 +59,23 @@ return null; } + public static boolean isPartOfPrimaryKeyColumns(ColumnModel columnModel) { + TableModel tableModel = getDefinedTable(columnModel); + try { + PrimaryKeyModel primaryKey = TableUtil.getPrimaryKey(tableModel); + List<ColumnRef> keyColumns = primaryKey.getKeyColumns(); + for (ColumnRef columnRef : keyColumns) { + if (columnRef.getReferenceId() == columnModel.getId()) { + return true; + } + } + } catch (TooManyElementsException e) { + // FIXME 適切に処理せよ + logger.warn("複数PKテーブルでisPartOfPrimaryKeyColumnsが呼ばれた"); + } + return false; + } + /** * カラムにドメイン型をデータ型として設定する。 * Modified: vesta/trunk/org.jiemamy.eclipse/.classpath =================================================================== --- vesta/trunk/org.jiemamy.eclipse/.classpath 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/.classpath 2009-02-17 18:03:22 UTC (rev 2682) @@ -6,26 +6,26 @@ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="lib" path="lib/collections-generic-4.01.jar"/> - <classpathentry kind="lib" path="lib/commons-beanutils-1.8.0.jar"/> - <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar"/> - <classpathentry kind="lib" path="lib/commons-lang-2.3.jar"/> - <classpathentry kind="lib" path="lib/eclipse-common-0.0.4.jar"/> - <classpathentry kind="lib" path="lib/factory-enhancer-0.1.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/generic-tree-0.1.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/javassist-3.8.0.GA.jar"/> - <classpathentry kind="lib" path="lib/jcl-over-slf4j-1.5.5.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-core-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-dialect-postgresql-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-dialect-sql99-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-spec-core-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-spec-view-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/jiemamy-view-0.2.0-SNAPSHOT.jar"/> - <classpathentry kind="lib" path="lib/logback-classic-0.9.9.jar"/> - <classpathentry kind="lib" path="lib/logback-core-0.9.9.jar"/> - <classpathentry kind="lib" path="lib/slf4j-api-1.5.5.jar"/> - <classpathentry kind="lib" path="lib/stax-1.2.0.jar"/> - <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/> - <classpathentry kind="lib" path="lib/wstx-asl-3.2.7.jar"/> + <classpathentry kind="lib" path="lib/collections-generic-4.01.jar" sourcepath="lib/sources/collections-generic-4.01-sources.jar"/> + <classpathentry kind="lib" path="lib/commons-beanutils-1.8.0.jar" sourcepath="lib/sources/commons-beanutils-1.8.0-sources.jar"/> + <classpathentry kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> + <classpathentry kind="lib" path="lib/commons-lang-2.3.jar" sourcepath="lib/sources/commons-lang-2.3-sources.jar"/> + <classpathentry kind="lib" path="lib/eclipse-common-0.0.4.jar" sourcepath="lib/sources/eclipse-common-0.0.4-sources.jar"/> + <classpathentry kind="lib" path="lib/factory-enhancer-0.1.0-SNAPSHOT.jar" sourcepath="lib/sources/factory-enhancer-0.1.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/generic-tree-0.1.0-SNAPSHOT.jar" sourcepath="lib/sources/generic-tree-0.1.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/javassist-3.8.0.GA.jar" sourcepath="lib/sources/javassist-3.8.0.GA-sources.jar"/> + <classpathentry kind="lib" path="lib/jcl-over-slf4j-1.5.5.jar" sourcepath="lib/sources/jcl-over-slf4j-1.5.5-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-core-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-core-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-dialect-postgresql-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-dialect-postgresql-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-dialect-sql99-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-dialect-sql99-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-spec-core-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-spec-core-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-spec-view-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-spec-view-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/jiemamy-view-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-view-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry kind="lib" path="lib/logback-classic-0.9.9.jar" sourcepath="lib/sources/logback-classic-0.9.9-sources.jar"/> + <classpathentry kind="lib" path="lib/logback-core-0.9.9.jar" sourcepath="lib/sources/logback-core-0.9.9-sources.jar"/> + <classpathentry kind="lib" path="lib/slf4j-api-1.5.5.jar" sourcepath="lib/sources/slf4j-api-1.5.5-sources.jar"/> + <classpathentry kind="lib" path="lib/stax-1.2.0.jar" sourcepath="lib/sources/stax-1.2.0-sources.jar"/> + <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar" sourcepath="lib/sources/stax-api-1.0.1-sources.jar"/> + <classpathentry kind="lib" path="lib/wstx-asl-3.2.7.jar" sourcepath="lib/sources/wstx-asl-3.2.7-sources.jar"/> <classpathentry kind="output" path="target/classes"/> </classpath> Modified: vesta/trunk/org.jiemamy.eclipse/.project =================================================================== --- vesta/trunk/org.jiemamy.eclipse/.project 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/.project 2009-02-17 18:03:22 UTC (rev 2682) @@ -30,15 +30,9 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>edu.umd.cs.findbugs.ZZZZZZplugin.eclipse.findbugsNature</nature> - <nature>org.devzuz.q.maven.jdt.core.mavenNature</nature> <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.pde.PluginNature</nature> Modified: vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2009-02-17 18:03:22 UTC (rev 2682) @@ -40,7 +40,6 @@ org.eclipse.update.core, org.eclipse.debug.core, org.eclipse.jdt.ui -Eclipse-BuddyPolicy: registered Export-Package: org.jiemamy, org.jiemamy.command, org.jiemamy.composer, @@ -107,3 +106,4 @@ org.jiemamy.validator, org.jiemamy.validator.impl, org.jiemamy.xml +Eclipse-BuddyPolicy: registered Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DisplayPlace.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DisplayPlace.java 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/DisplayPlace.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -28,5 +28,8 @@ FIGURE, /** アウトラインツリー上に表示する事を表す */ - OUTLINE_TREE; + OUTLINE_TREE, + + /** 表中に表示することを表す */ + TABLE; } 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-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/Messages.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -25,7 +25,7 @@ * * @author daisuke */ -public class Messages extends NLS { +class Messages extends NLS { /** Dialogのタイトル */ public static String Dialog_Title; Modified: 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/RootEditDialog.java 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialog.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -118,30 +118,33 @@ tabDomain = new RootEditDialogDomainTab(tabFolder, SWT.NONE, rootModel); // ---- B-2. BeginScript - tabBeginScript = - new TextEditTab(tabFolder, Messages.Tab_BeginScript, StringUtils.defaultIfEmpty(rootModel - .getBeginScript(), "")); + String beginScript = StringUtils.defaultIfEmpty(rootModel.getBeginScript(), ""); + tabBeginScript = new TextEditTab(tabFolder, Messages.Tab_BeginScript, beginScript); // ---- B-3. EndScript - tabEndScript = - new TextEditTab(tabFolder, Messages.Tab_EndScript, StringUtils.defaultIfEmpty(rootModel.getEndScript(), - "")); + String endScript = StringUtils.defaultIfEmpty(rootModel.getEndScript(), ""); + tabEndScript = new TextEditTab(tabFolder, Messages.Tab_EndScript, endScript); // ---- B-4. Description - tabDescription = - new TextEditTab(tabFolder, Messages.Tab_Description, StringUtils.defaultIfEmpty(rootModel - .getDescription(), "")); + String description = StringUtils.defaultIfEmpty(rootModel.getDescription(), ""); + tabDescription = new TextEditTab(tabFolder, Messages.Tab_Description, description); return composite; } @Override protected void okPressed() { - rootModel.setDialectClassName(cmbDialect.getText()); - rootModel.setSchemaName(StringUtils.defaultIfEmpty(txtSchema.getText(), null)); - rootModel.setBeginScript(StringUtils.defaultIfEmpty(tabBeginScript.getText().getText(), null)); - rootModel.setEndScript(StringUtils.defaultIfEmpty(tabEndScript.getText().getText(), null)); - rootModel.setDescription(StringUtils.defaultIfEmpty(tabDescription.getText().getText(), null)); - super.okPressed(); + if (canExecuteOk()) { + rootModel.setDialectClassName(cmbDialect.getText()); + rootModel.setSchemaName(StringUtils.defaultIfEmpty(txtSchema.getText(), null)); + rootModel.setBeginScript(StringUtils.defaultIfEmpty(tabBeginScript.getTextWidget().getText(), null)); + rootModel.setEndScript(StringUtils.defaultIfEmpty(tabEndScript.getTextWidget().getText(), null)); + rootModel.setDescription(StringUtils.defaultIfEmpty(tabDescription.getTextWidget().getText(), null)); + super.okPressed(); + } } + + private boolean canExecuteOk() { + return StringUtils.isEmpty(cmbDialect.getText()) == false; + } } Modified: 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/root/RootEditDialogDomainTab.java 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDomainTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -7,7 +7,7 @@ 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.BaseLabelProvider; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; @@ -75,7 +75,7 @@ private final RootModel rootModel; - private AbstractTableEditor domainEditArea; + private AbstractTableEditor domainEditor; private Text txtDomainName; @@ -106,9 +106,9 @@ composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - domainEditArea = new DomainTableEditor(composite, SWT.NULL, rootModel); - domainEditArea.configure(); - domainEditArea.disableEditControls(); + domainEditor = new DomainTableEditor(composite, SWT.NULL, rootModel); + domainEditor.configure(); + domainEditor.disableEditControls(); getTabItem().setControl(composite); } @@ -127,7 +127,7 @@ public void commandExecuted(Command command) { logger.debug("DomainContentProvider: commandExecuted"); // if (evt.getPropertyName().equals(RootModel.P_DB_DOMAINS)) { - domainEditArea.refreshTable(); // レコードの変更を反映させる。 + domainEditor.refreshTable(); // レコードの変更を反映させる。 // } else if (evt.getSource() instanceof DefinitionModel) { // domainEditArea.refreshTable(); // レコードの変更を反映させる。 // if (evt.getPropertyName().equals(DefinitionModel.P_CREATE)) { @@ -159,19 +159,21 @@ logger.debug("DomainContentProvider: input changed"); logger.trace("oldInput: " + oldInput); logger.trace("newInput: " + newInput); + this.viewer = viewer; - if (oldInput != null) { + +// if (oldInput != null) { // rootModel.removePropertyChangeListener(this); // for (DomainModel domain : rootModel.getDomains()) { // domain.removePropertyChangeListener(this); // } - } - if (newInput != null) { +// } +// if (newInput != null) { // rootModel.addPropertyChangeListener(this); // for (DomainModel domain : rootModel.getDomains()) { // domain.addPropertyChangeListener(this); // } - } +// } super.inputChanged(viewer, oldInput, newInput); } @@ -183,21 +185,13 @@ * * @author daisuke */ - private class DomainLabelProvider implements ITableLabelProvider { + private class DomainLabelProvider extends BaseLabelProvider 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) { + if (columnIndex == 2) { boolean notNull = DomainUtil.hasConstraint(domain, NotNullConstraintModel.class); return ir.get(notNull ? Images.CHECK_ON : Images.CHECK_OFF); } @@ -208,22 +202,14 @@ DomainModel domain = (DomainModel) element; switch (columnIndex) { case 0: - return LabelStringUtil.getString(rootModel, domain, DisplayTarget.NAME, DisplayPlace.FIGURE); + return LabelStringUtil.getString(rootModel, domain, DisplayTarget.NAME, DisplayPlace.TABLE); case 1: - return LabelStringUtil.getString(rootModel, domain, DisplayTarget.TYPE, DisplayPlace.FIGURE); + return LabelStringUtil.getString(rootModel, domain, DisplayTarget.TYPE, DisplayPlace.TABLE); default: return ""; } } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // nothing to do - } } private class DomainTableEditor extends AbstractTableEditor { @@ -279,8 +265,10 @@ @Override protected JiemamyElement addItem() { + Table table = getTableViewer().getTable(); JiemamyFactory factory = jiemamy.getFactory(); DomainModel domainModel = factory.newModel(DomainModel.class); + domainModel.setName("DOMAIN_" + (domains.size() + 1)); BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class); @@ -290,7 +278,7 @@ domains.add(domainModel); int addedIndex = domains.indexOf(domainModel); - getTableViewer().getTable().setSelection(addedIndex); + table.setSelection(addedIndex); enableEditControls(addedIndex); txtDomainName.setFocus(); @@ -311,6 +299,7 @@ @Override public void keyReleased(KeyEvent e) { updateModel(); + domainEditor.refreshTable(); } }); cmbColumnType.addSelectionListener(new SelectionAdapter() { @@ -320,6 +309,7 @@ int domainEditIndex = getTableViewer().getTable().getSelectionIndex(); updateModel(); enableEditDetailControls(domainEditIndex); + domainEditor.refreshTable(); } }); txtColumnSize.addKeyListener(new KeyAdapter() { @@ -327,6 +317,7 @@ @Override public void keyReleased(KeyEvent e) { updateModel(); + domainEditor.refreshTable(); } }); txtDescription.addFocusListener(new TextSelectionAdapter(txtDescription)); @@ -344,6 +335,7 @@ int domainEditIndex = getTableViewer().getTable().getSelectionIndex(); updateModel(); enableEditDetailControls(domainEditIndex); + domainEditor.refreshTable(); } }); txtCheck.addFocusListener(new TextSelectionAdapter(txtCheck)); @@ -352,6 +344,7 @@ @Override public void keyReleased(KeyEvent e) { updateModel(); + domainEditor.refreshTable(); } }); } @@ -511,7 +504,6 @@ @Override protected void disableEditDetailControls() { txtDomainName.setText(""); - cmbColumnType.setText(""); txtColumnSize.setText(""); txtCheck.setText(""); @@ -586,7 +578,7 @@ return; } - ListUtils.moveUp(domains, index); + ListUtils.moveDown(domains, index); table.setSelection(index + 1); enableEditControls(index + 1); @@ -608,14 +600,15 @@ @Override protected JiemamyElement removeTableSelectionItem() { - Table table = getTableViewer().getTable(); + TableViewer tableViewer = getTableViewer(); + Table table = tableViewer.getTable(); int index = table.getSelectionIndex(); if (index < 0 || index > table.getItemCount()) { return null; } - DomainModel domainToRemove = domains.remove(table.getSelectionIndex()); - TableViewer tableViewer = getTableViewer(); + DomainModel domainToRemove = domains.remove(index); tableViewer.remove(domainToRemove); + table.setSelection(index); disableEditControls(); Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/ColumnSelectDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/ColumnSelectDialog.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/ColumnSelectDialog.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,124 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +import java.util.List; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +import org.jiemamy.eclipse.editor.DisplayPlace; +import org.jiemamy.eclipse.editor.DisplayTarget; +import org.jiemamy.eclipse.editor.utils.LabelStringUtil; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.ColumnModel; + +/** + * カラムを選択するダイアログ。インデックスカラム洗濯用。 + * + * @author daisuke + */ +public class ColumnSelectDialog extends Dialog { + + private int selectIndex = -1; + + private List<ColumnModel> columns; + + private Table tblColumns; + + + /** + * インスタンスを生成する。 + * + * @param parentShell + * @param columns + */ + public ColumnSelectDialog(Shell parentShell, List<ColumnModel> columns) { + super(parentShell); + setShellStyle(getShellStyle() | SWT.RESIZE); + + this.columns = columns; + } + +// @Override +// protected void constrainShellSize() { +// Shell shell = getShell(); +// shell.pack(); +// shell.setSize(shell.getSize().x, 400); +// } + + /** + * 選択結果を取得します。 + * + * @return 選択されたカラム + */ + public ColumnModel getResult() { + if (selectIndex >= 0 && selectIndex < columns.size()) { + return columns.get(selectIndex); + } + return null; + } + + @Override + protected Control createDialogArea(Composite parent) { + getShell().setText("Select column"); // RESOURCE + + Composite composite = new Composite(parent, SWT.NULL); + composite.setLayout(new GridLayout(1, false)); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + tblColumns = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); + tblColumns.setLayoutData(new GridData(GridData.FILL_BOTH)); + tblColumns.setHeaderVisible(true); + + TableColumn colStatus = new TableColumn(tblColumns, SWT.LEFT); + colStatus.setText(""); + colStatus.setWidth(40); + + TableColumn colName = new TableColumn(tblColumns, SWT.LEFT); + colName.setText("column name"); // RESOURCE + colName.setWidth(100); + + TableColumn colType = new TableColumn(tblColumns, SWT.LEFT); + colType.setText("data type"); // RESOURCE + colType.setWidth(150); + + refreshTable(); + + tblColumns.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + selectIndex = tblColumns.getSelectionIndex(); + } + }); + + return composite; + } + + /** + * Tableをリフレッシュします。 + */ + protected void refreshTable() { + tblColumns.removeAll(); + for (ColumnModel model : columns) { + TableItem item = new TableItem(tblColumns, SWT.NULL); + updateColumnTableItem(item, model); + } + } + + private void updateColumnTableItem(TableItem item, ColumnModel column) { + RootModel rootModel = column.getJiemamy().getFactory().getRootModel(); + item.setText(0, ""); + item.setText(1, LabelStringUtil.getString(rootModel, column, DisplayTarget.NAME, DisplayPlace.TABLE)); + item.setText(2, LabelStringUtil.getString(rootModel, column, DisplayTarget.TYPE, DisplayPlace.TABLE)); + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/ColumnSelectDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/Messages.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/Messages.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/Messages.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -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.table; + +import org.eclipse.osgi.util.NLS; + +/** + * {@link TableEditDialog}用メッセージリソースクラス。 + * + * @author daisuke + */ +class Messages extends NLS { + + /** Dialogのタイトル */ + public static String Dialog_Title; + + /** テーブル編集コントロールグループタイトル */ + public static String Message; + + /** テーブル名ラベル */ + public static String Label_Table_Name; + + /** テーブル名ラベル */ + public static String Label_Table_LogicalName; + + /** 定義タブ */ + public static String Tab_Table_Definition; + + /** 開始スクリプトタブ */ + public static String Tab_Table_BeginScript; + + /** 終了スクリプトタブ */ + public static String Tab_Table_EndScript; + + /** 説明タブ */ + public static String Tab_Table_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/table/Messages.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,225 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +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.TextEditTab; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.attribute.ColumnModel; +import org.jiemamy.model.entity.EntityModel; +import org.jiemamy.model.entity.TableModel; +import org.jiemamy.utils.model.TableUtil; + +/** + * テーブルの詳細編集ダイアログ + * + * @author takezoe + * @author daisuke + */ +public class TableEditDialog extends Dialog { + + private TableModel tableModel; + + private RootModel rootModel; + + // 共通 + private Text txtTableName; + + private Text txtLogicalName; + +// private TableEditDialogColumnTab tabColumns; +// +// private TableEditDialogIndexTab tabIndexes; +// +// private TableEditDialogCheckTab tabChecks; +// +// private TableEditDialogRecordTab tabRecords; + + private TextEditTab tabBeginScript; + + private TextEditTab tabEndScript; + + private TextEditTab tabDescription; + + + /** + * コンストラクタ。 + * + * @param parentShell 親shell + * @param tableModel 編集対象モデル + * @param rootModel ルートモデル + */ + public TableEditDialog(Shell parentShell, TableModel tableModel, RootModel rootModel) { + + super(parentShell); + setShellStyle(getShellStyle() | SWT.RESIZE); + + this.tableModel = tableModel; + this.rootModel = rootModel; + } + + @Override + protected void constrainShellSize() { + Shell shell = getShell(); + shell.pack(); + int height = 500; + shell.setSize((int) (height * 1.618), height); + } + + @Override + protected Control createDialogArea(Composite parent) { + getShell().setText("テーブル情報編集"); // RESOURCE + + // ---- A. 最上段名称欄 + 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.NONE); + label.setText("テーブル名"); // RESOURCE + + txtTableName = new Text(composite, SWT.BORDER | SWT.SINGLE); + txtTableName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtTableName.setText(tableModel.getName()); + txtTableName.addFocusListener(new TextSelectionAdapter(txtTableName)); + + // ---- A-2. 論理名 + label = new Label(composite, SWT.NONE); + label.setText("論理名"); // RESOURCE + + txtLogicalName = new Text(composite, SWT.BORDER | SWT.SINGLE); + txtLogicalName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtLogicalName.setText(tableModel.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 +// tableModel.setBgColor(new JmColor(rgb.red, rgb.green, rgb.blue)); + } + } + }); + + Button btnDefaultColor = new Button(composite, SWT.PUSH); + btnDefaultColor.setText("default color"); // RESOURCE + btnDefaultColor.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent evt) { + // TODO +// tableModel.setBgColor(null); + } + }); + + // ---- B. タブ + TabFolder tabFolder = new TabFolder(composite, SWT.NULL); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.horizontalSpan = 6; + tabFolder.setLayoutData(gd); + +// tabColumns = new TableEditDialogColumnTab(tabFolder, SWT.NULL, tableModel); +// +// tabIndexes = new TableEditDialogIndexTab(tabFolder, SWT.NULL, tableModel); +// +// tabChecks = new TableEditDialogCheckTab(tabFolder, SWT.NULL, tableModel); +// +// tabRecords = new TableEditDialogRecordTab(tabFolder, SWT.NULL, tableModel); + + // ---- B-5. BeginScript + String beginScript = StringUtils.defaultIfEmpty(tableModel.getBeginScript(), ""); + tabBeginScript = new TextEditTab(tabFolder, Messages.Tab_Table_BeginScript, beginScript); + + // ---- B-6. EndScript + String endScript = StringUtils.defaultIfEmpty(tableModel.getEndScript(), ""); + tabEndScript = new TextEditTab(tabFolder, Messages.Tab_Table_EndScript, endScript); + + // ---- B-7. Description + String description = StringUtils.defaultIfEmpty(tableModel.getDescription(), ""); + tabDescription = new TextEditTab(tabFolder, Messages.Tab_Table_Description, description); + + return composite; + } + + @Override + protected void okPressed() { + if (canExecuteOk()) { + tableModel.setName(txtTableName.getText()); + tableModel.setLogicalName(txtLogicalName.getText()); + tableModel.setBeginScript(StringUtils.defaultIfEmpty(tabBeginScript.getTextWidget().getText(), null)); + tableModel.setEndScript(StringUtils.defaultIfEmpty(tabEndScript.getTextWidget().getText(), null)); + tableModel.setDescription(StringUtils.defaultIfEmpty(tabDescription.getTextWidget().getText(), null)); + super.okPressed(); + } + } + + private boolean canExecuteOk() { + if (StringUtils.isEmpty(txtTableName.getText())) { + return false; + } + + Set<EntityModel> entities = rootModel.getEntities(); + Set<String> entityNames = new HashSet<String>(entities.size()); + for (EntityModel entity : entities) { + if (entity != tableModel) { + entityNames.add(entity.getName()); + } + } + + List<ColumnModel> columns = TableUtil.getColumns(tableModel); + Set<String> columnNames = new HashSet<String>(columns.size()); + for (ColumnModel column : columns) { + columnNames.add(column.getName()); + } + + boolean entityCheckOk; + boolean columnCheckOk; + + if (entityNames.contains(txtTableName.getText())) { + entityCheckOk = MessageDialog.openQuestion(getParentShell(), "Confirm", "エンティティ名が重複しますが、よろしいですか?"); // RESOURCE + } else { + entityCheckOk = true; + } + + if (columnNames.size() != columns.size()) { + columnCheckOk = MessageDialog.openQuestion(getParentShell(), "Confirm", "カラム名が重複しますが、よろしいですか?"); // RESOURCE + } else { + columnCheckOk = true; + } + + return entityCheckOk && columnCheckOk; + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialog.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,401 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +// +//import org.eclipse.jface.viewers.ArrayContentProvider; +//import org.eclipse.jface.viewers.BaseLabelProvider; +//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.KeyAdapter; +//import org.eclipse.swt.events.KeyEvent; +//import org.eclipse.swt.graphics.Image; +//import org.eclipse.swt.layout.GridData; +//import org.eclipse.swt.layout.GridLayout; +//import org.eclipse.swt.widgets.Composite; +//import org.eclipse.swt.widgets.Group; +//import org.eclipse.swt.widgets.Label; +//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.jiemamy.eclipse.JiemamyPlugin; +//import org.jiemamy.eclipse.ui.AbstractTableEditor; +//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.attribute.constraint.CheckConstraintModel; +//import org.jiemamy.model.entity.TableModel; +// +///** +// * テーブル編集ダイアログの「CHECK制約」タブ +// * +// * @author daisuke +// */ +//public class TableEditDialogCheckTab extends AbstractTab { +// +// private TableModel tableModel; +// +// private AbstractTableEditor checkEditArea; +// +// private CheckContentProvider contentProvider; +// +// private Text txtCheckName; +// +// private Text txtCheckDefinition; +// +// +// public TableEditDialogCheckTab(TabFolder parentTabFolder, int style, TableModel tableModel) { +// super(parentTabFolder, style, "カラム"); // RESOURCE +// this.tableModel = tableModel; +// } +// +// @Override +// public Composite createTabArea(TabFolder parentTabFolder) { +// Composite composite = new Composite(parentTabFolder, SWT.NULL); +// composite.setLayout(new GridLayout(1, false)); +// composite.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// TabItem tabColumn = new TabItem(parentTabFolder, SWT.NONE); +// tabColumn.setText(JiemamyPlugin.getResourceString("dialog.table.tab.check")); +// tabColumn.setControl(composite); +// +// createColumnTab(composite); +// checkEditArea.disableEditControls(); +// +// return composite; +// } +// +// private void createColumnTab(Composite parent) { +// checkEditArea = new CheckEditTableArea(tableModel); +// checkEditArea.setAddLabel(JiemamyPlugin.getResourceString("dialog.table.check.btn.add")); +// checkEditArea.setInsertLabel(JiemamyPlugin.getResourceString("dialog.table.check.btn.insert")); +// checkEditArea.setRemoveLabel(JiemamyPlugin.getResourceString("dialog.table.check.btn.remove")); +// checkEditArea.createControlArea(parent); +// } +// +// +// /** +// * Column用ContentProvider +// * +// * @author daisuke +// */ +// private class CheckContentProvider extends ArrayContentProvider implements CommandListener { +// +// private Viewer viewer; +// +// +// public void commandExecuted(Command command) { +//// if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_CHECKS)) { +// checkEditArea.refreshTable(); +//// } else if (evt.getPropertyName().equals(CheckConstraintModel.P_CHECK_NAME)) { +//// checkEditArea.refreshTable(); +//// } else if (evt.getPropertyName().equals(CheckConstraintModel.P_CHECK_DEFINITION)) { +//// checkEditArea.refreshTable(); +//// } else if (evt.getSource() instanceof CheckConstraintModel) { +//// checkEditArea.refreshTable(); +//// if (evt.getPropertyName().equals(CheckConstraintModel.P_CREATE)) { +//// // nothing to do +//// } else if (evt.getPropertyName().equals(CheckConstraintModel.P_DELETE)) { +//// ((AbstractModel) evt.getSource()).removePropertyChangeListener(this); +//// } else if (evt.getPropertyName().equals(CheckConstraintModel.P_REVERT)) { +//// ((AbstractModel) evt.getSource()).addPropertyChangeListener(this); +//// } +//// } +// } +// +// @Override +// public void dispose() { +//// tableModel.removePropertyChangeListener(this); +//// for (CheckConstraintModel check : tableModel.getChecks()) { +//// ((AbstractModel) check).removePropertyChangeListener(this); +//// } +// super.dispose(); +// } +// +// /** +// * {@inheritDoc} +// */ +// public JiemamyElement getTargetModel() { +// return (JiemamyElement) viewer.getInput(); +// } +// +// @Override +// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { +// this.viewer = viewer; +// +//// if (oldInput != null) { +//// tableModel.removePropertyChangeListener(this); +//// for (CheckConstraintModel check : tableModel.getChecks()) { +//// ((AbstractModel) check).removePropertyChangeListener(this); +//// } +//// } +//// if (newInput != null) { +//// tableModel.addPropertyChangeListener(this); +//// for (CheckConstraintModel check : tableModel.getChecks()) { +//// ((AbstractModel) check).addPropertyChangeListener(this); +//// } +//// } +// +// super.inputChanged(viewer, oldInput, newInput); +// } +// +// } +// +// private class CheckEditTableArea extends AbstractTableEditor { +// +// private TableModel tableModel; +// +// +// public CheckEditTableArea(TableModel targetModel) { +// super(); +// tableModel = targetModel; +// } +// +// @Override +// protected JiemamyElement addItem() { +// Table table = getTableViewer().getTable(); +// CheckConstraintModel check = new CheckConstraintModel(); +// +// tableModel.addCheck(check); +// +// int addedIndex = tableModel.getChecks().indexOf(check); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtCheckName.setFocus(); +// +// return check; +// } +// +// @Override +// protected void configureEditorControls() { +// txtCheckName.addFocusListener(new TextSelectionAdapter(txtCheckName)); +// txtCheckName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// checkEditArea.refreshTable(); +// } +// }); +// txtCheckDefinition.addFocusListener(new TextSelectionAdapter(txtCheckDefinition)); +// txtCheckDefinition.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// checkEditArea.refreshTable(); +// } +// }); +// } +// +// @Override +// protected void configureTable(final Table table) { +// super.configureTable(table); +// +// // THINK ↓要る? +//// 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) { +// tableViewer.setLabelProvider(new CheckLabelProvider()); +// contentProvider = new CheckContentProvider(); +// tableViewer.setContentProvider(contentProvider); +// tableViewer.setInput(tableModel.getChecks()); +// } +// +// @Override +// protected void createEditorControls(Composite parent) { +// Label label; +// +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.check.title")); +// 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(4, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpNames.setLayout(layout); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.check.label.name")); +// +// txtCheckName = new Text(cmpNames, SWT.BORDER); +// txtCheckName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.check.label.definition")); +// +// txtCheckDefinition = new Text(cmpNames, SWT.BORDER); +// txtCheckDefinition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// return group; +// } +// +// @Override +// protected void createTableColumns(Table table) { +// TableColumn col = new TableColumn(table, SWT.LEFT); +// col.setText(JiemamyPlugin.getResourceString("dialog.table.check.tbl.header.name")); +// col.setWidth(200); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText(JiemamyPlugin.getResourceString("dialog.table.check.tbl.header.definition")); +// col.setWidth(500); +// } +// +// @Override +// protected void disableEditDetailControls() { +// txtCheckName.setText(""); +// txtCheckDefinition.setText(""); +// +// txtCheckName.setEnabled(false); +// txtCheckDefinition.setEnabled(false); +// } +// +// @Override +// protected void enableEditDetailControls(int index) { +// CheckConstraintModel check = tableModel.getCheck(index); +// +// // 現在値の設定 +// txtCheckName.setText(check.getName()); +// txtCheckDefinition.setText(check.getDefinition()); +// +// // 編集可否の設定 +// txtCheckName.setEnabled(true); +// txtCheckDefinition.setEnabled(true); +// } +// +// @Override +// protected JiemamyElement insertTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// CheckConstraintModel check = new CheckConstraintModel(); +// +// if (index < 0 || index > table.getItemCount()) { +// tableModel.addCheck(check); +// } else { +// tableModel.addCheck(index, check); +// } +// +// int addedIndex = tableModel.getChecks().indexOf(check); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtCheckName.setFocus(); +// +// return check; +// } +// +// @Override +// protected void moveDownTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// if (index < 0 || index >= table.getItemCount()) { +// return; +// } +// +// tableModel.moveDownCheck(index); +// +// table.setSelection(index + 1); +// enableEditControls(index + 1); +// } +// +// @Override +// protected void moveUpTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// if (index <= 0 || index > table.getItemCount()) { +// return; +// } +// +// tableModel.moveUpCheck(index); +// +// table.setSelection(index - 1); +// enableEditControls(index - 1); +// } +// +// @Override +// protected JiemamyElement removeTableSelectionItem() { +// TableViewer tableViewer = getTableViewer(); +// Table table = tableViewer.getTable(); +// int index = table.getSelectionIndex(); +// if (index < 0 || index > table.getItemCount()) { +// return null; +// } +// CheckConstraintModel checkToRemove = tableModel.removeCheck(table.getSelectionIndex()); +// tableViewer.remove(checkToRemove); +// table.setSelection(index); +// +// disableEditControls(); +// +// return checkToRemove; +// } +// +// private void updateModel() { +// int editIndex = getTableViewer().getTable().getSelectionIndex(); +// +// if (editIndex != -1) { +// CheckConstraintModel check = tableModel.getCheck(editIndex); +// check.setName(txtCheckName.getText()); +// check.setDefinition(txtCheckDefinition.getText()); +// } +// } +// } +// +// /** +// * Column用LabelProvider +// * +// * @author daisuke +// */ +// private class CheckLabelProvider extends BaseLabelProvider implements ITableLabelProvider { +// +// public Image getColumnImage(Object element, int columnIndex) { +// return null; +// } +// +// public String getColumnText(Object element, int columnIndex) { +// CheckConstraintModel check = (CheckConstraintModel) element; +// switch (columnIndex) { +// case 0: +// return check.getName(); +// +// case 1: +// return check.getDefinition(); +// +// default: +// return ""; +// } +// } +// } +//} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogCheckTab.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,846 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +// +//import java.util.List; +// +//import org.eclipse.jface.resource.ImageRegistry; +//import org.eclipse.jface.viewers.ArrayContentProvider; +//import org.eclipse.jface.viewers.BaseLabelProvider; +//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.KeyAdapter; +//import org.eclipse.swt.events.KeyEvent; +//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.Label; +//import org.eclipse.swt.widgets.TabFolder; +//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.Jiemamy; +//import org.jiemamy.JiemamyFactory; +//import org.jiemamy.dialect.Dialect; +//import org.jiemamy.dialect.Dialect.AvailableTypeInfo; +//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.AbstractTableEditor; +//import org.jiemamy.eclipse.ui.TableEditorConfigurator; +//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.ColumnModel; +//import org.jiemamy.model.datatype.BuiltinDataType; +//import org.jiemamy.model.datatype.DataType; +//import org.jiemamy.model.datatype.DataTypeCategory; +//import org.jiemamy.model.entity.TableModel; +//import org.jiemamy.utils.CollectionsUtil; +//import org.jiemamy.utils.ListUtils; +//import org.jiemamy.utils.model.RootModelUtil; +//import org.jiemamy.utils.model.TableUtil; +// +///** +// * テーブル編集ダイアログの「カラム」タブ +// * +// * @author daisuke +// */ +//public class TableEditDialogColumnTab extends AbstractTab { +// +// private static Logger logger = LoggerFactory.getLogger(TableEditDialogColumnTab.class); +// +// private RootModel rootModel; +// +// private TableModel tableModel; +// +// private List<AvailableTypeInfo> allTypes; +// +// private AbstractTableEditor columnEditor; +// +// private ColumnContentProvider contentProvider; +// +// +// /** +// * インスタンスを生成する。 +// * +// * @param parentTabFolder +// * @param style +// * @param tableModel +// */ +// public TableEditDialogColumnTab(TabFolder parentTabFolder, int style, TableModel tableModel) { +// super(parentTabFolder, style, "カラム"); // RESOURCE +// +// this.tableModel = tableModel; +// rootModel = tableModel.getJiemamy().getFactory().getRootModel(); +// +// Dialect dialect; +// try { +// dialect = RootModelUtil.getDialect(rootModel); +// } catch (ClassNotFoundException e) { +// // FIXME なんとか…。 +// dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); +// } +// +// allTypes = CollectionsUtil.newArrayList(rootModel.getDomains().size() + dialect.getAllDataTypes().size()); +// +// allTypes.addAll(dialect.getAllDataTypes()); +//// allTypes.addAll(/* domain */); +// +// Composite composite = new Composite(parentTabFolder, SWT.NULL); +// composite.setLayout(new GridLayout(1, false)); +// composite.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// columnEditor = new ColumnTableEditor(composite, SWT.NULL, tableModel); +// columnEditor.configure(); +// columnEditor.disableEditControls(); +// +// getTabItem().setControl(composite); +// } +// +// +// /** +// * Column用ContentProvider +// * +// * @author daisuke +// */ +// private class ColumnContentProvider extends ArrayContentProvider implements CommandListener { +// +// private Viewer viewer; +// +// +// /** +// * {@inheritDoc} +// */ +// public void commandExecuted(Command command) { +//// if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_COLUMNS)) { +// columnEditor.refreshTable(); // レコードの変更を反映させる。 +//// } else if (evt.getSource() instanceof DefinitionModel) { +//// columnEditor.refreshTable(); // レコードの変更を反映させる。 +//// if (evt.getPropertyName().equals(DefinitionModel.P_CREATE)) { +//// // nothing to do +//// } else if (evt.getPropertyName().equals(DefinitionModel.P_DELETE)) { +//// ((AbstractModel) evt.getSource()).removePropertyChangeListener(this); +//// } else if (evt.getPropertyName().equals(DefinitionModel.P_REVERT)) { +//// ((AbstractModel) evt.getSource()).addPropertyChangeListener(this); +//// } +//// } +// } +// +// @Override +// public void dispose() { +// logger.debug("ColumnContentProvider: disposed"); +//// tableModel.removePropertyChangeListener(this); +//// for (ColumnModel column : tableModel.getColumns()) { +//// ((AbstractModel) column).removePropertyChangeListener(this); +//// } +// super.dispose(); +// } +// +// /** +// * {@inheritDoc} +// */ +// public JiemamyElement getTargetModel() { +// return (JiemamyElement) viewer.getInput(); +// } +// +// @Override +// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { +// logger.debug("ColumnContentProvider: input changed"); +// logger.trace("oldInput: " + oldInput); +// logger.trace("newInput: " + newInput); +// +// this.viewer = viewer; +// +//// if (oldInput != null) { +//// tableModel.removePropertyChangeListener(this); +//// for (ColumnModel column : tableModel.getColumns()) { +//// ((AbstractModel) column).removePropertyChangeListener(this); +//// } +//// } +//// if (newInput != null) { +//// tableModel.addPropertyChangeListener(this); +//// for (ColumnModel column : tableModel.getColumns()) { +//// ((AbstractModel) column).addPropertyChangeListener(this); +//// } +//// } +// +// super.inputChanged(viewer, oldInput, newInput); +// } +// +// } +// +// /** +// * Column用LabelProvider +// * +// * @author daisuke +// */ +// private class ColumnLabelProvider extends BaseLabelProvider implements ITableLabelProvider { +// +// public Image getColumnImage(Object element, int columnIndex) { +// ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); +// ColumnModel column = (ColumnModel) element; +// +// switch (columnIndex) { +// case 0: +// return null; +// +// case 1: +// // FIXME false固定 +// return /*ColumnUtil.isPartOfPrimaryKeyColumns(column)*/false ? ir.get(Images.ICON_PK) : null; +// +// case 4: +// // FIXME ここ、何を表示するんだっけ PKだっけ? ↑にあるじゃん。。 +// return null; +// +// case 5: +// // FIXME false固定 +// return ir.get(/* uniqueかどうか */false ? Images.CHECK_ON : Images.CHECK_OFF); +// +// case 6: +// // FIXME false固定 +// return ir.get(/* NNかどうか */false ? Images.CHECK_ON : Images.CHECK_OFF); +// +// default: +// return null; +// } +// } +// +// public String getColumnText(Object element, int columnIndex) { +// ColumnModel column = (ColumnModel) element; +// switch (columnIndex) { +// case 1: +// return LabelStringUtil.getString(rootModel, column, DisplayTarget.NAME, DisplayPlace.TABLE); +// +// case 2: +// return LabelStringUtil.getString(rootModel, column, DisplayTarget.TYPE, DisplayPlace.TABLE); +// +// case 3: +// return column.getDefaultValue(); +// +// default: +// return ""; +// } +// } +// } +// +// private class ColumnTableEditor extends AbstractTableEditor { +// +// private Jiemamy jiemamy; +// +// private final List<ColumnModel> columns; +// +// private Dialect dialect; +// +// private Text txtColumnName; +// +// private Text txtColumnLogicalName; +// +// private Text txtCheckDefinition; +// +// private Text txtCheckName; +// +// private Combo cmbColumnType; +// +// private Text txtColumnSize; +// +// private Text txtDefaultValue; +// +// private Text txtDescription; +// +// private Button chkIsPK; +// +// private Button chkIsUnique; +// +// private Button chkIsNotNull; +// +// private Button chkIsTypical; +// +// +// /** +// * インスタンスを生成する。 +// * +// * @param parent +// * @param style +// * @param tableModel +// */ +// public ColumnTableEditor(Composite parent, int style, TableModel tableModel) { +// super(parent, style, new TableEditorConfigurator() { +// +// public String getAddLabel() { +// return "追加"; // RESOURCE +// } +// +// public String getEditorTitle() { +// return "カラム情報"; // RESOURCE +// } +// +// public String getInsertLabel() { +// return "挿入"; // RESOURCE +// } +// +// public String getRemoveLabel() { +// return "削除"; // RESOURCE +// } +// }); +// +// jiemamy = tableModel.getJiemamy(); +// columns = TableUtil.getColumns(tableModel); +// +// try { +// dialect = RootModelUtil.getDialect(rootModel.getJiemamy().getFactory().getRootModel()); +// } catch (ClassNotFoundException e) { +// // THINK どうにか。。。w +// dialect = JiemamyPlugin.getDialectResolver().getAllInstance().get(0); +// } +// +// assert jiemamy != null; +// assert columns != null; +// assert dialect != null; +// } +// +// @Override +// protected JiemamyElement addItem() { +// Table table = getTableViewer().getTable(); +// JiemamyFactory factory = jiemamy.getFactory(); +// ColumnModel columnModel = factory.newModel(ColumnModel.class); +// columnModel.setName("COLUMN_" + (columns.size() + 1)); +// +// BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class); +// builtinDataType.setCategory(DataTypeCategory.INTEGER); +// columnModel.setDataType(builtinDataType); +// +// columns.add(columnModel); +// tableModel.getAttributes().add(columnModel); +// +// int addedIndex = columns.indexOf(columnModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtColumnName.setFocus(); +// +// return columnModel; +// } +// +// @Override +// protected void configureEditorControls() { +// super.configureEditorControls(); +// +// for (AvailableTypeInfo typeInfo : dialect.getAllDataTypes()) { +// cmbColumnType.add(typeInfo.getTypeName()); +// } +// +// txtColumnName.addFocusListener(new TextSelectionAdapter(txtColumnName)); +// txtColumnName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// txtColumnLogicalName.addFocusListener(new TextSelectionAdapter(txtColumnLogicalName)); +// txtColumnLogicalName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// txtCheckName.addFocusListener(new TextSelectionAdapter(txtCheckName)); +// txtCheckName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// txtCheckDefinition.addFocusListener(new TextSelectionAdapter(txtCheckDefinition)); +// txtCheckDefinition.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// cmbColumnType.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// updateModel(); +// enableEditDetailControls(columnEditIndex); +// columnEditor.refreshTable(); +// } +// }); +// txtColumnSize.addFocusListener(new TextSelectionAdapter(txtColumnSize)); +// txtColumnSize.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// txtDefaultValue.addFocusListener(new TextSelectionAdapter(txtDefaultValue)); +// txtDefaultValue.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// columnEditor.refreshTable(); +// } +// }); +// txtDescription.addFocusListener(new TextSelectionAdapter(txtDefaultValue)); +// txtDescription.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// } +// }); +// chkIsPK.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// updateModel(); +// enableEditDetailControls(columnEditIndex); +// columnEditor.refreshTable(); +// } +// }); +// chkIsUnique.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// updateModel(); +// enableEditDetailControls(columnEditIndex); +// columnEditor.refreshTable(); +// } +// }); +// chkIsNotNull.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// updateModel(); +// enableEditDetailControls(columnEditIndex); +// columnEditor.refreshTable(); +// } +// }); +// chkIsTypical.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// updateModel(); +// enableEditDetailControls(columnEditIndex); +// columnEditor.refreshTable(); +// } +// }); +// } +// +// @Override +// protected void configureTable(final Table table) { +// super.configureTable(table); +// +// table.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = table.getSelectionIndex(); +// if (index >= 0) { +// enableEditDetailControls(index); +// } else { +// disableEditDetailControls(); +// } +// } +// }); +// +// // THINK ↓要る? +//// 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) { +// tableViewer.setLabelProvider(new ColumnLabelProvider()); +// contentProvider = new ColumnContentProvider(); +// tableViewer.setContentProvider(contentProvider); +// tableViewer.setInput(columns); +// } +// +// @Override +// protected void createEditorControls(Composite parent) { +// GridData gd; +// Label label; +// +// Composite cmpNames = new Composite(parent, SWT.NULL); +// cmpNames.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// GridLayout layout = new GridLayout(4, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpNames.setLayout(layout); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText("カラム名"); // RESOURCE +// +// txtColumnName = new Text(cmpNames, SWT.BORDER); +// txtColumnName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText("論理名"); // RESOURCE +// +// txtColumnLogicalName = new Text(cmpNames, SWT.BORDER); +// txtColumnLogicalName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// Composite cmpCheckConstraint = new Composite(parent, SWT.NULL); +// cmpCheckConstraint.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// layout = new GridLayout(4, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpCheckConstraint.setLayout(layout); +// +// label = new Label(cmpCheckConstraint, SWT.NULL); +// label.setText("チェック制約名"); // RESOURCE +// +// txtCheckName = new Text(cmpCheckConstraint, SWT.BORDER); +// txtCheckName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// label = new Label(cmpCheckConstraint, SWT.NULL); +// label.setText("チェック制約式"); // RESOURCE +// +// txtCheckDefinition = new Text(cmpCheckConstraint, SWT.BORDER); +// txtCheckDefinition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// Composite cmpTypes = new Composite(parent, 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("型"); // RESOURCE +// +// cmbColumnType = new Combo(cmpTypes, SWT.READ_ONLY); +// cmbColumnType.setVisibleItemCount(20); +// +// label = new Label(cmpTypes, SWT.NULL); +// label.setText("サイズ"); // RESOURCE +// +// txtColumnSize = new Text(cmpTypes, SWT.BORDER); +// gd = new GridData(); +// gd.widthHint = 60; +// txtColumnSize.setLayoutData(gd); +// +// label = new Label(cmpTypes, SWT.NULL); +// label.setText("デフォルト値"); // RESOURCE +// +// txtDefaultValue = new Text(cmpTypes, SWT.BORDER); +// txtDefaultValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// Composite cmpDesc = new Composite(parent, 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("説明"); // RESOURCE +// txtDescription = new Text(cmpDesc, SWT.MULTI | SWT.BORDER); +// txtDescription.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// Composite cmpChecks = new Composite(parent, SWT.NULL); +// cmpChecks.setLayoutData(new GridData()); +// RowLayout rowLayout = new RowLayout(); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpChecks.setLayout(rowLayout); +// +// chkIsPK = new Button(cmpChecks, SWT.CHECK); +// chkIsPK.setText("主キー"); // RESOURCE +// +// chkIsUnique = new Button(cmpChecks, SWT.CHECK); +// chkIsUnique.setText("単独一意"); // RESOURCE +// +// chkIsNotNull = new Button(cmpChecks, SWT.CHECK); +// chkIsNotNull.setText("非NULL"); // RESOURCE +// +// chkIsTypical = new Button(cmpChecks, SWT.CHECK); +// chkIsTypical.setText("代表"); // RESOURCE +// } +// +// @Override +// protected void createTableColumns(Table table) { +// TableColumn col = new TableColumn(table, SWT.LEFT); +// col.setText(""); +// col.setWidth(20); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("カラム名"); // RESOURCE +// col.setWidth(200); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("データ型"); // RESOURCE +// col.setWidth(150); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("デフォルト値"); // RESOURCE +// col.setWidth(150); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("PK"); // RESOURCE +// col.setWidth(30); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("一意"); // RESOURCE +// col.setWidth(30); +// +// col = new TableColumn(table, SWT.LEFT); +// col.setText("NN"); +// col.setWidth(30); +// } +// +// @Override +// protected void disableEditDetailControls() { +// txtColumnName.setText(""); +// txtColumnLogicalName.setText(""); +// txtCheckName.setText(""); +// txtCheckDefinition.setText(""); +// cmbColumnType.setText(""); +// txtColumnSize.setText(""); +// chkIsPK.setSelection(false); +// chkIsUnique.setSelection(false); +// chkIsNotNull.setSelection(false); +// chkIsTypical.setSelection(false); +// txtDefaultValue.setText(""); +// txtDescription.setText(""); +// +// txtColumnName.setEnabled(false); +// txtColumnLogicalName.setEnabled(false); +// txtCheckName.setEnabled(false); +// txtCheckDefinition.setEnabled(false); +// cmbColumnType.setEnabled(false); +// txtColumnSize.setEnabled(false); +// chkIsPK.setEnabled(false); +// chkIsUnique.setEnabled(false); +// chkIsNotNull.setEnabled(false); +// chkIsTypical.setEnabled(false); +// txtDefaultValue.setEnabled(false); +// txtDescription.setEnabled(false); +// } +// +// @Override +// protected void enableEditDetailControls(int index) { +// ColumnModel column = columns.get(index); +// +// // 現在値の設定 +// txtColumnName.setText(column.getName()); +// txtColumnLogicalName.setText(column.getLogicalName()); +// txtCheckName.setText(column.getCheck().getName()); +// txtCheckDefinition.setText(column.getCheck().getDefinition()); +// if (column.getDataType().isDomain()) { +// cmbColumnType.setText(((DefinitionModel) column.getDataType()).getName()); +// } else { +// cmbColumnType.setText(rootModel.getDialect().convertToPrimitiveType(column.getDataType()).getName()); +// } +// txtDescription.setText(column.getDescription()); +// +// if (column.getDataType().isDomain()) { +// DefinitionModel definition = (DefinitionModel) column.getDataType(); +// +// txtColumnSize.setText(String.valueOf(definition.getSize())); +// txtDefaultValue.setText(definition.getDefaultValue()); +// } else { +// txtColumnSize.setText(String.valueOf(column.getSize())); +// txtDefaultValue.setText(column.getDefaultValue()); +// } +// +// chkIsPK.setSelection(column.getConstraint(DefinitionModel.CONSTRAINT_PRIMARY_KEY)); +// if (column.getDataType().isDomain()) { +// DefinitionModel definition = (DefinitionModel) column.getDataType(); +// chkIsUnique.setSelection(definition.getConstraint(DefinitionModel.CONSTRAINT_UNIQUE)); +// chkIsNotNull.setSelection(definition.getConstraint(DefinitionModel.CONSTRAINT_NOT_NULL)); +// } else { +// chkIsUnique.setSelection(column.getConstraint(DefinitionModel.CONSTRAINT_UNIQUE)); +// chkIsNotNull.setSelection(column.getConstraint(DefinitionModel.CONSTRAINT_NOT_NULL)); +// } +// chkIsTypical.setSelection(column.getConstraint(DefinitionModel.CONSTRAINT_TYPICAL)); +// +// txtColumnName.setEnabled(true); +// txtColumnLogicalName.setEnabled(true); +// txtCheckName.setEnabled(true); +// txtCheckDefinition.setEnabled(true); +// cmbColumnType.setEnabled(true); +// txtColumnSize.setEnabled(true); +// txtDefaultValue.setEnabled(true); +// txtDescription.setEnabled(true); +// chkIsPK.setEnabled(true); +// chkIsUnique.setEnabled(true); +// chkIsNotNull.setEnabled(true); +// chkIsTypical.setEnabled(true); +// } +// +// @Override +// protected JiemamyElement insertTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// +// JiemamyFactory factory = jiemamy.getFactory(); +// ColumnModel columnModel = factory.newModel(ColumnModel.class); +// columnModel.setName("COLUMN_" + (columns.size() + 1)); +// +// BuiltinDataType builtinDataType = factory.newModel(BuiltinDataType.class); +// builtinDataType.setCategory(DataTypeCategory.INTEGER); +// columnModel.setDataType(builtinDataType); +// +// if (index < 0 || index > table.getItemCount()) { +// tableModel.getAttributes().add(columnModel); +// columns.add(columnModel); +// } else { +// // FIXME attributesに対しては、indexを調整しないと。 +// tableModel.getAttributes().add(index, columnModel); +// columns.add(index, columnModel); +// } +// +// int addedIndex = columns.indexOf(columnModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtColumnName.setFocus(); +// +// return columnModel; +// } +// +// @Override +// protected void moveDownTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// if (index < 0 || index >= table.getItemCount()) { +// return; +// } +// +// // FIXME attributesに対しては、indexを調整しないと。 +// ListUtils.moveDown(tableModel.getAttributes(), index); +// ListUtils.moveDown(columns, index); +// +// table.setSelection(index + 1); +// enableEditControls(index + 1); +// } +// +// @Override +// protected void moveUpTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// if (index <= 0 || index > table.getItemCount()) { +// return; +// } +// +// // FIXME attributesに対しては、indexを調整しないと。 +// ListUtils.moveUp(tableModel.getAttributes(), index); +// ListUtils.moveUp(columns, index); +// +// table.setSelection(index - 1); +// enableEditControls(index - 1); +// } +// +// @Override +// protected JiemamyElement removeTableSelectionItem() { +// TableViewer tableViewer = getTableViewer(); +// Table table = tableViewer.getTable(); +// int index = table.getSelectionIndex(); +// if (index < 0 || index > table.getItemCount()) { +// return null; +// } +// ColumnModel columnToRemove = columns.remove(index); +// tableModel.getAttributes().remove(columnToRemove); +// tableViewer.remove(columnToRemove); +// table.setSelection(index); +// +// disableEditControls(); +// +// return columnToRemove; +// } +// +// private void updateModel() { +// int columnEditIndex = getTableViewer().getTable().getSelectionIndex(); +// int selectionInedx = cmbColumnType.getSelectionIndex(); +// +// if (columnEditIndex != -1 && selectionInedx != -1) { +// ColumnModel column = columns.get(columnEditIndex); +// column.setName(txtColumnName.getText()); +// column.setLogicalName(txtColumnLogicalName.getText()); +// column.getCheck().setName(txtCheckName.getText()); +// column.getCheck().setDefinition(txtCheckDefinition.getText()); +// +// DataType selectedType = allTypes.get(selectionInedx); +// +// column.setDataType(selectedType); +// +// if (!column.getDataType().isDomain()) { +// if (rootModel.getDialect().convertToPrimitiveType(column.getDataType()).getSizeSupportLevel() == DataType.SIZE.NOT_SUPPORTED) { +// column.setSize(""); +// } else { +// column.setSize(txtColumnSize.getText()); +// } +// } +// column.setDefaultValue(txtDefaultValue.getText()); +// column.setDescription(txtDescription.getText()); +// +// column.setConstraint(DefinitionModel.CONSTRAINT_PRIMARY_KEY, chkIsPK.getSelection()); +// +// if (!column.getDataType().isDomain()) { +// column.setConstraint(DefinitionModel.CONSTRAINT_UNIQUE, chkIsUnique.getSelection()); +// column.setConstraint(DefinitionModel.CONSTRAINT_NOT_NULL, chkIsNotNull.getSelection()); +// } +// +// if (chkIsTypical.getSelection()) { +// tableModel.clearTypical(); +// } +// column.setConstraint(DefinitionModel.CONSTRAINT_TYPICAL, chkIsTypical.getSelection()); +// } +// } +// } +//} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogColumnTab.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,553 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +// +//import java.util.Collections; +// +//import org.eclipse.jface.dialogs.Dialog; +//import org.eclipse.swt.SWT; +//import org.eclipse.swt.events.KeyAdapter; +//import org.eclipse.swt.events.KeyEvent; +//import org.eclipse.swt.events.SelectionAdapter; +//import org.eclipse.swt.events.SelectionEvent; +//import org.eclipse.swt.layout.GridData; +//import org.eclipse.swt.layout.GridLayout; +//import org.eclipse.swt.widgets.Button; +//import org.eclipse.swt.widgets.Composite; +//import org.eclipse.swt.widgets.Group; +//import org.eclipse.swt.widgets.Label; +//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.TableItem; +//import org.eclipse.swt.widgets.Text; +// +//import org.jiemamy.eclipse.JiemamyPlugin; +//import org.jiemamy.eclipse.ui.AbstractTableEditor; +//import org.jiemamy.eclipse.ui.helper.TextSelectionAdapter; +//import org.jiemamy.eclipse.ui.tab.AbstractTab; +//import org.jiemamy.model.RootModel; +//import org.jiemamy.model.entity.TableModel; +//import org.jiemamy.model.index.IndexColumnModel; +//import org.jiemamy.model.index.IndexModel; +// +///** +// * テーブル編集ダイアログの「インデックス」タブ +// * +// * @author daisuke +// */ +//public class TableEditDialogIndexTab extends AbstractTab { +// +// private RootModel rootModel; +// +// private TableModel tableModel; +// +// private int indexEditIndex = -1; +// +// private int indexColumnEditIndex = -1; +// +// private AbstractTableEditor indexesEditArea; +// +// private AbstractTableEditor indexColumnsEditArea; +// +// private Text txtIndexName; +// +// private Button chkIsUniqueIndex; +// +// private Button radSortNone; +// +// private Button radSortAsc; +// +// private Button radSortDesc; +// +// +// /** +// * インスタンスを生成する。 +// * +// * @param parentTabFolder +// * @param style +// * @param tableModel +// */ +// public TableEditDialogIndexTab(TabFolder parentTabFolder, int style, TableModel tableModel) { +// super(parentTabFolder, style, "インデックス"); // RESOURCE +// this.tableModel = tableModel; +// } +// +// @Override +// public Composite createTabArea(TabFolder parentTabFolder) { +// Composite composite = new Composite(parentTabFolder, SWT.NULL); +// composite.setLayout(new GridLayout(2, false)); +// composite.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// TabItem tabIndex = new TabItem(parentTabFolder, SWT.NONE); +// tabIndex.setText(JiemamyPlugin.getResourceString("dialog.table.tab.index")); +// tabIndex.setControl(composite); +// +// createIndexTab(composite); +// +// disableIndexForm(); +// disableIndexColumnForm(); +// +// return composite; +// } +// +// private void createIndexTab(Composite parent) { +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.index.group")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); +// group.setLayout(new GridLayout(1, false)); +// +// indexesEditArea = new IndexTableEditor(); +// indexesEditArea.createControlArea(group); +// +// group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.group")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); +// group.setLayout(new GridLayout(1, false)); +// +// indexColumnsEditArea = new IndexColumnTableEditor(); +// indexColumnsEditArea.createControlArea(group); +// } +// +// private void disableIndexColumnForm() { +// indexColumnEditIndex = -1; +// +// radSortNone.setEnabled(false); +// radSortAsc.setEnabled(false); +// radSortDesc.setEnabled(false); +// +// radSortNone.setSelection(false); +// radSortAsc.setSelection(false); +// radSortDesc.setSelection(false); +// +// indexColumnsEditArea.getBtnRemove().setEnabled(false); +// indexColumnsEditArea.getBtnMoveUp().setEnabled(false); +// indexColumnsEditArea.getBtnMoveDown().setEnabled(false); +// } +// +// private void disableIndexForm() { +// indexEditIndex = -1; +// +// txtIndexName.setEnabled(false); +//// txtIndexLogicalName.setEnabled(false); +// chkIsUniqueIndex.setEnabled(false); +// +// txtIndexName.setText(""); +//// txtIndexLogicalName.setText(""); +// chkIsUniqueIndex.setSelection(false); +// +// indexesEditArea.getBtnRemove().setEnabled(false); +// indexesEditArea.getBtnMoveUp().setEnabled(false); +// indexesEditArea.getBtnMoveDown().setEnabled(false); +// +// indexColumnsEditArea.getBtnAdd().setEnabled(false); +// } +// +// private void enableIndexColumnForm(int index) { +// if (indexEditIndex >= 0) { +// IndexModel indexModel = tableModel.getIndex(indexEditIndex); +// IndexColumnModel indexColumnModel = indexModel.getColumn(index); +// +// indexColumnEditIndex = index; +// +// radSortNone.setEnabled(true); +// radSortAsc.setEnabled(true); +// radSortDesc.setEnabled(true); +// +// radSortNone.setSelection(false); +// radSortAsc.setSelection(false); +// radSortDesc.setSelection(false); +// if (indexColumnModel.getSort().equals(IndexColumnModel.SORT_ASC)) { +// radSortAsc.setSelection(true); +// } else if (indexColumnModel.getSort().equals(IndexColumnModel.SORT_DESC)) { +// radSortDesc.setSelection(true); +// } else { +// radSortNone.setSelection(true); +// } +// +// indexColumnsEditArea.getBtnRemove().setEnabled(true); +// // 選択が一番上だった場合 +// indexColumnsEditArea.getBtnMoveUp().setEnabled(index > 0); +// // 選択が一番下だった場合 +// indexColumnsEditArea.getBtnMoveDown().setEnabled(index + 1 < indexesEditArea.getTable().getItemCount()); +// } +// } +// +// private void enableIndexForm(int index) { +// IndexModel indexModel = tableModel.getIndex(index); +// +// indexEditIndex = index; +// +// txtIndexName.setEnabled(true); +//// txtIndexLogicalName.setEnabled(true); +// chkIsUniqueIndex.setEnabled(true); +// +// txtIndexName.setText(indexModel.getName()); +//// txtIndexLogicalName.setText(indexModel.getLogicalName()); +// chkIsUniqueIndex.setSelection(indexModel.isUnique()); +// +// indexesEditArea.getBtnRemove().setEnabled(true); +// // 選択が一番上だった場合 +// indexesEditArea.getBtnMoveUp().setEnabled(index > 0); +// // 選択が一番下だった場合 +// indexesEditArea.getBtnMoveDown().setEnabled(index + 1 < indexesEditArea.getTable().getItemCount()); +// +// indexColumnsEditArea.getBtnAdd().setEnabled(true); +// indexColumnsEditArea.refreshTable(); +// } +// +// private void updateIndexColumnTableItem(TableItem item, IndexColumnModel indexColumnModel) { +// item.setText(0, indexColumnModel.createTableDisplayString()); +// item.setText(1, indexColumnModel.getSort().trim()); +// } +// +// private void updateIndexTableItem(TableItem item, IndexModel indexModel) { +// item.setText(0, indexModel.createTableDisplayString()); +// item.setText(1, String.valueOf(indexModel.isUnique())); +// } +// +// private void updateModel() { +// if (indexEditIndex != -1) { +// IndexModel indexModel = tableModel.getIndex(indexEditIndex); +// indexModel.setName(txtIndexName.getText()); +//// model.setLogicalName(txtIndexLogicalName.getText()); +// indexModel.setUnique(chkIsUniqueIndex.getSelection()); +// +// TableItem indexItem = indexesEditArea.getTable().getItem(indexEditIndex); +// updateIndexTableItem(indexItem, indexModel); +// +// if (indexColumnEditIndex != -1) { +// IndexColumnModel indexColumnModel = indexModel.getColumn(indexColumnEditIndex); +//// indexColumnModel.getColumn(). addとかremoveとか +// if (radSortAsc.getSelection()) { +// indexColumnModel.setSort(IndexColumnModel.SORT_ASC); +// } else if (radSortDesc.getSelection()) { +// indexColumnModel.setSort(IndexColumnModel.SORT_DESC); +// } else { +// indexColumnModel.setSort(IndexColumnModel.SORT_NONE); +// } +// +// TableItem indexColumnItem = indexColumnsEditArea.getTable().getItem(indexColumnEditIndex); +// updateIndexColumnTableItem(indexColumnItem, indexColumnModel); +// } +// } +// } +// +// +// private class IndexColumnTableEditor extends AbstractTableEditor { +// +// public IndexColumnTableEditor() { +// super(); +// } +// +// @Override +// public void refreshTable() { +// getTable().removeAll(); +// if (indexEditIndex > -1) { +// IndexModel indexModel = tableModel.getIndex(indexEditIndex); +// for (IndexColumnModel indexColumnModel : indexModel.getColumns()) { +// TableItem item = new TableItem(getTable(), SWT.NULL); +// updateIndexColumnTableItem(item, indexColumnModel); +// } +// } +// } +// +// @Override +// protected void configureEditButtons() { +// getBtnAdd().setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.btn.add")); +// getBtnAdd().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// ColumnSelectDialog dialog = +// new ColumnSelectDialog(getBtnAdd().getParent().getShell(), tableModel.getColumns(), +// rootModel.getDialect()); +// +// if (dialog.open() == Dialog.OK && dialog.getResult() != null && indexEditIndex > -1) { +// IndexColumnModel indexColumnModel = new IndexColumnModel(); +// +// indexColumnModel.setColumn(dialog.getResult()); +// +// tableModel.getIndex(indexEditIndex).addColumn(indexColumnModel); +// +// TableItem item = new TableItem(getTable(), SWT.NULL); +// updateIndexColumnTableItem(item, indexColumnModel); +// } +// } +// }); +// +// getBtnRemove().setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.btn.remove")); +// getBtnRemove().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index < 0 || index > getTable().getItemCount()) { +// return; +// } +// +// tableModel.getIndex(indexEditIndex).removeColumn(index); +// getTable().remove(index); +// disableIndexColumnForm(); +// } +// }); +// +// getBtnMoveUp().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index <= 0 || index > getTable().getItemCount()) { +// return; +// } +// +// Collections.swap(tableModel.getIndex(indexEditIndex).getColumns(), index, index - 1); +// +// refreshTable(); +// getTable().setSelection(index - 1); +// enableIndexColumnForm(index - 1); +// } +// }); +// +// getBtnMoveDown().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index < 0 || index >= getTable().getItemCount()) { +// return; +// } +// +// Collections.swap(tableModel.getIndex(indexEditIndex).getColumns(), index, index + 1); +// +// refreshTable(); +// getTable().setSelection(index + 1); +// enableIndexColumnForm(index + 1); +// } +// }); +// } +// +// @Override +// protected void createEditorControls(Composite parent) { +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.title")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// group.setLayout(new GridLayout(3, false)); +// +// radSortNone = new Button(group, SWT.RADIO); +// radSortNone.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.none")); +// radSortNone.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// +// radSortAsc = new Button(group, SWT.RADIO); +// radSortAsc.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.asc")); +// radSortAsc.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// +// radSortDesc = new Button(group, SWT.RADIO); +// radSortDesc.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.desc")); +// radSortDesc.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// +// return group; +// } +// +// @Override +// protected void createTableColumns() { +// TableColumn colColumn = new TableColumn(getTable(), SWT.LEFT); +// colColumn.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.tbl.header.column")); +// colColumn.setWidth(180); +// +// TableColumn colSort = new TableColumn(getTable(), SWT.LEFT); +// colSort.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.tbl.header.sort")); +// colSort.setWidth(50); +// +// refreshTable(); +// +// getTable().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index >= 0) { +// enableIndexColumnForm(index); +// } else { +// disableIndexColumnForm(); +// } +// } +// }); +// } +// } +// +// private class IndexTableEditor extends AbstractTableEditor { +// +// public IndexTableEditor() { +// super(); +// } +// +// @Override +// public void refreshTable() { +// getTable().removeAll(); +// for (IndexModel model : tableModel.getIndexes()) { +// TableItem item = new TableItem(getTable(), SWT.NULL); +// updateIndexTableItem(item, model); +// } +// } +// +// @Override +// protected void configureEditButtons() { +// getBtnAdd().setText(JiemamyPlugin.getResourceString("dialog.table.index.btn.add")); +// getBtnAdd().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// IndexModel index = new IndexModel(); +// index.setName("idx_" + tableModel.getName() + "_" + (tableModel.getIndexes().size() + 1)); +// tableModel.addIndex(index); +// +// TableItem item = new TableItem(getTable(), SWT.NULL); +// updateIndexTableItem(item, index); +// } +// }); +// +// getBtnRemove().setText(JiemamyPlugin.getResourceString("dialog.table.index.btn.remove")); +// getBtnRemove().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index < 0 || index > getTable().getItemCount()) { +// return; +// } +// +// tableModel.removeIndex(getTable().getSelectionIndex()); +// getTable().remove(getTable().getSelectionIndex()); +// disableIndexForm(); +// disableIndexColumnForm(); +// indexColumnsEditArea.getTable().clearAll(); +// } +// }); +// +// getBtnMoveUp().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index <= 0 || index > getTable().getItemCount()) { +// return; +// } +// +// tableModel.moveUpIndex(index); +// +// refreshTable(); +// getTable().setSelection(index - 1); +// enableIndexForm(index - 1); +// } +// }); +// +// getBtnMoveDown().addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = getTable().getSelectionIndex(); +// if (index < 0 || index >= getTable().getItemCount()) { +// return; +// } +// +// tableModel.moveDownIndex(index); +// +// refreshTable(); +// getTable().setSelection(index + 1); +// enableIndexForm(index + 1); +// } +// }); +// } +// +// @Override +// protected Composite createDetailEditControls(Composite parent) { +// Label label; +// +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.index.title")); +// 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)); +// // 論理名つける場合は 2→4 +// GridLayout layout = new GridLayout(2, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpNames.setLayout(layout); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.index.label.name")); +// +// txtIndexName = new Text(cmpNames, SWT.BORDER); +// txtIndexName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// txtIndexName.addFocusListener(new TextSelectionAdapter(txtIndexName)); +// txtIndexName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// } +// }); +// +// chkIsUniqueIndex = new Button(group, SWT.CHECK); +// chkIsUniqueIndex.setText(JiemamyPlugin.getResourceString("dialog.table.index.label.unique")); +// chkIsUniqueIndex.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// +// return group; +// } +// +// @Override +// protected void createTableColumns(final Table table) { +// TableColumn colName = new TableColumn(table, SWT.LEFT); +// colName.setText(JiemamyPlugin.getResourceString("dialog.table.index.tbl.header.indexName")); +// colName.setWidth(180); +// +// TableColumn colUnique = new TableColumn(table, SWT.LEFT); +// colUnique.setText(JiemamyPlugin.getResourceString("dialog.table.index.tbl.header.unique")); +// colUnique.setWidth(50); +// +// refreshTable(); +// +// table.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = table.getSelectionIndex(); +// if (index >= 0) { +// enableIndexForm(index); +// disableIndexColumnForm(); +// } else { +// disableIndexForm(); +// disableIndexColumnForm(); +// } +// } +// }); +// } +// } +//} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab2.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab2.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab2.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,734 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +// +//import org.eclipse.jface.dialogs.Dialog; +//import org.eclipse.jface.viewers.ArrayContentProvider; +//import org.eclipse.jface.viewers.BaseLabelProvider; +//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.KeyAdapter; +//import org.eclipse.swt.events.KeyEvent; +//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.widgets.Button; +//import org.eclipse.swt.widgets.Composite; +//import org.eclipse.swt.widgets.Group; +//import org.eclipse.swt.widgets.Label; +//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.jiemamy.eclipse.JiemamyPlugin; +//import org.jiemamy.eclipse.ui.AbstractTableEditor; +//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.entity.TableModel; +//import org.jiemamy.model.index.IndexColumnModel; +//import org.jiemamy.model.index.IndexModel; +// +///** +// * テーブル編集ダイアログの「インデックス」タブ +// * +// * @author daisuke +// */ +//public class TableEditDialogIndexTab2 extends AbstractTab { +// +// private TableModel tableModel; +// +// private RootModel rootModel; +// +//// private int indexEditIndex = -1; +//// private int indexColumnEditIndex = -1; +// +// private AbstractTableEditor indexesEditArea; +// +// private IndexContentProvider indexContentProvider; +// +// private AbstractTableEditor indexColumnsEditArea; +// +// private IndexColumnContentProvider indexColumnContentProvider; +// +// private Text txtIndexName; +// +// private Button chkIsUniqueIndex; +// +// private Button radSortNone; +// +// private Button radSortAsc; +// +// private Button radSortDesc; +// +// +// public TableEditDialogIndexTab2(TabFolder parentTabFolder, int style, TableModel tableModel) { +// super(parentTabFolder, style, "インデックス"); // RESOURCE +// this.tableModel = tableModel; +// } +// +// @Override +// public Composite createTabArea(TabFolder parentTabFolder) { +// Composite composite = new Composite(parentTabFolder, SWT.NULL); +// composite.setLayout(new GridLayout(2, false)); +// composite.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// TabItem tabIndex = new TabItem(parentTabFolder, SWT.NONE); +// tabIndex.setText(JiemamyPlugin.getResourceString("dialog.table.tab.index")); +// tabIndex.setControl(composite); +// +// createIndexTab(composite); +// indexesEditArea.disableEditControls(); +// indexColumnsEditArea.disableEditControls(); +// +// return composite; +// } +// +// private void createIndexTab(Composite parent) { +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.index.group")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); +// group.setLayout(new GridLayout(1, false)); +// +// indexesEditArea = new IndexTableEditor(tableModel); +// indexesEditArea.setAddLabel(JiemamyPlugin.getResourceString("dialog.table.index.btn.add")); +// indexesEditArea.setInsertLabel(JiemamyPlugin.getResourceString("dialog.table.index.btn.insert")); +// indexesEditArea.setRemoveLabel(JiemamyPlugin.getResourceString("dialog.table.index.btn.remove")); +// indexesEditArea.createControlArea(group); +// +// group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.group")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL)); +// group.setLayout(new GridLayout(1, false)); +// +// indexColumnsEditArea = new IndexColumnEditTableArea(tableModel); +// indexColumnsEditArea.setAddLabel(JiemamyPlugin.getResourceString("dialog.table.indexColumn.btn.add")); +// indexColumnsEditArea.setInsertLabel(JiemamyPlugin.getResourceString("dialog.table.indexColumn.btn.insert")); +// indexColumnsEditArea.setRemoveLabel(JiemamyPlugin.getResourceString("dialog.table.indexColumn.btn.remove")); +// indexColumnsEditArea.createControlArea(group); +// } +// +// +// private class IndexColumnContentProvider extends ArrayContentProvider implements CommandListener { +// +// private Viewer viewer; +// +// +// public void commandExecuted(Command command) { +//// if (evt.getPropertyName().equals(IndexModel.P_INDEX_COLUMNS)) { +// indexColumnsEditArea.refreshTable(); // インデックスカラムの変更を反映させる。 +//// } else if (evt.getSource() instanceof DefinitionModel) { +//// indexColumnsEditArea.refreshTable(); // インデックスカラムの変更を反映させる。 +//// if (evt.getPropertyName().equals(IndexColumnModel.P_CREATE)) { +//// // nothing to do +//// } else if (evt.getPropertyName().equals(IndexColumnModel.P_DELETE)) { +//// ((AbstractModel) evt.getSource()).removePropertyChangeListener(this); +//// } else if (evt.getPropertyName().equals(IndexColumnModel.P_REVERT)) { +//// ((AbstractModel) evt.getSource()).addPropertyChangeListener(this); +//// } +//// } +// } +// +// @Override +// public void dispose() { +//// tableModel.removePropertyChangeListener(this); +//// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +//// for (IndexColumnModel column : tableModel.getIndexes().get(indexIndex).getColumns()) { +//// ((AbstractModel) column).removePropertyChangeListener(this); +//// } +// super.dispose(); +// } +// +// public JiemamyElement getTargetModel() { +// return (JiemamyElement) viewer.getInput(); +// } +// +// @Override +// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { +// this.viewer = viewer; +//// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +//// if (oldInput != null) { +//// tableModel.removePropertyChangeListener(this); +//// for (IndexColumnModel column : tableModel.getIndexes().get(indexIndex).getColumns()) { +//// ((AbstractModel) column).removePropertyChangeListener(this); +//// } +//// } +//// if (newInput != null) { +//// tableModel.addPropertyChangeListener(this); +//// for (IndexColumnModel column : tableModel.getIndexes().get(indexIndex).getColumns()) { +//// ((AbstractModel) column).addPropertyChangeListener(this); +//// } +//// } +// +// super.inputChanged(viewer, oldInput, newInput); +// } +// +// } +// +// private class IndexColumnEditTableArea extends AbstractTableEditor { +// +// private TableModel tableModel; +// +// +// public IndexColumnEditTableArea(TableModel targetModel) { +// super(); +// tableModel = targetModel; +// } +// +// public void updateInput() { +// TableViewer tableViewer = getTableViewer(); +// int index = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// if (index >= 0) { +// tableViewer.setInput(tableModel.getIndexes().get(index)); +// } else { +// tableViewer.setInput(null); +// } +// } +// +// @Override +// protected JiemamyElement addItem() { +// Table table = getTableViewer().getTable(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// ColumnSelectDialog dialog = +// new ColumnSelectDialog(table.getShell(), tableModel.getColumns(), rootModel.getDialect()); +// +// if (dialog.open() == Dialog.OK && dialog.getResult() != null && indexIndex != -1) { +// IndexColumnModel indexColumnModel = new IndexColumnModel(); +// +// indexColumnModel.setColumn(dialog.getResult()); +// +// indexColumnModel.firePropertyChange(DefinitionModel.P_CREATE, null, indexColumnModel); +// indexColumnModel.addPropertyChangeListener(indexColumnContentProvider); +// +// tableModel.getIndexes().get(indexIndex).addColumn(indexColumnModel); +// +// int addedIndex = tableModel.getIndexes().get(indexIndex).getColumns().indexOf(indexColumnModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// +// return indexColumnModel; +// } +// return null; +// } +// +// @Override +// protected void configureEditorControls() { +// radSortNone.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// radSortAsc.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// radSortDesc.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// } +// +// @Override +// protected void configureTable(Table table) { +// super.configureTable(table); +// } +// +// @Override +// protected void configureTableViewer(TableViewer tableViewer) { +// tableViewer.setLabelProvider(new IndexColumnLabelProvider()); +// indexColumnContentProvider = new IndexColumnContentProvider(); +// tableViewer.setContentProvider(indexColumnContentProvider); +// +// int index = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// if (index >= 0) { +// tableViewer.setInput(tableModel.getIndexes().get(index)); +// } else { +// tableViewer.setInput(null); +// } +// } +// +// @Override +// protected Composite createEditDetailControls(Composite parent) { +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.title")); +// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// group.setLayout(new GridLayout(3, false)); +// +// radSortNone = new Button(group, SWT.RADIO); +// radSortNone.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.none")); +// +// radSortAsc = new Button(group, SWT.RADIO); +// radSortAsc.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.asc")); +// +// radSortDesc = new Button(group, SWT.RADIO); +// radSortDesc.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.label.desc")); +// +// return group; +// } +// +// @Override +// protected void createTableColumns(Table table) { +// TableColumn colColumn = new TableColumn(table, SWT.LEFT); +// colColumn.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.tbl.header.column")); +// colColumn.setWidth(180); +// +// TableColumn colSort = new TableColumn(table, SWT.LEFT); +// colSort.setText(JiemamyPlugin.getResourceString("dialog.table.indexColumn.tbl.header.sort")); +// colSort.setWidth(50); +// } +// +// @Override +// protected void disableEditDetailControls() { +// radSortNone.setEnabled(false); +// radSortAsc.setEnabled(false); +// radSortDesc.setEnabled(false); +// +// radSortNone.setSelection(false); +// radSortAsc.setSelection(false); +// radSortDesc.setSelection(false); +// } +// +// @Override +// protected void enableEditDetailControls(int index) { +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// +// IndexModel indexModel = tableModel.getIndexes().get(indexIndex); +// IndexColumnModel indexColumnModel = indexModel.getColumn(index); +// +// radSortNone.setEnabled(true); +// radSortAsc.setEnabled(true); +// radSortDesc.setEnabled(true); +// +// radSortNone.setSelection(false); +// radSortAsc.setSelection(false); +// radSortDesc.setSelection(false); +// if (indexColumnModel.getSort().equals(IndexColumnModel.SORT_ASC)) { +// radSortAsc.setSelection(true); +// } else if (indexColumnModel.getSort().equals(IndexColumnModel.SORT_DESC)) { +// radSortDesc.setSelection(true); +// } else { +// radSortNone.setSelection(true); +// } +// } +// +// @Override +// protected JiemamyElement insertTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// ColumnSelectDialog dialog = +// new ColumnSelectDialog(table.getShell(), tableModel.getColumns(), rootModel.getDialect()); +// +// if (dialog.open() == Dialog.OK && dialog.getResult() != null && indexIndex != -1) { +// IndexColumnModel indexColumnModel = new IndexColumnModel(); +// +// indexColumnModel.setColumn(dialog.getResult()); +// +// if (index < 0 || index > table.getItemCount()) { +// tableModel.getIndexes().get(indexIndex).addColumn(indexColumnModel); +// } else { +// tableModel.getIndexes().get(indexIndex).addColumn(index, indexColumnModel); +// } +// +// int addedIndex = tableModel.getIndexes().get(indexIndex).getColumns().indexOf(indexColumnModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// +// return indexColumnModel; +// } +// return null; +// } +// +// @Override +// protected void moveDownTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// if (index < 0 || index >= table.getItemCount()) { +// return; +// } +// +// tableModel.getIndexes().get(indexIndex).moveDownColumn(index); +// +// table.setSelection(index + 1); +// enableEditControls(index + 1); +// } +// +// @Override +// protected void moveUpTableSelectionItem() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// if (index <= 0 || index > table.getItemCount()) { +// return; +// } +// +// tableModel.getIndexes().get(indexIndex).moveUpColumn(index); +// +// table.setSelection(index - 1); +// enableEditControls(index - 1); +// } +// +// @Override +// protected JiemamyElement removeTableSelectionItem() { +// TableViewer tableViewer = getTableViewer(); +// Table table = tableViewer.getTable(); +// int index = table.getSelectionIndex(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// if (index < 0 || index > table.getItemCount()) { +// return null; +// } +// IndexColumnModel removed = tableModel.getIndexes().get(indexIndex).removeColumn(index); +// +// tableViewer.remove(index); +// +// disableEditControls(); +// +// return removed; +// } +// +// private void updateModel() { +// Table table = getTableViewer().getTable(); +// int index = table.getSelectionIndex(); +// int indexIndex = ((IndexTableEditor) indexesEditArea).getTable().getSelectionIndex(); +// +// if (indexIndex != -1 && index != -1) { +// IndexColumnModel indexColumnModel = tableModel.getIndexes().get(indexIndex).getColumn(index); +// // indexColumnModel.getColumn(). addとかremoveとか +// if (radSortAsc.getSelection()) { +// indexColumnModel.setSort(IndexColumnModel.SORT_ASC); +// } else if (radSortDesc.getSelection()) { +// indexColumnModel.setSort(IndexColumnModel.SORT_DESC); +// } else { +// indexColumnModel.setSort(IndexColumnModel.SORT_NONE); +// } +// } +// } +// } +// +// private class IndexColumnLabelProvider extends BaseLabelProvider implements ITableLabelProvider { +// +// public Image getColumnImage(Object element, int columnIndex) { +// return null; +// } +// +// public String getColumnText(Object element, int columnIndex) { +// IndexColumnModel indexColumnModel = (IndexColumnModel) element; +// switch (columnIndex) { +// case 0: +// return indexColumnModel.createTableDisplayString(); +// case 1: +// return indexColumnModel.getSort().trim(); +// +// default: +// return ""; +// } +// } +// } +// +// private class IndexContentProvider extends ArrayContentProvider implements CommandListener { +// +// @SuppressWarnings("unused") +// private Viewer viewer; +// +// +// public void commandExecuted(Command command) { +//// if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_INDEXES)) { +// indexesEditArea.refreshTable(); // インデックスの変更を反映させる。 +//// } else if (evt.getSource() instanceof DefinitionModel) { +//// indexesEditArea.refreshTable(); // インデックスの変更を反映させる。 +//// if (evt.getPropertyName().equals(IndexModel.P_CREATE)) { +//// // nothing to do +//// } else if (evt.getPropertyName().equals(IndexModel.P_DELETE)) { +//// ((JiemamyElement) evt.getSource()).removePropertyChangeListener(this); +//// } else if (evt.getPropertyName().equals(IndexModel.P_REVERT)) { +//// ((JiemamyElement) evt.getSource()).addPropertyChangeListener(this); +//// } +//// } +// } +// +// @Override +// public void dispose() { +//// tableModel.removePropertyChangeListener(this); +//// for (IndexModel column : tableModel.getIndexes().get()) { +//// ((JiemamyElement) column).removePropertyChangeListener(this); +//// } +// super.dispose(); +// } +// +// public JiemamyElement getTargetModel() { +// // TODO Auto-generated method stub +// return null; +// } +// +// @Override +// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { +// this.viewer = viewer; +//// if (oldInput != null) { +//// tableModel.removePropertyChangeListener(this); +//// for (IndexModel indexModel : tableModel.getIndexes().get()) { +//// ((JiemamyElement) indexModel).removePropertyChangeListener(this); +//// } +//// } +//// if (newInput != null) { +//// tableModel.addPropertyChangeListener(this); +//// for (IndexModel indexModel : tableModel.getIndexes().get()) { +//// ((JiemamyElement) indexModel).addPropertyChangeListener(this); +//// } +//// } +// +// super.inputChanged(viewer, oldInput, newInput); +// } +// } +// +// private class IndexLabelProvider extends BaseLabelProvider implements ITableLabelProvider { +// +// public Image getColumnImage(Object element, int columnIndex) { +// return null; +// } +// +// public String getColumnText(Object element, int columnIndex) { +// IndexModel indexModel = (IndexModel) element; +// switch (columnIndex) { +// case 0: +// return indexModel.createTableDisplayString(); +// case 1: +// return String.valueOf(indexModel.isUnique()); +// +// default: +// return ""; +// } +// } +// } +// +// private class IndexTableEditor extends AbstractTableEditor { +// +// private TableModel tableModel; +// +// private Table table; +// +// +// public IndexTableEditor(TableModel targetModel) { +// super(); +// tableModel = targetModel; +// } +// +// public Table getTable() { +// return table; +// } +// +// @Override +// protected JiemamyElement addItem() { +// IndexModel indexModel = new IndexModel(); +// indexModel.setName("idx_" + tableModel.getName() + "_" + (tableModel.getIndexes().size() + 1)); +// +// tableModel.getIndexes().add(indexModel); +// +// int addedIndex = tableModel.getIndexes().indexOf(indexModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtIndexName.setFocus(); +// +// return indexModel; +// } +// +// @Override +// protected void configureEditorControls() { +// txtIndexName.addFocusListener(new TextSelectionAdapter(txtIndexName)); +// txtIndexName.addKeyListener(new KeyAdapter() { +// +// @Override +// public void keyReleased(KeyEvent e) { +// updateModel(); +// } +// }); +// chkIsUniqueIndex.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// updateModel(); +// } +// }); +// } +// +// @Override +// protected void configureTable(final Table table) { +// super.configureTable(table); +// +// table.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// int index = table.getSelectionIndex(); +// if (index >= 0) { +// ((IndexColumnEditTableArea) indexColumnsEditArea).updateInput(); +// } else { +// indexColumnsEditArea.disableEditControls(); +// } +// } +// }); +// } +// +// @Override +// protected void configureTableViewer(TableViewer tableViewer) { +// tableViewer.setLabelProvider(new IndexLabelProvider()); +// indexContentProvider = new IndexContentProvider(); +// tableViewer.setContentProvider(indexContentProvider); +// tableViewer.setInput(tableModel.getIndexes()); +// } +// +// @Override +// protected void createEditorControls(Composite parent) { +// Label label; +// +// Group group = new Group(parent, SWT.NULL); +// group.setText(JiemamyPlugin.getResourceString("dialog.table.index.title")); +// 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)); +// // 論理名つける場合は 2→4 +// GridLayout layout = new GridLayout(2, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// cmpNames.setLayout(layout); +// +// label = new Label(cmpNames, SWT.NULL); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.index.label.name")); +// +// txtIndexName = new Text(cmpNames, SWT.BORDER); +// txtIndexName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +//// label = new Label(cmpNames, SWT.NULL); +//// label.setText(JiemamyPlugin.getDefault(). +//// getResourceString("dialog.table.index.label.logicalname")); +//// +//// txtIndexLogicalName = new Text(cmpNames, SWT.BORDER); +//// txtIndexLogicalName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); +// +// chkIsUniqueIndex = new Button(group, SWT.CHECK); +// chkIsUniqueIndex.setText(JiemamyPlugin.getResourceString("dialog.table.index.label.unique")); +// +// return group; +// } +// +// @Override +// protected void createTableColumns(Table table) { +// TableColumn colName = new TableColumn(table, SWT.LEFT); +// colName.setText(JiemamyPlugin.getResourceString("dialog.table.index.tbl.header.indexName")); +// colName.setWidth(180); +// +// TableColumn colUnique = new TableColumn(table, SWT.LEFT); +// colUnique.setText(JiemamyPlugin.getResourceString("dialog.table.index.tbl.header.unique")); +// colUnique.setWidth(50); +// } +// +// @Override +// protected void disableEditDetailControls() { +// txtIndexName.setEnabled(false); +// chkIsUniqueIndex.setEnabled(false); +// +// txtIndexName.setText(""); +// chkIsUniqueIndex.setSelection(false); +// } +// +// @Override +// protected void enableEditDetailControls(int index) { +// IndexModel indexModel = tableModel.getIndexes().get(index); +// +// txtIndexName.setEnabled(true); +// chkIsUniqueIndex.setEnabled(true); +// +// txtIndexName.setText(indexModel.getName()); +// chkIsUniqueIndex.setSelection(indexModel.isUnique()); +// } +// +// @Override +// protected JiemamyElement insertTableSelectionItem() { +// int index = table.getSelectionIndex(); +// IndexModel indexModel = new IndexModel(); +// indexModel.setName("idx_" + tableModel.getName() + "_" + (tableModel.getIndexes().size() + 1)); +// +// if (index < 0 || index > table.getItemCount()) { +// tableModel.addIndex(indexModel); +// } else { +// tableModel.addIndex(index, indexModel); +// } +// +// int addedIndex = tableModel.getColumns().indexOf(indexModel); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// txtIndexName.setFocus(); +// +// return indexModel; +// } +// +// @Override +// protected void moveDownTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index < 0 || index >= table.getItemCount()) { +// return; +// } +// +// tableModel.moveDownIndex(index); +// +// table.setSelection(index + 1); +// enableEditControls(index + 1); +// } +// +// @Override +// protected void moveUpTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index <= 0 || index > table.getItemCount()) { +// return; +// } +// +// tableModel.moveUpIndex(index); +// +// table.setSelection(index - 1); +// enableEditControls(index - 1); +// } +// +// @Override +// protected JiemamyElement removeTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index < 0 || index > table.getItemCount()) { +// return null; +// } +// IndexModel indexToRemove = tableModel.getIndexes().remove(table.getSelectionIndex()); +// +// TableViewer tableViewer = getTableViewer(); +// tableViewer.remove(indexToRemove); +// +// disableEditControls(); +// +// return indexToRemove; +// } +// +// private void updateModel() { +// int index = table.getSelectionIndex(); +// if (index != -1) { +// IndexModel indexModel = tableModel.getIndexes().get(index); +// indexModel.setName(txtIndexName.getText()); +// indexModel.setUnique(chkIsUniqueIndex.getSelection()); +// } +// } +// } +//} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab2.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogRecordTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogRecordTab.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogRecordTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -0,0 +1,842 @@ +package org.jiemamy.eclipse.editor.dialog.table; + +// +//import java.io.BufferedReader; +//import java.io.BufferedWriter; +//import java.io.File; +//import java.io.FileNotFoundException; +//import java.io.FileReader; +//import java.io.FileWriter; +//import java.io.IOException; +//import java.util.ArrayList; +//import java.util.List; +//import java.util.Map; +//import java.util.Random; +//import java.util.StringTokenizer; +// +//import org.eclipse.jface.dialogs.MessageDialog; +//import org.eclipse.jface.resource.ImageRegistry; +//import org.eclipse.jface.viewers.ArrayContentProvider; +//import org.eclipse.jface.viewers.BaseLabelProvider; +//import org.eclipse.jface.viewers.CellEditor; +//import org.eclipse.jface.viewers.ComboBoxCellEditor; +//import org.eclipse.jface.viewers.ICellModifier; +//import org.eclipse.jface.viewers.ITableLabelProvider; +//import org.eclipse.jface.viewers.TableViewer; +//import org.eclipse.jface.viewers.TextCellEditor; +//import org.eclipse.jface.viewers.Viewer; +//import org.eclipse.swt.SWT; +//import org.eclipse.swt.custom.CCombo; +//import org.eclipse.swt.events.KeyAdapter; +//import org.eclipse.swt.events.KeyEvent; +//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.widgets.Button; +//import org.eclipse.swt.widgets.Combo; +//import org.eclipse.swt.widgets.Composite; +//import org.eclipse.swt.widgets.Control; +//import org.eclipse.swt.widgets.FileDialog; +//import org.eclipse.swt.widgets.Item; +//import org.eclipse.swt.widgets.Label; +//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.jiemamy.eclipse.JiemamyPlugin; +//import org.jiemamy.eclipse.ui.AbstractTableEditor; +//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.attribute.ColumnModel; +//import org.jiemamy.model.dataset.RecordModel; +//import org.jiemamy.model.entity.TableModel; +// +///** +// * テーブル編集ダイアログの「レコード」タブ +// * +// * @author daisuke +// */ +//public class TableEditDialogRecordTab extends AbstractTab { +// +// private TableModel tableModel; +// +// private AbstractTableEditor recordsEditArea; +// +// private Combo subjectCombo; +// +// private Combo objectCombo; +// +// private Button btnClear; +// +// private Button btnExchange; +// +// private Button btnExecute; +// +// +// public TableEditDialogRecordTab(TabFolder parentTabFolder, int style, TableModel tableModel) { +// super(parentTabFolder, style, "レコード"); // RESOURCE +// this.tableModel = tableModel; +// } +// +// @Override +// public Composite createTabArea(TabFolder parentTabFolder) { +// Composite composite = new Composite(parentTabFolder, SWT.NULL); +// composite.setLayout(new GridLayout(1, false)); +// composite.setLayoutData(new GridData(GridData.FILL_BOTH)); +// +// TabItem tabRecord = new TabItem(parentTabFolder, SWT.NONE); +// tabRecord.setText(JiemamyPlugin.getResourceString("dialog.table.tab.record")); +// tabRecord.setControl(composite); +// +// createRecordTab(composite); +// recordsEditArea.disableEditControls(); +// +// return composite; +// } +// +// private void createRecordTab(Composite parent) { +// recordsEditArea = new RecordTableEditor(tableModel); +// recordsEditArea.setAddLabel(JiemamyPlugin.getResourceString("dialog.table.record.btn.add")); +// recordsEditArea.setInsertLabel(JiemamyPlugin.getResourceString("dialog.table.record.btn.insert")); +// recordsEditArea.setRemoveLabel(JiemamyPlugin.getResourceString("dialog.table.record.btn.remove")); +// recordsEditArea.createControlArea(parent); +// } +// +// private void refreshEditComboItems() { +// boolean first = true; +// subjectCombo.removeAll(); +// objectCombo.removeAll(); +// for (ColumnIdNameDto dto : tableModel.getRecordColumnDtos()) { +// subjectCombo.add(dto.getName()); +// objectCombo.add(dto.getName()); +// if (first) { +// subjectCombo.setText(dto.getName()); +// objectCombo.setText(dto.getName()); +// } +// first = false; +// } +// } +// +// +// private class RecordTableEditor extends AbstractTableEditor { +// +// private TableModel tableModel; +// +// private Table table; +// +// private RecordContentProvider contentProvider; +// +// /** セルエディタのリスト */ +// private List<CellEditor> editorList = new ArrayList<CellEditor>(); +// +// /** CSVインポートボタン */ +// private Button btnImport; +// +// /** CSVエクスポートボタン */ +// private Button btnExport; +// +// +// /** +// * コンストラクタ。 +// * +// * @param targetModel +// */ +// public RecordTableEditor(TableModel targetModel) { +// super(); +// tableModel = targetModel; +// } +// +// @Override +// protected JiemamyElement addItem() { +// RecordModel record = new RecordModel(); +// tableModel.addRecord(record); +// +// int addedIndex = tableModel.getRecords().indexOf(record); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// +// return record; +// } +// +// @Override +// protected void configureCellEditor() { +// int columnSize = tableModel.getRecordColumnDtos().size(); +// List<String> propertyList = new ArrayList<String>(columnSize); +// editorList.clear(); +// for (ColumnIdNameDto dto : tableModel.getRecordColumnDtos()) { +// propertyList.add(String.valueOf(dto.getColumnId())); +// +// ColumnModel column = tableModel.getColumnById(dto.getColumnId()); +// if (column != null && column.canEditRecordByCombo()) { +// List<String> allowedStrings = new ArrayList<String>(); +// for (RecordValueModel allowedValue : column.getValuesAllowedByForeignKeys()) { +// StringBuilder sb = new StringBuilder(); +// sb.append(allowedValue.getValue()); +// if (allowedValue.getTypicalValue().length() != 0) { +// sb.append(" (").append(allowedValue.getTypicalValue()).append(")"); +// } +// allowedStrings.add(sb.toString()); +// } +// editorList.add(new RecordComboBoxCellEditor(table, allowedStrings.toArray(new String[allowedStrings +// .size()]))); +// } else { +// editorList.add(new RecordTextCellEditor(table)); +// } +// } +// TableViewer tableViewer = getTableViewer(); +// tableViewer.setColumnProperties(propertyList.toArray(new String[columnSize])); +// tableViewer.setCellEditors(editorList.toArray(new CellEditor[columnSize])); +// } +// +// @Override +// protected void configureEditButtons() { +// super.configureEditButtons(); +// +// btnImport.setText(JiemamyPlugin.getResourceString("dialog.table.record.btn.import")); +// btnImport.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// importFromCsv(); +// } +// +// private void importFromCsv() { +// FileDialog dialog = new FileDialog(btnImport.getShell(), SWT.OPEN); +// dialog.setText(JiemamyPlugin.getResourceString("dialog.table.record.import.title")); +// String filename = dialog.open(); +// +// if (filename != null) { +// File csv = new File(filename); +// BufferedReader br = null; +// try { +// br = new BufferedReader(new FileReader(csv)); +// +// List<Long> columnIds = new ArrayList<Long>(); +// if (br.ready()) { +// String line = br.readLine(); +// StringTokenizer st = new StringTokenizer(line, ","); +// while (st.hasMoreTokens()) { +// ColumnModel column = tableModel.getColumn(st.nextToken()); +// if (column != null) { +// columnIds.add(column.getId()); +// } else { +// columnIds.add(Math.abs(new Random().nextLong())); +// } +// } +// } +// +// while (br.ready()) { +// RecordModel record = (RecordModel) addItem(); +// +// String line = br.readLine(); +// StringTokenizer st = new StringTokenizer(line, ","); +// for (int i = 0; st.hasMoreTokens(); i++) { +// while (columnIds.size() <= i) { +// columnIds.add(Math.abs(new Random().nextLong())); +// } +// +// record.setRecordData(columnIds.get(i), new RecordValueModel(st.nextToken())); +// } +// } +// +// refreshTableColumns(); +// } catch (FileNotFoundException e) { +// JiemamyPlugin.handleException(e, JiemamyPlugin.LOG | JiemamyPlugin.DIALOG); +// } catch (IOException e) { +// JiemamyPlugin.handleException(e, JiemamyPlugin.ALL); +// } finally { +// ResourceUtils.close(br); +// } +// } +// } +// }); +// +// btnExport.setText(JiemamyPlugin.getResourceString("dialog.table.record.btn.export")); +// btnExport.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent e) { +// exportToCsv(); +// } +// +// private void exportToCsv() { +// FileDialog dialog = new FileDialog(btnExport.getShell(), SWT.SAVE); +// dialog.setText(JiemamyPlugin.getResourceString("dialog.table.record.export.title")); +// String filename = dialog.open(); +// +// if (filename != null) { +// File csv = new File(filename); +// BufferedWriter bw = null; +// if (csv.exists()) { +// // TODO 外部化せよ +// boolean result = MessageDialog.openQuestion(btnExport.getShell(), "Confirm", "overwrite?"); +// if (!result) { +// return; +// } +// } +// try { +// bw = new BufferedWriter(new FileWriter(csv)); +// +// boolean first = true; +// for (ColumnIdNameDto dto : tableModel.getRecordColumnDtos()) { +// bw.write(first ? "" : ","); +// bw.write(dto.getName()); +// first = false; +// } +// bw.write("\n"); +// +// for (RecordModel record : tableModel.getRecords()) { +// first = true; +// for (Map.Entry<Long, RecordValueModel> entry : record.getRecord().entrySet()) { +// RecordValueModel value = entry.getValue(); +// bw.write(first ? "" : ","); +// bw.write(value.getValue()); +// first = false; +// } +// bw.write("\n"); +// } +// } catch (IOException e) { +// JiemamyPlugin.handleException(e, JiemamyPlugin.ALL); +// } finally { +// ResourceUtils.close(bw); +// } +// } +// } +// }); +// } +// +// @Override +// protected void configureEditorControls() { +// btnClear.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent evt) { +// objectCombo.setEnabled(false); +// } +// }); +// btnExchange.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent evt) { +// objectCombo.setEnabled(true); +// } +// }); +// +// btnExecute.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent evt) { +// if (btnClear.getSelection()) { +// tableModel.removeRecordColumn(tableModel.getRecordColumnDtos().get( +// subjectCombo.getSelectionIndex()).getColumnId()); +// } else if (btnExchange.getSelection()) { +// tableModel.exchangeRecordColumn(tableModel.getRecordColumnDtos().get( +// subjectCombo.getSelectionIndex()).getColumnId(), tableModel.getRecordColumnDtos().get( +// objectCombo.getSelectionIndex()).getColumnId()); +// } +// } +// }); +// } +// +// @Override +// protected void configureTable(final Table table) { +// super.configureTable(table); +// +// // THINK ↓要る? +//// 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) { +// tableViewer.setCellModifier(new RecordCellModifier(tableViewer)); +// tableViewer.setLabelProvider(new RecordLabelProvider()); +// contentProvider = new RecordContentProvider(); +// tableViewer.setContentProvider(contentProvider); +//// tableViewer.setSorter(new ViewerSorter()); +// tableViewer.setInput(tableModel.getRecords()); +// } +// +// @Override +// protected void createEditorControls(Composite parent) { +// Composite composite = new Composite(parent, SWT.NULL); +// GridLayout layout = new GridLayout(6, false); +// layout.marginHeight = 0; +// layout.marginWidth = 0; +// composite.setLayout(layout); +// composite.setLayoutData(new GridData()); +// +// Label label = new Label(composite, SWT.NONE); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.record.label.column")); +// GridData gd = new GridData(); +// gd.verticalSpan = 2; +// label.setLayoutData(gd); +// +// subjectCombo = new Combo(composite, SWT.READ_ONLY); +// gd = new GridData(); +// gd.verticalSpan = 2; +// subjectCombo.setLayoutData(gd); +// subjectCombo.setVisibleItemCount(20); +// +// btnClear = new Button(composite, SWT.RADIO); +// btnClear.setText(JiemamyPlugin.getResourceString("dialog.table.record.label.delete")); +// btnClear.setSelection(true); +// gd = new GridData(); +// gd.horizontalSpan = 3; +// btnClear.setLayoutData(gd); +// +// btnExecute = new Button(composite, SWT.PUSH); +// btnExecute.setText(JiemamyPlugin.getResourceString("dialog.table.record.label.execute")); +// gd = new GridData(); +// gd.verticalSpan = 2; +// btnExecute.setLayoutData(gd); +// +// btnExchange = new Button(composite, SWT.RADIO); +// btnExchange.setText(JiemamyPlugin.getResourceString("dialog.table.record.label.exchange1")); +// +// objectCombo = new Combo(composite, SWT.READ_ONLY); +// objectCombo.setEnabled(false); +// objectCombo.setVisibleItemCount(20); +// +// label = new Label(composite, SWT.NONE); +// label.setText(JiemamyPlugin.getResourceString("dialog.table.record.label.exchange2")); +// +// refreshEditComboItems(); +// +// return composite; +// } +// +// @Override +// protected void createOptionalEditButtons(Composite parent) { +// btnImport = new Button(parent, SWT.PUSH); +// btnExport = new Button(parent, SWT.PUSH); +// } +// +// @Override +// protected void createTableColumns(Table table) { +// for (ColumnIdNameDto dto : tableModel.getRecordColumnDtos()) { +// TableColumn col = new TableColumn(table, SWT.LEFT); +// col.setText(dto.getName()); +// col.setWidth(100); +// col.addSelectionListener(new SelectionAdapter() { +// +// @Override +// public void widgetSelected(SelectionEvent evt) { +// subjectCombo.setText(((TableColumn) evt.getSource()).getText()); +// } +// }); +// } +// } +// +// @Override +// protected JiemamyElement insertTableSelectionItem() { +// int index = table.getSelectionIndex(); +// RecordModel record = new RecordModel(); +// if (index < 0 || index > table.getItemCount()) { +// tableModel.addRecord(record); +// } else { +// tableModel.addRecord(index, record); +// } +// +// int addedIndex = tableModel.getRecords().indexOf(record); +// table.setSelection(addedIndex); +// enableEditControls(addedIndex); +// +// return record; +// } +// +// @Override +// protected void moveDownTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index < 0 || index >= table.getItemCount()) { +// return; +// } +// +// tableModel.moveDownRecord(index); +// +// table.setSelection(index + 1); +// enableEditControls(index + 1); +// } +// +// @Override +// protected void moveUpTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index <= 0 || index > table.getItemCount()) { +// return; +// } +// +// tableModel.moveUpRecord(index); +// +// table.setSelection(index - 1); +// enableEditControls(index - 1); +// } +// +// @Override +// protected JiemamyElement removeTableSelectionItem() { +// int index = table.getSelectionIndex(); +// if (index < 0 || index > table.getItemCount()) { +// return null; +// } +// RecordModel recordToRemove = tableModel.removeRecord(table.getSelectionIndex()); +// +// TableViewer tableViewer = getTableViewer(); +// tableViewer.remove(recordToRemove); +// +// disableEditControls(); +// +// return recordToRemove; +// } +// +// +// /** +// * 編集セルをCTRL+カーソルキーで移動できるようにするKeyListener +// * +// * @author daisuke +// */ +// private class CellEditorKeyListener extends KeyAdapter { +// +// private Control control; +// +// private CellEditor editor; +// +// +// /** +// * コンストラクタ。 +// * +// * @param control +// * @param editor +// */ +// public CellEditorKeyListener(Control control, CellEditor editor) { +// this.control = control; +// this.editor = editor; +// } +// +// @Override +// public void keyPressed(KeyEvent evt) { +// if (control == null || control.isDisposed()) { +// return; +// } +// +// if ((evt.stateMask & SWT.CTRL) == 0) { +// return; +// } +// +// int selectionIndex = table.getSelectionIndex(); +// int columnIndex = editorList.indexOf(editor); +// +// switch (evt.keyCode) { +// case SWT.ARROW_RIGHT: +// if (columnIndex < editorList.size()) { +// columnIndex++; +// } +// break; +// +// case SWT.ARROW_LEFT: +// if (columnIndex >= 0) { +// columnIndex--; +// } +// break; +// +// case SWT.ARROW_UP: +// if (selectionIndex >= 0) { +// table.setSelection(--selectionIndex); +// } +// break; +// +// case SWT.ARROW_DOWN: +// if (selectionIndex < tableModel.getRecords().size() - 1) { +// table.setSelection(++selectionIndex); +// } +// break; +// +// default: +// return; +// } +// +// editor.deactivate(); +// getTableViewer().editElement(tableModel.getRecord(selectionIndex), columnIndex); +// } +// } +// +// /** +// * Record用CellModifier +// * +// * @author daisuke +// */ +// private class RecordCellModifier implements ICellModifier { +// +// @SuppressWarnings("unused") +// private TableViewer viewer; +// +// +// public RecordCellModifier(TableViewer viewer) { +// this.viewer = viewer; +// } +// +// public boolean canModify(Object element, String property) { +// return true; +// } +// +// public Object getValue(Object element, String property) { +// RecordModel record = (RecordModel) element; +// ColumnModel column = tableModel.getColumnById(Long.parseLong(property)); +// +// assert record != null; +// +// Object result; +// if (column != null && column.canEditRecordByCombo()) { +// String value = record.getRecordData(Long.parseLong(property)).getValue(); +// +// int index; +// for (index = 0; index < column.getValuesAllowedByForeignKeys().size(); index++) { +// String currentValue = column.getValuesAllowedByForeignKeys().get(index).getValue(); +// if (currentValue.equals(value)) { +// break; +// } +// } +// result = index; +// } else { +// result = record.getRecordData(Long.parseLong(property)); +// } +// return result; +// } +// +// public void modify(Object element, String property, Object value) { +// RecordModel record; +// if (element instanceof Item) { +// record = (RecordModel) ((Item) element).getData(); +// } else { +// record = (RecordModel) element; +// } +// ColumnModel column = tableModel.getColumnById(Long.parseLong(property)); +// +// if (column != null && column.canEditRecordByCombo()) { +// RecordValueModel val; +// if (value == null) { // NULL選択時 +// val = null; +// } else if (value instanceof Integer) { +// val = column.getValuesAllowedByForeignKeys().get((Integer) value); +// } else { // 選択肢外入力時 +// val = new RecordValueModel((String) value); +// } +// record.setRecordData(Long.parseLong(property), val); +// } else { +// record.setRecordData(Long.parseLong(property), (RecordValueModel) value); +// } +// TableViewer tableViewer = getTableViewer(); +// tableViewer.update(element, null); +// } +// +// } +// +// /** +// * RecordTable用ComboBoxCellEditor +// * +// * @author daisuke +// */ +// private class RecordComboBoxCellEditor extends ComboBoxCellEditor { +// +// private CCombo comboBox; +// +// +// /** +// * コンストラクタ。 +// * +// * @param parent 親 +// * @param items コンボアイテム文字列の配列 +// */ +// public RecordComboBoxCellEditor(Composite parent, String[] items) { +// super(parent, items); +// } +// +// @Override +// protected Control createControl(Composite parent) { +// comboBox = (CCombo) super.createControl(parent); +// comboBox.addKeyListener(new CellEditorKeyListener(comboBox, this)); +// return comboBox; +// } +// +// @Override +// protected Object doGetValue() { +// Object value = super.doGetValue(); +// if (value.equals(-1)) { // 選択肢外入力時 +// return comboBox.getText(); +// } else if (value.equals(0)) { // NULL選択時 +// // TODO NOT NULLの時は? +// return null; +// } +// return value; +// } +// +// @Override +// protected void doSetValue(Object value) { +// Object newValue; +// if (value == null) { +// newValue = 0; +// } else { +// newValue = value; +// } +// super.doSetValue(newValue); +// } +// } +// +// /** +// * Record用ContentProvider +// * +// * @author daisuke +// */ +// private class RecordContentProvider extends ArrayContentProvider implements CommandListener { +// +// private Viewer viewer; +// +// +// public void commandExecuted(Command command) { +//// if (evt.getPropertyName().equals(RecordModel.P_RECORD_DATA)) { +// refreshTable(); +//// } else if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_RECORDS)) { +//// refreshTable(); // レコードの変更を反映させる。 +//// } else if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_COLUMNS)) { +//// refreshTableColumns(); // 増えた/減ったカラムを反映させる。 +//// configureCellEditor(); // CellEditor関係を更新する。 +//// refreshEditComboItems(); // 削除・交換操作用コンボを更新する。 +//// } +// } +// +// @Override +// public void dispose() { +//// for (RecordModel record : tableModel.getRecords()) { +//// record.removePropertyChangeListener(this); +//// } +//// tableModel.removePropertyChangeListener(this); +// super.dispose(); +// } +// +// /** +// * {@inheritDoc} +// */ +// public JiemamyElement getTargetModel() { +// return (JiemamyElement) viewer.getInput(); +// } +// +// @Override +// public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { +// this.viewer = viewer; +//// if (oldInput != null) { +//// for (RecordModel record : tableModel.getRecords()) { +//// record.removePropertyChangeListener(this); +//// } +//// tableModel.removePropertyChangeListener(this); +//// } +//// if (newInput != null) { +//// tableModel.addPropertyChangeListener(this); +//// for (RecordModel record : tableModel.getRecords()) { +//// record.addPropertyChangeListener(this); +//// } +//// } +// +// super.inputChanged(viewer, oldInput, newInput); +// } +// +// } +// +// /** +// * Record用LabelProvider +// * +// * @author daisuke +// */ +// private class RecordLabelProvider extends BaseLabelProvider implements ITableLabelProvider { +// +// public Image getColumnImage(Object element, int columnIndex) { +// RecordModel record = (RecordModel) element; +// long columnId = tableModel.getRecordColumnDtos().get(columnIndex).getColumnId(); +// +// RecordValueModel value = record.getRecordData(columnId); +// if (value.getStatus() != RecordValueStatus.VALUE) { +// ImageRegistry ir = JiemamyPlugin.getDefault().getImageRegistry(); +// return ir.get(ImageNames.ICON_NULL_DATA); +// } +// +// return null; +// } +// +// public String getColumnText(Object element, int columnIndex) { +// RecordModel record = (RecordModel) element; +// long columnId = tableModel.getRecordColumnDtos().get(columnIndex).getColumnId(); +// RecordValueModel result = record.getRecordData(columnId); +// +// return result.getValueWithTypical(); +// } +// } +// +// /** +// * RecordTable用TextCellEditor +// * +// * @author daisuke +// */ +// private class RecordTextCellEditor extends TextCellEditor { +// +// public RecordTextCellEditor(Composite parent) { +// super(parent); +// } +// +// @Override +// protected Control createControl(Composite parent) { +// Control text = super.createControl(parent); +// text.addKeyListener(new CellEditorKeyListener(text, this)); +// return text; +// } +// +// @Override +// protected Object doGetValue() { +// Object value = super.doGetValue(); +// if (RecordValueStatus.NULL.getKey().equals(value)) { +// return new RecordValueModel(RecordValueStatus.NULL); +// } else if (RecordValueStatus.NOT_SPECIFIED.getKey().equals(value)) { +// return new RecordValueModel(RecordValueStatus.NOT_SPECIFIED); +// } +// return new RecordValueModel((String) value); +// } +// +// @Override +// protected void doSetValue(Object value) { +// Object newValue; +// if (((RecordValueModel) value).getStatus() == RecordValueStatus.NULL) { +// newValue = RecordValueStatus.NULL.getKey(); +// } else if (((RecordValueModel) value).getStatus() == RecordValueStatus.NOT_SPECIFIED) { +// newValue = RecordValueStatus.NOT_SPECIFIED.getKey(); +// } else { +// newValue = ((RecordValueModel) value).getValue(); +// } +// super.doSetValue(newValue); +// } +// } +// } +//} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogRecordTab.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: 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 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/Messages.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -25,7 +25,7 @@ * * @author daisuke */ -public class Messages extends NLS { +class Messages extends NLS { /** Dialogのタイトル */ public static String Dialog_Title; Modified: 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 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/dialog/view/ViewEditDialog.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -160,12 +160,19 @@ @Override protected void okPressed() { - viewModel.setName(txtName.getText()); - viewModel.setLogicalName(StringUtils.defaultIfEmpty(txtLogicalName.getText(), null)); - viewModel.setDefinition(StringUtils.defaultIfEmpty(tabDefinition.getText().getText(), null)); - viewModel.setBeginScript(StringUtils.defaultIfEmpty(tabBeginScript.getText().getText(), null)); - viewModel.setEndScript(StringUtils.defaultIfEmpty(tabEndScript.getText().getText(), null)); - viewModel.setDescription(StringUtils.defaultIfEmpty(tabDescription.getText().getText(), null)); - super.okPressed(); + if (canExecuteOk()) { + viewModel.setName(txtName.getText()); + viewModel.setLogicalName(StringUtils.defaultIfEmpty(txtLogicalName.getText(), null)); + viewModel.setDefinition(tabDefinition.getTextWidget().getText()); + viewModel.setBeginScript(StringUtils.defaultIfEmpty(tabBeginScript.getTextWidget().getText(), null)); + viewModel.setEndScript(StringUtils.defaultIfEmpty(tabEndScript.getTextWidget().getText(), null)); + viewModel.setDescription(StringUtils.defaultIfEmpty(tabDescription.getTextWidget().getText(), null)); + super.okPressed(); + } } + + private boolean canExecuteOk() { + return StringUtils.isEmpty(tabDefinition.getTextWidget().getText()) == false + && StringUtils.isEmpty(txtName.getText()) == false; + } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/tab/TextEditTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/tab/TextEditTab.java 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/ui/tab/TextEditTab.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -37,7 +37,7 @@ * * @return */ - public Text getText() { + public Text getTextWidget() { return text; } } Modified: vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.classpath =================================================================== --- vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.classpath 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.classpath 2009-02-17 18:03:22 UTC (rev 2682) @@ -4,25 +4,24 @@ <classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/> - <classpathentry exported="true" kind="lib" path="lib/collections-generic-4.01.jar"/> - <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar"/> - <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.2.jar"/> - <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.3.jar"/> - <classpathentry exported="true" kind="lib" path="lib/eclipse-common-0.0.4.jar"/> - <classpathentry exported="true" kind="lib" path="lib/factory-enhancer-0.1.0-SNAPSHOT.jar"/> - <classpathentry exported="true" kind="lib" path="lib/generic-tree-0.1.0-SNAPSHOT.jar"/> - <classpathentry exported="true" kind="lib" path="lib/javassist-3.8.0.GA.jar"/> - <classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j-1.5.5.jar"/> - <classpathentry exported="true" kind="lib" path="lib/jiemamy-core-0.2.0-SNAPSHOT.jar"/> - <classpathentry exported="true" kind="lib" path="lib/jiemamy-spec-core-0.2.0-SNAPSHOT.jar"/> - <classpathentry exported="true" kind="lib" path="lib/logback-classic-0.9.9.jar"/> - <classpathentry exported="true" kind="lib" path="lib/logback-core-0.9.9.jar"/> - <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.5.5.jar"/> - <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar"/> - <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar"/> - <classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.7.jar"/> + <classpathentry exported="true" kind="lib" path="lib/collections-generic-4.01.jar" sourcepath="lib/sources/collections-generic-4.01-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.8.0.jar" sourcepath="lib/sources/commons-beanutils-1.8.0-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.2.jar" sourcepath="lib/sources/commons-io-1.3.2-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.3.jar" sourcepath="lib/sources/commons-lang-2.3-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/eclipse-common-0.0.4.jar" sourcepath="lib/sources/eclipse-common-0.0.4-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/factory-enhancer-0.1.0-SNAPSHOT.jar" sourcepath="lib/sources/factory-enhancer-0.1.0-SNAPSHOT-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/generic-tree-0.1.0-SNAPSHOT.jar" sourcepath="lib/sources/generic-tree-0.1.0-SNAPSHOT-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/javassist-3.8.0.GA.jar" sourcepath="lib/sources/generic-tree-0.1.0-SNAPSHOT-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/jcl-over-slf4j-1.5.5.jar" sourcepath="lib/sources/jcl-over-slf4j-1.5.5-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/jiemamy-core-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-core-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/jiemamy-spec-core-0.2.0-SNAPSHOT.jar" sourcepath="lib/sources/jiemamy-spec-core-0.2.0-SNAPSHOT-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/logback-classic-0.9.9.jar" sourcepath="lib/sources/logback-classic-0.9.9-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/logback-core-0.9.9.jar" sourcepath="lib/sources/logback-core-0.9.9-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.5.5.jar" sourcepath="lib/sources/slf4j-api-1.5.5-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/stax-1.2.0.jar" sourcepath="lib/sources/stax-1.2.0-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/stax-api-1.0.1.jar" sourcepath="lib/sources/stax-api-1.0.1-sources.jar"/> + <classpathentry exported="true" kind="lib" path="lib/wstx-asl-3.2.7.jar" sourcepath="lib/sources/wstx-asl-3.2.7-sources.jar"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="output" path="target/classes"/> </classpath> Modified: vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.project =================================================================== --- vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.project 2009-02-17 13:48:44 UTC (rev 2681) +++ vesta/trunk/org.jiemamy.eclipse.dialect.mysql/.project 2009-02-17 18:03:22 UTC (rev 2682) @@ -30,21 +30,20 @@ <arguments> </arguments> </buildCommand> - <buildCommand> - <name>org.devzuz.q.maven.jdt.core.mavenIncrementalBuilder</name> - <arguments> - </arguments> - </buildCommand> </buildSpec> <natures> <nature>edu.umd.cs.findbugs.ZZZZZZplugin.eclipse.findbugsNature</nature> - <nature>org.devzuz.q.maven.jdt.core.mavenNature</nature> <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.pde.PluginNature</nature> </natures> <linkedResources> <link> + <name>.checkstyle</name> + <type>1</type> + <locationURI>DOCUMENTS/jiemamy-artemis/.checkstyle</locationURI> + </link> + <link> <name>.fbprefs</name> <type>1</type> <locationURI>DOCUMENTS/jiemamy-artemis/.fbprefs</locationURI> @@ -54,10 +53,5 @@ <type>1</type> <locationURI>DOCUMENTS/jiemamy-artemis/findbugs.xml</locationURI> </link> - <link> - <name>.checkstyle</name> - <type>1</type> - <locationURI>DOCUMENTS/jiemamy-artemis/.checkstyle</locationURI> - </link> </linkedResources> </projectDescription> Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2009-02-17 13:48:44 UTC (rev 2681) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/attribute/ColumnModel.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -39,12 +39,6 @@ String getDefaultValue(); /** - * 自由文字列を取得する。 - * @return 自由文字列 - */ - String getFreeString(); - - /** * 型記述子を設定する。 * @param dataType 型記述子 */ @@ -56,10 +50,4 @@ */ void setDefaultValue(String defaultValue); - /** - * 自由文字列を設定する。 - * @param freeString 自由文字列 - */ - void setFreeString(String freeString); - } Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java 2009-02-17 13:48:44 UTC (rev 2681) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/datatype/DomainModel.java 2009-02-17 18:03:22 UTC (rev 2682) @@ -61,12 +61,6 @@ String getDescription(); /** - * 自由文字列を取得する。 - * @return 自由文字列 - */ - String getFreeString(); - - /** * 論理名を取得する。 * @return 論理名 */ @@ -103,12 +97,6 @@ void setDescription(String description); /** - * 自由文字列を設定する。 - * @param freeString 自由文字列 - */ - void setFreeString(String freeString); - - /** * 論理名を設定する。 * @param logicalName 論理名 */ Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd 2009-02-17 13:48:44 UTC (rev 2681) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-core.xsd 2009-02-17 18:03:22 UTC (rev 2682) @@ -59,7 +59,6 @@ <xsd:element ref="description" minOccurs="0" /> <xsd:element ref="dataType" /> <xsd:element ref="constraints" minOccurs="0" /> - <xsd:element ref="freeString" minOccurs="0" /> <xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="id" type="uuidType" use="required" /> @@ -129,7 +128,6 @@ <xsd:element ref="description" minOccurs="0" /> <xsd:element ref="dataType" /> <xsd:element ref="defaultValue" minOccurs="0" /> - <xsd:element ref="freeString" minOccurs="0" /> <xsd:element ref="adapter" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="id" type="uuidType" use="required" /> @@ -384,7 +382,6 @@ </xsd:annotation> </xsd:element> <xsd:element name="defaultValue" type="xsd:string" /> - <xsd:element name="freeString" type="xsd:string" /> <!-- 単純型 --> Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/sample2.xml =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/sample2.xml 2009-02-17 13:48:44 UTC (rev 2681) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/sample2.xml 2009-02-17 18:03:22 UTC (rev 2682) @@ -9,7 +9,7 @@ <domain id="9a3ba23c-b328-4c70-a32d-3e4be3ee3f08"> <name>ID</name> <dataType> - <sqlType>4</sqlType> + <typeCategory>INTEGER</typeCategory> <typeName>INTEGER</typeName> <adapter class="org.jiemamy.model.datatype.adapter.SerialDataTypeAdapter"> <serial>true</serial> @@ -23,7 +23,7 @@ <name>NAME</name> <description>人名用の型です。</description> <dataType> - <sqlType>12</sqlType> + <typeCategory>VARCHAR</typeCategory> <typeName>VARCHAR</typeName> <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> <size>32</size> @@ -49,7 +49,7 @@ <name>USER_ID</name> <logicalName>オーダーユーザID</logicalName> <dataType> - <sqlType>4</sqlType> + <typeCategory>INTEGER</typeCategory> <typeName>INTEGER</typeName> </dataType> <adapter class="org.jiemamy.utils.DisablableImpl"> @@ -59,7 +59,7 @@ <column id="4ce761b0-137b-4105-ad2a-2efcba5e6bc4"> <name>ORDER_DATE</name> <dataType> - <sqlType>93</sqlType> + <typeCategory>TIMESTAMP</typeCategory> <typeName>TIMESTAMP</typeName> </dataType> <adapter class="org.jiemamy.utils.DisablableImpl"> @@ -74,18 +74,6 @@ <disabled>false</disabled> </adapter> </primaryKey> - <notNull id="3930591d-8621-4809-9761-87a2e15716ab"> - <columnRef ref="db7a2f62-9658-406a-9dc1-8b90ae2da47c"/> - <adapter class="org.jiemamy.utils.DisablableImpl"> - <disabled>false</disabled> - </adapter> - </notNull> - <notNull id="a1ba8dae-569a-4d79-ac80-3ad55e0cc0df"> - <columnRef ref="4ce761b0-137b-4105-ad2a-2efcba5e6bc4"/> - <adapter class="org.jiemamy.utils.DisablableImpl"> - <disabled>false</disabled> - </adapter> - </notNull> <foreignKey id="325b5aa9-821e-4791-aac5-2d3eb64f9392"> <columnRefs> <columnRef ref="db7a2f62-9658-406a-9dc1-8b90ae2da47c"/> @@ -101,6 +89,18 @@ <disabled>false</disabled> </adapter> </foreignKey> + <notNull id="3930591d-8621-4809-9761-87a2e15716ab"> + <columnRef ref="db7a2f62-9658-406a-9dc1-8b90ae2da47c"/> + <adapter class="org.jiemamy.utils.DisablableImpl"> + <disabled>false</disabled> + </adapter> + </notNull> + <notNull id="a1ba8dae-569a-4d79-ac80-3ad55e0cc0df"> + <columnRef ref="4ce761b0-137b-4105-ad2a-2efcba5e6bc4"/> + <adapter class="org.jiemamy.utils.DisablableImpl"> + <disabled>false</disabled> + </adapter> + </notNull> </attributes> <adapter class="org.jiemamy.utils.DisablableImpl"> <disabled>false</disabled> @@ -166,7 +166,7 @@ <column id="a28c64c6-b379-41a4-9563-b774f5bce165"> <name>ORDER_ID</name> <dataType> - <sqlType>4</sqlType> + <typeCategory>INTEGER</typeCategory> <typeName>INTEGER</typeName> </dataType> <adapter class="org.jiemamy.utils.DisablableImpl"> @@ -176,7 +176,7 @@ <column id="b4d50786-3b3e-4557-baa3-b739159f0530"> <name>ITEM_ID</name> <dataType> - <sqlType>4</sqlType> + <typeCategory>INTEGER</typeCategory> <typeName>INTEGER</typeName> </dataType> <adapter class="org.jiemamy.utils.DisablableImpl"> @@ -186,7 +186,7 @@ <column id="77bb21f4-e793-4198-a695-42363dac2216"> <name>QUANTITY</name> <dataType> - <sqlType>4</sqlType> + <typeCategory>INTEGER</typeCategory> <typeName>INTEGER</typeName> </dataType> <adapter class="org.jiemamy.utils.DisablableImpl"> @@ -201,24 +201,6 @@ <disabled>false</disabled> </adapter> </primaryKey> - <notNull id="6d607439-186e-47ac-b391-2ad931c2e8d6"> - <columnRef ref="a28c64c6-b379-41a4-9563-b774f5bce165"/> - <adapter class="org.jiemamy.utils.DisablableImpl"> - <disabled>false</disabled> - </adapter> - </notNull> - <notNull id="bc929c76-7aa4-44d9-9dbf-c0684136a796"> - <columnRef ref="b4d50786-3b3e-4557-baa3-b739159f0530"/> - <adapter class="org.jiemamy.utils.DisablableImpl"> - <disabled>false</disabled> - </adapter> - </notNull> - <notNull id="8bb593a4-dac4-4387-8f81-c35e0c8491d7"> - <columnRef ref="77bb21f4-e793-4198-a695-42363dac2216"/> - <adapter class="org.jiemamy.utils.DisablableImpl"> - <disabled>false</disabled> - </adapter> - </notNull> <foreignKey id="df781ad0-112a-4db7-a76c-4395b15600b2"> <columnRefs> <columnRef ref="b4d50786-3b3e-4557-baa3-b739159f0530"/> @@ -246,6 +228,24 @@ <disabled>false</disabled> </adapter> </foreignKey> + <notNull id="6d607439-186e-47ac-b391-2ad931c2e8d6"> + <columnRef ref="a28c64c6-b379-41a4-9563-b774f5bce165"/> + <adapter class="org.jiemamy.utils.DisablableImpl"> + <disabled>false</disabled> + </adapter> + </notNull> + <notNull id="bc929c76-7aa4-44d9-9dbf-c0684136a796"> + <columnRef ref="b4d50786-3b3e-4557-baa3-b739159f0530"/> + <adapter class="org.jiemamy.utils.DisablableImpl"> + <disabled>false</disabled> + </adapter> + </notNull> + <notNull id="8bb593a4-dac4-4387-8f81-c35e0c8491d7"> + <columnRef ref="77bb21f4-e793-4198-a695-42363dac2216"/> + <adapter class="org.jiemamy.utils.DisablableImpl"> + <disabled>false</disabled> + </adapter> + </notNull> </attributes> <adapter class="org.jiemamy.utils.DisablableImpl"> <disabled>false</disabled> @@ -268,7 +268,7 @@ <name>NAME</name> <logicalName>商品名</logicalName> <dataType> - <sqlType>12</sqlType> + <typeCategory>VARCHAR</typeCategory> <typeName>VARCHAR</typeName> <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> <size>20</size> @@ -285,7 +285,7 @@ <name>PRICE</name> <logicalName>価格</logicalName> <dataType> - <sqlType>12</sqlType> + <typeCategory>VARCHAR</typeCategory> <typeName>VARCHAR</typeName> <adapter class="org.jiemamy.model.datatype.adapter.SizedDataTypeAdapter"> <size>20</size>