package example;
import org.eclipse.jface.action.IToolBarManager;
public class View extends ViewPart {
public static final String ID = "example.view";
public void createPartControl(Composite parent) {
Composite top = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
top.setLayout(layout);
// top banner
Composite banner = new Composite(top, SWT.NONE);
banner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
layout = new GridLayout();
layout.marginHeight = 5;
layout.marginWidth = 10;
layout.numColumns = 2;
banner.setLayout(layout);
// setup bold font
Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
Label l = new Label(banner, SWT.WRAP);
l.setText("Subject:");
l.setFont(boldFont);
l = new Label(banner, SWT.WRAP);
l.setText("This is a message about the cool Eclipse RCP!");
l = new Label(banner, SWT.WRAP);
l.setText("From:");
l.setFont(boldFont);
final Link link = new Link(banner, SWT.NONE);
link.setText("<a>nicole@mail.org</a>");
link.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
MessageDialog.openInformation(getSite().getShell(), "Not Implemented", "Imagine the address book or a new message being created now.");
}
});
l = new Label(banner, SWT.WRAP);
l.setText("Date:");
l.setFont(boldFont);
l = new Label(banner, SWT.WRAP);
l.setText("10:34 am");
// message contents
Text thisRcpApplicationText = new Text(top, SWT.MULTI | SWT.WRAP);
thisRcpApplicationText.setText("This RCP Application was generated from the PDE Plug-in Project wizard. This sample shows how to:\r\n- add a top-level menu and toolbar with actions\r\n- add keybindings to actions\r\n- create views that can't be closed and\r\n multiple instances of the same view\r\n- perspectives with placeholders for new views\r\n- use the default about dialog\r\n- create a product definition\r\n");
final GridData gd_thisRcpApplicationText = new GridData(GridData.FILL_BOTH);
thisRcpApplicationText.setLayoutData(gd_thisRcpApplicationText);
initializeToolBar();
}
public void setFocus() {
}
private void initializeToolBar() {
IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
}
}