mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
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 bd6fa94e63
)
This commit is contained in:
parent
81f6bd0259
commit
7500101404
2 changed files with 18 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue