Reputation: 514
I use a WizardNewFileCreationPage to give a user the option to create a new file the project workspace.
However I want the user to create the file only in certain folders, for example in project/data
not in project/data/trash
folder.
How do I specify this criteria?
Upvotes: 0
Views: 82
Reputation: 111142
You can create a class which extends WizardNewFileCreationPage
and override the validatePage
method:
@Override
protected boolean validatePage()
{
boolean valid = super.validatePage();
if (!valid)
return false;
IPath containerPath = getContainerFullPath();
String fileName = getFileName();
valid = ... check containerPath and fileName meet your criteria
if (!valid)
{
setErrorMessage("your error message");
}
return valid;
}
Upvotes: 1