how to validate over all files & customize new project wizard [message #714661] |
Thu, 11 August 2011 08:16 |
Michal S Messages: 74 Registered: July 2011 |
Member |
|
|
Hello,
I have trouble with two following tasks:
1. Validate unique names over all files with my extension in my project folder (and any subfolder)
I wrote code:
@Check
public void checkNamesAreUnique(Composition composition){
EList<FrameworkContent> contents = new BasicEList<FrameworkContent>();
for (Resource resource: composition.eResource().getResourceSet().getResources()) {
for (EObject eobject: resource.getContents()){
if (eobject.getClass().getName().contains("FrameworkImpl")){
Framework tc = ((Framework) eobject);
contents.addAll(tc.getContents());
}
}
}
if (contents.size()>1){
for (FrameworkContent c: contents){
if (c.getClass().equals(composition.getClass()) && (!c.equals(composition))){
if (((Composition) c).getName().equals(composition.getName())){
error("Duplicate name in scope: "+ composition.getName(),FrameworkPackage.Literals.COMPOSITION__NAME);
}
}
}
}
}
Problem is, that composition.eResource().getResourceSet().getResources() returns only referenced resources, and I need all of them. When I close and again open the project it makes "update" and there are all resources found and it writes expected errors. But whenever I re-save the files containing duplicity, error is gone...
2. Customize Project Wizard: What I need is to create just folder structure (without files). I used to .xpt file to create folder structure with files, but I need it without them.
And also, I don't want "src" and "src-gen" folders to be created. In my model "src" has another meaning, it is used for specific purposes... not as the top level eclipse folder.
Is there any simple way how to do this?
Thanks in advance,
Michal
|
|
|
|
Powered by
FUDForum. Page generated in 0.02843 seconds