diff options
| author | Jonah Graham | 2015-08-07 15:37:49 +0000 |
|---|---|---|
| committer | Gerrit Code Review @ Eclipse.org | 2015-08-17 13:50:26 +0000 |
| commit | bd6fa94e63387dbaf42ce0f5f426cf1f1b1b4d00 (patch) | |
| tree | b041d52b01ccb66c226e1d492b1ae79736221d0c | |
| parent | 20702b3045d1e588854998936375cada98aae90d (diff) | |
| download | org.eclipse.cdt-bd6fa94e63387dbaf42ce0f5f426cf1f1b1b4d00.tar.gz org.eclipse.cdt-bd6fa94e63387dbaf42ce0f5f426cf1f1b1b4d00.tar.xz org.eclipse.cdt-bd6fa94e63387dbaf42ce0f5f426cf1f1b1b4d00.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>
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 { |
