| /** |
| * |
| * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.wizard.ui.allinonedsl; |
| |
| import org.apache.commons.lang3.JavaVersion; |
| import org.apache.commons.lang3.SystemUtils; |
| import org.eclipse.jface.wizard.WizardDialog; |
| import org.eclipse.osbp.utils.themes.ui.VaaclipseUiTheme; |
| import org.eclipse.osbp.utils.themes.ui.VaaclipseUiTheme.ThemeList; |
| import org.eclipse.osbp.wizard.ui.AllInOneDSLsNewProjectWizard; |
| import org.eclipse.osbp.wizard.ui.basic.BasicNewProjectConfigurationPage; |
| import org.eclipse.osbp.wizard.ui.basic.CommonProjectWizardTranslator; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.widgets.Combo; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Label; |
| import org.eclipse.swt.widgets.MessageBox; |
| |
| /** |
| * The Class AllInOneDSLsNewProjectConfigurationPage. |
| * <br> |
| * Add Vaaclipse theme selection to th basic project configuration page. |
| */ |
| public class AllInOneDSLsNewProjectConfigurationPage extends BasicNewProjectConfigurationPage { |
| |
| /** |
| * Instantiates a new all in one DSLs new project configuration page. |
| * |
| * @param wizard the wizard |
| * @param pageName the page name |
| */ |
| public AllInOneDSLsNewProjectConfigurationPage(final AllInOneDSLsNewProjectWizard wizard, String pageName) { |
| super(wizard, pageName); |
| } |
| |
| @Override |
| protected void createProjectNameGroup(Composite parent) { |
| super.createProjectNameGroup(parent); |
| AllInOneDSLsNewProjectWizard wizard = (AllInOneDSLsNewProjectWizard)this.wizard; |
| int selected = 0; |
| |
| Label vaaclipseThemeLabel = new Label(projectGroup, SWT.NONE); |
| vaaclipseThemeLabel.setText(wizard.translator.getDocumentation(this,"labelVaaclipseTheme")); |
| vaaclipseThemeLabel.setFont(parent.getFont()); |
| |
| wizard.vaaclipseTheme = new Combo (projectGroup, SWT.READ_ONLY); |
| selected = 0; |
| for (VaaclipseUiTheme theme : VaaclipseUiTheme.values(ThemeList.forWizard)) { |
| wizard.vaaclipseTheme.add(theme.toString()); |
| if (theme.getId().equals(wizard.projectInfo.getVaaclipseTheme().getId())) { |
| selected = wizard.vaaclipseTheme.indexOf(theme.toString()); |
| } |
| } |
| wizard.vaaclipseTheme.setLayoutData(data); |
| wizard.vaaclipseTheme.select(selected); |
| |
| if (!SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8)) { |
| MessageBox messageBox = new MessageBox( |
| this.getShell(), |
| SWT.ICON_ERROR | SWT.CANCEL |
| ); |
| messageBox.setMessage( |
| wizard.translator.getDocumentation(this,"checkJavaRuntimeVersion.text")); |
| messageBox.setText( |
| wizard.translator.getDocumentation(this,"checkJavaRuntimeVersion.title")); |
| messageBox.open(); |
| ((WizardDialog)wizard.getContainer()).close(); |
| } |
| } |
| } |