Question

I am writing a eclipse plugin. I am in the need of restricting a file with a specific extension (not creating more than one) in a project. Through a wizard i am creating a file with extension "file.extension". I have restricted in the wizard level as the user is not allowed to create more than one file with extension ".extension". I also need to restrict an user not allowing him to copy or drag the files into some other project of same type. Because, that project must have only one file with a specific extension (".extension"). Please help me through this.

Was it helpful?

Solution

Don't do it that way. A user can always just shutdown Eclipse, create another file in the project and restart Eclipse. You simply cannot avoid that.

Instead, create a custom builder for your project nature which verifies that there is only one file. And in case of more than 1 file have the project builder raise an error in the problems view, so the user can fix it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top