diff --git a/build/org.eclipse.cdt.make.ui/plugin.xml b/build/org.eclipse.cdt.make.ui/plugin.xml index 1873bfa0035..c1f920a0e24 100644 --- a/build/org.eclipse.cdt.make.ui/plugin.xml +++ b/build/org.eclipse.cdt.make.ui/plugin.xml @@ -415,6 +415,8 @@ name="%GCCPerFileProfile.name" profileId="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"/> + + + + + wizardId="org.eclipse.cdt.managedbuilder.ui.wizards.StdCCWizard"> + + + wizardId="org.eclipse.cdt.managedbuilder.ui.wizards.StdCWizard"> + + diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml index 8d89b7328f5..782c7c32b69 100644 --- a/core/org.eclipse.cdt.ui/plugin.xml +++ b/core/org.eclipse.cdt.ui/plugin.xml @@ -1398,14 +1398,9 @@ - - - - + @@ -1460,6 +1455,14 @@ + + + + + - - - - + @@ -1491,14 +1489,9 @@ - - - - + @@ -1512,14 +1505,9 @@ - - - - + @@ -1533,11 +1521,9 @@ - - - + diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionGroup.java new file mode 100644 index 00000000000..9355b5bbe03 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionGroup.java @@ -0,0 +1,193 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * IBM Corporation - initial API and implementation + * Sebastian Davids - Images for menu items (27481) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.navigator; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.actions.DeleteResourceAction; +import org.eclipse.ui.actions.MoveResourceAction; +import org.eclipse.ui.actions.RenameResourceAction; +import org.eclipse.ui.actions.TextActionHandler; +import org.eclipse.ui.navigator.ICommonMenuConstants; +import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; +import org.eclipse.ui.views.navigator.ResourceSelectionUtil; + +import org.eclipse.cdt.internal.ui.actions.SelectionConverter; +import org.eclipse.cdt.internal.ui.cview.CopyAction; +import org.eclipse.cdt.internal.ui.cview.PasteAction; + +/** + * This is the action group for refactor actions, including global action + * handlers for copy, paste and delete. + * + * A clone of org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup. + */ +public class CNavigatorRefactorActionGroup extends ActionGroup { + + private Clipboard clipboard; + + private CopyAction copyAction; + + private DeleteResourceAction deleteAction; + + private PasteAction pasteAction; + + private RenameResourceAction renameAction; + + private MoveResourceAction moveAction; + + private TextActionHandler textActionHandler; + + private Shell shell; + + private Tree tree; + + /** + * + * @param aShell + * @param aTree + */ + public CNavigatorRefactorActionGroup(Shell aShell, Tree aTree) { + shell = aShell; + tree = aTree; + makeActions(); + } + + public void dispose() { + if (clipboard != null) { + clipboard.dispose(); + clipboard = null; + } + super.dispose(); + } + + public void fillContextMenu(IMenuManager menu) { + IStructuredSelection selection = SelectionConverter + .convertSelectionToResources(getContext().getSelection()); + boolean anyResourceSelected = !selection.isEmpty() + && ResourceSelectionUtil.allResourcesAreOfType(selection, + IResource.PROJECT | IResource.FOLDER | IResource.FILE); + + copyAction.selectionChanged(selection); + menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction); + pasteAction.selectionChanged(selection); + menu.insertAfter(copyAction.getId(), pasteAction); + + if (anyResourceSelected) { + deleteAction.selectionChanged(selection); + menu.insertAfter(pasteAction.getId(), deleteAction); + moveAction.selectionChanged(selection); + menu.insertAfter(deleteAction.getId(), moveAction); + renameAction.selectionChanged(selection); + menu.insertAfter(moveAction.getId(), renameAction); + } + } + + public void fillActionBars(IActionBars actionBars) { + + if (textActionHandler == null) { + textActionHandler = new TextActionHandler(actionBars); // hook handlers + } + textActionHandler.setCopyAction(copyAction); + textActionHandler.setPasteAction(pasteAction); + textActionHandler.setDeleteAction(deleteAction); + renameAction.setTextActionHandler(textActionHandler); + updateActionBars(); + +// textActionHandler.updateActionBars(); + + actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), + moveAction); + actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), + renameAction); + } + + /** + * Handles a key pressed event by invoking the appropriate action. + * + * @param event + * The Key Event + */ + public void handleKeyPressed(KeyEvent event) { + if (event.character == SWT.DEL && event.stateMask == 0) { + if (deleteAction.isEnabled()) { + deleteAction.run(); + } + + // Swallow the event. + event.doit = false; + + } else if (event.keyCode == SWT.F2 && event.stateMask == 0) { + if (renameAction.isEnabled()) { + renameAction.run(); + } + + // Swallow the event. + event.doit = false; + } + } + + protected void makeActions() { + clipboard = new Clipboard(shell.getDisplay()); + + pasteAction = new PasteAction(shell, clipboard); + ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); + pasteAction.setDisabledImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); + pasteAction.setImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); + pasteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE); + + copyAction = new CopyAction(shell, clipboard, pasteAction); + copyAction.setDisabledImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); + copyAction.setImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); + copyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); + + moveAction = new MoveResourceAction(shell); + moveAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.MOVE); + + renameAction = new RenameResourceAction(shell, tree); + renameAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.RENAME); + + deleteAction = new DeleteResourceAction(shell); + deleteAction.setDisabledImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); + deleteAction.setImageDescriptor(images + .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); + deleteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE); + } + + public void updateActionBars() { + IStructuredSelection selection = (IStructuredSelection) getContext() + .getSelection(); + + copyAction.selectionChanged(selection); + pasteAction.selectionChanged(selection); + deleteAction.selectionChanged(selection); + moveAction.selectionChanged(selection); + renameAction.selectionChanged(selection); + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionProvider.java new file mode 100644 index 00000000000..be42638b5df --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/navigator/CNavigatorRefactorActionProvider.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are 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: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.cdt.internal.ui.navigator; + +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; +import org.eclipse.ui.operations.UndoRedoActionGroup; + +/** + * A clone of org.eclipse.ui.internal.navigator.resources.actions.RefactorActionProvider. + */ +public class CNavigatorRefactorActionProvider extends CommonActionProvider { + + private UndoRedoActionGroup undoRedoGroup; + + private CNavigatorRefactorActionGroup refactorGroup; + + private ICommonActionExtensionSite site; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite anActionSite) { + site = anActionSite; + refactorGroup = new CNavigatorRefactorActionGroup(site.getViewSite().getShell(), (Tree)site.getStructuredViewer().getControl()); + + IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin + .getWorkspace().getAdapter(IUndoContext.class); + undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(), + workspaceContext, true); + } + + public void dispose() { + undoRedoGroup.dispose(); + refactorGroup.dispose(); + } + + public void fillActionBars(IActionBars actionBars) { + undoRedoGroup.fillActionBars(actionBars); + refactorGroup.fillActionBars(actionBars); + } + + public void fillContextMenu(IMenuManager menu) { + undoRedoGroup.fillContextMenu(menu); + refactorGroup.fillContextMenu(menu); + } + + public void setContext(ActionContext context) { + undoRedoGroup.setContext(context); + refactorGroup.setContext(context); + } + + public void updateActionBars() { + undoRedoGroup.updateActionBars(); + refactorGroup.updateActionBars(); + } + +}