| /******************************************************************************* |
| * 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 |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.core.environment.earth.ui.handlers; |
| |
| import org.eclipse.apogy.core.environment.earth.ui.composites.EarthViewComposite.EarthViewMode; |
| import org.eclipse.apogy.core.environment.earth.ui.parts.EarthViewPart; |
| import org.eclipse.e4.core.di.annotations.CanExecute; |
| import org.eclipse.e4.core.di.annotations.Execute; |
| import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
| |
| public class EarthViewSetFlatEarthMode { |
| |
| @CanExecute |
| public boolean canExecute(MPart part) { |
| if (part.getObject() instanceof EarthViewPart) { |
| return true; |
| } else { |
| return false; |
| } |
| } |
| |
| @Execute |
| public void execute(MPart part) { |
| if (part.getObject() instanceof EarthViewPart) { |
| EarthViewPart earthViewPart = (EarthViewPart) part.getObject(); |
| earthViewPart.setEarthViewMode(EarthViewMode.FLAT); |
| } |
| } |
| } |