org.eclipse.emf.edit.domain.IEditingDomainProvider Java Examples
The following examples show how to use
org.eclipse.emf.edit.domain.IEditingDomainProvider.
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: MigrationStatusView.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("rawtypes") @Override public Object getAdapter(final Class adapter) { if (adapter == IPropertySheetPage.class) { return getSite().getPage().getActiveEditor().getAdapter(adapter); } else if (adapter == IEditingDomainProvider.class) { return new IEditingDomainProvider() { @Override public EditingDomain getEditingDomain() { final IEditorPart part = getSite().getPage().getActiveEditor(); if (part instanceof DiagramEditor) { return ((DiagramEditor) part).getEditingDomain(); } return null; } }; } return super.getAdapter(adapter); }
Example #2
Source File: FillFieldNumbersHandler.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public Object execute ( final ExecutionEvent event ) throws ExecutionException { final IEditorPart editor = getActivePage ().getActiveEditor (); byte b = (byte)1; for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) ) { EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute ); if ( domain == null && editor instanceof IEditingDomainProvider ) { domain = ( (IEditingDomainProvider)editor ).getEditingDomain (); } SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute (); b++; } return null; }
Example #3
Source File: ExtensionsActionBarContributor.java From ifml-editor with MIT License | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #4
Source File: CoreActionBarContributor.java From ifml-editor with MIT License | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #5
Source File: EipActionBarContributor.java From eip-designer with Apache License 2.0 | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #6
Source File: BeansActionBarContributor.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #7
Source File: GenconfActionBarContributor.java From M2Doc with Eclipse Public License 1.0 | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { Object object = ((IStructuredSelection) selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #8
Source File: CrossflowActionBarContributor.java From scava with Eclipse Public License 2.0 | 5 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }
Example #9
Source File: RecipeActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #10
Source File: ConfigurationActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #11
Source File: ItemActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #12
Source File: ComponentActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #13
Source File: GlobalizeActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #14
Source File: SecurityActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #15
Source File: InfrastructureActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #16
Source File: ProtocolActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #17
Source File: MemoryActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #18
Source File: WorldActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #19
Source File: OsgiActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #20
Source File: ProfileActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #21
Source File: SetupActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #22
Source File: DeploymentActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #23
Source File: VisualInterfaceActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #24
Source File: DetailViewActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged ( SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( createChildMenuManager != null ) { depopulateManager ( createChildMenuManager, createChildSubmenuActions ); depopulateManager ( createChildMenuManager, createChildActions ); } if ( createSiblingMenuManager != null ) { depopulateManager ( createSiblingMenuManager, createSiblingSubmenuActions ); depopulateManager ( createSiblingMenuManager, createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { Object object = ( (IStructuredSelection)selection ).getFirstElement (); EditingDomain domain = ( (IEditingDomainProvider)activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); createChildSubmenuActions = extractSubmenuActions ( createChildActions ); createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); createSiblingSubmenuActions = extractSubmenuActions ( createSiblingActions ); if ( createChildMenuManager != null ) { populateManager ( createChildMenuManager, createChildSubmenuActions, null ); populateManager ( createChildMenuManager, createChildActions, null ); createChildMenuManager.update ( true ); } if ( createSiblingMenuManager != null ) { populateManager ( createSiblingMenuManager, createSiblingSubmenuActions, null ); populateManager ( createSiblingMenuManager, createSiblingActions, null ); createSiblingMenuManager.update ( true ); } }
Example #25
Source File: ChartActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings that can * be added to the selected object and updating the menus accordingly. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void selectionChanged ( final SelectionChangedEvent event ) { // Remove any menu items for old selection. // if ( this.createChildMenuManager != null ) { depopulateManager ( this.createChildMenuManager, this.createChildActions ); } if ( this.createSiblingMenuManager != null ) { depopulateManager ( this.createSiblingMenuManager, this.createSiblingActions ); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; final ISelection selection = event.getSelection (); if ( selection instanceof IStructuredSelection && ( (IStructuredSelection)selection ).size () == 1 ) { final Object object = ( (IStructuredSelection)selection ).getFirstElement (); final EditingDomain domain = ( (IEditingDomainProvider)this.activeEditorPart ).getEditingDomain (); newChildDescriptors = domain.getNewChildDescriptors ( object, null ); newSiblingDescriptors = domain.getNewChildDescriptors ( null, object ); } // Generate actions for selection; populate and redraw the menus. // this.createChildActions = generateCreateChildActions ( newChildDescriptors, selection ); this.createSiblingActions = generateCreateSiblingActions ( newSiblingDescriptors, selection ); if ( this.createChildMenuManager != null ) { populateManager ( this.createChildMenuManager, this.createChildActions, null ); this.createChildMenuManager.update ( true ); } if ( this.createSiblingMenuManager != null ) { populateManager ( this.createSiblingMenuManager, this.createSiblingActions, null ); this.createSiblingMenuManager.update ( true ); } }
Example #26
Source File: ChartActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
public void setViewPart ( final IViewPart part ) { if ( part != this.activeEditorPart ) { if ( this.activeEditorPart != null ) { deactivate (); } if ( part instanceof IEditingDomainProvider ) { this.activeEditorPart = part; activate (); } } // Switch to the new selection provider. // if ( this.selectionProvider != null ) { this.selectionProvider.removeSelectionChangedListener ( this ); } if ( part == null ) { this.selectionProvider = null; } else { this.selectionProvider = part.getSite ().getSelectionProvider (); this.selectionProvider.addSelectionChangedListener ( this ); this.deleteAction.setActiveWorkbenchPart ( part ); // Fake a selection changed event to update the menus. // if ( this.selectionProvider.getSelection () != null ) { selectionChanged ( new SelectionChangedEvent ( this.selectionProvider, this.selectionProvider.getSelection () ) ); } } }
Example #27
Source File: ChartActionBarContributor.java From neoscada with Eclipse Public License 1.0 | 4 votes |
/** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { Object object = ((IStructuredSelection) selection) .getFirstElement(); EditingDomain domain = ((IEditingDomainProvider) activeEditorPart) .getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions( newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } }