use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class TreeViewpointFilterProvider method getTextColor.
/**
* If the element is disallowed in a Viewpoint grey it out
* @param element
* @return Color or null
*/
Color getTextColor(Object element) {
if (isActive() && fActiveDiagramModel != null && element instanceof IArchimateConcept) {
String id = fActiveDiagramModel.getViewpoint();
IViewpoint viewpoint = ViewpointManager.INSTANCE.getViewpoint(id);
if (viewpoint != null) {
// From same model as active diagram
IArchimateModel model = ((IArchimateConcept) element).getArchimateModel();
if (model == fActiveDiagramModel.getArchimateModel()) {
if (element instanceof IArchimateRelationship) {
IArchimateConcept source = ((IArchimateRelationship) element).getSource();
IArchimateConcept target = ((IArchimateRelationship) element).getTarget();
if (!viewpoint.isAllowedConcept(source.eClass()) || !viewpoint.isAllowedConcept(target.eClass())) {
return ColorFactory.get(128, 128, 128);
}
} else if (element instanceof IArchimateElement) {
if (!viewpoint.isAllowedConcept(((IArchimateElement) element).eClass())) {
return ColorFactory.get(128, 128, 128);
}
}
}
}
}
return null;
}
use of com.archimatetool.model.viewpoints.IViewpoint 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.model.viewpoints.IViewpoint in project archi by archimatetool.
the class ArchimateDiagramEditor method createActions.
/**
* Add some extra Actions - *after* the graphical viewer has been created
*/
@Override
@SuppressWarnings("unchecked")
protected void createActions(GraphicalViewer viewer) {
super.createActions(viewer);
ActionRegistry registry = getActionRegistry();
IAction action;
// Delete from Model
action = new DeleteFromModelAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
// Viewpoints
for (IViewpoint viewPoint : ViewpointManager.INSTANCE.getAllViewpoints()) {
action = new ViewpointAction(this, viewPoint);
registry.registerAction(action);
}
// Find/Replace
action = new FindReplaceAction(getEditorSite().getWorkbenchWindow());
registry.registerAction(action);
// Generate View For
action = new GenerateViewAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class ArchimateDiagramEditorActionBarContributor method buildActions.
@Override
protected void buildActions() {
super.buildActions();
// Delete From Model
RetargetAction retargetAction = new RetargetAction(DeleteFromModelAction.ID, DeleteFromModelAction.TEXT);
addRetargetAction(retargetAction);
// Viewpoints
for (IViewpoint viewPoint : ViewpointManager.INSTANCE.getAllViewpoints()) {
retargetAction = new RetargetAction(viewPoint.toString(), viewPoint.getName(), IAction.AS_RADIO_BUTTON);
addRetargetAction(retargetAction);
}
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class ArchimateDiagramEditorContextMenuProvider method buildContextMenu.
/**
* @see ContextMenuProvider#buildContextMenu(org.eclipse.jface.action.IMenuManager)
*/
@Override
public void buildContextMenu(IMenuManager menu) {
super.buildContextMenu(menu);
// Delete from Model
menu.appendToGroup(GROUP_EDIT, actionRegistry.getAction(DeleteFromModelAction.ID));
// Select Element in Tree
menu.appendToGroup(GROUP_RENAME, new Separator());
menu.appendToGroup(GROUP_RENAME, actionRegistry.getAction(SelectElementInTreeAction.ID));
// Generate View For Element
menu.appendToGroup(GROUP_RENAME, actionRegistry.getAction(ArchiActionFactory.GENERATE_VIEW.getId()));
// Viewpoints
menu.appendToGroup(GROUP_CONNECTIONS, new Separator(GROUP_VIEWPOINTS));
IMenuManager viewPointMenu = new MenuManager(Messages.ArchimateDiagramEditorContextMenuProvider_0);
menu.appendToGroup(GROUP_VIEWPOINTS, viewPointMenu);
for (IViewpoint viewPoint : ViewpointManager.INSTANCE.getAllViewpoints()) {
viewPointMenu.add(actionRegistry.getAction(viewPoint.toString()));
}
}
Aggregations