Search in sources :

Example 1 with ProcessingResourceType

use of org.palladiosimulator.pcm.resourcetype.ProcessingResourceType in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddHDDProcessingResourceSpecification method getResourceType.

private ProcessingResourceType getResourceType(final ProcessingResourceSpecification processingResourceSpecification) {
    // positive filter
    final ArrayList<Object> filterList = new ArrayList<Object>();
    // Set types to show and their super types
    filterList.add(ProcessingResourceType.class);
    filterList.add(ResourceRepository.class);
    final ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
    // set EReference that should be set (in this case: active resource type)
    additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_ActiveResourceType_ActiveResourceSpecification());
    final PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), filterList, additionalReferences, processingResourceSpecification.getResourceContainer_ProcessingResourceSpecification().eResource().getResourceSet());
    dialog.setProvidedService(ProcessingResourceType.class);
    dialog.open();
    if (dialog.getResult() == null || !(dialog.getResult() instanceof ProcessingResourceType)) {
        return null;
    }
    return (ProcessingResourceType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with ProcessingResourceType

use of org.palladiosimulator.pcm.resourcetype.ProcessingResourceType in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddHDDProcessingResourceSpecification method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final Object parameter = parameters.get(NEW_HDD_PROCESSING_RESOURCE_SPECIFICATION);
    if (parameter == null || !(parameter instanceof HDDProcessingResourceSpecification)) {
        return;
    }
    final HDDProcessingResourceSpecification hddProcessingResourceSpecification = (HDDProcessingResourceSpecification) parameter;
    // 1. dialog
    final ProcessingResourceType prt = getResourceType(hddProcessingResourceSpecification);
    if (prt != null) {
        hddProcessingResourceSpecification.setActiveResourceType_ActiveResourceSpecification(prt);
    } else {
        return;
    }
    // set processing rate always to 1
    final PCMRandomVariable processingRate = CoreFactory.eINSTANCE.createPCMRandomVariable();
    processingRate.setSpecification("1");
    hddProcessingResourceSpecification.setProcessingRate_ProcessingResourceSpecification(processingRate);
    // 2. dialog
    final PCMRandomVariable readProcessingRate = getReadProcessingRate();
    if (readProcessingRate != null) {
        hddProcessingResourceSpecification.setReadProcessingRate(readProcessingRate);
    } else {
        return;
    }
    // 3. dialog
    final PCMRandomVariable writeProcessingRate = getWriteProcessingRate();
    if (writeProcessingRate != null) {
        hddProcessingResourceSpecification.setWriteProcessingRate(writeProcessingRate);
    } else {
        return;
    }
    // 4. dialog
    final SchedulingPolicy sp = getSchedulingPolicy(hddProcessingResourceSpecification);
    if (sp != null) {
        hddProcessingResourceSpecification.setSchedulingPolicy(sp);
    } else {
        return;
    }
}
Also used : HDDProcessingResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.HDDProcessingResourceSpecification) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) SchedulingPolicy(org.palladiosimulator.pcm.resourcetype.SchedulingPolicy) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 3 with ProcessingResourceType

use of org.palladiosimulator.pcm.resourcetype.ProcessingResourceType in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddProcessingResourceSpecification method getResourceType.

private ProcessingResourceType getResourceType(final ProcessingResourceSpecification processingResourceSpecification) {
    // positive filter
    final ArrayList<Object> filterList = new ArrayList<Object>();
    // Set types to show and their super types
    filterList.add(ProcessingResourceType.class);
    filterList.add(ResourceRepository.class);
    final ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
    // set EReference that should be set (in this case: active resource type)
    additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_ActiveResourceType_ActiveResourceSpecification());
    final PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), filterList, additionalReferences, processingResourceSpecification.getResourceContainer_ProcessingResourceSpecification().eResource().getResourceSet());
    dialog.setProvidedService(ProcessingResourceType.class);
    dialog.open();
    if (dialog.getResult() == null || !(dialog.getResult() instanceof ProcessingResourceType)) {
        return null;
    }
    return (ProcessingResourceType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) EReference(org.eclipse.emf.ecore.EReference)

Example 4 with ProcessingResourceType

use of org.palladiosimulator.pcm.resourcetype.ProcessingResourceType in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddProcessingResourceSpecification method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    final Object parameter = parameters.get(NEW_PROCESSING_RESOURCE_SPECIFICATION);
    if (parameter == null || !(parameter instanceof ProcessingResourceSpecification)) {
        return;
    }
    final ProcessingResourceSpecification processingResourceSpecification = (ProcessingResourceSpecification) parameter;
    // 1. dialog
    final ProcessingResourceType prt = getResourceType(processingResourceSpecification);
    if (prt != null)
        processingResourceSpecification.setActiveResourceType_ActiveResourceSpecification(prt);
    else
        return;
    // 2. dialog
    final PCMRandomVariable pcmrv = getProcessingRate();
    if (pcmrv != null)
        processingResourceSpecification.setProcessingRate_ProcessingResourceSpecification(pcmrv);
    else
        return;
    // 3. dialog
    final SchedulingPolicy sp = getSchedulingPolicy(processingResourceSpecification);
    if (sp != null)
        processingResourceSpecification.setSchedulingPolicy(sp);
    else
        return;
}
Also used : ProcessingResourceSpecification(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) SchedulingPolicy(org.palladiosimulator.pcm.resourcetype.SchedulingPolicy) PCMRandomVariable(org.palladiosimulator.pcm.core.PCMRandomVariable)

Example 5 with ProcessingResourceType

use of org.palladiosimulator.pcm.resourcetype.ProcessingResourceType in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetRequiredResource method getProcessingResourceType.

private ProcessingResourceType getProcessingResourceType(ParametricResourceDemand rd) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(ResourceRepository.class);
    filter.add(ProcessingResourceType.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, rd.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(ProcessingResourceType.class);
    dialog.open();
    return (ProcessingResourceType) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) ProcessingResourceType(org.palladiosimulator.pcm.resourcetype.ProcessingResourceType) EReference(org.eclipse.emf.ecore.EReference)

Aggregations

ProcessingResourceType (org.palladiosimulator.pcm.resourcetype.ProcessingResourceType)7 EObject (org.eclipse.emf.ecore.EObject)5 ArrayList (java.util.ArrayList)3 EReference (org.eclipse.emf.ecore.EReference)3 PalladioSelectEObjectDialog (org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog)3 PCMRandomVariable (org.palladiosimulator.pcm.core.PCMRandomVariable)2 ProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification)2 SchedulingPolicy (org.palladiosimulator.pcm.resourcetype.SchedulingPolicy)2 Test (org.junit.Test)1 HDDProcessingResourceSpecification (org.palladiosimulator.pcm.resourceenvironment.HDDProcessingResourceSpecification)1 LinkingResource (org.palladiosimulator.pcm.resourceenvironment.LinkingResource)1 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)1 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)1 ParametricResourceDemand (org.palladiosimulator.pcm.seff.seff_performance.ParametricResourceDemand)1