use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class ViewModelDataSource method getViewpointName.
public String getViewpointName() {
if (fCurrentView instanceof IArchimateDiagramModel) {
String id = ((IArchimateDiagramModel) fCurrentView).getViewpoint();
IViewpoint vp = ViewpointManager.INSTANCE.getViewpoint(id);
if (vp == ViewpointManager.NONE_VIEWPOINT) {
return Messages.ViewModelDataSource_1;
}
String name = vp.getName();
// $NON-NLS-1$
return name == null ? "" : NLS.bind(Messages.ViewModelDataSource_0, name);
}
return null;
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class ZestView method makeLocalToolBar.
/**
* Populate the ToolBar
*/
private void makeLocalToolBar() {
IActionBars bars = getViewSite().getActionBars();
IToolBarManager manager = bars.getToolBarManager();
fDrillDownManager.addNavigationActions(manager);
manager.add(new Separator());
manager.add(fActionPinContent);
manager.add(new Separator());
manager.add(fActionLayout);
final IMenuManager menuManager = bars.getMenuManager();
IMenuManager depthMenuManager = new MenuManager(Messages.ZestView_3);
menuManager.add(depthMenuManager);
// Depth Actions
fDepthActions = new Action[6];
for (int i = 0; i < fDepthActions.length; i++) {
fDepthActions[i] = createDepthAction(i, i + 1);
depthMenuManager.add(fDepthActions[i]);
}
// Set depth from prefs
int depth = ArchiZestPlugin.INSTANCE.getPreferenceStore().getInt(IPreferenceConstants.VISUALISER_DEPTH);
getContentProvider().setDepth(depth);
fDepthActions[depth].setChecked(true);
// Set filter based on Viewpoint
IMenuManager viewpointMenuManager = new MenuManager(Messages.ZestView_5);
menuManager.add(viewpointMenuManager);
// Get viewpoint from prefs
String viewpointID = ArchiZestPlugin.INSTANCE.getPreferenceStore().getString(IPreferenceConstants.VISUALISER_VIEWPOINT);
getContentProvider().setViewpointFilter(ViewpointManager.INSTANCE.getViewpoint(viewpointID));
// Viewpoint actions
fViewpointActions = new ArrayList<IAction>();
for (IViewpoint vp : ViewpointManager.INSTANCE.getAllViewpoints()) {
IAction action = createViewpointMenuAction(vp);
fViewpointActions.add(action);
viewpointMenuManager.add(action);
// Set checked
if (vp.getID().equals(viewpointID)) {
action.setChecked(true);
}
}
// Set filter based on Relationship
IMenuManager relationshipMenuManager = new MenuManager(Messages.ZestView_6);
menuManager.add(relationshipMenuManager);
// Get relationship from prefs
String relationshipID = ArchiZestPlugin.INSTANCE.getPreferenceStore().getString(IPreferenceConstants.VISUALISER_RELATIONSHIP);
EClass eClass = (EClass) IArchimatePackage.eINSTANCE.getEClassifier(relationshipID);
getContentProvider().setRelationshipFilter(eClass);
// Relationship actions, first the "None" relationship
fRelationshipActions = new ArrayList<IAction>();
IAction action = createRelationshipMenuAction(null);
if (eClass == null) {
action.setChecked(true);
}
fRelationshipActions.add(action);
relationshipMenuManager.add(action);
// Then get all relationships and sort them
ArrayList<EClass> actionList = new ArrayList<EClass>(Arrays.asList(ArchimateModelUtils.getRelationsClasses()));
actionList.sort((o1, o2) -> o1.getName().compareTo(o2.getName()));
for (EClass rel : actionList) {
action = createRelationshipMenuAction(rel);
fRelationshipActions.add(action);
relationshipMenuManager.add(action);
// Set checked
if (eClass != null && rel.getName().equals(eClass.getName())) {
action.setChecked(true);
}
}
// Orientation
IMenuManager orientationMenuManager = new MenuManager(Messages.ZestView_32);
menuManager.add(orientationMenuManager);
// Direction
fDirectionActions = new Action[3];
fDirectionActions[0] = createOrientationMenuAction(0, Messages.ZestView_33, ZestViewerContentProvider.DIR_BOTH);
orientationMenuManager.add(fDirectionActions[0]);
fDirectionActions[1] = createOrientationMenuAction(1, Messages.ZestView_34, ZestViewerContentProvider.DIR_IN);
orientationMenuManager.add(fDirectionActions[1]);
fDirectionActions[2] = createOrientationMenuAction(2, Messages.ZestView_35, ZestViewerContentProvider.DIR_OUT);
orientationMenuManager.add(fDirectionActions[2]);
// Set direction from prefs
int direction = ArchiZestPlugin.INSTANCE.getPreferenceStore().getInt(IPreferenceConstants.VISUALISER_DIRECTION);
getContentProvider().setDirection(direction);
fDirectionActions[direction].setChecked(true);
menuManager.add(new Separator());
menuManager.add(fActionSelectInModelTree);
menuManager.add(fActionCopyImageToClipboard);
menuManager.add(fActionExportImageToFile);
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class GenerateViewDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
setTitle(Messages.GenerateViewDialog_1);
// $NON-NLS-1$
String message = "";
for (Iterator<IArchimateElement> iter = fSelectedElements.iterator(); iter.hasNext(); ) {
message += ArchiLabelProvider.INSTANCE.getLabel(iter.next());
if (iter.hasNext()) {
// $NON-NLS-1$
message += ", ";
} else {
// $NON-NLS-1$
message += ".";
}
}
setMessage(message);
Composite composite = (Composite) super.createDialogArea(parent);
Composite client = new Composite(composite, SWT.NULL);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 10;
layout.marginHeight = 10;
layout.verticalSpacing = 20;
client.setLayout(layout);
client.setLayoutData(new GridData(GridData.FILL_BOTH));
Label label = new Label(client, SWT.NONE);
label.setText(Messages.GenerateViewDialog_3);
fComboViewer = new ComboViewer(new Combo(client, SWT.READ_ONLY | SWT.BORDER));
fComboViewer.getCombo().setVisibleItemCount(12);
fComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
for (IViewpoint viewpoint : ViewpointManager.INSTANCE.getAllViewpoints()) {
boolean allowed = true;
for (IArchimateElement element : fSelectedElements) {
if (!viewpoint.isAllowedConcept(element.eClass())) {
allowed = false;
break;
}
}
if (allowed && !fValidViewPoints.contains(viewpoint)) {
fValidViewPoints.add(viewpoint);
}
}
fComboViewer.setContentProvider(new IStructuredContentProvider() {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(Object inputElement) {
return fValidViewPoints.toArray();
}
});
fComboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
return ((IViewpoint) element).getName();
}
});
// $NON-NLS-1$
fComboViewer.setInput("");
label = new Label(client, SWT.NONE);
label.setText(Messages.GenerateViewDialog_2);
fNameText = new Text(client, SWT.BORDER);
fNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// $NON-NLS-1$
fNameText.setText(Messages.GenerateViewDialog_6 + " " + ArchiLabelProvider.INSTANCE.getLabel(fSelectedElements.get(0)));
Group groupOptions = new Group(client, SWT.NONE);
groupOptions.setText(Messages.GenerateViewDialog_4);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
groupOptions.setLayoutData(gd);
groupOptions.setLayout(new GridLayout(2, false));
label = new Label(groupOptions, SWT.NONE);
label.setText(Messages.GenerateViewDialog_5);
fAddAllConnectionsButton = new Button(groupOptions, SWT.CHECK);
loadPreferences();
return composite;
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class GenerateViewDialog method loadPreferences.
void loadPreferences() {
IPreferenceStore store = ArchiPlugin.INSTANCE.getPreferenceStore();
fAddAllConnectionsButton.setSelection(store.getBoolean(PREFS_ALLCONNECTIONS));
String id = store.getString(PREFS_LASTVIEWPOINT);
IViewpoint lastViewpoint = ViewpointManager.INSTANCE.getViewpoint(id);
if (!fValidViewPoints.contains(lastViewpoint)) {
lastViewpoint = ViewpointManager.NONE_VIEWPOINT;
}
fComboViewer.setSelection(new StructuredSelection(lastViewpoint));
}
use of com.archimatetool.model.viewpoints.IViewpoint in project archi by archimatetool.
the class MagicConnectionCreationTool method isAllowedTargetTypeInViewpoint.
/**
* @return True if type is an allowed target type for a given Viewpoint
*/
private boolean isAllowedTargetTypeInViewpoint(IDiagramModelArchimateComponent diagramComponent, EClass type) {
if (!Preferences.STORE.getBoolean(IPreferenceConstants.VIEWPOINTS_HIDE_MAGIC_CONNECTOR_ELEMENTS)) {
return true;
}
IArchimateDiagramModel dm = (IArchimateDiagramModel) diagramComponent.getDiagramModel();
String id = dm.getViewpoint();
IViewpoint viewpoint = ViewpointManager.INSTANCE.getViewpoint(id);
return viewpoint == null ? true : viewpoint.isAllowedConcept(type);
}
Aggregations