Author: dazarov
Date: 2011-12-07 13:49:56 -0500 (Wed, 07 Dec 2011)
New Revision: 37076
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java
Log:
EL refactoring for @Named beans doesn't work properly
https://issues.jboss.org/browse/JBIDE-10210
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2011-12-07
18:44:25 UTC (rev 37075)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2011-12-07
18:49:56 UTC (rev 37076)
@@ -102,7 +102,7 @@
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
TextFileChange fileChange = new CDIFileChange(file.getName(), file);
- if(CDIFileChange.getEditor(file) != null)
+ if(CDIFileChange.getAndReloadEditor(file) != null)
fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
@@ -122,7 +122,7 @@
rootChange.add(fileChange);
}
fileChange = new CDIFileChange(file2.getName(), file2);
- if(CDIFileChange.getEditor(file2) != null)
+ if(CDIFileChange.getAndReloadEditor(file2) != null)
fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java 2011-12-07
18:44:25 UTC (rev 37075)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java 2011-12-07
18:49:56 UTC (rev 37076)
@@ -21,6 +21,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
import org.jboss.tools.cdi.core.CDICorePlugin;
public class CDIFileChange extends TextFileChange{
@@ -44,16 +45,28 @@
});
}
+ public static IEditorPart getAndReloadEditor(IFile file){
+ IEditorInput input = EditorUtility.getEditorInput(file);
+
+ if(EditorUtility.isOpenInEditor(input) != null){
+ try {
+ return EditorUtility.openInEditor(input, false);
+ } catch (PartInitException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ return null;
+ }
+
public static IEditorPart getEditor(IFile file){
- IEditorInput ii = EditorUtility.getEditorInput(file);
+ IEditorInput input = EditorUtility.getEditorInput(file);
IWorkbenchWindow[] windows =
CDICorePlugin.getDefault().getWorkbench().getWorkbenchWindows();
for(IWorkbenchWindow window : windows){
- IEditorPart editor = window.getActivePage().findEditor(ii);
+ IEditorPart editor = window.getActivePage().findEditor(input);
if(editor != null)
return editor;
}
return null;
}
-
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2011-12-07
18:44:25 UTC (rev 37075)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2011-12-07
18:49:56 UTC (rev 37076)
@@ -57,7 +57,7 @@
rootChange = new CompositeChange(label);
change = new CDIFileChange(file.getName(), file);
- if(CDIFileChange.getEditor(file) != null)
+ if(CDIFileChange.getAndReloadEditor(file) != null)
change.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
change.setSaveMode(TextFileChange.FORCE_SAVE);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-12-07
18:44:25 UTC (rev 37075)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-12-07
18:49:56 UTC (rev 37076)
@@ -90,7 +90,7 @@
}
lastChange = new CDIFileChange(file.getName(), file);
- if(CDIFileChange.getEditor(file) != null)
+ if(CDIFileChange.getAndReloadEditor(file) != null)
lastChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
lastChange.setSaveMode(TextFileChange.FORCE_SAVE);