1 19 20 package org.netbeans.modules.subversion.ui.commit; 21 22 import java.io.*; 23 import org.netbeans.modules.subversion.*; 24 import org.netbeans.modules.subversion.client.*; 25 import org.netbeans.modules.subversion.ui.actions.ContextAction; 26 import org.netbeans.modules.subversion.util.*; 27 import org.openide.*; 28 import org.openide.filesystems.*; 29 import org.openide.nodes.Node; 30 import org.openide.util.RequestProcessor; 31 import org.tigris.subversion.svnclientadapter.*; 32 33 38 public class ConflictResolvedAction extends ContextAction { 39 40 protected String getBaseName(Node[] activatedNodes) { 41 return "resolve"; } 43 44 protected int getFileEnabledStatus() { 45 return FileInformation.STATUS_VERSIONED_CONFLICT; 46 } 47 48 protected int getDirectoryEnabledStatus() { 49 return 0; 50 } 51 52 protected void performContextAction(Node[] nodes) { 53 final Context ctx = getContext(nodes); 54 final File[] files = ctx.getFiles(); 55 56 ProgressSupport support = new ContextAction.ProgressSupport(this, nodes) { 57 public void perform() { 58 59 SvnClient client = null; 60 try { 61 client = Subversion.getInstance().getClient(ctx, this); 62 } catch (SVNClientException ex) { 63 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 64 ErrorManager.getDefault().notify(ErrorManager.USER, ex); 65 } 66 67 if (client == null) { 68 return; 69 } 70 71 for (int i = 0; i<files.length; i++) { 72 if(isCanceled()) { 73 return; 74 } 75 File file = files[i]; 76 ConflictResolvedAction.perform(file, client); 77 } 78 } 79 }; 80 support.start(createRequestProcessor(nodes)); 81 } 82 83 84 85 public static void perform(File file) { 86 SvnClient client = null; 87 try { 88 client = Subversion.getInstance().getClient(file); 89 perform(file, client); 90 } catch (SVNClientException ex) { 91 ExceptionHandler eh = new ExceptionHandler (ex); 92 eh.notifyException(); 93 } 94 } 95 96 private static void perform(File file, SvnClient client) { 97 FileStatusCache cache = Subversion.getInstance().getStatusCache(); 98 99 try { 100 client.resolved(file); 101 cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN); 102 103 File parent = file.getParentFile(); 105 if (parent != null) { 106 FileObject folder = FileUtil.toFileObject(parent); 107 if (folder != null) { 108 folder.refresh(); 109 } 110 } 111 } catch (SVNClientException ex) { 112 ExceptionHandler eh = new ExceptionHandler (ex); 113 eh.notifyException(); 114 } 115 } 116 117 } 118 | Popular Tags |