| /******************************************************************************* |
| * Copyright (c) 2009 Zoltan Ujhelyi and Daniel Varro. |
| * 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: |
| * Zoltan Ujhelyi - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.viatra2.visualisation.common.action; |
| |
| import org.eclipse.jface.action.Action; |
| import org.eclipse.ui.PlatformUI; |
| import org.eclipse.viatra2.visualisation.view.ViatraVisualisationView; |
| |
| /** |
| * An action that allows setting the content provider for the graph viewer |
| * @author Zoltan Ujhelyi |
| * |
| */ |
| public class SetAutoLayoutAction extends Action { |
| |
| /** |
| * Initializes a Select Provider action |
| * @param name the name in the user interface that represents the content provider |
| */ |
| public SetAutoLayoutAction(String name) { |
| super(name,AS_CHECK_BOX); |
| setToolTipText("Selects the " + name + " provider."); |
| } |
| |
| /* (non-Javadoc) |
| * @see org.eclipse.jface.action.Action#run() |
| */ |
| @Override |
| public void run() { |
| String viewId = "org.eclipse.viatra2.visualisation.view"; |
| ViatraVisualisationView view = (ViatraVisualisationView) PlatformUI |
| .getWorkbench().getActiveWorkbenchWindow().getActivePage() |
| .findViewReference(viewId).getView(false); |
| view.setAutoLayout(isChecked()); |
| } |
| |
| |
| } |