Author: dazarov
Date: 2011-01-21 11:08:25 -0500 (Fri, 21 Jan 2011)
New Revision: 28473
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithSelectionWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Animal.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Armchiar.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Chiar.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Couch.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cow.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cupboard.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Desk.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Dog.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken1.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken2.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Furniture.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HighStool.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HomeFurniture.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/OfficeFurniture.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken1.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken2.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sheep.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/SmallFarmAnimals.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sofa.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Stool.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7635
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.ui.marker;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -33,7 +34,7 @@
/**
* @author Daniel Azarov
*/
-public class MakeInjectedPointUnambiguousMarkerResolution implements IMarkerResolution2
{
+public class MakeInjectedPointUnambiguousMarkerResolution implements IMarkerResolution2,
TestableResolutionWithSelectionWizard {
private String label;
private IInjectionPoint injectionPoint;
private List<IBean> beans;
@@ -49,17 +50,50 @@
public String getLabel() {
return label;
}
+
+ public void selectFirstElementAndRun(IMarker marker){
+ internal_run(marker, true);
+ }
+
+ public void run(IMarker marker) {
+ internal_run(marker, false);
+ }
- public void run(IMarker marker) {
+ private void internal_run(IMarker marker, boolean test) {
if(checkBeans()){
Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
AddQualifiersToBeanWizard wizard = new AddQualifiersToBeanWizard(injectionPoint,
beans, selectedBean);
WizardDialog dialog = new WizardDialog(shell, wizard);
- int status = dialog.open();
- if(status != WizardDialog.OK)
- return;
- List<IQualifier> deployed = wizard.getDeployedQualifiers();
+ List<IQualifier> deployed;
+
+ if(test){
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ List<IQualifier> qualifiers = new ArrayList<IQualifier>();
+ qualifiers.addAll(wizard.getAvailableQualifiers());
+ if(qualifiers.isEmpty())
+ return;
+ for(IQualifier qualifier : qualifiers){
+ if(wizard.checkBeans())
+ break;
+ wizard.deploy(qualifier);
+ }
+ deployed = wizard.getDeployedQualifiers();
+ wizard.performCancel();
+ dialog.close();
+ }else{
+ int status = dialog.open();
+
+ if(status != WizardDialog.OK)
+ return;
+
+ deployed = wizard.getDeployedQualifiers();
+ }
+
+
+ deployed = wizard.getDeployedQualifiers();
MarkerResolutionUtils.addQualifiersToBean(deployed, selectedBean);
try {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IMarker;
@@ -30,7 +31,7 @@
/**
* @author Daniel Azarov
*/
-public class SelectBeanMarkerResolution implements IMarkerResolution2 {
+public class SelectBeanMarkerResolution implements IMarkerResolution2,
TestableResolutionWithSelectionWizard {
private String label;
private IInjectionPoint injectionPoint;
private List<IBean> beans;
@@ -45,17 +46,55 @@
return label;
}
+ public void selectFirstElementAndRun(IMarker marker){
+ internal_run(marker, true);
+ }
+
public void run(IMarker marker) {
+ internal_run(marker, false);
+ }
+
+ private void internal_run(IMarker marker, boolean test) {
Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
SelectBeanWizard wizard = new SelectBeanWizard(injectionPoint, beans);
WizardDialog dialog = new WizardDialog(shell, wizard);
- int status = dialog.open();
- if(status != WizardDialog.OK)
- return;
- IBean selectedBean = wizard.getBean();
+ IBean selectedBean = null;
+ List<IQualifier> deployed;
- List<IQualifier> deployed = wizard.getDeployedQualifiers();
+ if(test){
+ if(beans.isEmpty())
+ return;
+
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+
+ selectedBean = beans.get(0);
+
+ wizard.init(selectedBean);
+
+ List<IQualifier> qualifiers = new ArrayList<IQualifier>();
+ qualifiers.addAll(wizard.getAvailableQualifiers());
+ if(qualifiers.isEmpty())
+ return;
+ for(IQualifier qualifier : qualifiers){
+ if(wizard.checkBeans())
+ break;
+ wizard.deploy(qualifier);
+ }
+ deployed = wizard.getDeployedQualifiers();
+ wizard.performCancel();
+ dialog.close();
+ }else{
+ int status = dialog.open();
+
+ if(status != WizardDialog.OK)
+ return;
+
+ selectedBean = wizard.getBean();
+ deployed = wizard.getDeployedQualifiers();
+ }
+
MarkerResolutionUtils.addQualifiersToBean(deployed, selectedBean);
try {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithSelectionWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithSelectionWizard.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithSelectionWizard.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import org.eclipse.core.resources.IMarker;
+
+/**
+ * @author Daniel Azarov
+ */
+public interface TestableResolutionWithSelectionWizard {
+ public void selectFirstElementAndRun(IMarker marker);
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithSelectionWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanComposite.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -77,7 +77,7 @@
private Button remove, removeAll;
private Label nLabel;
-
+
protected boolean isComplete = true;
public AddQualifiersToBeanComposite(Composite parent, WizardPage wizard) {
@@ -155,7 +155,7 @@
});
}
- private boolean checkBeans(){
+ public boolean checkBeans(){
total.clear();
total.addAll(originalQualifiers);
total.addAll(deployed);
@@ -540,7 +540,16 @@
return total;
}
+
+ public void deploy(IQualifier qualifier){
+ IQualifier[] qualifiers = new IQualifier[]{qualifier};
+ moveAll(qualifiers, true);
+ }
+ public ArrayList<IQualifier> getAvailableQualifiers(){
+ return qualifiers;
+ }
+
class QualifiersListLabelProvider implements ILabelProvider{
public void addListener(ILabelProviderListener listener) {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -42,4 +42,15 @@
return page.getDeployedQualifiers();
}
+ public List<IQualifier> getAvailableQualifiers(){
+ return page.getAvailableQualifiers();
+ }
+
+ public void deploy(IQualifier qualifier){
+ page.deploy(qualifier);
+ }
+
+ public boolean checkBeans(){
+ return page.checkBeans();
+ }
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -21,7 +21,7 @@
public class AddQualifiersToBeanWizardPage extends WizardPage{
private AddQualifiersToBeanComposite composite;
-
+
protected AddQualifiersToBeanWizardPage(String pageName) {
super(pageName);
setTitle(CDIUIMessages.ADD_QUALIFIERS_TO_BEAN_WIZARD_TITLE);
@@ -35,9 +35,20 @@
public ArrayList<IQualifier> getDeployedQualifiers(){
return composite.getDeployedQualifiers();
}
+
+ public ArrayList<IQualifier> getAvailableQualifiers(){
+ return composite.getAvailableQualifiers();
+ }
public void init(IBean bean){
composite.init(bean);
}
+ public void deploy(IQualifier qualifier){
+ composite.deploy(qualifier);
+ }
+
+ public boolean checkBeans(){
+ return composite.checkBeans();
+ }
}
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-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -56,10 +56,27 @@
page = new AddQualifiersToBeanWizardPage("");
addPage(page);
}
+
public java.util.List<IQualifier> getDeployedQualifiers(){
return page.getDeployedQualifiers();
}
+ public java.util.List<IQualifier> getAvailableQualifiers(){
+ return page.getAvailableQualifiers();
+ }
+
+ public void init(IBean bean){
+ page.init(bean);
+ }
+
+ public void deploy(IQualifier qualifier){
+ page.deploy(qualifier);
+ }
+
+ public boolean checkBeans(){
+ return page.checkBeans();
+ }
+
@Override
public boolean performFinish() {
return true;
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Animal.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Animal.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Animal.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+interface Animal
+{
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Animal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Armchiar.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Armchiar.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Armchiar.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Armchiar implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Armchiar.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Chiar.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Chiar.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Chiar.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Chiar implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Chiar.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Couch.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Couch.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Couch.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Couch implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Couch.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cow.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cow.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cow.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+class Cow implements Animal
+{
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cupboard.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cupboard.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cupboard.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Cupboard implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Cupboard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Desk.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Desk.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Desk.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Desk implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Desk.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Dog.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Dog.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Dog.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Dog implements Animal {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Dog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken1.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken1.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken1.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.inject.Inject;
+
+
+public class Farm_Broken1 {
+ @SuppressWarnings("unused")
+ @Inject private Animal animal;
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken2.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.inject.Inject;
+
+public class Farm_Broken2 {
+ @SuppressWarnings("unused")
+ @Inject @SmallFarmAnimals private Animal animal2;
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Farm_Broken2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Furniture.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Furniture.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Furniture.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+interface Furniture
+{
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Furniture.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HighStool.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HighStool.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HighStool.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class HighStool extends Stool {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HighStool.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HomeFurniture.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HomeFurniture.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HomeFurniture.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface HomeFurniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/HomeFurniture.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/OfficeFurniture.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/OfficeFurniture.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/OfficeFurniture.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface OfficeFurniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/OfficeFurniture.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken1.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken1.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken1.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.inject.Inject;
+
+public class Office_Broken1 {
+ @SuppressWarnings("unused")
+ @Inject private Furniture furniture;
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken2.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.inject.Inject;
+
+public class Office_Broken2 {
+ @SuppressWarnings("unused")
+ @Inject @OfficeFurniture private Furniture officeFurniture;
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Office_Broken2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sheep.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sheep.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sheep.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+class Sheep implements Animal
+{
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sheep.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/SmallFarmAnimals.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/SmallFarmAnimals.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/SmallFarmAnimals.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface SmallFarmAnimals {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/SmallFarmAnimals.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sofa.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sofa.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sofa.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Sofa implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Sofa.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Stool.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Stool.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Stool.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+public class Stool implements Furniture {
+
+}
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Stool.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-01-21
14:48:16 UTC (rev 28472)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-01-21
16:08:25 UTC (rev 28473)
@@ -33,9 +33,12 @@
import org.jboss.tools.cdi.ui.marker.DeleteAllDisposerDuplicantMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllInjectedConstructorsMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.MakeInjectedPointUnambiguousMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodBusinessMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodPublicMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.SelectBeanMarkerResolution;
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithRefactoringProcessor;
+import org.jboss.tools.cdi.ui.marker.TestableResolutionWithSelectionWizard;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.test.util.JobUtils;
@@ -97,14 +100,23 @@
CompositeChange rootChange = (CompositeChange)processor.createChange(new
NullProgressMonitor());
rootChange.perform(new NullProgressMonitor());
+ }else if(resolution instanceof TestableResolutionWithSelectionWizard){
+ ((TestableResolutionWithSelectionWizard)resolution).selectFirstElementAndRun(marker);
}else{
resolution.run(marker);
}
refresh(project);
- IMarker[] newMarkers = file.findMarkers(markerType,
true, IResource.DEPTH_INFINITE);
+ IMarker[] newMarkers = file.findMarkers(markerType, true,
IResource.DEPTH_INFINITE);
+ System.out.println("Before: "+markers.length+" after:
"+newMarkers.length);
+
+ for(IMarker m : newMarkers){
+ String text = (String)m.getAttribute(IMarker.TEXT,"none");
+ System.out.println("After quick fix: "+text);
+ }
+
assertTrue("Marker resolution did not decrease number of problems. was:
"+markers.length+" now: "+newMarkers.length, newMarkers.length <
markers.length);
checkResults(project, fileNames, results);
@@ -367,4 +379,48 @@
DeleteAllInjectedConstructorsMarkerResolution.class);
}
+ public void testMakeInjectedPointUnambiguousResolution() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken1.java"
+ },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID,
+ MakeInjectedPointUnambiguousMarkerResolution.class);
+ }
+
+ public void testSelectBeanResolution() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken1.java"
+ },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.AMBIGUOUS_INJECTION_POINTS_ID,
+ SelectBeanMarkerResolution.class);
+ }
+
+ public void testMakeInjectedPointUnambiguousResolution2() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken2.java"
+ },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.UNSATISFIED_INJECTION_POINTS_ID,
+ MakeInjectedPointUnambiguousMarkerResolution.class);
+ }
+
+ public void testSelectBeanResolution2() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken2.java"
+ },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.UNSATISFIED_INJECTION_POINTS_ID,
+ SelectBeanMarkerResolution.class);
+ }
+
}