/******************************************************************************* | |
* Copyright (c) 2011, 2012 Formal Mind GmbH and University of Dusseldorf. | |
* 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: | |
* Michael Jastram - initial API and implementation | |
******************************************************************************/ | |
package org.eclipse.rmf.reqif10.pror.editor.actions; | |
import org.eclipse.jface.action.IAction; | |
import org.eclipse.jface.viewers.ISelection; | |
import org.eclipse.rmf.reqif10.pror.editor.ISpecificationEditor; | |
import org.eclipse.ui.IEditorActionDelegate; | |
import org.eclipse.ui.IEditorPart; | |
import org.eclipse.ui.IWorkbenchWindow; | |
import org.eclipse.ui.IWorkbenchWindowActionDelegate; | |
/** | |
* @author jastram | |
* | |
*/ | |
public class ToggleSpecRelationsActionDelegate implements | |
IEditorActionDelegate, IWorkbenchWindowActionDelegate { | |
private IEditorPart editor; | |
/** | |
* Informs the Editor of the change, if the active editor happens to be a | |
* {@link ReqIFEditor}. | |
* | |
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) | |
*/ | |
public void run(IAction action) { | |
if (editor != null && editor instanceof ISpecificationEditor) { | |
((ISpecificationEditor) editor).setShowSpecRelations(action | |
.isChecked()); | |
} | |
} | |
/* | |
* (non-Javadoc) | |
* | |
* @see | |
* org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action | |
* .IAction, org.eclipse.jface.viewers.ISelection) | |
*/ | |
public void selectionChanged(IAction action, ISelection selection) { | |
} | |
/* | |
* (non-Javadoc) | |
* | |
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() | |
*/ | |
public void dispose() { | |
} | |
/* | |
* (non-Javadoc) | |
* | |
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui. | |
* IWorkbenchWindow) | |
*/ | |
public void init(IWorkbenchWindow window) { | |
} | |
/** | |
* Keeps track of the active editor. | |
* | |
* @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, | |
* org.eclipse.ui.IEditorPart) | |
*/ | |
public void setActiveEditor(IAction action, IEditorPart targetEditor) { | |
this.editor = targetEditor; | |
} | |
} |