1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Reset the selection of variable after casting.

This commit is contained in:
Mikhail Khodjaiants 2003-09-11 21:01:20 +00:00
parent ad5028bba4
commit 5d9f94704f
3 changed files with 29 additions and 0 deletions

View file

@ -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 2003-11-10 Mikhail Khodjaiants
Moving the shared library search paths block to mi UI. Moving the shared library search paths block to mi UI.
* SolibSearchPathBlock.java: moved to mi UI. * SolibSearchPathBlock.java: moved to mi UI.

View file

@ -12,11 +12,14 @@ import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.custom.BusyIndicator;
@ -246,6 +249,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
private ICastToArray fCastToArray = null; private ICastToArray fCastToArray = null;
private IStatus fStatus = null; private IStatus fStatus = null;
private IWorkbenchPart fTargetPart = null;
public CastToArrayActionDelegate() public CastToArrayActionDelegate()
{ {
@ -257,6 +261,7 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
*/ */
public void setActivePart( IAction action, IWorkbenchPart targetPart ) public void setActivePart( IAction action, IWorkbenchPart targetPart )
{ {
fTargetPart = targetPart;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -348,6 +353,13 @@ public class CastToArrayActionDelegate extends ActionDelegate implements IObject
int firstIndex = dialog.getFirstIndex(); int firstIndex = dialog.getFirstIndex();
int lastIndex = dialog.getLength(); int lastIndex = dialog.getLength();
castToArray.castToArray( firstIndex, lastIndex ); castToArray.castToArray( firstIndex, lastIndex );
if ( getSelectionProvider() != null )
getSelectionProvider().setSelection( new StructuredSelection( castToArray ) );
} }
} }
private ISelectionProvider getSelectionProvider()
{
return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null;
}
} }

View file

@ -11,11 +11,14 @@ import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window; import org.eclipse.jface.window.Window;
import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -70,6 +73,7 @@ public class CastToTypeActionDelegate extends ActionDelegate
private ICastToType fCastToType = null; private ICastToType fCastToType = null;
private IStatus fStatus = null; private IStatus fStatus = null;
private IWorkbenchPart fTargetPart = null;
public CastToTypeActionDelegate() public CastToTypeActionDelegate()
{ {
@ -81,6 +85,7 @@ public class CastToTypeActionDelegate extends ActionDelegate
*/ */
public void setActivePart( IAction action, IWorkbenchPart targetPart ) public void setActivePart( IAction action, IWorkbenchPart targetPart )
{ {
fTargetPart = targetPart;
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -171,6 +176,13 @@ public class CastToTypeActionDelegate extends ActionDelegate
{ {
String newType = dialog.getValue().trim(); String newType = dialog.getValue().trim();
castToType.cast( newType ); castToType.cast( newType );
if ( getSelectionProvider() != null )
getSelectionProvider().setSelection( new StructuredSelection( castToType ) );
} }
} }
private ISelectionProvider getSelectionProvider()
{
return ( fTargetPart instanceof IDebugView ) ? ((IDebugView)fTargetPart).getViewer() : null;
}
} }