Java Code Examples for org.eclipse.emf.ecore.util.EcoreUtil.getObjectsByType()

The following are Jave code examples for showing how to use getObjectsByType() of the org.eclipse.emf.ecore.util.EcoreUtil class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: neoscada   File: MemoryModelOscarProcessor.java   View Source Code Vote up 6 votes
@Override
public void process ( final OscarContext ctx, final EquinoxApplication application, final IProgressMonitor monitor )
{
    try
    {
        final Collection<Object> modules = EcoreUtil.getObjectsByType ( application.getModules (), MemoryManagerPackage.Literals.MEMORY_MANAGER_MODULE );

        if ( modules.isEmpty () )
        {
            return;
        }
        if ( modules.size () > 1 )
        {
            throw new IllegalStateException ( String.format ( "There must only be one module instance of type: %s", MemoryManagerModule.class.getName () ) );
        }

        process ( ctx, application, (MemoryManagerModule)modules.iterator ().next (), monitor );
    }
    finally
    {
        monitor.done ();
    }
}