protected static String getResourcePath(String resourceId) { IQ7NamedElement element = Q7SearchCore.findById(resourceId); if (element == null) { return null; } return element.getResource().getFullPath().toString(); }
private static IContext[] getReferencedContexts(IQ7NamedElement element) { if (element == null) { return new IContext[0]; } try { List<IContext> result = new ArrayList<IContext>(); if (element instanceof Q7InternalTestCase) { Scenario scenario = ((Q7InternalTestCase) element).getNamedElement(); for (String id : scenario.getContexts()) { IQ7NamedElement ref = Q7SearchCore.findById(id); if (!(ref instanceof IContext)) { continue; } result.add((IContext) ref); } return result.toArray(new IContext[result.size()]); } if (element instanceof ITestCase) { String[] ids = ((ITestCase) element).getContexts(); return RcpttCore.getInstance() .getContexts((ITestCase) element, Arrays.asList(ids), null, true); } IQ7ProjectMetadata metadata = element.getQ7Project().getMetadata(); if (metadata.exists()) { String[] ids = metadata.getContexts(); for (String id : ids) { IQ7NamedElement ref = Q7SearchCore.findById(id); if (!(ref instanceof IContext)) { continue; } result.add((IContext) ref); } } return result.toArray(new IContext[result.size()]); } catch (ModelException e) { return new IContext[0]; } }