"A model must be loaded first"
);
}
// First, we need to identify a container package and isolate the
// simple name
IPackageService containerPackageService = null;
String containerFullName = null;
String simpleName = null;
int lastPointIndex = packageFullName.lastIndexOf('.');
if(lastPointIndex > 0) {
containerFullName =
packageFullName.substring(0, lastPointIndex - 1);
simpleName = packageFullName.substring(lastPointIndex + 1);
}
else {
simpleName = packageFullName;
}
// If we have a container package,
if(containerFullName != null) {
// Then we resolve the corresponding service
containerPackageService =
modelService.resolvePackageService(containerFullName);
}
else {
// Else we resolve the default package service
containerPackageService =
modelService.resolvePackageService(
IPackageService.defaultUMLPackageName
);
}
if(containerPackageService != null) {
IPackageService packageService =
containerPackageService.createNestedPackage(simpleName);
return packageService != null;
}
else return false;
}