Author: scabanovich
Date: 2010-08-31 11:49:51 -0400 (Tue, 31 Aug 2010)
New Revision: 24580
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/ActionClassValueFilter.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBActionForm.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizardPage.java
Log:
https://jira.jboss.org/browse/JBIDE-6616
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/ActionClassValueFilter.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/ActionClassValueFilter.java 2010-08-31
15:37:49 UTC (rev 24579)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/attribute/ActionClassValueFilter.java 2010-08-31
15:49:51 UTC (rev 24580)
@@ -11,13 +11,18 @@
package org.jboss.tools.esb.ui.editor.attribute;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.common.meta.XAttribute;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.attribute.IValueFilter;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.esb.ui.wizard.NewActionWizardPage;
/**
*
@@ -42,7 +47,27 @@
boolean b = value.startsWith("org.jboss.soa.esb.actions.")
|| EclipseJavaUtil.isDerivedClass(value, AbstractActionLifecycle, project)
|| EclipseJavaUtil.isDerivedClass(value, AbstractActionPipelineProcessor, project);
-
+ if(!b) {
+ IType t = EclipseResourceUtil.getValidType(project, value);
+ if(t != null) {
+ try {
+ boolean q = NewActionWizardPage.PROCESS.equals(EclipseJavaUtil.resolveType(t,
"Process")) ;
+ IMethod[] ms = t.getMethods();
+ for (int i = 0; i < ms.length; i++) {
+ IAnnotation a = ms[i].getAnnotation(NewActionWizardPage.PROCESS);
+ if((a == null || !a.exists()) && q) {
+ a = ms[i].getAnnotation("Process");
+ }
+ if(a != null && a.exists()) {
+ b = true;
+ break;
+ }
+ }
+ } catch (CoreException e) {
+
+ }
+ }
+ }
return b;
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBActionForm.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBActionForm.java 2010-08-31
15:37:49 UTC (rev 24579)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBActionForm.java 2010-08-31
15:49:51 UTC (rev 24580)
@@ -7,6 +7,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
@@ -29,6 +30,7 @@
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.esb.core.model.ESBConstants;
+import org.jboss.tools.esb.ui.wizard.NewActionWizardPage;
public class ESBActionForm extends Form {
static IFormData formData = ModelFormLayoutData.createGeneralFormData(
@@ -100,10 +102,15 @@
if(ms[i].isConstructor()) continue;
if(!Flags.isPublic(ms[i].getFlags())) continue;
String[] ps = ms[i].getParameterTypes();
- if(ps == null || ps.length != 1) continue;
+ if(ps == null || ps.length == 0) continue;
String t = EclipseJavaUtil.resolveTypeAsString(type, ps[0]);
- if(!t.endsWith("Message")) continue;
- list.add(ms[i].getElementName());
+ if(t.endsWith("Message") && ps.length == 1) {
+ list.add(ms[i].getElementName());
+ continue;
+ }
+ if(hasProcessAnnotation(ms[i])) {
+ list.add(ms[i].getElementName());
+ }
}
String st = type.getSuperclassName();
if(st != null && st.length() > 0) {
@@ -114,4 +121,19 @@
}
}
+
+ static boolean hasProcessAnnotation(IMethod m) throws JavaModelException {
+ boolean q =
NewActionWizardPage.PROCESS.equals(EclipseJavaUtil.resolveType(m.getDeclaringType(),
"Process"));
+ IAnnotation[] as = m.getAnnotations();
+ for (IAnnotation a: as) {
+ String n = a.getElementName();
+ if(NewActionWizardPage.PROCESS.equals(n)) {
+ return true;
+ }
+ if(q && "Process".equals(n)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizardPage.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizardPage.java 2010-08-31
15:37:49 UTC (rev 24579)
+++
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/wizard/NewActionWizardPage.java 2010-08-31
15:49:51 UTC (rev 24580)
@@ -45,6 +45,8 @@
*
*/
public class NewActionWizardPage extends NewClassWizardPageEx {
+ public static String PROCESS =
"org.jboss.soa.esb.actions.annotation.Process";
+
RadioFieldEditor pojo = null;
public NewActionWizardPage() {
@@ -187,7 +189,7 @@
buf.append(comment);
buf.append(lineDelim);
}
- imports.addImport("org.jboss.soa.esb.actions.annotation.Process");
//$NON-NLS-1$
+ imports.addImport(PROCESS); //$NON-NLS-1$
buf.append("(a)Process").append(lineDelim); //$NON-NLS-1$
buf.append("public Message process("); //$NON-NLS-1$
buf.append(imports.addImport("org.jboss.soa.esb.message.Message"));
//$NON-NLS-1$