mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Bug 400972: Creating new C/C++ project in existing read-only
directory should be disallowed Change-Id: I75090498bd4f408d77ad17491f50f4fd66850c97 Reviewed-on: https://git.eclipse.org/r/10404 Reviewed-by: Jesse Weinstein <Jesse.Weinstein@clinicomp.com> Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
parent
1908efec38
commit
18ff30de24
6 changed files with 15 additions and 2 deletions
|
@ -186,6 +186,7 @@ public class Messages extends NLS {
|
|||
public static String NewMakeProjFromExistingPage_7;
|
||||
public static String NewMakeProjFromExistingPage_8;
|
||||
public static String NewMakeProjFromExistingPage_9;
|
||||
public static String NewMakeProjFromExistingPage_DirReadOnlyError;
|
||||
public static String NewVarDialog_0;
|
||||
public static String NewVarDialog_1;
|
||||
public static String PreferredToolchainsTab_0;
|
||||
|
|
|
@ -152,6 +152,8 @@ NewMakeProjFromExistingPage_6=Browse...
|
|||
NewMakeProjFromExistingPage_7=Select root directory of existing code
|
||||
NewMakeProjFromExistingPage_8=Not a valid directory
|
||||
NewMakeProjFromExistingPage_9=Languages
|
||||
NewMakeProjFromExistingPage_DirReadOnlyError=Directory is read-only
|
||||
|
||||
|
||||
# ----------- Configuration Selection Page -----------
|
||||
BuildPropertyPage_error_Unknown_tree_element=Unknown type of element in tree of type {0}
|
||||
|
|
|
@ -155,10 +155,13 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
|||
else {
|
||||
final File file= new File(loc);
|
||||
if (file.isDirectory()) {
|
||||
// Ensure we can create files in the directory.
|
||||
if (!file.canWrite())
|
||||
msg = Messages.NewMakeProjFromExistingPage_DirReadOnlyError;
|
||||
// Set the project name to the directory name but not if the user has supplied a name
|
||||
// (bugzilla 368987). Use a job to ensure proper sequence of activity, as setting the Text
|
||||
// will invoke the listener, which will invoke this method.
|
||||
if (!projectNameSetByUser && !name.equals(file.getName())) {
|
||||
else if (!projectNameSetByUser && !name.equals(file.getName())) {
|
||||
WorkbenchJob wjob = new WorkbenchJob("update project name") { //$NON-NLS-1$
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
|
|
|
@ -105,6 +105,7 @@ public class Messages extends NLS {
|
|||
public static String CMainWizardPage_5;
|
||||
public static String CMainWizardPage_6;
|
||||
public static String CMainWizardPage_7;
|
||||
public static String CMainWizardPage_DirReadOnlyError;
|
||||
public static String ConfigDescriptionTab_0;
|
||||
public static String ConfigDescriptionTab_1;
|
||||
public static String ConfigDescriptionTab_2;
|
||||
|
|
|
@ -273,6 +273,7 @@ CMainWizardPage_3=No project types available. Project cannot be created
|
|||
CMainWizardPage_5=Cannot create ICProjectTypeHandler:
|
||||
CMainWizardPage_6=File with specified name already exists.
|
||||
CMainWizardPage_7=Directory with specified name already exists.
|
||||
CMainWizardPage_DirReadOnlyError=Directory with specified name already exists and is read-only.
|
||||
|
||||
ProjectContentsArea_0=Browse...
|
||||
ProjectContentsArea_1=Use default location
|
||||
|
|
|
@ -211,7 +211,12 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
IFileInfo f = fs.fetchInfo();
|
||||
if (f.exists()) {
|
||||
if (f.isDirectory()) {
|
||||
setMessage(Messages.CMainWizardPage_7, IMessageProvider.WARNING);
|
||||
if (f.getAttribute(EFS.ATTRIBUTE_READ_ONLY)) {
|
||||
setErrorMessage(Messages.CMainWizardPage_DirReadOnlyError);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
setMessage(Messages.CMainWizardPage_7, IMessageProvider.WARNING);
|
||||
} else {
|
||||
setErrorMessage(Messages.CMainWizardPage_6);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue