Author: scabanovich
Date: 2011-12-29 20:00:56 -0500 (Thu, 29 Dec 2011)
New Revision: 37585
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ScheduleListAdapter.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java
Log:
JBIDE-10573
https://issues.jboss.org/browse/JBIDE-10573
Attribute 'scheduleidref' validation.
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2011-12-30 01:00:06 UTC (rev
37584)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/plugin.xml 2011-12-30 01:00:56 UTC (rev
37585)
@@ -64,12 +64,14 @@
<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.ScheduleListAdapter"
id="ESBScheduleList"/>
<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="ESBScheduleList"/>
<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>
Modified:
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 2011-12-30
01:00:06 UTC (rev 37584)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/BusListAdapter.java 2011-12-30
01:00:56 UTC (rev 37585)
@@ -4,6 +4,7 @@
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
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;
@@ -28,8 +29,7 @@
}
protected void loadTags() {
- XModelObject f = context;
- while(f != null && f.getFileType() != XModelObject.FILE) f = f.getParent();
+ XModelObject f = FileSystemsHelper.getFile(context);
if(f == null) return;
String listenerEntity = attribute.getModelEntity().getName();
String prefix = getBusEntityPrefix(listenerEntity);
Added:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ScheduleListAdapter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ScheduleListAdapter.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/adapter/ScheduleListAdapter.java 2011-12-30
01:00:56 UTC (rev 37585)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+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.filesystems.FileSystemsHelper;
+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;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class ScheduleListAdapter extends DefaultComboBoxValueAdapter {
+
+ protected IListContentProvider createListContentProvider(XAttribute attribute) {
+ ScheduleListContentProvider p = new ScheduleListContentProvider();
+ p.setContext(modelObject);
+ p.setAttribute(attribute);
+ return p;
+ }
+
+}
+
+class ScheduleListContentProvider extends DefaultXAttributeListContentProvider {
+ private XModelObject context;
+
+ public void setContext(XModelObject context) {
+ this.context = context;
+ }
+
+ protected void loadTags() {
+ XModelObject f = FileSystemsHelper.getFile(context);
+ if(f == null) return;
+ XModelObject[] ps = f.getChildByPath("Providers").getChildren();
+ TreeSet<String> set = new TreeSet<String>();
+ for (int i = 0; i < ps.length; i++) {
+ if("schedule-provider".equals(ps[i].getModelEntity().getXMLSubPath())) {
+ XModelObject[] cs = ps[i].getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ if(cs[j].getModelEntity().getAttribute(ESBConstants.ATTR_SCHEDULE_ID) != null) {
+ String v = cs[j].getAttributeValue(ESBConstants.ATTR_SCHEDULE_ID);
+ if(v != null && v.length() > 0) {
+ set.add(v);
+ }
+ }
+ }
+ }
+ }
+ 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/ScheduleListAdapter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain