Author: scabanovich
Date: 2011-09-30 20:57:44 -0400 (Fri, 30 Sep 2011)
New Revision: 35253
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
Log:
JBIDE-9347
https://issues.jboss.org/browse/JBIDE-9347
Testing feature added to dialog; specialized beans filter fixed.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java 2011-10-01
00:51:22 UTC (rev 35252)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java 2011-10-01
00:57:44 UTC (rev 35253)
@@ -33,13 +33,13 @@
public void filter(Set<IBean> beans);
}
- static int OPTION_UNAVAILABLE_BEANS = 1;
- static int OPTION_DECORATOR = 2;
- static int OPTION_INTERCEPTOR = 3;
- static int OPTION_UNSELECTED_ALTERNATIVE = 4;
- static int OPTION_PRODUCER_IN_UNAVAILABLE_BEAN = 5;
- static int OPTION_SPECIALIZED_BEAN = 6;
- static int OPTION_ELIMINATED_AMBIGUOUS = 7;
+ public static int OPTION_UNAVAILABLE_BEANS = 1;
+ public static int OPTION_DECORATOR = 2;
+ public static int OPTION_INTERCEPTOR = 3;
+ public static int OPTION_UNSELECTED_ALTERNATIVE = 4;
+ public static int OPTION_PRODUCER_IN_UNAVAILABLE_BEAN = 5;
+ public static int OPTION_SPECIALIZED_BEAN = 6;
+ public static int OPTION_ELIMINATED_AMBIGUOUS = 7;
public static class Checkbox {
int id;
@@ -134,12 +134,15 @@
public static class SpecializedBeanFilter implements Filter {
public void filter(Set<IBean> beans) {
Iterator<IBean> it = beans.iterator();
+ Set<IBean> specialized = new HashSet<IBean>();
while(it.hasNext()) {
IBean b = it.next();
- if(b instanceof IClassBean && !((IClassBean)
b).getSpecializingBeans().isEmpty()) {
- it.remove();
+ IBean bean = b.getSpecializedBean();
+ if(bean != null) {
+ specialized.add(bean);
}
}
+ beans.removeAll(specialized);
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-10-01
00:51:22 UTC (rev 35252)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-10-01
00:57:44 UTC (rev 35253)
@@ -80,6 +80,7 @@
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.core.util.BeanPresentationUtil;
import org.jboss.tools.cdi.internal.core.impl.AbstractBeanElement;
+import org.jboss.tools.cdi.text.ext.CDIExtensionsMessages;
import org.jboss.tools.cdi.text.ext.CDIExtensionsPlugin;
import org.jboss.tools.cdi.text.ext.hyperlink.AssignableBeanFilters.Checkbox;
import org.jboss.tools.cdi.text.ext.hyperlink.AssignableBeanFilters.Filter;
@@ -176,6 +177,11 @@
return fViewMenuButtonComposite;
}
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(CDIExtensionsMessages.ASSIGNABLE_BEANS_DIALOG_TITLE);
+ }
+
protected Control createDialogArea(Composite parent) {
composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
@@ -347,6 +353,9 @@
if(display == null) {
display = Display.getDefault();
}
+ if(display.getActiveShell() == null) {
+ return super.getDefaultLocation(size);
+ }
Rectangle b = display.getActiveShell().getBounds();
int x = b.x + (b.width - size.x) / 2;
int y = b.y + (b.height - size.y) / 2;
@@ -386,7 +395,32 @@
}
}
+ public List<IBean> getDisplayedBeans() {
+ List<IBean> bs = new ArrayList<IBean>();
+ int index = 0;
+ while(true) {
+ Object o = list.getElementAt(index);
+ if(o instanceof IBean) {
+ bs.add((IBean)o);
+ } else {
+ break;
+ }
+ index++;
+ }
+ return bs;
+ }
+ public boolean isFilterEnabled(int index) {
+ return AssignableBeanFilters.ALL_OPTIONS[index].state;
+ }
+
+ public void setFilterEnabled(int index, boolean value) {
+ AssignableBeanFilters.ALL_OPTIONS[index].state = value;
+ filterView.refresh();
+// filterView.setChecked(AssignableBeanFilters.ALL_OPTIONS[index], value);
+ list.refresh();
+ }
+
class ShowHideAction extends Action {
public ShowHideAction() {
super("Show/Hide panel", Action.AS_CHECK_BOX);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2011-10-01
00:51:22 UTC (rev 35252)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2011-10-01
00:57:44 UTC (rev 35253)
@@ -42,8 +42,6 @@
}
AssignableBeansDialog dialog = new AssignableBeansDialog(display.getActiveShell());
dialog.setInjectionPoint(injectionPoint);
- dialog.create();
- dialog.getShell().setText(CDIExtensionsMessages.ASSIGNABLE_BEANS_DIALOG_TITLE);
dialog.open();
}