blob: 2da039f65ee208dc8b1d5977a86e186368b216e5 [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,
* Regent L'Archeveque - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.addons.sensors.range.impl;
import org.eclipse.apogy.addons.sensors.range.ApogyAddonsSensorsRangeFactory;
import org.eclipse.apogy.addons.sensors.range.RasterScanSettings;
import org.eclipse.apogy.common.topology.Node;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.EList;
public class RasterScanRangeSensorCustomImpl extends RasterScanRangeSensorImpl {
protected RasterScanSettings rasterScanSettings = null;
@Override
public IProgressMonitor getProgressMonitor() {
if (this.progressMonitor == null) {
setProgressMonitor(new NullProgressMonitor());
}
return this.progressMonitor;
}
@Override
public synchronized RasterScanSettings getScanSettings() {
if (this.rasterScanSettings == null) {
// Search the list of children of the RasterScanRangeSensor to find a
// RasterScanSettings.
EList<Node> children = getChildren();
for (Node node : children) {
if (node instanceof RasterScanSettings) {
this.rasterScanSettings = (RasterScanSettings) node;
}
}
// If no RasterScanSettings is found, creates one.
if (this.rasterScanSettings == null) {
this.rasterScanSettings = ApogyAddonsSensorsRangeFactory.eINSTANCE.createRasterScanSettings();
getChildren().add(this.rasterScanSettings);
}
}
return this.rasterScanSettings;
}
} // RasterScanRangeSensorImpl