1 19 20 package org.netbeans.modules.subversion.ui.diff; 21 22 import java.util.*; 23 24 import org.netbeans.modules.subversion.ui.actions.ContextAction; 25 import org.netbeans.modules.subversion.util.Context; 26 import org.netbeans.modules.subversion.util.SvnUtils; 27 import org.netbeans.modules.subversion.*; 28 import java.io.File ; 29 30 import org.openide.nodes.Node; 31 import org.openide.util.*; 32 33 38 public class DiffAction extends ContextAction { 39 40 protected String getBaseName(Node[] nodes) { 41 return "CTL_MenuItem_Diff"; } 43 44 protected boolean enable(Node[] nodes) { 45 Context ctx = SvnUtils.getCurrentContext(nodes); 46 return SvnUtils.getModifiedFiles(ctx, FileInformation.STATUS_LOCAL_CHANGE).length > 0; 47 } 48 49 public static void diff(Context ctx, int type, String contextName) { 50 51 DiffMainPanel panel = new DiffMainPanel(ctx, type, contextName); DiffTopComponent tc = new DiffTopComponent(panel); 53 tc.setName(NbBundle.getMessage(DiffAction.class, "CTL_DiffPanel_Title", contextName)); tc.open(); 55 tc.requestActive(); 56 } 57 58 public static void diff(File file, String rev1, String rev2) { 59 DiffMainPanel panel = new DiffMainPanel(file, rev1, rev2); DiffTopComponent tc = new DiffTopComponent(panel); 61 tc.setName(NbBundle.getMessage(DiffAction.class, "CTL_DiffPanel_Title", file.getName())); tc.open(); 63 tc.requestActive(); 64 } 65 66 protected void performContextAction(Node[] nodes) { 67 Context ctx = getContext(nodes); 68 String contextName = getContextDisplayName(nodes); 69 diff(ctx, Setup.DIFFTYPE_LOCAL, contextName); 70 } 71 72 } 73 | Popular Tags |