1 11 package org.eclipse.team.internal.ccvs.ui.actions; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.jface.action.IAction; 18 import org.eclipse.jface.operation.IRunnableWithProgress; 19 import org.eclipse.team.internal.ccvs.core.CVSException; 20 import org.eclipse.team.internal.ccvs.core.ICVSResource; 21 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; 22 import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; 23 import org.eclipse.team.internal.ui.TeamUIPlugin; 24 import org.eclipse.team.ui.TeamUI; 25 26 public class ShowResourceInHistoryAction extends WorkspaceAction { 27 30 public void execute(IAction action) throws InterruptedException , InvocationTargetException { 31 run(new IRunnableWithProgress() { 32 public void run(IProgressMonitor monitor) throws InvocationTargetException { 33 IResource[] resources = getSelectedResources(); 34 if (resources.length != 1) return; 35 TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resources[0], null); 36 } 37 }, false , PROGRESS_BUSYCURSOR); 38 } 39 40 43 protected String getErrorTitle() { 44 return CVSUIMessages.ShowHistoryAction_showHistory; 45 } 46 47 50 protected boolean isEnabledForMultipleResources() { 51 return false; 52 } 53 54 57 protected boolean isEnabledForAddedResources() { 58 return true; 59 } 60 61 64 protected boolean isEnabledForNonExistantResources() { 65 return true; 66 } 67 68 71 protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException { 72 return (!cvsResource.isFolder() && super.isEnabledForCVSResource(cvsResource)); 73 } 74 75 78 public String getId() { 79 return ICVSUIConstants.CMD_HISTORY; 80 } 81 82 protected boolean isEnabledForUnmanagedResources() { 83 return true; 84 } 85 86 protected boolean isEnabledForIgnoredResources() { 87 return true; 88 } 89 } 90 | Popular Tags |