Search in sources :

Example 1 with IDomain

use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.

the class SimulationView method updateTypeSystem.

private void updateTypeSystem(final IDebugTarget debugTarget) {
    IDomain domain = DomainRegistry.getDomain((EObject) debugTarget.getAdapter(EObject.class));
    typeSystem = domain.getInjector(IDomain.FEATURE_SIMULATION).getInstance(ITypeSystem.class);
}
Also used : ITypeSystem(org.yakindu.base.types.typesystem.ITypeSystem) IDomain(org.yakindu.sct.domain.extension.IDomain)

Example 2 with IDomain

use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.

the class PlugableExternalXtextLabelEditPart method init.

private void init(String target) {
    IDomain domain = DomainRegistry.getDomain(resolveSemanticElement());
    injector = domain.getInjector(IDomain.FEATURE_EDITOR, target);
}
Also used : IDomain(org.yakindu.sct.domain.extension.IDomain)

Example 3 with IDomain

use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.

the class DomainSpecificTaskFinder method findTasks.

@Override
public List<Task> findTasks(Resource resource) {
    if (resource instanceof AbstractSCTResource) {
        IDomain domain = DomainRegistry.getDomain((EObject) EcoreUtil2.getObjectByType(resource.getContents(), SGraphPackage.Literals.STATECHART));
        ITaskFinder taskFinder = domain.getInjector(IDomain.FEATURE_RESOURCE).getInstance(ITaskFinder.class);
        if (taskFinder != null)
            return taskFinder.findTasks(resource);
    }
    return Collections.emptyList();
}
Also used : IDomain(org.yakindu.sct.domain.extension.IDomain) AbstractSCTResource(org.yakindu.sct.model.sgraph.resource.AbstractSCTResource) ITaskFinder(org.eclipse.xtext.tasks.ITaskFinder)

Example 4 with IDomain

use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.

the class StextResourceFactory method createResource.

@Override
public Resource createResource(URI uri) {
    String domainID = DomainRegistry.determineDomainID(uri);
    if (domainID == null || DomainRegistry.getDomain(domainID) == null) {
        return new XMIResourceImpl(uri);
    }
    IDomain domain = DomainRegistry.getDomain(domainID);
    Injector injector = getInjector(domain);
    Resource resource = injector.getInstance(Resource.class);
    ResourceSet set = new ResourceSetImpl();
    set.getResources().add(resource);
    resource.setURI(uri);
    return resource;
}
Also used : IDomain(org.yakindu.sct.domain.extension.IDomain) ResourceSetImpl(org.eclipse.emf.ecore.resource.impl.ResourceSetImpl) Injector(com.google.inject.Injector) Resource(org.eclipse.emf.ecore.resource.Resource) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) XMIResourceImpl(org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl)

Example 5 with IDomain

use of org.yakindu.sct.domain.extension.IDomain in project statecharts by Yakindu.

the class StatechartPropertySection method bindDomainCombo.

protected void bindDomainCombo(EMFDataBindingContext context) {
    IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject), BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID);
    IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(domainCombo);
    UpdateValueStrategy modelToTarget = new UpdateValueStrategy() {

        @Override
        public Object convert(Object value) {
            return ((IDomain) value).getDomainID();
        }
    };
    UpdateValueStrategy targetToModel = new UpdateValueStrategy() {

        @Override
        public Object convert(Object value) {
            return DomainRegistry.getDomain((String) value);
        }
    };
    context.bindValue(observeSingleSelection, property.observe(eObject), modelToTarget, targetToModel);
}
Also used : UpdateValueStrategy(org.eclipse.core.databinding.UpdateValueStrategy) IDomain(org.yakindu.sct.domain.extension.IDomain) EObject(org.eclipse.emf.ecore.EObject) IEMFValueProperty(org.eclipse.emf.databinding.IEMFValueProperty) IViewerObservableValue(org.eclipse.jface.databinding.viewers.IViewerObservableValue)

Aggregations

IDomain (org.yakindu.sct.domain.extension.IDomain)11 Injector (com.google.inject.Injector)4 CoreException (org.eclipse.core.runtime.CoreException)2 EObject (org.eclipse.emf.ecore.EObject)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)2 ResourceSetImpl (org.eclipse.emf.ecore.resource.impl.ResourceSetImpl)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ComboViewer (org.eclipse.jface.viewers.ComboViewer)2 LabelProvider (org.eclipse.jface.viewers.LabelProvider)2 Label (org.eclipse.swt.widgets.Label)2 ITypeSystem (org.yakindu.base.types.typesystem.ITypeSystem)2 UpdateValueStrategy (org.eclipse.core.databinding.UpdateValueStrategy)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IEMFValueProperty (org.eclipse.emf.databinding.IEMFValueProperty)1 URIConverter (org.eclipse.emf.ecore.resource.URIConverter)1 XMIResourceImpl (org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl)1 IViewerObservableValue (org.eclipse.jface.databinding.viewers.IViewerObservableValue)1 ImageRegistry (org.eclipse.jface.resource.ImageRegistry)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1