/** * Dispose the contributions. */ public void dispose() { if (menuExtenders != null) { for (int i = 0; i < menuExtenders.size(); i++) { ((PopupMenuExtender) menuExtenders.get(i)).dispose(); } menuExtenders = null; } // Remove myself from the list of nested key binding services. if (service != null) { IKeyBindingService parentService = getMultiPageEditor().getEditorSite().getKeyBindingService(); if (parentService instanceof INestableKeyBindingService) { INestableKeyBindingService nestableParent = (INestableKeyBindingService) parentService; nestableParent.removeKeyBindingService(this); } if (service instanceof KeyBindingService) { ((KeyBindingService) service).dispose(); } service = null; } if (serviceLocator != null) { serviceLocator.dispose(); } }
public IKeyBindingService getKeyBindingService() { if (service == null) { service = getMultiPageEditor().getEditorSite().getKeyBindingService(); if (service instanceof INestableKeyBindingService) { INestableKeyBindingService nestableService = (INestableKeyBindingService) service; service = nestableService.getKeyBindingService(this); } else { /* * This is an internal reference, and should not be copied by client code. If you are thinking of copying this, * DON'T DO IT. */ WorkbenchPlugin .log("MultiPageEditorSite.getKeyBindingService() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ } } return service; }
private void bingdingKey( int newPageIndex ) { final IKeyBindingService service = getSite( ).getKeyBindingService( ); final IEditorPart editor = (IEditorPart) pages.get( newPageIndex ); if ( editor != null && editor.getEditorSite( ) != null ) { editor.setFocus( ); // There is no selected page, so deactivate the active service. if ( service instanceof INestableKeyBindingService ) { final INestableKeyBindingService nestableService = (INestableKeyBindingService) service; if ( editor != null ) { nestableService.activateKeyBindingService( editor.getEditorSite( ) ); } else { nestableService.activateKeyBindingService( null ); } } else { } } }
/** * This method can be used by implementors of {@link MultiPageEditorPart#createPageContainer(Composite)} to deactivate * the active inner editor services while their header has focus. A deactivateSite() must have a matching call to * activateSite() when appropriate. * <p> * An new inner editor will have its site activated on a {@link MultiPageEditorPart#pageChange(int)}. * </p> * <p> * <b>Note:</b> This API is evolving in 3.4 and this might not be its final form. * </p> * * @param immediate * immediately deactivate the legacy keybinding service * @param containerSiteActive * Leave the page container site active. * @since 3.4 * @see #activateSite() * @see #createPageContainer(Composite) * @see #getPageSite(int) * @see #PAGE_CONTAINER_SITE */ protected final void deactivateSite(boolean immediate, boolean containerSiteActive) { // Deactivate the nested services from the last active service locator. if (activeServiceLocator != null) { activeServiceLocator.deactivate(); activeServiceLocator = null; } final int pageIndex = getActivePage(); final IKeyBindingService service = getSite().getKeyBindingService(); if (pageIndex < 0 || pageIndex >= getPageCount() || immediate) { // There is no selected page, so deactivate the active service. if (service instanceof INestableKeyBindingService) { final INestableKeyBindingService nestableService = (INestableKeyBindingService) service; nestableService.activateKeyBindingService(null); } else { WorkbenchPlugin .log("MultiPageEditorPart.deactivateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ } } if (containerSiteActive) { IServiceLocator containerSite = getPageContainerSite(); if (containerSite instanceof INestable) { activeServiceLocator = (INestable) containerSite; activeServiceLocator.activate(); } } }
@Override public IKeyBindingService getKeyBindingService() { return null; }
@Override public IKeyBindingService getKeyBindingService() { // TODO Auto-generated method stub return null; }