Author: scabanovich
Date: 2008-02-21 11:49:32 -0500 (Thu, 21 Feb 2008)
New Revision: 6507
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
Log:
JBIDE-1670 Drop down selector for bus-id-ref added.
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2008-02-21 16:30:15 UTC (rev
6506)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2008-02-21 16:49:32 UTC (rev
6507)
@@ -33,4 +33,11 @@
class="org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"/>
</extension>
+ <extension point="org.jboss.tools.common.model.ui.attributeAdapter">
+ <attributeAdapter
class="org.jboss.tools.esb.ui.editor.attribute.adapter.BusListAdapter"
id="ESBBusList"/>
+ </extension>
+
+ <extension point="org.jboss.tools.common.model.ui.attributeEditor">
+ <attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="ESBBusList"/>
+ </extension>
</plugin>
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java 2008-02-21
16:49:32 UTC (rev 6507)
@@ -0,0 +1,51 @@
+package org.jboss.tools.esb.ui.editor.attribute.adapter;
+
+import java.util.TreeSet;
+
+import org.jboss.tools.common.meta.XAttribute;
+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;
+
+public class BusListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ BusListContentProvider p = new BusListContentProvider();
+ p.setContext(modelObject);
+ p.setAttribute(attribute);
+ return p;
+ }
+
+}
+
+class BusListContentProvider extends DefaultXAttributeListContentProvider {
+ private XModelObject context;
+
+ public void setContext(XModelObject context) {
+ this.context = context;
+ }
+
+ protected void loadTags() {
+ XModelObject f = context;
+ while(f != null && f.getFileType() != XModelObject.FILE) f = f.getParent();
+ if(f == null) return;
+ XModelObject[] ps = f.getChildByPath("Providers").getChildren();
+ TreeSet<String> set = new TreeSet<String>();
+ for (int i = 0; i < ps.length; i++) {
+ XModelObject[] cs = ps[i].getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ if(cs[j].getModelEntity().getAttribute("bus id") != null) {
+ String v = cs[j].getAttributeValue("bus id");
+ if(v != null && v.length() > 0) {
+ set.add(v);
+ }
+ }
+ }
+ }
+ tags = set.toArray(new String[0]);
+
+ }
+
+}
+