mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 01:35:39 +02:00
Bug 341175 - Address FindBugs issues in debug.core and debug.ui
This commit is contained in:
parent
ea04df9522
commit
eeb3c6825a
26 changed files with 293 additions and 301 deletions
|
@ -237,7 +237,7 @@ public class BreakpointActionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveActionData() {
|
public void saveActionData() {
|
||||||
String actionData = new String(""); //$NON-NLS-1$
|
String actionData = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
|
|
|
@ -455,11 +455,11 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBreakpoint getBreakpoint( ICDIBreakpoint cdiBreakpoint ) {
|
public IBreakpoint getBreakpoint( ICDIBreakpoint cdiBreakpoint ) {
|
||||||
Object b = null;
|
ICBreakpoint b;
|
||||||
synchronized ( getBreakpointMap() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
b = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
|
b = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
|
||||||
}
|
}
|
||||||
return ( b instanceof IBreakpoint ) ? (IBreakpoint)b : null;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -781,7 +781,7 @@ public class CBreakpointManager implements IBreakpointsListener, IBreakpointMana
|
||||||
|
|
||||||
ArrayList installedCDIBplist = new ArrayList();
|
ArrayList installedCDIBplist = new ArrayList();
|
||||||
ArrayList installedCBplist = new ArrayList();
|
ArrayList installedCBplist = new ArrayList();
|
||||||
ICBreakpoint[] breakpoints = new ICBreakpoint[0];
|
ICBreakpoint[] breakpoints;
|
||||||
synchronized( getBreakpointMap() ) {
|
synchronized( getBreakpointMap() ) {
|
||||||
breakpoints = getBreakpointMap().getAllCBreakpoints();
|
breakpoints = getBreakpointMap().getAllCBreakpoints();
|
||||||
for ( int i = 0; i < breakpoints.length; ++i ) {
|
for ( int i = 0; i < breakpoints.length; ++i ) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class CGlobalVariableManager implements ICGlobalVariableManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICGlobalVariable[] globals = new ICGlobalVariable[0];
|
ICGlobalVariable[] globals;
|
||||||
synchronized( fGlobals ) {
|
synchronized( fGlobals ) {
|
||||||
globals = fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] );
|
globals = fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] );
|
||||||
fGlobals.clear();
|
fGlobals.clear();
|
||||||
|
|
|
@ -331,7 +331,7 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
|
||||||
fSeverity = severity;
|
fSeverity = severity;
|
||||||
fMessage = message;
|
fMessage = message;
|
||||||
if ( fMessage != null )
|
if ( fMessage != null )
|
||||||
fMessage.trim();
|
fMessage = fMessage.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void resetStatus() {
|
protected void resetStatus() {
|
||||||
|
|
|
@ -1438,7 +1438,6 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
*/
|
*/
|
||||||
public IGlobalVariableDescriptor[] getGlobals() throws DebugException {
|
public IGlobalVariableDescriptor[] getGlobals() throws DebugException {
|
||||||
ICDITarget cdiTarget = getCDITarget();
|
ICDITarget cdiTarget = getCDITarget();
|
||||||
IGlobalVariableDescriptor[] globals = new IGlobalVariableDescriptor[0];
|
|
||||||
// If the backend can give us the globals...
|
// If the backend can give us the globals...
|
||||||
boolean hasCDIGlobals = false;
|
boolean hasCDIGlobals = false;
|
||||||
ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
|
ArrayList<IGlobalVariableDescriptor> list = new ArrayList<IGlobalVariableDescriptor>();
|
||||||
|
@ -1458,8 +1457,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
list.addAll(getCFileGlobals(file));
|
list.addAll(getCFileGlobals(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globals = list.toArray(new IGlobalVariableDescriptor[list.size()]);
|
return list.toArray(new IGlobalVariableDescriptor[list.size()]);
|
||||||
return globals;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<IGlobalVariableDescriptor> getCFileGlobals(IBinaryObject file) {
|
private List<IGlobalVariableDescriptor> getCFileGlobals(IBinaryObject file) {
|
||||||
|
@ -1952,7 +1950,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void stopInMain() throws DebugException {
|
protected void stopInMain() throws DebugException {
|
||||||
String mainSymbol = new String(ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT);
|
String mainSymbol = ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT;
|
||||||
try {
|
try {
|
||||||
final ICDITarget cdiTarget = getCDITarget();
|
final ICDITarget cdiTarget = getCDITarget();
|
||||||
if (cdiTarget != null) {
|
if (cdiTarget != null) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
|
|
||||||
private int fType = 0;
|
private int fType = 0;
|
||||||
|
|
||||||
private ICElement fCElement;
|
private Binary fBinary;
|
||||||
|
|
||||||
private ICDIObject fCDIObject;
|
private ICDIObject fCDIObject;
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
private CModule( int type, CDebugTarget target, IPath path ) {
|
private CModule( int type, CDebugTarget target, IPath path ) {
|
||||||
super( target );
|
super( target );
|
||||||
fType = type;
|
fType = type;
|
||||||
fCElement = createBinary(path);
|
fBinary = createBinary(path);
|
||||||
fCDIObject = null;
|
fCDIObject = null;
|
||||||
fImageName = path;
|
fImageName = path;
|
||||||
fSymbolsFileName = path;
|
fSymbolsFileName = path;
|
||||||
|
@ -84,7 +84,7 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
fType = type;
|
fType = type;
|
||||||
if ( cdiObject instanceof ICDISharedLibrary ) {
|
if ( cdiObject instanceof ICDISharedLibrary ) {
|
||||||
ICDISharedLibrary cdiSharedLib = (ICDISharedLibrary)cdiObject;
|
ICDISharedLibrary cdiSharedLib = (ICDISharedLibrary)cdiObject;
|
||||||
fCElement = createBinary(new Path(cdiSharedLib.getFileName()));
|
fBinary = createBinary(new Path(cdiSharedLib.getFileName()));
|
||||||
}
|
}
|
||||||
fCDIObject = cdiObject;
|
fCDIObject = cdiObject;
|
||||||
fImageName = ( ( cdiObject instanceof ICDISharedLibrary ) ) ? new Path( ((ICDISharedLibrary)cdiObject).getFileName() ) : new Path( CoreModelMessages.getString( "CModule.0" ) ); //$NON-NLS-1$
|
fImageName = ( ( cdiObject instanceof ICDISharedLibrary ) ) ? new Path( ((ICDISharedLibrary)cdiObject).getFileName() ) : new Path( CoreModelMessages.getString( "CModule.0" ) ); //$NON-NLS-1$
|
||||||
|
@ -203,8 +203,8 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
if (fCDIObject instanceof ICDISharedLibrary)
|
if (fCDIObject instanceof ICDISharedLibrary)
|
||||||
return ((ICDISharedLibrary)fCDIObject).areSymbolsLoaded();
|
return ((ICDISharedLibrary)fCDIObject).areSymbolsLoaded();
|
||||||
|
|
||||||
if (fCElement instanceof IBinary)
|
if (fBinary != null)
|
||||||
return ((IBinary)fCElement).hasDebug();
|
return fBinary.hasDebug();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -227,14 +227,14 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
* @see org.eclipse.cdt.debug.core.model.ICModule#getPlatform()
|
* @see org.eclipse.cdt.debug.core.model.ICModule#getPlatform()
|
||||||
*/
|
*/
|
||||||
public String getPlatform() {
|
public String getPlatform() {
|
||||||
return ( fCElement instanceof IBinary ) ? ((IBinary)fCElement).getCPU() : CoreModelMessages.getString( "CModule.1" ); //$NON-NLS-1$
|
return ( fBinary != null ) ? fBinary.getCPU() : CoreModelMessages.getString( "CModule.1" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.model.ICModule#isLittleEndian()
|
* @see org.eclipse.cdt.debug.core.model.ICModule#isLittleEndian()
|
||||||
*/
|
*/
|
||||||
public boolean isLittleEndian() {
|
public boolean isLittleEndian() {
|
||||||
return ( fCElement instanceof IBinary ) ? ((IBinary)fCElement).isLittleEndian() : ((CDebugTarget)getDebugTarget()).isLittleEndian();
|
return ( fBinary != null ) ? fBinary.isLittleEndian() : ((CDebugTarget)getDebugTarget()).isLittleEndian();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -248,7 +248,7 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
* @see org.eclipse.cdt.debug.core.model.ICModule#getCPU()
|
* @see org.eclipse.cdt.debug.core.model.ICModule#getCPU()
|
||||||
*/
|
*/
|
||||||
public String getCPU() {
|
public String getCPU() {
|
||||||
return ( fCElement instanceof IBinary ) ? ((IBinary)fCElement).getCPU() : null;
|
return ( fBinary != null ) ? fBinary.getCPU() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -273,7 +273,7 @@ public class CModule extends CDebugElement implements ICModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICElement getCElement() {
|
protected ICElement getCElement() {
|
||||||
return fCElement;
|
return fBinary;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSymbolsFromFile(IPath path) throws DebugException {
|
private void loadSymbolsFromFile(IPath path) throws DebugException {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class CType implements ICType {
|
||||||
ICDIType type = getCDIType();
|
ICDIType type = getCDIType();
|
||||||
while( type instanceof ICDIArrayType ) {
|
while( type instanceof ICDIArrayType ) {
|
||||||
++length;
|
++length;
|
||||||
type = ( type instanceof ICDIDerivedType ) ? ((ICDIDerivedType)type).getComponentType() : null;
|
type = ((ICDIDerivedType)type).getComponentType();
|
||||||
}
|
}
|
||||||
int[] dims = new int[length];
|
int[] dims = new int[length];
|
||||||
type = getCDIType();
|
type = getCDIType();
|
||||||
|
|
|
@ -179,16 +179,17 @@ public class CValue extends AbstractCValue {
|
||||||
ICDIValue value = getUnderlyingValue();
|
ICDIValue value = getUnderlyingValue();
|
||||||
if ( value != null ) {
|
if ( value != null ) {
|
||||||
vars = value.getVariables();
|
vars = value.getVariables();
|
||||||
// Quick fix.
|
|
||||||
// getVariables should return an empty array instead of null.
|
|
||||||
if ( vars == null ) {
|
|
||||||
vars = new ICDIVariable[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( CDIException e ) {
|
catch( CDIException e ) {
|
||||||
requestFailed( e.getMessage(), e );
|
requestFailed( e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getVariables should return an empty array instead of null.
|
||||||
|
if ( vars == null ) {
|
||||||
|
vars = new ICDIVariable[0];
|
||||||
|
}
|
||||||
|
|
||||||
return Arrays.asList( vars );
|
return Arrays.asList( vars );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,11 @@ import org.eclipse.cdt.debug.core.model.IDisassemblyInstruction;
|
||||||
|
|
||||||
public class DisassemblyInstruction extends CDebugElement implements IDisassemblyInstruction {
|
public class DisassemblyInstruction extends CDebugElement implements IDisassemblyInstruction {
|
||||||
|
|
||||||
private BigInteger fBaseElement;
|
|
||||||
private ICDIInstruction fCDIInstruction;
|
private ICDIInstruction fCDIInstruction;
|
||||||
private IAddress fAddress;
|
private IAddress fAddress;
|
||||||
|
|
||||||
public DisassemblyInstruction( CDebugTarget target, BigInteger baseElement, ICDIInstruction instruction ) {
|
public DisassemblyInstruction( CDebugTarget target, BigInteger baseElement, ICDIInstruction instruction ) {
|
||||||
super( target );
|
super( target );
|
||||||
fBaseElement = baseElement;
|
|
||||||
fCDIInstruction = instruction;
|
fCDIInstruction = instruction;
|
||||||
fAddress = target.getAddressFactory().createAddress( fCDIInstruction.getAdress() );
|
fAddress = target.getAddressFactory().createAddress( fCDIInstruction.getAdress() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class CSourceLookupDirector extends AbstractSourceLookupDirector {
|
||||||
if (container instanceof CProjectSourceContainer && project.equals(((CProjectSourceContainer) container).getProject())) {
|
if (container instanceof CProjectSourceContainer && project.equals(((CProjectSourceContainer) container).getProject())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (container instanceof ProjectSourceContainer && project.equals(((CProjectSourceContainer) container).getProject())) {
|
if (container instanceof ProjectSourceContainer && project.equals(((ProjectSourceContainer) container).getProject())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -685,7 +685,7 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
||||||
reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.5" ), new String[]{ sigInfo.getName(), sigInfo.getDescription() } ); //$NON-NLS-1$
|
reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.5" ), new String[]{ sigInfo.getName(), sigInfo.getDescription() } ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
else if ( info != null && info instanceof ICDIExitInfo ) {
|
else if ( info != null && info instanceof ICDIExitInfo ) {
|
||||||
reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.6" ), new Integer[] { new Integer( ((ICDIExitInfo)info).getCode() ) } ); //$NON-NLS-1$
|
reason = ' ' + MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.6" ), new Integer[] { Integer.valueOf( ((ICDIExitInfo)info).getCode() ) } ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return MessageFormat.format( label, new String[] { target.getName(), reason } );
|
return MessageFormat.format( label, new String[] { target.getName(), reason } );
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class AddWatchpointDialog extends Dialog implements ModifyListener, Selec
|
||||||
private boolean fRangeInitialEnable;
|
private boolean fRangeInitialEnable;
|
||||||
private Button fRangeEnableButton;
|
private Button fRangeEnableButton;
|
||||||
private Text fRangeField;
|
private Text fRangeField;
|
||||||
private String fRange = new String();
|
private String fRange = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private Button fChkBtnWrite;
|
private Button fChkBtnWrite;
|
||||||
private Button fChkBtnRead;
|
private Button fChkBtnRead;
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class SelectionButtonDialogFieldGroup extends DialogField {
|
||||||
fButtonsSelected[i]= false;
|
fButtonsSelected[i]= false;
|
||||||
fButtonsEnabled[i]= true;
|
fButtonsEnabled[i]= true;
|
||||||
}
|
}
|
||||||
if (fButtonsStyle == SWT.RADIO) {
|
if (buttonsStyle == SWT.RADIO) {
|
||||||
fButtonsSelected[0]= true;
|
fButtonsSelected[0]= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@ public class DisassemblyDisplayModeHandler extends AbstractHandler implements IE
|
||||||
if ( s instanceof IStructuredSelection ) {
|
if ( s instanceof IStructuredSelection ) {
|
||||||
Object o = ((IStructuredSelection)s).getFirstElement();
|
Object o = ((IStructuredSelection)s).getFirstElement();
|
||||||
if ( o instanceof DisassemblyEditorInput ) {
|
if ( o instanceof DisassemblyEditorInput ) {
|
||||||
IDocumentProvider dp = CDebugUIPlugin.getDefault().getDisassemblyEditorManager().getDocumentProvider();
|
DisassemblyDocumentProvider dp = CDebugUIPlugin.getDefault().getDisassemblyEditorManager().getDocumentProvider();
|
||||||
if ( dp instanceof DisassemblyDocumentProvider ) {
|
if ( dp != null ) {
|
||||||
return (DisassemblyEditorPresentation)((DisassemblyDocumentProvider)dp).getDocumentPresentation( o );
|
return (DisassemblyEditorPresentation)dp.getDocumentPresentation( o );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,6 @@ public final class ViewIDCounterManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Integer(0);
|
return Integer.valueOf(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
* Set the values of the component widgets based on the values in the preference store
|
* Set the values of the component widgets based on the values in the preference store
|
||||||
*/
|
*/
|
||||||
private void setValues() {
|
private void setValues() {
|
||||||
IPreferenceStore store = getPreferenceStore();
|
|
||||||
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
||||||
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||||
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
||||||
|
@ -299,7 +298,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
* Store the preference values based on the state of the component widgets
|
* Store the preference values based on the state of the component widgets
|
||||||
*/
|
*/
|
||||||
private void storeValues() {
|
private void storeValues() {
|
||||||
IPreferenceStore store = getPreferenceStore();
|
|
||||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) );
|
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT, getFormatId( fVariableFormatCombo.getSelectionIndex() ) );
|
||||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.getSelectionIndex() ) );
|
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT, getFormatId( fExpressionFormatCombo.getSelectionIndex() ) );
|
||||||
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId( fRegisterFormatCombo.getSelectionIndex() ) );
|
CDebugCorePlugin.getDefault().getPluginPreferences().setValue( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT, getFormatId( fRegisterFormatCombo.getSelectionIndex() ) );
|
||||||
|
@ -318,7 +316,6 @@ public class CDebugPreferencePage extends PreferencePage implements IWorkbenchPr
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultValues() {
|
private void setDefaultValues() {
|
||||||
IPreferenceStore store = getPreferenceStore();
|
|
||||||
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
fVariableFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ) );
|
||||||
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
fExpressionFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_EXPRESSION_FORMAT ) ) );
|
||||||
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
fRegisterFormatCombo.select( getFormatIndex( CDebugCorePlugin.getDefault().getPluginPreferences().getDefaultInt( ICDebugConstants.PREF_DEFAULT_REGISTER_FORMAT ) ) );
|
||||||
|
|
|
@ -72,10 +72,10 @@ public class ModuleProperties {
|
||||||
*/
|
*/
|
||||||
private ModuleProperties( ICModule module ) {
|
private ModuleProperties( ICModule module ) {
|
||||||
fProperties = new ArrayList( 10 );
|
fProperties = new ArrayList( 10 );
|
||||||
fProperties.add( new Property( TYPE, new Integer( module.getType() ) ) );
|
fProperties.add( new Property( TYPE, Integer.valueOf(module.getType()) ) );
|
||||||
fProperties.add( new Property( CPU, module.getCPU() ) );
|
fProperties.add( new Property( CPU, module.getCPU() ) );
|
||||||
fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) );
|
fProperties.add( new Property( BASE_ADDRESS, module.getBaseAddress() ) );
|
||||||
fProperties.add( new Property( SIZE, new Long( module.getSize() ) ) );
|
fProperties.add( new Property( SIZE, Long.valueOf( module.getSize() ) ) );
|
||||||
fProperties.add( new Property( SYMBOLS_LOADED, Boolean.valueOf( module.areSymbolsLoaded() ) ) );
|
fProperties.add( new Property( SYMBOLS_LOADED, Boolean.valueOf( module.areSymbolsLoaded() ) ) );
|
||||||
fProperties.add( new Property( SYMBOLS_FILE, module.getSymbolsFileName() ) );
|
fProperties.add( new Property( SYMBOLS_FILE, module.getSymbolsFileName() ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,14 +83,14 @@ abstract class BaseViewer extends TreeViewer {
|
||||||
Tree tree = getTree();
|
Tree tree = getTree();
|
||||||
|
|
||||||
// save the column order
|
// save the column order
|
||||||
String columnOrder = ""; //$NON-NLS-1$
|
StringBuilder columnOrder = new StringBuilder(); //$NON-NLS-1$
|
||||||
for (int index : tree.getColumnOrder()) {
|
for (int index : tree.getColumnOrder()) {
|
||||||
columnOrder += ","; //$NON-NLS-1$
|
columnOrder.append(","); //$NON-NLS-1$
|
||||||
columnOrder += Integer.toString(index);
|
columnOrder.append(Integer.toString(index));
|
||||||
}
|
}
|
||||||
// trim the leading comma
|
// trim the leading comma
|
||||||
columnOrder = columnOrder.substring(1);
|
columnOrder.deleteCharAt(0);
|
||||||
preferences.setValue(getColumnOrderKey(), columnOrder);
|
preferences.setValue(getColumnOrderKey(), columnOrder.toString());
|
||||||
|
|
||||||
// save which column was sorted and in which direction
|
// save which column was sorted and in which direction
|
||||||
TreeColumn sortedColumn = tree.getSortColumn();
|
TreeColumn sortedColumn = tree.getSortColumn();
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class AddMemoryBlockDialog extends TrayDialog implements ModifyListener,
|
||||||
GC gc = new GC(fAddressInput);
|
GC gc = new GC(fAddressInput);
|
||||||
FontMetrics fm = gc.getFontMetrics();
|
FontMetrics fm = gc.getFontMetrics();
|
||||||
// Give enough room for a 64 bit hex address (25 is a guess at the combobox selector)
|
// Give enough room for a 64 bit hex address (25 is a guess at the combobox selector)
|
||||||
gridData.minimumWidth = gridData.minimumWidth = 18 * fm.getAverageCharWidth() + 25;
|
gridData.minimumWidth = 18 * fm.getAverageCharWidth() + 25;
|
||||||
gc.dispose();
|
gc.dispose();
|
||||||
fAddressInput.setLayoutData(gridData);
|
fAddressInput.setLayoutData(gridData);
|
||||||
fAddressInput.addModifyListener(this);
|
fAddressInput.addModifyListener(this);
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
public class ExternalToolAction extends AbstractBreakpointAction {
|
public class ExternalToolAction extends AbstractBreakpointAction {
|
||||||
|
|
||||||
private String externalToolName = new String(""); //$NON-NLS-1$
|
private String externalToolName = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
|
public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) {
|
||||||
IStatus errorStatus = null;
|
IStatus errorStatus = null;
|
||||||
|
@ -96,7 +96,7 @@ public class ExternalToolAction extends AbstractBreakpointAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMemento() {
|
public String getMemento() {
|
||||||
String executeData = new String(""); //$NON-NLS-1$
|
String executeData = ""; //$NON-NLS-1$
|
||||||
if (externalToolName != null) {
|
if (externalToolName != null) {
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class ExternalToolActionComposite extends Composite {
|
||||||
public ILaunchConfiguration[] getLaunchConfigurations() {
|
public ILaunchConfiguration[] getLaunchConfigurations() {
|
||||||
ArrayList onlyExternalTools = new ArrayList();
|
ArrayList onlyExternalTools = new ArrayList();
|
||||||
ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager();
|
ILaunchManager lcm = DebugPlugin.getDefault().getLaunchManager();
|
||||||
ILaunchConfiguration[] launchConfigurations = new ILaunchConfiguration[0];
|
ILaunchConfiguration[] launchConfigurations;
|
||||||
try {
|
try {
|
||||||
launchConfigurations = lcm.getLaunchConfigurations();
|
launchConfigurations = lcm.getLaunchConfigurations();
|
||||||
for (int i = 0; i < launchConfigurations.length; i++) {
|
for (int i = 0; i < launchConfigurations.length; i++) {
|
||||||
|
@ -205,11 +205,9 @@ public class ExternalToolActionComposite extends Composite {
|
||||||
ILaunchConfiguration config = launchConfigurations[i];
|
ILaunchConfiguration config = launchConfigurations[i];
|
||||||
ILaunchConfigurationType type = config.getType();
|
ILaunchConfigurationType type = config.getType();
|
||||||
boolean priv = false;
|
boolean priv = false;
|
||||||
if (config != null) {
|
try {
|
||||||
try {
|
priv = config.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false);
|
||||||
priv = config.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false);
|
} catch (CoreException e) {
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
if (!priv && type.supportsMode(ILaunchManager.RUN_MODE) && equalCategories(type.getCategory(), "org.eclipse.ui.externaltools") //$NON-NLS-1$
|
if (!priv && type.supportsMode(ILaunchManager.RUN_MODE) && equalCategories(type.getCategory(), "org.eclipse.ui.externaltools") //$NON-NLS-1$
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class LogAction extends AbstractBreakpointAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMemento() {
|
public String getMemento() {
|
||||||
String logData = new String(""); //$NON-NLS-1$
|
String logData = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
public class ResumeAction extends AbstractBreakpointAction {
|
public class ResumeAction extends AbstractBreakpointAction {
|
||||||
|
|
||||||
final int INCRIMENT_MSEC = 100;
|
final static int INCRIMENT_MSEC = 100;
|
||||||
|
|
||||||
int pauseTime = 0;
|
int pauseTime = 0;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class ResumeAction extends AbstractBreakpointAction {
|
||||||
|
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
while (!monitor.isCanceled() && currentTime < endTime ){
|
while (!monitor.isCanceled() && currentTime < endTime ){
|
||||||
monitor.setTaskName(MessageFormat.format(Messages.getString("ResumeAction.SummaryResumeTime"), new Object[] { new Long((endTime - currentTime)/1000) })); //$NON-NLS-1$)
|
monitor.setTaskName(MessageFormat.format(Messages.getString("ResumeAction.SummaryResumeTime"), new Object[] { Long.valueOf((endTime - currentTime)/1000) })); //$NON-NLS-1$)
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
Thread.sleep(INCRIMENT_MSEC);
|
Thread.sleep(INCRIMENT_MSEC);
|
||||||
currentTime = System.currentTimeMillis();
|
currentTime = System.currentTimeMillis();
|
||||||
|
@ -104,7 +104,7 @@ public class ResumeAction extends AbstractBreakpointAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMemento() {
|
public String getMemento() {
|
||||||
String resumeData = new String(""); //$NON-NLS-1$
|
String resumeData = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
|
@ -139,7 +139,7 @@ public class ResumeAction extends AbstractBreakpointAction {
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
if (pauseTime == 0)
|
if (pauseTime == 0)
|
||||||
return Messages.getString("ResumeAction.SummaryImmediately"); //$NON-NLS-1$
|
return Messages.getString("ResumeAction.SummaryImmediately"); //$NON-NLS-1$
|
||||||
return MessageFormat.format(Messages.getString("ResumeAction.SummaryResumeTime"), new Object[] { new Integer(pauseTime) }); //$NON-NLS-1$
|
return MessageFormat.format(Messages.getString("ResumeAction.SummaryResumeTime"), new Object[] { Integer.valueOf(pauseTime) }); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTypeName() {
|
public String getTypeName() {
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class SoundAction extends AbstractBreakpointAction {
|
||||||
|
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
if (soundFile == null)
|
if (soundFile == null)
|
||||||
return new String(""); //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
return soundFile.getAbsolutePath();
|
return soundFile.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class SoundAction extends AbstractBreakpointAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMemento() {
|
public String getMemento() {
|
||||||
String soundData = new String(""); //$NON-NLS-1$
|
String soundData = ""; //$NON-NLS-1$
|
||||||
if (soundFile != null) {
|
if (soundFile != null) {
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
|
|
|
@ -1,237 +1,237 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Nokia and others.
|
* Copyright (c) 2007 Nokia and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Nokia - initial API and implementation
|
* Nokia - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.ui.breakpointactions;
|
package org.eclipse.cdt.debug.ui.breakpointactions;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.transform.OutputKeys;
|
import javax.xml.transform.OutputKeys;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
import javax.xml.transform.TransformerFactory;
|
import javax.xml.transform.TransformerFactory;
|
||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.PlatformObject;
|
import org.eclipse.core.runtime.PlatformObject;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
public class SoundActionPage extends PlatformObject implements IBreakpointActionPage {
|
public class SoundActionPage extends PlatformObject implements IBreakpointActionPage {
|
||||||
|
|
||||||
private static final String SOUND_ACTION_RECENT = "SoundBehaviorDialog.recentSounds"; //$NON-NLS-1$
|
private static final String SOUND_ACTION_RECENT = "SoundBehaviorDialog.recentSounds"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static boolean isWindows() {
|
private static boolean isWindows() {
|
||||||
String os = System.getProperty("os.name"); //$NON-NLS-1$
|
String os = System.getProperty("os.name"); //$NON-NLS-1$
|
||||||
return (os != null && os.toLowerCase().startsWith("win")); //$NON-NLS-1$
|
return (os != null && os.toLowerCase().startsWith("win")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isMacOS() {
|
private static boolean isMacOS() {
|
||||||
String os = System.getProperty("os.name"); //$NON-NLS-1$
|
String os = System.getProperty("os.name"); //$NON-NLS-1$
|
||||||
return (os != null && os.toLowerCase().startsWith("mac")); //$NON-NLS-1$
|
return (os != null && os.toLowerCase().startsWith("mac")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
private SoundActionComposite editor = null;
|
private SoundActionComposite editor = null;
|
||||||
private String mediaPath = ""; //$NON-NLS-1$
|
private String mediaPath = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
private ArrayList recentSounds = new ArrayList();
|
private ArrayList recentSounds = new ArrayList();
|
||||||
|
|
||||||
private SoundAction soundAction;
|
private SoundAction soundAction;
|
||||||
|
|
||||||
public SoundActionPage() {
|
public SoundActionPage() {
|
||||||
if (isWindows())
|
if (isWindows())
|
||||||
mediaPath = "C:\\WINNT\\Media\\"; //$NON-NLS-1$
|
mediaPath = "C:\\WINNT\\Media\\"; //$NON-NLS-1$
|
||||||
if (isMacOS())
|
if (isMacOS())
|
||||||
mediaPath = "/System/Library/Sounds"; //$NON-NLS-1$
|
mediaPath = "/System/Library/Sounds"; //$NON-NLS-1$
|
||||||
|
|
||||||
loadRecentSounds();
|
loadRecentSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionDialogCanceled() {
|
public void actionDialogCanceled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionDialogOK() {
|
public void actionDialogOK() {
|
||||||
saveRecentSounds();
|
saveRecentSounds();
|
||||||
soundAction.setSoundFile(editor.getSoundFile());
|
soundAction.setSoundFile(editor.getSoundFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRecentSound(File soundFile) {
|
public void addRecentSound(File soundFile) {
|
||||||
String soundFilePath = soundFile.getAbsolutePath();
|
String soundFilePath = soundFile.getAbsolutePath();
|
||||||
int removeIndex = -1;
|
int removeIndex = -1;
|
||||||
int fileCount = 0;
|
int fileCount = 0;
|
||||||
for (Iterator iter = recentSounds.iterator(); iter.hasNext() && removeIndex < 0;) {
|
for (Iterator iter = recentSounds.iterator(); iter.hasNext() && removeIndex < 0;) {
|
||||||
File element = (File) iter.next();
|
File element = (File) iter.next();
|
||||||
if (element.getAbsolutePath().equals(soundFilePath))
|
if (element.getAbsolutePath().equals(soundFilePath))
|
||||||
removeIndex = fileCount;
|
removeIndex = fileCount;
|
||||||
fileCount++;
|
fileCount++;
|
||||||
}
|
}
|
||||||
if (removeIndex >= 0)
|
if (removeIndex >= 0)
|
||||||
recentSounds.remove(removeIndex);
|
recentSounds.remove(removeIndex);
|
||||||
recentSounds.add(soundFile);
|
recentSounds.add(soundFile);
|
||||||
if (recentSounds.size() > 10)
|
if (recentSounds.size() > 10)
|
||||||
recentSounds.remove(0);
|
recentSounds.remove(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Composite createComposite(IBreakpointAction action, Composite composite, int style) {
|
public Composite createComposite(IBreakpointAction action, Composite composite, int style) {
|
||||||
this.soundAction = (SoundAction) action;
|
this.soundAction = (SoundAction) action;
|
||||||
loadRecentSounds();
|
loadRecentSounds();
|
||||||
if (soundAction.getSoundFile() == null && recentSounds.size() > 0)
|
if (soundAction.getSoundFile() == null && recentSounds.size() > 0)
|
||||||
soundAction.setSoundFile((File) recentSounds.get(0));
|
soundAction.setSoundFile((File) recentSounds.get(0));
|
||||||
editor = new SoundActionComposite(composite, style, this);
|
editor = new SoundActionComposite(composite, style, this);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMediaPath() {
|
public String getMediaPath() {
|
||||||
return mediaPath;
|
return mediaPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList getRecentSounds() {
|
public ArrayList getRecentSounds() {
|
||||||
return recentSounds;
|
return recentSounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
if (soundAction.getSoundFile() == null)
|
if (soundAction.getSoundFile() == null)
|
||||||
return new String(""); //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
return soundAction.getSoundFile().getAbsolutePath();
|
return soundAction.getSoundFile().getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeRecentSounds() {
|
private void initializeRecentSounds() {
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
String defaultSounds[] = { "chimes.wav", "chord.wav", "ding.wav", "notify.wav", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
String defaultSounds[] = { "chimes.wav", "chord.wav", "ding.wav", "notify.wav", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||||
"tada.wav" }; //$NON-NLS-1$
|
"tada.wav" }; //$NON-NLS-1$
|
||||||
|
|
||||||
for (int i = 0; i < defaultSounds.length; i++) {
|
for (int i = 0; i < defaultSounds.length; i++) {
|
||||||
File soundFile = new File(mediaPath + defaultSounds[i]);
|
File soundFile = new File(mediaPath + defaultSounds[i]);
|
||||||
if (soundFile.exists())
|
if (soundFile.exists())
|
||||||
recentSounds.add(soundFile);
|
recentSounds.add(soundFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isMacOS()) {
|
if (isMacOS()) {
|
||||||
File macSounds = new File(mediaPath);
|
File macSounds = new File(mediaPath);
|
||||||
File[] soundFiles = macSounds.listFiles();
|
File[] soundFiles = macSounds.listFiles();
|
||||||
|
|
||||||
for (int i = 0; i < soundFiles.length; i++) {
|
for (int i = 0; i < soundFiles.length; i++) {
|
||||||
String fileExtension = new Path(soundFiles[i].getAbsolutePath()).getFileExtension();
|
String fileExtension = new Path(soundFiles[i].getAbsolutePath()).getFileExtension();
|
||||||
if (fileExtension.equalsIgnoreCase("aiff") || fileExtension.equalsIgnoreCase("wav")) //$NON-NLS-1$ //$NON-NLS-2$
|
if (fileExtension.equalsIgnoreCase("aiff") || fileExtension.equalsIgnoreCase("wav")) //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
recentSounds.add(soundFiles[i]);
|
recentSounds.add(soundFiles[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveRecentSounds();
|
saveRecentSounds();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadRecentSounds() {
|
private void loadRecentSounds() {
|
||||||
String recentSoundData = CDebugUIPlugin.getDefault().getPreferenceStore().getString(SOUND_ACTION_RECENT);
|
String recentSoundData = CDebugUIPlugin.getDefault().getPreferenceStore().getString(SOUND_ACTION_RECENT);
|
||||||
|
|
||||||
if (recentSoundData == null || recentSoundData.length() == 0) {
|
if (recentSoundData == null || recentSoundData.length() == 0) {
|
||||||
initializeRecentSounds();
|
initializeRecentSounds();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
recentSounds = new ArrayList();
|
recentSounds = new ArrayList();
|
||||||
|
|
||||||
Element root = null;
|
Element root = null;
|
||||||
DocumentBuilder parser;
|
DocumentBuilder parser;
|
||||||
try {
|
try {
|
||||||
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
parser.setErrorHandler(new DefaultHandler());
|
parser.setErrorHandler(new DefaultHandler());
|
||||||
root = parser.parse(new InputSource(new StringReader(recentSoundData))).getDocumentElement();
|
root = parser.parse(new InputSource(new StringReader(recentSoundData))).getDocumentElement();
|
||||||
|
|
||||||
NodeList nodeList = root.getChildNodes();
|
NodeList nodeList = root.getChildNodes();
|
||||||
int entryCount = nodeList.getLength();
|
int entryCount = nodeList.getLength();
|
||||||
|
|
||||||
for (int i = 0; i < entryCount; i++) {
|
for (int i = 0; i < entryCount; i++) {
|
||||||
Node node = nodeList.item(i);
|
Node node = nodeList.item(i);
|
||||||
short type = node.getNodeType();
|
short type = node.getNodeType();
|
||||||
if (type == Node.ELEMENT_NODE) {
|
if (type == Node.ELEMENT_NODE) {
|
||||||
Element subElement = (Element) node;
|
Element subElement = (Element) node;
|
||||||
String nodeName = subElement.getNodeName();
|
String nodeName = subElement.getNodeName();
|
||||||
if (nodeName.equalsIgnoreCase("soundFileName")) { //$NON-NLS-1$
|
if (nodeName.equalsIgnoreCase("soundFileName")) { //$NON-NLS-1$
|
||||||
String value = subElement.getAttribute("name"); //$NON-NLS-1$
|
String value = subElement.getAttribute("name"); //$NON-NLS-1$
|
||||||
if (value == null)
|
if (value == null)
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
|
|
||||||
File soundFile = new File(value);
|
File soundFile = new File(value);
|
||||||
if (soundFile.exists()) {
|
if (soundFile.exists()) {
|
||||||
recentSounds.add(soundFile);
|
recentSounds.add(soundFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recentSounds.size() == 0)
|
if (recentSounds.size() == 0)
|
||||||
initializeRecentSounds();
|
initializeRecentSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveRecentSounds() {
|
public void saveRecentSounds() {
|
||||||
String recentSoundData = new String(""); //$NON-NLS-1$
|
String recentSoundData = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
|
||||||
DocumentBuilder docBuilder = null;
|
DocumentBuilder docBuilder = null;
|
||||||
try {
|
try {
|
||||||
docBuilder = dfactory.newDocumentBuilder();
|
docBuilder = dfactory.newDocumentBuilder();
|
||||||
Document doc = docBuilder.newDocument();
|
Document doc = docBuilder.newDocument();
|
||||||
|
|
||||||
Element rootElement = doc.createElement("recentSounds"); //$NON-NLS-1$
|
Element rootElement = doc.createElement("recentSounds"); //$NON-NLS-1$
|
||||||
doc.appendChild(rootElement);
|
doc.appendChild(rootElement);
|
||||||
|
|
||||||
for (Iterator iter = recentSounds.iterator(); iter.hasNext();) {
|
for (Iterator iter = recentSounds.iterator(); iter.hasNext();) {
|
||||||
File soundFile = (File) iter.next();
|
File soundFile = (File) iter.next();
|
||||||
|
|
||||||
Element element = doc.createElement("soundFileName"); //$NON-NLS-1$
|
Element element = doc.createElement("soundFileName"); //$NON-NLS-1$
|
||||||
element.setAttribute("name", soundFile.getAbsolutePath()); //$NON-NLS-1$
|
element.setAttribute("name", soundFile.getAbsolutePath()); //$NON-NLS-1$
|
||||||
rootElement.appendChild(element);
|
rootElement.appendChild(element);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
ByteArrayOutputStream s = new ByteArrayOutputStream();
|
||||||
|
|
||||||
TransformerFactory factory = TransformerFactory.newInstance();
|
TransformerFactory factory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = factory.newTransformer();
|
Transformer transformer = factory.newTransformer();
|
||||||
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
|
||||||
|
|
||||||
DOMSource source = new DOMSource(doc);
|
DOMSource source = new DOMSource(doc);
|
||||||
StreamResult outputTarget = new StreamResult(s);
|
StreamResult outputTarget = new StreamResult(s);
|
||||||
transformer.transform(source, outputTarget);
|
transformer.transform(source, outputTarget);
|
||||||
|
|
||||||
recentSoundData = s.toString("UTF8"); //$NON-NLS-1$
|
recentSoundData = s.toString("UTF8"); //$NON-NLS-1$
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
CDebugUIPlugin.getDefault().getPreferenceStore().setValue(SOUND_ACTION_RECENT, recentSoundData);
|
CDebugUIPlugin.getDefault().getPreferenceStore().setValue(SOUND_ACTION_RECENT, recentSoundData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SoundAction getSoundAction() {
|
public SoundAction getSoundAction() {
|
||||||
return soundAction;
|
return soundAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
|
||||||
setConfigurationDefaults(wc, targetProject);
|
setConfigurationDefaults(wc, targetProject);
|
||||||
|
|
||||||
final IStructuredSelection selection = new StructuredSelection(wc.doSave());
|
final IStructuredSelection selection = new StructuredSelection(wc.doSave());
|
||||||
final String identifier = new String("org.eclipse.debug.ui.launchGroup.debug"); //$NON-NLS-1$
|
final String identifier = "org.eclipse.debug.ui.launchGroup.debug"; //$NON-NLS-1$
|
||||||
|
|
||||||
UIJob openLaunchConfigJob = new UIJob(Messages.AbstractImportExecutableWizard_CreateLaunchConfiguration) {
|
UIJob openLaunchConfigJob = new UIJob(Messages.AbstractImportExecutableWizard_CreateLaunchConfiguration) {
|
||||||
|
|
||||||
|
@ -251,12 +251,12 @@ public abstract class AbstractImportExecutableWizard extends Wizard implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultProjectName() {
|
public String getDefaultProjectName() {
|
||||||
String defaultName = new String();
|
String defaultName = ""; //$NON-NLS-1$
|
||||||
String[] executables = getImportExecutablePage()
|
String[] executables = getImportExecutablePage()
|
||||||
.getSelectedExecutables();
|
.getSelectedExecutables();
|
||||||
if (executables.length > 0) {
|
if (executables.length > 0) {
|
||||||
String fileName = new File(executables[0]).getName();
|
String fileName = new File(executables[0]).getName();
|
||||||
defaultName = new String(Messages.ImportExecutablePageTwo_DefaultProjectPrefix + fileName);
|
defaultName = Messages.ImportExecutablePageTwo_DefaultProjectPrefix + fileName;
|
||||||
}
|
}
|
||||||
return defaultName;
|
return defaultName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue