org.eclipse.ui.IPartListener Java Examples
The following examples show how to use
org.eclipse.ui.IPartListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphicalEditorWithFlyoutPalette.java From birt with Eclipse Public License 1.0 | 5 votes |
public void shellActivated( ShellEvent e ) { if ( !shellActiveFlag ) { shellActiveFlag = true; // Pre-fetch shell from site in case it could be disposed before async execution final Shell siteShell = getSite( ).getShell( ); Display.getCurrent( ).asyncExec( new Runnable( ) { public void run( ) { if ( lastActiveShell == siteShell ) { // don't active the current active editor shellActiveFlag = false; return; } else { lastActiveShell = getSite( ).getShell( ); IEditorPart editor = UIUtil.getActiveEditor( true ); if ( editor instanceof IPartListener ) { // update the SessionHandleAdapter's model. // If old selection is dataset or datasource, // the selection status will lost. ( (IPartListener) editor ).partActivated( editor ); } shellActiveFlag = false; } } } ); } }
Example #2
Source File: CoolbarToolControl.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void loadContributions(IWorkbenchPage page) { contributions.stream().map(CustomToolItem::getContributionItem).filter(IPartListener.class::isInstance) .forEach(partListener -> page.removePartListener((IPartListener) partListener)); contributions.clear(); final IConfigurationElement[] elements = BonitaStudioExtensionRegistryManager.getInstance() .getConfigurationElements( "org.bonitasoft.studio.coolbarContributionItem"); if (elements.length >= MAX_CONTRIBUTION_SIZE) { throw new RuntimeException("Too many coolbar contributions defined"); } for (int i = 0; i < MAX_CONTRIBUTION_SIZE; i++) { final IConfigurationElement element = findContributionForPosition(i, elements); if (element != null) { try { final IBonitaContributionItem item = (IBonitaContributionItem) element .createExecutableExtension(CLASS); if (contributions.size() > i && item instanceof SeparatorCoolbarItem) { final IBonitaContributionItem previousItem = contributions.get(i - 1).getContributionItem(); if (previousItem instanceof SeparatorCoolbarItem) { item.setVisible(false); } } if (item.isVisible()) { if (item instanceof SaveCoolbarItem) { page.addPartListener((IPartListener) item); ((SaveCoolbarItem) item).partOpened(page.getActivePart()); } contributions.add(new CustomToolItem(item)); } } catch (final CoreException e) { BonitaStudioLog.error(e); } } } }