1 11 package org.eclipse.ui.internal.part; 12 13 import org.eclipse.swt.widgets.Composite; 14 import org.eclipse.ui.IEditorPart; 15 import org.eclipse.ui.IWorkbenchPage; 16 import org.eclipse.ui.internal.components.framework.ComponentException; 17 import org.eclipse.ui.internal.components.framework.Components; 18 import org.eclipse.ui.internal.components.framework.IServiceProvider; 19 import org.eclipse.ui.internal.components.framework.ServiceFactory; 20 import org.osgi.framework.Bundle; 21 22 27 public class EditorWrapper extends PartWrapper { 28 private IEditorPart part; 29 30 33 public EditorWrapper(Composite parentControl, Bundle bundle, IWorkbenchPage page, PartGenerator gen, ServiceFactory context) throws ComponentException { 34 super(parentControl, bundle, page, gen, context); 35 36 try { 37 part = (IEditorPart)getWrappedPart().getService(IEditorPart.class); 38 if (part == null) { 39 IServiceProvider container = getContainer(); 40 StandardWorkbenchServices services = new StandardWorkbenchServices(container); 41 IPartPropertyProvider provider = (IPartPropertyProvider)Components.queryInterface(getWrappedPart(), IPartPropertyProvider.class); 42 part = new NewPartToOldAdapter(services, provider, false); 43 } 44 } catch (ComponentException e) { 45 getWrappedPart().getControl().dispose(); 46 throw e; 47 } 48 } 49 50 public IEditorPart getEditorPart() { 51 return part; 52 } 53 } 54 | Popular Tags |