use of org.obeonetwork.dsl.requirement.presentation.RequirementEditor in project InformationSystem by ObeoNetwork.
the class ValidateRequirementsHandler method execute.
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
IEditorInput editorInput = HandlerUtil.getActiveEditorInput(event);
if (editor instanceof RequirementEditor) {
shell = HandlerUtil.getActiveShell(event);
RequirementEditor ed = (RequirementEditor) editor;
resourceSet = ed.getEditingDomain().getResourceSet();
} else if (editorInput instanceof SessionEditorInput) {
shell = HandlerUtil.getActiveShell(event);
resourceSet = ((SessionEditorInput) editorInput).getSession().getTransactionalEditingDomain().getResourceSet();
} else {
return null;
}
Collection<EObject> objects = new ArrayList<EObject>();
for (Resource resource : resourceSet.getResources()) {
for (EObject eObject : resource.getContents()) {
if (eObject instanceof Repository || eObject instanceof Category || eObject instanceof Requirement) {
objects.add(eObject);
}
}
}
executeValidation(objects);
return null;
}
use of org.obeonetwork.dsl.requirement.presentation.RequirementEditor in project InformationSystem by ObeoNetwork.
the class RequirementsShouldBeTested method test.
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof IEditorPart) {
if (receiver instanceof RequirementEditor) {
return true;
}
IEditorInput editorInput = ((IEditorPart) receiver).getEditorInput();
if (editorInput instanceof SessionEditorInput) {
SessionEditorInput sessionEditorInput = (SessionEditorInput) editorInput;
Session session = sessionEditorInput.getSession();
if (session != null) {
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();
if (ted != null) {
return containsRequirementsModel(ted.getResourceSet());
}
}
}
}
return false;
}
Aggregations