[jbosstools-commits] JBoss Tools SVN: r17529 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml: resources/meta and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 11 12:53:56 EDT 2009


Author: scabanovich
Date: 2009-09-11 12:53:55 -0400 (Fri, 11 Sep 2009)
New Revision: 17529

Added:
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/handlers/DeletePropertyHandler.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/ComplexAttrUtil.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigComplexPropertyImpl.java
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigSimplePropertyImpl.java
Modified:
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/plugin.xml
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/resources/meta/hibconfig3.meta
   trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibConfigLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2607

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/plugin.xml	2009-09-11 16:50:49 UTC (rev 17528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/plugin.xml	2009-09-11 16:53:55 UTC (rev 17529)
@@ -91,9 +91,16 @@
 			class="org.jboss.tools.hibernate.xml.model.impl.OrderedObject2Impl"/>
 		<xclass id="org.jboss.tools.hibernate.xml.model.impl.RegularObject2Impl"
 			class="org.jboss.tools.hibernate.xml.model.impl.RegularObject2Impl"/>
+		<xclass id="org.jboss.tools.hibernate.xml.model.impl.HibConfigComplexPropertyImpl"
+			class="org.jboss.tools.hibernate.xml.model.impl.HibConfigComplexPropertyImpl"/>
+		<xclass id="org.jboss.tools.hibernate.xml.model.impl.HibConfigSimplePropertyImpl"
+			class="org.jboss.tools.hibernate.xml.model.impl.HibConfigSimplePropertyImpl"/>
 
 		<xclass id="org.jboss.tools.hibernate.xml.model.impl.ContextPackageProvider"
 			class="org.jboss.tools.hibernate.xml.model.impl.ContextPackageProvider"/>
+
+		<xclass id="org.jboss.tools.hibernate.xml.model.handlers.DeletePropertyHandler"
+			class="org.jboss.tools.hibernate.xml.model.handlers.DeletePropertyHandler"/>
    </extension>
 
 </plugin>
\ No newline at end of file

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/resources/meta/hibconfig3.meta
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/resources/meta/hibconfig3.meta	2009-09-11 16:50:49 UTC (rev 17528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/resources/meta/hibconfig3.meta	2009-09-11 16:53:55 UTC (rev 17529)
@@ -3,7 +3,11 @@
                                    "meta.dtd">
 <XModelEntityGroup>
  <VERSION DEPENDS="Model:1.0" MODULE="Hibernate" VERSION="1.0"/>
- <MAPPINGS/>
+ <MAPPINGS>
+  <MAPPING name="Implementations">
+   <PAIR name="ComplexProperty" value="org.jboss.tools.hibernate.xml.model.impl.HibConfigComplexPropertyImpl"/>
+  </MAPPING>
+ </MAPPINGS>
  <ICONS>
   <GROUP name="action"/>
   <GROUP name="main">
@@ -658,7 +662,9 @@
   </XActionItem>
   <XDependencies/>
  </XModelEntity>
- <XModelEntity ImplementingClass="org.jboss.tools.hibernate.xml.model.impl.HibConfigListenerImpl" XMLSUBPATH="listener" name="HibConfig3Listener">
+ <XModelEntity
+  ImplementingClass="org.jboss.tools.hibernate.xml.model.impl.HibConfigListenerImpl"
+  XMLSUBPATH="listener" name="HibConfig3Listener">
   <XChildrenEntities/>
   <XEntityRenderer>
    <ICONS>
@@ -850,6 +856,9 @@
      <EntityData EntityName="HibConfig3Mapping">
       <AttributeData AttributeName="class" Mandatory="no"/>
       <AttributeData AttributeName="package" Mandatory="no"/>
+      <AttributeData AttributeName="file" Mandatory="no"/>
+      <AttributeData AttributeName="jar" Mandatory="no"/>
+      <AttributeData AttributeName="resource" Mandatory="no"/>
      </EntityData>
     </XActionItem>
    </XActionItem>
@@ -864,9 +873,388 @@
   </XActionItem>
   <XDependencies/>
  </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectBytecode">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="Bytecode" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general"
+    default="Bytecode" name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.bytecode.provider" name="provider"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.bytecode.use_reflection_optimizer" name="use reflection optimizer">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectC3P0">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="C3P0" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general" default="C3P0"
+    name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.acquire_increment" name="acquire increment"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.idle_test_period" name="idle test period"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.max_size" name="max size"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.max_statements" name="max statements"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.min_size" name="min size"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.c3p0.timeout" name="timeout"/>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectCache">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="Cache" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general"
+    default="Cache" name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.jndi" name="jndi"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.provider_class" name="provider class">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.provider_configuration_file_resource_path" name="provider configuration file">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.query_cache_factory" name="query cache factory">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.region_prefix" name="region prefix">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.use_minimal_puts" name="use minimal puts">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.use_query_cache" name="use query cache">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.use_second_level_cache" name="use second level cache">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.cache.use_structured_entries" name="use structured entries">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectConnection">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="Connection" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general"
+    default="Connection" name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection" name="connection"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.autocommit" name="autocommit">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.datasource" name="datasource"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.driver_class" name="driver class">
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.isolation" name="isolation"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.password" name="password"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.pool_size" name="pool size"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.provider_class" name="provider class">
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.release_mode" name="release mode">
+    <Constraint loader="List">
+     <value/>
+     <value name="on_close"/>
+     <value name="after_transaction"/>
+     <value name="after_statement"/>
+     <value name="auto"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.url" name="url"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.connection.username" name="username"/>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectJDBC">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="JDBC" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general" default="JDBC"
+    name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.batch_size" name="batch size"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.batch_versioned_data" name="batch versioned data"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.factory_class" name="factory class"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.fetch_size" name="fetch size"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.sql_exception_converter" name="sql exception converter"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.use_get_generated_keys" name="use get generated keys">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.use_scrollable_resultset" name="use scrollable resultset">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.use_streams_for_binary" name="use streams for binary">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jdbc.wrap_result_sets" name="wrap result sets">
+    <Constraint loader="List">
+     <value/>
+     <value name="true"/>
+     <value name="false"/>
+    </Constraint>
+    <Editor name="List"/>
+   </XModelAttribute>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ComplexProperty%" name="HibConfig3ObjectJNDI">
+  <XChildrenEntities/>
+  <XEntityRenderer>
+   <ICONS>
+    <ICON info="main.hibernate.folder" type="main"/>
+   </ICONS>
+  </XEntityRenderer>
+  <XModelAttributes>
+   <XModelAttribute default="JNDI" loader="ElementType" name="element type">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute PROPERTIES="id=true;category=general" default="JNDI"
+    name="name" visibility="false" xmlname="name">
+    <Editor name="Uneditable"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jndi" name="jndi"/>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jndi.class" name="class">
+    <Editor name="AccessibleJava"/>
+   </XModelAttribute>
+   <XModelAttribute
+    PROPERTIES="category=general;h_property=hibernate.jndi.url" name="url"/>
+  </XModelAttributes>
+  <XActionItem kind="list">
+   <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions"/>
+   <XActionItem ICON="action.empty" kind="list" name="Properties">
+    <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+     displayName="Properties..." kind="action" name="Properties"/>
+   </XActionItem>
+   <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+     ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+   </XActionItem>
+   <XActionItem displayName="move" kind="list" name="MoveActions"/>
+  </XActionItem>
+  <XDependencies/>
+ </XModelEntity>
  <XModelEntity ImplementingClass="%Hibernate3OrderedFolder%"
   PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.hibernate.ui.xml.form.Hibernate3FormLayoutData" name="HibConfig3PropertiesFolder">
   <XChildrenEntities>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectBytecode" required="yes"/>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectC3P0" required="yes"/>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectCache" required="yes"/>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectConnection" required="yes"/>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectJDBC" required="yes"/>
+   <XChildEntity maxCount="1" name="HibConfig3ObjectJNDI" required="yes"/>
    <XChildEntity name="HibConfig3Property"/>
   </XChildrenEntities>
   <XEntityRenderer>
@@ -905,7 +1293,9 @@
   </XActionItem>
   <XDependencies/>
  </XModelEntity>
- <XModelEntity ImplementingClass="%Regular2%" XMLSUBPATH="property" name="HibConfig3Property">
+ <XModelEntity
+  ImplementingClass="org.jboss.tools.hibernate.xml.model.impl.HibConfigSimplePropertyImpl"
+  XMLSUBPATH="property" name="HibConfig3Property">
   <XChildrenEntities/>
   <XEntityRenderer>
    <ICONS>
@@ -935,7 +1325,8 @@
      displayName="Properties..." kind="action" name="Properties"/>
    </XActionItem>
    <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
-    <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+    <XActionItem BaseActionName="Delete"
+     HandlerClassName="org.jboss.tools.hibernate.xml.model.handlers.DeletePropertyHandler"
      ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
    </XActionItem>
    <XActionItem displayName="move" kind="list" name="MoveActions">
@@ -1081,7 +1472,7 @@
    <XActionItem displayName="New" group="1" kind="list" name="CreateActions">
     <XActionItem displayName="File" group="1" kind="list" name="CreateFiles">
      <XActionItem kind="list" name="ORM">
-      <XActionItem HandlerClassName="%SpecialWizard%" HIDE="always"
+      <XActionItem HIDE="always" HandlerClassName="%SpecialWizard%"
        ICON="main.hibernate.file"
        PROPERTIES="entity=FileHibConfig3;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml"
        displayName="Hibernate Configuration 3.0..." kind="action" name="CreateFileHibConfig3">
@@ -1109,7 +1500,7 @@
    <XActionItem displayName="New" group="1" kind="list" name="CreateActions">
     <XActionItem displayName="File" group="1" kind="list" name="CreateFiles">
      <XActionItem kind="list" name="ORM">
-      <XActionItem HandlerClassName="%SpecialWizard%" HIDE="always"
+      <XActionItem HIDE="always" HandlerClassName="%SpecialWizard%"
        ICON="main.hibernate.file"
        PROPERTIES="entity=FileHibConfig3;extensions=.xml.;validator.addfile=true;support=org.jboss.tools.common.model.files.handlers.CreateFileSupport;extension=xml"
        displayName="Hibernate Configuration 3.0..." kind="action" name="CreateFileHibConfig3">

Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibConfigLoader.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibConfigLoader.java	2009-09-11 16:50:49 UTC (rev 17528)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/HibConfigLoader.java	2009-09-11 16:53:55 UTC (rev 17529)
@@ -11,10 +11,14 @@
 package org.jboss.tools.hibernate.xml.model;
 
 import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XChild;
 import org.jboss.tools.common.meta.XModelEntity;
 import org.jboss.tools.common.model.XModelObject;
 import org.jboss.tools.common.model.loaders.impl.SimpleWebFileLoader;
+import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
 import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.jboss.tools.hibernate.xml.model.impl.ComplexAttrUtil;
+import org.jboss.tools.hibernate.xml.model.impl.HibConfigComplexPropertyImpl;
 import org.w3c.dom.Element;
 
 public class HibConfigLoader extends SimpleWebFileLoader {
@@ -53,7 +57,12 @@
 	protected void loadFolders(Element element, XModelObject o, String[] folders) {
 		for (int i = 0; i < folders.length; i++) {
 			XModelObject c = o.getChildByPath(folders[i]);
-			if(c != null) super.loadChildren(element, c);
+			if(c != null) {
+				super.loadChildren(element, c);
+				if(i == 0) {
+					assignComplexProperties(c);
+				}
+			}
 		}
 	}
 
@@ -81,5 +90,21 @@
 		}
 		return super.isSaveable(entity, n, v, dv);
 	}
-	
+
+	private void assignComplexProperties(XModelObject folder) {
+		XModelObject[] ps = folder.getChildren(HibConfigComplexPropertyImpl.ENT_PROPERTY);
+		for (int i = 0; i < ps.length; i++) {
+			String n = ps[i].getAttributeValue(XMLStoreConstants.ATTR_NAME);
+			String v = ps[i].getAttributeValue(XMLStoreConstants.ATTR_VALUE);
+			XAttribute attr = ComplexAttrUtil.findComplexAttr(folder, n);
+			if(attr != null) {
+				XModelEntity entity = attr.getModelEntity();
+				XModelObject c = folder.getChildByPath(entity.getAttribute("name").getDefaultValue());
+				if(c != null) {
+					c.setAttributeValue(attr.getName(), v);
+				}
+			}
+		}
+	}
+
 }

Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/handlers/DeletePropertyHandler.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/handlers/DeletePropertyHandler.java	                        (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/handlers/DeletePropertyHandler.java	2009-09-11 16:53:55 UTC (rev 17529)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.hibernate.xml.model.handlers;
+
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
+import org.jboss.tools.hibernate.xml.model.impl.ComplexAttrUtil;
+
+public class DeletePropertyHandler extends DefaultRemoveHandler {
+
+	public DeletePropertyHandler() {}
+
+    public void executeHandler(XModelObject object, java.util.Properties p) throws XModelException {
+    	String name = object.getAttributeValue(XMLStoreConstants.ATTR_NAME);
+    	XAttribute attr = ComplexAttrUtil.findComplexAttr(object.getParent(), name);
+    	if(attr != null) {
+			XModelEntity entity = attr.getModelEntity();
+			XModelObject c = object.getParent().getChildByPath(entity.getAttribute(XMLStoreConstants.ATTR_NAME).getDefaultValue());
+			if(c != null) {
+				c.getModel().editObjectAttribute(c, attr.getName(), "");
+			}
+    	} else {
+    		super.executeHandler(object, p);
+    	}
+    }
+
+}


Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/handlers/DeletePropertyHandler.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/ComplexAttrUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/ComplexAttrUtil.java	                        (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/ComplexAttrUtil.java	2009-09-11 16:53:55 UTC (rev 17529)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.hibernate.xml.model.impl;
+
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XChild;
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.model.XModelObject;
+
+public class ComplexAttrUtil {
+
+	public static XAttribute findComplexAttr(XModelObject folder, String hProperty) {
+		XChild[] cs = folder.getModelEntity().getChildren();
+		for (int i = 0; i < cs.length; i++) {
+			if(cs[i].getMaxCount() == 1 && cs[i].isRequired()) {
+				String n = cs[i].getName();
+				XModelEntity e = folder.getModelEntity().getMetaModel().getEntity(n);
+				if(e == null) continue;
+				XAttribute[] as = e.getAttributes();
+				for (int j = 0; j < as.length; j++) {
+					if(hProperty.equals(as[j].getProperty(HibConfigComplexPropertyImpl.H_PROPERTY))) {
+						return as[j];
+					}
+				}
+			}
+		}
+		return null;
+	}
+
+}


Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/ComplexAttrUtil.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigComplexPropertyImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigComplexPropertyImpl.java	                        (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigComplexPropertyImpl.java	2009-09-11 16:53:55 UTC (rev 17529)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.hibernate.xml.model.impl;
+
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
+
+public class HibConfigComplexPropertyImpl extends RegularObject2Impl {
+	private static final long serialVersionUID = 1L;
+	public static String H_PROPERTY = "h_property"; //$NON-NLS-1$
+	public static String ENT_PROPERTY = "HibConfig3Property"; //$NON-NLS-1$
+	static String ATTR_VALUE = "value"; //$NON-NLS-1$
+	boolean lock = false;
+
+	public HibConfigComplexPropertyImpl() {
+	}
+
+	protected void onAttributeValueEdit(String name, String oldValue, String newValue) throws XModelException {
+		if(getParent() == null) return;
+		XAttribute a = getModelEntity().getAttribute(name);
+		if(a == null) return;
+		String propertyName = a.getProperty(H_PROPERTY);
+		if(propertyName == null || propertyName.length() == 0) return;
+		if(lock) return;
+		lock = true;
+		try {
+		XModelObject o = getParent().getChildByPath(propertyName);
+		if(o == null) {
+			if(newValue != null && newValue.length() > 0) {
+				XModelObject c = getModel().createModelObject(ENT_PROPERTY, null);
+				c.setAttributeValue(ATTR_VALUE, newValue);
+				c.setAttributeValue(XMLStoreConstants.ATTR_NAME, propertyName);
+				DefaultCreateHandler.addCreatedObject(getParent(), c, -1);
+			}
+		} else {
+			if(newValue == null || newValue.length() == 0) {
+				DefaultRemoveHandler.removeFromParent(o);
+			} else {
+				getModel().editObjectAttribute(o, ATTR_VALUE, newValue);
+			}
+		}
+		} finally {
+			lock = false;
+		}
+	}
+}


Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigComplexPropertyImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigSimplePropertyImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigSimplePropertyImpl.java	                        (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigSimplePropertyImpl.java	2009-09-11 16:53:55 UTC (rev 17529)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/ 
+package org.jboss.tools.hibernate.xml.model.impl;
+
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.XModelEntity;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
+
+public class HibConfigSimplePropertyImpl extends RegularObject2Impl {
+	private static final long serialVersionUID = 1L;
+
+	public HibConfigSimplePropertyImpl() {
+	}
+
+	protected void onAttributeValueEdit(String name, String oldValue, String newValue) throws XModelException {
+		if(getParent() == null) return;
+		if(name.equals(XMLStoreConstants.ATTR_VALUE)) {
+			XAttribute attr = ComplexAttrUtil.findComplexAttr(getParent(), getAttributeValue(XMLStoreConstants.ATTR_NAME));
+			if(attr != null) {
+				XModelEntity entity = attr.getModelEntity();
+				XModelObject c = getParent().getChildByPath(entity.getAttribute(XMLStoreConstants.ATTR_NAME).getDefaultValue());
+				if(c != null) {
+					c.setAttributeValue(attr.getName(), newValue);
+				}
+			}
+		} else if(name.equals(XMLStoreConstants.ATTR_NAME)) {
+			XAttribute attr = ComplexAttrUtil.findComplexAttr(getParent(), oldValue);
+			if(attr != null) {
+				XModelEntity entity = attr.getModelEntity();
+				XModelObject c = getParent().getChildByPath(entity.getAttribute(XMLStoreConstants.ATTR_NAME).getDefaultValue());
+				if(c != null) {
+					c.setAttributeValue(attr.getName(), "");
+				}
+			}
+			attr = ComplexAttrUtil.findComplexAttr(getParent(), newValue);
+			if(attr != null) {
+				XModelEntity entity = attr.getModelEntity();
+				XModelObject c = getParent().getChildByPath(entity.getAttribute(XMLStoreConstants.ATTR_NAME).getDefaultValue());
+				if(c != null) {
+					c.setAttributeValue(attr.getName(), newValue);
+				}
+			}
+		}
+	}
+}


Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml/src/org/jboss/tools/hibernate/xml/model/impl/HibConfigSimplePropertyImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list