Initial EGit contribution to eclipse.org
[egit.git] / org.eclipse.egit.ui / src / org / eclipse / egit / ui / internal / actions / ShowResourceInHistoryAction.java
blobc3d39676f98a8099a70e1d3e1ed53a0843c88268
1 /*******************************************************************************
2 * Copyright (C) 2007, David Watson <dwatson@mimvista.com>
3 * Copyright (C) 2007, Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
4 * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
5 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
7 * All rights reserved. This program and the accompanying materials
8 * are made available under the terms of the Eclipse Public License v1.0
9 * which accompanies this distribution, and is available at
10 * http://www.eclipse.org/legal/epl-v10.html
11 *******************************************************************************/
12 package org.eclipse.egit.ui.internal.actions;
14 import org.eclipse.egit.core.ResourceList;
15 import org.eclipse.jface.action.IAction;
16 import org.eclipse.swt.widgets.Shell;
17 import org.eclipse.team.internal.ui.actions.TeamAction;
18 import org.eclipse.team.ui.TeamUI;
19 import org.eclipse.team.ui.history.HistoryPageSaveablePart;
21 /**
22 * An action to update the history view for the selected
23 * resource. If the history view is not visible it will be
24 * shown.
26 public class ShowResourceInHistoryAction extends TeamAction {
28 // There are changes in Eclipse 3.3 requiring that execute be implemented
29 // for it to compile. while 3.2 requires that run is implemented instead.
30 /**
31 * See {@link #run}
33 * @param action
35 public void execute(IAction action) {
36 run(action);
39 @Override
40 public void run(IAction action) {
41 TeamUI.getHistoryView().showHistoryFor(
42 new ResourceList(getSelectedResources()));
45 void showCompareInDialog(Shell shell, Object object) {
46 HistoryPageSaveablePart.showHistoryInDialog(shell, object);
49 public boolean isEnabled() {
50 return !getSelection().isEmpty();