mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 04:05:38 +02:00
Add C refactoring action group to common navigator
This commit is contained in:
parent
013b90d91e
commit
25b75b4163
2 changed files with 31 additions and 19 deletions
|
@ -1481,7 +1481,10 @@
|
||||||
id="org.eclipse.cdt.ui.navigator.actions.refactor"
|
id="org.eclipse.cdt.ui.navigator.actions.refactor"
|
||||||
overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions">
|
overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions">
|
||||||
<enablement>
|
<enablement>
|
||||||
<adapt type="org.eclipse.core.resources.IResource"/>
|
<or>
|
||||||
|
<instanceof value="org.eclipse.cdt.core.model.ICElement" />
|
||||||
|
<adapt type="org.eclipse.core.resources.IResource"/>
|
||||||
|
</or>
|
||||||
</enablement>
|
</enablement>
|
||||||
</actionProvider>
|
</actionProvider>
|
||||||
<commonWizard
|
<commonWizard
|
||||||
|
|
|
@ -22,55 +22,64 @@ import org.eclipse.ui.navigator.ICommonActionExtensionSite;
|
||||||
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
|
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
|
||||||
import org.eclipse.ui.operations.UndoRedoActionGroup;
|
import org.eclipse.ui.operations.UndoRedoActionGroup;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.refactoring.actions.CRefactoringActionGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A clone of org.eclipse.ui.internal.navigator.resources.actions.RefactorActionProvider.
|
* A clone of org.eclipse.ui.internal.navigator.resources.actions.RefactorActionProvider.
|
||||||
*/
|
*/
|
||||||
public class CNavigatorRefactorActionProvider extends CommonActionProvider {
|
public class CNavigatorRefactorActionProvider extends CommonActionProvider {
|
||||||
|
|
||||||
private UndoRedoActionGroup undoRedoGroup;
|
private UndoRedoActionGroup undoRedoGroup;
|
||||||
|
private CNavigatorRefactorActionGroup resourceRefactorGroup;
|
||||||
private CNavigatorRefactorActionGroup refactorGroup;
|
private CRefactoringActionGroup cElementRefactorGroup;
|
||||||
|
|
||||||
private ICommonActionExtensionSite site;
|
private ICommonActionExtensionSite site;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
|
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite)
|
||||||
*/
|
*/
|
||||||
public void init(ICommonActionExtensionSite anActionSite) {
|
public void init(ICommonActionExtensionSite actionSite) {
|
||||||
site = anActionSite;
|
site = actionSite;
|
||||||
refactorGroup = new CNavigatorRefactorActionGroup(site.getViewSite().getShell(), (Tree)site.getStructuredViewer().getControl());
|
resourceRefactorGroup= new CNavigatorRefactorActionGroup(site.getViewSite().getShell(), (Tree)site.getStructuredViewer().getControl());
|
||||||
|
IUndoContext workspaceContext= (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
|
||||||
IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin
|
ICommonViewerWorkbenchSite workbenchSite = null;
|
||||||
.getWorkspace().getAdapter(IUndoContext.class);
|
if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) {
|
||||||
undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(),
|
workbenchSite = (ICommonViewerWorkbenchSite) site.getViewSite();
|
||||||
workspaceContext, true);
|
}
|
||||||
}
|
if (workbenchSite != null) {
|
||||||
|
undoRedoGroup = new UndoRedoActionGroup(workbenchSite.getSite(), workspaceContext, true);
|
||||||
|
cElementRefactorGroup= new CRefactoringActionGroup(workbenchSite.getPart());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
undoRedoGroup.dispose();
|
undoRedoGroup.dispose();
|
||||||
refactorGroup.dispose();
|
resourceRefactorGroup.dispose();
|
||||||
|
cElementRefactorGroup.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillActionBars(IActionBars actionBars) {
|
public void fillActionBars(IActionBars actionBars) {
|
||||||
undoRedoGroup.fillActionBars(actionBars);
|
undoRedoGroup.fillActionBars(actionBars);
|
||||||
refactorGroup.fillActionBars(actionBars);
|
resourceRefactorGroup.fillActionBars(actionBars);
|
||||||
|
cElementRefactorGroup.fillActionBars(actionBars);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
undoRedoGroup.fillContextMenu(menu);
|
undoRedoGroup.fillContextMenu(menu);
|
||||||
refactorGroup.fillContextMenu(menu);
|
resourceRefactorGroup.fillContextMenu(menu);
|
||||||
|
cElementRefactorGroup.fillContextMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContext(ActionContext context) {
|
public void setContext(ActionContext context) {
|
||||||
undoRedoGroup.setContext(context);
|
undoRedoGroup.setContext(context);
|
||||||
refactorGroup.setContext(context);
|
resourceRefactorGroup.setContext(context);
|
||||||
|
cElementRefactorGroup.setContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateActionBars() {
|
public void updateActionBars() {
|
||||||
undoRedoGroup.updateActionBars();
|
undoRedoGroup.updateActionBars();
|
||||||
refactorGroup.updateActionBars();
|
resourceRefactorGroup.updateActionBars();
|
||||||
|
cElementRefactorGroup.updateActionBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue