Author: scabanovich
Date: 2011-03-17 18:16:09 -0400 (Thu, 17 Mar 2011)
New Revision: 29892
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/RoutingFormDependency.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceCategoryListAdapter.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceNameListAdapter.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
Log:
JBIDE-8567
https://issues.jboss.org/browse/JBIDE-8567
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2011-03-17 22:14:22 UTC (rev
29891)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2011-03-17 22:16:09 UTC (rev
29892)
@@ -56,14 +56,20 @@
<xclass id="org.jboss.tools.esb.ui.wizard.NewActionWizard"
class="org.jboss.tools.esb.ui.wizard.NewActionWizard"/>
+ <xclass
id="org.jboss.tools.esb.ui.editor.attribute.adapter.RoutingFormDependency"
+ class="org.jboss.tools.esb.ui.editor.attribute.adapter.RoutingFormDependency"/>
</extension>
<extension point="org.jboss.tools.common.model.ui.attributeAdapter">
<attributeAdapter
class="org.jboss.tools.esb.ui.editor.attribute.adapter.BusListAdapter"
id="ESBBusList"/>
+ <attributeAdapter
class="org.jboss.tools.esb.ui.editor.attribute.adapter.ServiceCategoryListAdapter"
id="ESBServiceCategoryList"/>
+ <attributeAdapter
class="org.jboss.tools.esb.ui.editor.attribute.adapter.ServiceNameListAdapter"
id="ESBServiceNameList"/>
</extension>
<extension point="org.jboss.tools.common.model.ui.attributeEditor">
<attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="ESBBusList"/>
+ <attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="ESBServiceCategoryList"/>
+ <attributeEditor
class="org.jboss.tools.common.model.ui.attribute.editor.ComboBoxEditor"
id="ESBServiceNameList"/>
</extension>
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/RoutingFormDependency.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/RoutingFormDependency.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/RoutingFormDependency.java 2011-03-17
22:16:09 UTC (rev 29892)
@@ -0,0 +1,38 @@
+package org.jboss.tools.esb.ui.editor.attribute.adapter;
+
+import java.beans.PropertyChangeEvent;
+
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.common.model.ui.attribute.XAttributeSupport;
+import org.jboss.tools.common.model.ui.attribute.XAttributeSupport.IAttributeDependency;
+import org.jboss.tools.common.model.ui.attribute.editor.ComboBoxFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
+
+public class RoutingFormDependency implements IAttributeDependency {
+ XAttributeSupport support;
+
+ public RoutingFormDependency() {}
+
+ public void setSupport(XAttributeSupport support) {
+ this.support = support;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object source = evt.getSource();
+ if(source instanceof ServiceCategoryListAdapter) {
+ final ComboBoxFieldEditor f =
(ComboBoxFieldEditor)support.getFieldEditorByName("service name");
+ if(f == null) return;
+ final PropertyChangeEvent evt1 = new PropertyChangeEvent(this,
IPropertyEditor.LIST_CONTENT, "old", "new");
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ ComboBoxFieldEditor f1 =
(ComboBoxFieldEditor)support.getFieldEditorByName("service category");
+ if(f1 == null) return;
+ f.propertyChange(evt1);
+ f1.setFocusAndKeepSelection();
+ }
+ });
+ }
+
+ }
+
+}
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/RoutingFormDependency.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceCategoryListAdapter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceCategoryListAdapter.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceCategoryListAdapter.java 2011-03-17
22:16:09 UTC (rev 29892)
@@ -0,0 +1,45 @@
+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;
+import org.jboss.tools.esb.core.model.ESBConstants;
+
+public class ServiceCategoryListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ ServiceCategoryListContentProvider p = new ServiceCategoryListContentProvider();
+ p.setContext(modelObject);
+ p.setAttribute(attribute);
+ return p;
+ }
+
+}
+
+class ServiceCategoryListContentProvider 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 servicesFolder = f.getChildByPath("Services");
+ if(servicesFolder == null) return;
+ TreeSet<String> set = new TreeSet<String>();
+ XModelObject[] services = servicesFolder.getChildren();
+ for (int i = 0; i < services.length; i++) {
+ set.add(services[i].getAttributeValue("category"));
+ }
+ tags = set.toArray(new String[0]);
+ }
+
+}
+
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceCategoryListAdapter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceNameListAdapter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceNameListAdapter.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceNameListAdapter.java 2011-03-17
22:16:09 UTC (rev 29892)
@@ -0,0 +1,67 @@
+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.meta.action.XAttributeData;
+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.esb.core.model.ESBConstants;
+
+public class ServiceNameListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ ServiceNameListContentProvider p = new ServiceNameListContentProvider();
+ p.setContext(modelObject);
+ p.setAttribute(attribute);
+ p.setData(this.attributeData);
+ return p;
+ }
+
+}
+
+class ServiceNameListContentProvider extends DefaultXAttributeListContentProvider {
+ static String ATTR_SERVICE_CATEGORY = "service category";
+ private XModelObject context;
+ XAttributeData data;
+
+ public void setContext(XModelObject context) {
+ this.context = context;
+ }
+
+ public void setData(XAttributeData data) {
+ this.data = data;
+ }
+
+ protected void loadTags() {
+ XModelObject f = context;
+ while(f != null && f.getFileType() != XModelObject.FILE) f = f.getParent();
+ if(f == null) return;
+ XModelObject servicesFolder = f.getChildByPath("Services");
+ if(servicesFolder == null) return;
+ String category = getCategory();
+ if(category != null && category.trim().length() == 0) category = null;
+ TreeSet<String> set = new TreeSet<String>();
+ XModelObject[] services = servicesFolder.getChildren();
+ for (int i = 0; i < services.length; i++) {
+ if(category != null &&
!services[i].getAttributeValue("category").equals(category)) {
+ continue;
+ }
+ set.add(services[i].getAttributeValue("name"));
+ }
+ tags = set.toArray(new String[0]);
+ }
+
+ String getCategory() {
+ if(data != null) {
+ return data.getEntityData().getValue(ATTR_SERVICE_CATEGORY);
+ } else if(context != null &&
context.getModelEntity().getAttribute(ATTR_SERVICE_CATEGORY) != null) {
+ return context.getAttributeValue(ATTR_SERVICE_CATEGORY);
+ }
+ return ATTR_SERVICE_CATEGORY;
+ }
+
+}
+
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ServiceNameListAdapter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain