blob: bb9394ef851b0fdb15edd9380c48c87ad56a628c [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,
* Sebastien Gemme - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.common.topology.ui.impl;
import org.eclipse.apogy.common.topology.ui.Activator;
import org.eclipse.apogy.common.topology.ui.ApogyCommonTopologyUIPackage;
import org.eclipse.apogy.common.topology.ui.TransformNodePresentation;
import org.eclipse.apogy.common.topology.ui.adapters.TransformNodeSceneObject;
import org.eclipse.apogy.common.topology.ui.preferences.PreferencesConstants;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.jface.preference.IPreferenceStore;
public class TransformNodePresentationCustomImpl extends TransformNodePresentationImpl {
@Override
protected void initialSceneObject() {
TransformNodeSceneObject transformNodeObject = (TransformNodeSceneObject) getSceneObject();
transformNodeObject.setAxisVisible(isAxisVisible());
transformNodeObject.setAxisLength(getAxisLength());
super.initialSceneObject();
}
@Override
protected void updateSceneObject(Notification notification) {
if (getSceneObject() instanceof TransformNodeSceneObject) {
TransformNodeSceneObject object = (TransformNodeSceneObject) getSceneObject();
if (notification.getFeatureID(
TransformNodePresentation.class) == ApogyCommonTopologyUIPackage.TRANSFORM_NODE_PRESENTATION__AXIS_VISIBLE) {
object.setAxisVisible(isAxisVisible());
} else if (notification.getFeatureID(
TransformNodePresentation.class) == ApogyCommonTopologyUIPackage.TRANSFORM_NODE_PRESENTATION__AXIS_LENGTH) {
object.setAxisLength(getAxisLength());
}
}
super.updateSceneObject(notification);
}
@Override
protected void applyPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
// Change axis visibility.
setAxisVisible(store.getBoolean(PreferencesConstants.DEFAULT_TRANSFORM_NODE_AXIS_VISIBILITY_ID));
// Change Axis Length
setAxisLength(store.getDouble(PreferencesConstants.DEFAULT_TRANSFORM_NODE_AXIS_LENGTH_ID));
super.applyPreferences();
}
} // TransformNodePresentationImpl