use of com.archimatetool.model.IArchimateElement 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.IArchimateElement in project archi-modelrepository-plugin by archi-contribs.
the class GraficoModelImporter method resolveProxies.
/**
* Iterate through all model objects, and resolve proxies on known classes
*/
private void resolveProxies() {
for (Iterator<EObject> iter = fModel.eAllContents(); iter.hasNext(); ) {
EObject eObject = iter.next();
if (eObject instanceof IArchimateRelationship) {
// Resolve proxies for Relations
IArchimateRelationship relation = (IArchimateRelationship) eObject;
relation.setSource((IArchimateConcept) resolve(relation.getSource(), relation));
relation.setTarget((IArchimateConcept) resolve(relation.getTarget(), relation));
} else if (eObject instanceof IDiagramModelArchimateObject) {
// Resolve proxies for Elements
IDiagramModelArchimateObject element = (IDiagramModelArchimateObject) eObject;
element.setArchimateElement((IArchimateElement) resolve(element.getArchimateElement(), element));
// Update cross-references
element.getArchimateElement().getReferencingDiagramObjects().add(element);
} else if (eObject instanceof IDiagramModelArchimateConnection) {
// Resolve proxies for Connections
IDiagramModelArchimateConnection archiConnection = (IDiagramModelArchimateConnection) eObject;
archiConnection.setArchimateRelationship((IArchimateRelationship) resolve(archiConnection.getArchimateRelationship(), archiConnection));
// Update cross-reference
archiConnection.getArchimateRelationship().getReferencingDiagramConnections().add(archiConnection);
} else if (eObject instanceof IDiagramModelReference) {
// Resolve proxies for Model References
IDiagramModelReference element = (IDiagramModelReference) eObject;
element.setReferencedModel((IDiagramModel) resolve(element.getReferencedModel(), element));
}
}
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class DiagramFigureTypeSection method update.
@Override
protected void update() {
IDiagramModelArchimateObject diagramObject = (IDiagramModelArchimateObject) getFirstSelectedObject();
IArchimateElement element = diagramObject.getArchimateElement();
Image image1 = FigureImagePreviewFactory.getFigurePreviewImageForClass(element.eClass());
Image image2 = FigureImagePreviewFactory.getAlternateFigurePreviewImageForClass(element.eClass());
figure1.setImage(image1);
figure2.setImage(image2);
figure1.getParent().layout();
int type = diagramObject.getType();
figure1.setSelected(type == 0);
figure2.setSelected(type == 1);
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class ArchimateDiagramModelFactoryTests method testCreateDiagramModelArchimateObject.
@Test
public void testCreateDiagramModelArchimateObject() {
IArchimateElement element = IArchimateFactory.eINSTANCE.createBusinessProcess();
Preferences.STORE.setValue(IPreferenceConstants.DEFAULT_FIGURE_PREFIX + element.eClass().getName(), 1);
Preferences.STORE.setValue(IPreferenceConstants.SAVE_USER_DEFAULT_COLOR, true);
Preferences.STORE.setValue(IPreferenceConstants.DEFAULT_FILL_COLOR_PREFIX + element.eClass().getName(), "#ededed");
IDiagramModelArchimateObject dmo = ArchimateDiagramModelFactory.createDiagramModelArchimateObject(element);
assertNotNull(dmo);
assertEquals(element, dmo.getArchimateElement());
assertEquals(1, dmo.getType());
assertEquals("#ededed", dmo.getFillColor());
Preferences.STORE.setToDefault(IPreferenceConstants.DEFAULT_FIGURE_PREFIX + element.eClass().getName());
Preferences.STORE.setToDefault(IPreferenceConstants.SAVE_USER_DEFAULT_COLOR);
Preferences.STORE.setToDefault(IPreferenceConstants.DEFAULT_FILL_COLOR_PREFIX + element.eClass().getName());
}
use of com.archimatetool.model.IArchimateElement in project archi by archimatetool.
the class CreateDiagramArchimateConnectionWithDialogCommandTests method testGetExistingRelationshipOfType.
@Test
public void testGetExistingRelationshipOfType() {
ArchimateTestModel tm = new ArchimateTestModel();
tm.createSimpleModel();
IArchimateElement source = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
IArchimateElement target = (IArchimateElement) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getBusinessActor());
IArchimateRelationship relation1 = (IArchimateRelationship) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getAssignmentRelationship());
IArchimateRelationship relation2 = (IArchimateRelationship) tm.createModelElementAndAddToModel(IArchimatePackage.eINSTANCE.getFlowRelationship());
assertNull(cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getAssignmentRelationship(), source, target));
relation1.setSource(source);
relation1.setTarget(target);
relation2.setSource(source);
relation2.setTarget(target);
assertEquals(relation1, cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getAssignmentRelationship(), source, target));
assertEquals(relation2, cmd.getExistingRelationshipOfType(IArchimatePackage.eINSTANCE.getFlowRelationship(), source, target));
}
Aggregations