1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Revert "Bug 483602 - Implement deletion of elements from Outline view"

The Delete operation doesn't properly call
TextEditorAction.validateEditorInputState() and as a result doesn't work
in version control environments that keep unchanged files read-only.
Another problem is that Ctrl+Z doesn't trigger Undo when the Outline
view is active. When the Delete element action is reintroduced it should
be made to behave the same way as in JDT, e.g, display a prompt before
deletion and be bound to the Delete key.

This reverts commit f034a69fb7.

Change-Id: I6d37f5aaea1770143fbf84288068794430a5b0e0
This commit is contained in:
Sergey Prigogin 2016-10-31 17:54:31 -04:00
parent cb27913c43
commit 6335a5c2ba
6 changed files with 2 additions and 89 deletions

View file

@ -181,7 +181,6 @@ Refactoring.toggleFunction.label=Toggle Function
Refactoring.hideMethod.label=Hide Method...
Refactoring.implementMethod.label=Impl&ement Method...
Refactoring.gettersAndSetters.label=Gene&rate Getters and Setters...
Refactoring.deleteAction.label=&Delete
Source.menu.label = &Source

View file

@ -96,12 +96,6 @@ public interface ICEditorActionDefinitionIds extends ITextEditorActionDefinition
*/
public static final String RENAME_ELEMENT= "org.eclipse.cdt.ui.edit.text.rename.element"; //$NON-NLS-1$
/**
* Action definition ID of the refactor -> delete element action
* (value <code>"org.eclipse.cdt.ui.edit.text.delete.element"</code>).
*/
public static final String DELETE_ELEMENT = "org.eclipse.cdt.ui.edit.text.delete.element"; //$NON-NLS-1$}
/**
* Action definition ID of the refactor -> extract constant action
* (value <code>"org.eclipse.cdt.ui.refactor.extract.constant"</code>).

View file

@ -1,67 +0,0 @@
/*******************************************************************************
* Copyright (c) 2016 Luis Yanes.
* 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
*
*******************************************************************************/
package org.eclipse.cdt.ui.refactoring.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
/**
* Launches a delete refactoring.
*
* @since 6.2
* @noextend This class is not intended to be subclassed by clients.
* @author Luis Yanes
*/
public class CDeleteAction extends RefactoringAction {
public CDeleteAction() {
super(Messages.CDeleteAction_label);
}
@Override
public void run(IShellProvider shellProvider, IWorkingCopy wc, ITextSelection s) {
throw new UnsupportedOperationException("Invoking this action from the editor is not supported");
}
@Override
public void run(IShellProvider shellProvider, ICElement elem) {
final ICElement[] elements = new ICElement[] { elem };
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
CoreModel.getDefault().getCModel().delete(elements, false, monitor);
} catch (CModelException e) {
throw new InvocationTargetException(e);
}
}
};
try {
IRunnableContext context = new ProgressMonitorDialog(shellProvider.getShell());
context.run(true, true, runnable);
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, Messages.CDeleteAction_error_title, Messages.CDeleteAction_error_message);
} catch (InterruptedException e) {
// Safely ignore
}
}
}

View file

@ -26,7 +26,6 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.part.Page;
import org.eclipse.ui.texteditor.ITextEditor;
@ -114,7 +113,6 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
private String fGroupName= IWorkbenchActionConstants.GROUP_REORGANIZE;
private CRenameAction fRenameAction;
private CDeleteAction fDeleteAction;
private RefactoringAction fExtractConstantAction;
private RefactoringAction fExtractLocalVariableAction;
private RefactoringAction fExtractFunctionAction;
@ -167,12 +165,8 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
fToggleFunctionAction = new ToggleFunctionAction();
fToggleFunctionAction.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_FUNCTION);
fAllActions.add(fToggleFunctionAction);
} else {
fDeleteAction = new CDeleteAction();
fDeleteAction.setActionDefinitionId(ICEditorActionDefinitionIds.DELETE_ELEMENT);
fAllActions.add(fDeleteAction);
}
fHideMethodAction = new HideMethodAction();
fHideMethodAction.setActionDefinitionId(ICEditorActionDefinitionIds.HIDE_METHOD);
fAllActions.add(fHideMethodAction);
@ -242,7 +236,6 @@ public class CRefactoringActionGroup extends ActionGroup implements ISelectionCh
IMenuManager refactorSubmenu = new MenuManager(Messages.CRefactoringActionGroup_menu, MENU_ID);
refactorSubmenu.add(new Separator(GROUP_REORG));
addAction(refactorSubmenu, fRenameAction);
addAction(refactorSubmenu, fDeleteAction);
refactorSubmenu.add(new Separator(GROUP_CODING));
addAction(refactorSubmenu, fExtractConstantAction);
addAction(refactorSubmenu, fExtractLocalVariableAction);

View file

@ -22,10 +22,7 @@ class Messages extends NLS {
public static String ImplementMethodAction_label;
public static String GettersAndSetters_label;
public static String ToggleFunctionAction_label;
public static String CDeleteAction_label;
public static String CDeleteAction_error_title;
public static String CDeleteAction_error_message;
static {
NLS.initializeMessages(Messages.class.getName(), Messages.class);
}

View file

@ -18,6 +18,3 @@ ImplementMethodAction_label=Implement Method...
HideMethodAction_label=Hide Method...
ExtractFunctionAction_label=Extract Function...
ToggleFunctionAction_label=Toggle Function Definition
CDeleteAction_label=&Delete
CDeleteAction_error_title=Delete Element Problem
CDeleteAction_error_message=There was a problem while trying to delete the element.