use of org.absmodels.abs.plugin.editor.outline.PackageContainer in project abstools by abstools.
the class UtilityFunctions method getPackageAbsFile.
/**
* A convenient method to reconstruct a {@link PackageAbsFile} from the absolute
* path to the ABS package and the name to the specific entry in the package.
* @param proj the project which the package belongs to
* @param pak
* @param entry
* @return
*/
public static PackageAbsFile getPackageAbsFile(IProject proj, String pak, String entry) {
File file = new File(pak);
try {
if (new ABSPackageFile(file).isABSPackage()) {
PackageEntry pentry = null;
if (proj != null) {
AbsNature nature = getAbsNature(proj);
for (PackageEntry e : nature.getPackages().getPackages()) {
if (e.getPath().equals(file.getAbsolutePath())) {
pentry = e;
break;
}
}
}
if (pentry == null) {
PackageContainer container = new PackageContainer();
container.setProject(proj);
pentry = new PackageEntry(container, file.getName(), file.getAbsolutePath(), true);
}
return new PackageAbsFile(pentry, entry);
}
} catch (IOException e) {
}
return null;
}
Aggregations