diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java index 9792bddbbb2..56f8faed244 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -65,7 +65,16 @@ public class SoundActionComposite extends Composite { comboModifyListener = new ModifyListener() { public void modifyText(ModifyEvent e) { 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() { combo_1.removeAll(); - ArrayList sortedSounds = new ArrayList(soundActionPage.getRecentSounds()); + ArrayList sortedSounds = new ArrayList(soundActionPage.getRecentSounds()); Collections.sort(sortedSounds); - for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) { - File element = (File) iter.next(); + for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) { + File element = iter.next(); combo_1.add(element.getAbsolutePath()); } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionPage.java index c8bab1b750d..7ca9e1734b7 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionPage.java @@ -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 * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,7 +53,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction private SoundActionComposite editor = null; private String mediaPath = ""; //$NON-NLS-1$ - private ArrayList recentSounds = new ArrayList(); + private ArrayList recentSounds = new ArrayList(); private SoundAction soundAction; @@ -78,8 +78,8 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction String soundFilePath = soundFile.getAbsolutePath(); int removeIndex = -1; int fileCount = 0; - for (Iterator iter = recentSounds.iterator(); iter.hasNext() && removeIndex < 0;) { - File element = (File) iter.next(); + for (Iterator iter = recentSounds.iterator(); iter.hasNext() && removeIndex < 0;) { + File element = iter.next(); if (element.getAbsolutePath().equals(soundFilePath)) removeIndex = fileCount; fileCount++; @@ -96,7 +96,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction this.soundAction = (SoundAction) action; loadRecentSounds(); if (soundAction.getSoundFile() == null && recentSounds.size() > 0) - soundAction.setSoundFile((File) recentSounds.get(0)); + soundAction.setSoundFile(recentSounds.get(0)); editor = new SoundActionComposite(composite, style, this); return editor; } @@ -105,7 +105,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction return mediaPath; } - public ArrayList getRecentSounds() { + public ArrayList getRecentSounds() { return recentSounds; } @@ -150,7 +150,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction return; } - recentSounds = new ArrayList(); + recentSounds = new ArrayList(); Element root = null; DocumentBuilder parser; @@ -201,8 +201,8 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction Element rootElement = doc.createElement("recentSounds"); //$NON-NLS-1$ doc.appendChild(rootElement); - for (Iterator iter = recentSounds.iterator(); iter.hasNext();) { - File soundFile = (File) iter.next(); + for (Iterator iter = recentSounds.iterator(); iter.hasNext();) { + File soundFile = iter.next(); Element element = doc.createElement("soundFileName"); //$NON-NLS-1$ element.setAttribute("name", soundFile.getAbsolutePath()); //$NON-NLS-1$