Author: scabanovich
Date: 2012-08-15 20:17:47 -0400 (Wed, 15 Aug 2012)
New Revision: 43060
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllOtherAnnotationsFromParametersMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactorContributionFactory.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/OpenCDINamedBeanDialog.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.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.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -11,7 +11,7 @@
package org.jboss.tools.cdi.ui.marker;
import java.util.ArrayList;
-import java.util.Iterator;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -273,10 +273,9 @@
ICDIProject cdiProject =
CDIUtil.getCDIProject((IFile)compilationUnit.getUnderlyingResource(), cdiNature,
asYouType);
if(cdiProject != null){
- Set<IBean> beans =
cdiProject.getBeans(field.getUnderlyingResource().getFullPath());
- Iterator<IBean> iter = beans.iterator();
- if(iter.hasNext()){
- IBean bean = iter.next();
+ Collection<IBean> beans =
cdiProject.getBeans(field.getUnderlyingResource().getFullPath());
+ if(!beans.isEmpty()){
+ IBean bean = beans.iterator().next();
if(field != null){
return new IQuickFix[] {
new MakeFieldProtectedMarkerResolution(field),
@@ -625,7 +624,7 @@
return resolutions;
}
- Set<IBean> allBeans = CDIUtil.getFilteredBeans(cdiProject,
compilationUnit.getUnderlyingResource().getFullPath());
+ Collection<IBean> allBeans = CDIUtil.getFilteredBeans(cdiProject,
compilationUnit.getUnderlyingResource().getFullPath());
IInjectionPoint ip = CDIUtil.findInjectionPoint(allBeans, parameter, start);
if(ip != null){
@@ -808,7 +807,7 @@
return null;
}
- Set<IBean> allBeans = CDIUtil.getFilteredBeans(cdiProject,
compilationUnit.getUnderlyingResource().getFullPath());
+ Collection<IBean> allBeans = CDIUtil.getFilteredBeans(cdiProject,
compilationUnit.getUnderlyingResource().getFullPath());
IInjectionPoint ip = CDIUtil.findInjectionPoint(allBeans, element, start);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllOtherAnnotationsFromParametersMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllOtherAnnotationsFromParametersMarkerResolution.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllOtherAnnotationsFromParametersMarkerResolution.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -107,6 +107,11 @@
@Override
public String getDescription() {
+ if(description == null) {
+ System.out.println("compute description " + this);
+ description = getPreview();
+ System.out.println(description.length());
+ }
return description;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -11,8 +11,6 @@
package org.jboss.tools.cdi.ui.marker;
import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.Set;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IBuffer;
@@ -92,10 +90,7 @@
}
private IAnnotation getScopeAnnotation(){
- Set<IScopeDeclaration> scopDeclarations = bean.getScopeDeclarations();
- Iterator<IScopeDeclaration> iter = scopDeclarations.iterator();
- while(iter.hasNext()){
- IScopeDeclaration declaration = iter.next();
+ for(IScopeDeclaration declaration: bean.getScopeDeclarations()) {
if(declaration.getJavaAnnotation() != null) {
return declaration.getJavaAnnotation();
}
@@ -104,10 +99,7 @@
}
private String getFullyQualifiedName(){
- Set<IScopeDeclaration> scopDeclarations = bean.getScopeDeclarations();
- Iterator<IScopeDeclaration> iter = scopDeclarations.iterator();
- while(iter.hasNext()){
- IScopeDeclaration declaration = iter.next();
+ for(IScopeDeclaration declaration: bean.getScopeDeclarations()) {
return declaration.getScope().getSourceType().getFullyQualifiedName();
}
return null;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactorContributionFactory.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactorContributionFactory.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactorContributionFactory.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.refactoring;
+import java.util.Collection;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -103,7 +104,7 @@
if(cdiProject == null)
return null;
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Collection<IBean> beans = cdiProject.getBeans(file.getFullPath());
for(IBean bean : beans){
if(bean.getName() != null){
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.search;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -78,12 +79,11 @@
}
private void searchInProject(ISearchRequestor requestor, QuerySpecification
querySpecification, ICDIProject cdiProject, IProgressMonitor monitor, IJavaElement
element){
- Set<IBean> sourceBeans = cdiProject.getBeans(element);
+ Collection<IBean> sourceBeans = cdiProject.getBeans(element);
Set<IInjectionPoint> injectionPoints = new HashSet<IInjectionPoint>();
for (IBean b: sourceBeans) {
- Set<IParametedType> ts = b.getLegalTypes();
- for (IParametedType t: ts) {
+ for (IParametedType t: b.getLegalTypes()) {
injectionPoints.addAll(cdiProject.getInjections(t.getType().getFullyQualifiedName()));
}
}
@@ -93,7 +93,7 @@
for(IInjectionPoint injectionPoint : injectionPoints){
if(monitor.isCanceled())
break;
- Set<IBean> resultBeans = cdiProject.getBeans(false, injectionPoint);
+ Collection<IBean> resultBeans = cdiProject.getBeans(false, injectionPoint);
monitor.worked(1);
for(IBean cBean : resultBeans){
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.ui.search;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -94,12 +95,11 @@
if(cdiProject == null)
return;
- Set<IBean> beans = cdiProject.getBeans(element.getPath());
+ Collection<IBean> beans = cdiProject.getBeans(element.getPath());
IInjectionPoint injectionPoint = CDIUtil.findInjectionPoint(beans, element, 0);
if(injectionPoint != null){
- Set<IBean> resultBeanSet = cdiProject.getBeans(false, injectionPoint);
- List<IBean> resultBeanList = CDIUtil.sortBeans(resultBeanSet);
+ List<IBean> resultBeanList = CDIUtil.sortBeans(cdiProject.getBeans(false,
injectionPoint));
for(IBean bean : resultBeanList){
if(bean != null && containsInSearchScope(querySpecification, bean)){
CDIMatch match = new CDIMatch(bean);
@@ -123,8 +123,7 @@
private void resolveObserverMethods(ICDIProject cdiProject, IInjectionPoint
injectionPoint, ISearchRequestor requestor,
QuerySpecification querySpecification){
- Set<IObserverMethod> observerMethods =
cdiProject.resolveObserverMethods(injectionPoint);
- for(IObserverMethod observerMethod : observerMethods){
+ for(IObserverMethod observerMethod :
cdiProject.resolveObserverMethods(injectionPoint)){
if(containsInSearchScope(querySpecification, observerMethod)){
// match observer method
CDIMatch match = new CDIMatch(observerMethod);
@@ -138,8 +137,7 @@
private void findObservedEvents(ICDIProject cdiProject, IParameter param,
ISearchRequestor requestor,
QuerySpecification querySpecification){
- Set<IInjectionPoint> events = cdiProject.findObservedEvents(param);
- for(IInjectionPoint event : events){
+ for(IInjectionPoint event : cdiProject.findObservedEvents(param)){
if(containsInSearchScope(querySpecification, event)){
// match event
CDIMatch match = new CDIMatch(event);
@@ -151,14 +149,13 @@
}
}
- private IParameter findObserverParameter(Set<IBean> beans, IMethod method) throws
JavaModelException {
+ private IParameter findObserverParameter(Collection<IBean> beans, IMethod method)
throws JavaModelException {
for (IBean bean: beans) {
if(bean instanceof IClassBean) {
- Set<IObserverMethod> observers = ((IClassBean)bean).getObserverMethods();
- for (IObserverMethod bm: observers) {
+ for (IObserverMethod bm: ((IClassBean)bean).getObserverMethods()) {
if(bm.getMethod().equals(method)){
IObserverMethod obs = (IObserverMethod)bm;
- Set<IParameter> ps = obs.getObservedParameters();
+ Collection<IParameter> ps = obs.getObservedParameters();
if(!ps.isEmpty()) {
return ps.iterator().next();
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -293,9 +293,7 @@
IJavaProject jp = root.getJavaProject();
ICDIProject cdi = NewCDIAnnotationWizardPage.getCDIProject(jp);
if(cdi != null) {
- Set<String> scopes = cdi.getScopeNames();
- String[] tags = scopes.toArray(new String[0]);
- setScopes(tags);
+ setScopes(cdi.getScopeNames().toArray(new String[0]));
} else {
setScopes(new String[]{""});
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewStereotypeWizardPage.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -35,7 +35,6 @@
import org.jboss.tools.cdi.internal.core.validation.AnnotationValidationDelegate;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.cdi.ui.wizard.NewBeanWizardPage.CheckBoxEditorWrapper;
import org.jboss.tools.common.java.IAnnotationDeclaration;
import org.jboss.tools.common.ui.widget.editor.ITaggedFieldEditor;
import org.jboss.tools.common.ui.widget.editor.ListFieldEditor;
@@ -234,9 +233,7 @@
IJavaProject jp = root.getJavaProject();
ICDIProject cdi = getCDIProject(jp);
if(cdi != null) {
- Set<String> scopes = cdi.getScopeNames();
- String[] tags = scopes.toArray(new String[0]);
- setScopes(tags);
+ setScopes(cdi.getScopeNames().toArray(new String[0]));
} else {
setScopes(new String[]{""});
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/OpenCDINamedBeanDialog.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/OpenCDINamedBeanDialog.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/OpenCDINamedBeanDialog.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -14,6 +14,7 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -190,8 +191,7 @@
ICDIProject cdiProject = CDICorePlugin.getCDIProject(project, true);
if (cdiProject != null) {
- Set<IBean> iter = cdiProject.getNamedBeans(false);
- for (IBean bean: iter) {
+ for (IBean bean: cdiProject.getNamedBeans(false)) {
if (cdiProject == bean.getDeclaringProject()) {
contentProvider.add(new CDINamedBeanWrapper(bean
.getName(), project.getName(), bean),
@@ -291,7 +291,7 @@
}
String beanName = beanWrapper.getBeanName();
- Set<IBean> beans = cdiProject
+ Collection<IBean> beans = cdiProject
.getBeans(beanName, true);
IBean bean = (beans == null || beans.isEmpty() ? null : beans.iterator().next());
return (bean != null);
@@ -457,7 +457,7 @@
ICDIProject cdiProject = CDICorePlugin.getCDIProject(
project, true);
if (cdiProject != null) {
- Set<IBean> beans = cdiProject
+ Collection<IBean> beans = cdiProject
.getBeans(beanName, true);
if (!beans.isEmpty())
return beans.iterator().next();
@@ -518,7 +518,7 @@
mem.putString(DELETED, YES);
continue;
}
- Set<IBean> beans = cdiProject
+ Collection<IBean> beans = cdiProject
.getBeans(beanName, true);
IBean bean = (beans == null || beans.isEmpty() ? null : beans.iterator().next());
if (bean == null)
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2012-08-16
00:16:55 UTC (rev 43059)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2012-08-16
00:17:47 UTC (rev 43060)
@@ -15,7 +15,6 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.OperationCanceledException;
@@ -609,16 +608,13 @@
}
protected void moveAll(ValuedQualifier[] mods, boolean add2) {
- int size = mods.length;
ArrayList<ValuedQualifier> list = new ArrayList<ValuedQualifier>();
- for (int i = 0; i < size; i++) {
- if (!contains(list, mods[i]))
- list.add(mods[i]);
+ for (ValuedQualifier qualifier: mods) {
+ if (!contains(list, qualifier))
+ list.add(qualifier);
}
- Iterator<ValuedQualifier> iterator = list.iterator();
- while (iterator.hasNext()) {
- ValuedQualifier qualifier = iterator.next();
+ for (ValuedQualifier qualifier: list) {
if (add2) {
qualifiers.remove(qualifier);
deployed.add(qualifier);
@@ -653,9 +649,7 @@
public ArrayList<ValuedQualifier> getQualifiersToRemove() {
ArrayList<ValuedQualifier> list = new ArrayList<ValuedQualifier>();
- Iterator<ValuedQualifier> iterator = originalQualifiers.iterator();
- while (iterator.hasNext()) {
- ValuedQualifier qualifier = iterator.next();
+ for (ValuedQualifier qualifier: originalQualifiers) {
if (!contains(deployed, qualifier))
list.add(qualifier);
}
@@ -664,9 +658,7 @@
public ArrayList<ValuedQualifier> getQualifiersToAdd() {
ArrayList<ValuedQualifier> list = new ArrayList<ValuedQualifier>();
- Iterator<ValuedQualifier> iterator = deployed.iterator();
- while (iterator.hasNext()) {
- ValuedQualifier qualifier = iterator.next();
+ for (ValuedQualifier qualifier: deployed) {
if (!contains(originalQualifiers, qualifier))
list.add(qualifier);
}