use of com.archimatetool.hammer.validation.issues.IIssue in project archi by archimatetool.
the class ValidatorView method selectObjects.
void selectObjects(IStructuredSelection selection) {
if (selection != null) {
List<IArchimateConcept> treeList = new ArrayList<IArchimateConcept>();
List<IDiagramModel> viewList = new ArrayList<IDiagramModel>();
List<IDiagramModelComponent> viewComponentList = new ArrayList<IDiagramModelComponent>();
for (Object o : selection.toArray()) {
if (o instanceof IIssue) {
IIssue issue = (IIssue) o;
if (issue.getObject() instanceof IArchimateConcept) {
treeList.add((IArchimateConcept) issue.getObject());
} else if (issue.getObject() instanceof IDiagramModel) {
viewList.add((IDiagramModel) issue.getObject());
} else if (issue.getObject() instanceof IDiagramModelComponent) {
viewList.add(((IDiagramModelComponent) issue.getObject()).getDiagramModel());
viewComponentList.add(((IDiagramModelComponent) issue.getObject()));
}
}
}
if (!treeList.isEmpty()) {
ITreeModelView view = (ITreeModelView) ViewManager.showViewPart(ITreeModelView.ID, false);
if (view != null) {
view.getViewer().setSelection(new StructuredSelection(treeList), true);
}
}
if (!viewList.isEmpty()) {
for (IDiagramModel dm : viewList) {
IDiagramModelEditor editor = EditorManager.openDiagramEditor(dm, false);
if (editor != null) {
// Needs to be asyncExec to allow EditorPart to open if it is currently closed
getSite().getShell().getDisplay().asyncExec(() -> {
editor.selectObjects(viewComponentList.toArray());
});
}
}
}
}
}
use of com.archimatetool.hammer.validation.issues.IIssue in project archi by archimatetool.
the class UnusedElementsChecker method findUnusedElements.
List<IIssue> findUnusedElements() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateElement element : fArchimateElements) {
if (!DiagramModelUtils.isArchimateConceptReferencedInDiagrams(element)) {
String name = ArchiLabelProvider.INSTANCE.getLabel(element);
String description = NLS.bind(DESCRIPTION, name);
String explanation = NLS.bind(EXPLANATION, name);
IIssue issue = new WarningType(NAME, description, explanation, element);
issues.add(issue);
}
}
return issues;
}
use of com.archimatetool.hammer.validation.issues.IIssue in project archi by archimatetool.
the class ViewpointChecker method findComponentsInWrongViewpoints.
List<IIssue> findComponentsInWrongViewpoints() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateDiagramModel dm : fViews) {
String id = dm.getViewpoint();
IViewpoint viewPoint = ViewpointManager.INSTANCE.getViewpoint(id);
for (Iterator<EObject> iter = dm.eAllContents(); iter.hasNext(); ) {
EObject eObject = iter.next();
if (eObject instanceof IDiagramModelArchimateObject) {
IDiagramModelArchimateObject dmo = (IDiagramModelArchimateObject) eObject;
IArchimateElement element = dmo.getArchimateElement();
if (!viewPoint.isAllowedConcept(element.eClass())) {
IIssue issue = createIssue(dmo, dm.getName(), viewPoint.getName());
issues.add(issue);
}
}
}
}
return issues;
}
use of com.archimatetool.hammer.validation.issues.IIssue in project archi by archimatetool.
the class JunctionsChecker method findBogusJunctions.
List<IIssue> findBogusJunctions() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateElement element : fArchimateElements) {
if (element instanceof IJunction) {
IArchimateRelationship rel = null;
for (IArchimateRelationship relation : ArchimateModelUtils.getAllRelationshipsForConcept(element)) {
if (rel != null && rel.eClass() != relation.eClass()) {
String name = ArchiLabelProvider.INSTANCE.getLabel(element);
String description = NLS.bind(DESCRIPTION, name);
String explanation = NLS.bind(EXPLANATION, name);
IIssue issue = new ErrorType(NAME, description, explanation, element);
issues.add(issue);
break;
}
rel = relation;
}
}
}
return issues;
}
use of com.archimatetool.hammer.validation.issues.IIssue in project archi by archimatetool.
the class UnusedRelationsChecker method findUnusedRelations.
List<IIssue> findUnusedRelations() {
List<IIssue> issues = new ArrayList<IIssue>();
for (IArchimateRelationship relation : fRelations) {
if (!DiagramModelUtils.isArchimateConceptReferencedInDiagrams(relation)) {
String name = ArchiLabelProvider.INSTANCE.getLabel(relation);
String description = NLS.bind(DESCRIPTION, name);
String explanation = NLS.bind(EXPLANATION, name);
IIssue issue = new WarningType(NAME, description, explanation, relation);
issues.add(issue);
}
}
return issues;
}
Aggregations