Author: scabanovich
Date: 2012-08-15 20:16:18 -0400 (Wed, 15 Aug 2012)
New Revision: 43058
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/EventAndObserverMethodHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ITestableCDIHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java
Log:
JBIDE-12417
https://issues.jboss.org/browse/JBIDE-12417
Replaced Set by Collection in interfaces.
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 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -125,7 +125,7 @@
this.injectionPoint = injectionPoint;
filters.init(injectionPoint);
initSettings();
- beans = injectionPoint.getCDIProject().getBeans(false, injectionPoint);
+ beans = new HashSet<IBean>(injectionPoint.getCDIProject().getBeans(false,
injectionPoint));
eligibleBeans = new HashSet<IBean>(beans);
for (int i = AssignableBeanFilters.OPTION_UNAVAILABLE_BEANS + 1; i <
AssignableBeanFilters.OPTION_ELIMINATED_AMBIGUOUS; i++) {
Filter f = filters.getFilter(i);
@@ -133,7 +133,7 @@
f.filter(eligibleBeans);
}
}
- resolvedBeans = injectionPoint.getCDIProject().getBeans(true, injectionPoint);
+ resolvedBeans = new HashSet<IBean>(injectionPoint.getCDIProject().getBeans(true,
injectionPoint));
}
String computeTitle() {
@@ -144,8 +144,7 @@
IMethod m = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
result.append(m.getElementName()).append("(");
}
- Set<IQualifierDeclaration> ds = injectionPoint.getQualifierDeclarations();
- for (IQualifierDeclaration d: ds) {
+ for (IQualifierDeclaration d: injectionPoint.getQualifierDeclarations()) {
result.append("(a)").append(d.getType().getElementName()).append("
");
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventAndObserverMethodHyperlinkDetector.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.text.ext.hyperlink;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -101,7 +102,7 @@
IInjectionPoint injectionPoint = findInjectedPoint(cdiProject, elements[0], position,
input.getPath());
Set<IParameter> param = findObserverParameter(cdiProject, elements[0], offset,
input.getPath());
if(injectionPoint != null){
- Set<IObserverMethod> observerMethods =
cdiProject.resolveObserverMethods(injectionPoint);
+ Collection<IObserverMethod> observerMethods =
cdiProject.resolveObserverMethods(injectionPoint);
if(observerMethods.size() == 1){
hyperlinks.add(new ObserverMethodHyperlink(region,
observerMethods.iterator().next(), document));
@@ -132,22 +133,18 @@
}
private IInjectionPoint findInjectedPoint(ICDIProject cdiProject, IJavaElement element,
int offset, IPath path){
- Set<IBean> beans = cdiProject.getBeans(path);
-
- return CDIUtil.findInjectionPoint(beans, element, offset);
+ return CDIUtil.findInjectionPoint(cdiProject.getBeans(path), element, offset);
}
private Set<IParameter> findObserverParameter(ICDIProject cdiProject, IJavaElement
element, int offset, IPath path) throws JavaModelException {
HashSet<IParameter> result = new HashSet<IParameter>();
- Set<IBean> beans = cdiProject.getBeans(path);
- for (IBean bean: beans) {
+ for (IBean bean: cdiProject.getBeans(path)) {
if(bean instanceof IClassBean) {
- Set<IObserverMethod> observers = ((IClassBean)bean).getObserverMethods();
- for (IObserverMethod bm: observers) {
+ for (IObserverMethod bm: ((IClassBean)bean).getObserverMethods()) {
ISourceRange sr = bm.getMethod().getSourceRange();
if(sr.getOffset() <= offset && sr.getOffset() + sr.getLength() >=
offset) {
IObserverMethod obs = (IObserverMethod)bm;
- Set<IParameter> ps = obs.getObservedParameters();
+ Collection<IParameter> ps = obs.getObservedParameters();
if(!ps.isEmpty()) {
result.add(ps.iterator().next());
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ITestableCDIHyperlink.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ITestableCDIHyperlink.java 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ITestableCDIHyperlink.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -10,11 +10,11 @@
******************************************************************************/
package org.jboss.tools.cdi.text.ext.hyperlink;
-import java.util.Set;
+import java.util.Collection;
import org.jboss.tools.cdi.core.ICDIElement;
public interface ITestableCDIHyperlink {
public ICDIElement getCDIElement();
- public Set<? extends ICDIElement> getCDIElements();
+ public Collection<? extends ICDIElement> getCDIElements();
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.text.ext.hyperlink;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -115,7 +116,7 @@
return;
}
- Set<IBean> beans = cdiProject.getBeans(path);
+ Collection<IBean> beans = cdiProject.getBeans(path);
IInjectionPoint injectionPoint = CDIUtil.findInjectionPoint(beans, element, offset);
if(injectionPoint == null){
@@ -124,7 +125,7 @@
List<IBean> resultBeans = CDIUtil.getSortedBeans(cdiProject, true,
injectionPoint);
- Set<IBean> assignableBeans = cdiProject.getBeans(false, injectionPoint);
+ Collection<IBean> assignableBeans = cdiProject.getBeans(false, injectionPoint);
if(assignableBeans.size() > 0){
if(resultBeans.size() > 0){
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.text.ext.hyperlink;
-import java.util.Set;
+import java.util.Collection;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -23,9 +23,9 @@
public class ObserverMethodListHyperlink extends AbstractHyperlink implements
ITestableCDIHyperlink{
private ITextViewer viewer;
- private Set<IObserverMethod> observerMethods;
+ private Collection<IObserverMethod> observerMethods;
- public ObserverMethodListHyperlink(ITextViewer viewer, IRegion region,
Set<IObserverMethod> observerMethods, IDocument document){
+ public ObserverMethodListHyperlink(ITextViewer viewer, IRegion region,
Collection<IObserverMethod> observerMethods, IDocument document){
this.viewer = viewer;
this.observerMethods = observerMethods;
setRegion(region);
@@ -61,7 +61,7 @@
return null;
}
- public Set<? extends ICDIElement> getCDIElements() {
+ public Collection<? extends ICDIElement> getCDIElements() {
return observerMethods;
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java 2012-08-16
00:15:03 UTC (rev 43057)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ProducerDisposerHyperlinkDetector.java 2012-08-16
00:16:18 UTC (rev 43058)
@@ -11,8 +11,8 @@
package org.jboss.tools.cdi.text.ext.hyperlink;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
@@ -67,7 +67,7 @@
if(project == null)
return null;
- Set<IBean> beans = getBeans(project, input.getPath());
+ Collection<IBean> beans = getBeans(project, input.getPath());
if(beans == null)
return null;
@@ -123,7 +123,7 @@
return null;
}
- private Set<IBean> getBeans(IProject project, IPath path){
+ private Collection<IBean> getBeans(IProject project, IPath path){
CDICoreNature cdiNature = CDIUtil.getCDINatureWithProgress(project);
if(cdiNature == null)
@@ -136,8 +136,7 @@
return null;
- Set<IBean> beans = cdiProject.getBeans(path);
- return beans;
+ return cdiProject.getBeans(path);
}
private IProducerMethod getProducer(IClassBean classBean, IMethod method){