Search in sources :

Example 1 with EventItemProviderAdapterFactory

use of org.malai.event.provider.EventItemProviderAdapterFactory in project Malai by arnobl.

the class EventEditor method initializeEditingDomain.

/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain() {
    // Create an adapter factory that yields item providers.
    // 
    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EventItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    // Create the command stack that will notify this editor as commands are executed.
    // 
    BasicCommandStack commandStack = new BasicCommandStack();
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    // 
    commandStack.addCommandStackListener(new CommandStackListener() {

        public void commandStackChanged(final EventObject event) {
            getContainer().getDisplay().asyncExec(new Runnable() {

                public void run() {
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                    // Try to select the affected objects.
                    // 
                    Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
                    if (mostRecentCommand != null) {
                        setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                    }
                    if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
                        propertySheetPage.refresh();
                    }
                }
            });
        }
    });
    // Create the editing domain with a special command stack.
    // 
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
Also used : AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) CommandStack(org.eclipse.emf.common.command.CommandStack) EventItemProviderAdapterFactory(org.malai.event.provider.EventItemProviderAdapterFactory) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ResourceItemProviderAdapterFactory(org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) EventObject(java.util.EventObject) EcoreItemProviderAdapterFactory(org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory) ReflectiveItemProviderAdapterFactory(org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory) Command(org.eclipse.emf.common.command.Command)

Example 2 with EventItemProviderAdapterFactory

use of org.malai.event.provider.EventItemProviderAdapterFactory in project Malai by arnobl.

the class InstrumentEditor method initializeEditingDomain.

/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain() {
    // Create an adapter factory that yields item providers.
    // 
    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new InstrumentItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ActionItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EventItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new InteractionItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new WidgetItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    // Create the command stack that will notify this editor as commands are executed.
    // 
    BasicCommandStack commandStack = new BasicCommandStack();
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    // 
    commandStack.addCommandStackListener(new CommandStackListener() {

        public void commandStackChanged(final EventObject event) {
            getContainer().getDisplay().asyncExec(new Runnable() {

                public void run() {
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                    // Try to select the affected objects.
                    // 
                    Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
                    if (mostRecentCommand != null) {
                        setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                    }
                    if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
                        propertySheetPage.refresh();
                    }
                }
            });
        }
    });
    // Create the editing domain with a special command stack.
    // 
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
Also used : InteractionItemProviderAdapterFactory(org.malai.interaction.provider.InteractionItemProviderAdapterFactory) AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) CommandStack(org.eclipse.emf.common.command.CommandStack) EventItemProviderAdapterFactory(org.malai.event.provider.EventItemProviderAdapterFactory) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ResourceItemProviderAdapterFactory(org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ActionItemProviderAdapterFactory(org.malai.action.provider.ActionItemProviderAdapterFactory) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) EventObject(java.util.EventObject) EcoreItemProviderAdapterFactory(org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory) ReflectiveItemProviderAdapterFactory(org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory) Command(org.eclipse.emf.common.command.Command) InstrumentItemProviderAdapterFactory(org.malai.instrument.provider.InstrumentItemProviderAdapterFactory) WidgetItemProviderAdapterFactory(org.malai.widget.provider.WidgetItemProviderAdapterFactory)

Example 3 with EventItemProviderAdapterFactory

use of org.malai.event.provider.EventItemProviderAdapterFactory in project Malai by arnobl.

the class InteractionEditor method initializeEditingDomain.

/**
 * This sets up the editing domain for the model editor.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void initializeEditingDomain() {
    // Create an adapter factory that yields item providers.
    // 
    adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new InteractionItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new EventItemProviderAdapterFactory());
    adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
    // Create the command stack that will notify this editor as commands are executed.
    // 
    BasicCommandStack commandStack = new BasicCommandStack();
    // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
    // 
    commandStack.addCommandStackListener(new CommandStackListener() {

        public void commandStackChanged(final EventObject event) {
            getContainer().getDisplay().asyncExec(new Runnable() {

                public void run() {
                    firePropertyChange(IEditorPart.PROP_DIRTY);
                    // Try to select the affected objects.
                    // 
                    Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
                    if (mostRecentCommand != null) {
                        setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                    }
                    if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
                        propertySheetPage.refresh();
                    }
                }
            });
        }
    });
    // Create the editing domain with a special command stack.
    // 
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
}
Also used : InteractionItemProviderAdapterFactory(org.malai.interaction.provider.InteractionItemProviderAdapterFactory) AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) CommandStack(org.eclipse.emf.common.command.CommandStack) EventItemProviderAdapterFactory(org.malai.event.provider.EventItemProviderAdapterFactory) CommandStackListener(org.eclipse.emf.common.command.CommandStackListener) ResourceItemProviderAdapterFactory(org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) BasicCommandStack(org.eclipse.emf.common.command.BasicCommandStack) EventObject(java.util.EventObject) EcoreItemProviderAdapterFactory(org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory) ReflectiveItemProviderAdapterFactory(org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory) Command(org.eclipse.emf.common.command.Command)

Aggregations

EventObject (java.util.EventObject)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 BasicCommandStack (org.eclipse.emf.common.command.BasicCommandStack)3 Command (org.eclipse.emf.common.command.Command)3 CommandStack (org.eclipse.emf.common.command.CommandStack)3 CommandStackListener (org.eclipse.emf.common.command.CommandStackListener)3 EcoreItemProviderAdapterFactory (org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory)3 AdapterFactoryEditingDomain (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain)3 ComposedAdapterFactory (org.eclipse.emf.edit.provider.ComposedAdapterFactory)3 ReflectiveItemProviderAdapterFactory (org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory)3 ResourceItemProviderAdapterFactory (org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory)3 EventItemProviderAdapterFactory (org.malai.event.provider.EventItemProviderAdapterFactory)3 InteractionItemProviderAdapterFactory (org.malai.interaction.provider.InteractionItemProviderAdapterFactory)2 ActionItemProviderAdapterFactory (org.malai.action.provider.ActionItemProviderAdapterFactory)1 InstrumentItemProviderAdapterFactory (org.malai.instrument.provider.InstrumentItemProviderAdapterFactory)1 WidgetItemProviderAdapterFactory (org.malai.widget.provider.WidgetItemProviderAdapterFactory)1