Search in sources :

Example 1 with Repository

use of org.palladiosimulator.pcm.repository.Repository in project Palladio-Editors-Sirius by PalladioSimulator.

the class RepositoryCreationWizard method init.

@Override
protected void init(IStructuredSelection selection) {
    String viewpointName = Activator.VIEWPOINT_NAME;
    viewpoint = Activator.getDefault().getViewpoint();
    String ext = Activator.getDefault().getViewpoint().getModelFileExtension();
    modelCreationPage = new ModelCreationPage(selection, viewpointName + " Creation Wizard", "new" + viewpointName, ext);
    representationDescription = Activator.getDefault().getRepresentationDescription();
    String defaultRepresentationName = "new " + Activator.REPRESENTATION_NAME;
    this.representationCreationPage.setDefaultRepresentationName(defaultRepresentationName);
    Repository obj = RepositoryFactory.eINSTANCE.createRepository();
    obj.setEntityName("New Repository");
    modelObject = obj;
}
Also used : ModelCreationPage(org.palladiosimulator.editors.sirius.ui.wizard.model.ModelCreationPage) Repository(org.palladiosimulator.pcm.repository.Repository)

Example 2 with Repository

use of org.palladiosimulator.pcm.repository.Repository in project Palladio-Editors-Sirius by PalladioSimulator.

the class SetFailureType method execute.

@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
    InternalFailureOccurrenceDescription element = (InternalFailureOccurrenceDescription) parameters.get("instance");
    EObjectQuery query = new EObjectQuery(element);
    Collection<Resource> resources = query.getSession().getSemanticResources();
    boolean found = false;
    Resource resource = null;
    for (Resource r : resources) {
        if (r.getURI().equals(URI.createURI("pathmap://PCM_MODELS/FailureTypes.repository"))) {
            found = true;
            resource = r;
            break;
        }
    }
    if (found) {
        Repository rep = (Repository) resource.getContents().iterator().next();
        for (EObject o : rep.eContents()) {
            FailureType failureType = (FailureType) o;
            if (failureType.getEntityName().equals("SoftwareInducedFailure")) {
                element.setSoftwareInducedFailureType__InternalFailureOccurrenceDescription(((SoftwareInducedFailureType) failureType));
                break;
            }
        }
    }
}
Also used : EObjectQuery(org.eclipse.sirius.business.api.query.EObjectQuery) Repository(org.palladiosimulator.pcm.repository.Repository) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType) FailureType(org.palladiosimulator.pcm.reliability.FailureType) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) InternalFailureOccurrenceDescription(org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription) SoftwareInducedFailureType(org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)

Aggregations

Repository (org.palladiosimulator.pcm.repository.Repository)2 EObject (org.eclipse.emf.ecore.EObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 EObjectQuery (org.eclipse.sirius.business.api.query.EObjectQuery)1 ModelCreationPage (org.palladiosimulator.editors.sirius.ui.wizard.model.ModelCreationPage)1 FailureType (org.palladiosimulator.pcm.reliability.FailureType)1 InternalFailureOccurrenceDescription (org.palladiosimulator.pcm.reliability.InternalFailureOccurrenceDescription)1 SoftwareInducedFailureType (org.palladiosimulator.pcm.reliability.SoftwareInducedFailureType)1