mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Markus: turn off old refactoring UI if new refactoring plugin loaded. Hook up new refactoring UI.
This commit is contained in:
parent
7c8ce5b42e
commit
bac2cf5297
1 changed files with 96 additions and 84 deletions
|
@ -21,6 +21,7 @@ import org.eclipse.cdt.internal.ui.refactoring.RefactoringMessages;
|
|||
import org.eclipse.cdt.internal.ui.refactoring.actions.RedoRefactoringAction;
|
||||
import org.eclipse.cdt.internal.ui.refactoring.actions.RenameRefactoringAction;
|
||||
import org.eclipse.cdt.internal.ui.refactoring.actions.UndoRefactoringAction;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
@ -138,6 +139,7 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
||||
*/
|
||||
public RefactoringActionGroup(CEditor editor, String groupName) {
|
||||
if (!isRefactoringPluginLoaded()) {
|
||||
fSite= editor.getEditorSite();
|
||||
fEditor= editor;
|
||||
if((groupName != null) && (groupName.length() > 0))
|
||||
|
@ -162,8 +164,10 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
editor.setAction("RedoAction", fRedoAction); //$NON-NLS-1$
|
||||
fEditorActions.add(fRedoAction);
|
||||
}
|
||||
}
|
||||
|
||||
public RefactoringActionGroup(IWorkbenchSite site, String groupName) {
|
||||
if (!isRefactoringPluginLoaded()) {
|
||||
fSite= site;
|
||||
if((groupName != null) && (groupName.length() > 0))
|
||||
fGroupName= groupName;
|
||||
|
@ -178,7 +182,11 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
|
||||
fRedoAction= new RedoRefactoringAction(site);
|
||||
initAction(fRedoAction, provider, selection);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isRefactoringPluginLoaded() {
|
||||
return Platform.getBundle("org.eclipse.cdt.refactoring") != null; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static void initAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection){
|
||||
|
@ -191,23 +199,28 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
*/
|
||||
public void fillActionBars(IActionBars actionBars) {
|
||||
super.fillActionBars(actionBars);
|
||||
if (fSite != null) {
|
||||
actionBars.setGlobalActionHandler(REFACTOR_RENAME, fRenameAction);
|
||||
actionBars.setGlobalActionHandler(REFACTOR_UNDO, fUndoAction);
|
||||
actionBars.setGlobalActionHandler(REFACTOR_REDO, fRedoAction);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Method declared in ActionGroup
|
||||
*/
|
||||
public void fillContextMenu(IMenuManager menu) {
|
||||
super.fillContextMenu(menu);
|
||||
if (fSite != null) {
|
||||
addRefactorSubmenu(menu);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @see ActionGroup#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
if (fSite != null) {
|
||||
ISelectionProvider provider= fSite.getSelectionProvider();
|
||||
|
||||
if (fRenameAction != null) {
|
||||
|
@ -231,7 +244,7 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
fEditorActions.clear();
|
||||
fEditorActions= null;
|
||||
}
|
||||
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -274,5 +287,4 @@ public class RefactoringActionGroup extends ActionGroup {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue