blob: f5e0ebbf67f540520d1f5251ab91fc80829ce58f [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pierre Allard - initial API and implementation
* Regent L'Archeveque
*
* SPDX-License-Identifier: EPL-1.0
*******************************************************************************/
package org.eclipse.apogy.addons.vehicle.ui.wizards;
import org.eclipse.apogy.addons.vehicle.VehiclePathPlannerTool;
import org.eclipse.apogy.addons.vehicle.ui.composites.VehiclePathPlannerToolComposite;
import org.eclipse.apogy.core.invocator.Variable;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
public class VehiclePathPlannerToolWizardPage extends WizardPage {
private final static String WIZARD_PAGE_ID = "org.eclipse.apogy.addons.vehicle.ui.wizards.VehiclePathPlannerToolWizardPage";
private final VehiclePathPlannerTool vehiclePathPlannerTool;
private VehiclePathPlannerToolComposite vehiclePathPlannerToolComposite;
public VehiclePathPlannerToolWizardPage(VehiclePathPlannerTool vehiclePathPlannerTool) {
super(WIZARD_PAGE_ID);
this.vehiclePathPlannerTool = vehiclePathPlannerTool;
setTitle("Vehicle Path Planner Tool");
setDescription("Configure the Vehicle Path Planner Tool settings.");
validate();
}
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.None);
container.setLayout(new GridLayout(1, false));
this.vehiclePathPlannerToolComposite = new VehiclePathPlannerToolComposite(container, SWT.None) {
@Override
protected void newVariableSelected(Variable variable) {
validate();
}
};
this.vehiclePathPlannerToolComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
this.vehiclePathPlannerToolComposite.setVehiclePathPlannerTool(this.vehiclePathPlannerTool);
setControl(container);
this.vehiclePathPlannerToolComposite.setFocus();
validate();
}
protected void validate() {
setErrorMessage(null);
if (this.vehiclePathPlannerTool.getVariable() == null) {
setErrorMessage("The variable is not set !");
}
setPageComplete(getErrorMessage() == null);
}
}