mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Replaced the "Signal Properties" dialog by the standard property page.
This commit is contained in:
parent
9551479479
commit
aa6f9b5a00
10 changed files with 214 additions and 207 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2004-10-15 Mikhail Khodjaiants
|
||||||
|
Replaced the "Signal Properties" dialog by the standard property page.
|
||||||
|
* plugin.xml
|
||||||
|
* plugin.properties
|
||||||
|
* CDebugUIMessages.properties
|
||||||
|
* CDTDebugModelPresentation.java
|
||||||
|
* ActionMessages.properties
|
||||||
|
* SignalPropertiesActionDelegate.java
|
||||||
|
* PropertyPageMessages.properties
|
||||||
|
* SignalPropertyPage.java: new
|
||||||
|
* SignalPropertiesDialog.java: removed
|
||||||
|
|
||||||
2004-10-08 Mikhail Khodjaiants
|
2004-10-08 Mikhail Khodjaiants
|
||||||
Added the bookkeeping of registers and register groups.
|
Added the bookkeeping of registers and register groups.
|
||||||
* CDebugImages.java
|
* CDebugImages.java
|
||||||
|
|
|
@ -122,3 +122,4 @@ DebuggingCContext.description=Debugging C/C++ Programs
|
||||||
|
|
||||||
CommonBreakpointPage.label=Common
|
CommonBreakpointPage.label=Common
|
||||||
FilteringBreakpointPage.label=Filtering
|
FilteringBreakpointPage.label=Filtering
|
||||||
|
CommonSignalPage.label=Common
|
||||||
|
|
|
@ -1109,6 +1109,11 @@
|
||||||
class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointFilteringPage"
|
class="org.eclipse.cdt.debug.internal.ui.propertypages.CBreakpointFilteringPage"
|
||||||
name="%FilteringBreakpointPage.label"
|
name="%FilteringBreakpointPage.label"
|
||||||
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.filtering"/>
|
id="org.eclipse.cdt.debug.ui.propertypages.breakpoint.filtering"/>
|
||||||
|
<page
|
||||||
|
objectClass="org.eclipse.cdt.debug.core.model.ICSignal"
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.propertypages.SignalPropertyPage"
|
||||||
|
name="%CommonSignalPage.label"
|
||||||
|
id="org.eclipse.cdt.debug.ui.propertypages.signal.common"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="org.eclipse.cdt.debug.ui.editors"
|
id="org.eclipse.cdt.debug.ui.editors"
|
||||||
|
@ -1275,7 +1280,8 @@
|
||||||
class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
|
class="org.eclipse.cdt.debug.internal.ui.CBreakpointWorkbenchAdapterFactory"
|
||||||
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
adaptableType="org.eclipse.cdt.debug.core.model.ICBreakpoint">
|
||||||
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
||||||
</factory>
|
</factory>
dt.debug.core.model.ICSignal"/>
|
||||||
|
<adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.themes">
|
point="org.eclipse.ui.themes">
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
|
import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
|
||||||
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
|
||||||
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
import org.eclipse.cdt.debug.core.model.ICStackFrame;
|
||||||
import org.eclipse.cdt.debug.core.model.ICThread;
|
import org.eclipse.cdt.debug.core.model.ICThread;
|
||||||
import org.eclipse.cdt.debug.core.model.ICType;
|
import org.eclipse.cdt.debug.core.model.ICType;
|
||||||
|
@ -307,6 +308,10 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
label.append( getSharedLibraryText( (ICSharedLibrary)element, showQualified ) );
|
label.append( getSharedLibraryText( (ICSharedLibrary)element, showQualified ) );
|
||||||
return label.toString();
|
return label.toString();
|
||||||
}
|
}
|
||||||
|
if ( element instanceof ICSignal ) {
|
||||||
|
label.append( getSignalText( (ICSignal)element ) );
|
||||||
|
return label.toString();
|
||||||
|
}
|
||||||
if ( element instanceof IRegisterGroup ) {
|
if ( element instanceof IRegisterGroup ) {
|
||||||
label.append( ((IRegisterGroup)element).getName() );
|
label.append( ((IRegisterGroup)element).getName() );
|
||||||
return label.toString();
|
return label.toString();
|
||||||
|
@ -594,6 +599,17 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getSignalText( ICSignal signal ) {
|
||||||
|
StringBuffer sb = new StringBuffer( CDebugUIMessages.getString( "CDTDebugModelPresentation.12" ) ); //$NON-NLS-1$
|
||||||
|
try {
|
||||||
|
String name = signal.getName();
|
||||||
|
sb.append( " \'" ).append( name ).append( '\'' ); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plug in the single argument to the resource String for the key to get a formatted resource String.
|
* Plug in the single argument to the resource String for the key to get a formatted resource String.
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,7 @@ CDTDebugModelPresentation.16=: Breakpoint hit.
|
||||||
CDTDebugModelPresentation.17=: Shared library event.
|
CDTDebugModelPresentation.17=: Shared library event.
|
||||||
CDTDebugModelPresentation.18=Thread [{0}] (Suspended{1})
|
CDTDebugModelPresentation.18=Thread [{0}] (Suspended{1})
|
||||||
CDTDebugModelPresentation.19=Thread [{0}]
|
CDTDebugModelPresentation.19=Thread [{0}]
|
||||||
|
CDTDebugModelPresentation.12=signal
|
||||||
CDTDebugModelPresentation.20=at
|
CDTDebugModelPresentation.20=at
|
||||||
CDTDebugModelPresentation.21=<symbol is not available>
|
CDTDebugModelPresentation.21=<symbol is not available>
|
||||||
CDTDebugModelPresentation.22=(disabled)
|
CDTDebugModelPresentation.22=(disabled)
|
||||||
|
|
|
@ -17,17 +17,11 @@ LoadSymbolsForAllActionDelegate.Error(s)_occurred_loading_the_symbols_1=Error(s)
|
||||||
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
|
LoadSymbolsForAllAction.Load_Symbols_For_All_2=Load Symbols For All
|
||||||
LoadSymbolsForAllActionDelegate.Error_1=Error
|
LoadSymbolsForAllActionDelegate.Error_1=Error
|
||||||
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.
|
|
||||||
SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal.
|
SignalZeroWorkbenchActionDelegate.0=Exceptions occurred attempting to resume without signal.
|
||||||
SignalZeroWorkbenchActionDelegate.1=Resume without signal failed.
|
SignalZeroWorkbenchActionDelegate.1=Resume without signal failed.
|
||||||
SignalZeroWorkbenchActionDelegate.2=Resume Without Signal
|
SignalZeroWorkbenchActionDelegate.2=Resume Without Signal
|
||||||
SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal.
|
SignalZeroObjectActionDelegate.0=Unable to resume ignoring the signal.
|
||||||
SignalZeroObjectActionDelegate.1=Operation failed.
|
SignalZeroObjectActionDelegate.1=Operation failed.
|
||||||
SignalPropertiesActionDelegate.Unable_to_change_signal_properties_1=Unable to change signal properties.
|
|
||||||
SignalPropertiesActionDelegate.Operation_failed_1=Operation failed.
|
|
||||||
RunToLineActionDelegate.Error_1=Error
|
RunToLineActionDelegate.Error_1=Error
|
||||||
RunToLineActionDelegate.Operation_failed_1=Operation failed.
|
RunToLineActionDelegate.Operation_failed_1=Operation failed.
|
||||||
RunToLineAdapter.Empty_editor_1=Empty editor
|
RunToLineAdapter.Empty_editor_1=Empty editor
|
||||||
|
|
|
@ -12,19 +12,16 @@ package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.ICSignal;
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
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.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
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.IObjectActionDelegate;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.IWorkbenchWindow;
|
|
||||||
import org.eclipse.ui.actions.ActionDelegate;
|
import org.eclipse.ui.actions.ActionDelegate;
|
||||||
|
import org.eclipse.ui.dialogs.PropertyDialogAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal Properties action delegate.
|
* Signal Properties action delegate.
|
||||||
|
@ -32,7 +29,6 @@ import org.eclipse.ui.actions.ActionDelegate;
|
||||||
public class SignalPropertiesActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
public class SignalPropertiesActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
||||||
|
|
||||||
private ICSignal fSignal;
|
private ICSignal fSignal;
|
||||||
private SignalPropertiesDialog fDialog;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SignalPropertiesActionDelegate.
|
* Constructor for SignalPropertiesActionDelegate.
|
||||||
|
@ -68,6 +64,7 @@ public class SignalPropertiesActionDelegate extends ActionDelegate implements IO
|
||||||
protected ICSignal getSignal() {
|
protected ICSignal getSignal() {
|
||||||
return this.fSignal;
|
return this.fSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSignal( ICSignal signal ) {
|
private void setSignal( ICSignal signal ) {
|
||||||
this.fSignal = signal;
|
this.fSignal = signal;
|
||||||
}
|
}
|
||||||
|
@ -76,67 +73,21 @@ public class SignalPropertiesActionDelegate extends ActionDelegate implements IO
|
||||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||||
*/
|
*/
|
||||||
public void run( IAction action ) {
|
public void run( IAction action ) {
|
||||||
if ( getSignal() != null ) {
|
PropertyDialogAction propertyAction = new PropertyDialogAction( CDebugUIPlugin.getActiveWorkbenchShell(), new ISelectionProvider() {
|
||||||
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
|
||||||
DebugException.REQUEST_FAILED,
|
public void addSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||||
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() );
|
public ISelection getSelection() {
|
||||||
|
return new StructuredSelection( getSignal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSelectionChangedListener( ISelectionChangedListener listener ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelection( ISelection selection ) {
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
if ( !ms.isOK() ) {
|
propertyAction.run();
|
||||||
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 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
/**********************************************************************
|
|
||||||
* 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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,3 +30,9 @@ CBreakpointPropertyPage.17=&Ignore count:
|
||||||
CBreakpointPropertyPage.18=Type:
|
CBreakpointPropertyPage.18=Type:
|
||||||
CBreakpointPropertyPage.19=Enabled
|
CBreakpointPropertyPage.19=Enabled
|
||||||
ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
|
ThreadFilterEditor.0=&Restrict to Selected Targets and Threads:
|
||||||
|
SignalPropertyPage.0=Description: {0}.
|
||||||
|
SignalPropertyPage.1=Pass this signal to the program.
|
||||||
|
SignalPropertyPage.2=Suspend the program when this signal happens.
|
||||||
|
SignalPropertyPage.3=Error
|
||||||
|
SignalPropertyPage.4=Operation failed.
|
||||||
|
SignalPropertyPage.5=Unable to change signal properties.
|
||||||
|
|
|
@ -0,0 +1,152 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.propertypages;
|
||||||
|
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import org.eclipse.cdt.debug.core.model.ICSignal;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
|
||||||
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.BusyIndicator;
|
||||||
|
import org.eclipse.swt.graphics.Font;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.ui.dialogs.PropertyPage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The property page for a signal.
|
||||||
|
*/
|
||||||
|
public class SignalPropertyPage extends PropertyPage {
|
||||||
|
|
||||||
|
private SelectionButtonDialogField fPassButton;
|
||||||
|
private SelectionButtonDialogField fStopButton;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
protected Control createContents( Composite parent ) {
|
||||||
|
noDefaultAndApplyButton();
|
||||||
|
Composite composite = new Composite( parent, SWT.NONE );
|
||||||
|
Font font = parent.getFont();
|
||||||
|
composite.setFont( font );
|
||||||
|
composite.setLayout( new GridLayout() );
|
||||||
|
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
|
||||||
|
|
||||||
|
// Create description field
|
||||||
|
try {
|
||||||
|
String description = getSignal().getDescription();
|
||||||
|
Label label = new Label( composite, SWT.WRAP );
|
||||||
|
label.setText( MessageFormat.format( PropertyPageMessages.getString( "SignalPropertyPage.0" ), new String[] { description } ) ); //$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 );
|
||||||
|
}
|
||||||
|
catch( DebugException e1 ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create pass button
|
||||||
|
try {
|
||||||
|
boolean pass = getSignal().isPassEnabled();
|
||||||
|
fPassButton = new SelectionButtonDialogField( SWT.CHECK );
|
||||||
|
fPassButton.setLabelText( PropertyPageMessages.getString( "SignalPropertyPage.1" ) ); //$NON-NLS-1$
|
||||||
|
fPassButton.setSelection( pass );
|
||||||
|
fPassButton.setEnabled( getSignal().canModify() );
|
||||||
|
fPassButton.doFillIntoGrid( composite, 1 );
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create stop button
|
||||||
|
try {
|
||||||
|
boolean stop = getSignal().isStopEnabled();
|
||||||
|
fStopButton = new SelectionButtonDialogField( SWT.CHECK );
|
||||||
|
fStopButton.setLabelText( PropertyPageMessages.getString( "SignalPropertyPage.2" ) ); //$NON-NLS-1$
|
||||||
|
fStopButton.setSelection( stop );
|
||||||
|
fStopButton.setEnabled( getSignal().canModify() );
|
||||||
|
fStopButton.doFillIntoGrid( composite, 1 );
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
setValid( true );
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SelectionButtonDialogField getPassButton() {
|
||||||
|
return fPassButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected SelectionButtonDialogField getStopButton() {
|
||||||
|
return fStopButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICSignal getSignal() {
|
||||||
|
return (ICSignal)getElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.preference.IPreferencePage#performOk()
|
||||||
|
*/
|
||||||
|
public boolean performOk() {
|
||||||
|
boolean result = super.performOk();
|
||||||
|
if ( result ) {
|
||||||
|
try {
|
||||||
|
setSignalProperties();
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
DebugUIPlugin.errorDialog( getShell(), PropertyPageMessages.getString( "SignalPropertyPage.3" ), PropertyPageMessages.getString( "SignalPropertyPage.4" ), e.getStatus() ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSignalProperties() throws DebugException {
|
||||||
|
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
|
||||||
|
DebugException.REQUEST_FAILED,
|
||||||
|
PropertyPageMessages.getString( "SignalPropertyPage.5" ), //$NON-NLS-1$
|
||||||
|
null );
|
||||||
|
BusyIndicator.showWhile( Display.getCurrent(),
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if ( !getSignal().canModify() )
|
||||||
|
return;
|
||||||
|
if ( getPassButton() != null ) {
|
||||||
|
try {
|
||||||
|
getSignal().setPassEnabled( getPassButton().isSelected() );
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
ms.merge( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( getStopButton() != null ) {
|
||||||
|
try {
|
||||||
|
getSignal().setStopEnabled( getStopButton().isSelected() );
|
||||||
|
}
|
||||||
|
catch( DebugException e ) {
|
||||||
|
ms.merge( e.getStatus() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
if ( !ms.isOK() ) {
|
||||||
|
throw new DebugException( ms );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue