//------------------------------------------------------------------------------ // Copyright (c) 2005, 2007 IBM Corporation and others. // 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: // IBM Corporation - initial implementation //------------------------------------------------------------------------------ /** * */ package org.eclipse.epf.diagram.core.actions; import org.eclipse.epf.diagram.core.part.AbstractDiagramEditor; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; /** * Refresh action refreshes the DiagramEditPart, performs deactivate and activate. * * @author Shashidhar Kannoori * @author Phong Nguyen Le */ public class RefreshAction implements IObjectActionDelegate { private IDiagramWorkbenchPart activePart; public RefreshAction() { } /* (non-Javadoc) * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) */ public void setActivePart(IAction action, IWorkbenchPart targetPart) { if(targetPart instanceof IDiagramWorkbenchPart) { activePart = ((IDiagramWorkbenchPart)targetPart); } } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { if(activePart != null) { if(activePart instanceof AbstractDiagramEditor) { AbstractDiagramEditor editor = ((AbstractDiagramEditor)activePart); editor.refresh(); } } } /* (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) { } }