Author: scabanovich
Date: 2009-09-14 12:38:53 -0400 (Mon, 14 Sep 2009)
New Revision: 17552
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/PropertyListAdapter.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/form/HibConfig3PropertyFormLayoutData.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2607
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/plugin.xml 2009-09-14
16:37:00 UTC (rev 17551)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/plugin.xml 2009-09-14
16:38:53 UTC (rev 17552)
@@ -54,4 +54,13 @@
<xclass
id="org.jboss.tools.hibernate.ui.xml.form.Hibernate3FormLayoutData"
class="org.jboss.tools.hibernate.ui.xml.form.Hibernate3FormLayoutData"/>
</extension>
+
+ <extension point="org.jboss.tools.common.model.ui.attributeAdapter">
+ <attributeAdapter
class="org.jboss.tools.hibernate.ui.xml.editor.PropertyListAdapter"
id="HibernatePropertyList"/>
+ </extension>
+
+ <extension point="org.jboss.tools.common.model.ui.attributeEditor">
+ <attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="HibernatePropertyList"/>
+ </extension>
+
</plugin>
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/PropertyListAdapter.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/PropertyListAdapter.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/PropertyListAdapter.java 2009-09-14
16:38:53 UTC (rev 17552)
@@ -0,0 +1,55 @@
+package org.jboss.tools.hibernate.ui.xml.editor;
+
+import java.util.TreeSet;
+
+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.ui.attribute.IListContentProvider;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultComboBoxValueAdapter;
+import
org.jboss.tools.common.model.ui.attribute.adapter.DefaultXAttributeListContentProvider;
+import org.jboss.tools.hibernate.ui.xml.form.HibConfig3PropertyFormLayoutData;
+import org.jboss.tools.hibernate.xml.model.impl.HibConfigComplexPropertyImpl;
+
+public class PropertyListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ PropertyListContentProvider p = new PropertyListContentProvider();
+ p.setContext(modelObject);
+ p.setAttribute(attribute);
+ return p;
+ }
+
+}
+
+class PropertyListContentProvider extends DefaultXAttributeListContentProvider {
+ private XModelObject context;
+
+ public void setContext(XModelObject context) {
+ this.context = context;
+ }
+
+ protected void loadTags() {
+ XModelObject f = context;
+ XModelEntity ent =
f.getModelEntity().getMetaModel().getEntity(HibConfig3PropertyFormLayoutData.PROPERTY_FOLDER_ENTITY);
+ if(ent == null) return;
+ XChild[] cs = ent.getChildren();
+ TreeSet<String> set = new TreeSet<String>();
+
+ for (int i = 0; i < cs.length; i++) {
+ XModelEntity e = f.getModelEntity().getMetaModel().getEntity(cs[i].getName());
+ XAttribute[] as = e.getAttributes();
+ for (int j = 0; j < as.length; j++) {
+ String prop = as[j].getProperty(HibConfigComplexPropertyImpl.H_PROPERTY);
+ if(prop != null && prop.length() > 0) {
+ set.add(prop);
+ }
+ }
+ }
+
+ tags = set.toArray(new String[0]);
+ }
+
+}
+
Property changes on:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/editor/PropertyListAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/form/HibConfig3PropertyFormLayoutData.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/form/HibConfig3PropertyFormLayoutData.java 2009-09-14
16:37:00 UTC (rev 17551)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.xml.ui/src/org/jboss/tools/hibernate/ui/xml/form/HibConfig3PropertyFormLayoutData.java 2009-09-14
16:38:53 UTC (rev 17552)
@@ -19,6 +19,7 @@
*/
public class HibConfig3PropertyFormLayoutData {
static String PROPERTY_ENTITY = "HibConfig3Property"; //$NON-NLS-1$
+ public static String PROPERTY_FOLDER_ENTITY = "HibConfig3PropertiesFolder";
//$NON-NLS-1$
final static IFormData PROPERTY_LIST_DEFINITION = new FormData(
Messages.HibConfig3PropertyFormLayoutData_List,
@@ -32,7 +33,7 @@
final static IFormData PROPERTY_FOLDER_DEFINITION = new FormData(
Messages.HibConfig3PropertyFormLayoutData_Folder,
"", //"Description //$NON-NLS-1$
- "HibConfig3PropertiesFolder", //$NON-NLS-1$
+ PROPERTY_FOLDER_ENTITY,
new FormAttributeData[]{new FormAttributeData("name", 100,
Messages.HibConfig3PropertyFormLayoutData_Name)}, //$NON-NLS-1$
new String[]{PROPERTY_ENTITY},
Hibernate3FormLayoutDataUtil.createDefaultFormActionData("CreateActions.AddProperty")
//$NON-NLS-1$