1 11 package org.eclipse.team.internal.ccvs.core.client; 12 13 14 import org.eclipse.core.runtime.Assert; 15 import org.eclipse.core.runtime.IProgressMonitor; 16 import org.eclipse.team.internal.ccvs.core.*; 17 import org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag; 18 import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; 19 import org.eclipse.team.internal.ccvs.core.syncinfo.MutableFolderSyncInfo; 20 21 37 class StickyHandler extends ResponseHandler { 38 private final boolean setSticky; 39 40 public StickyHandler(boolean setSticky) { 41 this.setSticky = setSticky; 42 } 43 44 public String getResponseID() { 45 if (setSticky) { 46 return "Set-sticky"; } else { 48 return "Clear-sticky"; } 50 } 51 52 public void handle(Session session, String localDir, 53 IProgressMonitor monitor) throws CVSException { 54 String repositoryDir = session.readLine(); 56 String tag = null; 57 if (setSticky) { 58 tag = session.readLine(); 59 if (tag != null && tag.length() == 0) tag = null; 60 } 61 62 Assert.isTrue(repositoryDir.endsWith("/")); repositoryDir = repositoryDir.substring(0, repositoryDir.length() - 1); 65 try { 66 ICVSFolder folder = createFolder(session, localDir, repositoryDir); 67 FolderSyncInfo syncInfo = folder.getFolderSyncInfo(); 68 if (syncInfo == null) return; 70 MutableFolderSyncInfo newInfo = syncInfo.cloneMutable(); 71 newInfo.setTag(tag != null ? new CVSEntryLineTag(tag) : null); 72 74 if(tag != null && tag.equals("TBASE")) newInfo.setTag(syncInfo.getTag()); 76 if (!syncInfo.equals(newInfo)) 78 folder.setFolderSyncInfo(newInfo); 79 } catch (CVSException e) { 80 if (!handleInvalidResourceName(session, session.getLocalRoot().getFolder(localDir), e)) { 81 throw e; 82 } 83 } 84 } 85 } 86 87 | Popular Tags |