diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
82 files changed, 2007 insertions, 2007 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSAnnotateBlock.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSAnnotateBlock.java index 8a757d5bf..f9384de9f 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSAnnotateBlock.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSAnnotateBlock.java @@ -117,11 +117,11 @@ public class CVSAnnotateBlock { line = CVSMessages.CVSAnnotateBlock_5; } return NLS.bind(CVSMessages.CVSAnnotateBlock_6, (new Object[] { - user, - revision, - String.valueOf(delta), - line - })); + user, + revision, + String.valueOf(delta), + line + })); } /** diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java index c5b76c497..2df39fdfa 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java @@ -163,7 +163,7 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs newRoots.addAll(Arrays.asList(resources)); newRoots.removeAll(removals); resources = (IResource[]) newRoots.toArray(new IResource[newRoots.size()]); - + // Create the deltas for the removals SubscriberChangeEvent[] deltas = new SubscriberChangeEvent[removals.size()]; for (int i = 0; i < deltas.length; i++) { @@ -245,24 +245,24 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs } } - /** - * Return the tag associated with the given root resource - * or <code>null</code> if there is only a single tag - * for the subscriber. - * @param root the root resource - * @return the tag associated with the given root resource - */ - public CVSTag getTag(IResource root) { - return tree.getTag(root); - } - - /** - * Return <code>true</code> if the tag against which each - * root is compared may differ. - * @return whether the tag on each root may differ. - */ - public boolean isMultipleTagComparison() { - return getTag() == null; - } + /** + * Return the tag associated with the given root resource + * or <code>null</code> if there is only a single tag + * for the subscriber. + * @param root the root resource + * @return the tag associated with the given root resource + */ + public CVSTag getTag(IResource root) { + return tree.getTag(root); + } + + /** + * Return <code>true</code> if the tag against which each + * root is compared may differ. + * @return whether the tag on each root may differ. + */ + public boolean isMultipleTagComparison() { + return getTag() == null; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java index 49333af1d..cc2be829e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java @@ -28,63 +28,63 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; * Core validator that will load the UI validator only if a prompt is needed */ public class CVSCoreFileModificationValidator extends FileModificationValidator implements ICVSFileModificationValidator { - - FileModificationValidator uiValidator; - - @Override - public IStatus validateEdit(IFile[] files, FileModificationValidationContext context) { - IFile[] unmanagedReadOnlyFiles = getUnmanagedReadOnlyFiles(files); - if (unmanagedReadOnlyFiles.length > 0) { - IStatus status = setWritable(unmanagedReadOnlyFiles); - if (!status.isOK()) { - return status; - } - } + + FileModificationValidator uiValidator; + + @Override + public IStatus validateEdit(IFile[] files, FileModificationValidationContext context) { + IFile[] unmanagedReadOnlyFiles = getUnmanagedReadOnlyFiles(files); + if (unmanagedReadOnlyFiles.length > 0) { + IStatus status = setWritable(unmanagedReadOnlyFiles); + if (!status.isOK()) { + return status; + } + } IFile[] readOnlyFiles = getManagedReadOnlyFiles(files); if (readOnlyFiles.length == 0) return Status.OK_STATUS; return edit(readOnlyFiles, context); - } + } - @Override - public IStatus validateSave(IFile file) { + @Override + public IStatus validateSave(IFile file) { if (!needsCheckout(file)) { - if (file.isReadOnly()) { - setWritable(new IFile[] { file } ); - } - return Status.OK_STATUS; + if (file.isReadOnly()) { + setWritable(new IFile[] { file } ); + } + return Status.OK_STATUS; } return edit(new IFile[] {file}, (FileModificationValidationContext)null); - } - - /** - * Method for editing a set of files. Is overriden by the - * UI to prompt the user. Default behavior is to try and load the - * UI validator and, failing that, to edit without - * prompting. - * @param readOnlyFiles - * @param context - * @return - */ - protected IStatus edit(IFile[] readOnlyFiles, FileModificationValidationContext context) { - FileModificationValidator override = getUIValidator(); - if (override != null) { - return override.validateEdit(readOnlyFiles, context); - } else { - performEdit(readOnlyFiles); - return Status.OK_STATUS; - } - } - - private FileModificationValidator getUIValidator() { - synchronized(this) { - if (uiValidator == null) { - uiValidator = getPluggedInValidator(); - } - } - return uiValidator; - } - - @Override + } + + /** + * Method for editing a set of files. Is overriden by the + * UI to prompt the user. Default behavior is to try and load the + * UI validator and, failing that, to edit without + * prompting. + * @param readOnlyFiles + * @param context + * @return + */ + protected IStatus edit(IFile[] readOnlyFiles, FileModificationValidationContext context) { + FileModificationValidator override = getUIValidator(); + if (override != null) { + return override.validateEdit(readOnlyFiles, context); + } else { + performEdit(readOnlyFiles); + return Status.OK_STATUS; + } + } + + private FileModificationValidator getUIValidator() { + synchronized(this) { + if (uiValidator == null) { + uiValidator = getPluggedInValidator(); + } + } + return uiValidator; + } + + @Override public IStatus validateMoveDelete(IFile[] files, IProgressMonitor monitor) { IFile[] readOnlyFiles = getManagedReadOnlyFiles(files); if (readOnlyFiles.length == 0) return Status.OK_STATUS; @@ -93,30 +93,30 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator return Status.OK_STATUS; } - /* - * Perform the headless edit check in the background. - * The user will be notified of any errors that occurred. - */ + /* + * Perform the headless edit check in the background. + * The user will be notified of any errors that occurred. + */ protected void performEdit(final IFile[] readOnlyFiles) { - setWritable(readOnlyFiles); - Job job = new Job(CVSMessages.CVSCoreFileModificationValidator_editJob) { - protected IStatus run(IProgressMonitor monitor) { - try { - performEdit(readOnlyFiles, monitor); - } catch (CVSException e) { - return e.getStatus(); - } - return Status.OK_STATUS; - } - }; - scheduleEditJob(job); - } - - protected void scheduleEditJob(Job job) { - job.schedule(); - } - - protected CVSTeamProvider getProvider(IFile[] files) { + setWritable(readOnlyFiles); + Job job = new Job(CVSMessages.CVSCoreFileModificationValidator_editJob) { + protected IStatus run(IProgressMonitor monitor) { + try { + performEdit(readOnlyFiles, monitor); + } catch (CVSException e) { + return e.getStatus(); + } + return Status.OK_STATUS; + } + }; + scheduleEditJob(job); + } + + protected void scheduleEditJob(Job job) { + job.schedule(); + } + + protected CVSTeamProvider getProvider(IFile[] files) { CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(files[0].getProject(), CVSProviderPlugin.getTypeId()); return provider; } @@ -130,7 +130,7 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator if (file.isReadOnly()) { ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file); boolean managed = cvsFile.isManaged(); - return managed; + return managed; } } catch (CVSException e) { // Log the exception and assume we don't need a checkout @@ -140,21 +140,21 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator } protected IStatus setWritable(final IFile[] files) { - for (int i = 0; i < files.length; i++) { - IFile file = files[i]; - ResourceAttributes attributes = file.getResourceAttributes(); - if (attributes != null) { - attributes.setReadOnly(false); - } - try { - file.setResourceAttributes(attributes); - } catch (CoreException e) { - return CVSException.wrapException(e).getStatus(); - } - } - return Status.OK_STATUS; - } - + for (int i = 0; i < files.length; i++) { + IFile file = files[i]; + ResourceAttributes attributes = file.getResourceAttributes(); + if (attributes != null) { + attributes.setReadOnly(false); + } + try { + file.setResourceAttributes(attributes); + } catch (CoreException e) { + return CVSException.wrapException(e).getStatus(); + } + } + return Status.OK_STATUS; + } + private IFile[] getManagedReadOnlyFiles(IFile[] files) { List readOnlys = new ArrayList(); for (int i = 0; i < files.length; i++) { @@ -166,7 +166,7 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator return (IFile[]) readOnlys.toArray(new IFile[readOnlys.size()]); } - protected IFile[] getUnmanagedReadOnlyFiles(IFile[] files) { + protected IFile[] getUnmanagedReadOnlyFiles(IFile[] files) { List readOnlys = new ArrayList(); for (int i = 0; i < files.length; i++) { IFile iFile = files[i]; @@ -175,8 +175,8 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator } } return (IFile[]) readOnlys.toArray(new IFile[readOnlys.size()]); - } - + } + private static FileModificationValidator getPluggedInValidator() { IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(CVSProviderPlugin.ID, CVSProviderPlugin.PT_FILE_MODIFICATION_VALIDATOR).getExtensions(); if (extensions.length == 0) @@ -195,45 +195,45 @@ public class CVSCoreFileModificationValidator extends FileModificationValidator return null; } } - - public ISchedulingRule validateEditRule(CVSResourceRuleFactory factory, IResource[] resources) { - FileModificationValidator override = getUIValidator(); - if (override instanceof CVSCoreFileModificationValidator && override != this) { - CVSCoreFileModificationValidator ui = (CVSCoreFileModificationValidator) override; - return ui.validateEditRule(factory, resources); - } - return internalValidateEditRule(factory, resources); - } - - protected final ISchedulingRule internalValidateEditRule(CVSResourceRuleFactory factory, IResource[] resources) { - if (resources.length == 0) - return null; - //optimize rule for single file - if (resources.length == 1) - return isReadOnly(resources[0]) ? factory.getParent(resources[0]) : null; - //need a lock on the parents of all read-only files - HashSet rules = new HashSet(); - for (int i = 0; i < resources.length; i++) - if (isReadOnly(resources[i])) - rules.add(factory.getParent(resources[i])); - return createSchedulingRule(rules); - } - - protected ISchedulingRule createSchedulingRule(Set rules) { - if (rules.isEmpty()) - return null; - if (rules.size() == 1) - return (ISchedulingRule) rules.iterator().next(); - ISchedulingRule[] ruleArray = (ISchedulingRule[]) rules - .toArray(new ISchedulingRule[rules.size()]); - return new MultiRule(ruleArray); - } - - protected final boolean isReadOnly(IResource resource) { - ResourceAttributes a = resource.getResourceAttributes(); - if (a != null) { - return a.isReadOnly(); - } - return false; - } + + public ISchedulingRule validateEditRule(CVSResourceRuleFactory factory, IResource[] resources) { + FileModificationValidator override = getUIValidator(); + if (override instanceof CVSCoreFileModificationValidator && override != this) { + CVSCoreFileModificationValidator ui = (CVSCoreFileModificationValidator) override; + return ui.validateEditRule(factory, resources); + } + return internalValidateEditRule(factory, resources); + } + + protected final ISchedulingRule internalValidateEditRule(CVSResourceRuleFactory factory, IResource[] resources) { + if (resources.length == 0) + return null; + //optimize rule for single file + if (resources.length == 1) + return isReadOnly(resources[0]) ? factory.getParent(resources[0]) : null; + //need a lock on the parents of all read-only files + HashSet rules = new HashSet(); + for (int i = 0; i < resources.length; i++) + if (isReadOnly(resources[i])) + rules.add(factory.getParent(resources[i])); + return createSchedulingRule(rules); + } + + protected ISchedulingRule createSchedulingRule(Set rules) { + if (rules.isEmpty()) + return null; + if (rules.size() == 1) + return (ISchedulingRule) rules.iterator().next(); + ISchedulingRule[] ruleArray = (ISchedulingRule[]) rules + .toArray(new ISchedulingRule[rules.size()]); + return new MultiRule(ruleArray); + } + + protected final boolean isReadOnly(IResource resource) { + ResourceAttributes a = resource.getResourceAttributes(); + if (a != null) { + return a.isReadOnly(); + } + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSException.java index bc87a45a5..926712c09 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSException.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSException.java @@ -34,14 +34,14 @@ public class CVSException extends TeamException { private static final long serialVersionUID = 1L; - public CVSException(CoreException e) { - super(e); + public CVSException(CoreException e) { + super(e); } public CVSException(String message) { this(new CVSStatus(IStatus.ERROR, message)); } - + public CVSException(IStatus status) { super(status); } @@ -76,7 +76,7 @@ public class CVSException extends TeamException { //TODO: fix the caller to setup the error code return new CVSException(new CVSStatus(IStatus.ERROR, UNABLE, t.getMessage() != null ? t.getMessage() : "", t, (IResource)null)); //$NON-NLS-1$ } - + public static CVSException wrapException(CoreException e) { if (e instanceof CVSException) { return (CVSException)e; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java index e39b8ac0b..5f38acc26 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java @@ -347,6 +347,6 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour if(! (other instanceof CVSMergeSubscriber)) return false; CVSMergeSubscriber s = (CVSMergeSubscriber)other; return getEndTag().equals(s.getEndTag()) && - getStartTag().equals(s.getStartTag()) && rootsEqual(s); + getStartTag().equals(s.getStartTag()) && rootsEqual(s); } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java index d1deabbd7..879cf9e45 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java @@ -85,7 +85,7 @@ public class CVSMessages extends NLS { public static String CVSTeamProvider_errorGettingWatchEdit; public static String CVSTeamProvider_errorSettingWatchEdit; public static String CVSTeamProvider_updatingFolder; - public static String CVSCoreFileModificationValidator_editJob; + public static String CVSCoreFileModificationValidator_editJob; public static String ResourceDeltaVisitor_visitError; @@ -110,7 +110,7 @@ public class CVSMessages extends NLS { public static String Session_transferNoSize; public static String Session_calculatingCompressedSize; public static String Session_0; - public static String Session_sending; + public static String Session_sending; public static String Command_receivingResponses; public static String Command_warnings; @@ -122,8 +122,8 @@ public class CVSMessages extends NLS { public static String Command_noOpenSession; public static String Command_seriousServerError; - public static String Add_invalidParent; - + public static String Add_invalidParent; + public static String Commit_syncInfoMissing; public static String Commit_timestampReset; @@ -166,9 +166,9 @@ public class CVSMessages extends NLS { public static String CVSRepositoryLocation_invalidFormat; public static String CVSRepositoryLocation_openingConnection; public static String CVSRepositoryLocation_usernameRequired; - public static String CVSRepositoryLocation_hostRequired; - public static String CVSRepositoryLocation_rootRequired; - public static String CVSRepositoryLocation_noAuthenticator; + public static String CVSRepositoryLocation_hostRequired; + public static String CVSRepositoryLocation_rootRequired; + public static String CVSRepositoryLocation_noAuthenticator; public static String Util_timeout; public static String Util_processTimeout; @@ -197,7 +197,7 @@ public class CVSMessages extends NLS { public static String EclipseFile_Problem_writing_resource; public static String EclipseFolder_problem_creating; public static String EclipseFolder_isModifiedProgress; - public static String EclipseFolder_0; + public static String EclipseFolder_0; public static String EclipseSynchronizer_UpdatingSyncEndOperation; public static String EclipseSynchronizer_UpdatingSyncEndOperationCancelled; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java index 8579ccfaf..6399830a4 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProjectSetCapability.java @@ -144,16 +144,16 @@ public class CVSProjectSetCapability extends ProjectSetCapability { // Confirm the projects to be loaded Map infoMap = new HashMap(referenceStrings.length); - IProject[] projects = asProjects(referenceStrings, infoMap); + IProject[] projects = asProjects(referenceStrings, infoMap); - projects = confirmOverwrite(context, projects); + projects = confirmOverwrite(context, projects); if (projects == null || projects.length == 0 /* No projects to import */) return new IProject[0]; Map suggestedRepositoryLocations = CVSRepositoryLocationMatcher .prepareSuggestedRepositoryLocations(projects, infoMap); - applySinglePerfectMatchesToInfoMap(suggestedRepositoryLocations, infoMap); - if (CVSRepositoryLocationMatcher.isPromptRequired(suggestedRepositoryLocations)) { + applySinglePerfectMatchesToInfoMap(suggestedRepositoryLocations, infoMap); + if (CVSRepositoryLocationMatcher.isPromptRequired(suggestedRepositoryLocations)) { // Display the dialog Map userSelectedRepositoryLocations = promptForAdditionRepositoryInformation(suggestedRepositoryLocations); // Replace repository location from a project load info with one from the prompter @@ -165,8 +165,8 @@ public class CVSProjectSetCapability extends ProjectSetCapability { } } - // Load the projects - return checkout(projects, infoMap, monitor); + // Load the projects + return checkout(projects, infoMap, monitor); } private void applySinglePerfectMatchesToInfoMap( diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java index b84a4082e..85d9aff4b 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java @@ -115,38 +115,38 @@ public class CVSProviderPlugin extends Plugin { private static final String CRASH_INDICATION_FILE = ".running"; //$NON-NLS-1$ private boolean crash; - private boolean autoShareOnImport; - private boolean useProxy; - - public static final String PROXY_TYPE_HTTP = "HTTP"; //$NON-NLS-1$ - public static final String PROXY_TYPE_SOCKS5 = "SOCKS5"; //$NON-NLS-1$ - public static final String HTTP_DEFAULT_PORT = "80"; //$NON-NLS-1$ - public static final String SOCKS5_DEFAULT_PORT = "1080"; //$NON-NLS-1$ - - private String proxyType; - private String proxyHost; - private String proxyPort; - private boolean useProxyAuth; - - private CVSActiveChangeSetCollector changeSetManager; + private boolean autoShareOnImport; + private boolean useProxy; + + public static final String PROXY_TYPE_HTTP = "HTTP"; //$NON-NLS-1$ + public static final String PROXY_TYPE_SOCKS5 = "SOCKS5"; //$NON-NLS-1$ + public static final String HTTP_DEFAULT_PORT = "80"; //$NON-NLS-1$ + public static final String SOCKS5_DEFAULT_PORT = "1080"; //$NON-NLS-1$ + + private String proxyType; + private String proxyHost; + private String proxyPort; + private boolean useProxyAuth; + + private CVSActiveChangeSetCollector changeSetManager; private ServiceRegistration debugRegistration; private ServiceTracker tracker; - private static final String INFO_PROXY_USER = "org.eclipse.team.cvs.core.proxy.user"; //$NON-NLS-1$ - private static final String INFO_PROXY_PASS = "org.eclipse.team.cvs.core.proxy.pass"; //$NON-NLS-1$ - - private static final URL FAKE_URL; - static { - URL temp = null; - try { - temp = new URL("http://org.eclipse.team.cvs.proxy.auth");//$NON-NLS-1$ - } catch (MalformedURLException e) { - // Should never fail - } - FAKE_URL = temp; - } - - + private static final String INFO_PROXY_USER = "org.eclipse.team.cvs.core.proxy.user"; //$NON-NLS-1$ + private static final String INFO_PROXY_PASS = "org.eclipse.team.cvs.core.proxy.pass"; //$NON-NLS-1$ + + private static final URL FAKE_URL; + static { + URL temp = null; + try { + temp = new URL("http://org.eclipse.team.cvs.proxy.auth");//$NON-NLS-1$ + } catch (MalformedURLException e) { + // Should never fail + } + FAKE_URL = temp; + } + + public synchronized CVSWorkspaceSubscriber getCVSWorkspaceSubscriber() { if (cvsWorkspaceSubscriber == null) { cvsWorkspaceSubscriber = new CVSWorkspaceSubscriber( @@ -282,7 +282,7 @@ public class CVSProviderPlugin extends Plugin { * @param consoleListener the listener */ public void setConsoleListener(IConsoleListener consoleListener) { - ConsoleListeners.getInstance().addListener(consoleListener); + ConsoleListeners.getInstance().addListener(consoleListener); } @Override @@ -312,8 +312,8 @@ public class CVSProviderPlugin extends Plugin { // Must load the change set manager on startup since it listens to deltas getChangeSetManager(); - tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null); - tracker.open(); + tracker = new ServiceTracker(getBundle().getBundleContext(), IJSchService.class.getName(), null); + tracker.open(); } @Override @@ -638,13 +638,13 @@ public class CVSProviderPlugin extends Plugin { this.usePlatformLineend = usePlatformLineend; } - public void setAutoshareOnImport(boolean autoShareOnImport) { - this.autoShareOnImport = autoShareOnImport; - } + public void setAutoshareOnImport(boolean autoShareOnImport) { + this.autoShareOnImport = autoShareOnImport; + } - public boolean isAutoshareOnImport() { - return autoShareOnImport; - } + public boolean isAutoshareOnImport() { + return autoShareOnImport; + } /** * @return Returns the watchOnEdit. @@ -652,93 +652,93 @@ public class CVSProviderPlugin extends Plugin { public boolean isWatchOnEdit() { return getPluginPreferences().getBoolean(CVSProviderPlugin.ENABLE_WATCH_ON_EDIT); } - - // proxy configuration - - public void setUseProxy(boolean useProxy) { - this.useProxy = useProxy; - } - - public boolean isUseProxy() { - return this.useProxy; - } - - public void setProxyType(String proxyType) { - this.proxyType = proxyType; - } - - public String getProxyType() { - return this.proxyType; - } - - public void setProxyHost(String proxyHost) { - this.proxyHost = proxyHost; - } - - public String getProxyHost() { - return this.proxyHost; - } - - public void setProxyPort(String proxyPort) { - this.proxyPort = proxyPort; - } - - public String getProxyPort() { - return this.proxyPort; - } - - public void setUseProxyAuth(boolean useProxyAuth) { - this.useProxyAuth = useProxyAuth; - } - - public boolean isUseProxyAuth() { - return this.useProxyAuth; - } - - public String getProxyUser() { - Object user = getAuthInfo().get(INFO_PROXY_USER); - return user==null ? "" : (String) user; //$NON-NLS-1$ - } - - public String getProxyPassword() { - Object pass = getAuthInfo().get(INFO_PROXY_PASS); - return pass==null ? "" : (String) pass; //$NON-NLS-1$ - } - - private Map getAuthInfo() { - // Retrieve username and password from keyring. - Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, "proxy", ""); //$NON-NLS-1$ //$NON-NLS-2$ - return authInfo!=null ? authInfo : Collections.EMPTY_MAP; - } - - public void setProxyAuth(String proxyUser, String proxyPass) { - Map authInfo = getAuthInfo(); - if (authInfo.size()==0) { - authInfo = new java.util.HashMap(4); - } - if (proxyUser != null) { - authInfo.put(INFO_PROXY_USER, proxyUser); - } - if (proxyPass != null) { - authInfo.put(INFO_PROXY_PASS, proxyPass); - } - try { - Platform.addAuthorizationInfo(FAKE_URL, "proxy", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ - } catch (CoreException e) { - // We should probably wrap the CoreException here! - CVSProviderPlugin.log(e); - } - } - - public synchronized ActiveChangeSetManager getChangeSetManager() { - if (changeSetManager == null) { - changeSetManager = new CVSActiveChangeSetCollector(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()); - } - return changeSetManager; - } - - public IJSchService getJSchService() { - return (IJSchService)tracker.getService(); - } - + + // proxy configuration + + public void setUseProxy(boolean useProxy) { + this.useProxy = useProxy; + } + + public boolean isUseProxy() { + return this.useProxy; + } + + public void setProxyType(String proxyType) { + this.proxyType = proxyType; + } + + public String getProxyType() { + return this.proxyType; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public String getProxyHost() { + return this.proxyHost; + } + + public void setProxyPort(String proxyPort) { + this.proxyPort = proxyPort; + } + + public String getProxyPort() { + return this.proxyPort; + } + + public void setUseProxyAuth(boolean useProxyAuth) { + this.useProxyAuth = useProxyAuth; + } + + public boolean isUseProxyAuth() { + return this.useProxyAuth; + } + + public String getProxyUser() { + Object user = getAuthInfo().get(INFO_PROXY_USER); + return user==null ? "" : (String) user; //$NON-NLS-1$ + } + + public String getProxyPassword() { + Object pass = getAuthInfo().get(INFO_PROXY_PASS); + return pass==null ? "" : (String) pass; //$NON-NLS-1$ + } + + private Map getAuthInfo() { + // Retrieve username and password from keyring. + Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, "proxy", ""); //$NON-NLS-1$ //$NON-NLS-2$ + return authInfo!=null ? authInfo : Collections.EMPTY_MAP; + } + + public void setProxyAuth(String proxyUser, String proxyPass) { + Map authInfo = getAuthInfo(); + if (authInfo.size()==0) { + authInfo = new java.util.HashMap(4); + } + if (proxyUser != null) { + authInfo.put(INFO_PROXY_USER, proxyUser); + } + if (proxyPass != null) { + authInfo.put(INFO_PROXY_PASS, proxyPass); + } + try { + Platform.addAuthorizationInfo(FAKE_URL, "proxy", "", authInfo); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (CoreException e) { + // We should probably wrap the CoreException here! + CVSProviderPlugin.log(e); + } + } + + public synchronized ActiveChangeSetManager getChangeSetManager() { + if (changeSetManager == null) { + changeSetManager = new CVSActiveChangeSetCollector(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber()); + } + return changeSetManager; + } + + public IJSchService getJSchService() { + return (IJSchService)tracker.getService(); + } + } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSResourceRuleFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSResourceRuleFactory.java index b92be5df6..db3d55b0a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSResourceRuleFactory.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSResourceRuleFactory.java @@ -18,12 +18,12 @@ import org.eclipse.core.resources.team.ResourceRuleFactory; import org.eclipse.core.runtime.jobs.ISchedulingRule; public class CVSResourceRuleFactory extends ResourceRuleFactory { - public ISchedulingRule validateEditRule(IResource[] resources) { - return CVSTeamProvider.internalGetFileModificationValidator().validateEditRule(this, resources); - } - - public ISchedulingRule getParent(IResource resource) { - return parent(resource); - } - + public ISchedulingRule validateEditRule(IResource[] resources) { + return CVSTeamProvider.internalGetFileModificationValidator().validateEditRule(this, resources); + } + + public ISchedulingRule getParent(IResource resource) { + return parent(resource); + } + }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java index 3f3164600..3fda18b5e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSRevisionNumberCompareCriteria.java @@ -24,7 +24,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; * CVSRevisionNumberCompareCriteria */ public class CVSRevisionNumberCompareCriteria implements IResourceVariantComparator { - + private boolean isThreeWay; public CVSRevisionNumberCompareCriteria(boolean isThreeWay) { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java index 1e8306d93..ac05beb4f 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java @@ -98,46 +98,46 @@ public class CVSStatus extends TeamStatus { return message; } - /** - * Return whether this status is wrapping an internal error. - * An internal error is any error for which the wrapped exception - * is not a CVS exception. Check deeply to make sure there isn't - * an internal error buried deep down. - * @return whether this status is wrapping an internal error - */ - public boolean isInternalError() { - Throwable ex = getException(); - if (ex instanceof CVSException) { - CVSException cvsEx = (CVSException) ex; - IStatus status = cvsEx.getStatus(); - return isInternalError(status); - } - return ex != null; - } + /** + * Return whether this status is wrapping an internal error. + * An internal error is any error for which the wrapped exception + * is not a CVS exception. Check deeply to make sure there isn't + * an internal error buried deep down. + * @return whether this status is wrapping an internal error + */ + public boolean isInternalError() { + Throwable ex = getException(); + if (ex instanceof CVSException) { + CVSException cvsEx = (CVSException) ex; + IStatus status = cvsEx.getStatus(); + return isInternalError(status); + } + return ex != null; + } - /** - * Return whether this status is wrapping an internal error. - * An internal error is any error for which the wrapped exception - * is not a CVS exception. Check deeply to make sure there isn't - * an internal error buried deep down. - * @return whether this status is wrapping an internal error - */ - public static boolean isInternalError(IStatus status) { - if (status instanceof CVSStatus) { - return ((CVSStatus)status).isInternalError(); - } - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - IStatus child = children[i]; - if (isInternalError(child)) { - return true; - } - } - return false; - } - return true; - } + /** + * Return whether this status is wrapping an internal error. + * An internal error is any error for which the wrapped exception + * is not a CVS exception. Check deeply to make sure there isn't + * an internal error buried deep down. + * @return whether this status is wrapping an internal error + */ + public static boolean isInternalError(IStatus status) { + if (status instanceof CVSStatus) { + return ((CVSStatus)status).isInternalError(); + } + if (status.isMultiStatus()) { + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + IStatus child = children[i]; + if (isInternalError(child)) { + return true; + } + } + return false; + } + return true; + } public ICVSRepositoryLocation getCvsLocation() { if (cvsLocation==null){ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java index 7c14f4080..a5984d346 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSSyncInfo.java @@ -267,13 +267,13 @@ public class CVSSyncInfo extends SyncInfo { * </ul> * </ul> */ - public IStatus makeInSync() throws CVSException { - - // Only works on folders + public IStatus makeInSync() throws CVSException { + + // Only works on folders if (getLocal().getType() == IResource.FILE) { return new CVSStatus(IStatus.WARNING, INVALID_RESOURCE_TYPE, NLS.bind(CVSMessages.CVSSyncInfo_7, new String[] { getLocal().getFullPath().toString()}), getLocal()); } - + // Only works on outgoing and conflicting changes boolean outgoing = (getKind() & DIRECTION_MASK) == OUTGOING; if (outgoing) { @@ -318,9 +318,9 @@ public class CVSSyncInfo extends SyncInfo { // It is also impossible for an incomming folder to be static. FolderSyncInfo remoteInfo = remote.getFolderSyncInfo(); FolderSyncInfo localInfo = local.getParent().getFolderSyncInfo(); - MutableFolderSyncInfo newInfo = remoteInfo.cloneMutable(); - newInfo.setTag(localInfo.getTag()); - newInfo.setStatic(false); + MutableFolderSyncInfo newInfo = remoteInfo.cloneMutable(); + newInfo.setTag(localInfo.getTag()); + newInfo.setStatic(false); local.setFolderSyncInfo(newInfo); return Status.OK_STATUS; } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java index 0b0a8bf36..754c44908 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java @@ -100,26 +100,26 @@ public class CVSTeamProvider extends RepositoryProvider { * @param project the project */ public static void markAsTempShare(IProject project) { - if (RepositoryProvider.isShared(project)) - return; - try { - project.setSessionProperty(CVSTeamProvider.TEMP_SHARED, Boolean.TRUE); + if (RepositoryProvider.isShared(project)) + return; + try { + project.setSessionProperty(CVSTeamProvider.TEMP_SHARED, Boolean.TRUE); } catch (CoreException e) { CVSProviderPlugin.log(e); } } - /** - * Return the file modification validator used for all CVS repository providers. - * @return the file modification validator used for all CVS repository providers - */ - protected static CVSCoreFileModificationValidator internalGetFileModificationValidator() { - if (CVSTeamProvider.fileModificationValidator == null) { - CVSTeamProvider.fileModificationValidator = new CVSCoreFileModificationValidator(); - } - return CVSTeamProvider.fileModificationValidator; - } - + /** + * Return the file modification validator used for all CVS repository providers. + * @return the file modification validator used for all CVS repository providers + */ + protected static CVSCoreFileModificationValidator internalGetFileModificationValidator() { + if (CVSTeamProvider.fileModificationValidator == null) { + CVSTeamProvider.fileModificationValidator = new CVSCoreFileModificationValidator(); + } + return CVSTeamProvider.fileModificationValidator; + } + /** * No-arg Constructor for IProjectNature conformance */ @@ -184,13 +184,13 @@ public class CVSTeamProvider extends RepositoryProvider { /* * Generate an exception if the resource is not a child of the project */ - private void checkIsChild(IResource resource) throws CVSException { - if (!isChildResource(resource)) - throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, - NLS.bind(CVSMessages.CVSTeamProvider_invalidResource, (new Object[] {resource.getFullPath().toString(), project.getName()})), - null)); - } - + private void checkIsChild(IResource resource) throws CVSException { + if (!isChildResource(resource)) + throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, + NLS.bind(CVSMessages.CVSTeamProvider_invalidResource, (new Object[] {resource.getFullPath().toString(), project.getName()})), + null)); + } + /* * Get the arguments to be passed to a commit or update */ @@ -242,8 +242,8 @@ public class CVSTeamProvider extends RepositoryProvider { FolderSyncInfo info = folder.getFolderSyncInfo(); if (info != null) { monitor1.subTask(NLS.bind(CVSMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() })); - MutableFolderSyncInfo newInfo = info.cloneMutable(); - newInfo.setRoot(root); + MutableFolderSyncInfo newInfo = info.cloneMutable(); + newInfo.setRoot(root); folder.setFolderSyncInfo(newInfo); folder.acceptChildren(this); } @@ -833,9 +833,9 @@ public class CVSTeamProvider extends RepositoryProvider { @Override public IFileHistoryProvider getFileHistoryProvider() { - if (CVSTeamProvider.fileHistoryProvider == null) { - CVSTeamProvider.fileHistoryProvider = new CVSFileHistoryProvider(); - } - return CVSTeamProvider.fileHistoryProvider; + if (CVSTeamProvider.fileHistoryProvider == null) { + CVSTeamProvider.fileHistoryProvider = new CVSFileHistoryProvider(); + } + return CVSTeamProvider.fileHistoryProvider; } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java index c448cf678..7e3573456 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProviderType.java @@ -171,8 +171,8 @@ public class CVSTeamProviderType extends RepositoryProviderType implements IAdap TeamPlugin.log(IStatus.ERROR, "Could not flag meta-files as team-private for " + cvsDir.getFullPath(), e); //$NON-NLS-1$ } } - if (CVSProviderPlugin.getPlugin().isAutoshareOnImport()) - getAutoShareJob().share(project); + if (CVSProviderPlugin.getPlugin().isAutoshareOnImport()) + getAutoShareJob().share(project); } @Override diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java index fb60f80f5..6092771d8 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFolder.java @@ -57,7 +57,7 @@ public interface ICVSFolder extends ICVSResource { * Answers and array of <code>ICVSResource</code> elements that are immediate * children of this remote resource, in no particular order. The server may be contacted. * - * @param monitor a progress monitor to indicate the duration of the operation, or + * @param monitor a progress monitor to indicate the duration of the operation, or * <code>null</code> if progress reporting is not required. * * @return array of immediate children of this remote resource. diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java index be47baf77..b91adb72c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java @@ -20,14 +20,14 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.core.TeamException; /** - * This interface represents a file in a repository. - * Instances of this interface can be used to fetch the contents - * of the remote file. - * - * In the future, additional information should be available (tags, revisions, etc.) - * - * Clients are not expected to implement this interface. - */ + * This interface represents a file in a repository. + * Instances of this interface can be used to fetch the contents + * of the remote file. + * + * In the future, additional information should be available (tags, revisions, etc.) + * + * Clients are not expected to implement this interface. + */ public interface ICVSRemoteFile extends ICVSRemoteResource, ICVSFile { /** diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java index 9de9d9883..ea276b78e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java @@ -17,11 +17,11 @@ package org.eclipse.team.internal.ccvs.core; import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; /** - * This interface represents a remote folder in a repository. It provides - * access to the members (remote files and folders) of a remote folder - * - * Clients are not expected to implement this interface. - */ + * This interface represents a remote folder in a repository. It provides + * access to the members (remote files and folders) of a remote folder + * + * Clients are not expected to implement this interface. + */ public interface ICVSRemoteFolder extends ICVSRemoteResource, ICVSFolder { // This constant is the name of the folder at the root of a repository diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java index f35628eb9..10313ce9a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserAuthenticator.java @@ -129,14 +129,14 @@ public interface IUserAuthenticator { */ public int prompt(ICVSRepositoryLocation location, int promptType, String title, String message, int[] promptResponses, int defaultResponseIndex); - /** - * The host key for the given location has changed. - * @param location - * @return true if new host key should be accepted - */ - public boolean promptForHostKeyChange(ICVSRepositoryLocation location); - - /** + /** + * The host key for the given location has changed. + * @param location + * @return true if new host key should be accepted + */ + public boolean promptForHostKeyChange(ICVSRepositoryLocation location); + + /** * If the project set contains only partial repository information (some of * location are unknown) we will display a dialog to associate each project * set repository with a known repository location or create a new one or at diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/Policy.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/Policy.java index b0371deb7..7aabf568d 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/Policy.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/Policy.java @@ -74,39 +74,39 @@ public class Policy { } public static boolean isDebugProtocol() { - return DEBUG_CVS_PROTOCOL || recorder != null; + return DEBUG_CVS_PROTOCOL || recorder != null; } public static void printProtocolLine(String line) { - printProtocol(line, true); + printProtocol(line, true); } - public static void printProtocol(String string, boolean newLine) { - if (DEBUG_CVS_PROTOCOL) { - System.out.print(string); - if (newLine) { - System.out.println(); - } - } - if (recorder != null) { - recorder.print(string); - if (newLine) { - recorder.println(); - } - } - } - - public static String getMessage(String key) { - try { - Field f = CVSMessages.class.getDeclaredField(key); - Object o = f.get(null); - if (o instanceof String) - return (String)o; - } catch (SecurityException e) { - } catch (NoSuchFieldException e) { - } catch (IllegalArgumentException e) { - } catch (IllegalAccessException e) { - } - return null; - } + public static void printProtocol(String string, boolean newLine) { + if (DEBUG_CVS_PROTOCOL) { + System.out.print(string); + if (newLine) { + System.out.println(); + } + } + if (recorder != null) { + recorder.print(string); + if (newLine) { + recorder.println(); + } + } + } + + public static String getMessage(String key) { + try { + Field f = CVSMessages.class.getDeclaredField(key); + Object o = f.get(null); + if (o instanceof String) + return (String)o; + } catch (SecurityException e) { + } catch (NoSuchFieldException e) { + } catch (IllegalArgumentException e) { + } catch (IllegalAccessException e) { + } + return null; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java index 6de8222b1..ee7934bc5 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java @@ -44,8 +44,8 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { protected boolean sendQuestionable; protected boolean sendModifiedContents; private boolean sendBinary; - - private boolean recurse = true; + + private boolean recurse = true; public AbstractStructureVisitor(Session session, LocalOption[] localOptions, boolean sendQuestionable, boolean sendModifiedContents) { this(session, localOptions, sendQuestionable, sendModifiedContents, true); @@ -56,8 +56,8 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { this.sendQuestionable = sendQuestionable; this.sendModifiedContents = sendModifiedContents; this.sendBinary = sendBinary; - if (Command.DO_NOT_RECURSE.isElementOf(localOptions)) - recurse = false; + if (Command.DO_NOT_RECURSE.isElementOf(localOptions)) + recurse = false; } /** @@ -107,7 +107,7 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { if (isLastSent(mFolder)) return; // Do not send virtual directories - if (isCVSFolder && info.isVirtualDirectory()) { + if (isCVSFolder && info.isVirtualDirectory()) { return; } @@ -171,7 +171,7 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { boolean isManaged = syncBytes != null; if (isManaged) { - sendPendingNotification(mFile); + sendPendingNotification(mFile); } else { // If the file is not managed, send a questionable to the server if the file exists locally // A unmanaged, locally non-existant file results from the explicit use of the file name as a command argument @@ -190,15 +190,15 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { boolean sendContents = mFile.exists() && mFile.isModified(monitor) && !mFile.getSyncInfo().isNeedsMerge(mFile.getTimeStamp()); if (ResourceSyncInfo.isDeletion(syncBytes)) { - sendEntryLineToServer(mFile, syncBytes); + sendEntryLineToServer(mFile, syncBytes); } else if (sendContents) { - // Perform the send of modified contents in a sheduling rule to ensure that - // the contents are not modified while we are sending them - final IResource resource = mFile.getIResource(); - try { - if (resource != null) - Job.getJobManager().beginRule(resource, monitor); - + // Perform the send of modified contents in a sheduling rule to ensure that + // the contents are not modified while we are sending them + final IResource resource = mFile.getIResource(); + try { + if (resource != null) + Job.getJobManager().beginRule(resource, monitor); + sendEntryLineToServer(mFile, syncBytes); if (mFile.exists() && mFile.isModified(null)) { boolean binary = ResourceSyncInfo.isBinary(syncBytes); @@ -210,26 +210,26 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { } else { session.sendUnchanged(mFile); } - } finally { - if (resource != null) - Job.getJobManager().endRule(resource); - } + } finally { + if (resource != null) + Job.getJobManager().endRule(resource); + } } else { - sendEntryLineToServer(mFile, syncBytes); + sendEntryLineToServer(mFile, syncBytes); session.sendUnchanged(mFile); } monitor.worked(1); } - private void sendEntryLineToServer(ICVSFile mFile, byte[] syncBytes) throws CVSException { - if (syncBytes != null) { - String syncBytesToServer = ResourceSyncInfo.getTimestampToServer(syncBytes, mFile.getTimeStamp()); - session.sendEntry(syncBytes, syncBytesToServer); - } - } + private void sendEntryLineToServer(ICVSFile mFile, byte[] syncBytes) throws CVSException { + if (syncBytes != null) { + String syncBytesToServer = ResourceSyncInfo.getTimestampToServer(syncBytes, mFile.getTimeStamp()); + session.sendEntry(syncBytes, syncBytesToServer); + } + } - protected void sendPendingNotification(ICVSFile mFile) throws CVSException { + protected void sendPendingNotification(ICVSFile mFile) throws CVSException { NotifyInfo notify = mFile.getPendingNotification(); if (notify != null) { sendFolder(mFile.getParent()); @@ -284,16 +284,16 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor { } } - /** - * Return a send file message that contains one argument slot - * for the file name. - * @return a send file message that contains one argument slot - * for the file name - */ + /** + * Return a send file message that contains one argument slot + * for the file name. + * @return a send file message that contains one argument slot + * for the file name + */ protected String getSendFileMessage() { return CVSMessages.AbstractStructureVisitor_sendingFile; } - public boolean isRecurse() { - return recurse; - } + public boolean isRecurse() { + return recurse; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java index 91648de5b..d2917d4f0 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java @@ -67,8 +67,8 @@ public class Add extends Command { status = mergeStatus(status, new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.Add_invalidParent, new String[] { mFolder.getRelativePath(session.getLocalRoot()) }))); } else { String repository = info.getRepository() + "/" + mFolder.getName(); //$NON-NLS-1$ - MutableFolderSyncInfo newInfo = info.cloneMutable(); - newInfo.setRepository(repository); + MutableFolderSyncInfo newInfo = info.cloneMutable(); + newInfo.setRepository(repository); mFolder.setFolderSyncInfo(newInfo); } } @@ -77,22 +77,22 @@ public class Add extends Command { } @Override - protected ICommandOutputListener getDefaultCommandOutputListener() { - return new CommandOutputListener() { - public IStatus errorLine(String line, - ICVSRepositoryLocation location, ICVSFolder commandRoot, - IProgressMonitor monitor) { - - String serverMessage = getServerMessage(line, location); - if (serverMessage != null) { - if (serverMessage.indexOf("cvs commit") != -1 && serverMessage.indexOf("add") != -1 && serverMessage.indexOf("permanently") != -1) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - return OK; - if (serverMessage.startsWith("scheduling file") && serverMessage.indexOf("for addition") != -1) //$NON-NLS-1$ //$NON-NLS-2$ - return OK; - } - return super.errorLine(line, location, commandRoot, monitor); - } - }; - } + protected ICommandOutputListener getDefaultCommandOutputListener() { + return new CommandOutputListener() { + public IStatus errorLine(String line, + ICVSRepositoryLocation location, ICVSFolder commandRoot, + IProgressMonitor monitor) { + + String serverMessage = getServerMessage(line, location); + if (serverMessage != null) { + if (serverMessage.indexOf("cvs commit") != -1 && serverMessage.indexOf("add") != -1 && serverMessage.indexOf("permanently") != -1) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return OK; + if (serverMessage.startsWith("scheduling file") && serverMessage.indexOf("for addition") != -1) //$NON-NLS-1$ //$NON-NLS-2$ + return OK; + } + return super.errorLine(line, location, commandRoot, monitor); + } + }; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java index 043837727..d163ef33f 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Annotate.java @@ -20,7 +20,7 @@ package org.eclipse.team.internal.ccvs.core.client; */ public class Annotate extends AbstractMessageCommand { - public static final Object FORCE_BINARY_ANNOTATE = new LocalOption("-F"); //$NON-NLS-1$ + public static final Object FORCE_BINARY_ANNOTATE = new LocalOption("-F"); //$NON-NLS-1$ protected Annotate() { } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java index eecda7900..4b0193f9c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java @@ -179,8 +179,8 @@ public class Checkout extends Command { return RemoteModule.createRemoteModules(moduleDefinitionListener.getModuleExpansions(), session.getCVSRepositoryLocation(), tag); } - - protected String getDisplayText() { - return "checkout"; //$NON-NLS-1$ - } + + protected String getDisplayText() { + return "checkout"; //$NON-NLS-1$ + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java index e9a6ebee8..aa8018827 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java @@ -79,7 +79,7 @@ public abstract class Command extends Request { // Empty local option array public static final LocalOption[] NO_LOCAL_OPTIONS = new LocalOption[0]; // valid for: annotate checkout commit diff export log rdiff remove rtag status tag update - public static final LocalOption RECURSE = new LocalOption("-R"); //$NON-NLS-1$ + public static final LocalOption RECURSE = new LocalOption("-R"); //$NON-NLS-1$ public static final LocalOption DO_NOT_RECURSE = new LocalOption("-l"); //$NON-NLS-1$ // valid for: checkout export update public static final LocalOption PRUNE_EMPTY_DIRECTORIES = new LocalOption("-P"); //$NON-NLS-1$ @@ -324,7 +324,7 @@ public abstract class Command extends Request { // run the command try { - session.setCurrentCommand(Command.this); + session.setCurrentCommand(Command.this); status[0] = doExecute(session, gOptions, lOptions, arguments, listener, monitor); notifyConsoleOnCompletion(session, status[0], null); } catch (CVSException e1) { @@ -560,28 +560,28 @@ public abstract class Command extends Request { session.sendArgument(option); if (argument != null) session.sendArgument(argument); } - public LocalOption[] addTo(LocalOption[] options) { - if (this.isElementOf(options)) { - return options; - } - LocalOption[] newOptions = new LocalOption[options.length + 1]; - System.arraycopy(options, 0, newOptions, 0, options.length); - newOptions[options.length] = this; - return newOptions; - } - public LocalOption[] removeFrom(LocalOption[] options) { - if (!this.isElementOf(options)) { - return options; - } - List result = new ArrayList(); - for (int i = 0; i < options.length; i++) { - Command.LocalOption option = options[i]; - if (!option.equals(this)) { - result.add(option); - } - } - return (LocalOption[]) result.toArray(new LocalOption[result.size()]); - } + public LocalOption[] addTo(LocalOption[] options) { + if (this.isElementOf(options)) { + return options; + } + LocalOption[] newOptions = new LocalOption[options.length + 1]; + System.arraycopy(options, 0, newOptions, 0, options.length); + newOptions[options.length] = this; + return newOptions; + } + public LocalOption[] removeFrom(LocalOption[] options) { + if (!this.isElementOf(options)) { + return options; + } + List result = new ArrayList(); + for (int i = 0; i < options.length; i++) { + Command.LocalOption option = options[i]; + if (!option.equals(this)) { + result.add(option); + } + } + return (LocalOption[]) result.toArray(new LocalOption[result.size()]); + } } /** * Options subtype for keyword substitution options. @@ -654,40 +654,40 @@ public abstract class Command extends Request { */ public String getShortDisplayText() { if (isUnknownMode) - return NLS.bind(CVSMessages.KSubstOption_unknown_short, new String[] { option }); - if (option.equals("-kb")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kb_short; - if (option.equals("-kkv")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kkv_short; - if (option.equals("-ko")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__ko_short; - if (option.equals("-kk")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kk_short; - if (option.equals("-kv")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kv_short; - if (option.equals("-kkvl")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kkvl_short; - return NLS.bind(CVSMessages.KSubstOption_unknown_short, new String[] { option }); + return NLS.bind(CVSMessages.KSubstOption_unknown_short, new String[] { option }); + if (option.equals("-kb")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kb_short; + if (option.equals("-kkv")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kkv_short; + if (option.equals("-ko")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__ko_short; + if (option.equals("-kk")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kk_short; + if (option.equals("-kv")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kv_short; + if (option.equals("-kkvl")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kkvl_short; + return NLS.bind(CVSMessages.KSubstOption_unknown_short, new String[] { option }); } /** * Returns a long localized text string describing this mode. */ public String getLongDisplayText() { if (isUnknownMode) - return NLS.bind(CVSMessages.KSubstOption_unknown_long, new String[] { option }); - if (option.equals("-kb")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kb_long; - if (option.equals("-kkv")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kkv_long; - if (option.equals("-ko")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__ko_long; - if (option.equals("-kk")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kk_long; - if (option.equals("-kv")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kv_long; - if (option.equals("-kkvl")) //$NON-NLS-1$ - return CVSMessages.KSubstOption__kkvl_long; - return NLS.bind(CVSMessages.KSubstOption_unknown_long, new String[] { option }); + return NLS.bind(CVSMessages.KSubstOption_unknown_long, new String[] { option }); + if (option.equals("-kb")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kb_long; + if (option.equals("-kkv")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kkv_long; + if (option.equals("-ko")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__ko_long; + if (option.equals("-kk")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kk_long; + if (option.equals("-kv")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kv_long; + if (option.equals("-kkvl")) //$NON-NLS-1$ + return CVSMessages.KSubstOption__kkvl_long; + return NLS.bind(CVSMessages.KSubstOption_unknown_long, new String[] { option }); } /** * Return the text mode that will be used by default diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CommandOutputListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CommandOutputListener.java index 567c7c07f..9a4e30d83 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CommandOutputListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CommandOutputListener.java @@ -20,14 +20,14 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListen import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; public class CommandOutputListener implements ICommandOutputListener { - - /* - * Failure string that is returned from the server when pserver is used and the root directory - * is not readable. The problem can be fixed by making the directory readable or by using -f in - * the pserver configuration file. We will ignore the error since it does not affect the command. - */ - public static final String ROOT_CVSIGNORE_READ_FAILURE = "cvs server: cannot open /root/.cvsignore: Permission denied"; //$NON-NLS-1$ - + + /* + * Failure string that is returned from the server when pserver is used and the root directory + * is not readable. The problem can be fixed by making the directory readable or by using -f in + * the pserver configuration file. We will ignore the error since it does not affect the command. + */ + public static final String ROOT_CVSIGNORE_READ_FAILURE = "cvs server: cannot open /root/.cvsignore: Permission denied"; //$NON-NLS-1$ + public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { return OK; } @@ -37,8 +37,8 @@ public class CommandOutputListener implements ICommandOutputListener { return new CVSStatus(IStatus.ERROR, CVSStatus.PROTOCOL_ERROR, protocolError, commandRoot); } if (line.equals(ROOT_CVSIGNORE_READ_FAILURE) || getServerMessage(ROOT_CVSIGNORE_READ_FAILURE, location).equals(getServerMessage(line, location))) { - // Don't report this as an error since it does not affect the command - return new CVSStatus(IStatus.WARNING, CVSStatus.ERROR_LINE, line, commandRoot); + // Don't report this as an error since it does not affect the command + return new CVSStatus(IStatus.WARNING, CVSStatus.ERROR_LINE, line, commandRoot); } return new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE, line, commandRoot); } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java index 90efdc551..2980cd5f9 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java @@ -132,8 +132,8 @@ public class Commit extends Command { session.setTextTransferOverride(null); } } - - protected String getDisplayText() { - return "commit"; //$NON-NLS-1$ - } + + protected String getDisplayText() { + return "commit"; //$NON-NLS-1$ + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java index 7f552dfe4..7ab88ad15 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ConsoleListeners.java @@ -27,100 +27,100 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener; */ public class ConsoleListeners implements IConsoleListener { - private static ConsoleListeners instance = new ConsoleListeners(); - private Set listeners = new HashSet(); - - /** - * Return the console listeners - * @return the console listeners - */ - public static ConsoleListeners getInstance() { - return instance; - } - - public void addListener(IConsoleListener listener) { - synchronized(listeners) { - listeners.add(listener); - } - } - - public void removeListener(IConsoleListener listener) { - synchronized(listeners) { - listeners.remove(listener); - } - } + private static ConsoleListeners instance = new ConsoleListeners(); + private Set listeners = new HashSet(); + + /** + * Return the console listeners + * @return the console listeners + */ + public static ConsoleListeners getInstance() { + return instance; + } + + public void addListener(IConsoleListener listener) { + synchronized(listeners) { + listeners.add(listener); + } + } + + public void removeListener(IConsoleListener listener) { + synchronized(listeners) { + listeners.remove(listener); + } + } - private IConsoleListener[] getListeners() { - synchronized(listeners) { - return (IConsoleListener[]) listeners.toArray(new IConsoleListener[listeners.size()]); - } - } - - @Override - public void commandInvoked(final Session session, final String line) { - if (listeners.isEmpty()) return; - IConsoleListener[] listeners = getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IConsoleListener listener = listeners[i]; - Platform.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Exception logged by Platform - } - public void run() throws Exception { - listener.commandInvoked(session, line); - } - }); - } - } + private IConsoleListener[] getListeners() { + synchronized(listeners) { + return (IConsoleListener[]) listeners.toArray(new IConsoleListener[listeners.size()]); + } + } + + @Override + public void commandInvoked(final Session session, final String line) { + if (listeners.isEmpty()) return; + IConsoleListener[] listeners = getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IConsoleListener listener = listeners[i]; + Platform.run(new ISafeRunnable() { + public void handleException(Throwable exception) { + // Exception logged by Platform + } + public void run() throws Exception { + listener.commandInvoked(session, line); + } + }); + } + } - @Override - public void messageLineReceived(final Session session, final String line, final IStatus status) { - if (listeners.isEmpty()) return; - IConsoleListener[] listeners = getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IConsoleListener listener = listeners[i]; - Platform.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Exception logged by Platform - } - public void run() throws Exception { - listener.messageLineReceived(session, line, status); - } - }); - } - } + @Override + public void messageLineReceived(final Session session, final String line, final IStatus status) { + if (listeners.isEmpty()) return; + IConsoleListener[] listeners = getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IConsoleListener listener = listeners[i]; + Platform.run(new ISafeRunnable() { + public void handleException(Throwable exception) { + // Exception logged by Platform + } + public void run() throws Exception { + listener.messageLineReceived(session, line, status); + } + }); + } + } - @Override - public void errorLineReceived(final Session session, final String line, final IStatus status) { - if (listeners.isEmpty()) return; - IConsoleListener[] listeners = getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IConsoleListener listener = listeners[i]; - Platform.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Exception logged by Platform - } - public void run() throws Exception { - listener.errorLineReceived(session, line, status); - } - }); - } - } + @Override + public void errorLineReceived(final Session session, final String line, final IStatus status) { + if (listeners.isEmpty()) return; + IConsoleListener[] listeners = getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IConsoleListener listener = listeners[i]; + Platform.run(new ISafeRunnable() { + public void handleException(Throwable exception) { + // Exception logged by Platform + } + public void run() throws Exception { + listener.errorLineReceived(session, line, status); + } + }); + } + } - @Override - public void commandCompleted(final Session session, final IStatus status, final Exception exception) { - if (listeners.isEmpty()) return; - IConsoleListener[] listeners = getListeners(); - for (int i = 0; i < listeners.length; i++) { - final IConsoleListener listener = listeners[i]; - Platform.run(new ISafeRunnable() { - public void handleException(Throwable exception) { - // Exception logged by Platform - } - public void run() throws Exception { - listener.commandCompleted(session, status, exception); - } - }); - } - } + @Override + public void commandCompleted(final Session session, final IStatus status, final Exception exception) { + if (listeners.isEmpty()) return; + IConsoleListener[] listeners = getListeners(); + for (int i = 0; i < listeners.length; i++) { + final IConsoleListener listener = listeners[i]; + Platform.run(new ISafeRunnable() { + public void handleException(Throwable exception) { + // Exception logged by Platform + } + public void run() throws Exception { + listener.commandCompleted(session, status, exception); + } + }); + } + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java index 9955fb0e6..33babbc23 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java @@ -42,21 +42,21 @@ public class Diff extends Command { * so when there is a difference between the checked files. */ protected IStatus doExecute(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions, - String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor) throws CVSException { + String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor) throws CVSException { try { IStatus status = super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor); - if (status.getCode() == CVSStatus.SERVER_ERROR) { - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - IStatus child = children[i]; - if (child.getMessage().indexOf("[diff aborted]") != -1) { //$NON-NLS-1$ - throw new CVSServerException(status); - } - } - } - } - return status; + if (status.getCode() == CVSStatus.SERVER_ERROR) { + if (status.isMultiStatus()) { + IStatus[] children = status.getChildren(); + for (int i = 0; i < children.length; i++) { + IStatus child = children[i]; + if (child.getMessage().indexOf("[diff aborted]") != -1) { //$NON-NLS-1$ + throw new CVSServerException(status); + } + } + } + } + return status; } catch (CVSServerException e) { if (e.containsErrors()) throw e; return e.getStatus(); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java index 4091eed84..f4bf92070 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java @@ -73,9 +73,9 @@ class FileStructureVisitor extends AbstractStructureVisitor { ICVSResource[] children = mFolder.members(ICVSFolder.ALL_UNIGNORED_MEMBERS); sendFiles(children); sendQuestionableFolders(children); - if (isRecurse()) { - sendManagedFolders(children); - } + if (isRecurse()) { + sendManagedFolders(children); + } } /** diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Import.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Import.java index 70f526ace..1310f7767 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Import.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Import.java @@ -39,13 +39,13 @@ public class Import extends Command { IProgressMonitor monitor) throws CVSException { // If the branch option is not provided, a default value of 1.1.1 is used. - // This is done to maintain reference client compatibility - if (findOption(localOptions, "-b") == null) { //$NON-NLS-1$ - LocalOption[] newLocalOptions = new LocalOption[localOptions.length + 1]; + // This is done to maintain reference client compatibility + if (findOption(localOptions, "-b") == null) { //$NON-NLS-1$ + LocalOption[] newLocalOptions = new LocalOption[localOptions.length + 1]; newLocalOptions[0] = new LocalOption("-b", "1.1.1"); //$NON-NLS-1$ //$NON-NLS-2$ System.arraycopy(localOptions, 0, newLocalOptions, 1, localOptions.length); localOptions = newLocalOptions; - } + } return super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor); } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RLog.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RLog.java index 2338d2eb1..b0857c4a0 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RLog.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RLog.java @@ -34,7 +34,7 @@ public class RLog extends RemoteCommand { * ==== ==== ================================= * date date date<date (all revisions between date and later) * tag tag tag:tag (all revisions between tag and tag, must be on same branch) - * branch date >date (all revisions of date or later) + * branch date >date (all revisions of date or later) * branch tag tag: (all revisions from tag to the end of branchs tip) * * Valid for: rlog diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java index eff261de8..58d8f5a46 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemoteCommand.java @@ -54,21 +54,21 @@ public abstract class RemoteCommand extends Command { // Convert arguments List stringArguments = new ArrayList(arguments.length); for (int i = 0; i < arguments.length; i++) { - ICVSResource resource = arguments[i]; - String remotePath; - if (isDefinedModule(resource)) { - remotePath = resource.getName(); - } else { - remotePath = resource.getRepositoryRelativePath(); - - } - stringArguments.add(remotePath); + ICVSResource resource = arguments[i]; + String remotePath; + if (isDefinedModule(resource)) { + remotePath = resource.getName(); + } else { + remotePath = resource.getRepositoryRelativePath(); + + } + stringArguments.add(remotePath); } return (String[]) stringArguments.toArray(new String[stringArguments.size()]); } - private boolean isDefinedModule(ICVSResource resource) { - return resource instanceof ICVSRemoteFolder && ((ICVSRemoteFolder)resource).isDefinedModule(); - } + private boolean isDefinedModule(ICVSResource resource) { + return resource instanceof ICVSRemoteFolder && ((ICVSRemoteFolder)resource).isDefinedModule(); + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java index d452bf304..f08075f7d 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RemovedHandler.java @@ -59,25 +59,25 @@ class RemovedHandler extends ResponseHandler { // delete then unmanage the file try { - if (mFile.isReadOnly()) mFile.setReadOnly(false); - mFile.delete(); - mFile.unmanage(null); - } catch (CVSException e) { - IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.RESPONSE_HANDLING_FAILURE, NLS.bind(CVSMessages.RemovedHandler_0, new String[] { getPath(mFile) }), e, session.getLocalRoot()); - session.handleResponseError(status); - } + if (mFile.isReadOnly()) mFile.setReadOnly(false); + mFile.delete(); + mFile.unmanage(null); + } catch (CVSException e) { + IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.RESPONSE_HANDLING_FAILURE, NLS.bind(CVSMessages.RemovedHandler_0, new String[] { getPath(mFile) }), e, session.getLocalRoot()); + session.handleResponseError(status); + } } - private String getPath(ICVSFile file) { - IResource resource = file.getIResource(); - if (resource != null) { - return resource.getFullPath().toString(); - } - try { - return file.getRepositoryRelativePath(); - } catch (CVSException e1) { - return file.getName(); - } - } + private String getPath(ICVSFile file) { + IResource resource = file.getIResource(); + if (resource != null) { + return resource.getFullPath().toString(); + } + try { + return file.getRepositoryRelativePath(); + } catch (CVSException e1) { + return file.getName(); + } + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java index fe1a6bec5..341ed488d 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Request.java @@ -114,7 +114,7 @@ public abstract class Request { // move some rather than remaining still and then jumping to 100). final int TOTAL_WORK = 300; monitor.beginTask(CVSMessages.Command_receivingResponses, TOTAL_WORK); - monitor.subTask(CVSMessages.Command_receivingResponses); + monitor.subTask(CVSMessages.Command_receivingResponses); int halfWay = TOTAL_WORK / 2; int currentIncrement = 4; int nextProgress = currentIncrement; @@ -168,18 +168,18 @@ public abstract class Request { } if (!session.hasErrors()) { - session.addError(new CVSStatus(IStatus.ERROR, CVSStatus.SERVER_ERROR, CVSMessages.Command_noMoreInfoAvailable,session.getLocalRoot())); + session.addError(new CVSStatus(IStatus.ERROR, CVSStatus.SERVER_ERROR, CVSMessages.Command_noMoreInfoAvailable,session.getLocalRoot())); } IStatus status = new MultiStatus(CVSProviderPlugin.ID, CVSStatus.SERVER_ERROR, - session.getErrors(), + session.getErrors(), argument, null); if (serious) { throw new CVSServerException(status); } else { // look for particularly bad errors in the accumulated statuses - IStatus[] errors = session.getErrors(); - for (int i = 0; i < errors.length; i++) { - IStatus s = errors[i]; + IStatus[] errors = session.getErrors(); + for (int i = 0; i < errors.length; i++) { + IStatus s = errors[i]; if (s.getCode() == CVSStatus.PROTOCOL_ERROR) { throw new CVSServerException(status); } @@ -242,7 +242,7 @@ public abstract class Request { protected String getServerErrorMessage() { return NLS.bind(CVSMessages.Command_serverError, new String[] { getDisplayText() }); } - protected String getDisplayText() { - return getRequestId(); - } + protected String getDisplayText() { + return getRequestId(); + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java index 5cdef4c50..6a1827aba 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ResponseHandler.java @@ -83,39 +83,39 @@ public abstract class ResponseHandler { } if (! folder.isCVSFolder()) { String repositoryRoot = session.getRepositoryRoot(); - String relativePath; - if (repositoryDir.startsWith(repositoryRoot)) { - // The repositoryDir is an absolute path - relativePath = Util.getRelativePath(repositoryRoot, repositoryDir); - } else { - // The repositoryDir is already a relative path - relativePath = repositoryDir; - } - IResource resource = folder.getIResource(); - if (resource != null) { - IProject project = resource.getProject(); + String relativePath; + if (repositoryDir.startsWith(repositoryRoot)) { + // The repositoryDir is an absolute path + relativePath = Util.getRelativePath(repositoryRoot, repositoryDir); + } else { + // The repositoryDir is already a relative path + relativePath = repositoryDir; + } + IResource resource = folder.getIResource(); + if (resource != null) { + IProject project = resource.getProject(); if (project != null && project.isAccessible() && !CVSTeamProvider.isSharedWithCVS(project)) { - // The project isn't shared but we are about to perform an operation on it. - // we need to flag the project as shared so that the sync info management works - CVSTeamProvider.markAsTempShare(project); - } - } - try{ - folder.setFolderSyncInfo(new FolderSyncInfo( + // The project isn't shared but we are about to perform an operation on it. + // we need to flag the project as shared so that the sync info management works + CVSTeamProvider.markAsTempShare(project); + } + } + try{ + folder.setFolderSyncInfo(new FolderSyncInfo( relativePath, session.getCVSRepositoryLocation().getLocation(false), null, false)); - } catch (CVSException ex){ - IStatus status = ex.getStatus(); - if (status != null){ - if (status.getCode() == IResourceStatus.INVALID_VALUE){ - //if it's an invalid value, just ignore the exception (see Bug# 152053), - //else throw it again - } else { - throw ex; - } - } - } + } catch (CVSException ex){ + IStatus status = ex.getStatus(); + if (status != null){ + if (status.getCode() == IResourceStatus.INVALID_VALUE){ + //if it's an invalid value, just ignore the exception (see Bug# 152053), + //else throw it again + } else { + throw ex; + } + } + } } return folder; } @@ -127,13 +127,13 @@ public abstract class ResponseHandler { IContainer container = (IContainer)mParent.getIResource(); if (container != null) { try { - // Create all the parents as need - recreatePhantomFolders(mParent); - } catch (CVSException e) { - if (!handleInvalidResourceName(session, mParent, e)) { - throw e; - } - } + // Create all the parents as need + recreatePhantomFolders(mParent); + } catch (CVSException e) { + if (!handleInvalidResourceName(session, mParent, e)) { + throw e; + } + } } } return mParent; @@ -159,32 +159,32 @@ public abstract class ResponseHandler { return this; } - protected boolean handleInvalidResourceName(Session session, ICVSResource resource, CVSException e) { - int code = e.getStatus().getCode(); - if (code == IResourceStatus.INVALID_VALUE - || code == IResourceStatus.INVALID_RESOURCE_NAME - || code == IResourceStatus.RESOURCE_NOT_FOUND - || code == IResourceStatus.RESOURCE_EXISTS - || code == IResourceStatus.RESOURCE_WRONG_TYPE - || code == IResourceStatus.CASE_VARIANT_EXISTS - || code == IResourceStatus.PATH_OCCUPIED) { - - try { - IResource local = resource.getIResource(); - String path; - if (local == null) { - path = resource.getRepositoryRelativePath(); - } else { - path = local.getFullPath().toString(); - } - IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.INVALID_LOCAL_RESOURCE_PATH, NLS.bind(CVSMessages.ResponseHandler_0, new String[] { path, e.getMessage() }), e, session.getLocalRoot()); - session.handleResponseError(status); - } catch (CVSException e1) { - CVSProviderPlugin.log(e1); - } - return true; - } - return false; - } + protected boolean handleInvalidResourceName(Session session, ICVSResource resource, CVSException e) { + int code = e.getStatus().getCode(); + if (code == IResourceStatus.INVALID_VALUE + || code == IResourceStatus.INVALID_RESOURCE_NAME + || code == IResourceStatus.RESOURCE_NOT_FOUND + || code == IResourceStatus.RESOURCE_EXISTS + || code == IResourceStatus.RESOURCE_WRONG_TYPE + || code == IResourceStatus.CASE_VARIANT_EXISTS + || code == IResourceStatus.PATH_OCCUPIED) { + + try { + IResource local = resource.getIResource(); + String path; + if (local == null) { + path = resource.getRepositoryRelativePath(); + } else { + path = local.getFullPath().toString(); + } + IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.INVALID_LOCAL_RESOURCE_PATH, NLS.bind(CVSMessages.ResponseHandler_0, new String[] { path, e.getMessage() }), e, session.getLocalRoot()); + session.handleResponseError(status); + } catch (CVSException e1) { + CVSProviderPlugin.log(e1); + } + return true; + } + return false; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java index 4775d2979..f63b5fbe3 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java @@ -94,9 +94,9 @@ public class Session { private Map responseHandlers; // List of errors accumulated while the command is executing - private List errors = new ArrayList(); - - private Command currentCommand; + private List errors = new ArrayList(); + + private Command currentCommand; /** * Creates a new CVS session, initially in the CLOSED state. @@ -760,14 +760,14 @@ public class Session { } size = Long.parseLong(sizeLine, 10); } catch (NumberFormatException e) { - // In some cases, the server will give us an error line here - if (sizeLine != null && sizeLine.startsWith("E")) { //$NON-NLS-1$ - handleErrorLine(sizeLine.substring(1).trim(), org.eclipse.core.runtime.Status.OK_STATUS); - return; - } else { - IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR,CVSMessages.Session_badInt, e, localRoot); - throw new CVSException(status); - } + // In some cases, the server will give us an error line here + if (sizeLine != null && sizeLine.startsWith("E")) { //$NON-NLS-1$ + handleErrorLine(sizeLine.substring(1).trim(), org.eclipse.core.runtime.Status.OK_STATUS); + return; + } else { + IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR,CVSMessages.Session_badInt, e, localRoot); + throw new CVSException(status); + } } // create an input stream that spans the next 'size' bytes from the connection InputStream in = new SizeConstrainedInputStream(connection.getInputStream(), size, true /*discardOnClose*/); @@ -808,7 +808,7 @@ public class Session { file.setContents(in, responseType, true, new NullProgressMonitor()); } - /** + /** * Stores the value of the last Mod-time response encountered. * Valid only for the duration of a single CVS command. */ @@ -993,53 +993,53 @@ public class Session { return (ResponseHandler)getReponseHandlers().get(responseID); } - /** - * Accumulate the added errors so they can be included in the status returned - * when the command execution is finished. OK status are ignored. - * @param status the status to be accumulated - */ - public void addError(IStatus status) { - if (!status.isOK()) - errors.add(status); - } - - public boolean hasErrors() { - return !errors.isEmpty(); - } - - public IStatus[] getErrors() { - return (IStatus[]) errors.toArray(new IStatus[errors.size()]); - } + /** + * Accumulate the added errors so they can be included in the status returned + * when the command execution is finished. OK status are ignored. + * @param status the status to be accumulated + */ + public void addError(IStatus status) { + if (!status.isOK()) + errors.add(status); + } + + public boolean hasErrors() { + return !errors.isEmpty(); + } + + public IStatus[] getErrors() { + return (IStatus[]) errors.toArray(new IStatus[errors.size()]); + } - public void clearErrors() { - errors.clear(); - } + public void clearErrors() { + errors.clear(); + } - public void setCurrentCommand(Command c) { - currentCommand = c; - } - - public Command getCurrentCommand() { - return currentCommand; - } + public void setCurrentCommand(Command c) { + currentCommand = c; + } + + public Command getCurrentCommand() { + return currentCommand; + } /** * Report the given error line to any listeners - * @param line the error line - * @param status the status that indicates any problems encountered parsing the line - */ - public void handleErrorLine(String line, IStatus status) { - ConsoleListeners.getInstance().errorLineReceived(this, line, status); - } - - /** - * An error has occurred while processing responses from the - * server. Place this error is the status that will be returned - * from the command and show the error in the console - * @param status the status that descibes the error - */ - public void handleResponseError(IStatus status) { - addError(status); - handleErrorLine(NLS.bind(CVSMessages.Session_0, new String[] { status.getMessage() }), status); - } + * @param line the error line + * @param status the status that indicates any problems encountered parsing the line + */ + public void handleErrorLine(String line, IStatus status) { + ConsoleListeners.getInstance().errorLineReceived(this, line, status); + } + + /** + * An error has occurred while processing responses from the + * server. Place this error is the status that will be returned + * from the command and show the error in the console + * @param status the status that descibes the error + */ + public void handleResponseError(IStatus status) { + addError(status); + handleErrorLine(NLS.bind(CVSMessages.Session_0, new String[] { status.getMessage() }), status); + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StaticHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StaticHandler.java index c8335c6b0..59c21d149 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StaticHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StaticHandler.java @@ -61,20 +61,20 @@ class StaticHandler extends ResponseHandler { Assert.isTrue(repositoryDir.endsWith("/")); //$NON-NLS-1$ repositoryDir = repositoryDir.substring(0, repositoryDir.length() - 1); try { - ICVSFolder folder = createFolder(session, localDir, repositoryDir); - FolderSyncInfo syncInfo = folder.getFolderSyncInfo(); - // Added to ignore sync info for workspace root - if (syncInfo == null) return; - MutableFolderSyncInfo newInfo = syncInfo.cloneMutable(); - newInfo.setStatic(setStaticDirectory); - // only set the sync info if it has changed - if (!syncInfo.equals(newInfo)) - folder.setFolderSyncInfo(newInfo); - } catch (CVSException e) { - if (!handleInvalidResourceName(session, session.getLocalRoot().getFolder(localDir), e)) { - throw e; - } - } + ICVSFolder folder = createFolder(session, localDir, repositoryDir); + FolderSyncInfo syncInfo = folder.getFolderSyncInfo(); + // Added to ignore sync info for workspace root + if (syncInfo == null) return; + MutableFolderSyncInfo newInfo = syncInfo.cloneMutable(); + newInfo.setStatic(setStaticDirectory); + // only set the sync info if it has changed + if (!syncInfo.equals(newInfo)) + folder.setFolderSyncInfo(newInfo); + } catch (CVSException e) { + if (!handleInvalidResourceName(session, session.getLocalRoot().getFolder(localDir), e)) { + throw e; + } + } } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StickyHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StickyHandler.java index b94325e76..48fe582ff 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StickyHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/StickyHandler.java @@ -66,24 +66,24 @@ class StickyHandler extends ResponseHandler { Assert.isTrue(repositoryDir.endsWith("/")); //$NON-NLS-1$ repositoryDir = repositoryDir.substring(0, repositoryDir.length() - 1); try { - ICVSFolder folder = createFolder(session, localDir, repositoryDir); - FolderSyncInfo syncInfo = folder.getFolderSyncInfo(); - // Added to ignore sync info for workspace root - if (syncInfo == null) return; - MutableFolderSyncInfo newInfo = syncInfo.cloneMutable(); - newInfo.setTag(tag != null ? new CVSEntryLineTag(tag) : null); - /* if we are reverting to BASE we do not change anything here - * see bug 106876 */ - if(tag != null && tag.equals("TBASE")) //$NON-NLS-1$ - newInfo.setTag(syncInfo.getTag()); - // only set the sync info if it has changed - if (!syncInfo.equals(newInfo)) - folder.setFolderSyncInfo(newInfo); - } catch (CVSException e) { - if (!handleInvalidResourceName(session, session.getLocalRoot().getFolder(localDir), e)) { - throw e; - } - } + ICVSFolder folder = createFolder(session, localDir, repositoryDir); + FolderSyncInfo syncInfo = folder.getFolderSyncInfo(); + // Added to ignore sync info for workspace root + if (syncInfo == null) return; + MutableFolderSyncInfo newInfo = syncInfo.cloneMutable(); + newInfo.setTag(tag != null ? new CVSEntryLineTag(tag) : null); + /* if we are reverting to BASE we do not change anything here + * see bug 106876 */ + if(tag != null && tag.equals("TBASE")) //$NON-NLS-1$ + newInfo.setTag(syncInfo.getTag()); + // only set the sync info if it has changed + if (!syncInfo.equals(newInfo)) + folder.setFolderSyncInfo(newInfo); + } catch (CVSException e) { + if (!handleInvalidResourceName(session, session.getLocalRoot().getFolder(localDir), e)) { + throw e; + } + } } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java index 7bc529dc1..385559125 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java @@ -22,26 +22,26 @@ public class SyncUpdate extends Update { public SyncUpdate() { }; @Override - protected void sendFileStructure(Session session, ICVSResource[] resources, - LocalOption[] localOptions, boolean emptyFolders, IProgressMonitor monitor) throws CVSException { + protected void sendFileStructure(Session session, ICVSResource[] resources, + LocalOption[] localOptions, boolean emptyFolders, IProgressMonitor monitor) throws CVSException { checkResourcesManaged(session, resources); new FileStructureVisitor(session, localOptions, emptyFolders, true, false).visit(session, resources, monitor); } - @Override - protected boolean isWorkspaceModification() { - // The sync-update will not modify the workspace - return false; - } - - @Override - protected GlobalOption[] filterGlobalOptions(Session session, GlobalOption[] globalOptions) { - // Ensure that the DO_NOT_CHANGE (-n) global option is present + @Override + protected boolean isWorkspaceModification() { + // The sync-update will not modify the workspace + return false; + } + + @Override + protected GlobalOption[] filterGlobalOptions(Session session, GlobalOption[] globalOptions) { + // Ensure that the DO_NOT_CHANGE (-n) global option is present if (! Command.DO_NOT_CHANGE.isElementOf(globalOptions)) { globalOptions = Command.DO_NOT_CHANGE.addToEnd(globalOptions); } - return super.filterGlobalOptions(session, globalOptions); - } + return super.filterGlobalOptions(session, globalOptions); + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java index 9c99a9a0f..dd7783fac 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/TemplateHandler.java @@ -40,18 +40,18 @@ public class TemplateHandler extends ResponseHandler { @Override public void handle(Session session, String localDir, IProgressMonitor monitor) throws CVSException { session.readLine(); /* read the remote dir which is not needed */ - // Only read the template file if the container exists. - // This is OK as we only use the template from the project folder which must exist - ICVSFolder localFolder = session.getLocalRoot().getFolder(localDir); + // Only read the template file if the container exists. + // This is OK as we only use the template from the project folder which must exist + ICVSFolder localFolder = session.getLocalRoot().getFolder(localDir); IContainer container = (IContainer)localFolder.getIResource(); ICVSStorage templateFile = null; if (container != null && container.exists()) { - try { - templateFile = CVSWorkspaceRoot.getCVSFileFor(SyncFileWriter.getTemplateFile(container)); - } catch (CVSException e) { - // Log the inability to create the template file - CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, "Could not write template file in " + container.getFullPath() + ": " + e.getMessage(), e, session.getLocalRoot())); //$NON-NLS-1$ //$NON-NLS-2$ - } + try { + templateFile = CVSWorkspaceRoot.getCVSFileFor(SyncFileWriter.getTemplateFile(container)); + } catch (CVSException e) { + // Log the inability to create the template file + CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, "Could not write template file in " + container.getFullPath() + ": " + e.getMessage(), e, session.getLocalRoot())); //$NON-NLS-1$ //$NON-NLS-2$ + } } if (container == null || templateFile == null) { // Create a dummy storage handle to recieve the contents from the server @@ -98,12 +98,12 @@ public class TemplateHandler extends ResponseHandler { }; } try { - session.receiveFile(templateFile, false, UpdatedHandler.HANDLE_UPDATED, monitor); - } catch (CVSException e) { - if (!(templateFile instanceof ICVSFile && handleInvalidResourceName(session, (ICVSFile)templateFile, e))) { - throw e; - } - } + session.receiveFile(templateFile, false, UpdatedHandler.HANDLE_UPDATED, monitor); + } catch (CVSException e) { + if (!(templateFile instanceof ICVSFile && handleInvalidResourceName(session, (ICVSFile)templateFile, e))) { + throw e; + } + } } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java index a03b0604e..cb0e5daa5 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java @@ -171,9 +171,9 @@ public class Update extends Command { folder = resources[i].getParent(); } if (folder==null || (!folder.isCVSFolder() && folder.exists())) { - if (folder == null) - folder = (ICVSFolder)resources[i]; - IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR,NLS.bind(CVSMessages.Command_argumentNotManaged, new String[] { folder.getName() }),session.getLocalRoot()); + if (folder == null) + folder = (ICVSFolder)resources[i]; + IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR,NLS.bind(CVSMessages.Command_argumentNotManaged, new String[] { folder.getName() }),session.getLocalRoot()); throw new CVSException(status); } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdatedHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdatedHandler.java index efd121cbf..0b96cd76e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdatedHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/UpdatedHandler.java @@ -92,27 +92,27 @@ public class UpdatedHandler extends ResponseHandler { boolean executable = permissionsLine.indexOf(EXECUTE_FLAG) != -1; try { - // The file may have been set as read-only by a previous checkout/update - if (mFile.isReadOnly()) mFile.setReadOnly(false); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + // The file may have been set as read-only by a previous checkout/update + if (mFile.isReadOnly()) mFile.setReadOnly(false); + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } try { - receiveTargetFile(session, mFile, entryLine, modTime, binary, readOnly, executable, monitor); - } catch (CVSException e) { - // An error occurred while recieving the file. - // If it is due to an invalid file name, - // accumulate the error and continue. - // Otherwise, exit - if (!handleInvalidResourceName(session, mFile, e)) { - throw e; - } - } + receiveTargetFile(session, mFile, entryLine, modTime, binary, readOnly, executable, monitor); + } catch (CVSException e) { + // An error occurred while recieving the file. + // If it is due to an invalid file name, + // accumulate the error and continue. + // Otherwise, exit + if (!handleInvalidResourceName(session, mFile, e)) { + throw e; + } + } } - protected ICVSFile getTargetFile(ICVSFolder mParent, String fileName, byte[] entryBytes) throws CVSException { + protected ICVSFile getTargetFile(ICVSFolder mParent, String fileName, byte[] entryBytes) throws CVSException { return mParent.getFile(fileName); } @@ -148,12 +148,12 @@ public class UpdatedHandler extends ResponseHandler { } mFile.setSyncInfo(newInfoWithTimestamp, modificationState); try { - if (readOnly) mFile.setReadOnly(true); + if (readOnly) mFile.setReadOnly(true); if (executable) mFile.setExecutable(true); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } } public int getHandlerType() { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java index 388182224..282c736ad 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java @@ -70,13 +70,13 @@ public class Version extends RemoteCommand { if (knownPrefix != null) { String versionNumber = line.substring(knownPrefix.length(), line.indexOf(' ', knownPrefix.length() + 1)); if (versionNumber.startsWith("1.10") || versionNumber.equals("1.11") || versionNumber.equals("1.11.1")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - serverType = CVSRepositoryLocation.UNSUPPORTED_SERVER; + serverType = CVSRepositoryLocation.UNSUPPORTED_SERVER; status = new CVSStatus(IStatus.WARNING, CVSStatus.UNSUPPORTED_SERVER_VERSION, NLS.bind(CVSMessages.Version_unsupportedVersion, new String[] { location.getHost(), versionNumber }),location); } else if (isCVSNT) { - serverType = CVSRepositoryLocation.CVSNT_SERVER; + serverType = CVSRepositoryLocation.CVSNT_SERVER; } } else { - serverType = CVSRepositoryLocation.UNKNOWN_SERVER; + serverType = CVSRepositoryLocation.UNKNOWN_SERVER; status = new CVSStatus(IStatus.INFO, CVSStatus.SERVER_IS_UNKNOWN, NLS.bind(CVSMessages.Version_unknownVersionFormat, new String[] { location.getHost(), line }), location); } ((CVSRepositoryLocation)location).setServerPlaform(serverType); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AdminKSubstListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AdminKSubstListener.java index 286d30487..b7d70eff6 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AdminKSubstListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AdminKSubstListener.java @@ -80,7 +80,7 @@ public class AdminKSubstListener extends CommandOutputListener { IPath relativeFilePath = rcsFilePath.removeFirstSegments(remoteRootPath.segmentCount()); ICVSFile file = commandRoot.getFile(relativeFilePath.toString()); if (file.isManaged() && isMatchingPath(file, rcsFilePath)) { - return file; + return file; } } @@ -90,7 +90,7 @@ public class AdminKSubstListener extends CommandOutputListener { if (parent != null) { ICVSFile file = parent.getFile(rcsFilePath.lastSegment()); if (file.isManaged()) { - return file; + return file; } } @@ -99,30 +99,30 @@ public class AdminKSubstListener extends CommandOutputListener { NLS.bind(CVSMessages.AdminKSubstListener_expectedChildOfCommandRoot, new String[] { rcsFilePath.toString(), remoteRootPath.toString() }))); } - private ICVSFolder findFolder(ICVSFolder commandRoot, IPath path) throws CVSException { - final String remotePath = path.toString(); - final ICVSFolder[] result = new ICVSFolder[] { null }; - commandRoot.accept(new ICVSResourceVisitor() { - public void visitFile(ICVSFile file) throws CVSException { - // Nothing to do for files - } - public void visitFolder(ICVSFolder folder) throws CVSException { - FolderSyncInfo info = folder.getFolderSyncInfo(); - if (info != null && info.getRemoteLocation().equals(remotePath)) { - // We found the folder we're looking for - result[0] = folder; - } - if (result[0] == null) { - folder.acceptChildren(this); - } - } - }); - return result[0]; - } + private ICVSFolder findFolder(ICVSFolder commandRoot, IPath path) throws CVSException { + final String remotePath = path.toString(); + final ICVSFolder[] result = new ICVSFolder[] { null }; + commandRoot.accept(new ICVSResourceVisitor() { + public void visitFile(ICVSFile file) throws CVSException { + // Nothing to do for files + } + public void visitFolder(ICVSFolder folder) throws CVSException { + FolderSyncInfo info = folder.getFolderSyncInfo(); + if (info != null && info.getRemoteLocation().equals(remotePath)) { + // We found the folder we're looking for + result[0] = folder; + } + if (result[0] == null) { + folder.acceptChildren(this); + } + } + }); + return result[0]; + } - private boolean isMatchingPath(ICVSFile file, IPath rcsFilePath) throws CVSException { - FolderSyncInfo info = file.getParent().getFolderSyncInfo(); - return info != null - && info.getRemoteLocation().equals(rcsFilePath.removeLastSegments(1).toString()); - } + private boolean isMatchingPath(ICVSFile file, IPath rcsFilePath) throws CVSException { + FolderSyncInfo info = file.getParent().getFolderSyncInfo(); + return info != null + && info.getRemoteLocation().equals(rcsFilePath.removeLastSegments(1).toString()); + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java index dc277e4e7..b9408f4b7 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/AnnotateListener.java @@ -32,7 +32,7 @@ public class AnnotateListener extends CommandOutputListener { int lineNumber; public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { - String error = null; + String error = null; CVSAnnotateBlock aBlock = new CVSAnnotateBlock(line, lineNumber++); if (!aBlock.isValid()) { error = line; @@ -49,8 +49,8 @@ public class AnnotateListener extends CommandOutputListener { } catch (IOException e) { } add(aBlock); - if (error != null) - return new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE_PARSE_FAILURE, error, commandRoot); + if (error != null) + return new CVSStatus(IStatus.ERROR, CVSStatus.ERROR_LINE_PARSE_FAILURE, error, commandRoot); return OK; } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java index 55e09f61c..0660b6dc2 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java @@ -51,8 +51,8 @@ public class DiffListener extends CommandOutputListener { // Special handling to avoid getting duplicate CRs when generating a patch on windows. // If the remote file has CR/LF in it, then the line will have a CR at the end. - // We need to remove it so we don't end up with two CRs (since the printStream will also add one). - // On *nix, we want to include the CR since it will not be added by the printStream (see bug 92162). + // We need to remove it so we don't end up with two CRs (since the printStream will also add one). + // On *nix, we want to include the CR since it will not be added by the printStream (see bug 92162). if (Session.IS_CRLF_PLATFORM && line.length() > 0 && line.charAt(line.length() - 1) == '\r') { line = line.substring(0, line.length() - 1); } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener.java index b0ccb4b18..577709c47 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/ILogEntryListener.java @@ -20,10 +20,10 @@ import org.eclipse.team.internal.ccvs.core.ILogEntry; */ public interface ILogEntryListener { - /** - * A log entry was received for the current file - * @param entry the received log entry. - */ - void handleLogEntryReceived(ILogEntry entry); - + /** + * A log entry was received for the current file + * @param entry the received log entry. + */ + void handleLogEntryReceived(ILogEntry entry); + } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogEntry.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogEntry.java index 6c88f1fcf..09f28da16 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogEntry.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogEntry.java @@ -30,8 +30,8 @@ public class LogEntry extends PlatformObject implements ILogEntry { private String state; private CVSTag[] tags; private CVSTag[] branches; - private String[] revisions; - + private String[] revisions; + /* * Flatten the text in the multi-line comment */ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java index 6c3d2806b..6d199da8c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java @@ -33,233 +33,233 @@ import org.eclipse.team.internal.ccvs.core.util.Util; * server but delegates the handling of the entries to a subclass. */ public class LogListener extends CommandOutputListener { - - /* - * A new format for log dates was introduced in 1.12.9 - */ - private static final String LOG_TIMESTAMP_FORMAT_OLD= "yyyy/MM/dd HH:mm:ss zzz";//$NON-NLS-1$ - private static final String LOG_TIMESTAMP_FORMAT= "yyyy-MM-dd HH:mm:ss zzz";//$NON-NLS-1$ - private static final Locale LOG_TIMESTAMP_LOCALE= Locale.US; - private final DateFormat LOG_DATE_FORMATTER_OLD = new SimpleDateFormat(LOG_TIMESTAMP_FORMAT_OLD, LOG_TIMESTAMP_LOCALE); - private final DateFormat LOG_DATE_FORMATTER = new SimpleDateFormat(LOG_TIMESTAMP_FORMAT, LOG_TIMESTAMP_LOCALE); - - // Server message prefix used for error detection - private static final String NOTHING_KNOWN_ABOUT = "nothing known about "; //$NON-NLS-1$ + + /* + * A new format for log dates was introduced in 1.12.9 + */ + private static final String LOG_TIMESTAMP_FORMAT_OLD= "yyyy/MM/dd HH:mm:ss zzz";//$NON-NLS-1$ + private static final String LOG_TIMESTAMP_FORMAT= "yyyy-MM-dd HH:mm:ss zzz";//$NON-NLS-1$ + private static final Locale LOG_TIMESTAMP_LOCALE= Locale.US; + private final DateFormat LOG_DATE_FORMATTER_OLD = new SimpleDateFormat(LOG_TIMESTAMP_FORMAT_OLD, LOG_TIMESTAMP_LOCALE); + private final DateFormat LOG_DATE_FORMATTER = new SimpleDateFormat(LOG_TIMESTAMP_FORMAT, LOG_TIMESTAMP_LOCALE); + + // Server message prefix used for error detection + private static final String NOTHING_KNOWN_ABOUT = "nothing known about "; //$NON-NLS-1$ - // States of log accumulation. - private final int DONE = 4; - private final int COMMENT = 3; - private final int REVISION = 2; - private final int SYMBOLIC_NAMES = 1; - private final int BEGIN = 0; - - //Tag used for accumulating all of a branch's revision info - public final static String BRANCH_REVISION = "branchRevision"; //$NON-NLS-1$ - - private static final CVSTag[] NO_TAGS = new CVSTag[0]; - private static final String[] NO_VERSIONS = new String[0]; - - // Instance variables for accumulating Log information - private RemoteFile currentFile; - private int state = BEGIN; - private StringBuffer comment; - private String fileState; - private String revision; - private String author; - private Date creationDate; - private List versions = new ArrayList(); - private Map internedStrings = new HashMap(); - private final ILogEntryListener listener; - - /** - * Create a log listener for receiving entries for one or more files. - */ - public LogListener(ILogEntryListener listener) { - this.listener = listener; - } + // States of log accumulation. + private final int DONE = 4; + private final int COMMENT = 3; + private final int REVISION = 2; + private final int SYMBOLIC_NAMES = 1; + private final int BEGIN = 0; + + //Tag used for accumulating all of a branch's revision info + public final static String BRANCH_REVISION = "branchRevision"; //$NON-NLS-1$ + + private static final CVSTag[] NO_TAGS = new CVSTag[0]; + private static final String[] NO_VERSIONS = new String[0]; + + // Instance variables for accumulating Log information + private RemoteFile currentFile; + private int state = BEGIN; + private StringBuffer comment; + private String fileState; + private String revision; + private String author; + private Date creationDate; + private List versions = new ArrayList(); + private Map internedStrings = new HashMap(); + private final ILogEntryListener listener; + + /** + * Create a log listener for receiving entries for one or more files. + */ + public LogListener(ILogEntryListener listener) { + this.listener = listener; + } - public LogListener(RemoteFile file, ILogEntryListener listener) { - this(listener); - this.currentFile = file; - } + public LogListener(RemoteFile file, ILogEntryListener listener) { + this(listener); + this.currentFile = file; + } - private String getRelativeFilePath(ICVSRepositoryLocation location, String fileName) { - if (fileName.endsWith(",v")) { //$NON-NLS-1$ - fileName = fileName.substring(0, fileName.length() - 2); - } - fileName = Util.removeAtticSegment(fileName); - String rootDirectory = location.getRootDirectory(); - if (fileName.startsWith(rootDirectory)) { - try { - fileName = Util.getRelativePath(rootDirectory, fileName); - } catch (CVSException e) { - CVSProviderPlugin.log(e); - return null; - } - } - return fileName; - } + private String getRelativeFilePath(ICVSRepositoryLocation location, String fileName) { + if (fileName.endsWith(",v")) { //$NON-NLS-1$ + fileName = fileName.substring(0, fileName.length() - 2); + } + fileName = Util.removeAtticSegment(fileName); + String rootDirectory = location.getRootDirectory(); + if (fileName.startsWith(rootDirectory)) { + try { + fileName = Util.getRelativePath(rootDirectory, fileName); + } catch (CVSException e) { + CVSProviderPlugin.log(e); + return null; + } + } + return fileName; + } - public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { - String serverMessage = getServerMessage(line, location); - if (serverMessage != null) { - // look for the following condition - // E cvs server: nothing known about fileName - if (serverMessage.startsWith(NOTHING_KNOWN_ABOUT)) { - return new CVSStatus(IStatus.ERROR, CVSStatus.DOES_NOT_EXIST, line, commandRoot); - } - } - return OK; - } + public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { + String serverMessage = getServerMessage(line, location); + if (serverMessage != null) { + // look for the following condition + // E cvs server: nothing known about fileName + if (serverMessage.startsWith(NOTHING_KNOWN_ABOUT)) { + return new CVSStatus(IStatus.ERROR, CVSStatus.DOES_NOT_EXIST, line, commandRoot); + } + } + return OK; + } - public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { - // Fields we will find in the log for a file - // keys = String (tag name), values = String (tag revision number) */ - switch (state) { - case BEGIN: - if (line.startsWith("RCS file: ")) { //$NON-NLS-1$ - // We are starting to recieve the log for a file - String fileName = getRelativeFilePath(location, line.substring(10).trim()); - if (fileName == null) { - currentFile = null; - handleInvalidFileName(location, fileName); - } else { - if (currentFile == null || !currentFile.getRepositoryRelativePath().equals(fileName)) { - // We are starting another file - beginFile(location, fileName); - } - } - } else if (line.startsWith("symbolic names:")) { //$NON-NLS-1$ - state = SYMBOLIC_NAMES; - } else if (line.startsWith("revision ")) { //$NON-NLS-1$ - // if the revision has been locked, remove the "locked by" suffix - revision = line.substring(9).replaceFirst(ResourceSyncInfo.LOCKEDBY_REGEX, ""); //$NON-NLS-1$ - revision = internAndCopyString(revision); - state = REVISION; - } else if (line.startsWith("total revisions:")){ //$NON-NLS-1$ - //if there are no current revision selected and this is a branch then we are in the - //case where there have been no changes made on the branch since the initial branching - //and we need to get the revision that the branch was made from - int indexOfSelectedRevisions = line.lastIndexOf("selected revisions: "); //$NON-NLS-1$ - //20 for length of "selected revisions: " - String selectedRevisions = line.substring(indexOfSelectedRevisions + 20).trim(); - if (selectedRevisions.equals("0")){ //$NON-NLS-1$ - //ok put into comment state to await ======= and add info to log - state = COMMENT; - revision = BRANCH_REVISION; - comment = new StringBuffer(); - } - } - break; - case SYMBOLIC_NAMES: - if (line.startsWith("keyword substitution:")) { //$NON-NLS-1$ - state = BEGIN; - } else { - int firstColon = line.indexOf(':'); - String tagName = internAndCopyString(line.substring(1, firstColon)); - String tagRevision = internAndCopyString(line.substring(firstColon + 2)); - versions.add(new VersionInfo(tagRevision, tagName)); - } - break; - case REVISION: - // date: 2000/06/19 04:56:21; author: somebody; state: Exp; lines: +114 -45 - // get the creation date - int endOfDateIndex = line.indexOf(';', 6); - creationDate = convertFromLogTime(line.substring(6, endOfDateIndex) + " GMT"); //$NON-NLS-1$ - - // get the author name - int endOfAuthorIndex = line.indexOf(';', endOfDateIndex + 1); - author = internAndCopyString(line.substring(endOfDateIndex + 11, endOfAuthorIndex)); + public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { + // Fields we will find in the log for a file + // keys = String (tag name), values = String (tag revision number) */ + switch (state) { + case BEGIN: + if (line.startsWith("RCS file: ")) { //$NON-NLS-1$ + // We are starting to recieve the log for a file + String fileName = getRelativeFilePath(location, line.substring(10).trim()); + if (fileName == null) { + currentFile = null; + handleInvalidFileName(location, fileName); + } else { + if (currentFile == null || !currentFile.getRepositoryRelativePath().equals(fileName)) { + // We are starting another file + beginFile(location, fileName); + } + } + } else if (line.startsWith("symbolic names:")) { //$NON-NLS-1$ + state = SYMBOLIC_NAMES; + } else if (line.startsWith("revision ")) { //$NON-NLS-1$ + // if the revision has been locked, remove the "locked by" suffix + revision = line.substring(9).replaceFirst(ResourceSyncInfo.LOCKEDBY_REGEX, ""); //$NON-NLS-1$ + revision = internAndCopyString(revision); + state = REVISION; + } else if (line.startsWith("total revisions:")){ //$NON-NLS-1$ + //if there are no current revision selected and this is a branch then we are in the + //case where there have been no changes made on the branch since the initial branching + //and we need to get the revision that the branch was made from + int indexOfSelectedRevisions = line.lastIndexOf("selected revisions: "); //$NON-NLS-1$ + //20 for length of "selected revisions: " + String selectedRevisions = line.substring(indexOfSelectedRevisions + 20).trim(); + if (selectedRevisions.equals("0")){ //$NON-NLS-1$ + //ok put into comment state to await ======= and add info to log + state = COMMENT; + revision = BRANCH_REVISION; + comment = new StringBuffer(); + } + } + break; + case SYMBOLIC_NAMES: + if (line.startsWith("keyword substitution:")) { //$NON-NLS-1$ + state = BEGIN; + } else { + int firstColon = line.indexOf(':'); + String tagName = internAndCopyString(line.substring(1, firstColon)); + String tagRevision = internAndCopyString(line.substring(firstColon + 2)); + versions.add(new VersionInfo(tagRevision, tagName)); + } + break; + case REVISION: + // date: 2000/06/19 04:56:21; author: somebody; state: Exp; lines: +114 -45 + // get the creation date + int endOfDateIndex = line.indexOf(';', 6); + creationDate = convertFromLogTime(line.substring(6, endOfDateIndex) + " GMT"); //$NON-NLS-1$ + + // get the author name + int endOfAuthorIndex = line.indexOf(';', endOfDateIndex + 1); + author = internAndCopyString(line.substring(endOfDateIndex + 11, endOfAuthorIndex)); - // get the file state (because this revision might be "dead") - int endOfStateIndex = line.indexOf(';', endOfAuthorIndex + 1) < 0 ? line.length() : line.indexOf(';', endOfAuthorIndex + 1); - fileState = internAndCopyString(line.substring(endOfAuthorIndex + 10, endOfStateIndex)); - comment = new StringBuffer(); - state = COMMENT; - break; - case COMMENT: - // skip next line (info about branches) if it exists, if not then it is a comment line. - if (line.startsWith("branches:")) break; //$NON-NLS-1$ - if (line.equals("=============================================================================") //$NON-NLS-1$ - || line.equals("----------------------------")) { //$NON-NLS-1$ - state = DONE; - break; - } - //check for null if we are in the waiting to finish case (brought on by branches) - if (comment == null) - break; - - if (comment.length() != 0) comment.append('\n'); - comment.append(line); - break; - } - if (state == DONE) { - // we are only interested in tag names for this revision, remove all others. - List thisRevisionTags = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3); - List thisRevisionBranches = new ArrayList(1); - //a parallel lists for revision tags (used only for branches with no commits on them) - List revisionVersions = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3); - String branchRevision = this.getBranchRevision(revision); - for (Iterator i = versions.iterator(); i.hasNext();) { - VersionInfo version = (VersionInfo) i.next(); - String tagName = version.getTagName(); - String tagRevision = version.getTagRevision(); - String tagBranchRevision = version.getBranchRevision(); + // get the file state (because this revision might be "dead") + int endOfStateIndex = line.indexOf(';', endOfAuthorIndex + 1) < 0 ? line.length() : line.indexOf(';', endOfAuthorIndex + 1); + fileState = internAndCopyString(line.substring(endOfAuthorIndex + 10, endOfStateIndex)); + comment = new StringBuffer(); + state = COMMENT; + break; + case COMMENT: + // skip next line (info about branches) if it exists, if not then it is a comment line. + if (line.startsWith("branches:")) break; //$NON-NLS-1$ + if (line.equals("=============================================================================") //$NON-NLS-1$ + || line.equals("----------------------------")) { //$NON-NLS-1$ + state = DONE; + break; + } + //check for null if we are in the waiting to finish case (brought on by branches) + if (comment == null) + break; + + if (comment.length() != 0) comment.append('\n'); + comment.append(line); + break; + } + if (state == DONE) { + // we are only interested in tag names for this revision, remove all others. + List thisRevisionTags = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3); + List thisRevisionBranches = new ArrayList(1); + //a parallel lists for revision tags (used only for branches with no commits on them) + List revisionVersions = versions.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(3); + String branchRevision = this.getBranchRevision(revision); + for (Iterator i = versions.iterator(); i.hasNext();) { + VersionInfo version = (VersionInfo) i.next(); + String tagName = version.getTagName(); + String tagRevision = version.getTagRevision(); + String tagBranchRevision = version.getBranchRevision(); int type = version.isBranch() ? CVSTag.BRANCH : CVSTag.VERSION; if ( branchRevision.equals(tagBranchRevision) || (version.isBranch() && revision.equals(tagRevision))) { - CVSTag cvsTag = new CVSTag(tagName, tagBranchRevision, type); - thisRevisionBranches.add(cvsTag); - } - + CVSTag cvsTag = new CVSTag(tagName, tagBranchRevision, type); + thisRevisionBranches.add(cvsTag); + } + if (tagRevision.equals(revision) || - revision.equals(BRANCH_REVISION)) { - CVSTag cvsTag = new CVSTag(tagName, tagBranchRevision, type); - thisRevisionTags.add(cvsTag); - if (revision.equals(BRANCH_REVISION)){ - //also record the tag revision - revisionVersions.add(tagRevision); - } - } - } - - if (branchRevision.equals(CVSTag.HEAD_REVISION)) { - CVSTag tag = new CVSTag(CVSTag.HEAD_BRANCH, CVSTag.HEAD_REVISION, CVSTag.HEAD); + revision.equals(BRANCH_REVISION)) { + CVSTag cvsTag = new CVSTag(tagName, tagBranchRevision, type); + thisRevisionTags.add(cvsTag); + if (revision.equals(BRANCH_REVISION)){ + //also record the tag revision + revisionVersions.add(tagRevision); + } + } + } + + if (branchRevision.equals(CVSTag.HEAD_REVISION)) { + CVSTag tag = new CVSTag(CVSTag.HEAD_BRANCH, CVSTag.HEAD_REVISION, CVSTag.HEAD); thisRevisionBranches.add(tag); - } else { - if ( thisRevisionBranches.size() == 0) { - CVSTag cvsTag = new CVSTag(CVSTag.UNKNOWN_BRANCH, branchRevision, CVSTag.BRANCH); - thisRevisionBranches.add(cvsTag); - } - } - if (currentFile != null) { - LogEntry entry = new LogEntry(currentFile, revision, author, creationDate, - internString(comment.toString()), fileState, - !thisRevisionTags.isEmpty() ? (CVSTag[]) thisRevisionTags.toArray(new CVSTag[thisRevisionTags.size()]) :NO_TAGS, - !thisRevisionBranches.isEmpty() ? (CVSTag[]) thisRevisionBranches.toArray(new CVSTag[thisRevisionBranches.size()]) :NO_TAGS, - !revisionVersions.isEmpty() ? (String[]) revisionVersions.toArray(new String[revisionVersions.size()]) : NO_VERSIONS); - addEntry(entry); - } - state = BEGIN; - } - return OK; - } + } else { + if ( thisRevisionBranches.size() == 0) { + CVSTag cvsTag = new CVSTag(CVSTag.UNKNOWN_BRANCH, branchRevision, CVSTag.BRANCH); + thisRevisionBranches.add(cvsTag); + } + } + if (currentFile != null) { + LogEntry entry = new LogEntry(currentFile, revision, author, creationDate, + internString(comment.toString()), fileState, + !thisRevisionTags.isEmpty() ? (CVSTag[]) thisRevisionTags.toArray(new CVSTag[thisRevisionTags.size()]) :NO_TAGS, + !thisRevisionBranches.isEmpty() ? (CVSTag[]) thisRevisionBranches.toArray(new CVSTag[thisRevisionBranches.size()]) :NO_TAGS, + !revisionVersions.isEmpty() ? (String[]) revisionVersions.toArray(new String[revisionVersions.size()]) : NO_VERSIONS); + addEntry(entry); + } + state = BEGIN; + } + return OK; + } - /** - * Convert revision number to branch number. - * - * <table border="1"> - * <tr><th>revision</th><th>branch</th><th>comment</th></tr> - * <tr><td>1.1.2.1</td><td>1.1.0.2</td><td>regular branch</td></tr> - * <tr><td>1.1.4.1</td><td>1.1.0.4</td><td>regular branch</td></tr> - * <tr><td>1.1.1.2</td><td>1.1.1</td><td>vendor branch</td></tr> - * <tr><td>1.1.2.1.2.3</td><td>1.1.2.1.0.2</td><td>branch created from another branch</td></tr> - * </table> - * - * @param revision revision number - * @return branch number - * - */ + /** + * Convert revision number to branch number. + * + * <table border="1"> + * <tr><th>revision</th><th>branch</th><th>comment</th></tr> + * <tr><td>1.1.2.1</td><td>1.1.0.2</td><td>regular branch</td></tr> + * <tr><td>1.1.4.1</td><td>1.1.0.4</td><td>regular branch</td></tr> + * <tr><td>1.1.1.2</td><td>1.1.1</td><td>vendor branch</td></tr> + * <tr><td>1.1.2.1.2.3</td><td>1.1.2.1.0.2</td><td>branch created from another branch</td></tr> + * </table> + * + * @param revision revision number + * @return branch number + * + */ private String getBranchRevision(String revision) { if (revision.length() == 0 || revision.lastIndexOf(".") == -1) //$NON-NLS-1$ throw new IllegalArgumentException( @@ -274,63 +274,63 @@ public class LogListener extends CommandOutputListener { branchPrefix += branchNumber.substring(branchNumber.lastIndexOf(".")); //$NON-NLS-1$ return branchPrefix; } - - protected void beginFile(ICVSRepositoryLocation location, String fileName) { - currentFile = RemoteFile.create(fileName, location); - versions.clear(); - } + + protected void beginFile(ICVSRepositoryLocation location, String fileName) { + currentFile = RemoteFile.create(fileName, location); + versions.clear(); + } - protected void addEntry(LogEntry entry) { - listener.handleLogEntryReceived(entry); - } + protected void addEntry(LogEntry entry) { + listener.handleLogEntryReceived(entry); + } - protected void handleInvalidFileName(ICVSRepositoryLocation location, String badFilePath) { - CVSProviderPlugin.log(IStatus.WARNING, "Invalid file path '" + badFilePath + "' received from " + location.toString(), null); //$NON-NLS-1$ //$NON-NLS-2$ - } + protected void handleInvalidFileName(ICVSRepositoryLocation location, String badFilePath) { + CVSProviderPlugin.log(IStatus.WARNING, "Invalid file path '" + badFilePath + "' received from " + location.toString(), null); //$NON-NLS-1$ //$NON-NLS-2$ + } - /** - * Converts a time stamp as sent from a cvs server for a "log" command into a - * <code>Date</code>. - */ - private Date convertFromLogTime(String modTime) { - DateFormat format = LOG_DATE_FORMATTER; - // Compatibility for older cvs version (pre 1.12.9) - if (modTime.length() > 4 && modTime.charAt(4) == '/') - format = LOG_DATE_FORMATTER_OLD; - - try { - return format.parse(modTime); - } catch (ParseException e) { - // fallback is to return null - return null; - } - } - - private String internAndCopyString(String string) { - String internedString = (String) internedStrings.get(string); - if (internedString == null) { - internedString = new String(string); - internedStrings.put(internedString, internedString); - } - return internedString; - } - - private String internString(String string) { - String internedString = (String) internedStrings.get(string); - if (internedString == null) { - internedString = string; - internedStrings.put(internedString, internedString); - } - return internedString; - } - - private static class VersionInfo { + /** + * Converts a time stamp as sent from a cvs server for a "log" command into a + * <code>Date</code>. + */ + private Date convertFromLogTime(String modTime) { + DateFormat format = LOG_DATE_FORMATTER; + // Compatibility for older cvs version (pre 1.12.9) + if (modTime.length() > 4 && modTime.charAt(4) == '/') + format = LOG_DATE_FORMATTER_OLD; + + try { + return format.parse(modTime); + } catch (ParseException e) { + // fallback is to return null + return null; + } + } + + private String internAndCopyString(String string) { + String internedString = (String) internedStrings.get(string); + if (internedString == null) { + internedString = new String(string); + internedStrings.put(internedString, internedString); + } + return internedString; + } + + private String internString(String string) { + String internedString = (String) internedStrings.get(string); + if (internedString == null) { + internedString = string; + internedStrings.put(internedString, internedString); + } + return internedString; + } + + private static class VersionInfo { private final boolean isBranch; private String tagRevision; private String branchRevision; private final String tagName; - public VersionInfo(String version, String tagName) { + public VersionInfo(String version, String tagName) { this.tagName = tagName; this.isBranch = isBranchTag(version); tagRevision = version; @@ -347,7 +347,7 @@ public class LogListener extends CommandOutputListener { tagRevision = version.substring(0, lastDot); } } - } + } public String getTagName() { return this.tagName; @@ -356,34 +356,34 @@ public class LogListener extends CommandOutputListener { public String getTagRevision() { return this.tagRevision; } - - public boolean isBranch() { - return isBranch; - } - - /** branch tags have odd number of segments or have - * an even number with a zero as the second last segment - * e.g: 1.1.1, 1.26.0.2 are branch revision numbers */ - private boolean isBranchTag(String tagName) { - // First check if we have an odd number of segments (i.e. even number of dots) - int numberOfDots = 0; - int lastDot = 0; - for (int i = 0; i < tagName.length(); i++) { - if (tagName.charAt(i) == '.') { - numberOfDots++; - lastDot = i; - } - } - if ((numberOfDots % 2) == 0) return true; - if (numberOfDots == 1) return false; - - // If not, check if the second lat segment is a zero - if (tagName.charAt(lastDot - 1) == '0' && tagName.charAt(lastDot - 2) == '.') return true; - return false; - } + + public boolean isBranch() { + return isBranch; + } + + /** branch tags have odd number of segments or have + * an even number with a zero as the second last segment + * e.g: 1.1.1, 1.26.0.2 are branch revision numbers */ + private boolean isBranchTag(String tagName) { + // First check if we have an odd number of segments (i.e. even number of dots) + int numberOfDots = 0; + int lastDot = 0; + for (int i = 0; i < tagName.length(); i++) { + if (tagName.charAt(i) == '.') { + numberOfDots++; + lastDot = i; + } + } + if ((numberOfDots % 2) == 0) return true; + if (numberOfDots == 1) return false; + + // If not, check if the second lat segment is a zero + if (tagName.charAt(lastDot - 1) == '0' && tagName.charAt(lastDot - 2) == '.') return true; + return false; + } public String getBranchRevision() { return branchRevision; } - } + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java index f1538dd52..849ab09c2 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java @@ -238,9 +238,9 @@ public class UpdateListener extends CommandOutputListener { if (resource != null) { return new CVSStatus(IStatus.ERROR, CVSStatus.UNMEGERED_BINARY_CONFLICT, NLS.bind(CVSMessages.UpdateListener_0, (new Object[] { - resource.getFullPath().toString(), - mergedBinaryFileRevision, - resource.getFullPath().removeLastSegments(1).append(backupFile).toString()})), commandRoot); + resource.getFullPath().toString(), + mergedBinaryFileRevision, + resource.getFullPath().removeLastSegments(1).append(backupFile).toString()})), commandRoot); } } } catch (CVSException e1) { @@ -265,8 +265,8 @@ public class UpdateListener extends CommandOutputListener { // To get the folders, the update request should be re-issued for HEAD return new CVSStatus(IStatus.WARNING, CVSStatus.NO_SUCH_TAG, line, commandRoot); } else if (message.startsWith("Numeric join") && message.endsWith("may not contain a date specifier")) { //$NON-NLS-1$ //$NON-NLS-2$ - // This error indicates a join failed because a date tag was used - return super.errorLine(line, location, commandRoot, monitor); + // This error indicates a join failed because a date tag was used + return super.errorLine(line, location, commandRoot, monitor); } else { return super.errorLine(line, location, commandRoot, monitor); } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSAuthenticationException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSAuthenticationException.java index 256424391..8ff8f5f17 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSAuthenticationException.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSAuthenticationException.java @@ -25,7 +25,7 @@ public class CVSAuthenticationException extends CVSException { private int retryStatus = 0; - /** + /** * Code indicating that authentication can be retried after * prompting the user for corrected authentication information */ @@ -67,7 +67,7 @@ public class CVSAuthenticationException extends CVSException { this(new CVSStatus(IStatus.ERROR, CVSStatus.AUTHENTICATION_FAILURE,NLS.bind(CVSMessages.CVSAuthenticationException_detail, (new Object[] { detail })),cvsLocation)); // this.retryStatus = retryStatus; } - + /** * Creates a new <code>CVSAuthenticationException</code> * @@ -76,10 +76,10 @@ public class CVSAuthenticationException extends CVSException { * @param the location of the CVS server * @param the exception */ - public CVSAuthenticationException(String detail, int retryStatus,ICVSRepositoryLocation cvsLocation, Exception e) { - this(new CVSStatus(IStatus.ERROR, CVSStatus.AUTHENTICATION_FAILURE , NLS.bind(CVSMessages.CVSAuthenticationException_detail, (new Object[] { detail })), e, cvsLocation)); // - this.retryStatus = retryStatus; - } + public CVSAuthenticationException(String detail, int retryStatus,ICVSRepositoryLocation cvsLocation, Exception e) { + this(new CVSStatus(IStatus.ERROR, CVSStatus.AUTHENTICATION_FAILURE , NLS.bind(CVSMessages.CVSAuthenticationException_detail, (new Object[] { detail })), e, cvsLocation)); // + this.retryStatus = retryStatus; + } public int getRetryStatus() { return retryStatus; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSCommunicationException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSCommunicationException.java index f5f227fb7..268297a2a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSCommunicationException.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSCommunicationException.java @@ -24,7 +24,7 @@ public class CVSCommunicationException extends CVSException { private static final long serialVersionUID = 1L; - /** + /** * Create a new <code>CVSCommunicationException</code> with the * given status. */ @@ -75,18 +75,18 @@ public class CVSCommunicationException extends CVSException { } public static String getMessageFor(Throwable throwable) { - String message = Policy.getMessage(getMessageKey(throwable)); - if (message == null) { - message = NLS.bind(CVSMessages.CVSCommunicationException_io, (new Object[] {throwable.toString()})); - } else { - message = NLS.bind(message, (new Object[] {throwable.getMessage()})); - } + String message = Policy.getMessage(getMessageKey(throwable)); + if (message == null) { + message = NLS.bind(CVSMessages.CVSCommunicationException_io, (new Object[] {throwable.toString()})); + } else { + message = NLS.bind(message, (new Object[] {throwable.getMessage()})); + } return message; } - - private static String getMessageKey(Throwable t) { - String name = t.getClass().getName(); - name = name.replace('.', '_'); - return name; - } + + private static String getMessageKey(Throwable t) { + String name = t.getClass().getName(); + name = name.replace('.', '_'); + return name; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java index f484b4055..51486a6ad 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java @@ -290,7 +290,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit // Save options in hash table StringTokenizer stOpt = new StringTokenizer( location.substring(optionStart+1, end), - "=;" //$NON-NLS-1$ + "=;" //$NON-NLS-1$ ); while (stOpt.hasMoreTokens()) { hmOptions.put(stOpt.nextToken(), stOpt.nextToken()); @@ -343,11 +343,11 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit end= location.indexOf(COLON, start); int hostEnd = end; if (end == -1) { - // The last colon is optional so look for the slash that starts the path - end = location.indexOf('/', start); - hostEnd = end; - // Decrement the end since the slash is part of the path - if (end != -1) end--; + // The last colon is optional so look for the slash that starts the path + end = location.indexOf('/', start); + hostEnd = end; + // Decrement the end since the slash is part of the path + if (end != -1) end--; } String host = (hmOptions.containsKey("hostname")) ? hmOptions.get("hostname").toString() : location.substring(start, hostEnd); //$NON-NLS-1$ //$NON-NLS-2$ int port = USE_DEFAULT_PORT; @@ -721,8 +721,8 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit * for any connection made to this remote location. */ public Connection openConnection(IProgressMonitor monitor) throws CVSException { - // Get the lock for the host to ensure that we are not connecting to the same host concurrently. - Policy.checkCanceled(monitor); + // Get the lock for the host to ensure that we are not connecting to the same host concurrently. + Policy.checkCanceled(monitor); ILock hostLock; synchronized(hostLocks) { hostLock = hostLocks.get(getHost()); @@ -732,11 +732,11 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit } } try { - boolean acquired = false; - int count = 0; - int timeout = CVSProviderPlugin.getPlugin().getTimeout(); - while (!acquired) { - try { + boolean acquired = false; + int count = 0; + int timeout = CVSProviderPlugin.getPlugin().getTimeout(); + while (!acquired) { + try { acquired = hostLock.acquire(1000); } catch (InterruptedException e) { // Ignore @@ -746,7 +746,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit } count++; Policy.checkCanceled(monitor); - } + } // Allow two ticks in case of a retry monitor.beginTask(NLS.bind(CVSMessages.CVSRepositoryLocation_openingConnection, new String[] { getHost() }), 2); ensureLocationCached(); @@ -773,9 +773,9 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit // password = "";//$NON-NLS-1$ Connection connection = createConnection(password, monitor); if (cacheNeedsUpdate) - updateCachedLocation(); + updateCachedLocation(); previousAuthenticationFailed = false; - return connection; + return connection; } catch (CVSAuthenticationException ex) { previousAuthenticationFailed = true; if (ex.getRetryStatus() == CVSAuthenticationException.RETRY) { @@ -789,7 +789,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit } } } finally { - hostLock.release(); + hostLock.release(); monitor.done(); } } @@ -805,76 +805,76 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit authenticator.promptForUserInfo(this, this, message); } - /* + /* * Ensure that this location is in the known repositories list * and that the authentication information matches what is in the * cache, if this instance is not the instance in the cache. - */ - private void ensureLocationCached() { - String location = getLocation(); - KnownRepositories repositories = KnownRepositories.getInstance(); - if (repositories.isKnownRepository(location)) { - try { - // The repository is already known. - // Ensure that the authentication information of this - // location matches that of the known location - setAuthenticationInformation((CVSRepositoryLocation)repositories.getRepository(location)); - } catch (CVSException e) { - // Log the exception and continue - CVSProviderPlugin.log(e); - } - } else { - // The repository is not known so record it so any authentication - // information the user may provide is remembered - repositories.addRepository(this, true /* broadcast */); - } - } + */ + private void ensureLocationCached() { + String location = getLocation(); + KnownRepositories repositories = KnownRepositories.getInstance(); + if (repositories.isKnownRepository(location)) { + try { + // The repository is already known. + // Ensure that the authentication information of this + // location matches that of the known location + setAuthenticationInformation((CVSRepositoryLocation)repositories.getRepository(location)); + } catch (CVSException e) { + // Log the exception and continue + CVSProviderPlugin.log(e); + } + } else { + // The repository is not known so record it so any authentication + // information the user may provide is remembered + repositories.addRepository(this, true /* broadcast */); + } + } /* * Set the authentication information of this instance such that it matches the * provided instances. - */ - private void setAuthenticationInformation(CVSRepositoryLocation other) { - if (other != this) { - // The instances differ so copy from the other location to this one - if (other.getUserInfoCached()) { - // The user info is cached for the other instance - // so null all the values in this instance so the - // information is obtained from the cache - this.allowCaching = true; - if (!userFixed) this.user = null; - if (!passwordFixed) this.password = null; - } else { - // The user info is not cached for the other instance so - // copy the authentication information into this instance - setAllowCaching(false); /* this will clear any cached values */ - // Only copy the username and password if they are not fixed. - // (If they are fixed, they would be included in the location - // identifier and therefore must already match) - if (!other.userFixed) - this.user = other.user; - if (!other.passwordFixed) - this.password = other.password; - } - } - } + */ + private void setAuthenticationInformation(CVSRepositoryLocation other) { + if (other != this) { + // The instances differ so copy from the other location to this one + if (other.getUserInfoCached()) { + // The user info is cached for the other instance + // so null all the values in this instance so the + // information is obtained from the cache + this.allowCaching = true; + if (!userFixed) this.user = null; + if (!passwordFixed) this.password = null; + } else { + // The user info is not cached for the other instance so + // copy the authentication information into this instance + setAllowCaching(false); /* this will clear any cached values */ + // Only copy the username and password if they are not fixed. + // (If they are fixed, they would be included in the location + // identifier and therefore must already match) + if (!other.userFixed) + this.user = other.user; + if (!other.passwordFixed) + this.password = other.password; + } + } + } - /* - * The connection was successfully made. Update the cached - * repository location if it is a different instance than - * this location. - */ - private void updateCachedLocation() { - try { - CVSRepositoryLocation known = (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(getLocation()); - known.setAuthenticationInformation(this); - } catch (CVSException e) { - // Log the exception and continue - CVSProviderPlugin.log(e); - } - } - - /* + /* + * The connection was successfully made. Update the cached + * repository location if it is a different instance than + * this location. + */ + private void updateCachedLocation() { + try { + CVSRepositoryLocation known = (CVSRepositoryLocation)KnownRepositories.getInstance().getRepository(getLocation()); + known.setAuthenticationInformation(this); + } catch (CVSException e) { + // Log the exception and continue + CVSProviderPlugin.log(e); + } + } + + /* * Implementation of inherited toString() */ public String toString() { @@ -950,13 +950,13 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit public void setAllowCaching(boolean value) { allowCaching = value; - if (allowCaching) { - updateCache(); - } else { - if (password == null) - password = retrievePassword(); - removeNode(); - } + if (allowCaching) { + updateCache(); + } else { + if (password == null) + password = retrievePassword(); + removeNode(); + } } public void updateCache() { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java index 7c9e36c3d..c4b7c7b7c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSServerException.java @@ -26,7 +26,7 @@ public class CVSServerException extends CVSException { private static final long serialVersionUID = 1L; - /** + /** * Return true if the exception from the cvs server is the no tag error, and false * otherwise. */ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java index c298a78b2..230eaf0a7 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java @@ -173,7 +173,7 @@ public class Connection { String result = new String(buffer, 0, index, getEncoding(location)); if (Policy.isDebugProtocol()) - Policy.printProtocolLine(result); + Policy.printProtocolLine(result); return result; } @@ -183,7 +183,7 @@ public class Connection { * Sends the given string to the server. */ public void write(String s) throws CVSException { - try { + try { write(s.getBytes(fServerEncoding), false); } catch (UnsupportedEncodingException e) { IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.SERVER_ERROR, e.getMessage(), e, fCVSRoot); @@ -224,7 +224,7 @@ public class Connection { throw new CVSCommunicationException(CVSMessages.Connection_writeUnestablishedConnection,fCVSRoot,null); if (Policy.isDebugProtocol()) - Policy.printProtocol(new String(b, off, len), newline); + Policy.printProtocol(new String(b, off, len), newline); try { OutputStream out= getOutputStream(); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnection.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnection.java index 935069365..4d628c7a6 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnection.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/PServerConnection.java @@ -101,31 +101,31 @@ public class PServerConnection implements IServerConnection { InputStream is = null; OutputStream os = null; - - Proxy proxy = getProxy(); - if (proxy!=null) { - String host = cvsroot.getHost(); - int port = cvsroot.getPort(); - if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) { - port = DEFAULT_PORT; - } - try { - int timeout = CVSProviderPlugin.getPlugin().getTimeout() * 1000; - IJSchService service = CVSProviderPlugin.getPlugin().getJSchService(); - service.connect(proxy, host, port, timeout, monitor); - } catch( Exception ex) { - ex.printStackTrace(); - throw new IOException(ex.getMessage()); - } - is = proxy.getInputStream(); - os = proxy.getOutputStream(); - - } else { - fSocket = createSocket(monitor); - is = fSocket.getInputStream(); - os = fSocket.getOutputStream(); - } - + + Proxy proxy = getProxy(); + if (proxy!=null) { + String host = cvsroot.getHost(); + int port = cvsroot.getPort(); + if (port == ICVSRepositoryLocation.USE_DEFAULT_PORT) { + port = DEFAULT_PORT; + } + try { + int timeout = CVSProviderPlugin.getPlugin().getTimeout() * 1000; + IJSchService service = CVSProviderPlugin.getPlugin().getJSchService(); + service.connect(proxy, host, port, timeout, monitor); + } catch( Exception ex) { + ex.printStackTrace(); + throw new IOException(ex.getMessage()); + } + is = proxy.getInputStream(); + os = proxy.getOutputStream(); + + } else { + fSocket = createSocket(monitor); + is = fSocket.getInputStream(); + os = fSocket.getOutputStream(); + } + boolean connected = false; try { this.inputStream = new BufferedInputStream(new PollingInputStream(is, @@ -147,8 +147,8 @@ public class PServerConnection implements IServerConnection { Proxy proxy = service.getProxyForHost(cvsroot.getHost(), IProxyData.SOCKS_PROXY_TYPE); if (proxy == null) proxy = service.getProxyForHost(cvsroot.getHost(), IProxyData.HTTPS_PROXY_TYPE); - return proxy; - } + return proxy; + } @Override public InputStream getInputStream() { @@ -204,29 +204,29 @@ public class PServerConnection implements IServerConnection { String message = "";//$NON-NLS-1$ String separator = ""; //$NON-NLS-1$ - if(!CVSProviderPlugin.getPlugin().isUseProxy()) { - while (line.length() > 0 && line.charAt(0) == ERROR_CHAR) { - if (line.length() > 2) { - message += separator + line.substring(2); - separator = " "; //$NON-NLS-1$ - } - line = Connection.readLine(cvsroot, getInputStream()); - } - } else { - while (line.length() > 0) { - message += separator + line; - separator = "\n"; //$NON-NLS-1$ - line = Connection.readLine(cvsroot, getInputStream()); - } - } + if(!CVSProviderPlugin.getPlugin().isUseProxy()) { + while (line.length() > 0 && line.charAt(0) == ERROR_CHAR) { + if (line.length() > 2) { + message += separator + line.substring(2); + separator = " "; //$NON-NLS-1$ + } + line = Connection.readLine(cvsroot, getInputStream()); + } + } else { + while (line.length() > 0) { + message += separator + line; + separator = "\n"; //$NON-NLS-1$ + line = Connection.readLine(cvsroot, getInputStream()); + } + } // If the last line is the login failed (I HATE YOU) message, return authentication failure if (LOGIN_FAILED.equals(line)) { - if (message.length() == 0) { - throw new CVSAuthenticationException(CVSMessages.PServerConnection_loginRefused, CVSAuthenticationException.RETRY,cvsroot); - } else { - throw new CVSAuthenticationException(message, CVSAuthenticationException.RETRY,cvsroot); - } + if (message.length() == 0) { + throw new CVSAuthenticationException(CVSMessages.PServerConnection_loginRefused, CVSAuthenticationException.RETRY,cvsroot); + } else { + throw new CVSAuthenticationException(message, CVSAuthenticationException.RETRY,cvsroot); + } } // Remove leading "error 0" @@ -276,5 +276,5 @@ public class PServerConnection implements IServerConnection { private void throwInValidCharacter() throws CVSAuthenticationException { throw new CVSAuthenticationException(CVSMessages.PServerConnection_invalidChars, CVSAuthenticationException.RETRY, cvsroot); } - + } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileSystem.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileSystem.java index 94e6e8834..99fc9869d 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileSystem.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/filesystem/CVSFileSystem.java @@ -57,7 +57,7 @@ public class CVSFileSystem extends FileSystem { public CVSFileTree refreshTree(URI uri, IProgressMonitor monitor){ - CVSURI cvsURI = CVSURI.fromUri(uri); + CVSURI cvsURI = CVSURI.fromUri(uri); //Make sure that we're building the tree from the topmost level - keep cycling until you hit null ICVSRemoteFolder folder = cvsURI.getProjectURI().toFolder(); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/CVSCheckedInChangeSet.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/CVSCheckedInChangeSet.java index 95b5132de..fc79e9783 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/CVSCheckedInChangeSet.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/mapping/CVSCheckedInChangeSet.java @@ -22,29 +22,29 @@ import org.eclipse.team.internal.core.subscribers.DiffChangeSet; public class CVSCheckedInChangeSet extends DiffChangeSet { - private final ILogEntry entry; + private final ILogEntry entry; - public CVSCheckedInChangeSet(ILogEntry entry) { - this.entry = entry; + public CVSCheckedInChangeSet(ILogEntry entry) { + this.entry = entry; Date date = entry.getDate(); String comment = LogEntry.flattenText(entry.getComment()); if (date == null) { setName("["+entry.getAuthor()+ "] " + comment); //$NON-NLS-1$ //$NON-NLS-2$ } else { String dateString = DateFormat.getDateTimeInstance().format(date); - setName("["+entry.getAuthor()+ "] (" + dateString +") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + setName("["+entry.getAuthor()+ "] (" + dateString +") " + comment); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } - } - - public String getAuthor() { - return entry.getAuthor(); - } + } + + public String getAuthor() { + return entry.getAuthor(); + } - public Date getDate() { - return entry.getDate(); - } + public Date getDate() { + return entry.getDate(); + } - public String getComment() { - return entry.getComment(); - } + public String getComment() { + return entry.getComment(); + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java index 3f9315fdc..e0d4904e1 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSEntryLineTag.java @@ -23,10 +23,10 @@ import org.eclipse.team.internal.ccvs.core.*; public class CVSEntryLineTag extends CVSTag { - /* - * This is the format of a date as it appears in the entry line. The date in an entry - * line is always in GMT. - */ + /* + * This is the format of a date as it appears in the entry line. The date in an entry + * line is always in GMT. + */ private static final String ENTRY_LINE_DATE_TAG_FORMAT = "yyyy.MM.dd.HH.mm.ss"; //$NON-NLS-1$ /* @@ -62,7 +62,7 @@ public class CVSEntryLineTag extends CVSTag { static synchronized public Date entryLineToDate(String text){ try { - entryLineDateTagFormatter.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ + entryLineDateTagFormatter.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ return entryLineDateTagFormatter.parse(text); } catch (ParseException e) { CVSProviderPlugin.log(new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, "Tag name " + text + " is not of the expected format " + ENTRY_LINE_DATE_TAG_FORMAT, e)); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java index 12c2553d2..b0ce6e55d 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java @@ -54,12 +54,12 @@ public class CVSWorkspaceRoot { if ( ! info.equals(folderInfo)) { throw new CVSException(new CVSStatus(IStatus.ERROR, NLS.bind(CVSMessages.CVSProvider_infoMismatch, new String[] { project.getName() }))); } - - // Ensure that the repository location format is supported - String root = info.getRoot(); - // This will try to create a repository location for the root. - // If it fails, an exception is thrown. - KnownRepositories.getInstance().getRepository(root); + + // Ensure that the repository location format is supported + String root = info.getRoot(); + // This will try to create a repository location for the root. + // If it fails, an exception is thrown. + KnownRepositories.getInstance().getRepository(root); // Register the project with Team RepositoryProvider.map(project, CVSProviderPlugin.getTypeId()); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java index 4c094f94d..fc7f6e359 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java @@ -59,12 +59,12 @@ public class EclipseFile extends EclipseResource implements ICVSFile { } public InputStream getContents() throws CVSException { - try { + try { return getIFile().getContents(); } catch (CoreException e) { - throw CVSException.wrapException(resource, NLS.bind(CVSMessages.EclipseFile_Problem_accessing_resource, new String[] { resource.getFullPath().toString(), e.getStatus().getMessage() }), e); // - } - } + throw CVSException.wrapException(resource, NLS.bind(CVSMessages.EclipseFile_Problem_accessing_resource, new String[] { resource.getFullPath().toString(), e.getStatus().getMessage() }), e); // + } + } @Override public Date getTimeStamp() { @@ -204,10 +204,10 @@ public class EclipseFile extends EclipseResource implements ICVSFile { if (attributes != null) { attributes.setReadOnly(readOnly); try { - resource.setResourceAttributes(attributes); - } catch (CoreException e) { - throw CVSException.wrapException(e); - } + resource.setResourceAttributes(attributes); + } catch (CoreException e) { + throw CVSException.wrapException(e); + } } } @@ -222,10 +222,10 @@ public class EclipseFile extends EclipseResource implements ICVSFile { if (attributes != null) { attributes.setExecutable(executable); try { - resource.setResourceAttributes(attributes); - } catch (CoreException e) { - throw CVSException.wrapException(e); - } + resource.setResourceAttributes(attributes); + } catch (CoreException e) { + throw CVSException.wrapException(e); + } } } @@ -355,12 +355,12 @@ public class EclipseFile extends EclipseResource implements ICVSFile { } try { - // allow editing - setReadOnly(false); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + // allow editing + setReadOnly(false); + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } }, monitor); } @@ -400,12 +400,12 @@ public class EclipseFile extends EclipseResource implements ICVSFile { setBaserevInfo(null); try { - // prevent editing - setReadOnly(true); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + // prevent editing + setReadOnly(true); + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } }, monitor); } @@ -442,28 +442,28 @@ public class EclipseFile extends EclipseResource implements ICVSFile { modificationState = ICVSFile.DIRTY; } else { // cvs commit: commit of a changed file - // cvs update: update of a file whose contents match the server contents - Date timeStamp; - if (commit) { - // This is a commit. Put the file timestamp in the entry - timeStamp = getTimeStamp(); - } else { - // This is an update. We need to change the tiemstamp in the - // entry file to match the file timestamp returned by Java - timeStamp = oldInfo.getTimeStamp(); - if (timeStamp == null) { - timeStamp = getTimeStamp(); - } else { - // First, set the timestamp of the file to the timestamp from the entry - // There is a chance this will do nothing as the call to Java on some - // file systems munges the timestamps - setTimeStamp(timeStamp); - // To compensate for the above, reset the timestamp in the entry - // to match the timestamp in the file - timeStamp = getTimeStamp(); - } - } - newInfo = new ResourceSyncInfo(entryLine, timeStamp); + // cvs update: update of a file whose contents match the server contents + Date timeStamp; + if (commit) { + // This is a commit. Put the file timestamp in the entry + timeStamp = getTimeStamp(); + } else { + // This is an update. We need to change the tiemstamp in the + // entry file to match the file timestamp returned by Java + timeStamp = oldInfo.getTimeStamp(); + if (timeStamp == null) { + timeStamp = getTimeStamp(); + } else { + // First, set the timestamp of the file to the timestamp from the entry + // There is a chance this will do nothing as the call to Java on some + // file systems munges the timestamps + setTimeStamp(timeStamp); + // To compensate for the above, reset the timestamp in the entry + // to match the timestamp in the file + timeStamp = getTimeStamp(); + } + } + newInfo = new ResourceSyncInfo(entryLine, timeStamp); } //see bug 106876 @@ -483,23 +483,23 @@ public class EclipseFile extends EclipseResource implements ICVSFile { if (base != null) { setBaserevInfo(null); try { - setReadOnly(true); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + setReadOnly(true); + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } } else { - // Check to see if watch-edit is enabled for the project - CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()); - if (provider != null && provider.isWatchEditEnabled()) { - try { - setReadOnly(true); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } - } - } + // Check to see if watch-edit is enabled for the project + CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()); + if (provider != null && provider.isWatchEditEnabled()) { + try { + setReadOnly(true); + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } + } + } } @Override diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java index 5ccf5374f..d15a35d64 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java @@ -53,31 +53,31 @@ class EclipseFolder extends EclipseResource implements ICVSFolder { for (int i = 0; i < resources.length; i++) { IResource resource = resources[i]; int type = resource.getType(); - if ((includeFiles && (type==IResource.FILE)) + if ((includeFiles && (type==IResource.FILE)) || (includeFolders && (type==IResource.FOLDER))) { - boolean exists = resource.exists(); - if ((includeExisting && exists) || (includePhantoms && !exists)) { - ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); - boolean includeResource = false; - if ((includeManaged && includeUnmanaged && includeIgnored)) { - includeResource = true; - } else { - boolean isManaged = cvsResource.isManaged(); - if (isManaged && includeManaged) { - includeResource = true; - } else if (exists) { - boolean isIgnored = cvsResource.isIgnored(); - if (isIgnored && includeIgnored) { - includeResource = true; - } else if (! isManaged && ! isIgnored && includeUnmanaged) { - includeResource = true; - } - } - } - if (includeResource) { - result.add(cvsResource); - } - } + boolean exists = resource.exists(); + if ((includeExisting && exists) || (includePhantoms && !exists)) { + ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); + boolean includeResource = false; + if ((includeManaged && includeUnmanaged && includeIgnored)) { + includeResource = true; + } else { + boolean isManaged = cvsResource.isManaged(); + if (isManaged && includeManaged) { + includeResource = true; + } else if (exists) { + boolean isIgnored = cvsResource.isIgnored(); + if (isIgnored && includeIgnored) { + includeResource = true; + } else if (! isManaged && ! isIgnored && includeUnmanaged) { + includeResource = true; + } + } + } + if (includeResource) { + result.add(cvsResource); + } + } } } return result.toArray(new ICVSResource[result.size()]); @@ -234,12 +234,12 @@ class EclipseFolder extends EclipseResource implements ICVSFolder { monitor.worked(1); IResource resource = members[i]; if (resource.getType() == IResource.FILE) { - ResourceAttributes attrs = resource.getResourceAttributes(); - if (attrs != null && attrs.isReadOnly()) { - attrs.setReadOnly(false); - resource.setResourceAttributes(attrs); - } - } else { + ResourceAttributes attrs = resource.getResourceAttributes(); + if (attrs != null && attrs.isReadOnly()) { + attrs.setReadOnly(false); + resource.setResourceAttributes(attrs); + } + } else { recursiveUnmanage((IContainer) resource, monitor); } } @@ -260,12 +260,12 @@ class EclipseFolder extends EclipseResource implements ICVSFolder { @Override public ICVSResource getChild(String namedPath) throws CVSException { - if (namedPath.equals(Session.CURRENT_LOCAL_FOLDER)) { - return this; - } + if (namedPath.equals(Session.CURRENT_LOCAL_FOLDER)) { + return this; + } IPath path = new Path(null, namedPath); if(path.segmentCount()==0) { - return this; + return this; } IResource child = ((IContainer)resource).findMember(path, true /* include phantoms */); if(child!=null) { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java index be79effb9..30f4a16f8 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseResource.java @@ -33,8 +33,8 @@ import org.eclipse.team.internal.ccvs.core.util.Util; */ abstract class EclipseResource implements ICVSResource, Comparable { - // The separator that must be used when creating CVS resource paths. Never use - // the platform default separator since it is not compatible with CVS resources. + // The separator that must be used when creating CVS resource paths. Never use + // the platform default separator since it is not compatible with CVS resources. protected static final String SEPARATOR = Session.SERVER_SEPARATOR; protected static final String CURRENT_LOCAL_FOLDER = Session.CURRENT_LOCAL_FOLDER; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java index 11fdf0b81..fb010a389 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java @@ -148,10 +148,10 @@ public class EclipseSynchronizer implements IFlushOperation { */ public FolderSyncInfo getFolderSync(IContainer folder) throws CVSException { if (folder.getType() == IResource.ROOT || !isValid(folder)) return null; - // Do a check outside the lock for any folder sync info - FolderSyncInfo info = getSyncInfoCacheFor(folder).getCachedFolderSync(folder, false /* not thread safe */); - if (info != null) - return info; + // Do a check outside the lock for any folder sync info + FolderSyncInfo info = getSyncInfoCacheFor(folder).getCachedFolderSync(folder, false /* not thread safe */); + if (info != null) + return info; try { beginOperation(); cacheFolderSync(folder); @@ -262,10 +262,10 @@ public class EclipseSynchronizer implements IFlushOperation { public byte[] getSyncBytes(IResource resource) throws CVSException { IContainer parent = resource.getParent(); if (parent == null || parent.getType() == IResource.ROOT || !isValid(parent)) return null; - // Do a quick check outside the lock to see if there are sync butes for the resource. - byte[] info = getSyncInfoCacheFor(resource).getCachedSyncBytes(resource, false /* not thread safe */); - if (info != null) - return info; + // Do a quick check outside the lock to see if there are sync butes for the resource. + byte[] info = getSyncInfoCacheFor(resource).getCachedSyncBytes(resource, false /* not thread safe */); + if (info != null) + return info; try { beginOperation(); // cache resource sync for siblings, then return for self @@ -368,20 +368,20 @@ public class EclipseSynchronizer implements IFlushOperation { */ public boolean isIgnored(IResource resource) throws CVSException { if (resource.getType() == IResource.ROOT || - resource.getType() == IResource.PROJECT || - ! resource.exists()) { + resource.getType() == IResource.PROJECT || + ! resource.exists()) { return false; } IContainer parent = resource.getParent(); - FileNameMatcher matcher = sessionPropertyCache.getFolderIgnores(parent, false /* not thread safe */); - if (matcher == null) { - try { - beginOperation(); - matcher = cacheFolderIgnores(parent); - } finally { - endOperation(); - } - } + FileNameMatcher matcher = sessionPropertyCache.getFolderIgnores(parent, false /* not thread safe */); + if (matcher == null) { + try { + beginOperation(); + matcher = cacheFolderIgnores(parent); + } finally { + endOperation(); + } + } return matcher.match(resource.getName()); } @@ -499,10 +499,10 @@ public class EclipseSynchronizer implements IFlushOperation { */ public void endBatching(ISchedulingRule rule, IProgressMonitor monitor) throws CVSException { try { - resourceLock.release(rule, monitor); - } catch (TeamException e) { - throw CVSException.wrapException(e); - } + resourceLock.release(rule, monitor); + } catch (TeamException e) { + throw CVSException.wrapException(e); + } } /* @@ -532,21 +532,21 @@ public class EclipseSynchronizer implements IFlushOperation { */ private void beginOperation() { try { - // Do not try to acquire the lock if the resources tree is locked - // The reason for this is that during the resource delta phase (i.e. when the tree is locked) - // the workspace lock is held. If we obtain our lock, there is - // a chance of dealock. It is OK if we don't as we are still protected - // by scheduling rules and the workspace lock. - if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; - } catch (RuntimeException e) { - // If we are not active, throw a cancel. Otherwise, propogate it. - // (see bug 78303) - if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { - throw e; - } else { - throw new OperationCanceledException(); - } - } + // Do not try to acquire the lock if the resources tree is locked + // The reason for this is that during the resource delta phase (i.e. when the tree is locked) + // the workspace lock is held. If we obtain our lock, there is + // a chance of dealock. It is OK if we don't as we are still protected + // by scheduling rules and the workspace lock. + if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + } catch (RuntimeException e) { + // If we are not active, throw a cancel. Otherwise, propogate it. + // (see bug 78303) + if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { + throw e; + } else { + throw new OperationCanceledException(); + } + } lock.acquire(); } @@ -555,17 +555,17 @@ public class EclipseSynchronizer implements IFlushOperation { */ private void endOperation() { try { - // See beginOperation() for a description of why the lock is not obtained when the tree is locked - if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; - } catch (RuntimeException e) { - // If we are not active, throw a cancel. Otherwise, propogate it. - // (see bug 78303) - if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { - throw e; - } else { - throw new OperationCanceledException(); - } - } + // See beginOperation() for a description of why the lock is not obtained when the tree is locked + if (ResourcesPlugin.getWorkspace().isTreeLocked()) return; + } catch (RuntimeException e) { + // If we are not active, throw a cancel. Otherwise, propogate it. + // (see bug 78303) + if (Platform.getBundle(CVSProviderPlugin.ID).getState() == Bundle.ACTIVE) { + throw e; + } else { + throw new OperationCanceledException(); + } + } lock.release(); } @@ -595,8 +595,8 @@ public class EclipseSynchronizer implements IFlushOperation { // Flush changes to disk resourceLock.flush(Policy.subMonitorFor(monitor, 8)); } catch (TeamException e) { - throw CVSException.wrapException(e); - } finally { + throw CVSException.wrapException(e); + } finally { // Purge the in-memory cache sessionPropertyCache.purgeCache(root, deep); } @@ -638,55 +638,55 @@ public class EclipseSynchronizer implements IFlushOperation { public void ignoreFilesChanged(IContainer[] roots) throws CVSException { for (int i = 0; i < roots.length; i++) { IContainer container = roots[i]; - if (container.exists()) { - ISchedulingRule rule = null; - try { - Set<IResource> changed = new HashSet<>(); - rule = beginBatching(container, null); - try { - beginOperation(); - - // Record the previous ignore pattterns - FileNameMatcher oldIgnores = null; - if (sessionPropertyCache.isFolderSyncInfoCached(container)) { - oldIgnores = cacheFolderIgnores(container); - } - - // Purge the cached state for direct children of the container - changed.addAll(Arrays.asList( - sessionPropertyCache.purgeCache(container, oldIgnores == null /*flush deeply if the old patterns are not known*/))); - - // Purge the state for any children of previously ignored containers - if (oldIgnores != null) { - FileNameMatcher newIgnores = cacheFolderIgnores(container); - try { - IResource[] members = container.members(); - for (int j = 0; j < members.length; j++) { - IResource resource = members[j]; - if (resource.getType() == IResource.FOLDER) { - String name = resource.getName(); - if (oldIgnores.match(name) && !newIgnores.match(name)) { - changed.addAll(Arrays.asList( - sessionPropertyCache.purgeCache((IContainer)resource, true /*flush deeply*/))); - } - } - } - } catch (CoreException e) { - // Just log and continue - CVSProviderPlugin.log(e); - } - } - } finally { - endOperation(); - } - if (!changed.isEmpty()) { - ResourceStateChangeListeners.getListener().resourceSyncInfoChanged( - changed.toArray(new IResource[changed.size()])); - } - } finally { - if (rule != null) endBatching(rule, null); - } - } + if (container.exists()) { + ISchedulingRule rule = null; + try { + Set<IResource> changed = new HashSet<>(); + rule = beginBatching(container, null); + try { + beginOperation(); + + // Record the previous ignore pattterns + FileNameMatcher oldIgnores = null; + if (sessionPropertyCache.isFolderSyncInfoCached(container)) { + oldIgnores = cacheFolderIgnores(container); + } + + // Purge the cached state for direct children of the container + changed.addAll(Arrays.asList( + sessionPropertyCache.purgeCache(container, oldIgnores == null /*flush deeply if the old patterns are not known*/))); + + // Purge the state for any children of previously ignored containers + if (oldIgnores != null) { + FileNameMatcher newIgnores = cacheFolderIgnores(container); + try { + IResource[] members = container.members(); + for (int j = 0; j < members.length; j++) { + IResource resource = members[j]; + if (resource.getType() == IResource.FOLDER) { + String name = resource.getName(); + if (oldIgnores.match(name) && !newIgnores.match(name)) { + changed.addAll(Arrays.asList( + sessionPropertyCache.purgeCache((IContainer)resource, true /*flush deeply*/))); + } + } + } + } catch (CoreException e) { + // Just log and continue + CVSProviderPlugin.log(e); + } + } + } finally { + endOperation(); + } + if (!changed.isEmpty()) { + ResourceStateChangeListeners.getListener().resourceSyncInfoChanged( + changed.toArray(new IResource[changed.size()])); + } + } finally { + if (rule != null) endBatching(rule, null); + } + } } } @@ -954,9 +954,9 @@ public class EclipseSynchronizer implements IFlushOperation { IResource[] changedResources = threadInfo.getChangedResources(); IContainer[] changedFolders; if (threadInfo instanceof CVSThreadInfo) { - changedFolders = ((CVSThreadInfo)threadInfo).getChangedFolders(); + changedFolders = ((CVSThreadInfo)threadInfo).getChangedFolders(); } else { - changedFolders = new IContainer[0]; + changedFolders = new IContainer[0]; } Set<IContainer> dirtyParents = new HashSet<>(); for (int i = 0; i < changedResources.length; i++) { @@ -981,7 +981,7 @@ public class EclipseSynchronizer implements IFlushOperation { IContainer folder = changedFolders[i]; if (folder.exists() && folder.getType() != IResource.ROOT) { try { - beginOperation(); + beginOperation(); FolderSyncInfo info = sessionPropertyCache.getCachedFolderSync(folder, true); // Do not write the folder sync for linked resources if (info == null) { @@ -1002,8 +1002,8 @@ public class EclipseSynchronizer implements IFlushOperation { } errors.add(e.getStatus()); } finally { - endOperation(); - } + endOperation(); + } } monitor.worked(1); } @@ -1017,7 +1017,7 @@ public class EclipseSynchronizer implements IFlushOperation { if (folder.exists() && folder.getType() != IResource.ROOT) { // write sync info for all children in one go try { - beginOperation(); + beginOperation(); List<byte[]> infos = new ArrayList<>(); IResource[] children = folder.members(true); for (int i = 0; i < children.length; i++) { @@ -1046,8 +1046,8 @@ public class EclipseSynchronizer implements IFlushOperation { } errors.add(e.getStatus()); } finally { - endOperation(); - } + endOperation(); + } } monitor.worked(1); } @@ -1114,9 +1114,9 @@ public class EclipseSynchronizer implements IFlushOperation { } /** - * Sets the resource sync info for the resource; if null, deletes it. Parent - * must exist and must not be the workspace root. The resource sync info for - * the children of the parent container MUST ALREADY BE CACHED. + * Sets the resource sync info for the resource; if null, deletes it. Parent + * must exist and must not be the workspace root. The resource sync info for + * the children of the parent container MUST ALREADY BE CACHED. * * @param resource the resource * @param info the new resource sync info @@ -1523,10 +1523,10 @@ public class EclipseSynchronizer implements IFlushOperation { } protected String getDirtyIndicator(IResource resource) throws CVSException { - // Do a check outside the lock for the dirty indicator - String indicator = getSyncInfoCacheFor(resource).getDirtyIndicator(resource, false /* not thread safe */); - if (indicator != null) - return indicator; + // Do a check outside the lock for the dirty indicator + String indicator = getSyncInfoCacheFor(resource).getDirtyIndicator(resource, false /* not thread safe */); + if (indicator != null) + return indicator; try { beginOperation(); return getSyncInfoCacheFor(resource).getDirtyIndicator(resource, true); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java index 3a9b0e33f..f1521f44c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java @@ -40,23 +40,23 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.*; * use by the repository and sync view. */ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { - /* - * Listener for accumulating the entries fetched using the "cvs log" command - */ + /* + * Listener for accumulating the entries fetched using the "cvs log" command + */ private final class LogEntryListener implements ILogEntryListener { - private final List<ILogEntry> entries = new ArrayList<>(); - @Override + private final List<ILogEntry> entries = new ArrayList<>(); + @Override public void handleLogEntryReceived(ILogEntry entry) { - if (entry.getRemoteFile().getRepositoryRelativePath().equals(getRepositoryRelativePath())) { - entries.add(entry); - } - } - public ILogEntry[] getEntries() { - return entries.toArray(new ILogEntry[entries.size()]); - } - } + if (entry.getRemoteFile().getRepositoryRelativePath().equals(getRepositoryRelativePath())) { + entries.add(entry); + } + } + public ILogEntry[] getEntries() { + return entries.toArray(new ILogEntry[entries.size()]); + } + } - // sync info in byte form + // sync info in byte form private byte[] syncBytes; // cache the log entry for the remote file private ILogEntry entry; @@ -204,7 +204,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { private void internalFetchContents(IProgressMonitor monitor) throws CVSException { monitor.beginTask(CVSMessages.RemoteFile_getContents, 100); - monitor.subTask(CVSMessages.RemoteFile_getContents); + monitor.subTask(CVSMessages.RemoteFile_getContents); if (getRevision().equals(ResourceSyncInfo.ADDED_REVISION)) { // The revision of the remote file is not known so we need to use the tag to get the status of the file CVSTag tag = getSyncInfo().getTag(); @@ -242,7 +242,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { session.open(Policy.subMonitorFor(monitor, 10), false /* read-only */); try { try { - LogEntryListener listener = new LogEntryListener(); + LogEntryListener listener = new LogEntryListener(); IStatus status = Command.LOG.execute( session, Command.NO_GLOBAL_OPTIONS, @@ -423,7 +423,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { @Override public void setReadOnly(boolean readOnly) { // RemoteFiles are always read only - } + } @Override public boolean isReadOnly() { @@ -465,7 +465,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { * * The revision of the remote file is used as the base for the tagging operation */ - @Override + @Override public IStatus tag(final CVSTag tag, final LocalOption[] localOptions, IProgressMonitor monitor) throws CVSException { monitor = Policy.monitorFor(monitor); monitor.beginTask(null, 100); @@ -483,7 +483,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { } finally { session.close(); } - } + } @Override public boolean equals(Object target) { @@ -602,7 +602,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile { * @throws TeamException */ public void setContents(IFile file, IProgressMonitor monitor) throws TeamException, CoreException { - setContents(file.getContents(), monitor); + setContents(file.getContents(), monitor); } @Override diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java index 567c90813..8b5770dc4 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java @@ -412,9 +412,9 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC * @see ICVSRemoteFolder#setTag(String) */ public void setTag(CVSTag tag) { - MutableFolderSyncInfo newInfo = folderInfo.cloneMutable(); - newInfo.setTag(tag); - setFolderSyncInfo(newInfo); + MutableFolderSyncInfo newInfo = folderInfo.cloneMutable(); + newInfo.setTag(tag); + setFolderSyncInfo(newInfo); } @Override @@ -451,8 +451,8 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC } finally { session.close(); } - } - + } + @Override public ICVSResource[] fetchChildren(IProgressMonitor monitor) throws CVSException { try { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java index d6d297ffc..b2bf01607 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java @@ -175,10 +175,10 @@ public class RemoteFolderMemberFetcher implements IUpdateMessageListener, IStatu try { IPath path = this.parentFolder.getRelativePathFromRootRelativePath(commandRoot, new Path(null, stringPath)); if (path.segmentCount() == 1) { - String pathName = path.lastSegment(); - if (!pathName.equals(".")) { //$NON-NLS-1$ - recordFolder(path.lastSegment()); - } + String pathName = path.lastSegment(); + if (!pathName.equals(".")) { //$NON-NLS-1$ + recordFolder(path.lastSegment()); + } } } catch (CVSException e) { exceptions.add(e); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java index 4c2f3a2ae..6ff79882a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java @@ -126,7 +126,7 @@ public class RemoteFolderTreeBuilder { IProgressMonitor subProgress = Policy.infiniteSubMonitorFor(progress, 100); subProgress.beginTask(null, 512); subProgress.subTask(NLS.bind(CVSMessages.RemoteFolderTreeBuilder_buildingBase, new String[] { root.getName() })); - return builder.buildBaseTree(null, root, subProgress); + return builder.buildBaseTree(null, root, subProgress); } finally { progress.done(); } @@ -138,11 +138,11 @@ public class RemoteFolderTreeBuilder { public static RemoteFolderTree buildRemoteTree(CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, IProgressMonitor monitor) throws CVSException { RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, root, tag); - return builder.buildTree(new ICVSResource[] { root }, monitor); + return builder.buildTree(new ICVSResource[] { root }, monitor); } public static RemoteFile buildRemoteTree(CVSRepositoryLocation repository, ICVSFile file, CVSTag tag, IProgressMonitor monitor) throws CVSException { RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, file.getParent(), tag); - return builder.buildTree(file, monitor); + return builder.buildTree(file, monitor); } /* package */ RemoteFolderTree buildTree(ICVSResource[] resources, IProgressMonitor monitor) throws CVSException { @@ -215,24 +215,24 @@ public class RemoteFolderTreeBuilder { Session session; FolderSyncInfo folderSyncInfo = root.getFolderSyncInfo(); if (folderSyncInfo == null) { - // We've lost the mapping in the local workspace. - // This could be due to the project being deleted. - if (root.exists()) { - IResource resource = root.getIResource(); - String path; - if (resource == null) { - path = root.getName(); - } else { - path = resource.getFullPath().toString(); - } - IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolderTreeBuilder_0, new String[] { path }), root); - throw new CVSException(status); - } else { - // Just return. The remote tree will be null - return; - } + // We've lost the mapping in the local workspace. + // This could be due to the project being deleted. + if (root.exists()) { + IResource resource = root.getIResource(); + String path; + if (resource == null) { + path = root.getName(); + } else { + path = resource.getFullPath().toString(); + } + IStatus status = new CVSStatus(IStatus.ERROR, CVSStatus.ERROR, NLS.bind(CVSMessages.RemoteFolderTreeBuilder_0, new String[] { path }), root); + throw new CVSException(status); + } else { + // Just return. The remote tree will be null + return; + } } - remoteRoot = + remoteRoot = new RemoteFolderTree(null, root.getName(), repository, folderSyncInfo.getRepository(), tagForRemoteFolder(root, tag)); @@ -374,7 +374,7 @@ public class RemoteFolderTreeBuilder { // Create a remote folder tree corresponding to the local resource FolderSyncInfo folderSyncInfo = local.getFolderSyncInfo(); if (folderSyncInfo == null) return null; - RemoteFolder remote = createRemoteFolder(local, parent, folderSyncInfo); + RemoteFolder remote = createRemoteFolder(local, parent, folderSyncInfo); // Create a List to contain the created children List<RemoteResource> children = new ArrayList<>(); @@ -387,7 +387,7 @@ public class RemoteFolderTreeBuilder { monitor.worked(1); RemoteFolder tree = buildBaseTree(remote, folder, monitor); if (tree != null) - children.add(tree); + children.add(tree); } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java index 0877316bb..09935efe9 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java @@ -54,11 +54,11 @@ public class RemoteModule extends RemoteFolder { } } - private static ICVSFolder getRemoteRootFolder(ICVSRepositoryLocation repository) { - return new RemoteFolder(null, repository, "/", null); //$NON-NLS-1$ - } + private static ICVSFolder getRemoteRootFolder(ICVSRepositoryLocation repository) { + return new RemoteFolder(null, repository, "/", null); //$NON-NLS-1$ + } - /** + /** * Create a set of RemoteModules from the provided module definition strings returned from the server * * At the moment, we are very restrictive on the types of modules we support. @@ -191,7 +191,7 @@ public class RemoteModule extends RemoteFolder { // XXX Unsupported for now expandable = false; } else { - referencedFolders.add(child); + referencedFolders.add(child); } } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java index 33e526700..0af77ed00 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java @@ -62,13 +62,13 @@ public abstract class RemoteResource extends CachedResourceVariant implements IC public abstract ICVSRepositoryLocation getRepository(); - public int getWorkspaceSyncState() { - return workspaceSyncState; - } - - public void setWorkspaceSyncState(int workspaceSyncState) { - this.workspaceSyncState = workspaceSyncState; - } + public int getWorkspaceSyncState() { + return workspaceSyncState; + } + + public void setWorkspaceSyncState(int workspaceSyncState) { + this.workspaceSyncState = workspaceSyncState; + } public void delete() { // For now, do nothing but we could provide this in the future. @@ -92,7 +92,7 @@ public abstract class RemoteResource extends CachedResourceVariant implements IC public ICVSFolder getParent() { return parent; - } + } public boolean isIgnored() { return false; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java index 0c09bafc6..3ec9dc795 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SessionPropertySyncInfoCache.java @@ -82,10 +82,10 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter; } return matcher; } - - /* package */ boolean isIgnoresCached(IContainer container) throws CVSException { - return safeGetSessionProperty(container, IGNORE_SYNC_KEY) != null; - } + + /* package */ boolean isIgnoresCached(IContainer container) throws CVSException { + return safeGetSessionProperty(container, IGNORE_SYNC_KEY) != null; + } /*package*/ boolean isFolderSyncInfoCached(IContainer container) throws CVSException { Object info = safeGetSessionProperty(container, FOLDER_SYNC_KEY); @@ -115,9 +115,9 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter; */ FolderSyncInfo getCachedFolderSync(IContainer container, boolean threadSafeAccess) throws CVSException { FolderSyncInfo info = (FolderSyncInfo)safeGetSessionProperty(container, FOLDER_SYNC_KEY); - // If we are not thread safe, just return whatever was found in the session property - if (!threadSafeAccess) - return info == NULL_FOLDER_SYNC_INFO ? null : info; + // If we are not thread safe, just return whatever was found in the session property + if (!threadSafeAccess) + return info == NULL_FOLDER_SYNC_INFO ? null : info; if (info == null) { // Defer to the synchronizer in case the folder was recreated info = synchronizerCache.getCachedFolderSync(container, true); @@ -258,10 +258,10 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter; } else { di = RECOMPUTE_INDICATOR; } - // Only set the session property if we are thread safe - if (threadSafeAccess) { - setDirtyIndicator(container, di); - } + // Only set the session property if we are thread safe + if (threadSafeAccess) { + setDirtyIndicator(container, di); + } } return di; } catch (CoreException e) { @@ -306,8 +306,8 @@ import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter; byte[] getCachedSyncBytes(IResource resource, boolean threadSafeAccess) throws CVSException { byte[] bytes = (byte[])safeGetSessionProperty(resource, RESOURCE_SYNC_KEY); // If we are not thread safe, just return whatever was found in the session property - if (!threadSafeAccess) - return bytes; + if (!threadSafeAccess) + return bytes; if (bytes == null) { // Defer to the synchronizer in case the file was recreated bytes = synchronizerCache.getCachedSyncBytes(resource, true); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SyncInfoCache.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SyncInfoCache.java index 75077dfe5..2dcbbb1e2 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SyncInfoCache.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/SyncInfoCache.java @@ -54,7 +54,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; * holds a scheduling rule that encompasses the resource and the workspace is * open for modification. * @param container the container - * @param threadSafeAccess if false, the return value can only be used if not null + * @param threadSafeAccess if false, the return value can only be used if not null * @param canModifyWorkspace indicates if it is OK to modify the ISycnrhonizer * * @return the folder sync info for the folder, or null if none. diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java index 18280a3d2..c062b6a19 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java @@ -97,10 +97,10 @@ public class UpdateContentCachingService implements IUpdateMessageListener { // Handle execute try { if (executable) mFile.setExecutable(true); - } catch (CVSException e) { - // Just log and keep going - CVSProviderPlugin.log(e); - } + } catch (CVSException e) { + // Just log and keep going + CVSProviderPlugin.log(e); + } } } @@ -164,14 +164,14 @@ public class UpdateContentCachingService implements IUpdateMessageListener { IProgressMonitor subProgress = Policy.infiniteSubMonitorFor(progress, 100); subProgress.beginTask(null, 512); subProgress.subTask(NLS.bind(CVSMessages.RemoteFolderTreeBuilder_buildingBase, new String[] { root.getName() })); - RemoteFolder tree = builder.buildBaseTree(null, root, subProgress); - if (tree == null) { - // The local tree is empty and was pruned. - // Return the root folder so that the operation can proceed - FolderSyncInfo folderSyncInfo = root.getFolderSyncInfo(); - if (folderSyncInfo == null) return null; - return new RemoteFolderSandbox(null, root.getName(), repository, folderSyncInfo.getRepository(), folderSyncInfo.getTag(), folderSyncInfo.getIsStatic()); - } + RemoteFolder tree = builder.buildBaseTree(null, root, subProgress); + if (tree == null) { + // The local tree is empty and was pruned. + // Return the root folder so that the operation can proceed + FolderSyncInfo folderSyncInfo = root.getFolderSyncInfo(); + if (folderSyncInfo == null) return null; + return new RemoteFolderSandbox(null, root.getName(), repository, folderSyncInfo.getRepository(), folderSyncInfo.getTag(), folderSyncInfo.getIsStatic()); + } return tree; } finally { progress.done(); @@ -250,8 +250,8 @@ public class UpdateContentCachingService implements IUpdateMessageListener { private boolean isReportableError(IStatus status) { return CVSStatus.isInternalError(status) || status.getCode() == TeamException.UNABLE - || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH - || status.getCode() == CVSStatus.RESPONSE_HANDLING_FAILURE; + || status.getCode() == CVSStatus.INVALID_LOCAL_RESOURCE_PATH + || status.getCode() == CVSStatus.RESPONSE_HANDLING_FAILURE; } private LocalOption[] getLocalOptions() { diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java index 6b8ad8fec..d15e2158c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/CVSResourceVariantTree.java @@ -160,9 +160,9 @@ public class CVSResourceVariantTree extends ResourceVariantTree { bytes = null; } else { // Use the folder sync from the workspace and the tag from the store - MutableFolderSyncInfo newInfo = info.cloneMutable(); - newInfo.setTag(tag); - newInfo.setStatic(false); + MutableFolderSyncInfo newInfo = info.cloneMutable(); + newInfo.setTag(tag); + newInfo.setStatic(false); bytes = newInfo.getBytes(); } return bytes; @@ -206,42 +206,42 @@ public class CVSResourceVariantTree extends ResourceVariantTree { e); throw new CVSException(status); } - MutableFolderSyncInfo newInfo = info.cloneMutable(); - newInfo.setTag(tag); + MutableFolderSyncInfo newInfo = info.cloneMutable(); + newInfo.setTag(tag); ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IFolder)local); cvsFolder.setFolderSyncInfo(newInfo); } - if (remote == null && !isManaged(local)) { - // Do not record the lack of existence of a remote for unmanaged local files - // Instead, just flush the remote bytes if there are any - boolean changed = getByteStore().getBytes(local) != null; - flushVariants(local, IResource.DEPTH_ZERO); - return changed; - } else { - boolean changed = super.setVariant(local, remote); - if (local.getType() == IResource.FILE && getByteStore().getBytes(local) != null && !parentHasSyncBytes(local)) { - // Log a warning if there is no sync bytes available for the resource's - // parent but there is valid sync bytes for the child - CVSProviderPlugin.log(new TeamException(NLS.bind(CVSMessages.ResourceSynchronizer_missingParentBytesOnSet, new String[] { getSyncName(getByteStore()), local.getFullPath().toString() }))); - } - return changed; - } + if (remote == null && !isManaged(local)) { + // Do not record the lack of existence of a remote for unmanaged local files + // Instead, just flush the remote bytes if there are any + boolean changed = getByteStore().getBytes(local) != null; + flushVariants(local, IResource.DEPTH_ZERO); + return changed; + } else { + boolean changed = super.setVariant(local, remote); + if (local.getType() == IResource.FILE && getByteStore().getBytes(local) != null && !parentHasSyncBytes(local)) { + // Log a warning if there is no sync bytes available for the resource's + // parent but there is valid sync bytes for the child + CVSProviderPlugin.log(new TeamException(NLS.bind(CVSMessages.ResourceSynchronizer_missingParentBytesOnSet, new String[] { getSyncName(getByteStore()), local.getFullPath().toString() }))); + } + return changed; + } } private boolean isManaged(IResource local) { - try { - return CVSWorkspaceRoot.getCVSResourceFor(local).isManaged(); - } catch (CVSException e) { - return false; - } - } + try { + return CVSWorkspaceRoot.getCVSResourceFor(local).isManaged(); + } catch (CVSException e) { + return false; + } + } - private boolean parentHasSyncBytes(IResource resource) throws TeamException { + private boolean parentHasSyncBytes(IResource resource) throws TeamException { if (resource.getType() == IResource.PROJECT) return true; return getParentBytes(resource) != null; } - @Override + @Override protected IResource[] collectedMembers(IResource local, IResource[] members) throws TeamException { // Look for resources that have sync bytes but are not in the resources we care about IResource[] resources = getStoredMembers(local); @@ -307,17 +307,17 @@ public class CVSResourceVariantTree extends ResourceVariantTree { } count++; if (count >= 10) { - waitTime = 1000; + waitTime = 1000; } else if (count >= 5) { - waitTime = 100; + waitTime = 100; } Policy.checkCanceled(monitor); } try { changedResources = super.refresh(resource, depth, Policy.subMonitorFor(monitor, 99)); } catch (TeamException e) { - // Try to properly handle exceptions that are due to project modifications - // performed while the refresh was happening + // Try to properly handle exceptions that are due to project modifications + // performed while the refresh was happening if (!resource.getProject().isAccessible()) { // The project is closed so silently skip it return new IResource[0]; diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java index f0fe8866d..94c96483a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/DeferredResourceChangeHandler.java @@ -87,11 +87,11 @@ public class DeferredResourceChangeHandler extends BackgroundEventHandler { // Handle ignore file changes boolean workDone = !changedIgnoreFiles.isEmpty() || !recreatedResources.isEmpty(); try { - EclipseSynchronizer.getInstance().ignoreFilesChanged(getParents(changedIgnoreFiles)); - } catch (CVSException e) { - // Log and continue - CVSProviderPlugin.log(e); - } + EclipseSynchronizer.getInstance().ignoreFilesChanged(getParents(changedIgnoreFiles)); + } catch (CVSException e) { + // Log and continue + CVSProviderPlugin.log(e); + } changedIgnoreFiles.clear(); // Handle recreations by project to reduce locking granularity Map recreations = getResourcesByProject((IResource[]) recreatedResources.toArray(new IResource[recreatedResources.size()])); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java index 9cbc96c48..d58011df4 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/FolderSyncInfo.java @@ -39,14 +39,14 @@ public class FolderSyncInfo { protected String repository; // :pserver:user@host:/home/user/repo - protected String root; + protected String root; // sticky tag (e.g. version, date, or branch tag applied to folder) private CVSEntryLineTag tag; // if true then it means only part of the folder was fetched from the repository, and CVS will not create // additional files in that folder. - protected boolean isStatic; + protected boolean isStatic; /** * Construct a folder sync object. @@ -133,17 +133,17 @@ public class FolderSyncInfo { // If the username is missing, we have to find the third ':'. index = root.indexOf(CVSRepositoryLocation.COLON); if (index == 0) { - // This indicates that the conection method is present. - // It is surrounded by two colons so skip them. + // This indicates that the conection method is present. + // It is surrounded by two colons so skip them. index = root.indexOf(CVSRepositoryLocation.COLON, index + 1); index = root.indexOf(CVSRepositoryLocation.COLON, index + 1); } if (index == -1) { - // The host colon is missing. - // Look for a slash to find the path - index = root.indexOf(ResourceSyncInfo.SEPARATOR); - // Decrement the index since the slash is part of the path - if (index != -1) index--; + // The host colon is missing. + // Look for a slash to find the path + index = root.indexOf(ResourceSyncInfo.SEPARATOR); + // Decrement the index since the slash is part of the path + if (index != -1) index--; } } else { // If the username was there, we find the first ':' past the '@' @@ -323,7 +323,7 @@ public class FolderSyncInfo { return getRepository().equals(VIRTUAL_DIRECTORY); } - public FolderSyncInfo asImmutable() { - return this; - } + public FolderSyncInfo asImmutable() { + return this; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableFolderSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableFolderSyncInfo.java index e249a329a..a2939d737 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableFolderSyncInfo.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/MutableFolderSyncInfo.java @@ -47,15 +47,15 @@ public class MutableFolderSyncInfo extends FolderSyncInfo { this.repository = repository; } - public void setStatic(boolean isStatic) { - this.isStatic = isStatic; - } - - public FolderSyncInfo asImmutable() { - return new FolderSyncInfo(getRepository(), getRoot(), getTag(), getIsStatic()); - } + public void setStatic(boolean isStatic) { + this.isStatic = isStatic; + } + + public FolderSyncInfo asImmutable() { + return new FolderSyncInfo(getRepository(), getRoot(), getTag(), getIsStatic()); + } - public void setRoot(String root) { - this.root = root; - } + public void setRoot(String root) { + this.root = root; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java index 1cf5b283e..24e6bddc2 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ReentrantLock.java @@ -63,10 +63,10 @@ public class ReentrantLock extends BatchingLock { } @Override - protected ThreadInfo createThreadInfo(IFlushOperation operation) { - return new CVSThreadInfo(operation); - } - + protected ThreadInfo createThreadInfo(IFlushOperation operation) { + return new CVSThreadInfo(operation); + } + public void folderChanged(IContainer folder) { CVSThreadInfo info = (CVSThreadInfo)getThreadInfo(); Assert.isNotNull(info, "Folder changed outside of resource lock"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java index f578bbeed..3a3adc6e6 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/CVSDateFormatter.java @@ -80,8 +80,8 @@ public class CVSDateFormatter { * Timezone string is of the following format: [-|+]MMSS */ static private TimeZone getTimeZone(String dateFromServer) { - if (dateFromServer.lastIndexOf("0000") != -1) //$NON-NLS-1$ - return TimeZone.getTimeZone("GMT");//$NON-NLS-1$ + if (dateFromServer.lastIndexOf("0000") != -1) //$NON-NLS-1$ + return TimeZone.getTimeZone("GMT");//$NON-NLS-1$ String tz = null; StringBuffer resultTz = new StringBuffer("GMT");//$NON-NLS-1$ if (dateFromServer.indexOf("-") != -1) {//$NON-NLS-1$ diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java index c5f4a169d..3b9a11d28 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ResponsiveSocketFactory.java @@ -26,156 +26,156 @@ import org.eclipse.team.internal.ccvs.core.*; * Class copied from "org.eclipse.jsch.internal.core" */ public class ResponsiveSocketFactory { - private static final String JAVA_NET_PROXY="java.net.Proxy"; //$NON-NLS-1$ - private static final int DEFAULT_TIMEOUT=60; // Seconds - private IProgressMonitor monitor; - private final int timeout; - private static Class proxyClass; - private static boolean hasProxyClass = true; - public ResponsiveSocketFactory(IProgressMonitor monitor, int timeout) { - if (monitor == null) - monitor = new NullProgressMonitor(); - this.monitor = monitor; - this.timeout=timeout; - } - public Socket createSocket(String host, int port) throws IOException, UnknownHostException { - Socket socket = null; - socket = createSocket(host, port, timeout / 1000, monitor); - // Null out the monitor so we don't hold onto anything - // (i.e. the SSH2 session will keep a handle to the socket factory around - monitor = new NullProgressMonitor(); - // Set the socket timeout - socket.setSoTimeout(timeout); - return socket; - } - - /** - * Helper method that will time out when making a socket connection. - * This is required because there is no way to provide a timeout value - * when creating a socket and in some instances, they don't seem to - * timeout at all. - */ - private Socket createSocket(final String host, final int port, int timeout, IProgressMonitor monitor) throws UnknownHostException, IOException { - - // Start a thread to open a socket - final Socket[] socket = new Socket[] { null }; - final Exception[] exception = new Exception[] {null }; - final Thread thread = new Thread(() -> { - try { - Socket newSocket = internalCreateSocket(host, port); - synchronized (socket) { - if (Thread.interrupted()) { - // we we're either canceled or timed out so just close the socket - newSocket.close(); - } else { - socket[0] = newSocket; - } - } - } catch (UnknownHostException e1) { - exception[0] = e1; - } catch (IOException e2) { - exception[0] = e2; - } - }); - thread.start(); - - // Wait the appropriate number of seconds - if (timeout == 0) timeout = DEFAULT_TIMEOUT; - for (int i = 0; i < timeout; i++) { - try { - // wait for the thread to complete or 1 second, which ever comes first - thread.join(1000); - } catch (InterruptedException e) { - // I think this means the thread was interrupted but not necessarily timed out - // so we don't need to do anything - } - synchronized (socket) { - // if the user canceled, clean up before preempting the operation - if (monitor.isCanceled()) { - if (thread.isAlive()) { - thread.interrupt(); - } - if (socket[0] != null) { - socket[0].close(); - } - // this method will throw the proper exception - Policy.checkCanceled(monitor); - } - } - } - // If the thread is still running (i.e. we timed out) signal that it is too late - synchronized (socket) { - if (thread.isAlive()) { - thread.interrupt(); - } - } - if (exception[0] != null) { - if (exception[0] instanceof UnknownHostException) - throw (UnknownHostException)exception[0]; - else - throw (IOException)exception[0]; - } - if (socket[0] == null) { - throw new InterruptedIOException(NLS.bind(CVSMessages.Util_timeout, new String[] { host })); - } - return socket[0]; - } - - /* private */ Socket internalCreateSocket(final String host, final int port) - throws UnknownHostException, IOException{ - Class proxyClass = getProxyClass(); - if (proxyClass != null) { - // We need to disable proxy support for the socket - try{ - - // Obtain the value of the NO_PROXY static field of the proxy class - Field field = proxyClass.getField("NO_PROXY"); //$NON-NLS-1$ - Object noProxyObject = field.get(null); - Constructor constructor = Socket.class.getConstructor(new Class[] { proxyClass }); - Object o = constructor.newInstance(new Object[] { noProxyObject }); - if(o instanceof Socket){ - Socket socket=(Socket)o; - socket.connect(new InetSocketAddress(host, port), timeout * 1000); - return socket; - } - } - catch(SecurityException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(NoSuchFieldException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(IllegalArgumentException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(IllegalAccessException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(NoSuchMethodException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(InstantiationException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - catch(InvocationTargetException e){ - CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ - } - - } - return new Socket(host, port); - } - - private synchronized Class getProxyClass() { - if (hasProxyClass && proxyClass == null) { - try{ - proxyClass = Class.forName(JAVA_NET_PROXY); - } - catch(ClassNotFoundException e){ - // We couldn't find the class so we'll assume we are using pre-1.5 JRE - hasProxyClass = false; - } - } - return proxyClass; - } + private static final String JAVA_NET_PROXY="java.net.Proxy"; //$NON-NLS-1$ + private static final int DEFAULT_TIMEOUT=60; // Seconds + private IProgressMonitor monitor; + private final int timeout; + private static Class proxyClass; + private static boolean hasProxyClass = true; + public ResponsiveSocketFactory(IProgressMonitor monitor, int timeout) { + if (monitor == null) + monitor = new NullProgressMonitor(); + this.monitor = monitor; + this.timeout=timeout; + } + public Socket createSocket(String host, int port) throws IOException, UnknownHostException { + Socket socket = null; + socket = createSocket(host, port, timeout / 1000, monitor); + // Null out the monitor so we don't hold onto anything + // (i.e. the SSH2 session will keep a handle to the socket factory around + monitor = new NullProgressMonitor(); + // Set the socket timeout + socket.setSoTimeout(timeout); + return socket; + } + + /** + * Helper method that will time out when making a socket connection. + * This is required because there is no way to provide a timeout value + * when creating a socket and in some instances, they don't seem to + * timeout at all. + */ + private Socket createSocket(final String host, final int port, int timeout, IProgressMonitor monitor) throws UnknownHostException, IOException { + + // Start a thread to open a socket + final Socket[] socket = new Socket[] { null }; + final Exception[] exception = new Exception[] {null }; + final Thread thread = new Thread(() -> { + try { + Socket newSocket = internalCreateSocket(host, port); + synchronized (socket) { + if (Thread.interrupted()) { + // we we're either canceled or timed out so just close the socket + newSocket.close(); + } else { + socket[0] = newSocket; + } + } + } catch (UnknownHostException e1) { + exception[0] = e1; + } catch (IOException e2) { + exception[0] = e2; + } + }); + thread.start(); + + // Wait the appropriate number of seconds + if (timeout == 0) timeout = DEFAULT_TIMEOUT; + for (int i = 0; i < timeout; i++) { + try { + // wait for the thread to complete or 1 second, which ever comes first + thread.join(1000); + } catch (InterruptedException e) { + // I think this means the thread was interrupted but not necessarily timed out + // so we don't need to do anything + } + synchronized (socket) { + // if the user canceled, clean up before preempting the operation + if (monitor.isCanceled()) { + if (thread.isAlive()) { + thread.interrupt(); + } + if (socket[0] != null) { + socket[0].close(); + } + // this method will throw the proper exception + Policy.checkCanceled(monitor); + } + } + } + // If the thread is still running (i.e. we timed out) signal that it is too late + synchronized (socket) { + if (thread.isAlive()) { + thread.interrupt(); + } + } + if (exception[0] != null) { + if (exception[0] instanceof UnknownHostException) + throw (UnknownHostException)exception[0]; + else + throw (IOException)exception[0]; + } + if (socket[0] == null) { + throw new InterruptedIOException(NLS.bind(CVSMessages.Util_timeout, new String[] { host })); + } + return socket[0]; + } + + /* private */ Socket internalCreateSocket(final String host, final int port) + throws UnknownHostException, IOException{ + Class proxyClass = getProxyClass(); + if (proxyClass != null) { + // We need to disable proxy support for the socket + try{ + + // Obtain the value of the NO_PROXY static field of the proxy class + Field field = proxyClass.getField("NO_PROXY"); //$NON-NLS-1$ + Object noProxyObject = field.get(null); + Constructor constructor = Socket.class.getConstructor(new Class[] { proxyClass }); + Object o = constructor.newInstance(new Object[] { noProxyObject }); + if(o instanceof Socket){ + Socket socket=(Socket)o; + socket.connect(new InetSocketAddress(host, port), timeout * 1000); + return socket; + } + } + catch(SecurityException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(NoSuchFieldException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(IllegalArgumentException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(IllegalAccessException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(NoSuchMethodException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(InstantiationException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + catch(InvocationTargetException e){ + CVSProviderPlugin.log(IStatus.ERROR, NLS.bind("An internal error occurred while connecting to {0}", host), e); //$NON-NLS-1$ + } + + } + return new Socket(host, port); + } + + private synchronized Class getProxyClass() { + if (hasProxyClass && proxyClass == null) { + try{ + proxyClass = Class.forName(JAVA_NET_PROXY); + } + catch(ClassNotFoundException e){ + // We couldn't find the class so we'll assume we are using pre-1.5 JRE + hasProxyClass = false; + } + } + return proxyClass; + } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java index d589cf7ce..c04708776 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileChangeListener.java @@ -245,9 +245,9 @@ public class SyncFileChangeListener implements IResourceChangeListener { protected boolean isMetaFile(IResource resource) { IContainer parent = resource.getParent(); return resource.getType() == IResource.FILE && - parent!=null && - parent.getName().equals(SyncFileWriter.CVS_DIRNAME) && - (parent.isTeamPrivateMember() || !parent.exists()); + parent!=null && + parent.getName().equals(SyncFileWriter.CVS_DIRNAME) && + (parent.isTeamPrivateMember() || !parent.exists()); } /* diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java index ac943f1fb..b63bf4a2e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java @@ -70,12 +70,12 @@ public class SyncFileWriter { * If the folder does not have a CVS subdirectory then <code>null</code> is returned. */ public static byte[][] readAllResourceSync(IContainer parent) throws CVSException { - IFolder cvsSubDir = getCVSSubdirectory(parent); - - if (!folderExists(cvsSubDir)){ - return null; - } - + IFolder cvsSubDir = getCVSSubdirectory(parent); + + if (!folderExists(cvsSubDir)){ + return null; + } + if (Policy.DEBUG_METAFILE_CHANGES) { System.out.println("Reading Entries file for " + parent.getFullPath()); //$NON-NLS-1$ } @@ -126,14 +126,14 @@ public class SyncFileWriter { } private static boolean folderExists(IFolder cvsSubDir) throws CVSException { - try { - URI uri = cvsSubDir.getLocationURI(); - if (uri != null){ + try { + URI uri = cvsSubDir.getLocationURI(); + if (uri != null){ IFileStore store = EFS.getStore(uri); if (store != null){ return store.fetchInfo().exists(); } - } + } } catch (CoreException e) { throw CVSException.wrapException(e); } @@ -171,11 +171,11 @@ public class SyncFileWriter { public static FolderSyncInfo readFolderSync(IContainer folder) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(folder); - if (!folderExists(cvsSubDir)){ - return null; - } + if (!folderExists(cvsSubDir)){ + return null; + } - if (Policy.DEBUG_METAFILE_CHANGES) { + if (Policy.DEBUG_METAFILE_CHANGES) { System.out.println("Reading Root/Repository files for " + folder.getFullPath()); //$NON-NLS-1$ } @@ -328,10 +328,10 @@ public class SyncFileWriter { public static NotifyInfo[] readAllNotifyInfo(IContainer parent) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(parent); - if (!folderExists(cvsSubDir)){ - return null; - } - + if (!folderExists(cvsSubDir)){ + return null; + } + // process Notify file contents String[] entries = readLines(cvsSubDir.getFile(NOTIFY)); if (entries == null) return null; @@ -340,13 +340,13 @@ public class SyncFileWriter { String line = entries[i]; if(!"".equals(line)) { //$NON-NLS-1$ try { - NotifyInfo info = new NotifyInfo(parent, line); - infos.put(info.getName(), info); - } catch (CVSException e) { - // We couldn't parse the notify info - // Log it and ignore - CVSProviderPlugin.log(e); - } + NotifyInfo info = new NotifyInfo(parent, line); + infos.put(info.getName(), info); + } catch (CVSException e) { + // We couldn't parse the notify info + // Log it and ignore + CVSProviderPlugin.log(e); + } } } @@ -393,11 +393,11 @@ public class SyncFileWriter { */ public static BaserevInfo[] readAllBaserevInfo(IContainer parent) throws CVSException { IFolder cvsSubDir = getCVSSubdirectory(parent); - - if (!folderExists(cvsSubDir)){ - return null; - } - + + if (!folderExists(cvsSubDir)){ + return null; + } + // process Notify file contents String[] entries = readLines(cvsSubDir.getFile(BASEREV)); if (entries == null) return null; @@ -504,8 +504,8 @@ public class SyncFileWriter { } finally { reader.close(); } - } - return null; + } + return null; } catch (IOException e) { throw CVSException.wrapException(e); } catch (CoreException e) { @@ -524,7 +524,7 @@ public class SyncFileWriter { private static InputStream getInputStream(IFile file) throws CoreException, FileNotFoundException { if (file.exists()) { - return file.getContents(true); + return file.getContents(true); } URI uri = file.getLocationURI(); @@ -692,11 +692,11 @@ public class SyncFileWriter { if (attrs != null && attrs.isReadOnly() != readOnly) { attrs.setReadOnly(readOnly); try { - source.setResourceAttributes(attrs); - } catch (CoreException e) { - // Just log the failure since the move may succeed anyway - CVSProviderPlugin.log(e); - } + source.setResourceAttributes(attrs); + } catch (CoreException e) { + // Just log the failure since the move may succeed anyway + CVSProviderPlugin.log(e); + } } } |