@@ -0,0 +1,2070 @@
+/*******************************************************************************%0A * Copyright (c) 2016 Pivotal, Inc.%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A *     Pivotal, Inc. - initial API and implementation%0A *******************************************************************************/%0Apackage org.springsource.ide.eclipse.commons.livexp.ui;%0A%0Aimport java.util.concurrent.Callable;%0A%0Aimport org.eclipse.jface.layout.GridDataFactory;%0Aimport org.eclipse.swt.SWT;%0Aimport org.eclipse.swt.events.SelectionEvent;%0Aimport org.eclipse.swt.events.SelectionListener;%0Aimport org.eclipse.swt.widgets.Button;%0Aimport org.eclipse.swt.widgets.Composite;%0Aimport org.springframework.ide.eclipse.boot.core.BootActivator;%0A%0A/**%0A * A section containing a single clickable button.%0A *%0A * @author Kris De Volder%0A */%0Apublic class ButtonSection extends WizardPageSection %7B%0A%0A%09private String label;%0A%09private Callable%3CVoid%3E clickHandler;%0A%0A%09public ButtonSection(IPageWithSections owner, String label, Callable%3CVoid%3E clickHandler) %7B%0A%09%09super(owner);%0A%09%09this.label = label;%0A%09%09this.clickHandler = clickHandler;%0A%09%7D%0A%0A%09@Override%0A%09public void createContents(Composite page) %7B%0A%09%09Button button = new Button(page, SWT.PUSH);%0A%09%09button.setText(label);%0A%09%09applyLayoutData(button);%0A%09%09button.addSelectionListener(new SelectionListener() %7B%0A%09%09%09@Override%0A%09%09%09public void widgetSelected(SelectionEvent arg0) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09clickHandler.call();%0A%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09BootActivator.log(e);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public void widgetDefaultSelected(SelectionEvent arg0) %7B%0A%09%09%09%09widgetSelected(arg0);%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D%0A%0A%09/**%0A%09 * Default implementation aligns the button to the right side of the screen. Override this%0A%09 * method to change the layout.%0A%09 */%0A%09protected void applyLayoutData(Button button) %7B%0A%09%09GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(button);%0A%09%7D%0A%0A%7D%0A

Move ButtonSection to livexp for easier reuse