package ie.dcu.apps.ist.actions; import ie.dcu.apps.ist.Application; import ie.dcu.swt.layout.LayoutFactory; import org.eclipse.jface.dialogs.*; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.*; /** * Show an about dialog. * * @author Kevin McGuinness */ public class AboutAction extends AppAction { private AboutBox dialog; public AboutAction(ActionManager m) { super(m); } @Override public void run() { if (dialog == null) { dialog = new AboutBox(); } dialog.open(); } private class AboutBox extends Dialog { private static final String MESSAGE_DEV = " Nikhil Lingutla \n" + " School of Electrical Engineering and Computer Science\n" + " Oregon State University\n" + " http://www.oregonstate.edu\n" + "\n" + " Justin Preece \n" + " Jaiswal Lab, Dept. of Botany and Plant Pathology\n" + " Oregon State University\n" + " http://jaiswallab.cgrb.oregonstate.edu\n"; private static final String MESSAGE_SPONSOR = " Sinisa Todorovic \n" + " Assistant Prof., School of Electrical Engineering and Computer Science\n" + " Oregon State University\n" + " http://eecs.oregonstate.edu/people/todorovic\n" + "\n" + " Pankaj Jaiswal \n" + " Assistant Prof., Dept. of Botany and Plant Pathology\n" + " Oregon State University\n" + " http://bpp.oregonstate.edu/jaiswal\n"; private static final String MESSAGE_ORIG = " Kevin McGuinness \n" + " CLARITY: Center for Sensor Web Technologies\n" + " Dublin City University\n" + " http://www.clarity-center.org\n"; private static final String MESSAGE_ORIG_SOFTWARE = " Interactive Segmentation and Annotation Tool, v1.3.4\n" + " http://kspace.cdvp.dcu.ie/public/interactive-segmentation\n"; private Composite composite; protected AboutBox() { super(window); } @Override protected Control createDialogArea(Composite parent) { composite = new Composite(parent, SWT.NONE); composite.setLayout(LayoutFactory.createGridLayout(5, 5, 2, false)); // top row String image = string("aboutImage"); addImage(image); addLabel("AISO (Annotation of Image Segments using Ontologies)" + System.getProperty("line.separator") + "Ontology-Enabled Image Segmentation and Annotation", SWT.CENTER); // 2nd row addLabel(String.format("Version %s", Application.APP_VERSION), SWT.CENTER); addLabel(" SWT Version " + swtVersionString(), SWT.CENTER); // 3rd row addLabel(" Developed By:", SWT.RIGHT); addLink(MESSAGE_DEV); // 4th row addLabel(" Sponsored By:", SWT.RIGHT); addLink(MESSAGE_SPONSOR); // 5th row addLabel(" Based on software:", SWT.RIGHT); addLink(MESSAGE_ORIG_SOFTWARE); // 6th row addLabel(" Originally developed by:", SWT.RIGHT); addLink(MESSAGE_ORIG); // Last row addLink("This work is licensed under\n" + "a Creative Commons\n" + "Attribution-NonCommercial-NoDerivs\n" + "3.0 Unported License"); String osImage = string("os_license_image"); addImage(osImage); return composite; } private String swtVersionString() { return String.format("%d (%s)", SWT.getVersion(), SWT.getPlatform()); } @Override protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); } @Override protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText("About"); } private void addLink(String string) { Link link = new Link(composite, 0); link.setText(string); link.setLayoutData(LayoutFactory.createGridData()); } private void addLabel(String text, int alignment) { Label label = new Label(composite, 0); label.setText(text); label.setAlignment(alignment); label.setLayoutData(LayoutFactory.createGridData()); label.setFont(JFaceResources.getBannerFont()); } private void addImage(String url) { Label label = new Label(composite, 0); label.setImage(window.getIcon(url)); label.setLayoutData(LayoutFactory.createGridData()); } } }