Author: dazarov
Date: 2011-10-07 18:41:33 -0400 (Fri, 07 Oct 2011)
New Revision: 35491
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/beans.xml
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
Quick fixes for problem markers in beans.xml
https://issues.jboss.org/browse/JBIDE-9833
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java 2011-10-07
22:31:09 UTC (rev 35490)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java 2011-10-07
22:41:33 UTC (rev 35491)
@@ -28,7 +28,7 @@
import org.jboss.tools.cdi.ui.wizard.NewStereotypeCreationWizard;
import org.jboss.tools.common.model.ui.wizards.NewTypeWizardAdapter;
-public class CreateCDIElementMarkerResolution implements IMarkerResolution2{
+public class CreateCDIElementMarkerResolution implements IMarkerResolution2,
TestableResolutionWithDialog{
private static final String OBJECT = "java.lang.Object";
public static final int CREATE_BEAN_CLASS = 1;
@@ -61,8 +61,16 @@
return "";
}
+ public void run(IMarker marker){
+ internal_run(marker, false);
+ }
+
@Override
- public void run(IMarker marker) {
+ public void runForTest(IMarker marker) {
+ internal_run(marker, true);
+ }
+
+ private void internal_run(IMarker marker, boolean test) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
NewCDIElementWizard wizard = null;
switch(id){
@@ -90,7 +98,16 @@
wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(new Object[]{}));
WizardDialog dialog = new WizardDialog(shell, wizard);
+ if(test){
+ dialog.setBlockOnOpen(false);
+ }
+
dialog.open();
+
+ if(test){
+ wizard.performFinish();
+ dialog.close();
+ }
}
@Override
@@ -103,4 +120,5 @@
return CDIImages.QUICKFIX_EDIT;
}
+
}
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/beans.xml
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/beans.xml
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/beans.xml 2011-10-07
22:41:33 UTC (rev 35491)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<beans
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:weld="http://jboss.org/schema/weld/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://jboss.org/schema/cdi/beans_1_0.xsd http://jboss.org/schema/weld/beans
http://jboss.org/schema/weld/beans_1_1.xsd">
+ <interceptors>
+
<class>org.jboss.jsr299.tck.tests.jbt.quickfixes.MyFirstInterceptor</class>
+ </interceptors>
+ <weld:scan/>
+ <decorators>
+ <class>org.jboss.jsr299.tck.tests.jbt.quickfixes.MyFirstDecorator</class>
+ </decorators>
+ <alternatives>
+ <class>org.jboss.jsr299.tck.tests.jbt.quickfixes.MyFirstBean</class>
+
<stereotype>org.jboss.jsr299.tck.tests.jbt.quickfixes.MyFirstStereotype</stereotype>
+ </alternatives>
+</beans>
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/beans.xml
___________________________________________________________________
Added: 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-10-07
22:31:09 UTC (rev 35490)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-10-07
22:41:33 UTC (rev 35491)
@@ -33,12 +33,14 @@
import org.jboss.tools.cdi.ui.marker.AddSerializableInterfaceMarkerResolution;
import org.jboss.tools.cdi.ui.marker.AddTargetAnnotationMarkerResolution;
import org.jboss.tools.cdi.ui.marker.ChangeAnnotationMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.CreateCDIElementMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllDisposerDuplicantMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllInjectedConstructorsMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAnnotationMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodBusinessMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodPublicMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.TestableResolutionWithDialog;
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithRefactoringProcessor;
import org.jboss.tools.common.base.test.validation.TestUtil;
import org.jboss.tools.common.util.FileUtil;
@@ -102,6 +104,8 @@
CompositeChange rootChange = (CompositeChange)processor.createChange(new
NullProgressMonitor());
rootChange.perform(new NullProgressMonitor());
+ } else if(resolution instanceof TestableResolutionWithDialog){
+ ((TestableResolutionWithDialog) resolution).runForTest(marker);
} else {
resolution.run(marker);
}
@@ -945,4 +949,37 @@
CDIValidationErrorManager.SESSION_BEAN_ANNOTATED_INTERCEPTOR_ID,
DeleteAnnotationMarkerResolution.class);
}
+
+ public void testCreateBeanClassResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/beans.xml"
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_BEAN_CLASS_NAME_ID,
+ CreateCDIElementMarkerResolution.class);
+ }
+
+ public void testCreateStereotypeResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/beans.xml"
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.UNKNOWN_ALTERNATIVE_ANNOTATION_NAME_ID,
+ CreateCDIElementMarkerResolution.class);
+ }
+
+ public void testCreateInterceptorResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/beans.xml"
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.UNKNOWN_INTERCEPTOR_CLASS_NAME_ID,
+ CreateCDIElementMarkerResolution.class);
+ }
}
\ No newline at end of file