@Test public void getInfoWithScopeTest() { final PreferenceScopeResolutionStrategyInfo scopeInfo = scopeResolutionStrategies.getUserInfoFor(WorkbenchPreferenceScopes.PROJECT, "my-project"); final List<PreferenceScope> order = scopeInfo.order(); assertEquals(3, order.size()); final PreferenceScope firstScope = order.get(0); assertEquals("user", firstScope.type()); assertEquals("admin", firstScope.key()); assertEquals("project", firstScope.childScope().type()); assertEquals("my-project", firstScope.childScope().key()); final PreferenceScope secondScope = order.get(1); assertEquals("user", secondScope.type()); assertEquals("admin", secondScope.key()); final PreferenceScope threeScope = order.get(2); assertEquals("global", threeScope.type()); assertEquals("global", threeScope.key()); final PreferenceScope defaultScope = scopeInfo.defaultScope(); assertEquals("user", defaultScope.type()); assertEquals("admin", defaultScope.key()); assertEquals("project", defaultScope.childScope().type()); assertEquals("my-project", defaultScope.childScope().key()); }
@Override public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType, final String scopeKey ) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if ( scopeType != null ) { PreferenceScope userScope = scopeFactory.createScope( WorkbenchPreferenceScopes.USER ); PreferenceScope userScopedScope; if ( scopeKey != null ) { userScopedScope = scopeFactory.createScope(scopeType, scopeKey ); } else { userScopedScope = scopeFactory.createScope(scopeType ); } PreferenceScope projectUserScope = scopeFactory.createScope(userScope, userScopedScope ); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, projectUserScope ); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory ); } return scopeResolutionStrategy.getInfo(); }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType, final String scopeKey ) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if ( scopeType != null ) { PreferenceScope userScope = scopeFactory.createScope( WorkbenchPreferenceScopes.USER ); PreferenceScope userScopedScope; if ( scopeKey != null ) { userScopedScope = scopeFactory.createScope(scopeType, scopeKey ); } else { userScopedScope = scopeFactory.createScope(scopeType ); } PreferenceScope projectUserScope = scopeFactory.createScope(userScope, userScopedScope ); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, projectUserScope ); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory ); } return scopeResolutionStrategy.getInfo(); } }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType, final String scopeKey ) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if ( scopeType != null ) { PreferenceScope userScope = scopeFactory.createScope( WorkbenchPreferenceScopes.USER ); PreferenceScope userScopedScope; if ( scopeKey != null ) { userScopedScope = scopeFactory.createScope(scopeType, scopeKey ); } else { userScopedScope = scopeFactory.createScope(scopeType ); } PreferenceScope projectUserScope = scopeFactory.createScope(userScope, userScopedScope ); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, projectUserScope ); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory ); } return scopeResolutionStrategy.getInfo(); } WorkbenchPreferenceScopeResolutionStrategiesImpl(); @Inject  WorkbenchPreferenceScopeResolutionStrategiesImpl( final PreferenceScopeFactory scopeFactory ); }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType, final String scopeKey ) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if ( scopeType != null ) { PreferenceScope userScope = scopeFactory.createScope( WorkbenchPreferenceScopes.USER ); PreferenceScope userScopedScope; if ( scopeKey != null ) { userScopedScope = scopeFactory.createScope(scopeType, scopeKey ); } else { userScopedScope = scopeFactory.createScope(scopeType ); } PreferenceScope projectUserScope = scopeFactory.createScope(userScope, userScopedScope ); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, projectUserScope ); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory ); } return scopeResolutionStrategy.getInfo(); } WorkbenchPreferenceScopeResolutionStrategiesImpl(); @Inject  WorkbenchPreferenceScopeResolutionStrategiesImpl( final PreferenceScopeFactory scopeFactory ); @Override PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType,
                                                                final String scopeKey ); @Override PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey); }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType, final String scopeKey ) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if ( scopeType != null ) { PreferenceScope userScope = scopeFactory.createScope( WorkbenchPreferenceScopes.USER ); PreferenceScope userScopedScope; if ( scopeKey != null ) { userScopedScope = scopeFactory.createScope(scopeType, scopeKey ); } else { userScopedScope = scopeFactory.createScope(scopeType ); } PreferenceScope projectUserScope = scopeFactory.createScope(userScope, userScopedScope ); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, projectUserScope ); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory ); } return scopeResolutionStrategy.getInfo(); } WorkbenchPreferenceScopeResolutionStrategiesImpl(); @Inject  WorkbenchPreferenceScopeResolutionStrategiesImpl( final PreferenceScopeFactory scopeFactory ); @Override PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType,
                                                                final String scopeKey ); @Override PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey);  }