@Test public void getSpaceInfoWithScopeTest() { final PreferenceScopeResolutionStrategyInfo scopeInfo = scopeResolutionStrategies.getSpaceInfoFor("mySpace"); final List<PreferenceScope> order = scopeInfo.order(); assertEquals(3, order.size()); final PreferenceScope firstScope = order.get(0); assertEquals("space", firstScope.type()); assertEquals("mySpace", firstScope.key()); final PreferenceScope secondScope = order.get(1); assertEquals("user", secondScope.type()); assertEquals("admin", secondScope.key()); final PreferenceScope thirdScope = order.get(2); assertEquals("global", thirdScope.type()); assertEquals("global", thirdScope.key()); final PreferenceScope defaultScope = scopeInfo.defaultScope(); assertEquals("space", defaultScope.type()); assertEquals("mySpace", defaultScope.key()); }
@Override public PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if (scopeKey != null) { final PreferenceScope spaceScope = scopeFactory.createScope(WorkbenchPreferenceScopes.SPACE, scopeKey); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, spaceScope); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory); } return scopeResolutionStrategy.getInfo(); }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if (scopeKey != null) { final PreferenceScope spaceScope = scopeFactory.createScope(WorkbenchPreferenceScopes.SPACE, scopeKey); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, spaceScope); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory); } return scopeResolutionStrategy.getInfo(); } }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if (scopeKey != null) { final PreferenceScope spaceScope = scopeFactory.createScope(WorkbenchPreferenceScopes.SPACE, scopeKey); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, spaceScope); } else { scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory); } return scopeResolutionStrategy.getInfo(); } WorkbenchPreferenceScopeResolutionStrategiesImpl(); @Inject  WorkbenchPreferenceScopeResolutionStrategiesImpl( final PreferenceScopeFactory scopeFactory ); }
WorkbenchPreferenceScopeResolutionStrategiesImpl implements WorkbenchPreferenceScopeResolutionStrategies { @Override public PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if (scopeKey != null) { final PreferenceScope spaceScope = scopeFactory.createScope(WorkbenchPreferenceScopes.SPACE, scopeKey); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, spaceScope); } 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 getSpaceInfoFor(final String scopeKey) { PreferenceScopeResolutionStrategy scopeResolutionStrategy; if (scopeKey != null) { final PreferenceScope spaceScope = scopeFactory.createScope(WorkbenchPreferenceScopes.SPACE, scopeKey); scopeResolutionStrategy = new WorkbenchPreferenceScopeResolutionStrategy(scopeFactory, spaceScope); } 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);  }