Author: dazarov
Date: 2011-11-18 19:48:27 -0500 (Fri, 18 Nov 2011)
New Revision: 36462
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/refactoring/CDIRefactoringProcessor.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/MarkerResolutionUtils.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-19
00:02:46 UTC (rev 36461)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-19
00:48:27 UTC (rev 36462)
@@ -589,9 +589,13 @@
for(ValuedQualifier vq : deployed){
String qualifierName = vq.getQualifier().getSourceType().getFullyQualifiedName();
String value = vq.getValue();
+ String elName = getELName(bean);
- if(!value.isEmpty())
+ if(!value.isEmpty() && (!value.equals(elName) ||
!qualifierName.equals(CDIConstants.NAMED_QUALIFIER_TYPE_NAME))){
value = "(\""+value+"\")";
+ }else{
+ value = "";
+ }
if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) &&
!qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
addAnnotation(qualifierName, compilationUnit, beanElement, value, edit);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-19
00:02:46 UTC (rev 36461)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-19
00:48:27 UTC (rev 36462)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.refactoring;
-import java.lang.reflect.InvocationTargetException;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -20,9 +19,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
@@ -32,11 +28,13 @@
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.cdi.core.CDICoreMessages;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -44,6 +42,7 @@
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.text.ext.IMultiPageEditor;
public abstract class CDIRefactoringProcessor extends RefactoringProcessor {
protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new
RefactoringParticipant[0];
@@ -180,33 +179,17 @@
super(name, file);
}
- protected void releaseDocument(IDocument document, IProgressMonitor pm)
+ @Override
+ protected void releaseDocument(final IDocument document, IProgressMonitor pm)
throws CoreException {
super.releaseDocument(document, pm);
-
- final IEditorPart editor = getEditor(getFile());
- if(editor != null){
- IRunnableContext context = new ProgressMonitorDialog(editor.getSite().getShell());
-
- IRunnableWithProgress resolutionsRunnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- IEditorPart editor = getEditor(getFile());
- if(editor != null){
- editor.doSave(new NullProgressMonitor());
- }
- }
- };
- try {
- PlatformUI.getWorkbench().getProgressService().runInUI(context,
- resolutionsRunnable, null);
- } catch (InvocationTargetException e) {
- CDIUIPlugin.getDefault().logError(e);
- } catch (InterruptedException e) {
- CDIUIPlugin.getDefault().logError(e);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IEditorPart editor = getEditor(getFile());
+ editor.doSave(new NullProgressMonitor());
}
- }
+
+ });
}
-
}
-
}