1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +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>
This commit is contained in:
Jonah Graham 2015-08-07 16:37:49 +01:00 committed by Gerrit Code Review @ Eclipse.org
parent 20702b3045
commit bd6fa94e63
2 changed files with 18 additions and 1 deletions

View file

@ -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:

View file

@ -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 {