1 11 package org.eclipse.ui.internal.part.services; 12 13 import org.eclipse.swt.SWT; 14 import org.eclipse.swt.layout.FillLayout; 15 import org.eclipse.swt.widgets.Composite; 16 import org.eclipse.swt.widgets.Display; 17 import org.eclipse.swt.widgets.Shell; 18 import org.eclipse.ui.internal.components.framework.ComponentFactory; 19 import org.eclipse.ui.internal.components.framework.ComponentHandle; 20 import org.eclipse.ui.internal.components.framework.IDisposable; 21 import org.eclipse.ui.internal.components.framework.IServiceProvider; 22 23 26 public class DefaultCompositeFactory extends ComponentFactory { 27 28 private final static class CompositeHandle extends ComponentHandle implements IDisposable { 29 30 public CompositeHandle(Composite toWrap) { 31 super(toWrap); 32 } 33 34 public IDisposable getDisposable() { 35 return this; 36 } 37 38 public void dispose() { 39 ((Composite)getInstance()).dispose(); 40 } 41 42 }; 43 44 47 public ComponentHandle createHandle(IServiceProvider availableServices) { 48 Shell result = new Shell(Display.getCurrent(), SWT.NONE); 49 result.setLayout(new FillLayout()); 50 result.open(); 51 return new CompositeHandle(result); 52 } 53 54 } 55 | Popular Tags |