| /******************************************************************************* |
| * 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.PositionNodePresentation; |
| 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 PositionNodePresentationCustomImpl extends PositionNodePresentationImpl { |
| |
| @Override |
| protected void initialSceneObject() { |
| if (this.sceneObject instanceof TransformNodeSceneObject) { |
| TransformNodeSceneObject transformNodeObject = (TransformNodeSceneObject) this.sceneObject; |
| |
| 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( |
| PositionNodePresentation.class) == ApogyCommonTopologyUIPackage.POSITION_NODE_PRESENTATION__AXIS_VISIBLE) { |
| object.setAxisVisible(isAxisVisible()); |
| } else if (notification.getFeatureID( |
| PositionNodePresentation.class) == ApogyCommonTopologyUIPackage.POSITION_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_POSITION_NODE_AXIS_VISIBILITY_ID)); |
| |
| // Change Axis Length |
| setAxisLength(store.getDouble(PreferencesConstants.DEFAULT_POSITION_NODE_AXIS_LENGTH_ID)); |
| |
| super.applyPreferences(); |
| } |
| } // PositionNodePresentationImpl |