From 5d9f94704fefc93176ab0fea63b2e28b27822209 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Thu, 11 Sep 2003 21:01:20 +0000 Subject: [PATCH] Reset the selection of variable after casting. --- debug/org.eclipse.cdt.debug.ui/ChangeLog | 5 +++++ .../ui/actions/CastToArrayActionDelegate.java | 12 ++++++++++++ .../ui/actions/CastToTypeActionDelegate.java | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 4e7da646824..2e1ff8dd4ea 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,8 @@ +2003-11-10 Mikhail Khodjaiants + Reset the selection of variable after casting. + * CastToArrayActionDelegate.java + * CastToTypeActionDelegate.java + 2003-11-10 Mikhail Khodjaiants Moving the shared library search paths block to mi UI. * SolibSearchPathBlock.java: moved to mi UI. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java index 520f5a2418a..8495b3855ce 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java @@ -12,11 +12,14 @@ import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.BusyIndicator; @@ -246,6 +249,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject private ICastToArray fCastToArray = null; private IStatus fStatus = null; + private IWorkbenchPart fTargetPart = null; public CastToArrayActionDelegate() { @@ -257,6 +261,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject */ public void setActivePart( IAction action, IWorkbenchPart targetPart ) { + fTargetPart = targetPart; } /* (non-Javadoc) @@ -348,6 +353,13 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject int firstIndex = dialog.getFirstIndex(); int lastIndex = dialog.getLength(); castToArray.castToArray( firstIndex, lastIndex ); + if ( getSelectionProvider() != null ) + getSelectionProvider().setSelection( new StructuredSelection( castToArray ) ); } } + + private ISelectionProvider getSelectionProvider() + { + return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null; + } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java index 0c13af49de4..b20b2951e52 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToTypeActionDelegate.java @@ -11,11 +11,14 @@ import org.eclipse.cdt.debug.internal.ui.CDebugImages; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.ui.IDebugView; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.window.Window; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; @@ -70,6 +73,7 @@ public class CastToTypeActionDelegate extends ActionDelegate private ICastToType fCastToType = null; private IStatus fStatus = null; + private IWorkbenchPart fTargetPart = null; public CastToTypeActionDelegate() { @@ -81,6 +85,7 @@ public class CastToTypeActionDelegate extends ActionDelegate */ public void setActivePart( IAction action, IWorkbenchPart targetPart ) { + fTargetPart = targetPart; } /* (non-Javadoc) @@ -171,6 +176,13 @@ public class CastToTypeActionDelegate extends ActionDelegate { String newType = dialog.getValue().trim(); castToType.cast( newType ); + if ( getSelectionProvider() != null ) + getSelectionProvider().setSelection( new StructuredSelection( castToType ) ); } } + + private ISelectionProvider getSelectionProvider() + { + return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null; + } }