diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index 1bb55dca631..b2882243d82 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,11 @@ +2005-02-14 Mikhail Khodjaiants + Bug 82264: Enhance the Shared Libraries view. + Added the "Load Symbols" action. + * LoadModuleSymbolsActionDelegate.java: new + * ActionMessages.properties + * plugin.xml + * plugin.properties + 2005-02-14 Mikhail Khodjaiants Bug 82264: Enhance the Shared Libraries view. Implementing module's properties. diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties index 9b0dd6d235f..99212f8e336 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.properties +++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties @@ -125,5 +125,5 @@ ModulesDetailPaneFontDefinition.description=The text font used in the detail pan CollapseAllModulesAction.label=Collapse All CollapseAllModulesAction.tooltip=Collapse All -ModulePropertiesAction.label=Module Properties... +ModulePropertiesAction.label=Properties... ModulePropertiesAction.tooltip=Open Module Properties Dialog diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index c1799c377d8..02961680788 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -732,6 +732,15 @@ + - - - diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties index 659d1fcc8ba..e26dabb161a 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/ActionMessages.properties @@ -17,6 +17,7 @@ LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s) LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All LoadSymbolsForAllActionDelegate.Error_1=Error LoadSymbolsForAllActionDelegate.0=Operation failed. +LoadModuleSymbolsActionDelegate.0=Unable to load symbols. LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols. SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal. SignalZeroWorkbenchActionDelegate.1=Resume without signal failed. diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadModuleSymbolsActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadModuleSymbolsActionDelegate.java new file mode 100644 index 00000000000..b17bdfcffb5 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/LoadModuleSymbolsActionDelegate.java @@ -0,0 +1,105 @@ +/********************************************************************** + * Copyright (c) 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.debug.internal.ui.actions; + +import org.eclipse.cdt.debug.core.CDIDebugModel; +import org.eclipse.cdt.debug.core.CDebugUtils; +import org.eclipse.cdt.debug.core.model.ICModule; +import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.actions.ActionDelegate; + +/** + * The delegate of the "Load Symbols" action contribution to the "ICModule" objects. + */ +public class LoadModuleSymbolsActionDelegate extends ActionDelegate implements IObjectActionDelegate { + + private ICModule fModule; + + /* (non-Javadoc) + * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) + */ + public void setActivePart( IAction action, IWorkbenchPart targetPart ) { + } + + protected ICModule getModule() { + return fModule; + } + + private void setModule( ICModule module ) { + fModule = module; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run( IAction action ) { + final ICModule module = getModule(); + if ( module != null ) { + + DebugPlugin.getDefault().asyncExec( + new Runnable() { + public void run() { + try { + doAction( module ); + } + catch( DebugException e ) { + failed( e ); + } + } + } ); + } + } + + protected void doAction( ICModule module ) throws DebugException { + module.loadSymbols(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged( IAction action, ISelection selection ) { + if ( selection instanceof IStructuredSelection ) { + if ( ((IStructuredSelection)selection).size() == 1 ) { + Object element = ((IStructuredSelection)selection).getFirstElement(); + if ( element instanceof ICModule ) { + boolean enabled = enablesFor( (ICModule)element ); + action.setEnabled( enabled ); + if ( enabled ) { + setModule( (ICModule)element ); + return; + } + } + } + } + action.setEnabled( false ); + setModule( null ); + } + + private boolean enablesFor( ICModule module ) { + return ( module != null && module.canLoadSymbols() ); + } + + protected void failed( Throwable e ) { + MultiStatus ms = new MultiStatus( CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, ActionMessages.getString( "LoadModuleSymbolsActionDelegate.0" ), null ); //$NON-NLS-1$ + ms.add( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), null ) ); + CDebugUtils.error( ms, getModule() ); + } +}