Author: dazarov
Date: 2012-01-10 12:40:29 -0500 (Tue, 10 Jan 2012)
New Revision: 37746
Added:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/BaseRefactoringWizard.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseFileChange.java
Removed:
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
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/refactoring/RenameNamedBeanWizard.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/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java
Log:
Renamed JBDSFileChange -> BaseFileChange, JBDSRefactoringWizard ->
BaseRefactoringWizard
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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -27,7 +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;
+import org.jboss.tools.common.refactoring.BaseFileChange;
public class AddQualifiersToBeanProcessor extends CDIRefactoringProcessor {
protected IBean selectedBean;
@@ -90,7 +90,7 @@
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
- JBDSFileChange fileChange = new JBDSFileChange(file);
+ BaseFileChange fileChange = new BaseFileChange(file);
MultiTextEdit edit = new MultiTextEdit();
@@ -106,7 +106,7 @@
fileChange.setEdit(edit);
rootChange.add(fileChange);
}
- fileChange = new JBDSFileChange(file2);
+ fileChange = new BaseFileChange(file2);
edit = new MultiTextEdit();
}else{
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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -25,12 +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;
+import org.jboss.tools.common.refactoring.BaseFileChange;
public abstract class CDIRefactoringProcessor extends AbstractCDIProcessor {
protected IFile file;
- protected JBDSFileChange change;
+ protected BaseFileChange change;
protected IClassBean bean;
public CDIRefactoringProcessor(IFile file, String label){
@@ -44,7 +44,7 @@
protected void createRootChange(){
rootChange = new CompositeChange(getLabel());
- change = new JBDSFileChange(file);
+ change = new BaseFileChange(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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -29,14 +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.common.refactoring.BaseFileChange;
import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
/**
* @author Daniel Azarov
*/
public abstract class CDIRenameProcessor extends AbstractCDIProcessor {
- protected JBDSFileChange lastChange;
+ protected BaseFileChange lastChange;
protected IFile declarationFile=null;
private String newName;
@@ -85,18 +85,18 @@
}
// lets collect all changes for the same files in one MultiTextEdit
- protected JBDSFileChange getChange(IFile file){
+ protected BaseFileChange getChange(IFile file){
if(lastChange != null && lastChange.getFile().equals(file))
return lastChange;
for(int i=0; i < rootChange.getChildren().length; i++){
- JBDSFileChange change = (JBDSFileChange)rootChange.getChildren()[i];
+ BaseFileChange change = (BaseFileChange)rootChange.getChildren()[i];
if(change.getFile().equals(file)){
lastChange = change;
return lastChange;
}
}
- lastChange = new JBDSFileChange(file);
+ lastChange = new BaseFileChange(file);
MultiTextEdit root = new MultiTextEdit();
lastChange.setEdit(root);
@@ -116,7 +116,7 @@
protected void change(IFile file, int offset, int length, String text){
String key = file.getFullPath().toString()+" "+offset;
if(!keys.contains(key)){
- JBDSFileChange change = getChange(file);
+ BaseFileChange 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/refactoring/RenameNamedBeanWizard.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -24,7 +24,7 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.internal.core.refactoring.RenameNamedBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.common.ui.refactoring.JBDSRefactoringWizard;
+import org.jboss.tools.common.ui.refactoring.BaseRefactoringWizard;
import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
@@ -32,7 +32,7 @@
/**
* @author Daniel Azarov
*/
-public class RenameNamedBeanWizard extends JBDSRefactoringWizard {
+public class RenameNamedBeanWizard extends BaseRefactoringWizard {
private IBean bean;
private String componentName;
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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -23,9 +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;
+import org.jboss.tools.common.ui.refactoring.BaseRefactoringWizard;
-public abstract class AbstractModifyInjectionPointWizard extends JBDSRefactoringWizard {
+public abstract class AbstractModifyInjectionPointWizard extends BaseRefactoringWizard {
public AbstractModifyInjectionPointWizard(ProcessorBasedRefactoring refactoring){
super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
}
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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/DeletePreviewWizard.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -17,9 +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;
+import org.jboss.tools.common.ui.refactoring.BaseRefactoringWizard;
-public class DeletePreviewWizard extends JBDSRefactoringWizard {
+public class DeletePreviewWizard extends BaseRefactoringWizard {
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 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -47,7 +47,7 @@
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithRefactoringProcessor;
import org.jboss.tools.common.base.test.AbstractRefactorTest.TestChangeStructure;
import org.jboss.tools.common.base.test.validation.TestUtil;
-import org.jboss.tools.common.refactoring.JBDSFileChange;
+import org.jboss.tools.common.refactoring.BaseFileChange;
import org.jboss.tools.common.ui.marker.AddSuppressWarningsMarkerResolution;
import org.jboss.tools.common.ui.marker.ConfigureProblemSeverityMarkerResolution;
import org.jboss.tools.common.util.FileUtil;
Copied:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseFileChange.java
(from rev 37745,
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseFileChange.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/BaseFileChange.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+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.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;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.common.CommonPlugin;
+
+public class BaseFileChange extends MultiStateTextFileChange{
+ private IFile file;
+ private BaseTextChange rootChange = null;
+
+ public BaseFileChange(IFile file) {
+ super(file.getName(), file);
+ this.file = file;
+
+ setSaveMode();
+ }
+
+ private void setSaveMode(){
+ UIJob job = new UIJob("setSaveMode"){ //$NON-NLS-1$
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ try {
+ if(isOpenInEditor(file)){
+ setSaveMode(TextFileChange.LEAVE_DIRTY);
+ }else{
+ setSaveMode(TextFileChange.FORCE_SAVE);
+ }
+ } catch (PartInitException e) {
+ CommonPlugin.getDefault().logError(e);
+ }
+ return Status.OK_STATUS;
+ }};
+
+ job.setSystem(true);
+ job.schedule();
+ }
+
+ private static boolean isOpenInEditor(IFile file) throws PartInitException{
+ IEditorInput input = EditorUtility.getEditorInput(file);
+ for(IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()){
+ for(IWorkbenchPage page : window.getPages()){
+ for(IEditorReference editorReference : page.getEditorReferences()){
+ IEditorPart editor = editorReference.getEditor(true);
+ if(editor != null && editor.getEditorInput().equals(input)){
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public IFile getFile(){
+ return file;
+ }
+
+ public void setEdit(TextEdit edit) {
+ rootChange = new BaseTextChange();
+ rootChange.setEdit(edit);
+ super.addChange(rootChange);
+ }
+
+ public TextEdit getEdit(){
+ return rootChange.getEdit();
+ }
+
+ public void addEdit(TextEdit edit){
+ rootChange.addEdit(edit);
+ }
+
+ class BaseTextChange extends TextChange{
+
+ protected BaseTextChange() {
+ 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/BaseFileChange.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/refactoring/JBDSFileChange.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -1,144 +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.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.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-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.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;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.UIJob;
-import org.jboss.tools.common.CommonPlugin;
-
-public class JBDSFileChange extends MultiStateTextFileChange{
- private IFile file;
- private JBDSTextChange rootChange = null;
-
- public JBDSFileChange(IFile file) {
- super(file.getName(), file);
- this.file = file;
-
- setSaveMode();
- }
-
- private void setSaveMode(){
- UIJob job = new UIJob("setSaveMode"){ //$NON-NLS-1$
- public IStatus runInUIThread(IProgressMonitor monitor) {
- try {
- if(isOpenInEditor(file)){
- setSaveMode(TextFileChange.LEAVE_DIRTY);
- }else{
- setSaveMode(TextFileChange.FORCE_SAVE);
- }
- } catch (PartInitException e) {
- CommonPlugin.getDefault().logError(e);
- }
- return Status.OK_STATUS;
- }};
-
- job.setSystem(true);
- job.schedule();
- }
-
- private static boolean isOpenInEditor(IFile file) throws PartInitException{
- IEditorInput input = EditorUtility.getEditorInput(file);
- for(IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()){
- for(IWorkbenchPage page : window.getPages()){
- for(IEditorReference editorReference : page.getEditorReferences()){
- IEditorPart editor = editorReference.getEditor(true);
- if(editor != null && editor.getEditorInput().equals(input)){
- return true;
- }
- }
- }
- }
- return false;
- }
-
- 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;
- }
-
- }
-}
Copied:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/BaseRefactoringWizard.java
(from rev 37745,
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/BaseRefactoringWizard.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/BaseRefactoringWizard.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -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 BaseRefactoringWizard extends RefactoringWizard {
+
+ public BaseRefactoringWizard(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/BaseRefactoringWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/refactoring/JBDSRefactoringWizard.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -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.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());
- }
- }
- }
- }
- }
-
-}
Modified:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java 2012-01-10
15:43:21 UTC (rev 37745)
+++
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java 2012-01-10
17:40:29 UTC (rev 37746)
@@ -24,7 +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.common.refactoring.BaseFileChange;
import org.jboss.tools.test.util.JobUtils;
public class AbstractRefactorTest extends TestCase{
@@ -149,9 +149,9 @@
MultiTextEdit edit = null;
IFile file = null;
- if(fileChange instanceof JBDSFileChange){
- edit = (MultiTextEdit)((JBDSFileChange)fileChange).getEdit();
- file = ((JBDSFileChange)fileChange).getFile();
+ if(fileChange instanceof BaseFileChange){
+ edit = (MultiTextEdit)((BaseFileChange)fileChange).getEdit();
+ file = ((BaseFileChange)fileChange).getFile();
//((JBDSFileChange)fileChange).setSaveMode(TextFileChange.FORCE_SAVE);
}else if(fileChange instanceof TextFileChange){
edit = (MultiTextEdit)((TextFileChange)fileChange).getEdit();