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

Bug 335402 - Breakpoint Sound Action fails to change wav file

Fixed hang on Linux gtk
This commit is contained in:
Marc-Andre Laperle 2011-06-25 15:00:02 -04:00
parent d34a4195d5
commit ab8f68cc5b
2 changed files with 23 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Nokia and others. * Copyright (c) 2007, 2011 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
@ -65,7 +65,16 @@ public class SoundActionComposite extends Composite {
comboModifyListener = new ModifyListener() { comboModifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
if (combo_1.getText().length() > 0) { if (combo_1.getText().length() > 0) {
setSoundFile(combo_1.getText()); String filePath = combo_1.getText();
File soundFile = new File(filePath);
if (soundFile.exists()) {
soundFilePathLabel.setText(filePath);
tryItButton.setEnabled(true);
selectedSoundFile = soundFile;
} else {
soundFilePathLabel.setText(Messages.getString("SoundActionComposite.9")); //$NON-NLS-1$
tryItButton.setEnabled(false);
}
} }
} }
}; };
@ -136,11 +145,11 @@ public class SoundActionComposite extends Composite {
private void rebuildRecentSoundsCombo() { private void rebuildRecentSoundsCombo() {
combo_1.removeAll(); combo_1.removeAll();
ArrayList sortedSounds = new ArrayList(soundActionPage.getRecentSounds()); ArrayList<File> sortedSounds = new ArrayList<File>(soundActionPage.getRecentSounds());
Collections.sort(sortedSounds); Collections.sort(sortedSounds);
for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) { for (Iterator<File> iter = sortedSounds.iterator(); iter.hasNext();) {
File element = (File) iter.next(); File element = iter.next();
combo_1.add(element.getAbsolutePath()); combo_1.add(element.getAbsolutePath());
} }
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007 Nokia and others. * Copyright (c) 2007, 2011 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
@ -53,7 +53,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
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<File> recentSounds = new ArrayList<File>();
private SoundAction soundAction; private SoundAction soundAction;
@ -78,8 +78,8 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
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<File> iter = recentSounds.iterator(); iter.hasNext() && removeIndex < 0;) {
File element = (File) iter.next(); File element = iter.next();
if (element.getAbsolutePath().equals(soundFilePath)) if (element.getAbsolutePath().equals(soundFilePath))
removeIndex = fileCount; removeIndex = fileCount;
fileCount++; fileCount++;
@ -96,7 +96,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
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(recentSounds.get(0));
editor = new SoundActionComposite(composite, style, this); editor = new SoundActionComposite(composite, style, this);
return editor; return editor;
} }
@ -105,7 +105,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
return mediaPath; return mediaPath;
} }
public ArrayList getRecentSounds() { public ArrayList<File> getRecentSounds() {
return recentSounds; return recentSounds;
} }
@ -150,7 +150,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
return; return;
} }
recentSounds = new ArrayList(); recentSounds = new ArrayList<File>();
Element root = null; Element root = null;
DocumentBuilder parser; DocumentBuilder parser;
@ -201,8 +201,8 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
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<File> iter = recentSounds.iterator(); iter.hasNext();) {
File soundFile = (File) iter.next(); File soundFile = 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$