1 11 package org.eclipse.team.internal.ccvs.ui.repo; 12 13 import java.lang.reflect.InvocationTargetException ; 14 import java.util.Date ; 15 16 import org.eclipse.jface.action.IAction; 17 import org.eclipse.jface.window.Window; 18 import org.eclipse.swt.widgets.Shell; 19 import org.eclipse.team.internal.ccvs.core.CVSTag; 20 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 21 import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; 22 import org.eclipse.team.internal.ccvs.ui.DateTagDialog; 23 24 27 public class NewDateTagAction extends CVSRepoViewAction { 28 29 32 protected void execute(IAction action) throws InvocationTargetException , InterruptedException { 33 ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations(); 34 if (locations.length != 1) return; 35 CVSTag tag = getDateTag(getShell(), locations[0]); 36 CVSUIPlugin.getPlugin().getRepositoryManager().addDateTag(locations[0], tag); 37 } 38 39 public static CVSTag getDateTag(Shell shell, ICVSRepositoryLocation location) { 40 DateTagDialog dialog = new DateTagDialog(shell); 41 if (dialog.open() == Window.OK) { 42 Date date = dialog.getDate(); 43 CVSTag tag = new CVSTag(date); 44 return tag; 45 } 46 return null; 47 } 48 49 52 public boolean isEnabled() { 53 ICVSRepositoryLocation[] locations = getSelectedRepositoryLocations(); 54 if (locations.length != 1) return false; 55 return true; 56 } 57 } 58 | Popular Tags |