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

Bug 82264: Enhance the Shared Libraries view. Added the "Load Symbols" action.

This commit is contained in:
Mikhail Khodjaiants 2005-02-15 04:01:19 +00:00
parent 4a8913dad8
commit 30f8084e4f
5 changed files with 124 additions and 6 deletions

View file

@ -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.

View file

@ -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

View file

@ -732,6 +732,15 @@
<objectContribution
objectClass="org.eclipse.cdt.debug.core.model.ICModule"
id="org.eclipse.cdt.debug.ui.ModuleActions">
<action
helpContextId="load_symbols_action_context"
enablesFor="1"
label="%LoadSymbolsAction.label"
tooltip="%LoadSymbolsAction.tooltip"
icon="icons/full/clcl16/load_symbols_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.LoadModuleSymbolsActionDelegate"
menubarPath="modulesGroup"
id="org.eclipse.cdt.debug.ui.LoadSymbolsAction"/>
<action
helpContextId="module_properties_action_context"
enablesFor="1"
@ -740,11 +749,6 @@
class="org.eclipse.cdt.debug.internal.ui.actions.ModulesPropertiesActionDelegate"
style="pulldown"
id="org.eclipse.cdt.debug.ui.ModulePropertiesAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui.pluginState1"/>
</enablement>
</action>
</objectContribution>
</extension>

View file

@ -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.

View file

@ -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() );
}
}