1 11 package org.eclipse.ui.part; 12 13 import org.eclipse.jface.action.ToolBarManager; 14 import org.eclipse.jface.viewers.TreeViewer; 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.swt.widgets.ToolBar; 20 21 35 public class DrillDownComposite extends Composite { 36 private ToolBarManager toolBarMgr; 37 38 private TreeViewer fChildTree; 39 40 private DrillDownAdapter adapter; 41 42 48 public DrillDownComposite(Composite parent, int style) { 49 super(parent, style); 50 createNavigationButtons(); 51 } 52 53 56 protected void createNavigationButtons() { 57 GridData gid; 58 GridLayout layout; 59 60 layout = new GridLayout(); 62 layout.marginHeight = layout.marginWidth = layout.horizontalSpacing = layout.verticalSpacing = 0; 63 setLayout(layout); 64 65 toolBarMgr = new ToolBarManager(SWT.FLAT); 67 ToolBar toolBar = toolBarMgr.createControl(this); 68 gid = new GridData(); 69 gid.horizontalAlignment = GridData.FILL; 70 gid.verticalAlignment = GridData.BEGINNING; 71 toolBar.setLayoutData(gid); 72 } 73 74 80 public void setChildTree(TreeViewer aViewer) { 81 fChildTree = aViewer; 83 84 adapter = new DrillDownAdapter(fChildTree); 86 adapter.addNavigationActions(toolBarMgr); 87 toolBarMgr.update(true); 88 89 fChildTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 91 layout(); 92 } 93 } 94 | Popular Tags |