Search in sources :

Example 51 with EReference

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) DataType(org.palladiosimulator.pcm.repository.DataType) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 52 with EReference

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;
}
Also used : TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) ArrayList(java.util.ArrayList) TypeDialogCellEditor(org.palladiosimulator.editors.commons.tabs.operations.TypeDialogCellEditor) CallDataTypeDialog(org.palladiosimulator.editors.commons.dialogs.datatype.CallDataTypeDialog) Control(org.eclipse.swt.widgets.Control) Repository(org.palladiosimulator.pcm.repository.Repository) EventTypeDeleteCellValueListener(org.palladiosimulator.editors.commons.tabs.operations.EventTypeDeleteCellValueListener) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) DataType(org.palladiosimulator.pcm.repository.DataType) EObject(org.eclipse.emf.ecore.EObject) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) EReference(org.eclipse.emf.ecore.EReference)

Example 53 with EReference

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();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) SchedulingPolicy(org.palladiosimulator.pcm.resourcetype.SchedulingPolicy) EReference(org.eclipse.emf.ecore.EReference)

Example 54 with EReference

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();
}
Also used : PassiveResource(org.palladiosimulator.pcm.repository.PassiveResource) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Example 55 with EReference

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();
}
Also used : SourceRole(org.palladiosimulator.pcm.repository.SourceRole) RequiredRole(org.palladiosimulator.pcm.repository.RequiredRole) EventType(org.palladiosimulator.pcm.repository.EventType) ArrayList(java.util.ArrayList) ServiceEffectSpecification(org.palladiosimulator.pcm.seff.ServiceEffectSpecification) EventGroup(org.palladiosimulator.pcm.repository.EventGroup) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

EReference (org.eclipse.emf.ecore.EReference)229 EObject (org.eclipse.emf.ecore.EObject)118 EClass (org.eclipse.emf.ecore.EClass)58 List (java.util.List)52 ArrayList (java.util.ArrayList)48 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)37 Test (org.junit.Test)31 EAttribute (org.eclipse.emf.ecore.EAttribute)29 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)28 EClassifier (org.eclipse.emf.ecore.EClassifier)21 Resource (org.eclipse.emf.ecore.resource.Resource)21 IdEObject (org.bimserver.emf.IdEObject)18 EList (org.eclipse.emf.common.util.EList)17 IScope (org.eclipse.xtext.scoping.IScope)15 HashMapVirtualObject (org.bimserver.shared.HashMapVirtualObject)14 InternalEObject (org.eclipse.emf.ecore.InternalEObject)14 URI (org.eclipse.emf.common.util.URI)13 EPackage (org.eclipse.emf.ecore.EPackage)12 AbstractEList (org.eclipse.emf.common.util.AbstractEList)10 CrossReference (org.eclipse.xtext.CrossReference)10