mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Changes in the Shared Libraries and the Signals views.
This commit is contained in:
parent
863c45ab6c
commit
129a37e32a
27 changed files with 1144 additions and 869 deletions
|
@ -1,3 +1,32 @@
|
||||||
|
2004-04-01 Mikhail Khodjaiants
|
||||||
|
Changes in the Shared Libraries and the Signals views.
|
||||||
|
* ActionMessages.properties
|
||||||
|
* ActionMessages.java
|
||||||
|
* LoadSymbolsActionDelegate.java
|
||||||
|
* LoadSymbolsForAllAction.java
|
||||||
|
* ShowFullPathsAction.java
|
||||||
|
* SignalActionDelegate.java
|
||||||
|
* SignalPropertiesActionDelegate.java
|
||||||
|
* SignalPropertiesDialog.java
|
||||||
|
* ViewFilterAction.java
|
||||||
|
* AbstractDebugEventHandler.java
|
||||||
|
* AbstractDebugEventHandlerView.java
|
||||||
|
* IDebugExceptionHandler.java
|
||||||
|
* SharedLibrariesMessages.properties
|
||||||
|
* SharedLibrariesMessages.java
|
||||||
|
* SharedLibrariesView.java
|
||||||
|
* SharedLibrariesViewContentProvider.java
|
||||||
|
* SharedLibrariesViewEventHandler.java
|
||||||
|
* SignalsMessages.properties
|
||||||
|
* SignalsMessages.java
|
||||||
|
* SignalsView.java
|
||||||
|
* SignalsViewContentProvider.java
|
||||||
|
* SignalsViewer.java
|
||||||
|
* SignalsViewEventHandler.java
|
||||||
|
* CDebugUIPluginResources.properties
|
||||||
|
* plugin.properties
|
||||||
|
* plugin.xml
|
||||||
|
|
||||||
2004-04-01 Mikhail Khodjaiants
|
2004-04-01 Mikhail Khodjaiants
|
||||||
Moved the "Show Full Paths" action from toolbars to view's menus.
|
Moved the "Show Full Paths" action from toolbars to view's menus.
|
||||||
* CDebugModelPresentation.java - new (will replace CDTDebugModelPresentation)
|
* CDebugModelPresentation.java - new (will replace CDTDebugModelPresentation)
|
||||||
|
|
|
@ -69,6 +69,8 @@ SignalAction.label=Resume With Signal
|
||||||
SignalAction.tooltip=Resume With Signal
|
SignalAction.tooltip=Resume With Signal
|
||||||
SignalZeroAction.label=Resume Without Signal
|
SignalZeroAction.label=Resume Without Signal
|
||||||
SignalZeroAction.tooltip=Resume Ignoring Signal
|
SignalZeroAction.tooltip=Resume Ignoring Signal
|
||||||
|
SignalPropertiesAction.label=Signal Properties...
|
||||||
|
SignalPropertiesAction.tooltip=Open Signal Properties Dialog
|
||||||
|
|
||||||
CastToTypeAction.label=Cast To Type...
|
CastToTypeAction.label=Cast To Type...
|
||||||
CastToTypeAction.tooltip=Cast Varibale To Type
|
CastToTypeAction.tooltip=Cast Varibale To Type
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
<import plugin="org.eclipse.cdt.debug.core"/>
|
<import plugin="org.eclipse.cdt.debug.core"/>
|
||||||
<import plugin="org.eclipse.cdt.ui"/>
|
<import plugin="org.eclipse.cdt.ui"/>
|
||||||
<import plugin="org.eclipse.cdt.core"/>
|
<import plugin="org.eclipse.cdt.core"/>
|
||||||
<import plugin="org.eclipse.core.runtime.compatibility"/>
|
|
||||||
<import plugin="org.apache.xerces"/>
|
<import plugin="org.apache.xerces"/>
|
||||||
|
<import plugin="org.eclipse.core.runtime.compatibility"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
|
|
||||||
|
@ -746,6 +746,21 @@
|
||||||
</pluginState>
|
</pluginState>
|
||||||
</enablement>
|
</enablement>
|
||||||
</action>
|
</action>
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate"
|
||||||
|
label="%SignalPropertiesAction.label"
|
||||||
|
enablesFor="1"
|
||||||
|
style="pulldown"
|
||||||
|
id="org.eclipse.cdt.debug.ui.SignalPropertiesAction"
|
||||||
|
tooltip="%SignalPropertiesAction.tooltip"
|
||||||
|
helpContextId="signal_properties_action_context">
|
||||||
|
<enablement>
|
||||||
|
<pluginState
|
||||||
|
id="org.eclipse.cdt.debug.ui"
|
||||||
|
value="activated">
|
||||||
|
</pluginState>
|
||||||
|
</enablement>
|
||||||
|
</action>
|
||||||
</objectContribution>
|
</objectContribution>
|
||||||
<objectContribution
|
<objectContribution
|
||||||
objectClass="org.eclipse.cdt.debug.core.model.IResumeWithoutSignal"
|
objectClass="org.eclipse.cdt.debug.core.model.IResumeWithoutSignal"
|
||||||
|
|
|
@ -4,3 +4,9 @@ LoadSymbolsForAllAction.Load_Symbols_For_All_1=Load Symbols For All
|
||||||
LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries.
|
LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1=Load symbols for all shared libraries.
|
||||||
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
|
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
|
||||||
LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
|
LoadSymbolsForAllAction.Unable_to_load_symbols_1=Unable to load symbols.
|
||||||
|
SignalPropertiesDialog.Title_1=Properties for signal ''{0}''
|
||||||
|
SignalPropertiesDialog.Description_label_1=Signal description: {0}.
|
||||||
|
SignalPropertiesDialog.Stop_label_1=Suspend the program when this signal happens.
|
||||||
|
SignalPropertiesDialog.Pass_label_1=Pass this signal to the program.
|
||||||
|
SignalPropertiesActionDelegate.Unable_to_change_signal_properties_1=Unable to change signal properties.
|
||||||
|
SignalPropertiesActionDelegate.Operation_failed_1=Operation failed.
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
@ -23,78 +22,70 @@ import org.eclipse.ui.IWorkbenchWindow;
|
||||||
*
|
*
|
||||||
* @since: Jan 17, 2003
|
* @since: Jan 17, 2003
|
||||||
*/
|
*/
|
||||||
public class LoadSymbolsActionDelegate implements IObjectActionDelegate
|
public class LoadSymbolsActionDelegate implements IObjectActionDelegate {
|
||||||
{
|
|
||||||
private ICSharedLibrary fLibrary = null;
|
private ICSharedLibrary fLibrary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LoadSymbolsActionDelegate.
|
* Constructor for LoadSymbolsActionDelegate.
|
||||||
*/
|
*/
|
||||||
public LoadSymbolsActionDelegate()
|
public LoadSymbolsActionDelegate() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
|
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
|
||||||
*/
|
*/
|
||||||
public void setActivePart( IAction action, IWorkbenchPart targetPart )
|
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(IAction)
|
* @see org.eclipse.ui.IActionDelegate#run(IAction)
|
||||||
*/
|
*/
|
||||||
public void run( IAction action )
|
public void run( IAction action ) {
|
||||||
{
|
if ( getSharedLibrary() != null ) {
|
||||||
if ( getSharedLibrary() != null )
|
|
||||||
{
|
|
||||||
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
||||||
DebugException.REQUEST_FAILED, CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library"), null ); //$NON-NLS-1$
|
DebugException.REQUEST_FAILED,
|
||||||
|
ActionMessages.getString( "LoadSymbolsActionDelegate.Unable_to_load_symbols_of_shared_library_1" ), //$NON-NLS-1$
|
||||||
|
null );
|
||||||
BusyIndicator.showWhile( Display.getCurrent(),
|
BusyIndicator.showWhile( Display.getCurrent(),
|
||||||
new Runnable()
|
new Runnable() {
|
||||||
{
|
public void run() {
|
||||||
public void run()
|
try {
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
doAction( getSharedLibrary() );
|
doAction( getSharedLibrary() );
|
||||||
}
|
}
|
||||||
catch( DebugException e )
|
catch( DebugException e ) {
|
||||||
{
|
|
||||||
ms.merge( e.getStatus() );
|
ms.merge( e.getStatus() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
if ( !ms.isOK() )
|
if ( !ms.isOK() ) {
|
||||||
{
|
|
||||||
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
||||||
if ( window != null )
|
if ( window != null ) {
|
||||||
{
|
CDebugUIPlugin.errorDialog( ActionMessages.getString( "LoadSymbolsActionDelegate.Operation_failed_1" ), ms ); //$NON-NLS-1$
|
||||||
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsActionDelegate.Operation_failed"), ms ); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
CDebugUIPlugin.log( ms );
|
CDebugUIPlugin.log( ms );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
|
* @see org.eclipse.ui.IActionDelegate#selectionChanged(IAction, ISelection)
|
||||||
*/
|
*/
|
||||||
public void selectionChanged( IAction action, ISelection selection )
|
public void selectionChanged( IAction action, ISelection selection ) {
|
||||||
{
|
if ( selection instanceof IStructuredSelection ) {
|
||||||
if ( selection instanceof IStructuredSelection )
|
|
||||||
{
|
|
||||||
Object element = ((IStructuredSelection)selection).getFirstElement();
|
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||||
if ( element instanceof ICSharedLibrary )
|
if ( element instanceof ICSharedLibrary ) {
|
||||||
{
|
|
||||||
boolean enabled = enablesFor( (ICSharedLibrary)element );
|
boolean enabled = enablesFor( (ICSharedLibrary)element );
|
||||||
action.setEnabled( enabled );
|
action.setEnabled( enabled );
|
||||||
if ( enabled )
|
if ( enabled ) {
|
||||||
{
|
|
||||||
setSharedLibrary( (ICSharedLibrary)element );
|
setSharedLibrary( (ICSharedLibrary)element );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,23 +95,19 @@ public class LoadSymbolsActionDelegate implements IObjectActionDelegate
|
||||||
setSharedLibrary( null );
|
setSharedLibrary( null );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doAction( ICSharedLibrary library ) throws DebugException
|
protected void doAction( ICSharedLibrary library ) throws DebugException {
|
||||||
{
|
|
||||||
library.loadSymbols();
|
library.loadSymbols();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean enablesFor( ICSharedLibrary library )
|
private boolean enablesFor(ICSharedLibrary library) {
|
||||||
{
|
|
||||||
return ( library != null && !library.areSymbolsLoaded() );
|
return ( library != null && !library.areSymbolsLoaded() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSharedLibrary( ICSharedLibrary library )
|
private void setSharedLibrary( ICSharedLibrary library ) {
|
||||||
{
|
|
||||||
fLibrary = library;
|
fLibrary = library;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICSharedLibrary getSharedLibrary()
|
protected ICSharedLibrary getSharedLibrary() {
|
||||||
{
|
|
||||||
return fLibrary;
|
return fLibrary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
/*
|
/*
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* (c) Copyright QNX Software Systems Ltd. 2002. All Rights Reserved.
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
|
@ -22,33 +19,31 @@ import org.eclipse.ui.texteditor.IUpdate;
|
||||||
*
|
*
|
||||||
* @since: Feb 11, 2003
|
* @since: Feb 11, 2003
|
||||||
*/
|
*/
|
||||||
public class LoadSymbolsForAllAction extends Action implements IUpdate
|
public class LoadSymbolsForAllAction extends Action implements IUpdate {
|
||||||
{
|
|
||||||
private Viewer fViewer = null;
|
private Viewer fViewer = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LoadSymbolsForAllAction.
|
* Constructor for LoadSymbolsForAllAction.
|
||||||
*/
|
*/
|
||||||
public LoadSymbolsForAllAction( Viewer viewer )
|
public LoadSymbolsForAllAction( Viewer viewer ) {
|
||||||
{
|
super( ActionMessages.getString( "LoadSymbolsForAllAction.Load_Symbols_For_All_1" ) ); //$NON-NLS-1$
|
||||||
super( CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsForAllAction.Load_Symbols_For_all") ); //$NON-NLS-1$
|
|
||||||
fViewer = viewer;
|
fViewer = viewer;
|
||||||
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_LOAD_ALL_SYMBOLS );
|
// CDebugImages.setLocalImageDescriptors( this, ICDebugUIConstants.IMG_LCL_LOAD_ALL_SYMBOLS );
|
||||||
setDescription( CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries.") ); //$NON-NLS-1$
|
setDescription( ActionMessages.getString( "LoadSymbolsForAllAction.Load_symbols_for_all_shared_libraries_1" ) ); //$NON-NLS-1$
|
||||||
setToolTipText( CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsForAllAction.Load_Symbols_For_All") ); //$NON-NLS-1$
|
setToolTipText( ActionMessages.getString( "LoadSymbolsForAllAction.Load_Symbols_For_All_2" ) ); //$NON-NLS-1$
|
||||||
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.LOAD_SYMBOLS_FOR_ALL );
|
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.LOAD_SYMBOLS_FOR_ALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||||
*/
|
*/
|
||||||
public void update()
|
public void update() {
|
||||||
{
|
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable ) {
|
||||||
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
|
ICDebugTarget target = (ICDebugTarget)((IAdaptable)fViewer.getInput()).getAdapter(ICDebugTarget.class);
|
||||||
{
|
if ( target != null ) {
|
||||||
ICDebugTarget target = (ICDebugTarget)((IAdaptable)fViewer.getInput()).getAdapter( ICDebugTarget.class );
|
|
||||||
if ( target != null )
|
|
||||||
{
|
|
||||||
setEnabled( target.isSuspended() );
|
setEnabled( target.isSuspended() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -56,23 +51,20 @@ public class LoadSymbolsForAllAction extends Action implements IUpdate
|
||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
* @see org.eclipse.jface.action.IAction#run()
|
||||||
*/
|
*/
|
||||||
public void run()
|
public void run() {
|
||||||
{
|
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable ) {
|
||||||
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
|
ICDebugTarget target = (ICDebugTarget)((IAdaptable)fViewer.getInput()).getAdapter(ICDebugTarget.class);
|
||||||
{
|
if ( target != null ) {
|
||||||
ICSharedLibraryManager slm = (ICSharedLibraryManager)((IAdaptable)fViewer.getInput()).getAdapter( ICSharedLibraryManager.class );
|
try {
|
||||||
if ( slm != null )
|
target.loadSymbols();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
slm.loadSymbolsForAll();
|
|
||||||
}
|
}
|
||||||
catch( DebugException e )
|
catch( DebugException e ) {
|
||||||
{
|
CDebugUIPlugin.errorDialog( ActionMessages.getString( "LoadSymbolsForAllAction.Unable_to_load_symbols_1" ), e.getStatus() ); //$NON-NLS-1$
|
||||||
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.LoadSymbolsForAllAction.Unable_to_load_symbols."), e.getStatus() ); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,6 @@ import org.eclipse.swt.custom.BusyIndicator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An action delegate that toggles the state of its viewer to show/hide full paths.
|
* An action delegate that toggles the state of its viewer to show/hide full paths.
|
||||||
*
|
|
||||||
* @since: Feb 23, 2004
|
|
||||||
*/
|
*/
|
||||||
public class ShowFullPathsAction extends ViewFilterAction {
|
public class ShowFullPathsAction extends ViewFilterAction {
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SignalActionDelegate implements IObjectActionDelegate
|
||||||
{
|
{
|
||||||
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
||||||
DebugException.REQUEST_FAILED,
|
DebugException.REQUEST_FAILED,
|
||||||
MessageFormat.format( CDebugUIPlugin.getResourceString("internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target"), new String[] { getSignal().getName() } ), //$NON-NLS-1$
|
CDebugUIPlugin.getResourceString( "internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target" ), //$NON-NLS-1$
|
||||||
null );
|
null );
|
||||||
BusyIndicator.showWhile( Display.getCurrent(),
|
BusyIndicator.showWhile( Display.getCurrent(),
|
||||||
new Runnable()
|
new Runnable()
|
||||||
|
|
|
@ -0,0 +1,142 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.model.ICSignal;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.window.Window;
|
||||||
|
import org.eclipse.swt.custom.BusyIndicator;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.ui.IObjectActionDelegate;
|
||||||
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
import org.eclipse.ui.actions.ActionDelegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal Properties action delegate.
|
||||||
|
*/
|
||||||
|
public class SignalPropertiesActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
||||||
|
|
||||||
|
private ICSignal fSignal;
|
||||||
|
private SignalPropertiesDialog fDialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for SignalPropertiesActionDelegate.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public SignalPropertiesActionDelegate() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
|
||||||
|
*/
|
||||||
|
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (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 ) {
|
||||||
|
Object element = ((IStructuredSelection)selection).getFirstElement();
|
||||||
|
if ( element instanceof ICSignal ) {
|
||||||
|
action.setEnabled( true );
|
||||||
|
setSignal( (ICSignal)element );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
action.setEnabled( false );
|
||||||
|
setSignal( null );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ICSignal getSignal() {
|
||||||
|
return this.fSignal;
|
||||||
|
}
|
||||||
|
private void setSignal( ICSignal signal ) {
|
||||||
|
this.fSignal = signal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||||
|
*/
|
||||||
|
public void run( IAction action ) {
|
||||||
|
if ( getSignal() != null ) {
|
||||||
|
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.REQUEST_FAILED,
|
||||||
|
ActionMessages.getString( "SignalPropertiesActionDelegate.Unable_to_change_signal_properties_1" ), //$NON-NLS-1$
|
||||||
|
null );
|
||||||
|
BusyIndicator.showWhile( Display.getCurrent(),
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
doAction( getSignal() );
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
ms.merge( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
if ( !ms.isOK() ) {
|
||||||
|
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
||||||
|
if ( window != null ) {
|
||||||
|
CDebugUIPlugin.errorDialog( ActionMessages.getString( "SignalPropertiesActionDelegate.Operation_failed_1" ), ms ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CDebugUIPlugin.log( ms );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doAction( ICSignal signal ) throws DebugException {
|
||||||
|
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
||||||
|
if ( window == null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Shell activeShell = window.getShell();
|
||||||
|
|
||||||
|
// If a previous edit is still in progress, don't start another
|
||||||
|
if ( fDialog != null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String name = signal.getName();
|
||||||
|
String description = signal.getDescription();
|
||||||
|
boolean pass = signal.isPassEnabled();
|
||||||
|
boolean stop = signal.isStopEnabled();
|
||||||
|
boolean canModify = signal.canModify();
|
||||||
|
fDialog = new SignalPropertiesDialog( activeShell, name, description, pass, stop, canModify );
|
||||||
|
try {
|
||||||
|
if ( fDialog.open() == Window.OK ) {
|
||||||
|
setProperties( signal, fDialog.isPassEnabled(), fDialog.isStopEnabled() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
fDialog = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setProperties( ICSignal signal, boolean pass, boolean stop ) throws DebugException {
|
||||||
|
signal.setPassEnabled( pass );
|
||||||
|
signal.setStopEnabled( stop );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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 java.text.MessageFormat;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
||||||
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Font;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal Properties dialog.
|
||||||
|
*/
|
||||||
|
public class SignalPropertiesDialog extends Dialog {
|
||||||
|
|
||||||
|
private String fName;
|
||||||
|
private String fDescription;
|
||||||
|
private boolean fPass = false;
|
||||||
|
private boolean fStop = false;
|
||||||
|
private boolean fCanModify = false;
|
||||||
|
|
||||||
|
private SelectionButtonDialogField fPassButton;
|
||||||
|
private SelectionButtonDialogField fStopButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for SignalPropertiesDialog.
|
||||||
|
* @param parentShell
|
||||||
|
*/
|
||||||
|
public SignalPropertiesDialog( Shell parentShell,
|
||||||
|
String name,
|
||||||
|
String description,
|
||||||
|
boolean pass,
|
||||||
|
boolean stop,
|
||||||
|
boolean canModify ) {
|
||||||
|
super( parentShell );
|
||||||
|
fName = name;
|
||||||
|
fDescription = description;
|
||||||
|
fStop = stop;
|
||||||
|
fPass = pass;
|
||||||
|
fCanModify = canModify;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
|
||||||
|
*/
|
||||||
|
protected void configureShell( Shell shell ) {
|
||||||
|
super.configureShell( shell );
|
||||||
|
shell.setText( MessageFormat.format( ActionMessages.getString( "SignalPropertiesDialog.Title_1" ), new String[] { getName() } ) ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getDescription() {
|
||||||
|
return this.fDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getName() {
|
||||||
|
return this.fName;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isPassEnabled() {
|
||||||
|
return this.fPass;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void enablePass( boolean enable ) {
|
||||||
|
this.fPass = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isStopEnabled() {
|
||||||
|
return this.fStop;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void enableStop( boolean enable ) {
|
||||||
|
this.fStop = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected Control createDialogArea( Composite parent ) {
|
||||||
|
Font font = parent.getFont();
|
||||||
|
Composite composite = (Composite)super.createDialogArea( parent );
|
||||||
|
|
||||||
|
// Create description field
|
||||||
|
Label label = new Label( composite, SWT.WRAP );
|
||||||
|
label.setText( MessageFormat.format( ActionMessages.getString( "SignalPropertiesDialog.Description_label_1" ), new String[] { getDescription() } ) ); //$NON-NLS-1$
|
||||||
|
GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER );
|
||||||
|
data.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH );
|
||||||
|
label.setLayoutData( data );
|
||||||
|
label.setFont( font );
|
||||||
|
|
||||||
|
// Create pass button
|
||||||
|
fPassButton = new SelectionButtonDialogField( SWT.CHECK );
|
||||||
|
fPassButton.setLabelText( ActionMessages.getString( "SignalPropertiesDialog.Pass_label_1" ) ); //$NON-NLS-1$
|
||||||
|
fPassButton.setSelection( fPass );
|
||||||
|
fPassButton.setEnabled( fCanModify );
|
||||||
|
fPassButton.doFillIntoGrid( composite, 1 );
|
||||||
|
|
||||||
|
// Create stop button
|
||||||
|
fStopButton = new SelectionButtonDialogField( SWT.CHECK );
|
||||||
|
fStopButton.setLabelText( ActionMessages.getString( "SignalPropertiesDialog.Stop_label_1" ) ); //$NON-NLS-1$
|
||||||
|
fStopButton.setSelection( fStop );
|
||||||
|
fStopButton.setEnabled( fCanModify );
|
||||||
|
fStopButton.doFillIntoGrid( composite, 1 );
|
||||||
|
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
||||||
|
*/
|
||||||
|
protected void okPressed() {
|
||||||
|
if ( fPassButton != null )
|
||||||
|
fPass = fPassButton.isSelected();
|
||||||
|
if ( fStopButton != null )
|
||||||
|
fStop = fStopButton.isSelected();
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,7 +25,7 @@ import org.eclipse.ui.IViewActionDelegate;
|
||||||
import org.eclipse.ui.IViewPart;
|
import org.eclipse.ui.IViewPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A base class for the view filtering actions.
|
||||||
*/
|
*/
|
||||||
public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 {
|
public abstract class ViewFilterAction extends ViewerFilter implements IViewActionDelegate, IActionDelegate2 {
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||||
* All Rights Reserved.
|
* 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:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.views;
|
package org.eclipse.cdt.debug.internal.ui.views;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.debug.core.DebugEvent;
|
import org.eclipse.debug.core.DebugEvent;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IDebugEventSetListener;
|
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||||
|
@ -13,19 +18,19 @@ import org.eclipse.debug.ui.AbstractDebugView;
|
||||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.StructuredViewer;
|
||||||
import org.eclipse.jface.viewers.TableTreeViewer;
|
import org.eclipse.jface.viewers.TableTreeViewer;
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Handles debug events, updating a view and viewer.
|
* Handles debug events, updating a view and viewer.
|
||||||
*
|
|
||||||
* @since Jul 23, 2002
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDebugEventHandler implements IDebugEventSetListener
|
public abstract class AbstractDebugEventHandler implements IDebugEventSetListener {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* This event handler's view
|
* This event handler's view
|
||||||
*/
|
*/
|
||||||
|
@ -36,127 +41,133 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
*
|
*
|
||||||
* @param view debug view
|
* @param view debug view
|
||||||
*/
|
*/
|
||||||
public AbstractDebugEventHandler( AbstractDebugView view )
|
public AbstractDebugEventHandler(AbstractDebugView view) {
|
||||||
{
|
setView(view);
|
||||||
setView( view );
|
DebugPlugin plugin= DebugPlugin.getDefault();
|
||||||
DebugPlugin plugin = DebugPlugin.getDefault();
|
plugin.addDebugEventListener(this);
|
||||||
plugin.addDebugEventListener( this );
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the active workbench page or <code>null</code> if none.
|
||||||
|
*/
|
||||||
|
protected IWorkbenchPage getActivePage() {
|
||||||
|
IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||||
|
if (window == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return window.getActivePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IDebugEventSetListener#handleDebugEvents(DebugEvent[])
|
* @see IDebugEventSetListener#handleDebugEvents(DebugEvent[])
|
||||||
*/
|
*/
|
||||||
public void handleDebugEvents( final DebugEvent[] events )
|
public void handleDebugEvents(final DebugEvent[] events) {
|
||||||
{
|
if (!isAvailable()) {
|
||||||
if ( !isAvailable() )
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Runnable r = new Runnable()
|
Runnable r= new Runnable() {
|
||||||
{
|
public void run() {
|
||||||
public void run()
|
if (isAvailable()) {
|
||||||
{
|
if (isViewVisible()) {
|
||||||
if ( isAvailable() )
|
doHandleDebugEvents(events);
|
||||||
{
|
}
|
||||||
doHandleDebugEvents( events );
|
updateForDebugEvents(events);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
getView().asyncExec(r);
|
||||||
|
}
|
||||||
|
|
||||||
getView().asyncExec( r );
|
/**
|
||||||
|
* Updates this view for the given debug events. Unlike
|
||||||
|
* doHandleDebugEvents(DebugEvent[]) which is only called if the view is
|
||||||
|
* visible, this method is always called. This allows the view to perform
|
||||||
|
* updating that must always be performed, even when the view is not
|
||||||
|
* visible.
|
||||||
|
*/
|
||||||
|
protected void updateForDebugEvents(DebugEvent[] events) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation specific handling of debug events.
|
* Implementation specific handling of debug events.
|
||||||
* Subclasses should override.
|
* Subclasses should override.
|
||||||
*/
|
*/
|
||||||
protected abstract void doHandleDebugEvents( DebugEvent[] events );
|
protected abstract void doHandleDebugEvents(DebugEvent[] events);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for inserting the given element - must be called in UI thread
|
* Helper method for inserting the given element in the tree viewer -
|
||||||
|
* must be called in UI thread
|
||||||
*/
|
*/
|
||||||
protected void insert( Object element )
|
protected void insert(Object element) {
|
||||||
{
|
TreeViewer viewer = getTreeViewer();
|
||||||
if ( isAvailable() )
|
if (isAvailable() && viewer != null) {
|
||||||
{
|
Object parent= ((ITreeContentProvider)viewer.getContentProvider()).getParent(element);
|
||||||
final Object parent = ((ITreeContentProvider)getTreeViewer().getContentProvider()).getParent( element );
|
|
||||||
// a parent can be null for a debug target or process that has not yet been associated
|
// a parent can be null for a debug target or process that has not yet been associated
|
||||||
// with a launch
|
// with a launch
|
||||||
if ( parent != null )
|
if (parent != null) {
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTreeViewer().add( parent, element );
|
viewer.add(parent, element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to remove the given element - must be called in UI thread.
|
* Helper method to remove the given element from the tree viewer -
|
||||||
|
* must be called in UI thread.
|
||||||
*/
|
*/
|
||||||
protected void remove( Object element )
|
protected void remove(Object element) {
|
||||||
{
|
TreeViewer viewer = getTreeViewer();
|
||||||
if ( isAvailable() )
|
if (isAvailable() && viewer != null) {
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTreeViewer().remove( element );
|
viewer.remove(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to update the label of the given element - must be called in UI thread
|
* Helper method to update the label of the given element - must be called in UI thread
|
||||||
*/
|
*/
|
||||||
protected void labelChanged( Object element )
|
protected void labelChanged(Object element) {
|
||||||
{
|
if (isAvailable()) {
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTreeViewer().update( element,
|
getStructuredViewer().update(element, new String[] {IBasicPropertyConstants.P_TEXT});
|
||||||
new String[] { IBasicPropertyConstants.P_TEXT } );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the given element in the viewer - must be called in UI thread.
|
* Refresh the given element in the viewer - must be called in UI thread.
|
||||||
*/
|
*/
|
||||||
protected void refresh( Object element )
|
protected void refresh(Object element) {
|
||||||
{
|
if (isAvailable()) {
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTreeViewer().refresh( element );
|
getStructuredViewer().refresh(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the viewer - must be called in UI thread.
|
* Refresh the viewer - must be called in UI thread.
|
||||||
*/
|
*/
|
||||||
public void refresh()
|
public void refresh() {
|
||||||
{
|
if (isAvailable()) {
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTreeViewer().refresh();
|
getStructuredViewer().refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to select and reveal the given element - must be called in UI thread
|
* Helper method to select and reveal the given element - must be called in UI thread
|
||||||
*/
|
*/
|
||||||
protected void selectAndReveal( Object element )
|
protected void selectAndReveal(Object element) {
|
||||||
{
|
if (isAvailable()) {
|
||||||
if ( isAvailable() )
|
getViewer().setSelection(new StructuredSelection(element), true);
|
||||||
{
|
|
||||||
getViewer().setSelection( new StructuredSelection( element ), true );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* De-registers this event handler from the debug model.
|
* De-registers this event handler from the debug model.
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose() {
|
||||||
{
|
DebugPlugin plugin= DebugPlugin.getDefault();
|
||||||
DebugPlugin plugin = DebugPlugin.getDefault();
|
plugin.removeDebugEventListener(this);
|
||||||
plugin.removeDebugEventListener( this );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,9 +176,8 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
*
|
*
|
||||||
* @return debug view
|
* @return debug view
|
||||||
*/
|
*/
|
||||||
protected AbstractDebugView getView()
|
protected AbstractDebugView getView() {
|
||||||
{
|
return this.fView;
|
||||||
return fView;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,18 +185,17 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
*
|
*
|
||||||
* @param view debug view
|
* @param view debug view
|
||||||
*/
|
*/
|
||||||
private void setView( AbstractDebugView view )
|
private void setView(AbstractDebugView view) {
|
||||||
{
|
this.fView = view;
|
||||||
fView = view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the viewer this event handler is updating.
|
* Returns the viewer this event handler is
|
||||||
|
* updating.
|
||||||
*
|
*
|
||||||
* @return viewer
|
* @return viewer
|
||||||
*/
|
*/
|
||||||
protected Viewer getViewer()
|
protected Viewer getViewer() {
|
||||||
{
|
|
||||||
return getView().getViewer();
|
return getView().getViewer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,31 +206,13 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
* @return this event handler's viewer as a tree
|
* @return this event handler's viewer as a tree
|
||||||
* viewer or <code>null</code> if none
|
* viewer or <code>null</code> if none
|
||||||
*/
|
*/
|
||||||
protected TreeViewer getTreeViewer()
|
protected TreeViewer getTreeViewer() {
|
||||||
{
|
if (getViewer() instanceof TreeViewer) {
|
||||||
if ( getViewer() instanceof TreeViewer )
|
|
||||||
{
|
|
||||||
return (TreeViewer)getViewer();
|
return (TreeViewer)getViewer();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns this event handler's viewer as a table
|
|
||||||
* viewer or <code>null</code> if none.
|
|
||||||
*
|
|
||||||
* @return this event handler's viewer as a table
|
|
||||||
* viewer or <code>null</code> if none
|
|
||||||
*/
|
|
||||||
protected TableViewer getTableViewer()
|
|
||||||
{
|
|
||||||
if ( getViewer() instanceof TableViewer )
|
|
||||||
{
|
|
||||||
return (TableViewer)getViewer();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns this event handler's viewer as a table tree
|
* Returns this event handler's viewer as a table tree
|
||||||
* viewer or <code>null</code> if none.
|
* viewer or <code>null</code> if none.
|
||||||
|
@ -229,15 +220,27 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
* @return this event handler's viewer as a table tree
|
* @return this event handler's viewer as a table tree
|
||||||
* viewer or <code>null</code> if none
|
* viewer or <code>null</code> if none
|
||||||
*/
|
*/
|
||||||
protected TableTreeViewer getTableTreeViewer()
|
protected TableTreeViewer getTableTreeViewer() {
|
||||||
{
|
if (getViewer() instanceof TableTreeViewer) {
|
||||||
if ( getViewer() instanceof TableTreeViewer )
|
|
||||||
{
|
|
||||||
return (TableTreeViewer)getViewer();
|
return (TableTreeViewer)getViewer();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this event handler's viewer as a structured
|
||||||
|
* viewer or <code>null</code> if none.
|
||||||
|
*
|
||||||
|
* @return this event handler's viewer as a structured
|
||||||
|
* viewer or <code>null</code> if none
|
||||||
|
*/
|
||||||
|
protected StructuredViewer getStructuredViewer() {
|
||||||
|
if (getViewer() instanceof StructuredViewer) {
|
||||||
|
return (StructuredViewer)getViewer();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this event handler's viewer is
|
* Returns whether this event handler's viewer is
|
||||||
* currently available.
|
* currently available.
|
||||||
|
@ -245,8 +248,32 @@ public abstract class AbstractDebugEventHandler implements IDebugEventSetListene
|
||||||
* @return whether this event handler's viewer is
|
* @return whether this event handler's viewer is
|
||||||
* currently available
|
* currently available
|
||||||
*/
|
*/
|
||||||
protected boolean isAvailable()
|
protected boolean isAvailable() {
|
||||||
{
|
|
||||||
return getView().isAvailable();
|
return getView().isAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this event handler's view is currently visible.
|
||||||
|
*
|
||||||
|
* @return whether this event handler's view is currently visible
|
||||||
|
*/
|
||||||
|
protected boolean isViewVisible() {
|
||||||
|
return getView().isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when this event handler's view becomes visible. Default behavior
|
||||||
|
* is to refresh the view.
|
||||||
|
*/
|
||||||
|
protected void viewBecomesVisible() {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when this event handler's view becomes hidden. Default behavior is
|
||||||
|
* to do nothing. Subclasses may override.
|
||||||
|
*/
|
||||||
|
protected void viewBecomesHidden() {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,25 @@
|
||||||
/*
|
/*******************************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||||
* All Rights Reserved.
|
* 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:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.views;
|
package org.eclipse.cdt.debug.internal.ui.views;
|
||||||
|
|
||||||
|
|
||||||
import org.eclipse.debug.ui.AbstractDebugView;
|
import org.eclipse.debug.ui.AbstractDebugView;
|
||||||
|
import org.eclipse.jface.action.IStatusLineManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A debug view that uses an event handler to update its
|
||||||
* A debug view that uses an event handler to update its view/viewer.
|
* view/viewer.
|
||||||
*
|
|
||||||
* @since Jul 23, 2002
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractDebugEventHandlerView extends AbstractDebugView
|
public abstract class AbstractDebugEventHandlerView extends AbstractDebugView {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Event handler for this view
|
* Event handler for this view
|
||||||
*/
|
*/
|
||||||
|
@ -25,9 +30,8 @@ public abstract class AbstractDebugEventHandlerView extends AbstractDebugView
|
||||||
*
|
*
|
||||||
* @param eventHandler event handler
|
* @param eventHandler event handler
|
||||||
*/
|
*/
|
||||||
protected void setEventHandler( AbstractDebugEventHandler eventHandler )
|
protected void setEventHandler(AbstractDebugEventHandler eventHandler) {
|
||||||
{
|
this.fEventHandler = eventHandler;
|
||||||
fEventHandler = eventHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,20 +39,39 @@ public abstract class AbstractDebugEventHandlerView extends AbstractDebugView
|
||||||
*
|
*
|
||||||
* @return The event handler for this view
|
* @return The event handler for this view
|
||||||
*/
|
*/
|
||||||
protected AbstractDebugEventHandler getEventHandler()
|
protected AbstractDebugEventHandler getEventHandler() {
|
||||||
{
|
return this.fEventHandler;
|
||||||
return fEventHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see IWorkbenchPart#dispose()
|
* @see IWorkbenchPart#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose() {
|
||||||
{
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
if ( getEventHandler() != null )
|
if (getEventHandler() != null) {
|
||||||
{
|
|
||||||
getEventHandler().dispose();
|
getEventHandler().dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden()
|
||||||
|
*/
|
||||||
|
protected void becomesHidden() {
|
||||||
|
super.becomesHidden();
|
||||||
|
getEventHandler().viewBecomesHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
|
||||||
|
*/
|
||||||
|
protected void becomesVisible() {
|
||||||
|
super.becomesVisible();
|
||||||
|
getEventHandler().viewBecomesVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void clearStatusLine() {
|
||||||
|
IStatusLineManager manager = getViewSite().getActionBars().getStatusLineManager();
|
||||||
|
manager.setErrorMessage(null);
|
||||||
|
manager.setMessage(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,7 @@ import org.eclipse.debug.core.DebugException;
|
||||||
/**
|
/**
|
||||||
* A plugable exception handler.
|
* A plugable exception handler.
|
||||||
*/
|
*/
|
||||||
public interface IDebugExceptionHandler
|
public interface IDebugExceptionHandler {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Handles the given debug exception.
|
* Handles the given debug exception.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* Copyright (c) 2000, 2003 IBM Corporation 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:
|
|
||||||
* IBM Corporation - initial API and implementation
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.views;
|
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memento of the expanded and selected items in a tree
|
|
||||||
* viewer for.
|
|
||||||
*
|
|
||||||
* @since 2.1
|
|
||||||
*/
|
|
||||||
public class ViewerState {
|
|
||||||
|
|
||||||
private Object[] fExpandedElements = null;
|
|
||||||
private ISelection fSelection = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a memento for the given viewer.
|
|
||||||
*/
|
|
||||||
public ViewerState(TreeViewer viewer) {
|
|
||||||
saveState(viewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Saves the current state of the given viewer into
|
|
||||||
* this memento.
|
|
||||||
*
|
|
||||||
* @param viewer viewer of which to save the state
|
|
||||||
*/
|
|
||||||
public void saveState(TreeViewer viewer) {
|
|
||||||
fExpandedElements = viewer.getExpandedElements();
|
|
||||||
fSelection = viewer.getSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Restores the state of the given viewer to this mementos
|
|
||||||
* saved state.
|
|
||||||
*
|
|
||||||
* @param viewer viewer to which state is restored
|
|
||||||
*/
|
|
||||||
public void restoreState(TreeViewer viewer) {
|
|
||||||
if (fExpandedElements != null) {
|
|
||||||
viewer.setExpandedElements(fExpandedElements);
|
|
||||||
}
|
|
||||||
if (fSelection != null) {
|
|
||||||
viewer.setSelection(fSelection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.views.sharedlibs;
|
||||||
|
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class SharedLibrariesMessages {
|
||||||
|
|
||||||
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.sharedlibs.SharedLibrariesMessages"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
|
||||||
|
|
||||||
|
private SharedLibrariesMessages() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getString( String key ) {
|
||||||
|
try {
|
||||||
|
return RESOURCE_BUNDLE.getString( key );
|
||||||
|
}
|
||||||
|
catch (MissingResourceException e) {
|
||||||
|
return '!' + key + '!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
SharedLibrariesView.Name_1=Name
|
||||||
|
SharedLibrariesView.Start_Address_1=Start Address
|
||||||
|
SharedLibrariesView.End_Address_1=End Address
|
||||||
|
SharedLibrariesView.Loaded_1=Loaded
|
||||||
|
SharedLibrariesView.Not_loaded_1=Not loaded
|
||||||
|
SharedLibrariesView.Symbols_1=Symbols
|
|
@ -1,36 +1,38 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.sharedlibs;
|
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
|
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshAction;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.LoadSymbolsForAllAction;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.RefreshAction;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
import org.eclipse.jface.action.IAction;
|
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.jface.viewers.IContentProvider;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.TableTreeViewer;
|
import org.eclipse.jface.viewers.TableTreeViewer;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -38,56 +40,52 @@ import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.ui.INullSelectionListener;
|
||||||
import org.eclipse.ui.ISelectionListener;
|
import org.eclipse.ui.ISelectionListener;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Displays shared libraries.
|
||||||
*
|
*
|
||||||
* @since: Jan 21, 2003
|
* @since: Jan 21, 2003
|
||||||
*/
|
*/
|
||||||
public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||||
implements ISelectionListener,
|
implements ISelectionListener,
|
||||||
|
INullSelectionListener,
|
||||||
IPropertyChangeListener,
|
IPropertyChangeListener,
|
||||||
IDebugExceptionHandler
|
IDebugExceptionHandler {
|
||||||
{
|
|
||||||
public class SharedLibrariesLabelProvider extends CDTDebugModelPresentation implements ITableLabelProvider
|
public class SharedLibrariesLabelProvider extends CDebugModelPresentation implements ITableLabelProvider {
|
||||||
{
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
public Image getColumnImage( Object element, int columnIndex )
|
public Image getColumnImage( Object element, int columnIndex ) {
|
||||||
{
|
|
||||||
if ( element instanceof ICSharedLibrary && columnIndex == 1 )
|
if ( element instanceof ICSharedLibrary && columnIndex == 1 )
|
||||||
{
|
|
||||||
return getImage( element );
|
return getImage( element );
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
public String getColumnText( Object element, int columnIndex )
|
public String getColumnText( Object element, int columnIndex ) {
|
||||||
{
|
if ( element instanceof ICSharedLibrary ) {
|
||||||
if ( element instanceof ICSharedLibrary )
|
|
||||||
{
|
|
||||||
ICSharedLibrary library = (ICSharedLibrary)element;
|
ICSharedLibrary library = (ICSharedLibrary)element;
|
||||||
switch( columnIndex )
|
switch( columnIndex ) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
case 1:
|
case 1:
|
||||||
return getText( element );
|
return getText( element );
|
||||||
case 2:
|
case 2:
|
||||||
return ( library.getStartAddress() > 0 ) ?
|
return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
CDebugUtils.toHexAddressString( library.getStartAddress() ) : ""; //$NON-NLS-1$
|
|
||||||
case 3:
|
case 3:
|
||||||
|
return ( library.getStartAddress() > 0 ) ?
|
||||||
|
CDebugUIUtils.toHexAddressString( library.getStartAddress() ) : ""; //$NON-NLS-1$
|
||||||
|
case 4:
|
||||||
return ( library.getEndAddress() > 0 ) ?
|
return ( library.getEndAddress() > 0 ) ?
|
||||||
CDebugUtils.toHexAddressString( library.getEndAddress() ) : ""; //$NON-NLS-1$
|
CDebugUIUtils.toHexAddressString( library.getEndAddress() ) : ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -97,8 +95,7 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
|
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
|
||||||
*/
|
*/
|
||||||
protected Viewer createViewer( Composite parent )
|
protected Viewer createViewer( Composite parent ) {
|
||||||
{
|
|
||||||
TableTreeViewer viewer = new TableTreeViewer( parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
|
TableTreeViewer viewer = new TableTreeViewer( parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
|
||||||
Table table = viewer.getTableTree().getTable();
|
Table table = viewer.getTableTree().getTable();
|
||||||
table.setLinesVisible( true );
|
table.setLinesVisible( true );
|
||||||
|
@ -109,25 +106,31 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||||
new TableColumn( table, SWT.NULL );
|
new TableColumn( table, SWT.NULL );
|
||||||
new TableColumn( table, SWT.NULL );
|
new TableColumn( table, SWT.NULL );
|
||||||
new TableColumn( table, SWT.NULL );
|
new TableColumn( table, SWT.NULL );
|
||||||
|
new TableColumn( table, SWT.NULL );
|
||||||
TableColumn[] columns = table.getColumns();
|
TableColumn[] columns = table.getColumns();
|
||||||
columns[1].setResizable( true );
|
columns[1].setResizable( true );
|
||||||
columns[2].setResizable( true );
|
columns[2].setResizable( true );
|
||||||
columns[3].setResizable( true );
|
columns[3].setResizable( true );
|
||||||
|
columns[4].setResizable( true );
|
||||||
|
|
||||||
columns[0].setText( "" ); //$NON-NLS-1$
|
columns[0].setText( "" ); //$NON-NLS-1$
|
||||||
columns[1].setText( CDebugUIPlugin.getResourceString("SharedLibrariesView.Name") ); //$NON-NLS-1$
|
columns[1].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Name_1" ) ); //$NON-NLS-1$
|
||||||
columns[2].setText( CDebugUIPlugin.getResourceString("SharedLibrariesView.Start_Address") ); //$NON-NLS-1$
|
columns[2].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Symbols_1" ) ); //$NON-NLS-1$
|
||||||
columns[3].setText( CDebugUIPlugin.getResourceString("SharedLibrariesView.End_Address") ); //$NON-NLS-1$
|
columns[3].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.Start_Address_1" ) ); //$NON-NLS-1$
|
||||||
|
columns[4].setText( SharedLibrariesMessages.getString( "SharedLibrariesView.End_Address_1" ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
PixelConverter pc = new PixelConverter( parent );
|
PixelConverter pc = new PixelConverter( parent );
|
||||||
columns[0].setWidth( pc.convertWidthInCharsToPixels( 3 ) );
|
columns[0].setWidth( pc.convertWidthInCharsToPixels( 3 ) );
|
||||||
columns[1].setWidth( pc.convertWidthInCharsToPixels( 50 ) );
|
columns[1].setWidth( pc.convertWidthInCharsToPixels( 50 ) );
|
||||||
columns[2].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
columns[2].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
||||||
columns[3].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
columns[3].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
||||||
|
columns[4].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
||||||
|
|
||||||
viewer.setContentProvider( new SharedLibrariesViewContentProvider() );
|
viewer.setContentProvider( createContentProvider() );
|
||||||
viewer.setLabelProvider( new SharedLibrariesLabelProvider() );
|
viewer.setLabelProvider( new SharedLibrariesLabelProvider() );
|
||||||
|
|
||||||
|
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
||||||
|
|
||||||
// listen to selection in debug view
|
// listen to selection in debug view
|
||||||
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||||
setEventHandler( createEventHandler( viewer ) );
|
setEventHandler( createEventHandler( viewer ) );
|
||||||
|
@ -138,146 +141,75 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
||||||
*/
|
*/
|
||||||
protected void createActions()
|
protected void createActions() {
|
||||||
{
|
|
||||||
IAction action = new AutoRefreshAction( getViewer(), CDebugUIPlugin.getResourceString("RegistersView.Auto_Refresh") ); //$NON-NLS-1$
|
|
||||||
CDebugImages.setLocalImageDescriptors( action, CDebugImages.IMG_LCL_AUTO_REFRESH );
|
|
||||||
action.setDescription( "Automatically Refresh Shared Libraries View" ); //$NON-NLS-1$
|
|
||||||
action.setToolTipText( CDebugUIPlugin.getResourceString("RegistersView.Auto_Refresh") ); //$NON-NLS-1$
|
|
||||||
WorkbenchHelp.setHelp( action, ICDebugHelpContextIds.AUTO_REFRESH_SHARED_LIBRARIES_ACTION );
|
|
||||||
action.setEnabled( false );
|
|
||||||
setAction( "AutoRefresh", action ); //$NON-NLS-1$
|
|
||||||
add( (AutoRefreshAction)action );
|
|
||||||
|
|
||||||
action = new RefreshAction( getViewer(), CDebugUIPlugin.getResourceString("RegistersView.Refresh") ); //$NON-NLS-1$
|
|
||||||
CDebugImages.setLocalImageDescriptors( action, CDebugImages.IMG_LCL_REFRESH );
|
|
||||||
action.setDescription( CDebugUIPlugin.getResourceString("SharedLibrariesView.Refresh_Shared_Libraries_View") ); //$NON-NLS-1$
|
|
||||||
action.setToolTipText( CDebugUIPlugin.getResourceString("RegistersView.Refresh") ); //$NON-NLS-1$
|
|
||||||
WorkbenchHelp.setHelp( action, ICDebugHelpContextIds.REFRESH_SHARED_LIBRARIES_ACTION );
|
|
||||||
action.setEnabled( false );
|
|
||||||
setAction( "Refresh", action ); //$NON-NLS-1$
|
|
||||||
add( (RefreshAction)action );
|
|
||||||
|
|
||||||
action = new LoadSymbolsForAllAction( getViewer() );
|
|
||||||
action.setEnabled( false );
|
|
||||||
setAction( "LoadSymbolsForAll", action ); //$NON-NLS-1$
|
|
||||||
add( (LoadSymbolsForAllAction)action );
|
|
||||||
|
|
||||||
// set initial content here, as viewer has to be set
|
|
||||||
setInitialContent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
||||||
*/
|
*/
|
||||||
protected String getHelpContextId()
|
protected String getHelpContextId() {
|
||||||
{
|
|
||||||
return ICDebugHelpContextIds.SHARED_LIBRARIES_VIEW;
|
return ICDebugHelpContextIds.SHARED_LIBRARIES_VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
|
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
|
||||||
*/
|
*/
|
||||||
protected void fillContextMenu( IMenuManager menu )
|
protected void fillContextMenu( IMenuManager menu ) {
|
||||||
{
|
|
||||||
updateObjects();
|
|
||||||
|
|
||||||
menu.add( new Separator( ICDebugUIConstants.EMPTY_SHARED_LIBRARIES_GROUP ) );
|
|
||||||
menu.add( new Separator( ICDebugUIConstants.SHARED_LIBRARIES_GROUP ) );
|
|
||||||
|
|
||||||
menu.add( new Separator( ICDebugUIConstants.EMPTY_REFRESH_GROUP ) );
|
|
||||||
menu.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
|
|
||||||
|
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
|
updateObjects();
|
||||||
menu.appendToGroup( ICDebugUIConstants.SHARED_LIBRARIES_GROUP, getAction( "LoadSymbolsForAll" ) ); //$NON-NLS-1$
|
|
||||||
menu.appendToGroup( ICDebugUIConstants.REFRESH_GROUP, getAction( "AutoRefresh" ) ); //$NON-NLS-1$
|
|
||||||
menu.appendToGroup( ICDebugUIConstants.REFRESH_GROUP, getAction( "Refresh" ) ); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
|
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
|
||||||
*/
|
*/
|
||||||
protected void configureToolBar( IToolBarManager tbm )
|
protected void configureToolBar( IToolBarManager tbm ) {
|
||||||
{
|
|
||||||
tbm.add( new Separator( this.getClass().getName() ) );
|
|
||||||
|
|
||||||
tbm.add( new Separator( ICDebugUIConstants.SHARED_LIBRARIES_GROUP ) );
|
|
||||||
tbm.add( getAction( "LoadSymbolsForAll" ) ); //$NON-NLS-1$
|
|
||||||
|
|
||||||
tbm.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
|
|
||||||
tbm.add( getAction( "AutoRefresh" ) ); //$NON-NLS-1$
|
|
||||||
tbm.add( getAction( "Refresh" ) ); //$NON-NLS-1$
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
||||||
*/
|
*/
|
||||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
|
||||||
{
|
if ( !isAvailable() || !isVisible() )
|
||||||
if ( selection instanceof IStructuredSelection )
|
return;
|
||||||
{
|
if ( selection == null )
|
||||||
|
setViewerInput( new StructuredSelection() );
|
||||||
|
else if ( selection instanceof IStructuredSelection )
|
||||||
setViewerInput( (IStructuredSelection)selection );
|
setViewerInput( (IStructuredSelection)selection );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
||||||
*/
|
*/
|
||||||
public void propertyChange( PropertyChangeEvent event )
|
public void propertyChange( PropertyChangeEvent event ) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
|
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
|
||||||
*/
|
*/
|
||||||
public void handleException( DebugException e )
|
public void handleException( DebugException e ) {
|
||||||
{
|
showMessage( e.getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setViewerInput( IStructuredSelection ssel )
|
protected void setViewerInput( IStructuredSelection ssel ) {
|
||||||
{
|
ICDebugTarget target = null;
|
||||||
ICSharedLibraryManager slm = null;
|
if ( ssel != null && ssel.size() == 1 ) {
|
||||||
if ( ssel != null && ssel.size() == 1 )
|
|
||||||
{
|
|
||||||
Object input = ssel.getFirstElement();
|
Object input = ssel.getFirstElement();
|
||||||
if ( input instanceof IDebugElement )
|
if ( input instanceof IDebugElement && ((IDebugElement)input).getDebugTarget() instanceof ICDebugTarget )
|
||||||
{
|
target = (ICDebugTarget)((IDebugElement)input).getDebugTarget();
|
||||||
slm = (ICSharedLibraryManager)((IDebugElement)input).getDebugTarget().getAdapter( ICSharedLibraryManager.class );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getViewer() == null )
|
if ( getViewer() == null )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Object current = getViewer().getInput();
|
Object current = getViewer().getInput();
|
||||||
if ( current != null && current.equals( slm ) )
|
if ( current != null && current.equals( target ) ) {
|
||||||
{
|
|
||||||
updateObjects();
|
updateObjects();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showViewer();
|
|
||||||
getViewer().setInput( slm );
|
|
||||||
updateObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
showViewer();
|
||||||
* Initializes the viewer input on creation
|
getViewer().setInput( target );
|
||||||
*/
|
updateObjects();
|
||||||
protected void setInitialContent()
|
|
||||||
{
|
|
||||||
ISelection selection =
|
|
||||||
getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
|
||||||
if ( selection instanceof IStructuredSelection && !selection.isEmpty() )
|
|
||||||
{
|
|
||||||
setViewerInput( (IStructuredSelection)selection );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setViewerInput( null );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,8 +218,47 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
|
||||||
* @param viewer the viewer associated with this view
|
* @param viewer the viewer associated with this view
|
||||||
* @return an event handler
|
* @return an event handler
|
||||||
*/
|
*/
|
||||||
protected AbstractDebugEventHandler createEventHandler( Viewer viewer )
|
protected AbstractDebugEventHandler createEventHandler( Viewer viewer ) {
|
||||||
{
|
|
||||||
return new SharedLibrariesViewEventHandler( this );
|
return new SharedLibrariesViewEventHandler( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates this view's content provider.
|
||||||
|
*
|
||||||
|
* @return a content provider
|
||||||
|
*/
|
||||||
|
protected IContentProvider createContentProvider() {
|
||||||
|
SharedLibrariesViewContentProvider cp = new SharedLibrariesViewContentProvider();
|
||||||
|
cp.setExceptionHandler( this );
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden()
|
||||||
|
*/
|
||||||
|
protected void becomesHidden() {
|
||||||
|
setViewerInput( new StructuredSelection() );
|
||||||
|
super.becomesHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
|
||||||
|
*/
|
||||||
|
protected void becomesVisible() {
|
||||||
|
super.becomesVisible();
|
||||||
|
IViewPart part = getSite().getPage().findView( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||||
|
if ( part != null ) {
|
||||||
|
ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||||
|
selectionChanged( part, selection );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IWorkbenchPart#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||||
|
CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,145 +1,164 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.sharedlibs;
|
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Provides content for the shared libraries view.
|
||||||
*
|
*
|
||||||
* @since: Jan 21, 2003
|
* @since: Jan 21, 2003
|
||||||
*/
|
*/
|
||||||
public class SharedLibrariesViewContentProvider implements ITreeContentProvider
|
public class SharedLibrariesViewContentProvider implements ITreeContentProvider {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* A table that maps children to their parent element
|
* A table that maps children to their parent element such that this
|
||||||
* such that this content provider can walk back up the
|
* content provider can walk back up the parent chain (since values do not
|
||||||
* parent chain (since values do not know their
|
* know their parent). Map of <code>IVariable</code> (child) -><code>IVariable</code>
|
||||||
* parent).
|
* (parent).
|
||||||
* Map of <code>IVariable</code> (child) -> <code>IVariable</code> (parent).
|
|
||||||
*/
|
*/
|
||||||
private HashMap fParentCache;
|
private HashMap fParentCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for exceptions as content is retrieved
|
* Handler for exceptions as content is retrieved
|
||||||
*/
|
*/
|
||||||
private IDebugExceptionHandler fExceptionHandler = null;
|
private IDebugExceptionHandler fExceptionHandler;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SharedLibrariesViewContentProvider.
|
* Constructor for SharedLibrariesViewContentProvider.
|
||||||
*/
|
*/
|
||||||
public SharedLibrariesViewContentProvider()
|
public SharedLibrariesViewContentProvider() {
|
||||||
{
|
setParentCache( new HashMap( 10 ) );
|
||||||
fParentCache = new HashMap( 10 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
|
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(Object)
|
||||||
*/
|
*/
|
||||||
public Object[] getChildren( Object parent )
|
public Object[] getChildren( Object parent ) {
|
||||||
{
|
if ( parent instanceof ICDebugTarget ) {
|
||||||
Object[] children = null;
|
Object[] children = null;
|
||||||
if ( parent != null && parent instanceof ICSharedLibraryManager )
|
ICDebugTarget target = (ICDebugTarget)parent;
|
||||||
{
|
try {
|
||||||
children = ((ICSharedLibraryManager)parent).getSharedLibraries();
|
if ( target != null )
|
||||||
}
|
children = target.getSharedLibraries();
|
||||||
if ( children != null )
|
if ( children != null ) {
|
||||||
{
|
|
||||||
cache( parent, children );
|
cache( parent, children );
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
if ( getExceptionHandler() != null )
|
||||||
|
getExceptionHandler().handleException( e );
|
||||||
|
else
|
||||||
|
CDebugUIPlugin.log( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches the given elememts as children of the given
|
* Caches the given elememts as children of the given parent.
|
||||||
* parent.
|
|
||||||
*
|
*
|
||||||
* @param parent parent element
|
* @param parent
|
||||||
* @param children children elements
|
* parent element
|
||||||
|
* @param children
|
||||||
|
* children elements
|
||||||
*/
|
*/
|
||||||
protected void cache( Object parent, Object[] children )
|
protected void cache( Object parent, Object[] children ) {
|
||||||
{
|
for ( int i = 0; i < children.length; i++ ) {
|
||||||
for ( int i = 0; i < children.length; i++ )
|
getParentCache().put( children[i], parent );
|
||||||
{
|
|
||||||
fParentCache.put( children[i], parent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
|
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(Object)
|
||||||
*/
|
*/
|
||||||
public Object getParent( Object element )
|
public Object getParent( Object element ) {
|
||||||
{
|
return getParentCache().get( element );
|
||||||
return fParentCache.get( element );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
|
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(Object)
|
||||||
*/
|
*/
|
||||||
public boolean hasChildren( Object parent )
|
public boolean hasChildren( Object parent ) {
|
||||||
{
|
if ( parent instanceof ICDebugTarget ) {
|
||||||
if ( parent instanceof ICSharedLibraryManager )
|
try {
|
||||||
{
|
ICDebugTarget target = (ICDebugTarget)parent;
|
||||||
return ( ((ICSharedLibraryManager)parent).getSharedLibraries().length > 0 );
|
return target.hasSharedLibraries();
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
CDebugUIPlugin.log( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
|
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
|
||||||
*/
|
*/
|
||||||
public Object[] getElements( Object inputElement )
|
public Object[] getElements( Object inputElement ) {
|
||||||
{
|
|
||||||
return getChildren( inputElement );
|
return getChildren( inputElement );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose() {
|
||||||
{
|
setParentCache( null );
|
||||||
fParentCache = null;
|
|
||||||
setExceptionHandler( null );
|
setExceptionHandler( null );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer,
|
||||||
|
* Object, Object)
|
||||||
*/
|
*/
|
||||||
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
|
public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
|
||||||
{
|
|
||||||
clearCache();
|
clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearCache()
|
protected void clearCache() {
|
||||||
{
|
if ( getParentCache() != null ) {
|
||||||
if ( fParentCache != null )
|
getParentCache().clear();
|
||||||
{
|
|
||||||
fParentCache.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the cached parent for the given children
|
* Remove the cached parent for the given children
|
||||||
*
|
*
|
||||||
* @param children for which to remove cached parents
|
* @param children
|
||||||
|
* for which to remove cached parents
|
||||||
*/
|
*/
|
||||||
public void removeCache( Object[] children )
|
public void removeCache( Object[] children ) {
|
||||||
{
|
if ( getParentCache() != null ) {
|
||||||
if ( fParentCache != null )
|
for ( int i = 0; i < children.length; i++ ) {
|
||||||
{
|
getParentCache().remove( children[i] );
|
||||||
for ( int i = 0; i < children.length; i++ )
|
|
||||||
{
|
|
||||||
fParentCache.remove( children[i] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,9 +168,8 @@ public class SharedLibrariesViewContentProvider implements ITreeContentProvider
|
||||||
*
|
*
|
||||||
* @param handler debug exception handler or <code>null</code>
|
* @param handler debug exception handler or <code>null</code>
|
||||||
*/
|
*/
|
||||||
protected void setExceptionHandler( IDebugExceptionHandler handler )
|
protected void setExceptionHandler( IDebugExceptionHandler handler ) {
|
||||||
{
|
this.fExceptionHandler = handler;
|
||||||
fExceptionHandler = handler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,8 +177,15 @@ public class SharedLibrariesViewContentProvider implements ITreeContentProvider
|
||||||
*
|
*
|
||||||
* @return debug exception handler or <code>null</code>
|
* @return debug exception handler or <code>null</code>
|
||||||
*/
|
*/
|
||||||
protected IDebugExceptionHandler getExceptionHandler()
|
protected IDebugExceptionHandler getExceptionHandler() {
|
||||||
{
|
return this.fExceptionHandler;
|
||||||
return fExceptionHandler;
|
}
|
||||||
|
|
||||||
|
private HashMap getParentCache() {
|
||||||
|
return this.fParentCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setParentCache( HashMap parentCache ) {
|
||||||
|
this.fParentCache = parentCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.sharedlibs;
|
package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||||
|
@ -12,35 +17,33 @@ import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
import org.eclipse.debug.ui.AbstractDebugView;
|
import org.eclipse.debug.ui.AbstractDebugView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Updates the shared libraries view.
|
||||||
*
|
*
|
||||||
* @since: Jan 21, 2003
|
* @since: Jan 21, 2003
|
||||||
*/
|
*/
|
||||||
public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler
|
public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SharedLibrariesViewEventHandler.
|
* Constructs a new event handler on the given view
|
||||||
* @param view
|
*
|
||||||
|
* @param view shared libraries view
|
||||||
*/
|
*/
|
||||||
public SharedLibrariesViewEventHandler( AbstractDebugView view )
|
public SharedLibrariesViewEventHandler( AbstractDebugView view ) {
|
||||||
{
|
|
||||||
super( view );
|
super( view );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(DebugEvent[])
|
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(DebugEvent[])
|
||||||
*/
|
*/
|
||||||
protected void doHandleDebugEvents( DebugEvent[] events )
|
protected void doHandleDebugEvents( DebugEvent[] events ) {
|
||||||
{
|
for ( int i = 0; i < events.length; i++ ) {
|
||||||
for( int i = 0; i < events.length; i++ )
|
|
||||||
{
|
|
||||||
DebugEvent event = events[i];
|
DebugEvent event = events[i];
|
||||||
switch( event.getKind() )
|
switch( event.getKind() ) {
|
||||||
{
|
|
||||||
case DebugEvent.CREATE:
|
case DebugEvent.CREATE:
|
||||||
case DebugEvent.TERMINATE:
|
case DebugEvent.TERMINATE:
|
||||||
if ( event.getSource() instanceof IDebugTarget ||
|
if ( event.getSource() instanceof IDebugTarget || event.getSource() instanceof ICSharedLibrary )
|
||||||
event.getSource() instanceof ICSharedLibrary )
|
|
||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
case DebugEvent.CHANGE :
|
case DebugEvent.CHANGE :
|
||||||
|
@ -51,25 +54,25 @@ public class SharedLibrariesViewEventHandler extends AbstractDebugEventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh()
|
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh()
|
||||||
*/
|
*/
|
||||||
public void refresh()
|
public void refresh() {
|
||||||
{
|
if ( isAvailable() ) {
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTableTreeViewer().refresh();
|
getTableTreeViewer().refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh(java.lang.Object)
|
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#refresh(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
protected void refresh( Object element )
|
protected void refresh( Object element ) {
|
||||||
{
|
if ( isAvailable() ) {
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
getView().showViewer();
|
||||||
getTableTreeViewer().refresh( element );
|
getTableTreeViewer().refresh( element );
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.views.signals;
|
||||||
|
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
public class SignalsMessages {
|
||||||
|
|
||||||
|
private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.ui.views.signals.SignalsMessages";//$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME );
|
||||||
|
|
||||||
|
private SignalsMessages() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getString( String key ) {
|
||||||
|
try {
|
||||||
|
return RESOURCE_BUNDLE.getString( key );
|
||||||
|
} catch( MissingResourceException e ) {
|
||||||
|
return '!' + key + '!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
SignalsViewer.4=Name
|
||||||
|
SignalsViewer.5=Pass
|
||||||
|
SignalsViewer.6=Suspend
|
||||||
|
SignalsViewer.7=Description
|
||||||
|
SignalsViewer.8=yes
|
||||||
|
SignalsViewer.9=no
|
|
@ -1,19 +1,24 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.signals;
|
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
|
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
|
@ -25,71 +30,71 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.ui.INullSelectionListener;
|
||||||
import org.eclipse.ui.ISelectionListener;
|
import org.eclipse.ui.ISelectionListener;
|
||||||
|
import org.eclipse.ui.IViewPart;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Displays signals.
|
||||||
*
|
*
|
||||||
* @since: Jan 30, 2003
|
* @since: Mar 8, 2004
|
||||||
*/
|
*/
|
||||||
public class SignalsView extends AbstractDebugEventHandlerView
|
public class SignalsView extends AbstractDebugEventHandlerView
|
||||||
implements ISelectionListener,
|
implements ISelectionListener,
|
||||||
|
INullSelectionListener,
|
||||||
IPropertyChangeListener,
|
IPropertyChangeListener,
|
||||||
IDebugExceptionHandler
|
IDebugExceptionHandler {
|
||||||
{
|
|
||||||
/**
|
public class SignalsViewLabelProvider extends LabelProvider implements ITableLabelProvider {
|
||||||
* Enter type comment.
|
|
||||||
*
|
|
||||||
* @since: Jan 30, 2003
|
|
||||||
*/
|
|
||||||
public class SignalsViewLabelProvider extends LabelProvider implements ITableLabelProvider
|
|
||||||
{
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
public Image getColumnImage( Object element, int columnIndex )
|
public Image getColumnImage( Object element, int columnIndex ) {
|
||||||
{
|
|
||||||
if ( columnIndex == 0 )
|
if ( columnIndex == 0 )
|
||||||
return CDebugUIPlugin.getImageDescriptorRegistry().get( CDebugImages.DESC_OBJS_SIGNAL );
|
return getModelPresentation().getImage( element );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
public String getColumnText( Object element, int columnIndex )
|
public String getColumnText( Object element, int columnIndex ) {
|
||||||
{
|
if ( element instanceof ICSignal ) {
|
||||||
if ( element instanceof ICSignal )
|
try {
|
||||||
{
|
switch( columnIndex ) {
|
||||||
switch( columnIndex )
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
return ((ICSignal)element).getName();
|
return ((ICSignal)element).getName();
|
||||||
case 1:
|
case 1:
|
||||||
return ( ((ICSignal)element).isPassEnabled() ) ?
|
return (((ICSignal)element).isPassEnabled()) ? SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
||||||
SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
|
||||||
case 2:
|
case 2:
|
||||||
return ( ((ICSignal)element).isStopEnabled() ) ?
|
return (((ICSignal)element).isStopEnabled()) ? SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
||||||
SignalsViewer.YES_VALUE : SignalsViewer.NO_VALUE;
|
|
||||||
case 3:
|
case 3:
|
||||||
return ((ICSignal)element).getDescription();
|
return ((ICSignal)element).getDescription();
|
||||||
}
|
}
|
||||||
|
} catch( DebugException e ) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IDebugModelPresentation getModelPresentation() {
|
||||||
|
return CDebugUIPlugin.getDebugModelPresentation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(Composite)
|
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
protected Viewer createViewer( Composite parent )
|
protected Viewer createViewer( Composite parent ) {
|
||||||
{
|
|
||||||
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
||||||
|
|
||||||
// add tree viewer
|
// add tree viewer
|
||||||
|
@ -97,7 +102,8 @@ public class SignalsView extends AbstractDebugEventHandlerView
|
||||||
vv.setContentProvider( createContentProvider() );
|
vv.setContentProvider( createContentProvider() );
|
||||||
vv.setLabelProvider( new SignalsViewLabelProvider() );
|
vv.setLabelProvider( new SignalsViewLabelProvider() );
|
||||||
vv.setUseHashlookup( true );
|
vv.setUseHashlookup( true );
|
||||||
vv.setExceptionHandler( this );
|
|
||||||
|
CDebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener( this );
|
||||||
|
|
||||||
// listen to selection in debug view
|
// listen to selection in debug view
|
||||||
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
getSite().getPage().addSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||||
|
@ -109,109 +115,53 @@ public class SignalsView extends AbstractDebugEventHandlerView
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
|
||||||
*/
|
*/
|
||||||
protected void createActions()
|
protected void createActions() {
|
||||||
{
|
|
||||||
// set initial content here, as viewer has to be set
|
|
||||||
setInitialContent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
* @see org.eclipse.debug.ui.AbstractDebugView#getHelpContextId()
|
||||||
*/
|
*/
|
||||||
protected String getHelpContextId()
|
protected String getHelpContextId() {
|
||||||
{
|
|
||||||
return ICDebugHelpContextIds.SIGNALS_VIEW;
|
return ICDebugHelpContextIds.SIGNALS_VIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
|
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
|
||||||
*/
|
*/
|
||||||
protected void fillContextMenu( IMenuManager menu )
|
protected void fillContextMenu( IMenuManager menu ) {
|
||||||
{
|
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
|
|
||||||
*/
|
|
||||||
protected void configureToolBar( IToolBarManager tbm )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
|
|
||||||
*/
|
|
||||||
public void selectionChanged( IWorkbenchPart part, ISelection selection )
|
|
||||||
{
|
|
||||||
if ( selection instanceof IStructuredSelection )
|
|
||||||
{
|
|
||||||
setViewerInput( (IStructuredSelection)selection );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
|
|
||||||
*/
|
|
||||||
public void propertyChange( PropertyChangeEvent event )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(DebugException)
|
|
||||||
*/
|
|
||||||
public void handleException( DebugException e )
|
|
||||||
{
|
|
||||||
showMessage( e.getMessage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setViewerInput( IStructuredSelection ssel )
|
|
||||||
{
|
|
||||||
ICSignalManager sm = null;
|
|
||||||
if ( ssel != null && ssel.size() == 1 )
|
|
||||||
{
|
|
||||||
Object input = ssel.getFirstElement();
|
|
||||||
if ( input instanceof IDebugElement )
|
|
||||||
{
|
|
||||||
sm = (ICSignalManager)((IDebugElement)input).getDebugTarget().getAdapter( ICSignalManager.class );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( getViewer() == null )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object current = getViewer().getInput();
|
|
||||||
if ( current != null && current.equals( sm ) )
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
showViewer();
|
|
||||||
getViewer().setInput( sm );
|
|
||||||
updateObjects();
|
updateObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* Initializes the viewer input on creation
|
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
|
||||||
*/
|
*/
|
||||||
protected void setInitialContent()
|
protected void configureToolBar( IToolBarManager tbm ) {
|
||||||
{
|
|
||||||
ISelection selection =
|
|
||||||
getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
|
||||||
if ( selection instanceof IStructuredSelection && !selection.isEmpty() )
|
|
||||||
{
|
|
||||||
setViewerInput( (IStructuredSelection)selection );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.ui.IWorkbenchPart#dispose()
|
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void selectionChanged( IWorkbenchPart part, ISelection selection ) {
|
||||||
{
|
if ( !isAvailable() || !isVisible() )
|
||||||
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
return;
|
||||||
CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
|
if ( selection == null )
|
||||||
super.dispose();
|
setViewerInput( new StructuredSelection() );
|
||||||
|
else if ( selection instanceof IStructuredSelection )
|
||||||
|
setViewerInput( (IStructuredSelection)selection );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
|
||||||
|
*/
|
||||||
|
public void propertyChange( PropertyChangeEvent event ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler#handleException(org.eclipse.debug.core.DebugException)
|
||||||
|
*/
|
||||||
|
public void handleException( DebugException e ) {
|
||||||
|
showMessage( e.getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,10 +169,60 @@ public class SignalsView extends AbstractDebugEventHandlerView
|
||||||
*
|
*
|
||||||
* @return a content provider
|
* @return a content provider
|
||||||
*/
|
*/
|
||||||
protected IContentProvider createContentProvider()
|
private IContentProvider createContentProvider() {
|
||||||
{
|
|
||||||
SignalsViewContentProvider cp = new SignalsViewContentProvider();
|
SignalsViewContentProvider cp = new SignalsViewContentProvider();
|
||||||
cp.setExceptionHandler( this );
|
cp.setExceptionHandler( this );
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setViewerInput( IStructuredSelection ssel ) {
|
||||||
|
ICDebugTarget target = null;
|
||||||
|
if ( ssel != null && ssel.size() == 1 ) {
|
||||||
|
Object input = ssel.getFirstElement();
|
||||||
|
if ( input instanceof IDebugElement && ((IDebugElement)input).getDebugTarget() instanceof ICDebugTarget )
|
||||||
|
target = (ICDebugTarget)((IDebugElement)input).getDebugTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getViewer() == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Object current = getViewer().getInput();
|
||||||
|
if ( current != null && current.equals( target ) ) {
|
||||||
|
updateObjects();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showViewer();
|
||||||
|
getViewer().setInput( target );
|
||||||
|
updateObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesHidden()
|
||||||
|
*/
|
||||||
|
protected void becomesHidden() {
|
||||||
|
setViewerInput( new StructuredSelection() );
|
||||||
|
super.becomesHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#becomesVisible()
|
||||||
|
*/
|
||||||
|
protected void becomesVisible() {
|
||||||
|
super.becomesVisible();
|
||||||
|
IViewPart part = getSite().getPage().findView( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||||
|
if ( part != null ) {
|
||||||
|
ISelection selection = getSite().getPage().getSelection( IDebugUIConstants.ID_DEBUG_VIEW );
|
||||||
|
selectionChanged( part, selection );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.IWorkbenchPart#dispose()
|
||||||
|
*/
|
||||||
|
public void dispose() {
|
||||||
|
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||||
|
CDebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener( this );
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,75 +1,72 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.signals;
|
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICSignalManager;
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Provides content for the signals view.
|
||||||
*
|
*
|
||||||
* @since: Jan 30, 2003
|
* @since: Mar 8, 2004
|
||||||
*/
|
*/
|
||||||
public class SignalsViewContentProvider implements IStructuredContentProvider
|
public class SignalsViewContentProvider implements IStructuredContentProvider {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Handler for exceptions as content is retrieved
|
* Handler for exceptions as content is retrieved
|
||||||
*/
|
*/
|
||||||
private IDebugExceptionHandler fExceptionHandler = null;
|
private IDebugExceptionHandler fExceptionHandler = null;
|
||||||
|
|
||||||
/**
|
public SignalsViewContentProvider() {
|
||||||
* Constructor for SignalsViewContentProvider.
|
|
||||||
*/
|
|
||||||
public SignalsViewContentProvider()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
|
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object[] getElements( Object inputElement )
|
public Object[] getElements( Object inputElement ) {
|
||||||
{
|
if ( inputElement instanceof ICDebugTarget ) {
|
||||||
if ( inputElement instanceof ICSignalManager )
|
ICDebugTarget target = (ICDebugTarget)inputElement;
|
||||||
{
|
try {
|
||||||
try
|
if ( target != null ) {
|
||||||
{
|
Object[] signals = target.getSignals();
|
||||||
return ((ICSignalManager)inputElement).getSignals();
|
if ( signals != null )
|
||||||
|
return signals;
|
||||||
}
|
}
|
||||||
catch( DebugException e )
|
}
|
||||||
{
|
catch( DebugException e ) {
|
||||||
if ( getExceptionHandler() != null )
|
if ( getExceptionHandler() != null )
|
||||||
{
|
|
||||||
getExceptionHandler().handleException( e );
|
getExceptionHandler().handleException( e );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
CDebugUIPlugin.log( e );
|
CDebugUIPlugin.log( e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
|
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
|
public void inputChanged( Viewer viewer, Object oldInput, Object newInput ) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +74,7 @@ public class SignalsViewContentProvider implements IStructuredContentProvider
|
||||||
*
|
*
|
||||||
* @param handler debug exception handler or <code>null</code>
|
* @param handler debug exception handler or <code>null</code>
|
||||||
*/
|
*/
|
||||||
protected void setExceptionHandler( IDebugExceptionHandler handler )
|
protected void setExceptionHandler(IDebugExceptionHandler handler) {
|
||||||
{
|
|
||||||
fExceptionHandler = handler;
|
fExceptionHandler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,8 +83,7 @@ public class SignalsViewContentProvider implements IStructuredContentProvider
|
||||||
*
|
*
|
||||||
* @return debug exception handler or <code>null</code>
|
* @return debug exception handler or <code>null</code>
|
||||||
*/
|
*/
|
||||||
protected IDebugExceptionHandler getExceptionHandler()
|
protected IDebugExceptionHandler getExceptionHandler() {
|
||||||
{
|
|
||||||
return fExceptionHandler;
|
return fExceptionHandler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.signals;
|
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
|
@ -11,70 +17,43 @@ import org.eclipse.debug.core.DebugEvent;
|
||||||
import org.eclipse.debug.core.model.IDebugTarget;
|
import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
import org.eclipse.debug.ui.AbstractDebugView;
|
import org.eclipse.debug.ui.AbstractDebugView;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Updates the signals view.
|
||||||
*
|
*
|
||||||
* @since: Jan 30, 2003
|
* @since: Mar 8, 2004
|
||||||
*/
|
*/
|
||||||
public class SignalsViewEventHandler extends AbstractDebugEventHandler
|
public class SignalsViewEventHandler extends AbstractDebugEventHandler {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SignalsViewEventHandler.
|
* Constructs a new event handler on the given view
|
||||||
* @param view
|
*
|
||||||
|
* @param view signals view
|
||||||
*/
|
*/
|
||||||
public SignalsViewEventHandler( AbstractDebugView view )
|
public SignalsViewEventHandler( AbstractDebugView view ) {
|
||||||
{
|
|
||||||
super( view );
|
super( view );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(DebugEvent[])
|
* @see org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler#doHandleDebugEvents(org.eclipse.debug.core.DebugEvent[])
|
||||||
*/
|
*/
|
||||||
protected void doHandleDebugEvents( DebugEvent[] events )
|
protected void doHandleDebugEvents( DebugEvent[] events ) {
|
||||||
{
|
for( int i = 0; i < events.length; i++ ) {
|
||||||
for( int i = 0; i < events.length; i++ )
|
|
||||||
{
|
|
||||||
DebugEvent event = events[i];
|
DebugEvent event = events[i];
|
||||||
switch( event.getKind() )
|
switch( event.getKind() ) {
|
||||||
{
|
|
||||||
case DebugEvent.CREATE:
|
case DebugEvent.CREATE:
|
||||||
case DebugEvent.TERMINATE:
|
case DebugEvent.TERMINATE:
|
||||||
if ( event.getSource() instanceof IDebugTarget ||
|
if ( event.getSource() instanceof IDebugTarget || event.getSource() instanceof ICSignal )
|
||||||
event.getSource() instanceof ICSignal )
|
|
||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
case DebugEvent.SUSPEND :
|
case DebugEvent.SUSPEND:
|
||||||
refresh();
|
refresh();
|
||||||
break;
|
break;
|
||||||
case DebugEvent.CHANGE :
|
case DebugEvent.CHANGE:
|
||||||
if ( event.getSource() instanceof ICSignal )
|
if ( event.getSource() instanceof ICSignal )
|
||||||
refresh( event.getSource() );
|
refresh( event.getSource() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Refresh the given element in the viewer - must be called in UI thread.
|
|
||||||
*/
|
|
||||||
protected void refresh( Object element )
|
|
||||||
{
|
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
|
||||||
getTableViewer().refresh( element );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refresh the viewer - must be called in UI thread.
|
|
||||||
*/
|
|
||||||
public void refresh()
|
|
||||||
{
|
|
||||||
if ( isAvailable() )
|
|
||||||
{
|
|
||||||
getView().showViewer();
|
|
||||||
getTableViewer().refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,37 +1,35 @@
|
||||||
/*
|
/**********************************************************************
|
||||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
* All Rights Reserved.
|
* 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.views.signals;
|
package org.eclipse.cdt.debug.internal.ui.views.signals;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
|
||||||
import org.eclipse.debug.core.DebugException;
|
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
|
||||||
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
|
||||||
import org.eclipse.jface.viewers.ICellModifier;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter type comment.
|
* Signals viewer.
|
||||||
*
|
*
|
||||||
* @since: Jan 30, 2003
|
* @since: Mar 8, 2004
|
||||||
*/
|
*/
|
||||||
public class SignalsViewer extends TableViewer
|
public class SignalsViewer extends TableViewer {
|
||||||
{
|
|
||||||
// String constants
|
// String constants
|
||||||
protected static final String YES_VALUE = CDebugUIPlugin.getResourceString("SignalsViewer.yes"); //$NON-NLS-1$
|
protected static final String YES_VALUE = SignalsMessages.getString( "SignalsViewer.8" ); //$NON-NLS-1$
|
||||||
protected static final String NO_VALUE = CDebugUIPlugin.getResourceString("SignalsViewer.no"); //$NON-NLS-1$
|
protected static final String NO_VALUE = SignalsMessages.getString( "SignalsViewer.9" ); //$NON-NLS-1$
|
||||||
|
|
||||||
// Column properties
|
// Column properties
|
||||||
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
||||||
|
@ -39,15 +37,19 @@ public class SignalsViewer extends TableViewer
|
||||||
private static final String CP_SUSPEND = "suspend"; //$NON-NLS-1$
|
private static final String CP_SUSPEND = "suspend"; //$NON-NLS-1$
|
||||||
private static final String CP_DESCRIPTION = "description"; //$NON-NLS-1$
|
private static final String CP_DESCRIPTION = "description"; //$NON-NLS-1$
|
||||||
|
|
||||||
private IDebugExceptionHandler fExceptionHandler = null;
|
// Column labels
|
||||||
|
private static final String CL_NAME = SignalsMessages.getString( "SignalsViewer.4" ); //$NON-NLS-1$
|
||||||
|
private static final String CL_PASS = SignalsMessages.getString( "SignalsViewer.5" ); //$NON-NLS-1$
|
||||||
|
private static final String CL_SUSPEND = SignalsMessages.getString( "SignalsViewer.6" ); //$NON-NLS-1$
|
||||||
|
private static final String CL_DESCRIPTION = SignalsMessages.getString( "SignalsViewer.7" ); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SignalsViewer.
|
* Constructor for SignalsViewer
|
||||||
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param style
|
* @param style
|
||||||
*/
|
*/
|
||||||
public SignalsViewer( Composite parent, int style )
|
public SignalsViewer( Composite parent, int style ) {
|
||||||
{
|
|
||||||
super( parent, style );
|
super( parent, style );
|
||||||
Table table = getTable();
|
Table table = getTable();
|
||||||
table.setLinesVisible( true );
|
table.setLinesVisible( true );
|
||||||
|
@ -65,10 +67,10 @@ public class SignalsViewer extends TableViewer
|
||||||
columns[2].setResizable( false );
|
columns[2].setResizable( false );
|
||||||
columns[3].setResizable( true );
|
columns[3].setResizable( true );
|
||||||
|
|
||||||
columns[0].setText( CDebugUIPlugin.getResourceString("SignalsViewer.Name") ); //$NON-NLS-1$
|
columns[0].setText( CL_NAME );
|
||||||
columns[1].setText( CDebugUIPlugin.getResourceString("SignalsViewer.Pass") ); //$NON-NLS-1$
|
columns[1].setText( CL_PASS );
|
||||||
columns[2].setText( CDebugUIPlugin.getResourceString("SignalsViewer.Suspend") ); //$NON-NLS-1$
|
columns[2].setText( CL_SUSPEND );
|
||||||
columns[3].setText( CDebugUIPlugin.getResourceString("SignalsViewer.Description") ); //$NON-NLS-1$
|
columns[3].setText( CL_DESCRIPTION );
|
||||||
|
|
||||||
PixelConverter pc = new PixelConverter( parent );
|
PixelConverter pc = new PixelConverter( parent );
|
||||||
columns[0].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
columns[0].setWidth( pc.convertWidthInCharsToPixels( 20 ) );
|
||||||
|
@ -76,76 +78,6 @@ public class SignalsViewer extends TableViewer
|
||||||
columns[2].setWidth( pc.convertWidthInCharsToPixels( 15 ) );
|
columns[2].setWidth( pc.convertWidthInCharsToPixels( 15 ) );
|
||||||
columns[3].setWidth( pc.convertWidthInCharsToPixels( 50 ) );
|
columns[3].setWidth( pc.convertWidthInCharsToPixels( 50 ) );
|
||||||
|
|
||||||
CellEditor cellEditor = new ComboBoxCellEditor( table, new String[]{ YES_VALUE, NO_VALUE } );
|
|
||||||
setCellEditors( new CellEditor[]{ null, cellEditor, cellEditor, null } );
|
|
||||||
setColumnProperties( new String[]{ CP_NAME, CP_PASS, CP_SUSPEND, CP_DESCRIPTION } );
|
setColumnProperties( new String[]{ CP_NAME, CP_PASS, CP_SUSPEND, CP_DESCRIPTION } );
|
||||||
setCellModifier( createCellModifier() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICellModifier createCellModifier()
|
|
||||||
{
|
|
||||||
return new ICellModifier()
|
|
||||||
{
|
|
||||||
public boolean canModify( Object element, String property )
|
|
||||||
{
|
|
||||||
if ( element instanceof ICSignal )
|
|
||||||
{
|
|
||||||
return ((ICSignal)element).getDebugTarget().isSuspended();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue( Object element, String property )
|
|
||||||
{
|
|
||||||
if ( element instanceof ICSignal )
|
|
||||||
{
|
|
||||||
if ( CP_PASS.equals( property ) )
|
|
||||||
{
|
|
||||||
return ( ((ICSignal)element).isPassEnabled() ) ? new Integer( 0 ) : new Integer( 1 );
|
|
||||||
}
|
|
||||||
else if ( CP_SUSPEND.equals( property ) )
|
|
||||||
{
|
|
||||||
return ( ((ICSignal)element).isStopEnabled() ) ? new Integer( 0 ) : new Integer( 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void modify( Object element, String property, Object value )
|
|
||||||
{
|
|
||||||
IStructuredSelection sel = (IStructuredSelection)getSelection();
|
|
||||||
Object entry = sel.getFirstElement();
|
|
||||||
if ( entry instanceof ICSignal && value instanceof Integer )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
boolean enable = ( ((Integer)value).intValue() == 0 );
|
|
||||||
if ( CP_PASS.equals( property ) )
|
|
||||||
{
|
|
||||||
((ICSignal)entry).setPassEnabled( enable );
|
|
||||||
}
|
|
||||||
else if ( CP_SUSPEND.equals( property ) )
|
|
||||||
{
|
|
||||||
((ICSignal)entry).setStopEnabled( enable );
|
|
||||||
}
|
|
||||||
refresh( entry );
|
|
||||||
}
|
|
||||||
catch( DebugException e )
|
|
||||||
{
|
|
||||||
Display.getCurrent().beep();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IDebugExceptionHandler getExceptionHandler()
|
|
||||||
{
|
|
||||||
return fExceptionHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setExceptionHandler( IDebugExceptionHandler handler )
|
|
||||||
{
|
|
||||||
fExceptionHandler = handler;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target=Unable to deliver the signal ''{0}'' to the target.
|
internal.ui.actions.SignalActionDelegate.Unable_to_deliver_signal_to_target=Unable to deliver the signal to the target.
|
||||||
internal.ui.actions.SignalActionDelegate.Operation_failed=Operation failed.
|
internal.ui.actions.SignalActionDelegate.Operation_failed=Operation failed.
|
||||||
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_checkbox=Show &Type Names
|
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_checkbox=Show &Type Names
|
||||||
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_tooltip=Show Type Names
|
internal.ui.actions.ShowRegisterTypesAction.Show_Type_Names_tooltip=Show Type Names
|
||||||
|
|
Loading…
Add table
Reference in a new issue