1 11 package org.eclipse.ui.internal.part.services; 12 13 import org.eclipse.jface.viewers.ISelection; 14 import org.eclipse.ui.internal.components.framework.ComponentException; 15 import org.eclipse.ui.internal.components.framework.IServiceProvider; 16 import org.eclipse.ui.internal.part.Part; 17 import org.eclipse.ui.internal.part.components.services.ISelectionHandler; 18 import org.eclipse.ui.internal.part.multiplexer.INestedComponent; 19 import org.eclipse.ui.internal.part.multiplexer.ISharedContext; 20 21 26 public class ChildSelectionHandler implements ISelectionHandler, INestedComponent { 27 28 private ISelectionHandler parent; 29 private ISelection selection; 30 private boolean isActive = false; 31 32 public ChildSelectionHandler(ISharedContext shared) throws ComponentException { 33 34 IServiceProvider parentContainer = shared.getSharedComponents(); 35 this.parent = (ISelectionHandler)parentContainer.getService(ISelectionHandler.class); 38 } 39 40 43 public void activate(Part newActivePart) { 44 parent.setSelection(selection); 46 isActive = true; 47 } 48 49 52 public void deactivate(Object newActive) { 53 isActive = false; 54 } 55 56 59 public void setSelection(ISelection newSelection) { 60 selection = newSelection; 62 if (isActive) { 63 parent.setSelection(newSelection); 66 } 67 } 68 69 } 70 | Popular Tags |