Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java19
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionPage.java18
2 files changed, 23 insertions, 14 deletions
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 9792bddbbb..56f8faed24 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<File> sortedSounds = new ArrayList<File>(soundActionPage.getRecentSounds());
Collections.sort(sortedSounds);
- for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) {
- File element = (File) iter.next();
+ for (Iterator<File> 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 c8bab1b750..7ca9e1734b 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<File> recentSounds = new ArrayList<File>();
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<File> 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<File> getRecentSounds() {
return recentSounds;
}
@@ -150,7 +150,7 @@ public class SoundActionPage extends PlatformObject implements IBreakpointAction
return;
}
- recentSounds = new ArrayList();
+ recentSounds = new ArrayList<File>();
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<File> 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$

Back to the top