Author: dazarov
Date: 2011-12-02 18:56:43 -0500 (Fri, 02 Dec 2011)
New Revision: 36907
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java
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/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-02
23:48:43 UTC (rev 36906)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2011-12-02
23:56:43 UTC (rev 36907)
@@ -102,7 +102,7 @@
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
TextFileChange fileChange = new CDIFileChange(file.getName(), file);
- if(getEditor(file) != null)
+ if(CDIFileChange.getEditor(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(getEditor(file2) != null)
+ if(CDIFileChange.getEditor(file2) != null)
fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
Added:
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
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java 2011-12-02
23:56:43 UTC (rev 36907)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.internal.core.refactoring;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+
+public class CDIFileChange extends TextFileChange{
+
+ public CDIFileChange(String name, IFile file) {
+ super(name, file);
+ }
+
+ @Override
+ protected void releaseDocument(final IDocument document, IProgressMonitor pm)
+ throws CoreException {
+ super.releaseDocument(document, pm);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IEditorPart editor = getEditor(getFile());
+ if(editor != null){
+ editor.doSave(new NullProgressMonitor());
+ }
+ }
+
+ });
+ }
+
+ public static IEditorPart getEditor(IFile file){
+ IEditorInput ii = EditorUtility.getEditorInput(file);
+
+ IWorkbenchWindow[] windows =
CDICorePlugin.getDefault().getWorkbench().getWorkbenchWindows();
+ for(IWorkbenchWindow window : windows){
+ IEditorPart editor = window.getActivePage().findEditor(ii);
+ if(editor != null)
+ return editor;
+ }
+ return null;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-02
23:48:43 UTC (rev 36906)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2011-12-02
23:56:43 UTC (rev 36907)
@@ -16,10 +16,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-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;
@@ -28,11 +25,7 @@
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.jboss.tools.cdi.core.CDICoreMessages;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -64,7 +57,7 @@
rootChange = new CompositeChange(label);
change = new CDIFileChange(file.getName(), file);
- if(getEditor(file) != null)
+ if(CDIFileChange.getEditor(file) != null)
change.setSaveMode(TextFileChange.LEAVE_DIRTY);
else
change.setSaveMode(TextFileChange.FORCE_SAVE);
@@ -75,17 +68,6 @@
rootChange.markAsSynthetic();
}
- protected IEditorPart getEditor(IFile file){
- IEditorInput ii = EditorUtility.getEditorInput(file);
-
- IWorkbenchWindow[] windows =
CDICorePlugin.getDefault().getWorkbench().getWorkbenchWindows();
- for(IWorkbenchWindow window : windows){
- IEditorPart editor = window.getActivePage().findEditor(ii);
- if(editor != null)
- return editor;
- }
- return null;
- }
private IClassBean findClassBean(){
CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
@@ -168,26 +150,4 @@
SharableParticipants sharedParticipants) throws CoreException {
return EMPTY_REF_PARTICIPANT;
}
-
- protected class CDIFileChange extends TextFileChange{
-
- public CDIFileChange(String name, IFile file) {
- super(name, file);
- }
-
- @Override
- protected void releaseDocument(final IDocument document, IProgressMonitor pm)
- throws CoreException {
- super.releaseDocument(document, pm);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- IEditorPart editor = getEditor(getFile());
- if(editor != null){
- editor.doSave(new NullProgressMonitor());
- }
- }
-
- });
- }
- }
}
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-02
23:48:43 UTC (rev 36906)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-12-02
23:56:43 UTC (rev 36907)
@@ -88,7 +88,7 @@
return lastChange;
}
}
- lastChange = new TextFileChange(file.getName(), file);
+ lastChange = new CDIFileChange(file.getName(), file);
MultiTextEdit root = new MultiTextEdit();
lastChange.setEdit(root);
rootChange.add(lastChange);