1 11 package org.eclipse.ui.internal.part.services; 12 13 import org.eclipse.core.runtime.IStatus; 14 import org.eclipse.jface.resource.ImageDescriptor; 15 import org.eclipse.ui.internal.components.Assert; 16 import org.eclipse.ui.internal.components.framework.ComponentException; 17 import org.eclipse.ui.internal.components.framework.IServiceProvider; 18 import org.eclipse.ui.internal.part.Part; 19 import org.eclipse.ui.internal.part.components.services.IPartDescriptor; 20 import org.eclipse.ui.internal.part.components.services.IStatusHandler; 21 import org.eclipse.ui.internal.part.multiplexer.INestedComponent; 22 import org.eclipse.ui.internal.part.multiplexer.ISharedContext; 23 24 public class ChildStatusHandler implements IStatusHandler, INestedComponent { 25 26 private boolean active = false; 27 private IStatusHandler parent; 28 private ImageDescriptor image; 29 private IStatus message; 30 31 34 public ChildStatusHandler(IPartDescriptor descr, ISharedContext shared) throws ComponentException { 35 Assert.isNotNull(descr); 36 IServiceProvider sharedContainer = shared.getSharedComponents(); 37 38 this.parent = (IStatusHandler)sharedContainer.getService(IStatusHandler.class); 39 } 40 41 public void set(IStatus message, ImageDescriptor image) { 42 this.image = image; 43 this.message = message; 44 45 if (active) { 46 parent.set(message, image); 47 } 48 } 49 50 public void activate(Part partBeingActivated) { 51 parent.set(message, image); 52 53 active = true; 54 } 55 56 public void deactivate(Object newActive) { 57 parent.set(null, null); 58 active = false; 59 } 60 61 } 62 | Popular Tags |