Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2015-08-07 15:37:49 +0000
committerMarc Khouzam2015-08-17 15:28:50 +0000
commit75001014046d2d1c5678e3d4b347c56f213ee58d (patch)
tree93086b22cf6713fa54fa64f6bead1f2ca6f685da
parent81f6bd025959d9db743a591d3141534885580a27 (diff)
downloadorg.eclipse.cdt-75001014046d2d1c5678e3d4b347c56f213ee58d.tar.gz
org.eclipse.cdt-75001014046d2d1c5678e3d4b347c56f213ee58d.tar.xz
org.eclipse.cdt-75001014046d2d1c5678e3d4b347c56f213ee58d.zip
Bug 474179: Require file name to be absolute and exist
When a file is not found, the debugger will be used to resolve it to an absolute file. One of the side effects at the moment is that no breakpoint marker is created in the editor for the file. To mitigate the situation and reduce user confusion, until installed breakpoints can be displayed in the UI don't allow users to create breakpoints on non-absolute file names. Change-Id: Ib69bfdfcde0c83fe6e20cacb0850d8ee907583a1 Signed-off-by: Jonah Graham <jonah@kichwacoders.com> (cherry picked from commit bd6fa94e63387dbaf42ce0f5f426cf1f1b1b4d00)
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java17
2 files changed, 18 insertions, 1 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
index dc6cf5c3f5c..8942d9a016e 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/BreakpointsMessages.properties
@@ -15,7 +15,7 @@
CBreakpointPropertyPage.0=Ignore count must be a nonnegative integer
CBreakpointPropertyPage.file_system_button=File S&ystem...
-CBreakpointPropertyPage.fileName_errorMessage=Enter a file name:
+CBreakpointPropertyPage.fileName_errorMessage=Enter the absolute path to an existing file:
CBreakpointPropertyPage.function_valueNotAvailable_label=Not available
CBreakpointPropertyPage.function_label=Function name:
CBreakpointPropertyPage.function_value_errorMessage=Enter a function expression:
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
index 80ef12f64a4..dcdf5d43ab0 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
@@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.breakpoints;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
@@ -293,6 +294,22 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
});
}
+ @Override
+ protected boolean doCheckState() {
+ // Check that the file name supplied is absolute and exists so that we can
+ // associate it to an IResource later for creating a breakpoint marker.
+ String stringValue = getStringValue();
+ if (stringValue == null) {
+ return false;
+ }
+ File sourceFile = new File(stringValue);
+ if (!sourceFile.isAbsolute() || !sourceFile.exists() || !sourceFile.isFile()) {
+ return false;
+ }
+
+ return super.doCheckState();
+ }
+
}
class WatchpointRangeFieldEditor extends IntegerFieldEditor {

Back to the top