Author: dazarov
Date: 2011-11-02 19:50:22 -0400 (Wed, 02 Nov 2011)
New Revision: 36149
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing
https://issues.jboss.org/browse/JBIDE-9940
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-02
22:48:21 UTC (rev 36148)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-02
23:50:22 UTC (rev 36149)
@@ -75,7 +75,7 @@
createRootChange();
MarkerResolutionUtils.addQualifiersToBean(qualifiers, selectedBean, rootChange);
-
+
MarkerResolutionUtils.addQualifiersToInjectionPoint(qualifiers, injectionPoint,
rootChange);
return status;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-02
22:48:21 UTC (rev 36148)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-02
23:50:22 UTC (rev 36149)
@@ -549,9 +549,10 @@
}
}
- fileChange.setEdit(edit);
- if(edit.getChildrenSize() > 0)
+ if(edit.getChildrenSize() > 0){
+ fileChange.setEdit(edit);
change.add(fileChange);
+ }
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
@@ -599,9 +600,10 @@
}
- fileChange.setEdit(edit);
- if(edit.getChildrenSize() > 0)
+ if(edit.getChildrenSize() > 0){
+ fileChange.setEdit(edit);
change.add(fileChange);
+ }
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java 2011-11-02
22:48:21 UTC (rev 36148)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java 2011-11-02
23:50:22 UTC (rev 36149)
@@ -149,6 +149,7 @@
if(next instanceof AddQualifiersToBeanWizardPage)
((AddQualifiersToBeanWizardPage)next).init(bean);
setSelectedBean(bean);
+ page.setDeployedQualifiers(page.getDeployedQualifiers());
}else
setPageComplete(false);
}
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 2011-11-02
22:48:21 UTC (rev 36148)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-11-02
23:50:22 UTC (rev 36149)
@@ -20,6 +20,8 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.jdt.core.Flags;
@@ -128,6 +130,8 @@
createControl();
if(bean != null)
init(bean);
+
+ page.setDeployedQualifiers(getDeployedQualifiers());
}
public void init(IBean bean){
@@ -447,6 +451,8 @@
monitor.beginTask(CDICoreMessages.CDI_UTIL_BUILD_CDI_MODEL, 10);
monitor.worked(3);
+ //waitForIdle(1000, 5000);
+ delay(1000);
try {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
} catch (InterruptedException e) {
@@ -455,6 +461,45 @@
monitor.worked(7);
}
+
+// public void waitForIdle(long delay, long maxIdle) {
+// long start = System.currentTimeMillis();
+// while (!Job.getJobManager().isIdle()) {
+// delay(delay);
+// if ((System.currentTimeMillis() - start) > maxIdle) {
+// Job[] jobs = Job.getJobManager().find(null);
+// StringBuffer str = new StringBuffer();
+// for (Job job : jobs) {
+// if (job.getThread() != null) {
+// str.append("\n").append(job.getName()).append(" (")
+// .append(job.getClass()).append(")");
+// }
+// }
+// throw new RuntimeException(
+// "Long running tasks detected:" + str.toString()); //$NON-NLS-1$
+// }
+// }
+// }
+
+ public void delay(long waitTimeMillis) {
+ Display display = Display.getCurrent();
+ if (display != null) {
+ long endTimeMillis = System.currentTimeMillis() + waitTimeMillis;
+ while (System.currentTimeMillis() < endTimeMillis) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.update();
+ }
+ // Otherwise, perform a simple sleep.
+ else {
+ try {
+ Thread.sleep(waitTimeMillis);
+ } catch (InterruptedException e) {
+ // Ignored.
+ }
+ }
+ }
});
}catch(InterruptedException ie){
CDICorePlugin.getDefault().logError(ie);