/** * Constructor for AbstractLaunchConfigurationAction. * @param text the action label * @param viewer the viewer the action belongs to * @param mode the mode the action applies to */ public AbstractLaunchConfigurationAction(String text, Viewer viewer, String mode) { super(text); fViewer = viewer; fViewer.addSelectionChangedListener(this); fMode = mode; }
public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration) { if (input != getInput()) return null; final Viewer v = CompareUI.findStructureViewer(oldViewer, input, parent, configuration); if (v != null) { v.getControl().addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { v.removeSelectionChangedListener(InternalOutlineViewerCreator.this); } }); v.addSelectionChangedListener(this); } return v; }
protected void createCatalogDetailsView(Composite parent) { Group detailsGroup = new Group(parent, SWT.NONE); detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); detailsGroup.setLayout(new GridLayout()); detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS); final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup); ISelectionChangedListener listener = new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogEntry) { ICatalogEntry entry = (ICatalogEntry) selectedObject; detailsView.setCatalogElement(entry); } else if (selectedObject instanceof INextCatalog) { INextCatalog entry = (INextCatalog) selectedObject; detailsView.setCatalogElement(entry); } else { detailsView.setCatalogElement((ICatalogEntry) null); } } }; catalogEntriesView.getViewer().addSelectionChangedListener(listener); }
viewer.addSelectionChangedListener(selectionChangedListener);
@Override public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration) { if (input != getInput()) return null; final Viewer v = CompareUI.findStructureViewer(oldViewer, input, parent, configuration); if (v != null) { v.getControl().addDisposeListener(e -> v.removeSelectionChangedListener(InternalOutlineViewerCreator.this)); v.addSelectionChangedListener(this); } return v; }
protected void createCatalogDetailsView(Composite parent) { Group detailsGroup = new Group(parent, SWT.NONE); detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); detailsGroup.setLayout(new GridLayout()); detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS); final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup); ISelectionChangedListener listener = new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; if (selectedObject instanceof ICatalogEntry) { ICatalogEntry entry = (ICatalogEntry) selectedObject; detailsView.setCatalogElement(entry); currentSelectionLocation = entry.getURI(); currentSelectionNamespace = entry.getKey(); } else { detailsView.setCatalogElement((ICatalogEntry) null); currentSelectionLocation = ""; currentSelectionNamespace = ""; } } }; catalogEntriesView.getViewer().addSelectionChangedListener(listener); }
@Override protected void initializeAndShowPage(final IPageBookViewPage page) { if (viewer != null) viewer.removeSelectionChangedListener(this); IPageSite site = new SubPageSite(getSite()); if (book != null && page != null) { try { page.init(site); } catch (PartInitException e) { CasEditorPlugin.log(e); } } super.initializeAndShowPage(page); if (book != null) { if (page != null) { viewer = ((AnnotationOutline) page).getViewer(); viewer.addSelectionChangedListener(this); } else { viewer = null; } } }
getViewer().addSelectionChangedListener(paste); paste.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); getViewer().addSelectionChangedListener(remove);