private Label createTitleLabel(Composite parent, String text) { Label label = new Label(parent, SWT.NONE); if (text != null) label.setText(text); label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); label.setFont(JFaceResources.getHeaderFont()); return label; }
@Override public void createPartControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); container.setLayout(new FormLayout()); FormToolkit toolkit = new FormToolkit(container.getDisplay()); Form form = toolkit.createForm(container); FormData data = new FormData(); data.top = new FormAttachment(0, 20); data.left = new FormAttachment(50, -100); data.right = new FormAttachment(50, 100); data.bottom = new FormAttachment(100, -20); form.setLayoutData(data); // form.setText(Messages.IntroTitle); FillLayout layout = new FillLayout(); layout.marginHeight = layout.marginWidth = 5; form.getBody().setLayout(layout); FormText text = toolkit.createFormText(form.getBody(), true); StringBuilder buf = new StringBuilder(); buf.append("<form>"); // $NON-NLS-1$ buf.append("<p><img href=\"logo\"/></p>"); // $NON-NLS-1$ buf.append("<p><span color=\"header\" font=\"header\">") // $NON-NLS-1$ .append(Messages.IntroTitle) // .append("</span></p>"); // $NON-NLS-1$ addLink(buf, "action:open", Messages.IntroOpenFile, Messages.IntroOpenFileText); // $NON-NLS-1$ addLink(buf, "action:new", Messages.IntroNewFile, Messages.IntroNewFileText); // $NON-NLS-1$ addLink( buf, "action:sample", Messages.IntroOpenSample, Messages.IntroOpenSampleText); // $NON-NLS-1$ addLink( buf, "action:daxsample", Messages.IntroOpenDaxSample, Messages.IntroOpenDaxSampleText); // $NON-NLS-1$ addLink( buf, "http://buchen.github.com/portfolio/new_and_noteworthy.html", //$NON-NLS-1$ Messages.IntroReadNews, Messages.IntroReadNewsText); buf.append("</form>"); // $NON-NLS-1$ text.setText(buf.toString(), true, false); text.setImage("logo", PortfolioPlugin.image(PortfolioPlugin.IMG_LOGO)); // $NON-NLS-1$ text.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); // $NON-NLS-1$ text.setFont("header", JFaceResources.getHeaderFont()); // $NON-NLS-1$ text.addHyperlinkListener(this); }