blob: 3eaf63eb98ffb946be1f3099f8b8cd0b64085979 [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.telecoms.provider;
import java.text.DecimalFormat;
import org.eclipse.apogy.addons.telecoms.SimpleConicalRadiationPattern;
import org.eclipse.emf.common.notify.AdapterFactory;
public class SimpleConicalRadiationPatternCustomItemProvider extends SimpleConicalRadiationPatternItemProvider {
public SimpleConicalRadiationPatternCustomItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
// FIXME Should be centralized.
private final DecimalFormat decimalFormat = new DecimalFormat("0.00");
@Override
public String getText(Object object) {
SimpleConicalRadiationPattern simpleConicalRadiationPattern = (SimpleConicalRadiationPattern) object;
String label = "";
if (simpleConicalRadiationPattern.getName() != null && simpleConicalRadiationPattern.getName().length() > 0) {
label = simpleConicalRadiationPattern.getName();
} else {
label = getString("_UI_SimpleConicalRadiationPattern_type");
}
label += " (" + this.decimalFormat.format(Math.toDegrees(simpleConicalRadiationPattern.getApexAngle()))
+ " deg)";
return label;
}
}