private String getPreferenceKey() { return contentService.getViewerId() + ACTIVATED_EXTENSIONS; }
/** * * @param aContentService The Content Service to register. */ public synchronized void registerContentService(INavigatorContentService aContentService) { if(findService(aContentService.getViewerId()) == null) { registeredContentServices.add(new WeakReference(aContentService)); } }
/** * * @param aViewerId A viewer id that should have previously been registered with the service. * @return The registered content service for the given viewer id. */ public synchronized INavigatorContentService findService(String aViewerId) { if(aViewerId == null || aViewerId.length() == 0) { return null; } INavigatorContentService contentService; for (Iterator iter = registeredContentServices.iterator(); iter.hasNext();) { WeakReference ref = (WeakReference) iter.next(); if(ref.get() == null) { iter.remove(); } else { contentService = (INavigatorContentService)ref.get(); if(aViewerId.equals(contentService.getViewerId())) { return contentService; } } } return null; }
private void notifyListeners(String[] navigatorExtensionIds, boolean toEnable) { if(navigatorExtensionIds != null) { // should really never be null, but just in case if(navigatorExtensionIds.length > 1) Arrays.sort(navigatorExtensionIds); Object[] listenerArray = listeners.getListeners(); for (int i = 0; i < listenerArray.length; i++) { ((IExtensionActivationListener) listenerArray[i]) .onExtensionActivation(contentService.getViewerId(), navigatorExtensionIds, toEnable); } } }
/** * Return the state model for the given descriptor. * * @param aDescriptor A content descriptor * @return The state model for the given descriptor. */ public IExtensionStateModel getExtensionStateModel( INavigatorContentDescriptor aDescriptor) { synchronized (lock) { IExtensionStateModel model = (IExtensionStateModel) stateModels .get(aDescriptor); if (model == null) stateModels.put(aDescriptor, model = new ExtensionStateModel( aDescriptor.getId(), contentService.getViewerId())); return model; } }
/** * * @param aContentService * The associated content service that is the source of the drag * @return A PluginTransferData properly configured to call the Common * Navigator's PluginDropAction. */ public static PluginTransferData createTransferData( INavigatorContentService aContentService) { NavigatorContentServiceTransfer.getInstance().registerContentService( aContentService); return new PluginTransferData(CN_PLUGIN_ACTION_ID, aContentService .getViewerId().getBytes()); }