Author: dazarov
Date: 2011-12-29 16:54:07 -0500 (Thu, 29 Dec 2011)
New Revision: 37578
Added:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java
Removed:
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.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.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
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
Log:
Java Seam and CDI quick fixes: after quick fix, editor is scrolled to the beginning. If
Undo/Redo commands are used, the entire file content gets selected
https://issues.jboss.org/browse/JBIDE-10536
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-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -27,6 +27,7 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
public class AddQualifiersToBeanProcessor extends CDIRefactoringProcessor {
protected IBean selectedBean;
@@ -86,7 +87,7 @@
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
- CDIFileChange fileChange = new CDIFileChange(file);
+ JBDSFileChange fileChange = new JBDSFileChange(file);
MultiTextEdit edit = new MultiTextEdit();
@@ -102,7 +103,7 @@
fileChange.setEdit(edit);
rootChange.add(fileChange);
}
- fileChange = new CDIFileChange(file2);
+ fileChange = new JBDSFileChange(file2);
edit = new MultiTextEdit();
}else{
Deleted:
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-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.OperationCanceledException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.MultiStateTextFileChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.text.edits.UndoEdit;
-
-public class CDIFileChange extends MultiStateTextFileChange{
- private IFile file;
- private CDITextChange rootChange = null;
-
- public CDIFileChange(IFile file) {
- super(file.getName(), file);
- this.file = file;
- setSaveMode(TextFileChange.LEAVE_DIRTY);
- }
-
- public IFile getFile(){
- return file;
- }
-
- public void setEdit(TextEdit edit) {
- rootChange = new CDITextChange();
- rootChange.setEdit(edit);
- super.addChange(rootChange);
- }
-
- public TextEdit getEdit(){
- return rootChange.getEdit();
- }
-
- public void addEdit(TextEdit edit){
- rootChange.addEdit(edit);
- }
-
- class CDITextChange extends TextChange{
-
- protected CDITextChange() {
- super("");
- }
-
- @Override
- protected IDocument acquireDocument(IProgressMonitor pm)
- throws CoreException {
- return null;
- }
-
- @Override
- protected void commit(IDocument document, IProgressMonitor pm)
- throws CoreException {
- }
-
- @Override
- protected void releaseDocument(IDocument document, IProgressMonitor pm)
- throws CoreException {
- }
-
- @Override
- protected Change createUndoChange(UndoEdit edit) {
- return null;
- }
-
- @Override
- public void initializeValidationData(IProgressMonitor pm) {
- }
-
- @Override
- public RefactoringStatus isValid(IProgressMonitor pm)
- throws CoreException, OperationCanceledException {
- return null;
- }
-
- @Override
- public Object getModifiedElement() {
- 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-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -25,11 +25,12 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
public abstract class CDIRefactoringProcessor extends AbstractCDIProcessor {
protected IFile file;
- protected CDIFileChange change;
+ protected JBDSFileChange change;
protected IClassBean bean;
public CDIRefactoringProcessor(IFile file, String label){
@@ -43,7 +44,7 @@
protected void createRootChange(){
rootChange = new CompositeChange(getLabel());
- change = new CDIFileChange(file);
+ change = new JBDSFileChange(file);
MultiTextEdit root = new MultiTextEdit();
change.setEdit(root);
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-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -29,13 +29,14 @@
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
/**
* @author Daniel Azarov
*/
public abstract class CDIRenameProcessor extends AbstractCDIProcessor {
- protected CDIFileChange lastChange;
+ protected JBDSFileChange lastChange;
protected IFile declarationFile=null;
private String newName;
@@ -84,18 +85,18 @@
}
// lets collect all changes for the same files in one MultiTextEdit
- protected CDIFileChange getChange(IFile file){
+ protected JBDSFileChange getChange(IFile file){
if(lastChange != null && lastChange.getFile().equals(file))
return lastChange;
for(int i=0; i < rootChange.getChildren().length; i++){
- CDIFileChange change = (CDIFileChange)rootChange.getChildren()[i];
+ JBDSFileChange change = (JBDSFileChange)rootChange.getChildren()[i];
if(change.getFile().equals(file)){
lastChange = change;
return lastChange;
}
}
- lastChange = new CDIFileChange(file);
+ lastChange = new JBDSFileChange(file);
MultiTextEdit root = new MultiTextEdit();
lastChange.setEdit(root);
@@ -115,7 +116,7 @@
protected void change(IFile file, int offset, int length, String text){
String key = file.getFullPath().toString()+" "+offset;
if(!keys.contains(key)){
- CDIFileChange change = getChange(file);
+ JBDSFileChange change = getChange(file);
TextEdit edit = new ReplaceEdit(offset, length, text);
change.addEdit(edit);
keys.add(key);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-12-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -23,8 +23,9 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.ui.refactoring.JBDSRefactoringWizard;
-public abstract class AbstractModifyInjectionPointWizard extends CDIRefactoringWizard {
+public abstract class AbstractModifyInjectionPointWizard extends JBDSRefactoringWizard {
public AbstractModifyInjectionPointWizard(ProcessorBasedRefactoring refactoring){
super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
}
Deleted:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.java 2011-12-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.ui.wizard;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-public class CDIRefactoringWizard extends RefactoringWizard {
-
- public CDIRefactoringWizard(Refactoring refactoring, int flags) {
- super(refactoring, flags);
- }
-
- @Override
- protected void addUserInputPages() {
- }
-
- @Override
- public boolean performFinish() {
- boolean result = super.performFinish();
-
- saveAllEditors();
-
- return result;
- }
-
- private void saveAllEditors(){
- for(IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()){
- for(IWorkbenchPage page : window.getPages()){
- for(IEditorReference eReference : page.getEditorReferences()){
- IEditorPart editor = eReference.getEditor(true);
- if(editor != null && editor.isDirty()){
- editor.doSave(new NullProgressMonitor());
- }
- }
- }
- }
- }
-
-}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java 2011-12-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -17,8 +17,9 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.refactoring.JBDSRefactoringWizard;
-public class DeletePreviewWizard extends CDIRefactoringWizard {
+public class DeletePreviewWizard extends JBDSRefactoringWizard {
public DeletePreviewWizard(Refactoring refactoring) {
super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
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 2011-12-29
19:13:36 UTC (rev 37577)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -19,9 +19,12 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+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.RefactoringProcessor;
+import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.cdi.core.test.tck.TCKTest;
@@ -43,9 +46,11 @@
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithDialog;
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithRefactoringProcessor;
import org.jboss.tools.common.base.test.validation.TestUtil;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
import org.jboss.tools.common.ui.marker.AddSuppressWarningsMarkerResolution;
import org.jboss.tools.common.ui.marker.ConfigureProblemSeverityMarkerResolution;
import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.tests.AbstractRefactorTest.TestChangeStructure;
/**
* @author Daniel Azarov
@@ -125,7 +130,13 @@
assertNull("Rename processor returns fatal error",
status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
CompositeChange rootChange = (CompositeChange)processor.createChange(new
NullProgressMonitor());
-
+
+ for(Change fileChange : rootChange.getChildren()){
+ if(fileChange instanceof JBDSFileChange){
+ ((JBDSFileChange)fileChange).setSaveMode(TextFileChange.FORCE_SAVE);
+ }
+ }
+
rootChange.perform(new NullProgressMonitor());
} else if(resolution instanceof TestableResolutionWithDialog){
((TestableResolutionWithDialog) resolution).runForTest(marker);
Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2011-12-29 19:13:36
UTC (rev 37577)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2011-12-29 21:54:07
UTC (rev 37578)
@@ -39,7 +39,8 @@
org.eclipse.jface.text;bundle-version="3.7.0",
org.apache.commons.httpclient;bundle-version="3.1.0",
org.eclipse.ui.editors;bundle-version="3.7.0",
- org.eclipse.jpt.common.core;bundle-version="1.0.0"
+ org.eclipse.jpt.common.core;bundle-version="1.0.0",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.201"
Bundle-Version: 3.3.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-ManifestVersion: 2
Copied:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java
(from rev 37577,
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.common.refactoring;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.MultiStateTextFileChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextChange;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.UndoEdit;
+
+public class JBDSFileChange extends MultiStateTextFileChange{
+ private IFile file;
+ private JBDSTextChange rootChange = null;
+
+ public JBDSFileChange(IFile file) {
+ super(file.getName(), file);
+ this.file = file;
+ setSaveMode(TextFileChange.LEAVE_DIRTY);
+ }
+
+ public IFile getFile(){
+ return file;
+ }
+
+ public void setEdit(TextEdit edit) {
+ rootChange = new JBDSTextChange();
+ rootChange.setEdit(edit);
+ super.addChange(rootChange);
+ }
+
+ public TextEdit getEdit(){
+ return rootChange.getEdit();
+ }
+
+ public void addEdit(TextEdit edit){
+ rootChange.addEdit(edit);
+ }
+
+ class JBDSTextChange extends TextChange{
+
+ protected JBDSTextChange() {
+ super("");
+ }
+
+ @Override
+ protected IDocument acquireDocument(IProgressMonitor pm)
+ throws CoreException {
+ return null;
+ }
+
+ @Override
+ protected void commit(IDocument document, IProgressMonitor pm)
+ throws CoreException {
+ }
+
+ @Override
+ protected void releaseDocument(IDocument document, IProgressMonitor pm)
+ throws CoreException {
+ }
+
+ @Override
+ protected Change createUndoChange(UndoEdit edit) {
+ return null;
+ }
+
+ @Override
+ public void initializeValidationData(IProgressMonitor pm) {
+ }
+
+ @Override
+ public RefactoringStatus isValid(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ return null;
+ }
+
+ @Override
+ public Object getModifiedElement() {
+ return null;
+ }
+
+ }
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-12-29
19:13:36 UTC (rev 37577)
+++ trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-12-29
21:54:07 UTC (rev 37578)
@@ -28,12 +28,14 @@
org.eclipse.ui.cheatsheets;bundle-version="3.4.0",
org.eclipse.jdt.core.manipulation;bundle-version="1.4.0",
org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
- org.eclipse.jpt.common.core;bundle-version="1.0.0"
+ org.eclipse.jpt.common.core;bundle-version="1.0.0",
+ org.eclipse.ltk.ui.refactoring;bundle-version="3.6.0"
Export-Package: org.jboss.tools.common.ui,
org.jboss.tools.common.ui.databinding,
org.jboss.tools.common.ui.marker,
org.jboss.tools.common.ui.preferences,
org.jboss.tools.common.ui.preferencevalue,
+ org.jboss.tools.common.ui.refactoring,
org.jboss.tools.common.ui.ssh,
org.jboss.tools.common.ui.widget.editor,
org.jboss.tools.common.ui.widget.field,
Copied:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java
(from rev 37577,
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.common.ui.refactoring;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class JBDSRefactoringWizard extends RefactoringWizard {
+
+ public JBDSRefactoringWizard(Refactoring refactoring, int flags) {
+ super(refactoring, flags);
+ }
+
+ @Override
+ protected void addUserInputPages() {
+ }
+
+ @Override
+ public boolean performFinish() {
+ boolean result = super.performFinish();
+
+ saveAllEditors();
+
+ return result;
+ }
+
+ private void saveAllEditors(){
+ for(IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()){
+ for(IWorkbenchPage page : window.getPages()){
+ for(IEditorReference eReference : page.getEditorReferences()){
+ IEditorPart editor = eReference.getEditor(true);
+ if(editor != null && editor.isDirty()){
+ editor.doSave(new NullProgressMonitor());
+ }
+ }
+ }
+ }
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2011-12-29 19:13:36 UTC
(rev 37577)
+++ trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2011-12-29 21:54:07 UTC
(rev 37578)
@@ -12,7 +12,8 @@
org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
org.eclipse.text;bundle-version="3.5.0",
- org.eclipse.ui.ide.application;bundle-version="1.0.200"
+ org.eclipse.ui.ide.application;bundle-version="1.0.200",
+ org.jboss.tools.common;bundle-version="3.3.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.test.resource,
org.jboss.tools.test.util,
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2011-12-29
19:13:36 UTC (rev 37577)
+++
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2011-12-29
21:54:07 UTC (rev 37578)
@@ -24,6 +24,7 @@
import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
import org.eclipse.text.edits.MultiTextEdit;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
import org.jboss.tools.test.util.JobUtils;
public class AbstractRefactorTest extends TestCase{
@@ -144,13 +145,22 @@
int numberOfChanges = rootChange.getChildren().length;
for(int i = 0; i < rootChange.getChildren().length;i++){
- TextFileChange fileChange = (TextFileChange)rootChange.getChildren()[i];
-
- MultiTextEdit edit = (MultiTextEdit)fileChange.getEdit();
+ Change fileChange = rootChange.getChildren()[i];
+ MultiTextEdit edit = null;
+ IFile file = null;
+ if(fileChange instanceof JBDSFileChange){
+ edit = (MultiTextEdit)((JBDSFileChange)fileChange).getEdit();
+ file = ((JBDSFileChange)fileChange).getFile();
+ ((JBDSFileChange)fileChange).setSaveMode(TextFileChange.FORCE_SAVE);
+ }else if(fileChange instanceof TextFileChange){
+ edit = (MultiTextEdit)((TextFileChange)fileChange).getEdit();
+ file = ((TextFileChange)fileChange).getFile();
+ }
+
//System.out.println("File - "+fileChange.getFile().getFullPath()+"
offset - "+edit.getOffset());
- TestChangeStructure change = findChange(changeList, fileChange.getFile());
+ TestChangeStructure change = findChange(changeList, file);
if(change != null){
assertEquals(change.size(), edit.getChildrenSize());
}