1 11 12 package org.eclipse.ui.internal.navigator; 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 17 import org.eclipse.ui.internal.navigator.extensions.ExtensionStateModel; 18 import org.eclipse.ui.navigator.IExtensionStateModel; 19 import org.eclipse.ui.navigator.INavigatorContentDescriptor; 20 import org.eclipse.ui.navigator.INavigatorContentService; 21 22 32 public class NavigatorExtensionStateService { 33 34 private final Object lock = new Object (); 35 private INavigatorContentService contentService; 36 37 44 public NavigatorExtensionStateService(INavigatorContentService theContentService) { 45 contentService = theContentService; 46 } 47 48 52 private final Map stateModels = new HashMap (); 53 54 60 public IExtensionStateModel getExtensionStateModel( 61 INavigatorContentDescriptor aDescriptor) { 62 synchronized (lock) { 63 IExtensionStateModel model = (IExtensionStateModel) stateModels 64 .get(aDescriptor); 65 if (model == null) 66 stateModels.put(aDescriptor, model = new ExtensionStateModel( 67 aDescriptor.getId(), contentService.getViewerId())); 68 return model; 69 } 70 } 71 72 } 73 | Popular Tags |