1 19 20 package org.netbeans.modules.subversion.ui.update; 21 22 import java.io.*; 23 import org.netbeans.modules.subversion.*; 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.openide.DialogDisplayer; 28 import org.openide.NotifyDescriptor; 29 import org.openide.nodes.Node; 30 31 36 public class ResolveConflictsAction extends ContextAction { 37 38 public ResolveConflictsAction() { 39 } 40 41 protected String getBaseName(Node[] activatedNodes) { 42 return "ResolveConflicts"; } 44 45 46 protected boolean enable(Node[] nodes) { 47 Context ctx = SvnUtils.getCurrentContext(nodes); 48 return SvnUtils.getModifiedFiles(ctx, FileInformation.STATUS_VERSIONED_CONFLICT).length > 0; 49 } 50 51 protected void performContextAction(Node[] nodes) { 52 Context ctx = getContext(nodes); 53 FileStatusCache cache = Subversion.getInstance().getStatusCache(); 54 File[] files = cache.listFiles(ctx, FileInformation.STATUS_VERSIONED_CONFLICT); 55 56 if (files.length == 0) { 57 NotifyDescriptor nd = new NotifyDescriptor.Message(org.openide.util.NbBundle.getMessage(ResolveConflictsAction.class, "MSG_NoConflictsFound")); DialogDisplayer.getDefault().notify(nd); 59 } else { 60 for (int i = 0; i<files.length; i++) { 61 File file = files[i]; 62 ResolveConflictsExecutor executor = new ResolveConflictsExecutor(file); 63 executor.exec(); 64 } 65 } 66 } 67 68 public boolean asynchronous() { 69 return false; 70 } 71 72 } 73 | Popular Tags |