1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Bug 567536 - In a Perforce workspace, untracked language.settings.xml always get prompted to get latest

IWorkspace.validateEdit should only be called if the file is read only.

Quoting IWorkspace.validateEdit javadoc "A client (such as an editor)
should perform a validateEdit on a file whenever it finds itself in the
following position: (a) the file is marked read-only, and (b) the client
believes it likely (not necessarily certain) that it will modify the
file's contents at some point."

Change-Id: Id73d3629f9ce276b931ed586a6dbf19199d56831
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2020-10-02 01:12:19 -04:00 committed by Marc-André Laperle
parent de70eaa5c5
commit cb8e2c6887

View file

@ -897,7 +897,13 @@ public class LanguageSettingsProvidersSerializer {
fileStorePrj.delete(true, null);
}
} else {
project.getWorkspace().validateEdit(new IFile[] { fileStorePrj }, IWorkspace.VALIDATE_PROMPT);
if (fileStorePrj.isReadOnly()) {
IStatus editStatus = project.getWorkspace().validateEdit(new IFile[] { fileStorePrj },
IWorkspace.VALIDATE_PROMPT);
if (!editStatus.isOK()) {
throw new CoreException(editStatus);
}
}
IContainer folder = fileStorePrj.getParent();
if (folder instanceof IFolder && !folder.exists()) {
((IFolder) folder).create(true, true, null);