1 11 package org.eclipse.jdt.internal.ui.util; 12 13 import org.eclipse.swt.SWT; 14 import org.eclipse.swt.custom.CLabel; 15 import org.eclipse.swt.custom.ViewForm; 16 import org.eclipse.swt.graphics.Image; 17 import org.eclipse.swt.widgets.Composite; 18 import org.eclipse.swt.widgets.ToolBar; 19 20 import org.eclipse.jface.action.ToolBarManager; 21 22 27 public class ViewerPane extends ViewForm { 28 29 private ToolBarManager fToolBarManager; 30 31 public ViewerPane(Composite parent, int style) { 32 super(parent, style); 33 34 marginWidth= 0; 35 marginHeight= 0; 36 37 CLabel label= new CLabel(this, SWT.NONE); 38 setTopLeft(label); 39 40 ToolBar tb= new ToolBar(this, SWT.FLAT); 41 setTopCenter(tb); 42 fToolBarManager= new ToolBarManager(tb); 43 } 44 45 48 public void setText(String label) { 49 CLabel cl= (CLabel) getTopLeft(); 50 cl.setText(label); 51 } 52 53 public String getText() { 54 CLabel cl= (CLabel) getTopLeft(); 55 return cl.getText(); 56 } 57 58 61 public void setImage(Image image) { 62 CLabel cl= (CLabel) getTopLeft(); 63 cl.setImage(image); 64 } 65 66 public Image getImage() { 67 CLabel cl= (CLabel) getTopLeft(); 68 return cl.getImage(); 69 } 70 71 public ToolBarManager getToolBarManager() { 72 return fToolBarManager; 73 } 74 } 75 | Popular Tags |