Author: dazarov
Date: 2011-12-29 14:13:36 -0500 (Thu, 29 Dec 2011)
New Revision: 37577
Added:
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/CDIFileChange.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
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/CDIFileChange.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIFileChange.java 2011-12-29
18:36:20 UTC (rev 37576)
+++
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)
@@ -30,7 +30,7 @@
public CDIFileChange(IFile file) {
super(file.getName(), file);
this.file = file;
- setSaveMode(TextFileChange.FORCE_SAVE);
+ setSaveMode(TextFileChange.LEAVE_DIRTY);
}
public IFile getFile(){
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
18:36:20 UTC (rev 37576)
+++
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)
@@ -24,7 +24,7 @@
import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-public abstract class AbstractModifyInjectionPointWizard extends RefactoringWizard {
+public abstract class AbstractModifyInjectionPointWizard extends CDIRefactoringWizard {
public AbstractModifyInjectionPointWizard(ProcessorBasedRefactoring refactoring){
super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
}
Added:
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
(rev 0)
+++
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)
@@ -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.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());
+ }
+ }
+ }
+ }
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/CDIRefactoringWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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
18:36:20 UTC (rev 37576)
+++
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)
@@ -18,7 +18,7 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-public class DeletePreviewWizard extends RefactoringWizard {
+public class DeletePreviewWizard extends CDIRefactoringWizard {
public DeletePreviewWizard(Refactoring refactoring) {
super(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);