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();
}
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;
}
}
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();
}
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;
}
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();
}
Aggregations