Index:
ChangeLog =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.mi.ui/ChangeLog,v retrieving revision
1.7 diff -u -r1.7 ChangeLog --- ChangeLog 11 Feb 2003 23:58:55
-0000 1.7 +++ ChangeLog 13 Feb 2003 00:15:10 -0000 @@ -1,3 +1,9
@@ +2003-02-12 Mikhail Khodjaiants + Changes in the 'Automatically
Load Symbols' action because of the removal of the + 'setAutoSolib'
method from ICDISharedLibraryManager. + *
SetAutoSolibActionDelegate.java + * plugin.xml + 2003-02-11
Mikhail Khodjaiants The 'Automatically Load Symbols' action is
added to the 'Shared Libraries' view. *
SetAutoSolibActionDelegate.java: new Index:
plugin.xml =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.mi.ui/plugin.xml,v retrieving
revision 1.7 diff -u -r1.7 plugin.xml --- plugin.xml 11 Feb 2003
23:58:55 -0000 1.7 +++ plugin.xml 13 Feb 2003 00:15:10 -0000 @@
-61,11 +61,11
@@
icon="icons/full/elcl16/auto_solib_co.gif"
helpContextId="set_auto_solib_action_context"
label="%SetAutoSolibAction.label" -
menubarPath="sharedLibrariesGroup" +
menubarPath="additions"
tooltip="%SetAutoSolibAction.tooltip">
<enablement>
<pluginState -
value="activated" +
value="installed"
id="org.eclipse.cdt.debug.ui">
</pluginState>
</enablement> Index:
src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java,v retrieving
revision 1.1 diff -u -r1.1 SetAutoSolibActionDelegate.java ---
src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java 11
Feb 2003 23:58:55 -0000 1.1 +++
src/org/eclipse/cdt/debug/mi/internal/ui/actions/SetAutoSolibActionDelegate.java 13
Feb 2003 00:15:10 -0000 @@ -5,15 +5,21 @@ */ package
org.eclipse.cdt.debug.mi.internal.ui.actions; -import
org.eclipse.cdt.debug.core.ICSharedLibraryManager; +import
org.eclipse.cdt.debug.core.cdi.CDIException; +import
org.eclipse.cdt.debug.core.cdi.ICDISession; +import
org.eclipse.cdt.debug.mi.core.MIPlugin; +import
org.eclipse.cdt.debug.mi.core.cdi.Session; +import
org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; import
org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import
org.eclipse.core.runtime.IAdaptable; import
org.eclipse.core.runtime.IStatus; +import
org.eclipse.core.runtime.Status; import
org.eclipse.debug.core.DebugException; import
org.eclipse.debug.core.model.IDebugElement; +import
org.eclipse.debug.ui.DebugUITools; import
org.eclipse.debug.ui.IDebugUIConstants; import
org.eclipse.jface.action.IAction; import
org.eclipse.jface.viewers.ISelection; -import
org.eclipse.jface.viewers.IStructuredSelection; import
org.eclipse.swt.custom.BusyIndicator; import
org.eclipse.swt.widgets.Display; import
org.eclipse.ui.IPartListener; @@ -29,12 +35,11 @@ * @since: Feb 11,
2003 */ public class SetAutoSolibActionDelegate implements
IViewActionDelegate,
-
ISelectionListener,
+
ISelectionListener,
IPartListener { private IViewPart fView =
null; private IAction fAction; - private
IStructuredSelection fSelection; private IStatus fStatus =
null; /** @@ -42,6 +47,7 @@
*/ public
SetAutoSolibActionDelegate() { + super(); } /*
(non-Javadoc) @@ -61,14 +67,6 @@ { if (
part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW )
) { - if ( selection instanceof
IStructuredSelection
) - { - setSelection(
(IStructuredSelection)selection
); - } - else - { - setSelection(
null ); - } update( getAction()
); } } @@ -78,9 +76,6 @@
*/ public void run( IAction action
) { - final IStructuredSelection selection =
getSelection(); - if ( selection != null &&
selection.size() != 1
) - return; BusyIndicator.showWhile(
Display.getCurrent(),
new Runnable()
{ @@ -88,7 +83,7
@@
{
try
{ -
doAction( selection.getFirstElement()
); +
doAction( DebugUITools.getDebugContext()
);
setStatus( null
); }
catch( DebugException e ) @@ -108,7 +103,8
@@ { CDebugUIPlugin.log(
getStatus()
); } - } + } + update(
action ); } /*
(non-Javadoc) @@ -127,8 +123,9 @@ { if (
action != null ) { - action.setEnabled(
getEnableStateForSelection( getSelection() )
); - action.setChecked( getCheckStateForSelection(
getSelection() ) ); + IAdaptable element =
DebugUITools.getDebugContext(); + action.setEnabled(
getEnableStateForSelection( element )
); + action.setChecked( getCheckStateForSelection( element )
); } } @@ -191,53 +188,36
@@ return
fAction; } - private void setSelection(
IStructuredSelection selection ) - { - fSelection =
selection; - } - - private IStructuredSelection
getSelection() - { - return
fSelection; - } - protected void
dispose() { if ( getView() != null )
{ getView().getViewSite().getPage().removeSelectionListener(
IDebugUIConstants.ID_DEBUG_VIEW, this
); getView().getViewSite().getPage().removePartListener(
this
); - } + } } - protected
boolean getCheckStateForSelection( IStructuredSelection selection
) - { - if ( selection == null || selection.size() != 1
) + protected boolean getCheckStateForSelection( IAdaptable element
) + { + SharedLibraryManager slm =
getSharedLibraryManager( element ); + if ( slm != null
) { - return
false; - } - Object element =
selection.getFirstElement(); - if ( element instanceof
IDebugElement ) - { - ICSharedLibraryManager
slm =
(ICSharedLibraryManager)((IDebugElement)element).getDebugTarget().getAdapter(
ICSharedLibraryManager.class ); - if ( slm != null
) + try + { + return
slm.isAutoLoadSymbols(); + } + catch(
CDIException e ) { - return
slm.getAutoLoadSymbols(); } } return
false; } - protected boolean
getEnableStateForSelection( IStructuredSelection selection ) + protected
boolean getEnableStateForSelection( IAdaptable element
) { - if ( selection == null || selection.size() !=
1 ) - { - return
false; - } - Object element =
selection.getFirstElement(); return ( element instanceof
IDebugElement &&
((IDebugElement)element).getDebugTarget().isSuspended()
&& -
((IDebugElement)element).getDebugTarget().getAdapter(
ICSharedLibraryManager.class ) != null ); +
getSharedLibraryManager( element ) != null
); } protected String
getStatusMessage() @@ -263,25 +243,37 @@ return
fStatus; } - protected void doAction( Object
element ) throws DebugException + protected void doAction( IAdaptable
element ) throws DebugException { if (
getView() == null ) return; - if (
element instanceof IDebugElement ) + SharedLibraryManager slm =
getSharedLibraryManager( element ); + if ( slm != null &&
getAction() != null
) { - ICSharedLibraryManager slm =
(ICSharedLibraryManager)((IDebugElement)element).getDebugTarget().getAdapter(
ICSharedLibraryManager.class ); - if ( slm != null
&& getAction() != null
) + try { - try - { - slm.setAutoLoadSymbols(
getAction().isChecked()
); - } - catch(
DebugException e
) - { - getAction().setChecked(
slm.getAutoLoadSymbols() ); - throw
e; - } + slm.setAutoLoadSymbols(
getAction().isChecked()
); } + catch( CDIException e
) + { + getAction().setChecked(
!getAction().isChecked() ); + throw new
DebugException( new Status( IStatus.ERROR,
+
MIPlugin.getUniqueIdentifier(), +
DebugException.TARGET_REQUEST_FAILED,
+
e.toString(),
+
null )
); + } + } + } + + private
SharedLibraryManager getSharedLibraryManager( IAdaptable element
) + { + if ( element != null
) + { + ICDISession session =
(ICDISession)element.getAdapter( ICDISession.class ); + if (
session instanceof Session &&
((Session)session).getSharedLibraryManager() instanceof SharedLibraryManager
) + return
(SharedLibraryManager)((Session)session).getSharedLibraryManager(); } + return
null; } }
|