Make ShowResourceInHistoryAction work in both Eclipse 3.2 and 3.3
[egit.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / internal / actions / ShowResourceInHistoryAction.java
blob4cfe844810ea2b6e728ee55dd47be250b475b957
1 /*
2 * Copyright (C) 2006 Guilhem Bonnefille
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License, version 2.1, as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 package org.spearce.egit.ui.internal.actions;
19 import org.eclipse.jface.action.IAction;
20 import org.eclipse.swt.widgets.Shell;
21 import org.eclipse.team.internal.ui.actions.TeamAction;
22 import org.eclipse.team.ui.TeamUI;
23 import org.eclipse.team.ui.history.HistoryPageSaveablePart;
25 public class ShowResourceInHistoryAction extends TeamAction {
27 // There are changes in Eclipse 3.3 requiring that execute be implemented
28 // for it to compile. while 3.2 requires that run is implemented instead.
30 public void execute(IAction action) {
31 run(action);
34 @Override
35 public void run(IAction action) {
36 TeamUI.getHistoryView().showHistoryFor(getSelectedResources()[0]);
39 protected void showCompareInDialog(Shell shell, Object object) {
40 HistoryPageSaveablePart.showHistoryInDialog(shell, object);
43 public boolean isEnabled() {
44 return !getSelection().isEmpty();