1 19 package org.netbeans.modules.localhistory; 20 21 import java.awt.Image ; 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import javax.swing.Action ; 25 import org.netbeans.modules.localhistory.ui.actions.RevertDeletedAction; 26 import org.netbeans.modules.localhistory.ui.revert.RevertToAction; 27 import org.netbeans.modules.localhistory.ui.view.ShowLocalHistoryAction; 28 import org.netbeans.modules.versioning.spi.VCSAnnotator; 29 import org.netbeans.modules.versioning.spi.VCSContext; 30 import org.netbeans.modules.versioning.util.SystemActionBridge; 31 import org.openide.util.Lookup; 32 import org.openide.util.NbBundle; 33 import org.openide.util.actions.SystemAction; 34 import org.openide.util.lookup.Lookups; 35 36 42 public class LocalHistoryVCSAnnotator extends VCSAnnotator { 43 44 45 public LocalHistoryVCSAnnotator() { 46 } 47 48 public Image annotateIcon(Image icon, VCSContext context) { 49 return super.annotateIcon(icon, context); 51 } 52 53 public String annotateName(String name, VCSContext context) { 54 return super.annotateName(name, context); 56 } 57 58 public Action [] getActions(VCSContext ctx, VCSAnnotator.ActionDestination destination) { 59 Lookup context = Lookups.fixed(ctx.getNodes()); 60 List <Action > actions = new ArrayList <Action >(); 61 if (destination == VCSAnnotator.ActionDestination.MainMenu) { 62 actions.add(SystemAction.get(ShowLocalHistoryAction.class)); 63 actions.add(SystemAction.get(RevertDeletedAction.class)); 64 actions.add(SystemAction.get(RevertToAction.class)); 65 } else { 66 actions.add(SystemActionBridge.createAction( 67 SystemAction.get(ShowLocalHistoryAction.class), 68 NbBundle.getMessage(LocalHistoryVCSAnnotator.class, "CTL_PopupMenuItem_ShowLocalHistory"), context)); 70 actions.add(SystemActionBridge.createAction( 71 SystemAction.get(RevertDeletedAction.class), 72 NbBundle.getMessage(LocalHistoryVCSAnnotator.class, "CTL_PopupMenuItem_RevertDeleted"), context)); 74 actions.add(SystemActionBridge.createAction( 75 SystemAction.get(RevertToAction.class), 76 RevertToAction.getMenuName(), 77 context)); 78 } 79 return actions.toArray(new Action [actions.size()]); 80 } 81 82 } 83 | Popular Tags |