Author: dazarov
Date: 2010-12-17 07:55:16 -0500 (Fri, 17 Dec 2010)
New Revision: 27587
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithRefactoringProcessor.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.qfxresult
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF
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-7673
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2010-12-17
12:44:31 UTC (rev 27586)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2010-12-17
12:55:16 UTC (rev 27587)
@@ -11,32 +11,24 @@
package org.jboss.tools.cdi.ui.marker;
import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.internal.Workbench;
-import org.jboss.tools.cdi.core.CDIConstants;
-import org.jboss.tools.cdi.core.CDIUtil;
-import org.jboss.tools.cdi.core.IBeanMethod;
-import org.jboss.tools.cdi.core.IClassBean;
-import org.jboss.tools.cdi.core.IProducer;
-import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.common.text.ITextSourceReference;
/**
* @author Daniel Azarov
*/
-public class DeleteAllDisposerDuplicantMarkerResolution implements IMarkerResolution2 {
+public class DeleteAllDisposerDuplicantMarkerResolution implements IMarkerResolution2,
TestableResolutionWithRefactoringProcessor {
private String label;
private IMethod method;
private IFile file;
@@ -67,6 +59,10 @@
}
+ public RefactoringProcessor getRefactoringProcessor(){
+ return new DeleteAllDisposerAnnotationsProcessor(file, method);
+ }
+
public String getDescription() {
return null;
}
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithRefactoringProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithRefactoringProcessor.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithRefactoringProcessor.java 2010-12-17
12:55:16 UTC (rev 27587)
@@ -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.ltk.core.refactoring.participants.RefactoringProcessor;
+
+/**
+ * @author Daniel Azarov
+ */
+public interface TestableResolutionWithRefactoringProcessor {
+ public RefactoringProcessor getRefactoringProcessor();
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/TestableResolutionWithRefactoringProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.qfxresult
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.qfxresult
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.qfxresult 2010-12-17
12:55:16 UTC (rev 27587)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+public class TimestampLogger_Broken {
+
+ @Produces
+ public static Spider getSpider() {
+ return new Spider();
+ }
+
+ public static void destorySpider(@Disposes Spider spider) {
+ }
+
+ public static void destorySpiderAgain( Spider spider) {
+ }
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF 2010-12-17 12:44:31
UTC (rev 27586)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/META-INF/MANIFEST.MF 2010-12-17 12:55:16
UTC (rev 27587)
@@ -19,5 +19,6 @@
org.eclipse.jdt.core,
org.eclipse.jdt.ui,
org.eclipse.ui.ide,
- org.jboss.tools.jst.jsp.base.test
+ org.jboss.tools.jst.jsp.base.test,
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.100"
Export-Package: org.jboss.tools.cdi.ui.test
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 2010-12-17
12:44:31 UTC (rev 27586)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-17
12:55:16 UTC (rev 27587)
@@ -21,14 +21,20 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.cdi.core.test.tck.validation.ValidationTest;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
import org.jboss.tools.cdi.ui.marker.AddLocalBeanMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.DeleteAllDisposerDuplicantMarkerResolution;
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.TestableResolutionWithRefactoringProcessor;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.test.util.JobUtils;
@@ -65,9 +71,35 @@
for (int j = 0; j < resolutions.length; j++) {
IMarkerResolution resolution = resolutions[j];
if (resolution.getClass().equals(resolutionClass)) {
+ if(resolution instanceof TestableResolutionWithRefactoringProcessor){
+ RefactoringProcessor processor =
((TestableResolutionWithRefactoringProcessor)resolution).getRefactoringProcessor();
+
+ RefactoringStatus status = processor.checkInitialConditions(new
NullProgressMonitor());
+
+// RefactoringStatusEntry[] entries = status.getEntries();
+// for(RefactoringStatusEntry entry : entries){
+// System.out.println("Refactor status - "+entry.getMessage());
+// }
+
+ assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ status = processor.checkFinalConditions(new NullProgressMonitor(), null);
+
+// entries = status.getEntries();
+// for(RefactoringStatusEntry entry : entries){
+// System.out.println("Refactor status - "+entry.getMessage());
+// }
+
+ assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+
+ CompositeChange rootChange = (CompositeChange)processor.createChange(new
NullProgressMonitor());
+
+ rootChange.perform(new NullProgressMonitor());
+ }else{
+ resolution.run(marker);
+ }
- resolution.run(marker);
-
refresh(project);
IMarker[] newMarkers = file.findMarkers(markerType,
true, IResource.DEPTH_INFINITE);
@@ -76,6 +108,7 @@
checkResults(project, fileNames, results);
+
return;
}
}
@@ -305,4 +338,18 @@
MakeMethodPublicMarkerResolution.class);
}
+ public void testDeleteAllDisposerDuplicantsResolution() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java"
+ },
+// new String[]{
+// "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/TimestampLogger_Broken.qfxresult"
+// },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.MULTIPLE_DISPOSERS_FOR_PRODUCER_ID,
+ DeleteAllDisposerDuplicantMarkerResolution.class);
+ }
+
}