Author: dazarov
Date: 2011-11-16 19:49:48 -0500 (Wed, 16 Nov 2011)
New Revision: 36399
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.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-17
00:05:15 UTC (rev 36398)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-17
00:49:48 UTC (rev 36399)
@@ -23,11 +23,16 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.refactoring.CompilationUnitChange;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.UndoEdit;
import org.jboss.tools.cdi.core.CDICoreMessages;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -103,7 +108,11 @@
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
- CompilationUnitChange fileChange = new CompilationUnitChange(file.getName(),
compilationUnit);
+ TextFileChange fileChange = new TextFileChange(file.getName(), file);
+ if(isEditorOpened(file))
+ fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
+ else
+ fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
MultiTextEdit edit = new MultiTextEdit();
@@ -119,7 +128,11 @@
fileChange.setEdit(edit);
rootChange.add(fileChange);
}
- fileChange = new CompilationUnitChange(file2.getName(), compilationUnit2);
+ fileChange = new TextFileChange(file2.getName(), file2);
+ if(isEditorOpened(file2))
+ fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
+ else
+ fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
edit = new MultiTextEdit();
}else{