blob: 0a2c9cb849925671f0b78d1725e89d6e52648eb3 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 Zoltan Ujhelyi and Istvan Rath 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:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.visualisation.modelspace.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.PlatformUI;
import org.eclipse.viatra2.visualisation.common.extensions.FilterConfiguration;
import org.eclipse.viatra2.visualisation.view.ViatraVisualisationView;
/**
* Selects and applies a filter configuration to the visualisation.
* @author Istvan Rath
*
*/
public class SelectFilterConfigurationAction extends Action {
FilterConfiguration fc;
/**
* Initializes a new select filter configuration action with a given name and configuration
* @param name the configuration identifier
* @param _fc the configuration to se.
*/
public SelectFilterConfigurationAction(String name, FilterConfiguration _fc) {
super(name);
this.fc = _fc;
setToolTipText("Selects the " + name + " filter configuration for the current graph.");
}
/* (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.setFilterConfiguration(fc);
}
}