There are a few static functions in the
Global scope that can be used to leave the
scope of the current script execution and to get access to other
scopes in the workspace. However, since the script has no write
permission to other projects, the access to outside scopes is
limited.
getFinder()
{Function} - Returns new
Finderinstance for a given scope. A scope can be either a single object or a set of objects. Note: in case a single object is passed, the finder searches the whole containment tree of the given object. In contrast, passing a set (array) of objects will limit the finder to exactly the passed set of objects.
// use of second Finder instance var parts = finder.findByType(Metamodel.sysml.SysMLPart); if (!parts.isEmpty()) { // search only within the scope of the first part var secondFinder = Global.getFinder(parts.toList().get(0)); secondFinder.find(...) }
Stability 2 - Unstable
getProjects()
{Function} - Returns a list of all project root objects found in the workspace.
var count = Global.getProjects().size(); console.log("There are {0} projects in the workspace", count);
Stability 1 - Experimental
getTraces()
{Function} - Returns all traces within a project as a
FindResultobject. A single object has to be passed as parameter to determine the project scope. See theFinderandFindResultAPI for further use cases.
var count = Global.getTraces(finder.scope).size(); console.log("There are {0} traces in the project", count);
Stability 1 - Experimental