use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class DataTypeSelectionWizard method selectDataType.
public static DataType selectDataType(EObject eObject) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(DataType.class);
// Additional Child References
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
// Creating the dialog
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, eObject.eResource().getResourceSet());
// Setting the needed object type
dialog.setProvidedService(DataType.class);
dialog.open();
return (DataType) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class EventTypesEditorSection method createViewerCellEditors.
/* (non-Javadoc)
* @see org.palladiosimulator.editors.commons.tabs.generic.EditorSection#createViewerCellEditors(org.eclipse.swt.widgets.Table)
*/
@Override
protected CellEditor[] createViewerCellEditors(Table table) {
CellEditor[] editors = new CellEditor[columnNames.length];
editors[EVENTTYPENAME_COLUMN_INDEX] = new TextCellEditor(table);
// create 'DeleteCellValueListener' and as SelectionListener to the 'TableVewer'
EventTypeDeleteCellValueListener cellValueListener = new EventTypeDeleteCellValueListener(viewer);
viewer.addSelectionChangedListener(cellValueListener);
editors[PARAMETER_NAME_COLUMN_INDEX] = new TextCellEditor(table);
editors[PARAMETER_TYPE_COLUMN_INDEX] = new TypeDialogCellEditor(table, cellValueListener) {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control)
*/
@Override
protected Object openDialogBox(Control cellEditorWindow) {
TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getSelectedEventType());
ArrayList<Object> filterList = new ArrayList<Object>();
filterList.add(DataType.class);
filterList.add(Repository.class);
ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
CallDataTypeDialog dialog = new CallDataTypeDialog(cellEditorWindow.getShell(), filterList, additionalReferences, editingDomain.getResourceSet());
dialog.setProvidedService(DataType.class);
dialog.open();
if (!(dialog.getResult() instanceof DataType))
return null;
return dialog.getResult();
}
};
return editors;
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddProcessingResourceSpecification method getSchedulingPolicy.
private SchedulingPolicy getSchedulingPolicy(final ProcessingResourceSpecification processingResourceSpecification) {
final ResourceSet set = (processingResourceSpecification.getResourceContainer_ProcessingResourceSpecification()).eResource().getResourceSet();
// positive filter
final ArrayList<Object> filterList = new ArrayList<Object>();
// Set types to show and their super types
filterList.add(SchedulingPolicy.class);
filterList.add(ResourceRepository.class);
final ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
// set EReference that should be set (in this case: SchedulingPolicy)
additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_SchedulingPolicy());
final PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), filterList, additionalReferences, set);
dialog.setProvidedService(SchedulingPolicy.class);
dialog.open();
if (dialog.getResult() == null || !(dialog.getResult() instanceof SchedulingPolicy)) {
return null;
}
return (SchedulingPolicy) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddAcquireAction method getPassiveResource.
private PassiveResource getPassiveResource(AcquireAction acquireAction) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(BasicComponent.class);
filter.add(PassiveResource.class);
// Additional Child References
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
// additionalChildReferences.add(RepositoryPackage.Literals.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE);
// Creating the dialog
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, acquireAction.eResource().getResourceSet());
// Setting the needed object type
dialog.setProvidedService(PassiveResource.class);
dialog.open();
return (PassiveResource) dialog.getResult();
}
use of org.eclipse.emf.ecore.EReference in project Palladio-Editors-Sirius by PalladioSimulator.
the class AddEmitEventAction method getEventType.
private EventType getEventType(EmitEventAction emitEventAction) {
Collection<Object> filter = new ArrayList<Object>();
filter.add(Repository.class);
filter.add(EventGroup.class);
filter.add(EventType.class);
Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, emitEventAction.eResource().getResourceSet());
dialog.setProvidedService(EventType.class);
// Only show EventTypes from EventGroups from SourceRoles of the parent BasicComponent
for (Object o : dialog.getTreeViewer().getExpandedElements()) {
if (!(o instanceof EventGroup))
continue;
ServiceEffectSpecification seff = SEFFUtil.getEnclosingSEFF(emitEventAction.getResourceDemandingBehaviour_AbstractAction());
BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
boolean found = false;
for (RequiredRole r : parent.getRequiredRoles_InterfaceRequiringEntity()) {
if (!(r instanceof SourceRole))
continue;
SourceRole sourceRole = (SourceRole) r;
if (sourceRole.getEventGroup__SourceRole().equals(o)) {
found = true;
emitEventAction.setSourceRole__EmitEventAction(sourceRole);
}
}
if (!found)
dialog.getTreeViewer().remove(o);
}
dialog.open();
return (EventType) dialog.getResult();
}
Aggregations