From c20491c79b80fb5de5ea54bfa9b327c94a9a0bf2 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 7 Mar 2002 15:22:35 +0000 Subject: Slam CR/LF on all files --- bundles/org.eclipse.team.cvs.core/about.html | 184 +- .../org.eclipse.team.cvs.core/buildnotes_cvs.html | 230 +- bundles/org.eclipse.team.cvs.core/doc/hglegal.htm | 28 +- .../doc/org_eclipse_team_cvs_core.html | 30 +- .../org.eclipse.team.cvs.core/plugin.properties | 2 +- bundles/org.eclipse.team.cvs.core/plugin.xml | 120 +- .../eclipse/team/internal/ccvs/core/CVSTag.java | 152 +- .../team/internal/ccvs/core/ICVSRemoteFile.java | 74 +- .../team/internal/ccvs/core/IConnectionMethod.java | 62 +- .../team/internal/ccvs/core/IServerConnection.java | 2 +- .../eclipse/team/internal/ccvs/core/IUserInfo.java | 66 +- .../ccvs/core/resources/CVSEntryLineTag.java | 116 +- .../ccvs/core/resources/CVSLocalSyncElement.java | 266 +-- .../ccvs/core/resources/CVSRemoteSyncElement.java | 634 ++--- .../ccvs/core/util/AssertionFailedException.java | 56 +- .../team/internal/ccvs/core/util/FileUtil.java | 74 +- bundles/org.eclipse.team.cvs.ssh/about.html | 206 +- bundles/org.eclipse.team.cvs.ssh/plugin.xml | 60 +- .../eclipse/team/internal/ccvs/ssh/Blowfish.java | 2428 ++++++++++---------- .../team/internal/ccvs/ssh/ClientPacket.java | 94 +- .../org/eclipse/team/internal/ccvs/ssh/Packet.java | 28 +- .../eclipse/team/internal/ccvs/ssh/SSHPlugin.java | 2 +- bundles/org.eclipse.team.cvs.ui/about.html | 82 +- bundles/org.eclipse.team.cvs.ui/plugin.xml | 756 +++--- .../internal/ccvs/ui/CVSCompareEditorInput.java | 712 +++--- .../team/internal/ccvs/ui/CVSResourceNode.java | 182 +- .../team/internal/ccvs/ui/ResourceEditionNode.java | 318 +-- .../internal/ccvs/ui/model/BranchCategory.java | 2 +- .../ccvs/ui/sync/CVSCatchupReleaseViewer.java | 542 ++--- .../internal/ccvs/ui/sync/CVSSyncCompareInput.java | 220 +- .../ccvs/ui/sync/ToolTipMessageDialog.java | 44 +- bundles/org.eclipse.team.ui/README | 24 +- bundles/org.eclipse.team.ui/about.html | 82 +- bundles/org.eclipse.team.ui/doc/hglegal.htm | 28 +- .../doc/org_eclipse_team_ui.html | 60 +- .../org_eclipse_team_ui_configurationWizards.html | 122 +- .../doc/org_eclipse_team_ui_decorators.html | 110 +- bundles/org.eclipse.team.ui/plugin.xml | 200 +- .../internal/ui/ConfigurationWizardElement.java | 274 +-- .../team/internal/ui/ConfigurationWizardNode.java | 130 +- .../team/internal/ui/TextPreferencePage.java | 2 +- .../org/eclipse/team/ui/IConfigurationWizard.java | 60 +- .../src/org/eclipse/team/ui/ISharedImages.java | 42 +- .../src/org/eclipse/team/ui/sync/SyncView.java | 4 +- tests/org.eclipse.team.tests.cvs.core/.vcm_meta | 38 +- .../resources/BenchmarkTest/benchmarkBig.zip | Bin 2571357 -> 2571283 bytes .../resources/BenchmarkTest/benchmarkSmall.zip | Bin 213162 -> 213154 bytes .../resources/CommandTest/CVSROOT/modules | 128 +- .../resources/CommandTest/common/docs/readme.html | 2 +- 49 files changed, 4539 insertions(+), 4539 deletions(-) diff --git a/bundles/org.eclipse.team.cvs.core/about.html b/bundles/org.eclipse.team.cvs.core/about.html index 05fb15c44..833a8b7e9 100644 --- a/bundles/org.eclipse.team.cvs.core/about.html +++ b/bundles/org.eclipse.team.cvs.core/about.html @@ -1,93 +1,93 @@ - - -About - - - - - - - - -
About This Content
-

11th December, 2001

-

License

-

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

- -

Third Party Content

- -

The Content includes items that have been sourced from third parties as follows:

- -

Ant 1.4.1

-

The plug-in is based on software developed by The Apache Software Foundation as part of the Jakarta project.

- -

The class PServerConnection "Ant Derivative Work" contained in teamcvs.jar and teamcvssrc.zip is based on Ant code.

- -

The Ant Derivative Work is:

- -
Copyright (c) 1999 The Apache Software Foundation. All rights reserved.
- -

Your use of the Ant Derivative Work, is subject to the terms and conditions of the -Apache Software License 1.1. -More specifically:

-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of
- conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must include the
- following acknowledgment:
-
- "This product includes software developed by the Apache Software Foundation
- (http://www.apache.org/)." -
- Alternately, this acknowledgment may appear in the software itself, if and wherever such
- third-party acknowledgments normally appear.
-
- 4. The names "Ant" and "Apache Software Foundation" must not be used to endorse or
- promote products derived from this software without prior written permission. For written
- permission, please contact apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may "Apache" appear
- in their name, without prior written permission of the Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -
- -

Contributions

- -

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

- -

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or -other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.

-
- + + +About + + + + + + + + +
About This Content
+

11th December, 2001

+

License

+

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

+ +

Third Party Content

+ +

The Content includes items that have been sourced from third parties as follows:

+ +

Ant 1.4.1

+

The plug-in is based on software developed by The Apache Software Foundation as part of the Jakarta project.

+ +

The class PServerConnection "Ant Derivative Work" contained in teamcvs.jar and teamcvssrc.zip is based on Ant code.

+ +

The Ant Derivative Work is:

+ +
Copyright (c) 1999 The Apache Software Foundation. All rights reserved.
+ +

Your use of the Ant Derivative Work, is subject to the terms and conditions of the +Apache Software License 1.1. +More specifically:

+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of
+ conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must include the
+ following acknowledgment:
+
+ "This product includes software developed by the Apache Software Foundation
+ (http://www.apache.org/)." +
+ Alternately, this acknowledgment may appear in the software itself, if and wherever such
+ third-party acknowledgments normally appear.
+
+ 4. The names "Ant" and "Apache Software Foundation" must not be used to endorse or
+ promote products derived from this software without prior written permission. For written
+ permission, please contact apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may "Apache" appear
+ in their name, without prior written permission of the Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +
+ +

Contributions

+ +

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise +made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such +Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

+ +

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or +other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the +host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available +to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also +providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of +the CPL.

+
+ \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/buildnotes_cvs.html b/bundles/org.eclipse.team.cvs.core/buildnotes_cvs.html index 4212066a2..2c27755cd 100644 --- a/bundles/org.eclipse.team.cvs.core/buildnotes_cvs.html +++ b/bundles/org.eclipse.team.cvs.core/buildnotes_cvs.html @@ -13,122 +13,122 @@ Eclipse Platform Release Notes - VCM - - diff --git a/bundles/org.eclipse.team.cvs.core/doc/hglegal.htm b/bundles/org.eclipse.team.cvs.core/doc/hglegal.htm index b071dbdf4..c59811321 100644 --- a/bundles/org.eclipse.team.cvs.core/doc/hglegal.htm +++ b/bundles/org.eclipse.team.cvs.core/doc/hglegal.htm @@ -1,14 +1,14 @@ - - - - - - Legal Notices - - - -

-Notices

-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. - - + + + + + + Legal Notices + + + +

+Notices

+(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. + + diff --git a/bundles/org.eclipse.team.cvs.core/doc/org_eclipse_team_cvs_core.html b/bundles/org.eclipse.team.cvs.core/doc/org_eclipse_team_cvs_core.html index 521e209dd..cb91e1cda 100644 --- a/bundles/org.eclipse.team.cvs.core/doc/org_eclipse_team_cvs_core.html +++ b/bundles/org.eclipse.team.cvs.core/doc/org_eclipse_team_cvs_core.html @@ -1,15 +1,15 @@ - - - - - - Eclipse CVS Core Extension Points - - - -

Eclipse CVS Core

-The extension points declared by this plug-in are for internal use only. -

-Copyright IBM Corp. 2000, 2001 - - + + + + + + Eclipse CVS Core Extension Points + + + +

Eclipse CVS Core

+The extension points declared by this plug-in are for internal use only. +

+Copyright IBM Corp. 2000, 2001 + + diff --git a/bundles/org.eclipse.team.cvs.core/plugin.properties b/bundles/org.eclipse.team.cvs.core/plugin.properties index 5f8281e6f..aaa56cf85 100644 --- a/bundles/org.eclipse.team.cvs.core/plugin.properties +++ b/bundles/org.eclipse.team.cvs.core/plugin.properties @@ -1,2 +1,2 @@ -pluginName = CVS Team Provider +pluginName = CVS Team Provider cvsNature=CVS Team Nature \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml index 072b9dedf..462a77d2a 100644 --- a/bundles/org.eclipse.team.cvs.core/plugin.xml +++ b/bundles/org.eclipse.team.cvs.core/plugin.xml @@ -1,61 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java index 610b4b87b..1ffc83cbc 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java @@ -1,77 +1,77 @@ -package org.eclipse.team.ccvs.core; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.internal.ccvs.core.Policy; - -/** - * A tag in CVS gives a label to a collection of revisions. The labels can represent a version, a branch, - * or a date. - */ -public class CVSTag { - - public final static int HEAD = 0; - public final static int BRANCH = 1; - public final static int VERSION = 2; - public final static int DATE = 3; - - public static final CVSTag DEFAULT = new CVSTag(); - - protected String name; - protected int type; - - public CVSTag() { - this("HEAD", HEAD); //$NON-NLS-1$ - } - - public CVSTag(String name, int type) { - this.name = name; - this.type = type; - } - - public boolean equals(Object other) { - if(other == this) return true; - if (!(other instanceof CVSTag)) return false; - - CVSTag tag = ((CVSTag)other); - if (getType() != tag.getType()) return false; - if (!getName().equals(tag.getName())) return false; - return true; - } - - public String getName() { - return name; - } - - public int getType() { - return type; - } - - public int hashCode() { - return name.hashCode(); - } - - public int compareTo(CVSTag other) { - return getName().compareTo(other.getName()); - } - - public static IStatus validateTagName(String tagName) { - if (tagName == null) - return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.nullName")); //$NON-NLS-1$ - if (tagName.equals("")) //$NON-NLS-1$ - return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.emptyName")); //$NON-NLS-1$ - if (!Character. isLetter(tagName.charAt(0))) - return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.beginName")); //$NON-NLS-1$ - - for (int i = 0; i < tagName.length(); i++) { - char c = tagName.charAt(i); - if ( Character.isSpaceChar(c) || c == '$' || c == ',' || c == '.' || c == ':' || c == ';' || c == '@' || c == '|') - return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.badCharName")); //$NON-NLS-1$ - } - return new CVSStatus(CVSStatus.OK, Policy.bind("ok")); //$NON-NLS-1$ - } +package org.eclipse.team.ccvs.core; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.team.internal.ccvs.core.Policy; + +/** + * A tag in CVS gives a label to a collection of revisions. The labels can represent a version, a branch, + * or a date. + */ +public class CVSTag { + + public final static int HEAD = 0; + public final static int BRANCH = 1; + public final static int VERSION = 2; + public final static int DATE = 3; + + public static final CVSTag DEFAULT = new CVSTag(); + + protected String name; + protected int type; + + public CVSTag() { + this("HEAD", HEAD); //$NON-NLS-1$ + } + + public CVSTag(String name, int type) { + this.name = name; + this.type = type; + } + + public boolean equals(Object other) { + if(other == this) return true; + if (!(other instanceof CVSTag)) return false; + + CVSTag tag = ((CVSTag)other); + if (getType() != tag.getType()) return false; + if (!getName().equals(tag.getName())) return false; + return true; + } + + public String getName() { + return name; + } + + public int getType() { + return type; + } + + public int hashCode() { + return name.hashCode(); + } + + public int compareTo(CVSTag other) { + return getName().compareTo(other.getName()); + } + + public static IStatus validateTagName(String tagName) { + if (tagName == null) + return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.nullName")); //$NON-NLS-1$ + if (tagName.equals("")) //$NON-NLS-1$ + return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.emptyName")); //$NON-NLS-1$ + if (!Character. isLetter(tagName.charAt(0))) + return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.beginName")); //$NON-NLS-1$ + + for (int i = 0; i < tagName.length(); i++) { + char c = tagName.charAt(i); + if ( Character.isSpaceChar(c) || c == '$' || c == ',' || c == '.' || c == ':' || c == ';' || c == '@' || c == '|') + return new CVSStatus(CVSStatus.ERROR, Policy.bind("CVSTag.badCharName")); //$NON-NLS-1$ + } + return new CVSStatus(CVSStatus.OK, Policy.bind("ok")); //$NON-NLS-1$ + } } \ No newline at end of file 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 3f815061e..a150af4e2 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 @@ -1,37 +1,37 @@ -package org.eclipse.team.ccvs.core; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.io.InputStream; - -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. - */ -public interface ICVSRemoteFile extends ICVSRemoteResource { - - /** - * Get the log entries of the remote file - */ - public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws TeamException; - - /** - * Get the revision of the remote file (e.g. 1.1) - * - * The revision depends on any tagging associated with the remote parent used - * to access the file. - */ - public String getRevision() throws TeamException; -} - +package org.eclipse.team.ccvs.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.io.InputStream; + +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. + */ +public interface ICVSRemoteFile extends ICVSRemoteResource { + + /** + * Get the log entries of the remote file + */ + public ILogEntry[] getLogEntries(IProgressMonitor monitor) throws TeamException; + + /** + * Get the revision of the remote file (e.g. 1.1) + * + * The revision depends on any tagging associated with the remote parent used + * to access the file. + */ + public String getRevision() throws TeamException; +} + diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IConnectionMethod.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IConnectionMethod.java index f2346ddf9..81d122db8 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IConnectionMethod.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IConnectionMethod.java @@ -1,31 +1,31 @@ -package org.eclipse.team.ccvs.core; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -/** - * Implementators of this class can act as factories for creating connections to a CVS server - * with the desired custom communication protocol. Providers of CVS connection methods must implement - * this interface and register the implementation with the extension point: - * - * org.eclipse.team.cvs.core.connectionmethods - * - * The createConnection() method will be invoked by the CVS client when the user - * is attempting to make a connection to the server using the connection name which matches - * the String returned by getName() (e.g. "pserver", "ext", etc.). - */ -public interface IConnectionMethod { - - /** - * Returns the name of this connection method (e.g."local", "ext"). - */ - public String getName(); - - /** - * Creates a new server connection using the given repository root - * (which includes the user name) and the given password. - */ - public IServerConnection createConnection(ICVSRepositoryLocation location, String password); -} +package org.eclipse.team.ccvs.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +/** + * Implementators of this class can act as factories for creating connections to a CVS server + * with the desired custom communication protocol. Providers of CVS connection methods must implement + * this interface and register the implementation with the extension point: + * + * org.eclipse.team.cvs.core.connectionmethods + * + * The createConnection() method will be invoked by the CVS client when the user + * is attempting to make a connection to the server using the connection name which matches + * the String returned by getName() (e.g. "pserver", "ext", etc.). + */ +public interface IConnectionMethod { + + /** + * Returns the name of this connection method (e.g."local", "ext"). + */ + public String getName(); + + /** + * Creates a new server connection using the given repository root + * (which includes the user name) and the given password. + */ + public IServerConnection createConnection(ICVSRepositoryLocation location, String password); +} diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IServerConnection.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IServerConnection.java index 95b8fe472..62fc1ab9a 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IServerConnection.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IServerConnection.java @@ -1 +1 @@ -package org.eclipse.team.ccvs.core; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException; /** * CVS supports different connection methods for communicating between a client and the server. * Furthermore, custom connection methods can be added. Connection methods are added * to the CVS client as an IConnectionMethod, which can be used to create connections of * type IServerConnection. * * @see IConnectionMethod */ public interface IServerConnection { /** * Open a connection to the CVS server. * * Throw CVSAuthenticationException if the username or password is invalid. * Throw IOExceptions for other failures. */ public void open(IProgressMonitor monitor) throws IOException, CVSAuthenticationException; /** * Close the connection * * Throw IOException on failures */ public void close() throws IOException; /** * Get the input stream to receive responses from the server */ public InputStream getInputStream(); /** * Get the output stream to send requests to the server */ public OutputStream getOutputStream(); } \ No newline at end of file +package org.eclipse.team.ccvs.core; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException; /** * CVS supports different connection methods for communicating between a client and the server. * Furthermore, custom connection methods can be added. Connection methods are added * to the CVS client as an IConnectionMethod, which can be used to create connections of * type IServerConnection. * * @see IConnectionMethod */ public interface IServerConnection { /** * Open a connection to the CVS server. * * Throw CVSAuthenticationException if the username or password is invalid. * Throw IOExceptions for other failures. */ public void open(IProgressMonitor monitor) throws IOException, CVSAuthenticationException; /** * Close the connection * * Throw IOException on failures */ public void close() throws IOException; /** * Get the input stream to receive responses from the server */ public InputStream getInputStream(); /** * Get the output stream to send requests to the server */ public OutputStream getOutputStream(); } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserInfo.java index 6725306a8..4f060706b 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserInfo.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/IUserInfo.java @@ -1,34 +1,34 @@ -package org.eclipse.team.ccvs.core; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -/** - * Instances of this class represent a username password pair. - * Both values can be set and the username can be retrieved. - * However, it is possible that the username is not mutable. - * Users must check before trying to set the username. - * - * Clients are not expected to implement this interface - */ -public interface IUserInfo { - /** - * Get the username for this user. - */ - public String getUsername(); - /** - * Return true if the username is mutable. If not, setUsername should not be called. - */ - public boolean isUsernameMutable(); - /** - * Sets the password for this user. - */ - public void setPassword(String password); - /** - * Sets the username for this user. This should not be called if - * isUsernameMutable() returns false. - */ - public void setUsername(String username); +package org.eclipse.team.ccvs.core; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +/** + * Instances of this class represent a username password pair. + * Both values can be set and the username can be retrieved. + * However, it is possible that the username is not mutable. + * Users must check before trying to set the username. + * + * Clients are not expected to implement this interface + */ +public interface IUserInfo { + /** + * Get the username for this user. + */ + public String getUsername(); + /** + * Return true if the username is mutable. If not, setUsername should not be called. + */ + public boolean isUsernameMutable(); + /** + * Sets the password for this user. + */ + public void setPassword(String password); + /** + * Sets the username for this user. This should not be called if + * isUsernameMutable() returns false. + */ + public void setUsername(String username); } \ 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 f097f1b00..54cd2595c 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 @@ -1,58 +1,58 @@ -package org.eclipse.team.internal.ccvs.core.resources; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.team.ccvs.core.CVSTag; - -public class CVSEntryLineTag extends CVSTag { - - /* - * The parameter tag must not be null. - */ - public CVSEntryLineTag(CVSTag tag) { - super(tag.getName(), tag.getType()); - } - - public CVSEntryLineTag(String entryLineTag) { - switch (entryLineTag.charAt(0)) { - case 'T' : type = BRANCH; break; - case 'N' : type = VERSION; break; - case 'D' : type = DATE; break; - default: type = HEAD; - } - name = entryLineTag.substring(1); - } - /* - * Returns the tag name - */ - public String getName() { - return name; - } - /* - * Returns the tag type - */ - public int getType() { - return type; - } - - public String toEntryLineFormat(boolean useSamePrefixForBranchAndTag) { - if (type == BRANCH || (type == VERSION && useSamePrefixForBranchAndTag)) - return "T" + name;//$NON-NLS-1$ - else if (type == VERSION) - return "N" + name;//$NON-NLS-1$ - else if (type == DATE) - return "D" + name;//$NON-NLS-1$ - return "";//$NON-NLS-1$ - } - - public boolean equals(Object obj) { - // We assume, that the name and type can not be null - if (obj == this) return true; - if (!(obj instanceof CVSEntryLineTag)) return false; - return (type == ((CVSEntryLineTag)obj).type) && name.equals(((CVSEntryLineTag)obj).name); - } -} - +package org.eclipse.team.internal.ccvs.core.resources; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.team.ccvs.core.CVSTag; + +public class CVSEntryLineTag extends CVSTag { + + /* + * The parameter tag must not be null. + */ + public CVSEntryLineTag(CVSTag tag) { + super(tag.getName(), tag.getType()); + } + + public CVSEntryLineTag(String entryLineTag) { + switch (entryLineTag.charAt(0)) { + case 'T' : type = BRANCH; break; + case 'N' : type = VERSION; break; + case 'D' : type = DATE; break; + default: type = HEAD; + } + name = entryLineTag.substring(1); + } + /* + * Returns the tag name + */ + public String getName() { + return name; + } + /* + * Returns the tag type + */ + public int getType() { + return type; + } + + public String toEntryLineFormat(boolean useSamePrefixForBranchAndTag) { + if (type == BRANCH || (type == VERSION && useSamePrefixForBranchAndTag)) + return "T" + name;//$NON-NLS-1$ + else if (type == VERSION) + return "N" + name;//$NON-NLS-1$ + else if (type == DATE) + return "D" + name;//$NON-NLS-1$ + return "";//$NON-NLS-1$ + } + + public boolean equals(Object obj) { + // We assume, that the name and type can not be null + if (obj == this) return true; + if (!(obj instanceof CVSEntryLineTag)) return false; + return (type == ((CVSEntryLineTag)obj).type) && name.equals(((CVSEntryLineTag)obj).name); + } +} + diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java index f8af2d450..479fda922 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java @@ -1,134 +1,134 @@ -package org.eclipse.team.internal.ccvs.core.resources; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.ccvs.core.*; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.LocalSyncElement; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; - -public class CVSLocalSyncElement extends LocalSyncElement { - - protected IRemoteResource base; - protected IResource local; - - public CVSLocalSyncElement(IResource local, IRemoteResource base) { - this.local = local; - this.base = base; - } - - /* - * @see RemoteSyncElement#create(IResource, IRemoteResource, IRemoteResource) - */ - public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) { - return new CVSLocalSyncElement(local, base); - } - - /* - * @see ILocalSyncElement#getLocal() - */ - public IResource getLocal() { - return local; - } - - /* - * @see ILocalSyncElement#getBase() - */ - public IRemoteResource getBase() { - return base; - } - - /* - * @see ILocalSyncElement#isDirty() - */ - public boolean isDirty() { - ICVSResource cvsResource = getCVSResourceFor(getLocal()); - if(cvsResource == null) { - return false; - } else { - // a folder is dirty if it is managed but is not a CVS folder. This can - // easily happen if someone deletes a folder from the file system but - // doesn't unmanage it. - if(cvsResource.isFolder()) { - return false; - } else { - try { - ResourceSyncInfo info = cvsResource.getSyncInfo(); - if(info==null) { - return false; - } - if(base!=null) { - boolean sameRevisions = ((RemoteFile)base).getRevision().equals(info.getRevision()); - if(!sameRevisions) { - return true; - } - } - return ((ICVSFile)cvsResource).isDirty(); - } catch(CVSException e) { - return true; - } - } - } - } - - /* - * @see ILocalSyncElement#isCheckedOut() - */ - public boolean isCheckedOut() { - return getLocal() != null; - } - - /* - * @see ILocalSyncElement#hasRemote() - */ - public boolean hasRemote() { - return getLocal() != null; - } - - /* - * @see RemoteSyncElement#getData() - */ - protected Object getData() { - return null; - } - - /* - * Answers the CVS resource for this sync element - */ - public ICVSResource getCVSResource() { - return getCVSResourceFor(getLocal()); - } - - /* - * @see LocalSyncElement#isIgnored(IResource) - */ - protected boolean isIgnored(IResource child) { - ICVSResource cvsResource = getCVSResourceFor(getLocal()); - if(cvsResource==null || !cvsResource.isFolder() ) { - return false; - } else { - try { - ICVSResource managedChild = ((ICVSFolder)cvsResource).getChild(child.getName()); - return managedChild.isIgnored(); - } catch(CVSException e) { - return false; - } - } - } - - private ICVSResource getCVSResourceFor(IResource resource) { - if(resource.getType() != IResource.FILE) { - return new EclipseFolder((IContainer)resource); - } else { - return new EclipseFile((IFile)resource); - } - } +package org.eclipse.team.internal.ccvs.core.resources; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.team.ccvs.core.*; +import org.eclipse.team.core.sync.ILocalSyncElement; +import org.eclipse.team.core.sync.IRemoteResource; +import org.eclipse.team.core.sync.LocalSyncElement; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; + +public class CVSLocalSyncElement extends LocalSyncElement { + + protected IRemoteResource base; + protected IResource local; + + public CVSLocalSyncElement(IResource local, IRemoteResource base) { + this.local = local; + this.base = base; + } + + /* + * @see RemoteSyncElement#create(IResource, IRemoteResource, IRemoteResource) + */ + public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) { + return new CVSLocalSyncElement(local, base); + } + + /* + * @see ILocalSyncElement#getLocal() + */ + public IResource getLocal() { + return local; + } + + /* + * @see ILocalSyncElement#getBase() + */ + public IRemoteResource getBase() { + return base; + } + + /* + * @see ILocalSyncElement#isDirty() + */ + public boolean isDirty() { + ICVSResource cvsResource = getCVSResourceFor(getLocal()); + if(cvsResource == null) { + return false; + } else { + // a folder is dirty if it is managed but is not a CVS folder. This can + // easily happen if someone deletes a folder from the file system but + // doesn't unmanage it. + if(cvsResource.isFolder()) { + return false; + } else { + try { + ResourceSyncInfo info = cvsResource.getSyncInfo(); + if(info==null) { + return false; + } + if(base!=null) { + boolean sameRevisions = ((RemoteFile)base).getRevision().equals(info.getRevision()); + if(!sameRevisions) { + return true; + } + } + return ((ICVSFile)cvsResource).isDirty(); + } catch(CVSException e) { + return true; + } + } + } + } + + /* + * @see ILocalSyncElement#isCheckedOut() + */ + public boolean isCheckedOut() { + return getLocal() != null; + } + + /* + * @see ILocalSyncElement#hasRemote() + */ + public boolean hasRemote() { + return getLocal() != null; + } + + /* + * @see RemoteSyncElement#getData() + */ + protected Object getData() { + return null; + } + + /* + * Answers the CVS resource for this sync element + */ + public ICVSResource getCVSResource() { + return getCVSResourceFor(getLocal()); + } + + /* + * @see LocalSyncElement#isIgnored(IResource) + */ + protected boolean isIgnored(IResource child) { + ICVSResource cvsResource = getCVSResourceFor(getLocal()); + if(cvsResource==null || !cvsResource.isFolder() ) { + return false; + } else { + try { + ICVSResource managedChild = ((ICVSFolder)cvsResource).getChild(child.getName()); + return managedChild.isIgnored(); + } catch(CVSException e) { + return false; + } + } + } + + private ICVSResource getCVSResourceFor(IResource resource) { + if(resource.getType() != IResource.FILE) { + return new EclipseFolder((IContainer)resource); + } else { + return new EclipseFile((IFile)resource); + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java index 0d8bd1670..9b0d64cc1 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java @@ -1,318 +1,318 @@ -package org.eclipse.team.internal.ccvs.core.resources; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.team.ccvs.core.CVSProviderPlugin; -import org.eclipse.team.ccvs.core.ICVSFolder; -import org.eclipse.team.ccvs.core.ICVSRemoteResource; -import org.eclipse.team.ccvs.core.ICVSResource; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.ILocalSyncElement; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.core.sync.RemoteSyncElement; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSProvider; -import org.eclipse.team.internal.ccvs.core.Policy; -import org.eclipse.team.internal.ccvs.core.client.Update; -import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; -import org.eclipse.team.internal.ccvs.core.util.Assert; - -public class CVSRemoteSyncElement extends RemoteSyncElement { - - CVSLocalSyncElement localSync; - IRemoteResource remote; - boolean ignoreBaseTree = true; - - public CVSRemoteSyncElement(boolean ignoreBaseTree, IResource local, IRemoteResource base, IRemoteResource remote) { - localSync = new CVSLocalSyncElement(local, base); - this.remote = remote; - this.ignoreBaseTree = ignoreBaseTree; - } - - /* - * @see RemoteSyncElement#create(IResource, IRemoteResource, IRemoteResource) - */ - public IRemoteSyncElement create(boolean ignoreBaseTree, IResource local, IRemoteResource base, IRemoteResource remote, Object data) { - return new CVSRemoteSyncElement(ignoreBaseTree, local, base, remote); - } - - /* - * @see IRemoteSyncElement#getRemote() - */ - public IRemoteResource getRemote() { - return remote; - } - - /* - * @see IRemoteSyncElement#isOutOfDate() - */ - public boolean isOutOfDate() { - IRemoteResource base = getBase(); - if(base!=null && remote!=null) { - ICVSRemoteResource remoteCvs = (ICVSRemoteResource)remote; - ICVSRemoteResource baseCvs = (ICVSRemoteResource)base; - return ! remoteCvs.equals(baseCvs); - } else if(base!=null && remote==null) { - return true; - } else { - return false; - } - } - - /* - * @see LocalSyncElement#getData() - */ - protected Object getData() { - return localSync.getData(); - } - - /* - * @see ILocalSyncElement#getLocal() - */ - public IResource getLocal() { - return localSync.getLocal(); - } - - /* - * @see ILocalSyncElement#getBase() - */ - public IRemoteResource getBase() { - return localSync.getBase(); - } - - /* - * @see ILocalSyncElement#isDirty() - */ - public boolean isDirty() { - return localSync.isDirty(); - } - - /* - * @see ILocalSyncElement#isCheckedOut() - */ - public boolean isCheckedOut() { - return localSync.isCheckedOut(); - } - - /* - * Local helper to indicate if the corresponding local resource has a base - * - * XXX Should this be part of the interface? - */ - public boolean hasBase() { - return getBase() != null; - } - - /* - * @see ILocalSyncElement#hasRemote() - */ - public boolean hasRemote() { - return remote != null; - } - - /* - * @see LocalSyncElement#create(IResource, IRemoteResource, Object) - */ - public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) { - return localSync.create(local, base, data); - } - /* - * @see LocalSyncElement#isIgnored(IResource) - */ - protected boolean isIgnored(IResource resource) { - return localSync.isIgnored(resource); - } - /* - * @see IRemoteSyncElement#ignoreBaseTree() - */ - public boolean ignoreBaseTree() { - return ignoreBaseTree; - } - - /* - * Update the sync info of the local resource in such a way that the local changes can be committed. - */ - public void makeOutgoing(IProgressMonitor monitor) throws TeamException { - - int syncKind = getSyncKind(GRANULARITY_TIMESTAMP, monitor); - boolean conflict = (syncKind & DIRECTION_MASK) == CONFLICTING; - boolean incoming = (syncKind & DIRECTION_MASK) == INCOMING; - boolean outgoing = (syncKind & DIRECTION_MASK) == OUTGOING; - - ICVSResource local = localSync.getCVSResource(); - RemoteResource remote = (RemoteResource)getRemote(); - ResourceSyncInfo info = local.getSyncInfo(); - String revision = null; - - if (outgoing) { - // The sync info is alright, it's already outgoing! - return; - } else if (incoming) { - // We have an incoming change, addition, or deletion that we want to ignore - if (local.exists()) { - // We could have an incoming change or deletion - if (remote == null) { - info = new ResourceSyncInfo(local.getName(), ResourceSyncInfo.ADDED_REVISION, ResourceSyncInfo.DUMMY_TIMESTAMP, - CVSProvider.isText(local.getName()) ? ResourceSyncInfo.USE_SERVER_MODE:ResourceSyncInfo.BINARY_TAG, local.getParent().getFolderSyncInfo().getTag(), null); - revision = info.getRevision(); - } else { - info = remote.getSyncInfo(); - // Otherwise change the revision to the remote revision - revision = info.getRevision(); - // Use the local sync info for the other info - info = local.getSyncInfo(); - } - } else { - // We have an incoming add, turn it around as an outgoing delete - info = remote.getSyncInfo(); - revision = ResourceSyncInfo.DELETED_PREFIX + info.getRevision(); - } - } else if (local.exists()) { - // We have a conflict and a local resource! - if (hasRemote()) { - if (hasBase()) { - // We have a conflicting change, Update the local revision - revision = remote.getSyncInfo().getRevision(); - } else { - // We have conflictin additions. - // We need to fetch the contents of the remote to get all the relevant information (timestamp, permissions) - remote.getContents(Policy.monitorFor(monitor)); - info = remote.getSyncInfo(); - revision = info.getRevision(); - } - } else if (hasBase()) { - // We have a remote deletion. Make the local an addition - revision = ResourceSyncInfo.ADDED_REVISION; - } else { - // There's a local, no base and no remote. We can't possible have a conflict! - Assert.isTrue(false); - } - } else { - // We have a conflict and there is no local! - if (hasRemote()) { - // We have a local deletion that conflicts with remote changes. - revision = ResourceSyncInfo.DELETED_PREFIX + remote.getSyncInfo().getRevision(); - } else { - // We have conflicting deletions. Clear the sync info - local.setSyncInfo(null); - return; - } - } - info = new ResourceSyncInfo(info.getName(), revision, ResourceSyncInfo.DUMMY_TIMESTAMP, info.getKeywordMode(), local.getParent().getFolderSyncInfo().getTag(), info.getPermissions()); - local.setSyncInfo(info); - } - - /* - * Update the sync info of the local resource in such a way that the remote resource can be loaded - * ignore any local changes. - */ - public void makeIncoming(IProgressMonitor monitor) throws TeamException { - // To make outgoing deletions incoming, the local will not exist but - // it is still important to unmanage (e.g. delete all meta info) for the - // deletion. - CVSWorkspaceRoot.getCVSResourceFor(getLocal()).unmanage(); - } - - /* - * Load the resource and folder sync info into the local from the remote - * - * This method can be used on incoming folder additions to set the folder sync info properly - * without hitting the server again. It also applies to conflicts that involves unmanaged - * local resources. - */ - public void makeInSync(IProgressMonitor monitor) throws TeamException { - - // Only work on folders - if (! isContainer()) return; - - int syncKind = getSyncKind(GRANULARITY_TIMESTAMP, monitor); - boolean outgoing = (syncKind & DIRECTION_MASK) == OUTGOING; - if (outgoing) return; - - ICVSFolder local = (ICVSFolder)localSync.getCVSResource(); - RemoteFolder remote = (RemoteFolder)getRemote(); - - // The parent must be managed - if (! local.getParent().isCVSFolder()) - return; - - if (! local.exists()) { - local.mkdir(); - } else { - // If the folder already has CVS info, check that the remote and local match - if(local.isManaged() && local.isCVSFolder() && ! remote.getFolderSyncInfo().equals(local.getFolderSyncInfo())) { - throw new CVSException(IStatus.ERROR, 0, Policy.bind("CVSRemoteSyncElement.alreadyManaged"));//$NON-NLS-1$ - } - } - - // Since the parent is managed, this will also set the resource sync info. It is - // impossible for an incoming folder addition to map to another location in the - // repo, so we assume that using the parent's folder sync as a basis is safe. - FolderSyncInfo remoteInfo = remote.getFolderSyncInfo(); - FolderSyncInfo localInfo = local.getParent().getFolderSyncInfo(); - local.setFolderSyncInfo(new FolderSyncInfo(remoteInfo.getRepository(), remoteInfo.getRoot(), localInfo.getTag(), localInfo.getIsStatic())); - } - /* - * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor) - */ - public int getSyncKind(int granularity, IProgressMonitor progress) { - - // 1. Run the generic sync calculation algorithm, then handle CVS specific - // sync cases. - int kind = super.getSyncKind(granularity, progress); - - // 2. Set the CVS specific sync type based on the workspace sync state provided - // by the CVS server. - if(remote!=null && (kind & IRemoteSyncElement.PSEUDO_CONFLICT) == 0) { - int type = ((RemoteResource)remote).getWorkspaceSyncState(); - switch(type) { - // the server compared both text files and decided that it cannot merge - // them without line conflicts. - case Update.STATE_CONFLICT: - return ILocalSyncElement.CONFLICTING | - ILocalSyncElement.CHANGE | - ILocalSyncElement.MANUAL_CONFLICT; - - // the server compared both text files and decided that it can safely merge - // them without line conflicts. - case Update.STATE_MERGEABLE_CONFLICT: - return ILocalSyncElement.CONFLICTING | - ILocalSyncElement.CHANGE | - ILocalSyncElement.AUTOMERGE_CONFLICT; - } - } - - // 3. unmanage delete/delete conflicts and return that they are in sync - kind = handleDeletionConflicts(kind); - - return kind; - } - - /* - * If the resource has a delete/delete conflict then ensure that the local is unmanaged so that the sync info - * can be properly flushed. - */ - private int handleDeletionConflicts(int kind) { - if(kind == (IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.DELETION | IRemoteSyncElement.PSEUDO_CONFLICT)) { - try { - ICVSResource cvsResource = localSync.getCVSResource(); - if(!isContainer() && cvsResource.isManaged()) { - cvsResource.unmanage(); - } - return IRemoteSyncElement.IN_SYNC; - } catch(CVSException e) { - CVSProviderPlugin.log(e.getStatus()); - return IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.DELETION; - } - } - return kind; - } +package org.eclipse.team.internal.ccvs.core.resources; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.team.ccvs.core.CVSProviderPlugin; +import org.eclipse.team.ccvs.core.ICVSFolder; +import org.eclipse.team.ccvs.core.ICVSRemoteResource; +import org.eclipse.team.ccvs.core.ICVSResource; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.sync.ILocalSyncElement; +import org.eclipse.team.core.sync.IRemoteResource; +import org.eclipse.team.core.sync.IRemoteSyncElement; +import org.eclipse.team.core.sync.RemoteSyncElement; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.CVSProvider; +import org.eclipse.team.internal.ccvs.core.Policy; +import org.eclipse.team.internal.ccvs.core.client.Update; +import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; +import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; +import org.eclipse.team.internal.ccvs.core.util.Assert; + +public class CVSRemoteSyncElement extends RemoteSyncElement { + + CVSLocalSyncElement localSync; + IRemoteResource remote; + boolean ignoreBaseTree = true; + + public CVSRemoteSyncElement(boolean ignoreBaseTree, IResource local, IRemoteResource base, IRemoteResource remote) { + localSync = new CVSLocalSyncElement(local, base); + this.remote = remote; + this.ignoreBaseTree = ignoreBaseTree; + } + + /* + * @see RemoteSyncElement#create(IResource, IRemoteResource, IRemoteResource) + */ + public IRemoteSyncElement create(boolean ignoreBaseTree, IResource local, IRemoteResource base, IRemoteResource remote, Object data) { + return new CVSRemoteSyncElement(ignoreBaseTree, local, base, remote); + } + + /* + * @see IRemoteSyncElement#getRemote() + */ + public IRemoteResource getRemote() { + return remote; + } + + /* + * @see IRemoteSyncElement#isOutOfDate() + */ + public boolean isOutOfDate() { + IRemoteResource base = getBase(); + if(base!=null && remote!=null) { + ICVSRemoteResource remoteCvs = (ICVSRemoteResource)remote; + ICVSRemoteResource baseCvs = (ICVSRemoteResource)base; + return ! remoteCvs.equals(baseCvs); + } else if(base!=null && remote==null) { + return true; + } else { + return false; + } + } + + /* + * @see LocalSyncElement#getData() + */ + protected Object getData() { + return localSync.getData(); + } + + /* + * @see ILocalSyncElement#getLocal() + */ + public IResource getLocal() { + return localSync.getLocal(); + } + + /* + * @see ILocalSyncElement#getBase() + */ + public IRemoteResource getBase() { + return localSync.getBase(); + } + + /* + * @see ILocalSyncElement#isDirty() + */ + public boolean isDirty() { + return localSync.isDirty(); + } + + /* + * @see ILocalSyncElement#isCheckedOut() + */ + public boolean isCheckedOut() { + return localSync.isCheckedOut(); + } + + /* + * Local helper to indicate if the corresponding local resource has a base + * + * XXX Should this be part of the interface? + */ + public boolean hasBase() { + return getBase() != null; + } + + /* + * @see ILocalSyncElement#hasRemote() + */ + public boolean hasRemote() { + return remote != null; + } + + /* + * @see LocalSyncElement#create(IResource, IRemoteResource, Object) + */ + public ILocalSyncElement create(IResource local, IRemoteResource base, Object data) { + return localSync.create(local, base, data); + } + /* + * @see LocalSyncElement#isIgnored(IResource) + */ + protected boolean isIgnored(IResource resource) { + return localSync.isIgnored(resource); + } + /* + * @see IRemoteSyncElement#ignoreBaseTree() + */ + public boolean ignoreBaseTree() { + return ignoreBaseTree; + } + + /* + * Update the sync info of the local resource in such a way that the local changes can be committed. + */ + public void makeOutgoing(IProgressMonitor monitor) throws TeamException { + + int syncKind = getSyncKind(GRANULARITY_TIMESTAMP, monitor); + boolean conflict = (syncKind & DIRECTION_MASK) == CONFLICTING; + boolean incoming = (syncKind & DIRECTION_MASK) == INCOMING; + boolean outgoing = (syncKind & DIRECTION_MASK) == OUTGOING; + + ICVSResource local = localSync.getCVSResource(); + RemoteResource remote = (RemoteResource)getRemote(); + ResourceSyncInfo info = local.getSyncInfo(); + String revision = null; + + if (outgoing) { + // The sync info is alright, it's already outgoing! + return; + } else if (incoming) { + // We have an incoming change, addition, or deletion that we want to ignore + if (local.exists()) { + // We could have an incoming change or deletion + if (remote == null) { + info = new ResourceSyncInfo(local.getName(), ResourceSyncInfo.ADDED_REVISION, ResourceSyncInfo.DUMMY_TIMESTAMP, + CVSProvider.isText(local.getName()) ? ResourceSyncInfo.USE_SERVER_MODE:ResourceSyncInfo.BINARY_TAG, local.getParent().getFolderSyncInfo().getTag(), null); + revision = info.getRevision(); + } else { + info = remote.getSyncInfo(); + // Otherwise change the revision to the remote revision + revision = info.getRevision(); + // Use the local sync info for the other info + info = local.getSyncInfo(); + } + } else { + // We have an incoming add, turn it around as an outgoing delete + info = remote.getSyncInfo(); + revision = ResourceSyncInfo.DELETED_PREFIX + info.getRevision(); + } + } else if (local.exists()) { + // We have a conflict and a local resource! + if (hasRemote()) { + if (hasBase()) { + // We have a conflicting change, Update the local revision + revision = remote.getSyncInfo().getRevision(); + } else { + // We have conflictin additions. + // We need to fetch the contents of the remote to get all the relevant information (timestamp, permissions) + remote.getContents(Policy.monitorFor(monitor)); + info = remote.getSyncInfo(); + revision = info.getRevision(); + } + } else if (hasBase()) { + // We have a remote deletion. Make the local an addition + revision = ResourceSyncInfo.ADDED_REVISION; + } else { + // There's a local, no base and no remote. We can't possible have a conflict! + Assert.isTrue(false); + } + } else { + // We have a conflict and there is no local! + if (hasRemote()) { + // We have a local deletion that conflicts with remote changes. + revision = ResourceSyncInfo.DELETED_PREFIX + remote.getSyncInfo().getRevision(); + } else { + // We have conflicting deletions. Clear the sync info + local.setSyncInfo(null); + return; + } + } + info = new ResourceSyncInfo(info.getName(), revision, ResourceSyncInfo.DUMMY_TIMESTAMP, info.getKeywordMode(), local.getParent().getFolderSyncInfo().getTag(), info.getPermissions()); + local.setSyncInfo(info); + } + + /* + * Update the sync info of the local resource in such a way that the remote resource can be loaded + * ignore any local changes. + */ + public void makeIncoming(IProgressMonitor monitor) throws TeamException { + // To make outgoing deletions incoming, the local will not exist but + // it is still important to unmanage (e.g. delete all meta info) for the + // deletion. + CVSWorkspaceRoot.getCVSResourceFor(getLocal()).unmanage(); + } + + /* + * Load the resource and folder sync info into the local from the remote + * + * This method can be used on incoming folder additions to set the folder sync info properly + * without hitting the server again. It also applies to conflicts that involves unmanaged + * local resources. + */ + public void makeInSync(IProgressMonitor monitor) throws TeamException { + + // Only work on folders + if (! isContainer()) return; + + int syncKind = getSyncKind(GRANULARITY_TIMESTAMP, monitor); + boolean outgoing = (syncKind & DIRECTION_MASK) == OUTGOING; + if (outgoing) return; + + ICVSFolder local = (ICVSFolder)localSync.getCVSResource(); + RemoteFolder remote = (RemoteFolder)getRemote(); + + // The parent must be managed + if (! local.getParent().isCVSFolder()) + return; + + if (! local.exists()) { + local.mkdir(); + } else { + // If the folder already has CVS info, check that the remote and local match + if(local.isManaged() && local.isCVSFolder() && ! remote.getFolderSyncInfo().equals(local.getFolderSyncInfo())) { + throw new CVSException(IStatus.ERROR, 0, Policy.bind("CVSRemoteSyncElement.alreadyManaged"));//$NON-NLS-1$ + } + } + + // Since the parent is managed, this will also set the resource sync info. It is + // impossible for an incoming folder addition to map to another location in the + // repo, so we assume that using the parent's folder sync as a basis is safe. + FolderSyncInfo remoteInfo = remote.getFolderSyncInfo(); + FolderSyncInfo localInfo = local.getParent().getFolderSyncInfo(); + local.setFolderSyncInfo(new FolderSyncInfo(remoteInfo.getRepository(), remoteInfo.getRoot(), localInfo.getTag(), localInfo.getIsStatic())); + } + /* + * @see ILocalSyncElement#getSyncKind(int, IProgressMonitor) + */ + public int getSyncKind(int granularity, IProgressMonitor progress) { + + // 1. Run the generic sync calculation algorithm, then handle CVS specific + // sync cases. + int kind = super.getSyncKind(granularity, progress); + + // 2. Set the CVS specific sync type based on the workspace sync state provided + // by the CVS server. + if(remote!=null && (kind & IRemoteSyncElement.PSEUDO_CONFLICT) == 0) { + int type = ((RemoteResource)remote).getWorkspaceSyncState(); + switch(type) { + // the server compared both text files and decided that it cannot merge + // them without line conflicts. + case Update.STATE_CONFLICT: + return ILocalSyncElement.CONFLICTING | + ILocalSyncElement.CHANGE | + ILocalSyncElement.MANUAL_CONFLICT; + + // the server compared both text files and decided that it can safely merge + // them without line conflicts. + case Update.STATE_MERGEABLE_CONFLICT: + return ILocalSyncElement.CONFLICTING | + ILocalSyncElement.CHANGE | + ILocalSyncElement.AUTOMERGE_CONFLICT; + } + } + + // 3. unmanage delete/delete conflicts and return that they are in sync + kind = handleDeletionConflicts(kind); + + return kind; + } + + /* + * If the resource has a delete/delete conflict then ensure that the local is unmanaged so that the sync info + * can be properly flushed. + */ + private int handleDeletionConflicts(int kind) { + if(kind == (IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.DELETION | IRemoteSyncElement.PSEUDO_CONFLICT)) { + try { + ICVSResource cvsResource = localSync.getCVSResource(); + if(!isContainer() && cvsResource.isManaged()) { + cvsResource.unmanage(); + } + return IRemoteSyncElement.IN_SYNC; + } catch(CVSException e) { + CVSProviderPlugin.log(e.getStatus()); + return IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.DELETION; + } + } + return kind; + } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AssertionFailedException.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AssertionFailedException.java index 99a2892a5..df2926d74 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AssertionFailedException.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/AssertionFailedException.java @@ -1,28 +1,28 @@ -package org.eclipse.team.internal.ccvs.core.util; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -/** - * AssertionFailedException is a runtime exception thrown - * by some of the methods in Assert. - *

- * This class is not declared public to prevent some misuses; programs that catch - * or otherwise depend on assertion failures are susceptible to unexpected - * breakage when assertions in the code are added or removed. - *

- */ -/* package */ -class AssertionFailedException extends RuntimeException { -/** Constructs a new exception. - */ -public AssertionFailedException() { -} -/** Constructs a new exception with the given message. - */ -public AssertionFailedException(String detail) { - super(detail); -} -} +package org.eclipse.team.internal.ccvs.core.util; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +/** + * AssertionFailedException is a runtime exception thrown + * by some of the methods in Assert. + *

+ * This class is not declared public to prevent some misuses; programs that catch + * or otherwise depend on assertion failures are susceptible to unexpected + * breakage when assertions in the code are added or removed. + *

+ */ +/* package */ +class AssertionFailedException extends RuntimeException { +/** Constructs a new exception. + */ +public AssertionFailedException() { +} +/** Constructs a new exception with the given message. + */ +public AssertionFailedException(String detail) { + super(detail); +} +} diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileUtil.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileUtil.java index 67e6771a4..6f4d5df07 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileUtil.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/FileUtil.java @@ -1,39 +1,39 @@ -package org.eclipse.team.internal.ccvs.core.util; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.team.ccvs.core.ICVSFolder; -import org.eclipse.team.ccvs.core.ICVSResource; - -public class FileUtil { - - public static void deepDelete(File resource) { - if (resource.isDirectory()) { - File[] fileList = resource.listFiles(); - for (int i = 0; i < fileList.length; i++) { +package org.eclipse.team.internal.ccvs.core.util; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import org.eclipse.team.ccvs.core.ICVSFolder; +import org.eclipse.team.ccvs.core.ICVSResource; + +public class FileUtil { + + public static void deepDelete(File resource) { + if (resource.isDirectory()) { + File[] fileList = resource.listFiles(); + for (int i = 0; i < fileList.length; i++) { deepDelete(fileList[i]); - } - } - resource.delete(); - } - - public static void transfer(InputStream in, OutputStream out) throws IOException { - final byte[] BUFFER = new byte[4096]; - int read = 0; - long totalRead = 0; - synchronized (BUFFER) { - while ((read = in.read(BUFFER)) != -1) { - out.write(BUFFER, 0, read); - } - } - out.flush(); - } + } + } + resource.delete(); + } + + public static void transfer(InputStream in, OutputStream out) throws IOException { + final byte[] BUFFER = new byte[4096]; + int read = 0; + long totalRead = 0; + synchronized (BUFFER) { + while ((read = in.read(BUFFER)) != -1) { + out.write(BUFFER, 0, read); + } + } + out.flush(); + } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ssh/about.html b/bundles/org.eclipse.team.cvs.ssh/about.html index e3c15c80d..ab1dd4198 100644 --- a/bundles/org.eclipse.team.cvs.ssh/about.html +++ b/bundles/org.eclipse.team.cvs.ssh/about.html @@ -1,104 +1,104 @@ - - -About - - - - - - - - -
About This Content
-

11th December, 2001

-

License

-

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

- -

Third Party Content

- -

The Content includes items that have been sourced from third parties as follows:

- -

The Java (TM) Ssh Applet

-

The plug-in is based on software developed by Cedric Gourio. -If the source code is included, it is located in teamcvssshsrc.zip. The binary code is located in teamcvsssh.jar. The Java Ssh Applet includes the following copyright notice which -must be included in any redistribution:

- -
- Copyright (c) 1998 Cedric Gourio
- (http://www.cl.cam.ac.uk/~fapp2/software/java-ssh/)
- (javassh@france-mail.com) - -

This program is FREE FOR COMMERCIAL AND NON-COMMERCIAL USE.
- You can freely modify the code.

- -

You should however include this copyright notice in any redistribution
- and please keep in touch with the author for any feedback.

-
- -

The Blowfish Encryption Algorithm

-

The plug-in is based on an algorithm developed by Bruce Schneier. The algorithm was originally published in -a paper that is located at http://www.counterpane.com/bfsverlag.html. -Your use of the Blowfish Encryption Algorithm in both source and binary code form contained in the plug-in is not subject to any -additional terms and conditions. If the source code, Blowfish.java is included, it is located in teamcvssshsrc.zip. The binary code, Blowfish.class is located in -teamcvsssh.jar.

- -

Contributions

- -

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

- -

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or -other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.

- -

Cryptography

- -

Export Control

-

The plug-in contains encryption software. The country in which you are currently may have restrictions on the import, possession, -and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's -laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this -is permitted.

- -

Encryption Items

- -

Details of the encryption software in this plug-in are provided to assist in obtaining relevant export control classification and approval. -Cryptography in this plug-in has been classified as Export Commodity Control Number (ECCN) 5D002.c.1 by the U.S. Government Department of Commerce, -Bureau of Export Administration and deemed eligible for export under License Exception ENC Technology Software Unrestricted (TSU) for object code -and (cryptographic) source code, and License Exception ENC Retail for object code and no (cryptographic) source code.

- -

The plug-in contains an implementation of the Secure Shell (SSH) protocol that encrypts the network traffic (program code files -in file versioning systems) between a Concurrent Versions System (CVS) server and a CVS client. Data is encrypted using the Blowfish algorithm -which is a 64-bit symmetric cipher that uses a key varying in length from 32 bits to 448 bits. The RSA PKCS #1 v1.5 key exchange algorithm is -used to authenticate and exchange keys with a minimum modulus size of 96 bits and a maximum modulus size theoretically unlimited since the -implementation uses the java.math.BigInteger class which has a maximum positive integer range limited only by the available memory in the computer. -In practice, the key length is defined by the CVS server with which communication is initiated.

- -

The following Java classes contain encryption items (the plug-in may contain both binary and source code):

- -
    -
  • org.eclipse.team.internal.ccvs.ssh.Blowfish
  • -
  • org.eclipse.team.internal.ccvs.ssh.Cipher
  • -
  • org.eclipse.team.internal.ccvs.ssh.Client
  • -
  • org.eclipse.team.internal.ccvs.ssh.ClientPacket
  • -
  • org.eclipse.team.internal.ccvs.ssh.Misc
  • -
- -Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. -
- + + +About + + + + + + + + +
About This Content
+

11th December, 2001

+

License

+

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

+ +

Third Party Content

+ +

The Content includes items that have been sourced from third parties as follows:

+ +

The Java (TM) Ssh Applet

+

The plug-in is based on software developed by Cedric Gourio. +If the source code is included, it is located in teamcvssshsrc.zip. The binary code is located in teamcvsssh.jar. The Java Ssh Applet includes the following copyright notice which +must be included in any redistribution:

+ +
+ Copyright (c) 1998 Cedric Gourio
+ (http://www.cl.cam.ac.uk/~fapp2/software/java-ssh/)
+ (javassh@france-mail.com) + +

This program is FREE FOR COMMERCIAL AND NON-COMMERCIAL USE.
+ You can freely modify the code.

+ +

You should however include this copyright notice in any redistribution
+ and please keep in touch with the author for any feedback.

+
+ +

The Blowfish Encryption Algorithm

+

The plug-in is based on an algorithm developed by Bruce Schneier. The algorithm was originally published in +a paper that is located at http://www.counterpane.com/bfsverlag.html. +Your use of the Blowfish Encryption Algorithm in both source and binary code form contained in the plug-in is not subject to any +additional terms and conditions. If the source code, Blowfish.java is included, it is located in teamcvssshsrc.zip. The binary code, Blowfish.class is located in +teamcvsssh.jar.

+ +

Contributions

+ +

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise +made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such +Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

+ +

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or +other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the +host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available +to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also +providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of +the CPL.

+ +

Cryptography

+ +

Export Control

+

The plug-in contains encryption software. The country in which you are currently may have restrictions on the import, possession, +and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's +laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this +is permitted.

+ +

Encryption Items

+ +

Details of the encryption software in this plug-in are provided to assist in obtaining relevant export control classification and approval. +Cryptography in this plug-in has been classified as Export Commodity Control Number (ECCN) 5D002.c.1 by the U.S. Government Department of Commerce, +Bureau of Export Administration and deemed eligible for export under License Exception ENC Technology Software Unrestricted (TSU) for object code +and (cryptographic) source code, and License Exception ENC Retail for object code and no (cryptographic) source code.

+ +

The plug-in contains an implementation of the Secure Shell (SSH) protocol that encrypts the network traffic (program code files +in file versioning systems) between a Concurrent Versions System (CVS) server and a CVS client. Data is encrypted using the Blowfish algorithm +which is a 64-bit symmetric cipher that uses a key varying in length from 32 bits to 448 bits. The RSA PKCS #1 v1.5 key exchange algorithm is +used to authenticate and exchange keys with a minimum modulus size of 96 bits and a maximum modulus size theoretically unlimited since the +implementation uses the java.math.BigInteger class which has a maximum positive integer range limited only by the available memory in the computer. +In practice, the key length is defined by the CVS server with which communication is initiated.

+ +

The following Java classes contain encryption items (the plug-in may contain both binary and source code):

+ +
    +
  • org.eclipse.team.internal.ccvs.ssh.Blowfish
  • +
  • org.eclipse.team.internal.ccvs.ssh.Cipher
  • +
  • org.eclipse.team.internal.ccvs.ssh.Client
  • +
  • org.eclipse.team.internal.ccvs.ssh.ClientPacket
  • +
  • org.eclipse.team.internal.ccvs.ssh.Misc
  • +
+ +Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. +
+ \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ssh/plugin.xml b/bundles/org.eclipse.team.cvs.ssh/plugin.xml index d5e56947e..49ef0a300 100644 --- a/bundles/org.eclipse.team.cvs.ssh/plugin.xml +++ b/bundles/org.eclipse.team.cvs.ssh/plugin.xml @@ -1,30 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java index 5cb92222e..6af1ae215 100644 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java +++ b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Blowfish.java @@ -1,1214 +1,1214 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -public class Blowfish extends Cipher { - private int[] P = new int[18]; - private int[][] S = new int[4][256]; - - private int lastEncipherXL = 0; - private int lastEncipherXR = 0; - private int lastDecipherXL = 0; - private int lastDecipherXR = 0; - - private final static int[] INIT_DATA = - { - 0x243f6a88, - 0x85a308d3, - 0x13198a2e, - 0x03707344, - 0xa4093822, - 0x299f31d0, - 0x082efa98, - 0xec4e6c89, - 0x452821e6, - 0x38d01377, - 0xbe5466cf, - 0x34e90c6c, - 0xc0ac29b7, - 0xc97c50dd, - 0x3f84d5b5, - 0xb5470917, - 0x9216d5d9, - 0x8979fb1b, - 0xd1310ba6, - 0x98dfb5ac, - 0x2ffd72db, - 0xd01adfb7, - 0xb8e1afed, - 0x6a267e96, - 0xba7c9045, - 0xf12c7f99, - 0x24a19947, - 0xb3916cf7, - 0x0801f2e2, - 0x858efc16, - 0x636920d8, - 0x71574e69, - 0xa458fea3, - 0xf4933d7e, - 0x0d95748f, - 0x728eb658, - 0x718bcd58, - 0x82154aee, - 0x7b54a41d, - 0xc25a59b5, - 0x9c30d539, - 0x2af26013, - 0xc5d1b023, - 0x286085f0, - 0xca417918, - 0xb8db38ef, - 0x8e79dcb0, - 0x603a180e, - 0x6c9e0e8b, - 0xb01e8a3e, - 0xd71577c1, - 0xbd314b27, - 0x78af2fda, - 0x55605c60, - 0xe65525f3, - 0xaa55ab94, - 0x57489862, - 0x63e81440, - 0x55ca396a, - 0x2aab10b6, - 0xb4cc5c34, - 0x1141e8ce, - 0xa15486af, - 0x7c72e993, - 0xb3ee1411, - 0x636fbc2a, - 0x2ba9c55d, - 0x741831f6, - 0xce5c3e16, - 0x9b87931e, - 0xafd6ba33, - 0x6c24cf5c, - 0x7a325381, - 0x28958677, - 0x3b8f4898, - 0x6b4bb9af, - 0xc4bfe81b, - 0x66282193, - 0x61d809cc, - 0xfb21a991, - 0x487cac60, - 0x5dec8032, - 0xef845d5d, - 0xe98575b1, - 0xdc262302, - 0xeb651b88, - 0x23893e81, - 0xd396acc5, - 0x0f6d6ff3, - 0x83f44239, - 0x2e0b4482, - 0xa4842004, - 0x69c8f04a, - 0x9e1f9b5e, - 0x21c66842, - 0xf6e96c9a, - 0x670c9c61, - 0xabd388f0, - 0x6a51a0d2, - 0xd8542f68, - 0x960fa728, - 0xab5133a3, - 0x6eef0b6c, - 0x137a3be4, - 0xba3bf050, - 0x7efb2a98, - 0xa1f1651d, - 0x39af0176, - 0x66ca593e, - 0x82430e88, - 0x8cee8619, - 0x456f9fb4, - 0x7d84a5c3, - 0x3b8b5ebe, - 0xe06f75d8, - 0x85c12073, - 0x401a449f, - 0x56c16aa6, - 0x4ed3aa62, - 0x363f7706, - 0x1bfedf72, - 0x429b023d, - 0x37d0d724, - 0xd00a1248, - 0xdb0fead3, - 0x49f1c09b, - 0x075372c9, - 0x80991b7b, - 0x25d479d8, - 0xf6e8def7, - 0xe3fe501a, - 0xb6794c3b, - 0x976ce0bd, - 0x04c006ba, - 0xc1a94fb6, - 0x409f60c4, - 0x5e5c9ec2, - 0x196a2463, - 0x68fb6faf, - 0x3e6c53b5, - 0x1339b2eb, - 0x3b52ec6f, - 0x6dfc511f, - 0x9b30952c, - 0xcc814544, - 0xaf5ebd09, - 0xbee3d004, - 0xde334afd, - 0x660f2807, - 0x192e4bb3, - 0xc0cba857, - 0x45c8740f, - 0xd20b5f39, - 0xb9d3fbdb, - 0x5579c0bd, - 0x1a60320a, - 0xd6a100c6, - 0x402c7279, - 0x679f25fe, - 0xfb1fa3cc, - 0x8ea5e9f8, - 0xdb3222f8, - 0x3c7516df, - 0xfd616b15, - 0x2f501ec8, - 0xad0552ab, - 0x323db5fa, - 0xfd238760, - 0x53317b48, - 0x3e00df82, - 0x9e5c57bb, - 0xca6f8ca0, - 0x1a87562e, - 0xdf1769db, - 0xd542a8f6, - 0x287effc3, - 0xac6732c6, - 0x8c4f5573, - 0x695b27b0, - 0xbbca58c8, - 0xe1ffa35d, - 0xb8f011a0, - 0x10fa3d98, - 0xfd2183b8, - 0x4afcb56c, - 0x2dd1d35b, - 0x9a53e479, - 0xb6f84565, - 0xd28e49bc, - 0x4bfb9790, - 0xe1ddf2da, - 0xa4cb7e33, - 0x62fb1341, - 0xcee4c6e8, - 0xef20cada, - 0x36774c01, - 0xd07e9efe, - 0x2bf11fb4, - 0x95dbda4d, - 0xae909198, - 0xeaad8e71, - 0x6b93d5a0, - 0xd08ed1d0, - 0xafc725e0, - 0x8e3c5b2f, - 0x8e7594b7, - 0x8ff6e2fb, - 0xf2122b64, - 0x8888b812, - 0x900df01c, - 0x4fad5ea0, - 0x688fc31c, - 0xd1cff191, - 0xb3a8c1ad, - 0x2f2f2218, - 0xbe0e1777, - 0xea752dfe, - 0x8b021fa1, - 0xe5a0cc0f, - 0xb56f74e8, - 0x18acf3d6, - 0xce89e299, - 0xb4a84fe0, - 0xfd13e0b7, - 0x7cc43b81, - 0xd2ada8d9, - 0x165fa266, - 0x80957705, - 0x93cc7314, - 0x211a1477, - 0xe6ad2065, - 0x77b5fa86, - 0xc75442f5, - 0xfb9d35cf, - 0xebcdaf0c, - 0x7b3e89a0, - 0xd6411bd3, - 0xae1e7e49, - 0x00250e2d, - 0x2071b35e, - 0x226800bb, - 0x57b8e0af, - 0x2464369b, - 0xf009b91e, - 0x5563911d, - 0x59dfa6aa, - 0x78c14389, - 0xd95a537f, - 0x207d5ba2, - 0x02e5b9c5, - 0x83260376, - 0x6295cfa9, - 0x11c81968, - 0x4e734a41, - 0xb3472dca, - 0x7b14a94a, - 0x1b510052, - 0x9a532915, - 0xd60f573f, - 0xbc9bc6e4, - 0x2b60a476, - 0x81e67400, - 0x08ba6fb5, - 0x571be91f, - 0xf296ec6b, - 0x2a0dd915, - 0xb6636521, - 0xe7b9f9b6, - 0xff34052e, - 0xc5855664, - 0x53b02d5d, - 0xa99f8fa1, - 0x08ba4799, - 0x6e85076a, - 0x4b7a70e9, - 0xb5b32944, - 0xdb75092e, - 0xc4192623, - 0xad6ea6b0, - 0x49a7df7d, - 0x9cee60b8, - 0x8fedb266, - 0xecaa8c71, - 0x699a17ff, - 0x5664526c, - 0xc2b19ee1, - 0x193602a5, - 0x75094c29, - 0xa0591340, - 0xe4183a3e, - 0x3f54989a, - 0x5b429d65, - 0x6b8fe4d6, - 0x99f73fd6, - 0xa1d29c07, - 0xefe830f5, - 0x4d2d38e6, - 0xf0255dc1, - 0x4cdd2086, - 0x8470eb26, - 0x6382e9c6, - 0x021ecc5e, - 0x09686b3f, - 0x3ebaefc9, - 0x3c971814, - 0x6b6a70a1, - 0x687f3584, - 0x52a0e286, - 0xb79c5305, - 0xaa500737, - 0x3e07841c, - 0x7fdeae5c, - 0x8e7d44ec, - 0x5716f2b8, - 0xb03ada37, - 0xf0500c0d, - 0xf01c1f04, - 0x0200b3ff, - 0xae0cf51a, - 0x3cb574b2, - 0x25837a58, - 0xdc0921bd, - 0xd19113f9, - 0x7ca92ff6, - 0x94324773, - 0x22f54701, - 0x3ae5e581, - 0x37c2dadc, - 0xc8b57634, - 0x9af3dda7, - 0xa9446146, - 0x0fd0030e, - 0xecc8c73e, - 0xa4751e41, - 0xe238cd99, - 0x3bea0e2f, - 0x3280bba1, - 0x183eb331, - 0x4e548b38, - 0x4f6db908, - 0x6f420d03, - 0xf60a04bf, - 0x2cb81290, - 0x24977c79, - 0x5679b072, - 0xbcaf89af, - 0xde9a771f, - 0xd9930810, - 0xb38bae12, - 0xdccf3f2e, - 0x5512721f, - 0x2e6b7124, - 0x501adde6, - 0x9f84cd87, - 0x7a584718, - 0x7408da17, - 0xbc9f9abc, - 0xe94b7d8c, - 0xec7aec3a, - 0xdb851dfa, - 0x63094366, - 0xc464c3d2, - 0xef1c1847, - 0x3215d908, - 0xdd433b37, - 0x24c2ba16, - 0x12a14d43, - 0x2a65c451, - 0x50940002, - 0x133ae4dd, - 0x71dff89e, - 0x10314e55, - 0x81ac77d6, - 0x5f11199b, - 0x043556f1, - 0xd7a3c76b, - 0x3c11183b, - 0x5924a509, - 0xf28fe6ed, - 0x97f1fbfa, - 0x9ebabf2c, - 0x1e153c6e, - 0x86e34570, - 0xeae96fb1, - 0x860e5e0a, - 0x5a3e2ab3, - 0x771fe71c, - 0x4e3d06fa, - 0x2965dcb9, - 0x99e71d0f, - 0x803e89d6, - 0x5266c825, - 0x2e4cc978, - 0x9c10b36a, - 0xc6150eba, - 0x94e2ea78, - 0xa5fc3c53, - 0x1e0a2df4, - 0xf2f74ea7, - 0x361d2b3d, - 0x1939260f, - 0x19c27960, - 0x5223a708, - 0xf71312b6, - 0xebadfe6e, - 0xeac31f66, - 0xe3bc4595, - 0xa67bc883, - 0xb17f37d1, - 0x018cff28, - 0xc332ddef, - 0xbe6c5aa5, - 0x65582185, - 0x68ab9802, - 0xeecea50f, - 0xdb2f953b, - 0x2aef7dad, - 0x5b6e2f84, - 0x1521b628, - 0x29076170, - 0xecdd4775, - 0x619f1510, - 0x13cca830, - 0xeb61bd96, - 0x0334fe1e, - 0xaa0363cf, - 0xb5735c90, - 0x4c70a239, - 0xd59e9e0b, - 0xcbaade14, - 0xeecc86bc, - 0x60622ca7, - 0x9cab5cab, - 0xb2f3846e, - 0x648b1eaf, - 0x19bdf0ca, - 0xa02369b9, - 0x655abb50, - 0x40685a32, - 0x3c2ab4b3, - 0x319ee9d5, - 0xc021b8f7, - 0x9b540b19, - 0x875fa099, - 0x95f7997e, - 0x623d7da8, - 0xf837889a, - 0x97e32d77, - 0x11ed935f, - 0x16681281, - 0x0e358829, - 0xc7e61fd6, - 0x96dedfa1, - 0x7858ba99, - 0x57f584a5, - 0x1b227263, - 0x9b83c3ff, - 0x1ac24696, - 0xcdb30aeb, - 0x532e3054, - 0x8fd948e4, - 0x6dbc3128, - 0x58ebf2ef, - 0x34c6ffea, - 0xfe28ed61, - 0xee7c3c73, - 0x5d4a14d9, - 0xe864b7e3, - 0x42105d14, - 0x203e13e0, - 0x45eee2b6, - 0xa3aaabea, - 0xdb6c4f15, - 0xfacb4fd0, - 0xc742f442, - 0xef6abbb5, - 0x654f3b1d, - 0x41cd2105, - 0xd81e799e, - 0x86854dc7, - 0xe44b476a, - 0x3d816250, - 0xcf62a1f2, - 0x5b8d2646, - 0xfc8883a0, - 0xc1c7b6a3, - 0x7f1524c3, - 0x69cb7492, - 0x47848a0b, - 0x5692b285, - 0x095bbf00, - 0xad19489d, - 0x1462b174, - 0x23820e00, - 0x58428d2a, - 0x0c55f5ea, - 0x1dadf43e, - 0x233f7061, - 0x3372f092, - 0x8d937e41, - 0xd65fecf1, - 0x6c223bdb, - 0x7cde3759, - 0xcbee7460, - 0x4085f2a7, - 0xce77326e, - 0xa6078084, - 0x19f8509e, - 0xe8efd855, - 0x61d99735, - 0xa969a7aa, - 0xc50c06c2, - 0x5a04abfc, - 0x800bcadc, - 0x9e447a2e, - 0xc3453484, - 0xfdd56705, - 0x0e1e9ec9, - 0xdb73dbd3, - 0x105588cd, - 0x675fda79, - 0xe3674340, - 0xc5c43465, - 0x713e38d8, - 0x3d28f89e, - 0xf16dff20, - 0x153e21e7, - 0x8fb03d4a, - 0xe6e39f2b, - 0xdb83adf7, - 0xe93d5a68, - 0x948140f7, - 0xf64c261c, - 0x94692934, - 0x411520f7, - 0x7602d4f7, - 0xbcf46b2e, - 0xd4a20068, - 0xd4082471, - 0x3320f46a, - 0x43b7d4b7, - 0x500061af, - 0x1e39f62e, - 0x97244546, - 0x14214f74, - 0xbf8b8840, - 0x4d95fc1d, - 0x96b591af, - 0x70f4ddd3, - 0x66a02f45, - 0xbfbc09ec, - 0x03bd9785, - 0x7fac6dd0, - 0x31cb8504, - 0x96eb27b3, - 0x55fd3941, - 0xda2547e6, - 0xabca0a9a, - 0x28507825, - 0x530429f4, - 0x0a2c86da, - 0xe9b66dfb, - 0x68dc1462, - 0xd7486900, - 0x680ec0a4, - 0x27a18dee, - 0x4f3ffea2, - 0xe887ad8c, - 0xb58ce006, - 0x7af4d6b6, - 0xaace1e7c, - 0xd3375fec, - 0xce78a399, - 0x406b2a42, - 0x20fe9e35, - 0xd9f385b9, - 0xee39d7ab, - 0x3b124e8b, - 0x1dc9faf7, - 0x4b6d1856, - 0x26a36631, - 0xeae397b2, - 0x3a6efa74, - 0xdd5b4332, - 0x6841e7f7, - 0xca7820fb, - 0xfb0af54e, - 0xd8feb397, - 0x454056ac, - 0xba489527, - 0x55533a3a, - 0x20838d87, - 0xfe6ba9b7, - 0xd096954b, - 0x55a867bc, - 0xa1159a58, - 0xcca92963, - 0x99e1db33, - 0xa62a4a56, - 0x3f3125f9, - 0x5ef47e1c, - 0x9029317c, - 0xfdf8e802, - 0x04272f70, - 0x80bb155c, - 0x05282ce3, - 0x95c11548, - 0xe4c66d22, - 0x48c1133f, - 0xc70f86dc, - 0x07f9c9ee, - 0x41041f0f, - 0x404779a4, - 0x5d886e17, - 0x325f51eb, - 0xd59bc0d1, - 0xf2bcc18f, - 0x41113564, - 0x257b7834, - 0x602a9c60, - 0xdff8e8a3, - 0x1f636c1b, - 0x0e12b4c2, - 0x02e1329e, - 0xaf664fd1, - 0xcad18115, - 0x6b2395e0, - 0x333e92e1, - 0x3b240b62, - 0xeebeb922, - 0x85b2a20e, - 0xe6ba0d99, - 0xde720c8c, - 0x2da2f728, - 0xd0127845, - 0x95b794fd, - 0x647d0862, - 0xe7ccf5f0, - 0x5449a36f, - 0x877d48fa, - 0xc39dfd27, - 0xf33e8d1e, - 0x0a476341, - 0x992eff74, - 0x3a6f6eab, - 0xf4f8fd37, - 0xa812dc60, - 0xa1ebddf8, - 0x991be14c, - 0xdb6e6b0d, - 0xc67b5510, - 0x6d672c37, - 0x2765d43b, - 0xdcd0e804, - 0xf1290dc7, - 0xcc00ffa3, - 0xb5390f92, - 0x690fed0b, - 0x667b9ffb, - 0xcedb7d9c, - 0xa091cf0b, - 0xd9155ea3, - 0xbb132f88, - 0x515bad24, - 0x7b9479bf, - 0x763bd6eb, - 0x37392eb3, - 0xcc115979, - 0x8026e297, - 0xf42e312d, - 0x6842ada7, - 0xc66a2b3b, - 0x12754ccc, - 0x782ef11c, - 0x6a124237, - 0xb79251e7, - 0x06a1bbe6, - 0x4bfb6350, - 0x1a6b1018, - 0x11caedfa, - 0x3d25bdd8, - 0xe2e1c3c9, - 0x44421659, - 0x0a121386, - 0xd90cec6e, - 0xd5abea2a, - 0x64af674e, - 0xda86a85f, - 0xbebfe988, - 0x64e4c3fe, - 0x9dbc8057, - 0xf0f7c086, - 0x60787bf8, - 0x6003604d, - 0xd1fd8346, - 0xf6381fb0, - 0x7745ae04, - 0xd736fccc, - 0x83426b33, - 0xf01eab71, - 0xb0804187, - 0x3c005e5f, - 0x77a057be, - 0xbde8ae24, - 0x55464299, - 0xbf582e61, - 0x4e58f48f, - 0xf2ddfda2, - 0xf474ef38, - 0x8789bdc2, - 0x5366f9c3, - 0xc8b38e74, - 0xb475f255, - 0x46fcd9b9, - 0x7aeb2661, - 0x8b1ddf84, - 0x846a0e79, - 0x915f95e2, - 0x466e598e, - 0x20b45770, - 0x8cd55591, - 0xc902de4c, - 0xb90bace1, - 0xbb8205d0, - 0x11a86248, - 0x7574a99e, - 0xb77f19b6, - 0xe0a9dc09, - 0x662d09a1, - 0xc4324633, - 0xe85a1f02, - 0x09f0be8c, - 0x4a99a025, - 0x1d6efe10, - 0x1ab93d1d, - 0x0ba5a4df, - 0xa186f20f, - 0x2868f169, - 0xdcb7da83, - 0x573906fe, - 0xa1e2ce9b, - 0x4fcd7f52, - 0x50115e01, - 0xa70683fa, - 0xa002b5c4, - 0x0de6d027, - 0x9af88c27, - 0x773f8641, - 0xc3604c06, - 0x61a806b5, - 0xf0177a28, - 0xc0f586e0, - 0x006058aa, - 0x30dc7d62, - 0x11e69ed7, - 0x2338ea63, - 0x53c2dd94, - 0xc2c21634, - 0xbbcbee56, - 0x90bcb6de, - 0xebfc7da1, - 0xce591d76, - 0x6f05e409, - 0x4b7c0188, - 0x39720a3d, - 0x7c927c24, - 0x86e3725f, - 0x724d9db9, - 0x1ac15bb4, - 0xd39eb8fc, - 0xed545578, - 0x08fca5b5, - 0xd83d7cd3, - 0x4dad0fc4, - 0x1e50ef5e, - 0xb161e6f8, - 0xa28514d9, - 0x6c51133c, - 0x6fd5c7e7, - 0x56e14ec4, - 0x362abfce, - 0xddc6c837, - 0xd79a3234, - 0x92638212, - 0x670efa8e, - 0x406000e0, - 0x3a39ce37, - 0xd3faf5cf, - 0xabc27737, - 0x5ac52d1b, - 0x5cb0679e, - 0x4fa33742, - 0xd3822740, - 0x99bc9bbe, - 0xd5118e9d, - 0xbf0f7315, - 0xd62d1c7e, - 0xc700c47b, - 0xb78c1b6b, - 0x21a19045, - 0xb26eb1be, - 0x6a366eb4, - 0x5748ab2f, - 0xbc946e79, - 0xc6a376d2, - 0x6549c2c8, - 0x530ff8ee, - 0x468dde7d, - 0xd5730a1d, - 0x4cd04dc6, - 0x2939bbdb, - 0xa9ba4650, - 0xac9526e8, - 0xbe5ee304, - 0xa1fad5f0, - 0x6a2d519a, - 0x63ef8ce2, - 0x9a86ee22, - 0xc089c2b8, - 0x43242ef6, - 0xa51e03aa, - 0x9cf2d0a4, - 0x83c061ba, - 0x9be96a4d, - 0x8fe51550, - 0xba645bd6, - 0x2826a2f9, - 0xa73a3ae1, - 0x4ba99586, - 0xef5562e9, - 0xc72fefd3, - 0xf752f7da, - 0x3f046f69, - 0x77fa0a59, - 0x80e4a915, - 0x87b08601, - 0x9b09e6ad, - 0x3b3ee593, - 0xe990fd5a, - 0x9e34d797, - 0x2cf0b7d9, - 0x022b8b51, - 0x96d5ac3a, - 0x017da67d, - 0xd1cf3ed6, - 0x7c7d2d28, - 0x1f9f25cf, - 0xadf2b89b, - 0x5ad6b472, - 0x5a88f54c, - 0xe029ac71, - 0xe019a5e6, - 0x47b0acfd, - 0xed93fa9b, - 0xe8d3c48d, - 0x283b57cc, - 0xf8d56629, - 0x79132e28, - 0x785f0191, - 0xed756055, - 0xf7960e44, - 0xe3d35e8c, - 0x15056dd4, - 0x88f46dba, - 0x03a16125, - 0x0564f0bd, - 0xc3eb9e15, - 0x3c9057a2, - 0x97271aec, - 0xa93a072a, - 0x1b3f6d9b, - 0x1e6321f5, - 0xf59c66fb, - 0x26dcf319, - 0x7533d928, - 0xb155fdf5, - 0x03563482, - 0x8aba3cbb, - 0x28517711, - 0xc20ad9f8, - 0xabcc5167, - 0xccad925f, - 0x4de81751, - 0x3830dc8e, - 0x379d5862, - 0x9320f991, - 0xea7a90c2, - 0xfb3e7bce, - 0x5121ce64, - 0x774fbe32, - 0xa8b6e37e, - 0xc3293d46, - 0x48de5369, - 0x6413e680, - 0xa2ae0810, - 0xdd6db224, - 0x69852dfd, - 0x09072166, - 0xb39a460a, - 0x6445c0dd, - 0x586cdecf, - 0x1c20c8ae, - 0x5bbef7dd, - 0x1b588d40, - 0xccd2017f, - 0x6bb4e3bb, - 0xdda26a7e, - 0x3a59ff45, - 0x3e350a44, - 0xbcb4cdd5, - 0x72eacea8, - 0xfa6484bb, - 0x8d6612ae, - 0xbf3c6f47, - 0xd29be463, - 0x542f5d9e, - 0xaec2771b, - 0xf64e6370, - 0x740e0d8d, - 0xe75b1357, - 0xf8721671, - 0xaf537d5d, - 0x4040cb08, - 0x4eb4e2cc, - 0x34d2466a, - 0x0115af84, - 0xe1b00428, - 0x95983a1d, - 0x06b89fb4, - 0xce6ea048, - 0x6f3f3b82, - 0x3520ab82, - 0x011a1d4b, - 0x277227f8, - 0x611560b1, - 0xe7933fdc, - 0xbb3a792b, - 0x344525bd, - 0xa08839e1, - 0x51ce794b, - 0x2f32c9b7, - 0xa01fbac9, - 0xe01cc87e, - 0xbcc7d1f6, - 0xcf0111c3, - 0xa1e8aac7, - 0x1a908749, - 0xd44fbd9a, - 0xd0dadecb, - 0xd50ada38, - 0x0339c32a, - 0xc6913667, - 0x8df9317c, - 0xe0b12b4f, - 0xf79e59b7, - 0x43f5bb3a, - 0xf2d519ff, - 0x27d9459c, - 0xbf97222c, - 0x15e6fc2a, - 0x0f91fc71, - 0x9b941525, - 0xfae59361, - 0xceb69ceb, - 0xc2a86459, - 0x12baa8d1, - 0xb6c1075e, - 0xe3056a0c, - 0x10d25065, - 0xcb03a442, - 0xe0ec6e0e, - 0x1698db3b, - 0x4c98a0be, - 0x3278e964, - 0x9f1f9532, - 0xe0d392df, - 0xd3a0342b, - 0x8971f21e, - 0x1b0a7441, - 0x4ba3348c, - 0xc5be7120, - 0xc37632d8, - 0xdf359f8d, - 0x9b992f2e, - 0xe60b6f47, - 0x0fe3f11d, - 0xe54cda54, - 0x1edad891, - 0xce6279cf, - 0xcd3e7e6f, - 0x1618b166, - 0xfd2c1d05, - 0x848fd2c5, - 0xf6fb2299, - 0xf523f357, - 0xa6327623, - 0x93a83531, - 0x56cccd02, - 0xacf08162, - 0x5a75ebb5, - 0x6e163697, - 0x88d273cc, - 0xde966292, - 0x81b949d0, - 0x4c50901b, - 0x71c65614, - 0xe6c6c7bd, - 0x327a140a, - 0x45e1d006, - 0xc3f27b9a, - 0xc9aa53fd, - 0x62a80f00, - 0xbb25bfe2, - 0x35bdd2f6, - 0x71126905, - 0xb2040222, - 0xb6cbcf7c, - 0xcd769c2b, - 0x53113ec0, - 0x1640e3d3, - 0x38abbd60, - 0x2547adf0, - 0xba38209c, - 0xf746ce76, - 0x77afa1c5, - 0x20756060, - 0x85cbfe4e, - 0x8ae88dd8, - 0x7aaaf9b0, - 0x4cf9aa7e, - 0x1948c25c, - 0x02fb8a8c, - 0x01c36ae4, - 0xd6ebe1f9, - 0x90d4f869, - 0xa65cdea0, - 0x3f09252d, - 0xc208e69f, - 0xb74e6132, - 0xce77e25b, - 0x578fdfe3, - 0x3ac372e6 }; -public void decipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { - int xL = lastDecipherXL; - int xR = lastDecipherXR; - - int dataXL; - int dataXR; - - int[] xLxR = new int[2]; - - for (int i = 0; i < len; i = i + 8) { - dataXL = (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24); - dataXR = (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24); - - decipher(dataXL, dataXR, xLxR); - - xL ^= xLxR[0]; - xR ^= xLxR[1]; - - dst[dstOff + i] = (byte) (xL & 0xff); - dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff); - dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff); - dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff); - dst[dstOff + i + 4] = (byte) (xR & 0xff); - dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff); - dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff); - dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff); - - xL = dataXL; - xR = dataXR; - } - - lastDecipherXL = xL; - lastDecipherXR = xR; -} -private void decipher(int xL, int xR, int[] xLxR) { - xL ^= P[17]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[16]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[15]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[14]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[13]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[12]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[11]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[10]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[9]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[8]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[7]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[6]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[5]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[4]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[3]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[2]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[1]; - xR ^= P[0]; - - xLxR[0] = xR; - xLxR[1] = xL; -} -public void encipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { - int xL = lastEncipherXL; - int xR = lastEncipherXR; - - int[] xLxR = new int[2]; - - for (int i = 0; i < len; i = i + 8) { - xL ^= (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24); - xR ^= (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24); - - encipher(xL, xR, xLxR); - - xL = xLxR[0]; - xR = xLxR[1]; - - dst[dstOff + i] = (byte) (xL & 0xff); - dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff); - dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff); - dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff); - dst[dstOff + i + 4] = (byte) (xR & 0xff); - dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff); - dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff); - dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff); - } - - lastEncipherXL = xL; - lastEncipherXR = xR; -} -private void encipher(int xL, int xR, int[] xLxR) { - xL ^= P[0]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[1]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[2]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[3]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[4]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[5]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[6]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[7]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[8]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[9]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[10]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[11]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[12]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[13]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[14]; - xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[15]; - xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[16]; - xR ^= P[17]; - - xLxR[0] = xR; - xLxR[1] = xL; -} -public void setKey(byte key[]) { - int data = 0; - int offset = 0; - - for (int i = 0; i < P.length; ++i) { - P[i] = INIT_DATA[offset++]; - } - - for (int i = 0; i < S.length; ++i) { - for (int j = 0; j < S[i].length; ++j) { - S[i][j] = INIT_DATA[offset++]; - } - } - - offset = 0; - for (int i = 0; i < P.length; ++i) { - data = 0; - for (int k = 0; k < 4; ++k) { - data = (data << 8) | (key[offset++] & 0xff); - if (offset >= key.length) { - offset = 0; - } - } - P[i] = P[i] ^ data; - } - - int[] lr = new int[] { 0, 0 }; - for (int i = 0; i < P.length; i += 2) { - encipher(lr[0], lr[1], lr); - P[i] = lr[0]; - P[i + 1] = lr[1]; - } - - for (int i = 0; i < S.length; ++i) { - for (int j = 0; j < S[i].length; j += 2) { - encipher(lr[0], lr[1], lr); - S[i][j] = lr[0]; - S[i][j + 1] = lr[1]; - } - } - - lastEncipherXL = 0; - lastEncipherXR = 0; - lastDecipherXL = 0; - lastDecipherXR = 0; -} -} +package org.eclipse.team.internal.ccvs.ssh; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +public class Blowfish extends Cipher { + private int[] P = new int[18]; + private int[][] S = new int[4][256]; + + private int lastEncipherXL = 0; + private int lastEncipherXR = 0; + private int lastDecipherXL = 0; + private int lastDecipherXR = 0; + + private final static int[] INIT_DATA = + { + 0x243f6a88, + 0x85a308d3, + 0x13198a2e, + 0x03707344, + 0xa4093822, + 0x299f31d0, + 0x082efa98, + 0xec4e6c89, + 0x452821e6, + 0x38d01377, + 0xbe5466cf, + 0x34e90c6c, + 0xc0ac29b7, + 0xc97c50dd, + 0x3f84d5b5, + 0xb5470917, + 0x9216d5d9, + 0x8979fb1b, + 0xd1310ba6, + 0x98dfb5ac, + 0x2ffd72db, + 0xd01adfb7, + 0xb8e1afed, + 0x6a267e96, + 0xba7c9045, + 0xf12c7f99, + 0x24a19947, + 0xb3916cf7, + 0x0801f2e2, + 0x858efc16, + 0x636920d8, + 0x71574e69, + 0xa458fea3, + 0xf4933d7e, + 0x0d95748f, + 0x728eb658, + 0x718bcd58, + 0x82154aee, + 0x7b54a41d, + 0xc25a59b5, + 0x9c30d539, + 0x2af26013, + 0xc5d1b023, + 0x286085f0, + 0xca417918, + 0xb8db38ef, + 0x8e79dcb0, + 0x603a180e, + 0x6c9e0e8b, + 0xb01e8a3e, + 0xd71577c1, + 0xbd314b27, + 0x78af2fda, + 0x55605c60, + 0xe65525f3, + 0xaa55ab94, + 0x57489862, + 0x63e81440, + 0x55ca396a, + 0x2aab10b6, + 0xb4cc5c34, + 0x1141e8ce, + 0xa15486af, + 0x7c72e993, + 0xb3ee1411, + 0x636fbc2a, + 0x2ba9c55d, + 0x741831f6, + 0xce5c3e16, + 0x9b87931e, + 0xafd6ba33, + 0x6c24cf5c, + 0x7a325381, + 0x28958677, + 0x3b8f4898, + 0x6b4bb9af, + 0xc4bfe81b, + 0x66282193, + 0x61d809cc, + 0xfb21a991, + 0x487cac60, + 0x5dec8032, + 0xef845d5d, + 0xe98575b1, + 0xdc262302, + 0xeb651b88, + 0x23893e81, + 0xd396acc5, + 0x0f6d6ff3, + 0x83f44239, + 0x2e0b4482, + 0xa4842004, + 0x69c8f04a, + 0x9e1f9b5e, + 0x21c66842, + 0xf6e96c9a, + 0x670c9c61, + 0xabd388f0, + 0x6a51a0d2, + 0xd8542f68, + 0x960fa728, + 0xab5133a3, + 0x6eef0b6c, + 0x137a3be4, + 0xba3bf050, + 0x7efb2a98, + 0xa1f1651d, + 0x39af0176, + 0x66ca593e, + 0x82430e88, + 0x8cee8619, + 0x456f9fb4, + 0x7d84a5c3, + 0x3b8b5ebe, + 0xe06f75d8, + 0x85c12073, + 0x401a449f, + 0x56c16aa6, + 0x4ed3aa62, + 0x363f7706, + 0x1bfedf72, + 0x429b023d, + 0x37d0d724, + 0xd00a1248, + 0xdb0fead3, + 0x49f1c09b, + 0x075372c9, + 0x80991b7b, + 0x25d479d8, + 0xf6e8def7, + 0xe3fe501a, + 0xb6794c3b, + 0x976ce0bd, + 0x04c006ba, + 0xc1a94fb6, + 0x409f60c4, + 0x5e5c9ec2, + 0x196a2463, + 0x68fb6faf, + 0x3e6c53b5, + 0x1339b2eb, + 0x3b52ec6f, + 0x6dfc511f, + 0x9b30952c, + 0xcc814544, + 0xaf5ebd09, + 0xbee3d004, + 0xde334afd, + 0x660f2807, + 0x192e4bb3, + 0xc0cba857, + 0x45c8740f, + 0xd20b5f39, + 0xb9d3fbdb, + 0x5579c0bd, + 0x1a60320a, + 0xd6a100c6, + 0x402c7279, + 0x679f25fe, + 0xfb1fa3cc, + 0x8ea5e9f8, + 0xdb3222f8, + 0x3c7516df, + 0xfd616b15, + 0x2f501ec8, + 0xad0552ab, + 0x323db5fa, + 0xfd238760, + 0x53317b48, + 0x3e00df82, + 0x9e5c57bb, + 0xca6f8ca0, + 0x1a87562e, + 0xdf1769db, + 0xd542a8f6, + 0x287effc3, + 0xac6732c6, + 0x8c4f5573, + 0x695b27b0, + 0xbbca58c8, + 0xe1ffa35d, + 0xb8f011a0, + 0x10fa3d98, + 0xfd2183b8, + 0x4afcb56c, + 0x2dd1d35b, + 0x9a53e479, + 0xb6f84565, + 0xd28e49bc, + 0x4bfb9790, + 0xe1ddf2da, + 0xa4cb7e33, + 0x62fb1341, + 0xcee4c6e8, + 0xef20cada, + 0x36774c01, + 0xd07e9efe, + 0x2bf11fb4, + 0x95dbda4d, + 0xae909198, + 0xeaad8e71, + 0x6b93d5a0, + 0xd08ed1d0, + 0xafc725e0, + 0x8e3c5b2f, + 0x8e7594b7, + 0x8ff6e2fb, + 0xf2122b64, + 0x8888b812, + 0x900df01c, + 0x4fad5ea0, + 0x688fc31c, + 0xd1cff191, + 0xb3a8c1ad, + 0x2f2f2218, + 0xbe0e1777, + 0xea752dfe, + 0x8b021fa1, + 0xe5a0cc0f, + 0xb56f74e8, + 0x18acf3d6, + 0xce89e299, + 0xb4a84fe0, + 0xfd13e0b7, + 0x7cc43b81, + 0xd2ada8d9, + 0x165fa266, + 0x80957705, + 0x93cc7314, + 0x211a1477, + 0xe6ad2065, + 0x77b5fa86, + 0xc75442f5, + 0xfb9d35cf, + 0xebcdaf0c, + 0x7b3e89a0, + 0xd6411bd3, + 0xae1e7e49, + 0x00250e2d, + 0x2071b35e, + 0x226800bb, + 0x57b8e0af, + 0x2464369b, + 0xf009b91e, + 0x5563911d, + 0x59dfa6aa, + 0x78c14389, + 0xd95a537f, + 0x207d5ba2, + 0x02e5b9c5, + 0x83260376, + 0x6295cfa9, + 0x11c81968, + 0x4e734a41, + 0xb3472dca, + 0x7b14a94a, + 0x1b510052, + 0x9a532915, + 0xd60f573f, + 0xbc9bc6e4, + 0x2b60a476, + 0x81e67400, + 0x08ba6fb5, + 0x571be91f, + 0xf296ec6b, + 0x2a0dd915, + 0xb6636521, + 0xe7b9f9b6, + 0xff34052e, + 0xc5855664, + 0x53b02d5d, + 0xa99f8fa1, + 0x08ba4799, + 0x6e85076a, + 0x4b7a70e9, + 0xb5b32944, + 0xdb75092e, + 0xc4192623, + 0xad6ea6b0, + 0x49a7df7d, + 0x9cee60b8, + 0x8fedb266, + 0xecaa8c71, + 0x699a17ff, + 0x5664526c, + 0xc2b19ee1, + 0x193602a5, + 0x75094c29, + 0xa0591340, + 0xe4183a3e, + 0x3f54989a, + 0x5b429d65, + 0x6b8fe4d6, + 0x99f73fd6, + 0xa1d29c07, + 0xefe830f5, + 0x4d2d38e6, + 0xf0255dc1, + 0x4cdd2086, + 0x8470eb26, + 0x6382e9c6, + 0x021ecc5e, + 0x09686b3f, + 0x3ebaefc9, + 0x3c971814, + 0x6b6a70a1, + 0x687f3584, + 0x52a0e286, + 0xb79c5305, + 0xaa500737, + 0x3e07841c, + 0x7fdeae5c, + 0x8e7d44ec, + 0x5716f2b8, + 0xb03ada37, + 0xf0500c0d, + 0xf01c1f04, + 0x0200b3ff, + 0xae0cf51a, + 0x3cb574b2, + 0x25837a58, + 0xdc0921bd, + 0xd19113f9, + 0x7ca92ff6, + 0x94324773, + 0x22f54701, + 0x3ae5e581, + 0x37c2dadc, + 0xc8b57634, + 0x9af3dda7, + 0xa9446146, + 0x0fd0030e, + 0xecc8c73e, + 0xa4751e41, + 0xe238cd99, + 0x3bea0e2f, + 0x3280bba1, + 0x183eb331, + 0x4e548b38, + 0x4f6db908, + 0x6f420d03, + 0xf60a04bf, + 0x2cb81290, + 0x24977c79, + 0x5679b072, + 0xbcaf89af, + 0xde9a771f, + 0xd9930810, + 0xb38bae12, + 0xdccf3f2e, + 0x5512721f, + 0x2e6b7124, + 0x501adde6, + 0x9f84cd87, + 0x7a584718, + 0x7408da17, + 0xbc9f9abc, + 0xe94b7d8c, + 0xec7aec3a, + 0xdb851dfa, + 0x63094366, + 0xc464c3d2, + 0xef1c1847, + 0x3215d908, + 0xdd433b37, + 0x24c2ba16, + 0x12a14d43, + 0x2a65c451, + 0x50940002, + 0x133ae4dd, + 0x71dff89e, + 0x10314e55, + 0x81ac77d6, + 0x5f11199b, + 0x043556f1, + 0xd7a3c76b, + 0x3c11183b, + 0x5924a509, + 0xf28fe6ed, + 0x97f1fbfa, + 0x9ebabf2c, + 0x1e153c6e, + 0x86e34570, + 0xeae96fb1, + 0x860e5e0a, + 0x5a3e2ab3, + 0x771fe71c, + 0x4e3d06fa, + 0x2965dcb9, + 0x99e71d0f, + 0x803e89d6, + 0x5266c825, + 0x2e4cc978, + 0x9c10b36a, + 0xc6150eba, + 0x94e2ea78, + 0xa5fc3c53, + 0x1e0a2df4, + 0xf2f74ea7, + 0x361d2b3d, + 0x1939260f, + 0x19c27960, + 0x5223a708, + 0xf71312b6, + 0xebadfe6e, + 0xeac31f66, + 0xe3bc4595, + 0xa67bc883, + 0xb17f37d1, + 0x018cff28, + 0xc332ddef, + 0xbe6c5aa5, + 0x65582185, + 0x68ab9802, + 0xeecea50f, + 0xdb2f953b, + 0x2aef7dad, + 0x5b6e2f84, + 0x1521b628, + 0x29076170, + 0xecdd4775, + 0x619f1510, + 0x13cca830, + 0xeb61bd96, + 0x0334fe1e, + 0xaa0363cf, + 0xb5735c90, + 0x4c70a239, + 0xd59e9e0b, + 0xcbaade14, + 0xeecc86bc, + 0x60622ca7, + 0x9cab5cab, + 0xb2f3846e, + 0x648b1eaf, + 0x19bdf0ca, + 0xa02369b9, + 0x655abb50, + 0x40685a32, + 0x3c2ab4b3, + 0x319ee9d5, + 0xc021b8f7, + 0x9b540b19, + 0x875fa099, + 0x95f7997e, + 0x623d7da8, + 0xf837889a, + 0x97e32d77, + 0x11ed935f, + 0x16681281, + 0x0e358829, + 0xc7e61fd6, + 0x96dedfa1, + 0x7858ba99, + 0x57f584a5, + 0x1b227263, + 0x9b83c3ff, + 0x1ac24696, + 0xcdb30aeb, + 0x532e3054, + 0x8fd948e4, + 0x6dbc3128, + 0x58ebf2ef, + 0x34c6ffea, + 0xfe28ed61, + 0xee7c3c73, + 0x5d4a14d9, + 0xe864b7e3, + 0x42105d14, + 0x203e13e0, + 0x45eee2b6, + 0xa3aaabea, + 0xdb6c4f15, + 0xfacb4fd0, + 0xc742f442, + 0xef6abbb5, + 0x654f3b1d, + 0x41cd2105, + 0xd81e799e, + 0x86854dc7, + 0xe44b476a, + 0x3d816250, + 0xcf62a1f2, + 0x5b8d2646, + 0xfc8883a0, + 0xc1c7b6a3, + 0x7f1524c3, + 0x69cb7492, + 0x47848a0b, + 0x5692b285, + 0x095bbf00, + 0xad19489d, + 0x1462b174, + 0x23820e00, + 0x58428d2a, + 0x0c55f5ea, + 0x1dadf43e, + 0x233f7061, + 0x3372f092, + 0x8d937e41, + 0xd65fecf1, + 0x6c223bdb, + 0x7cde3759, + 0xcbee7460, + 0x4085f2a7, + 0xce77326e, + 0xa6078084, + 0x19f8509e, + 0xe8efd855, + 0x61d99735, + 0xa969a7aa, + 0xc50c06c2, + 0x5a04abfc, + 0x800bcadc, + 0x9e447a2e, + 0xc3453484, + 0xfdd56705, + 0x0e1e9ec9, + 0xdb73dbd3, + 0x105588cd, + 0x675fda79, + 0xe3674340, + 0xc5c43465, + 0x713e38d8, + 0x3d28f89e, + 0xf16dff20, + 0x153e21e7, + 0x8fb03d4a, + 0xe6e39f2b, + 0xdb83adf7, + 0xe93d5a68, + 0x948140f7, + 0xf64c261c, + 0x94692934, + 0x411520f7, + 0x7602d4f7, + 0xbcf46b2e, + 0xd4a20068, + 0xd4082471, + 0x3320f46a, + 0x43b7d4b7, + 0x500061af, + 0x1e39f62e, + 0x97244546, + 0x14214f74, + 0xbf8b8840, + 0x4d95fc1d, + 0x96b591af, + 0x70f4ddd3, + 0x66a02f45, + 0xbfbc09ec, + 0x03bd9785, + 0x7fac6dd0, + 0x31cb8504, + 0x96eb27b3, + 0x55fd3941, + 0xda2547e6, + 0xabca0a9a, + 0x28507825, + 0x530429f4, + 0x0a2c86da, + 0xe9b66dfb, + 0x68dc1462, + 0xd7486900, + 0x680ec0a4, + 0x27a18dee, + 0x4f3ffea2, + 0xe887ad8c, + 0xb58ce006, + 0x7af4d6b6, + 0xaace1e7c, + 0xd3375fec, + 0xce78a399, + 0x406b2a42, + 0x20fe9e35, + 0xd9f385b9, + 0xee39d7ab, + 0x3b124e8b, + 0x1dc9faf7, + 0x4b6d1856, + 0x26a36631, + 0xeae397b2, + 0x3a6efa74, + 0xdd5b4332, + 0x6841e7f7, + 0xca7820fb, + 0xfb0af54e, + 0xd8feb397, + 0x454056ac, + 0xba489527, + 0x55533a3a, + 0x20838d87, + 0xfe6ba9b7, + 0xd096954b, + 0x55a867bc, + 0xa1159a58, + 0xcca92963, + 0x99e1db33, + 0xa62a4a56, + 0x3f3125f9, + 0x5ef47e1c, + 0x9029317c, + 0xfdf8e802, + 0x04272f70, + 0x80bb155c, + 0x05282ce3, + 0x95c11548, + 0xe4c66d22, + 0x48c1133f, + 0xc70f86dc, + 0x07f9c9ee, + 0x41041f0f, + 0x404779a4, + 0x5d886e17, + 0x325f51eb, + 0xd59bc0d1, + 0xf2bcc18f, + 0x41113564, + 0x257b7834, + 0x602a9c60, + 0xdff8e8a3, + 0x1f636c1b, + 0x0e12b4c2, + 0x02e1329e, + 0xaf664fd1, + 0xcad18115, + 0x6b2395e0, + 0x333e92e1, + 0x3b240b62, + 0xeebeb922, + 0x85b2a20e, + 0xe6ba0d99, + 0xde720c8c, + 0x2da2f728, + 0xd0127845, + 0x95b794fd, + 0x647d0862, + 0xe7ccf5f0, + 0x5449a36f, + 0x877d48fa, + 0xc39dfd27, + 0xf33e8d1e, + 0x0a476341, + 0x992eff74, + 0x3a6f6eab, + 0xf4f8fd37, + 0xa812dc60, + 0xa1ebddf8, + 0x991be14c, + 0xdb6e6b0d, + 0xc67b5510, + 0x6d672c37, + 0x2765d43b, + 0xdcd0e804, + 0xf1290dc7, + 0xcc00ffa3, + 0xb5390f92, + 0x690fed0b, + 0x667b9ffb, + 0xcedb7d9c, + 0xa091cf0b, + 0xd9155ea3, + 0xbb132f88, + 0x515bad24, + 0x7b9479bf, + 0x763bd6eb, + 0x37392eb3, + 0xcc115979, + 0x8026e297, + 0xf42e312d, + 0x6842ada7, + 0xc66a2b3b, + 0x12754ccc, + 0x782ef11c, + 0x6a124237, + 0xb79251e7, + 0x06a1bbe6, + 0x4bfb6350, + 0x1a6b1018, + 0x11caedfa, + 0x3d25bdd8, + 0xe2e1c3c9, + 0x44421659, + 0x0a121386, + 0xd90cec6e, + 0xd5abea2a, + 0x64af674e, + 0xda86a85f, + 0xbebfe988, + 0x64e4c3fe, + 0x9dbc8057, + 0xf0f7c086, + 0x60787bf8, + 0x6003604d, + 0xd1fd8346, + 0xf6381fb0, + 0x7745ae04, + 0xd736fccc, + 0x83426b33, + 0xf01eab71, + 0xb0804187, + 0x3c005e5f, + 0x77a057be, + 0xbde8ae24, + 0x55464299, + 0xbf582e61, + 0x4e58f48f, + 0xf2ddfda2, + 0xf474ef38, + 0x8789bdc2, + 0x5366f9c3, + 0xc8b38e74, + 0xb475f255, + 0x46fcd9b9, + 0x7aeb2661, + 0x8b1ddf84, + 0x846a0e79, + 0x915f95e2, + 0x466e598e, + 0x20b45770, + 0x8cd55591, + 0xc902de4c, + 0xb90bace1, + 0xbb8205d0, + 0x11a86248, + 0x7574a99e, + 0xb77f19b6, + 0xe0a9dc09, + 0x662d09a1, + 0xc4324633, + 0xe85a1f02, + 0x09f0be8c, + 0x4a99a025, + 0x1d6efe10, + 0x1ab93d1d, + 0x0ba5a4df, + 0xa186f20f, + 0x2868f169, + 0xdcb7da83, + 0x573906fe, + 0xa1e2ce9b, + 0x4fcd7f52, + 0x50115e01, + 0xa70683fa, + 0xa002b5c4, + 0x0de6d027, + 0x9af88c27, + 0x773f8641, + 0xc3604c06, + 0x61a806b5, + 0xf0177a28, + 0xc0f586e0, + 0x006058aa, + 0x30dc7d62, + 0x11e69ed7, + 0x2338ea63, + 0x53c2dd94, + 0xc2c21634, + 0xbbcbee56, + 0x90bcb6de, + 0xebfc7da1, + 0xce591d76, + 0x6f05e409, + 0x4b7c0188, + 0x39720a3d, + 0x7c927c24, + 0x86e3725f, + 0x724d9db9, + 0x1ac15bb4, + 0xd39eb8fc, + 0xed545578, + 0x08fca5b5, + 0xd83d7cd3, + 0x4dad0fc4, + 0x1e50ef5e, + 0xb161e6f8, + 0xa28514d9, + 0x6c51133c, + 0x6fd5c7e7, + 0x56e14ec4, + 0x362abfce, + 0xddc6c837, + 0xd79a3234, + 0x92638212, + 0x670efa8e, + 0x406000e0, + 0x3a39ce37, + 0xd3faf5cf, + 0xabc27737, + 0x5ac52d1b, + 0x5cb0679e, + 0x4fa33742, + 0xd3822740, + 0x99bc9bbe, + 0xd5118e9d, + 0xbf0f7315, + 0xd62d1c7e, + 0xc700c47b, + 0xb78c1b6b, + 0x21a19045, + 0xb26eb1be, + 0x6a366eb4, + 0x5748ab2f, + 0xbc946e79, + 0xc6a376d2, + 0x6549c2c8, + 0x530ff8ee, + 0x468dde7d, + 0xd5730a1d, + 0x4cd04dc6, + 0x2939bbdb, + 0xa9ba4650, + 0xac9526e8, + 0xbe5ee304, + 0xa1fad5f0, + 0x6a2d519a, + 0x63ef8ce2, + 0x9a86ee22, + 0xc089c2b8, + 0x43242ef6, + 0xa51e03aa, + 0x9cf2d0a4, + 0x83c061ba, + 0x9be96a4d, + 0x8fe51550, + 0xba645bd6, + 0x2826a2f9, + 0xa73a3ae1, + 0x4ba99586, + 0xef5562e9, + 0xc72fefd3, + 0xf752f7da, + 0x3f046f69, + 0x77fa0a59, + 0x80e4a915, + 0x87b08601, + 0x9b09e6ad, + 0x3b3ee593, + 0xe990fd5a, + 0x9e34d797, + 0x2cf0b7d9, + 0x022b8b51, + 0x96d5ac3a, + 0x017da67d, + 0xd1cf3ed6, + 0x7c7d2d28, + 0x1f9f25cf, + 0xadf2b89b, + 0x5ad6b472, + 0x5a88f54c, + 0xe029ac71, + 0xe019a5e6, + 0x47b0acfd, + 0xed93fa9b, + 0xe8d3c48d, + 0x283b57cc, + 0xf8d56629, + 0x79132e28, + 0x785f0191, + 0xed756055, + 0xf7960e44, + 0xe3d35e8c, + 0x15056dd4, + 0x88f46dba, + 0x03a16125, + 0x0564f0bd, + 0xc3eb9e15, + 0x3c9057a2, + 0x97271aec, + 0xa93a072a, + 0x1b3f6d9b, + 0x1e6321f5, + 0xf59c66fb, + 0x26dcf319, + 0x7533d928, + 0xb155fdf5, + 0x03563482, + 0x8aba3cbb, + 0x28517711, + 0xc20ad9f8, + 0xabcc5167, + 0xccad925f, + 0x4de81751, + 0x3830dc8e, + 0x379d5862, + 0x9320f991, + 0xea7a90c2, + 0xfb3e7bce, + 0x5121ce64, + 0x774fbe32, + 0xa8b6e37e, + 0xc3293d46, + 0x48de5369, + 0x6413e680, + 0xa2ae0810, + 0xdd6db224, + 0x69852dfd, + 0x09072166, + 0xb39a460a, + 0x6445c0dd, + 0x586cdecf, + 0x1c20c8ae, + 0x5bbef7dd, + 0x1b588d40, + 0xccd2017f, + 0x6bb4e3bb, + 0xdda26a7e, + 0x3a59ff45, + 0x3e350a44, + 0xbcb4cdd5, + 0x72eacea8, + 0xfa6484bb, + 0x8d6612ae, + 0xbf3c6f47, + 0xd29be463, + 0x542f5d9e, + 0xaec2771b, + 0xf64e6370, + 0x740e0d8d, + 0xe75b1357, + 0xf8721671, + 0xaf537d5d, + 0x4040cb08, + 0x4eb4e2cc, + 0x34d2466a, + 0x0115af84, + 0xe1b00428, + 0x95983a1d, + 0x06b89fb4, + 0xce6ea048, + 0x6f3f3b82, + 0x3520ab82, + 0x011a1d4b, + 0x277227f8, + 0x611560b1, + 0xe7933fdc, + 0xbb3a792b, + 0x344525bd, + 0xa08839e1, + 0x51ce794b, + 0x2f32c9b7, + 0xa01fbac9, + 0xe01cc87e, + 0xbcc7d1f6, + 0xcf0111c3, + 0xa1e8aac7, + 0x1a908749, + 0xd44fbd9a, + 0xd0dadecb, + 0xd50ada38, + 0x0339c32a, + 0xc6913667, + 0x8df9317c, + 0xe0b12b4f, + 0xf79e59b7, + 0x43f5bb3a, + 0xf2d519ff, + 0x27d9459c, + 0xbf97222c, + 0x15e6fc2a, + 0x0f91fc71, + 0x9b941525, + 0xfae59361, + 0xceb69ceb, + 0xc2a86459, + 0x12baa8d1, + 0xb6c1075e, + 0xe3056a0c, + 0x10d25065, + 0xcb03a442, + 0xe0ec6e0e, + 0x1698db3b, + 0x4c98a0be, + 0x3278e964, + 0x9f1f9532, + 0xe0d392df, + 0xd3a0342b, + 0x8971f21e, + 0x1b0a7441, + 0x4ba3348c, + 0xc5be7120, + 0xc37632d8, + 0xdf359f8d, + 0x9b992f2e, + 0xe60b6f47, + 0x0fe3f11d, + 0xe54cda54, + 0x1edad891, + 0xce6279cf, + 0xcd3e7e6f, + 0x1618b166, + 0xfd2c1d05, + 0x848fd2c5, + 0xf6fb2299, + 0xf523f357, + 0xa6327623, + 0x93a83531, + 0x56cccd02, + 0xacf08162, + 0x5a75ebb5, + 0x6e163697, + 0x88d273cc, + 0xde966292, + 0x81b949d0, + 0x4c50901b, + 0x71c65614, + 0xe6c6c7bd, + 0x327a140a, + 0x45e1d006, + 0xc3f27b9a, + 0xc9aa53fd, + 0x62a80f00, + 0xbb25bfe2, + 0x35bdd2f6, + 0x71126905, + 0xb2040222, + 0xb6cbcf7c, + 0xcd769c2b, + 0x53113ec0, + 0x1640e3d3, + 0x38abbd60, + 0x2547adf0, + 0xba38209c, + 0xf746ce76, + 0x77afa1c5, + 0x20756060, + 0x85cbfe4e, + 0x8ae88dd8, + 0x7aaaf9b0, + 0x4cf9aa7e, + 0x1948c25c, + 0x02fb8a8c, + 0x01c36ae4, + 0xd6ebe1f9, + 0x90d4f869, + 0xa65cdea0, + 0x3f09252d, + 0xc208e69f, + 0xb74e6132, + 0xce77e25b, + 0x578fdfe3, + 0x3ac372e6 }; +public void decipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { + int xL = lastDecipherXL; + int xR = lastDecipherXR; + + int dataXL; + int dataXR; + + int[] xLxR = new int[2]; + + for (int i = 0; i < len; i = i + 8) { + dataXL = (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24); + dataXR = (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24); + + decipher(dataXL, dataXR, xLxR); + + xL ^= xLxR[0]; + xR ^= xLxR[1]; + + dst[dstOff + i] = (byte) (xL & 0xff); + dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff); + dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff); + dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff); + dst[dstOff + i + 4] = (byte) (xR & 0xff); + dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff); + dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff); + dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff); + + xL = dataXL; + xR = dataXR; + } + + lastDecipherXL = xL; + lastDecipherXR = xR; +} +private void decipher(int xL, int xR, int[] xLxR) { + xL ^= P[17]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[16]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[15]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[14]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[13]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[12]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[11]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[10]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[9]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[8]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[7]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[6]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[5]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[4]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[3]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[2]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[1]; + xR ^= P[0]; + + xLxR[0] = xR; + xLxR[1] = xL; +} +public void encipher(byte[] src, int srcOff, byte[] dst, int dstOff, int len) { + int xL = lastEncipherXL; + int xR = lastEncipherXR; + + int[] xLxR = new int[2]; + + for (int i = 0; i < len; i = i + 8) { + xL ^= (src[srcOff + i] & 0xff) | ((src[srcOff + i + 1] & 0xff) << 8) | ((src[srcOff + i + 2] & 0xff) << 16) | ((src[srcOff + i + 3] & 0xff) << 24); + xR ^= (src[srcOff + i + 4] & 0xff) | ((src[srcOff + i + 5] & 0xff) << 8) | ((src[srcOff + i + 6] & 0xff) << 16) | ((src[srcOff + i + 7] & 0xff) << 24); + + encipher(xL, xR, xLxR); + + xL = xLxR[0]; + xR = xLxR[1]; + + dst[dstOff + i] = (byte) (xL & 0xff); + dst[dstOff + i + 1] = (byte) ((xL >> 8) & 0xff); + dst[dstOff + i + 2] = (byte) ((xL >> 16) & 0xff); + dst[dstOff + i + 3] = (byte) ((xL >> 24) & 0xff); + dst[dstOff + i + 4] = (byte) (xR & 0xff); + dst[dstOff + i + 5] = (byte) ((xR >> 8) & 0xff); + dst[dstOff + i + 6] = (byte) ((xR >> 16) & 0xff); + dst[dstOff + i + 7] = (byte) ((xR >> 24) & 0xff); + } + + lastEncipherXL = xL; + lastEncipherXR = xR; +} +private void encipher(int xL, int xR, int[] xLxR) { + xL ^= P[0]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[1]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[2]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[3]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[4]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[5]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[6]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[7]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[8]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[9]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[10]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[11]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[12]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[13]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[14]; + xR ^= (((S[0][(xL >> 24) & 0xff] + S[1][(xL >> 16) & 0xff]) ^ (S[2][(xL >> 8) & 0xff])) + (S[3][xL & 0xff])) ^ P[15]; + xL ^= (((S[0][(xR >> 24) & 0xff] + S[1][(xR >> 16) & 0xff]) ^ (S[2][(xR >> 8) & 0xff])) + (S[3][xR & 0xff])) ^ P[16]; + xR ^= P[17]; + + xLxR[0] = xR; + xLxR[1] = xL; +} +public void setKey(byte key[]) { + int data = 0; + int offset = 0; + + for (int i = 0; i < P.length; ++i) { + P[i] = INIT_DATA[offset++]; + } + + for (int i = 0; i < S.length; ++i) { + for (int j = 0; j < S[i].length; ++j) { + S[i][j] = INIT_DATA[offset++]; + } + } + + offset = 0; + for (int i = 0; i < P.length; ++i) { + data = 0; + for (int k = 0; k < 4; ++k) { + data = (data << 8) | (key[offset++] & 0xff); + if (offset >= key.length) { + offset = 0; + } + } + P[i] = P[i] ^ data; + } + + int[] lr = new int[] { 0, 0 }; + for (int i = 0; i < P.length; i += 2) { + encipher(lr[0], lr[1], lr); + P[i] = lr[0]; + P[i + 1] = lr[1]; + } + + for (int i = 0; i < S.length; ++i) { + for (int j = 0; j < S[i].length; j += 2) { + encipher(lr[0], lr[1], lr); + S[i][j] = lr[0]; + S[i][j + 1] = lr[1]; + } + } + + lastEncipherXL = 0; + lastEncipherXR = 0; + lastDecipherXL = 0; + lastDecipherXR = 0; +} +} diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java index 36d7a658c..839a6ef30 100644 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java +++ b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/ClientPacket.java @@ -1,47 +1,47 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -class ClientPacket extends Packet { - byte[] packet; -public ClientPacket(int type, byte[] data, Cipher cipher) { - packetLength = data == null ? 5 : data.length + 5; - paddingLength = 8 - (packetLength % 8); - packetType = type; - packet = new byte[4 + paddingLength + packetLength]; - - int packetOff = 0; - Misc.writeInt(packetLength, packet, packetOff); - packetOff += 4; - - if (cipher == null) { - for (int i = 0; i < paddingLength; i++) { - packet[packetOff++] = 0; - } - } else { - Misc.random(packet, packetOff, paddingLength, false); - packetOff += paddingLength; - } - - packet[packetOff++] = (byte) packetType; - - if (data != null) { - for (int i = 0; i < data.length; ++i) { - packet[packetOff++] = data[i]; - } - } - - long crc = Misc.crc32(packet, 4, packet.length - 8, 0); - Misc.writeInt((int) crc, packet, packetOff); - packetOff += 4; - - if (cipher != null) { - cipher.encipher(packet, 4, packet, 4, packet.length - 4); - } -} -public byte[] getBytes() { - return packet; -} -} +package org.eclipse.team.internal.ccvs.ssh; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +class ClientPacket extends Packet { + byte[] packet; +public ClientPacket(int type, byte[] data, Cipher cipher) { + packetLength = data == null ? 5 : data.length + 5; + paddingLength = 8 - (packetLength % 8); + packetType = type; + packet = new byte[4 + paddingLength + packetLength]; + + int packetOff = 0; + Misc.writeInt(packetLength, packet, packetOff); + packetOff += 4; + + if (cipher == null) { + for (int i = 0; i < paddingLength; i++) { + packet[packetOff++] = 0; + } + } else { + Misc.random(packet, packetOff, paddingLength, false); + packetOff += paddingLength; + } + + packet[packetOff++] = (byte) packetType; + + if (data != null) { + for (int i = 0; i < data.length; ++i) { + packet[packetOff++] = data[i]; + } + } + + long crc = Misc.crc32(packet, 4, packet.length - 8, 0); + Misc.writeInt((int) crc, packet, packetOff); + packetOff += 4; + + if (cipher != null) { + cipher.encipher(packet, 4, packet, 4, packet.length - 4); + } +} +public byte[] getBytes() { + return packet; +} +} diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java index 87cdc0648..ae83339ac 100644 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java +++ b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/Packet.java @@ -1,14 +1,14 @@ -package org.eclipse.team.internal.ccvs.ssh; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ -class Packet { - protected int packetLength; - protected int paddingLength; - protected int packetType; -public int getType() { - return packetType; -} -} +package org.eclipse.team.internal.ccvs.ssh; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ +class Packet { + protected int packetLength; + protected int paddingLength; + protected int packetType; +public int getType() { + return packetType; +} +} diff --git a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java index 762ababf1..d01c52238 100644 --- a/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java +++ b/bundles/org.eclipse.team.cvs.ssh/src/org/eclipse/team/internal/ccvs/ssh/SSHPlugin.java @@ -1 +1 @@ -package org.eclipse.team.internal.ccvs.ssh; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; public class SSHPlugin extends Plugin { public static String ID = "org.eclipse.team.cvs.ssh";//$NON-NLS-1$ /** * Constructor for SSHPlugin */ public SSHPlugin(IPluginDescriptor d) { super(d); } /** * @see Plugin#startup() */ public void startup() throws CoreException { super.startup(); Policy.localize("org.eclipse.team.internal.ccvs.ssh.messages"); //$NON-NLS-1$ } } \ No newline at end of file +package org.eclipse.team.internal.ccvs.ssh; /* * (c) Copyright IBM Corp. 2000, 2002. * All Rights Reserved. */ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; public class SSHPlugin extends Plugin { public static String ID = "org.eclipse.team.cvs.ssh";//$NON-NLS-1$ /** * Constructor for SSHPlugin */ public SSHPlugin(IPluginDescriptor d) { super(d); } /** * @see Plugin#startup() */ public void startup() throws CoreException { super.startup(); Policy.localize("org.eclipse.team.internal.ccvs.ssh.messages"); //$NON-NLS-1$ } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ui/about.html b/bundles/org.eclipse.team.cvs.ui/about.html index 768324e89..441774f92 100644 --- a/bundles/org.eclipse.team.cvs.ui/about.html +++ b/bundles/org.eclipse.team.cvs.ui/about.html @@ -1,42 +1,42 @@ - - -About - - - - - - - - -
About This Content
-

11th December, 2001

-

License

-

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

- -

Contributions

- -

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

- -

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or -other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.

-
- + + +About + + + + + + + + +
About This Content
+

11th December, 2001

+

License

+

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

+ +

Contributions

+ +

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise +made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such +Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

+ +

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or +other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the +host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available +to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also +providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of +the CPL.

+
+ \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml index f593e1659..0162b01b2 100644 --- a/bundles/org.eclipse.team.cvs.ui/plugin.xml +++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml @@ -1,379 +1,379 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java index a13bfab1d..a999bca20 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java @@ -1,358 +1,358 @@ -package org.eclipse.team.internal.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareEditorInput; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.IStructureComparator; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.team.ccvs.core.CVSTag; -import org.eclipse.team.ccvs.core.CVSTeamProvider; -import org.eclipse.team.ccvs.core.ICVSFile; -import org.eclipse.team.ccvs.core.ICVSRemoteFolder; -import org.eclipse.team.ccvs.core.ICVSRemoteResource; -import org.eclipse.team.ccvs.core.ICVSResource; -import org.eclipse.team.core.ITeamProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.TeamPlugin; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; +package org.eclipse.team.internal.ccvs.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.compare.CompareConfiguration; +import org.eclipse.compare.CompareEditorInput; +import org.eclipse.compare.ITypedElement; +import org.eclipse.compare.ResourceNode; +import org.eclipse.compare.structuremergeviewer.Differencer; +import org.eclipse.compare.structuremergeviewer.IStructureComparator; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.team.ccvs.core.CVSTag; +import org.eclipse.team.ccvs.core.CVSTeamProvider; +import org.eclipse.team.ccvs.core.ICVSFile; +import org.eclipse.team.ccvs.core.ICVSRemoteFolder; +import org.eclipse.team.ccvs.core.ICVSRemoteResource; +import org.eclipse.team.ccvs.core.ICVSResource; +import org.eclipse.team.core.ITeamProvider; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.TeamPlugin; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; - -/** - * A compare input for performing naive comparisons between - * resources and resource editions. - */ -public class CVSCompareEditorInput extends CompareEditorInput { - private ITypedElement left; - private ITypedElement right; - private ITypedElement ancestor; - - // comparison constants - private static final int NODE_EQUAL = 0; - private static final int NODE_NOT_EQUAL = 1; - private static final int NODE_UNKNOWN = 2; - - // provider for the project being compared - CVSTeamProvider cvsProvider = null; - - /** - * Creates a new CVSCompareEditorInput. - */ - public CVSCompareEditorInput(ITypedElement left, ITypedElement right) { - this(left, right, null); - } - - /** - * Creates a new CVSCompareEditorInput. - */ - public CVSCompareEditorInput(ITypedElement left, ITypedElement right, ITypedElement ancestor) { - super(new CompareConfiguration()); - this.left = left; - this.right = right; - this.ancestor = ancestor; - } - - /** - * Overridden to create the CVSDiffTreeViewer to have the proper popup actions - */ - //public Viewer createDiffViewer(Composite parent) { - // return new CVSDiffTreeViewer(parent, this); - //} - - /** - * Returns the label for the given input element. - */ - private String getLabel(ITypedElement element) { - if (element instanceof ResourceNode) { - return Policy.bind("CVSCompareEditorInput.workspace", element.getName()); - } - if (element instanceof ResourceEditionNode) { - ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource(); - ICVSResource resource = (ICVSResource)edition; - try { - if (edition.isContainer()) { - CVSTag tag = ((ICVSRemoteFolder)edition).getTag(); - if (tag == null) { - return Policy.bind("CVSCompareEditorInput.inHead", edition.getName()); - } else if (tag.getType() == CVSTag.BRANCH) { - return Policy.bind("CVSCompareEditorInput.inBranch", new Object[] {edition.getName(), tag.getName()}); - } else { - return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), tag.getName()}); - } - } else { - return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), resource.getSyncInfo().getRevision()}); - } - } catch (TeamException e) { - handle(e); - // Fall through and get the default label - } - } - return element.getName(); - } - - /** - * Returns the label for the given input element. - */ - private String getVersionLabel(ITypedElement element) { - if (element instanceof ResourceNode) { - return Policy.bind("CVSCompareEditorInput.workspaceLabel"); - } - if (element instanceof ResourceEditionNode) { - ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource(); - ICVSResource resource = (ICVSResource)edition; - try { - if (edition.isContainer()) { - CVSTag tag = ((ICVSRemoteFolder)resource).getTag(); - if (tag == null) { - return Policy.bind("CVSCompareEditorInput.headLabel"); - } else if (tag.getType() == CVSTag.BRANCH) { - return Policy.bind("CVSCompareEditorInput.branchLabel", tag.getName()); - } else { - return tag.getName(); - } - } else { - return resource.getSyncInfo().getRevision(); - } - } catch (TeamException e) { - handle(e); - // Fall through and get the default label - } - } - return element.getName(); - } - - /* - * Returns a guess of the resource name being compared, for display - * in the title. - */ - private String guessResourceName() { - if (left != null) { - return left.getName(); - } - if (right != null) { - return right.getName(); - } - if (ancestor != null) { - return ancestor.getName(); - } - return ""; - } - - /** - * Handles a random exception and sanitizes it into a reasonable - * error message. - */ - private void handle(Exception e) { - // create a status - Throwable t = e; - // unwrap the invocation target exception - if (t instanceof InvocationTargetException) { - t = ((InvocationTargetException)t).getTargetException(); - } - IStatus error; - if (t instanceof CoreException) { - error = ((CoreException)t).getStatus(); - } else if (t instanceof TeamException) { - error = ((TeamException)t).getStatus(); - } else { - error = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); - } - setMessage(error.getMessage()); - if (!(t instanceof TeamException)) { - CVSUIPlugin.log(error); - } - } - - /** - * Sets up the title and pane labels for the comparison view. - */ - private void initLabels() { - CompareConfiguration cc = (CompareConfiguration) getCompareConfiguration(); - - String leftLabel = getLabel(left); - cc.setLeftLabel(leftLabel); - cc.setLeftImage(left.getImage()); - - String rightLabel = getLabel(right); - cc.setRightLabel(rightLabel); - cc.setRightImage(right.getImage()); - - String title; - if (ancestor != null) { - cc.setAncestorLabel(getLabel(ancestor)); - cc.setAncestorImage(ancestor.getImage()); - title = Policy.bind("CVSCompareEditorInput.titleAncestor", new Object[] {guessResourceName(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)} ); - } else { - String leftName = null; - if (left != null) leftName = left.getName(); - String rightName = null; - if (right != null) rightName = right.getName(); - boolean differentNames = false; - if (leftName != null && !leftName.equals(rightName)) { - title = Policy.bind("CVSCompareEditorInput.titleNoAncestorDifferent", new Object[] {leftName, getVersionLabel(left), rightName, getVersionLabel(right)} ); - } else { - title = Policy.bind("CVSCompareEditorInput.titleNoAncestor", new Object[] {guessResourceName(), getVersionLabel(left), getVersionLabel(right)} ); - } - } - setTitle(title); - } - - /* (Non-javadoc) - * Method declared on CompareEditorInput - */ - public boolean isSaveNeeded() { - return false; - } - - /* (non-Javadoc) - * Method declared on CompareEditorInput - */ - protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - boolean threeWay = ancestor != null; - if (right == null || left == null) { - setMessage(Policy.bind("CVSCompareEditorInput.different")); - return null; - } - - initLabels(); - - Differencer d = new Differencer() { - protected boolean contentsEqual(Object input1, Object input2) { - int compare = teamEqual(input1, input2); - if (compare == NODE_EQUAL) { - return true; - } - if (compare == NODE_NOT_EQUAL) { - return false; - } - //revert to slow content comparison - return super.contentsEqual(input1, input2); - } - protected void updateProgress(IProgressMonitor progressMonitor, Object node) { - super.updateProgress(progressMonitor, node); - progressMonitor.worked(1); - } - protected Object[] getChildren(Object input) { - if (input instanceof IStructureComparator) { - Object[] children= ((IStructureComparator)input).getChildren(); - if (children != null) - return children; - } - return null; - } - }; - - try { - monitor.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 30); - - // get the CVS provider if one exists - if (left instanceof ResourceNode) { - IResource resource = ((ResourceNode)left).getResource(); - ITeamProvider p = TeamPlugin.getManager().getProvider(resource); - if(p != null && p instanceof CVSTeamProvider) { - cvsProvider = (CVSTeamProvider)p; - } - } - - // do the diff - IProgressMonitor sub = new SubProgressMonitor(monitor, 10); - try { - sub.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 100); - return d.findDifferences(threeWay, sub, null, ancestor, left, right); - } finally { - sub.done(); - } - } catch (OperationCanceledException e) { - throw new InterruptedException(e.getMessage()); - } catch (RuntimeException e) { - handle(e); - return null; - } finally { - monitor.done(); - } - } - - /** - * Compares two nodes to determine if they are equal. Returns NODE_EQUAL - * of they are the same, NODE_NOT_EQUAL if they are different, and - * NODE_UNKNOWN if comparison was not possible. - */ - protected int teamEqual(Object left, Object right) { - - // calculate the type for the left contribution - ICVSRemoteResource leftEdition = null; - if (left instanceof ResourceEditionNode) { - leftEdition = ((ResourceEditionNode)left).getRemoteResource(); - } else if (left instanceof ResourceNode) { - IResource resource = ((ResourceNode)left).getResource(); - try { - ICVSResource element = CVSWorkspaceRoot.getCVSResourceFor(resource); - if (resource.getType() == IResource.FILE) { - if (((ICVSFile) element).isDirty()) return NODE_NOT_EQUAL; - } - if(cvsProvider==null) { - return NODE_UNKNOWN; - } - leftEdition = CVSWorkspaceRoot.getRemoteResourceFor(resource); - } catch(CVSException e) { - return NODE_UNKNOWN; - } - } - - // calculate the type for the right contribution - ICVSRemoteResource rightEdition = null; - if (right instanceof ResourceEditionNode) - rightEdition = ((ResourceEditionNode)right).getRemoteResource(); - - - // compare them - - if (leftEdition == null || rightEdition == null) { - return NODE_UNKNOWN; - } - // if they're both non-files, they're the same - if (leftEdition.isContainer() && rightEdition.isContainer()) { - return NODE_EQUAL; - } - // if they have different types, they're different - if (leftEdition.isContainer() != rightEdition.isContainer()) { - return NODE_NOT_EQUAL; - } - - if (!leftEdition.getRepository().getLocation().equals(rightEdition.getRepository().getLocation())) { - return NODE_UNKNOWN; - } - try { - ResourceSyncInfo leftInfo = ((ICVSResource)leftEdition).getSyncInfo(); - ResourceSyncInfo rightInfo = ((ICVSResource)rightEdition).getSyncInfo(); - - if (leftEdition.getRepositoryRelativePath().equals(rightEdition.getRepositoryRelativePath()) && - leftInfo.getRevision().equals(rightInfo.getRevision())) { - return NODE_EQUAL; - } else { - // Optimized for most common case. There are actually cases where a file is merged from - // one branch to another where the revision numbers are different but the file is the same. - // We do not handle this case properly. - return NODE_NOT_EQUAL; - } - } catch (TeamException e) { - handle(e); - return NODE_UNKNOWN; - } - } + +/** + * A compare input for performing naive comparisons between + * resources and resource editions. + */ +public class CVSCompareEditorInput extends CompareEditorInput { + private ITypedElement left; + private ITypedElement right; + private ITypedElement ancestor; + + // comparison constants + private static final int NODE_EQUAL = 0; + private static final int NODE_NOT_EQUAL = 1; + private static final int NODE_UNKNOWN = 2; + + // provider for the project being compared + CVSTeamProvider cvsProvider = null; + + /** + * Creates a new CVSCompareEditorInput. + */ + public CVSCompareEditorInput(ITypedElement left, ITypedElement right) { + this(left, right, null); + } + + /** + * Creates a new CVSCompareEditorInput. + */ + public CVSCompareEditorInput(ITypedElement left, ITypedElement right, ITypedElement ancestor) { + super(new CompareConfiguration()); + this.left = left; + this.right = right; + this.ancestor = ancestor; + } + + /** + * Overridden to create the CVSDiffTreeViewer to have the proper popup actions + */ + //public Viewer createDiffViewer(Composite parent) { + // return new CVSDiffTreeViewer(parent, this); + //} + + /** + * Returns the label for the given input element. + */ + private String getLabel(ITypedElement element) { + if (element instanceof ResourceNode) { + return Policy.bind("CVSCompareEditorInput.workspace", element.getName()); + } + if (element instanceof ResourceEditionNode) { + ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource(); + ICVSResource resource = (ICVSResource)edition; + try { + if (edition.isContainer()) { + CVSTag tag = ((ICVSRemoteFolder)edition).getTag(); + if (tag == null) { + return Policy.bind("CVSCompareEditorInput.inHead", edition.getName()); + } else if (tag.getType() == CVSTag.BRANCH) { + return Policy.bind("CVSCompareEditorInput.inBranch", new Object[] {edition.getName(), tag.getName()}); + } else { + return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), tag.getName()}); + } + } else { + return Policy.bind("CVSCompareEditorInput.repository", new Object[] {edition.getName(), resource.getSyncInfo().getRevision()}); + } + } catch (TeamException e) { + handle(e); + // Fall through and get the default label + } + } + return element.getName(); + } + + /** + * Returns the label for the given input element. + */ + private String getVersionLabel(ITypedElement element) { + if (element instanceof ResourceNode) { + return Policy.bind("CVSCompareEditorInput.workspaceLabel"); + } + if (element instanceof ResourceEditionNode) { + ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource(); + ICVSResource resource = (ICVSResource)edition; + try { + if (edition.isContainer()) { + CVSTag tag = ((ICVSRemoteFolder)resource).getTag(); + if (tag == null) { + return Policy.bind("CVSCompareEditorInput.headLabel"); + } else if (tag.getType() == CVSTag.BRANCH) { + return Policy.bind("CVSCompareEditorInput.branchLabel", tag.getName()); + } else { + return tag.getName(); + } + } else { + return resource.getSyncInfo().getRevision(); + } + } catch (TeamException e) { + handle(e); + // Fall through and get the default label + } + } + return element.getName(); + } + + /* + * Returns a guess of the resource name being compared, for display + * in the title. + */ + private String guessResourceName() { + if (left != null) { + return left.getName(); + } + if (right != null) { + return right.getName(); + } + if (ancestor != null) { + return ancestor.getName(); + } + return ""; + } + + /** + * Handles a random exception and sanitizes it into a reasonable + * error message. + */ + private void handle(Exception e) { + // create a status + Throwable t = e; + // unwrap the invocation target exception + if (t instanceof InvocationTargetException) { + t = ((InvocationTargetException)t).getTargetException(); + } + IStatus error; + if (t instanceof CoreException) { + error = ((CoreException)t).getStatus(); + } else if (t instanceof TeamException) { + error = ((TeamException)t).getStatus(); + } else { + error = new Status(IStatus.ERROR, CVSUIPlugin.ID, 1, Policy.bind("internal"), t); + } + setMessage(error.getMessage()); + if (!(t instanceof TeamException)) { + CVSUIPlugin.log(error); + } + } + + /** + * Sets up the title and pane labels for the comparison view. + */ + private void initLabels() { + CompareConfiguration cc = (CompareConfiguration) getCompareConfiguration(); + + String leftLabel = getLabel(left); + cc.setLeftLabel(leftLabel); + cc.setLeftImage(left.getImage()); + + String rightLabel = getLabel(right); + cc.setRightLabel(rightLabel); + cc.setRightImage(right.getImage()); + + String title; + if (ancestor != null) { + cc.setAncestorLabel(getLabel(ancestor)); + cc.setAncestorImage(ancestor.getImage()); + title = Policy.bind("CVSCompareEditorInput.titleAncestor", new Object[] {guessResourceName(), getVersionLabel(ancestor), getVersionLabel(left), getVersionLabel(right)} ); + } else { + String leftName = null; + if (left != null) leftName = left.getName(); + String rightName = null; + if (right != null) rightName = right.getName(); + boolean differentNames = false; + if (leftName != null && !leftName.equals(rightName)) { + title = Policy.bind("CVSCompareEditorInput.titleNoAncestorDifferent", new Object[] {leftName, getVersionLabel(left), rightName, getVersionLabel(right)} ); + } else { + title = Policy.bind("CVSCompareEditorInput.titleNoAncestor", new Object[] {guessResourceName(), getVersionLabel(left), getVersionLabel(right)} ); + } + } + setTitle(title); + } + + /* (Non-javadoc) + * Method declared on CompareEditorInput + */ + public boolean isSaveNeeded() { + return false; + } + + /* (non-Javadoc) + * Method declared on CompareEditorInput + */ + protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + boolean threeWay = ancestor != null; + if (right == null || left == null) { + setMessage(Policy.bind("CVSCompareEditorInput.different")); + return null; + } + + initLabels(); + + Differencer d = new Differencer() { + protected boolean contentsEqual(Object input1, Object input2) { + int compare = teamEqual(input1, input2); + if (compare == NODE_EQUAL) { + return true; + } + if (compare == NODE_NOT_EQUAL) { + return false; + } + //revert to slow content comparison + return super.contentsEqual(input1, input2); + } + protected void updateProgress(IProgressMonitor progressMonitor, Object node) { + super.updateProgress(progressMonitor, node); + progressMonitor.worked(1); + } + protected Object[] getChildren(Object input) { + if (input instanceof IStructureComparator) { + Object[] children= ((IStructureComparator)input).getChildren(); + if (children != null) + return children; + } + return null; + } + }; + + try { + monitor.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 30); + + // get the CVS provider if one exists + if (left instanceof ResourceNode) { + IResource resource = ((ResourceNode)left).getResource(); + ITeamProvider p = TeamPlugin.getManager().getProvider(resource); + if(p != null && p instanceof CVSTeamProvider) { + cvsProvider = (CVSTeamProvider)p; + } + } + + // do the diff + IProgressMonitor sub = new SubProgressMonitor(monitor, 10); + try { + sub.beginTask(Policy.bind("CVSCompareEditorInput.comparing"), 100); + return d.findDifferences(threeWay, sub, null, ancestor, left, right); + } finally { + sub.done(); + } + } catch (OperationCanceledException e) { + throw new InterruptedException(e.getMessage()); + } catch (RuntimeException e) { + handle(e); + return null; + } finally { + monitor.done(); + } + } + + /** + * Compares two nodes to determine if they are equal. Returns NODE_EQUAL + * of they are the same, NODE_NOT_EQUAL if they are different, and + * NODE_UNKNOWN if comparison was not possible. + */ + protected int teamEqual(Object left, Object right) { + + // calculate the type for the left contribution + ICVSRemoteResource leftEdition = null; + if (left instanceof ResourceEditionNode) { + leftEdition = ((ResourceEditionNode)left).getRemoteResource(); + } else if (left instanceof ResourceNode) { + IResource resource = ((ResourceNode)left).getResource(); + try { + ICVSResource element = CVSWorkspaceRoot.getCVSResourceFor(resource); + if (resource.getType() == IResource.FILE) { + if (((ICVSFile) element).isDirty()) return NODE_NOT_EQUAL; + } + if(cvsProvider==null) { + return NODE_UNKNOWN; + } + leftEdition = CVSWorkspaceRoot.getRemoteResourceFor(resource); + } catch(CVSException e) { + return NODE_UNKNOWN; + } + } + + // calculate the type for the right contribution + ICVSRemoteResource rightEdition = null; + if (right instanceof ResourceEditionNode) + rightEdition = ((ResourceEditionNode)right).getRemoteResource(); + + + // compare them + + if (leftEdition == null || rightEdition == null) { + return NODE_UNKNOWN; + } + // if they're both non-files, they're the same + if (leftEdition.isContainer() && rightEdition.isContainer()) { + return NODE_EQUAL; + } + // if they have different types, they're different + if (leftEdition.isContainer() != rightEdition.isContainer()) { + return NODE_NOT_EQUAL; + } + + if (!leftEdition.getRepository().getLocation().equals(rightEdition.getRepository().getLocation())) { + return NODE_UNKNOWN; + } + try { + ResourceSyncInfo leftInfo = ((ICVSResource)leftEdition).getSyncInfo(); + ResourceSyncInfo rightInfo = ((ICVSResource)rightEdition).getSyncInfo(); + + if (leftEdition.getRepositoryRelativePath().equals(rightEdition.getRepositoryRelativePath()) && + leftInfo.getRevision().equals(rightInfo.getRevision())) { + return NODE_EQUAL; + } else { + // Optimized for most common case. There are actually cases where a file is merged from + // one branch to another where the revision numbers are different but the file is the same. + // We do not handle this case properly. + return NODE_NOT_EQUAL; + } + } catch (TeamException e) { + handle(e); + return NODE_UNKNOWN; + } + } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceNode.java index 9d5cd8640..18e56ec23 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceNode.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSResourceNode.java @@ -1,91 +1,91 @@ -package org.eclipse.team.internal.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.util.ArrayList; - -import org.eclipse.compare.ResourceNode; -import org.eclipse.compare.structuremergeviewer.IStructureComparator; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.team.ccvs.core.ICVSFile; -import org.eclipse.team.ccvs.core.ICVSFolder; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; - -/** - * This class is a wrapper for a CVSResource. We use it instead of the standard - * ResourceNode because it can more accurately get its local children taking - * into account ignored resources, CVS/ directories, etc. - */ -public class CVSResourceNode extends ResourceNode { - ArrayList fChildren; - - public CVSResourceNode(IResource resource) { - super(resource); - } - - public Object[] getChildren() { - if (fChildren == null) { - fChildren= new ArrayList(); - IResource resource = getResource(); - if (resource instanceof IContainer) { - try { - ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource); - ICVSFile[] files = cvsFolder.getFiles(); - for (int i= 0; i < files.length; i++) { - IResource child = getFile((IContainer)resource, files[i].getName()); - if (child.exists()) { - IStructureComparator childNode = createChild(child); - if (childNode != null) { - fChildren.add(childNode); - } - } - } - ICVSFolder[] folders = cvsFolder.getFolders(); - for (int i= 0; i < folders.length; i++) { - IResource child = getFolder((IContainer)resource, folders[i].getName()); - if (child.exists()) { - IStructureComparator childNode = createChild(child); - if (childNode != null) { - fChildren.add(childNode); - } - } - } - } catch (TeamException e) { - CVSUIPlugin.log(e.getStatus()); - } - } - } - return fChildren.toArray(); - } - - private IResource getFile(IContainer container, String name) { - if (container instanceof IProject) { - return ((IProject)container).getFile(name); - } - if (container instanceof IFolder) { - return ((IFolder)container).getFile(name); - } - return null; - } - - private IResource getFolder(IContainer container, String name) { - if (container instanceof IProject) { - return ((IProject)container).getFolder(name); - } - if (container instanceof IFolder) { - return ((IFolder)container).getFolder(name); - } - return null; - } - - protected IStructureComparator createChild(IResource child) { - return new CVSResourceNode(child); - } -} +package org.eclipse.team.internal.ccvs.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.util.ArrayList; + +import org.eclipse.compare.ResourceNode; +import org.eclipse.compare.structuremergeviewer.IStructureComparator; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.team.ccvs.core.ICVSFile; +import org.eclipse.team.ccvs.core.ICVSFolder; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; + +/** + * This class is a wrapper for a CVSResource. We use it instead of the standard + * ResourceNode because it can more accurately get its local children taking + * into account ignored resources, CVS/ directories, etc. + */ +public class CVSResourceNode extends ResourceNode { + ArrayList fChildren; + + public CVSResourceNode(IResource resource) { + super(resource); + } + + public Object[] getChildren() { + if (fChildren == null) { + fChildren= new ArrayList(); + IResource resource = getResource(); + if (resource instanceof IContainer) { + try { + ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource); + ICVSFile[] files = cvsFolder.getFiles(); + for (int i= 0; i < files.length; i++) { + IResource child = getFile((IContainer)resource, files[i].getName()); + if (child.exists()) { + IStructureComparator childNode = createChild(child); + if (childNode != null) { + fChildren.add(childNode); + } + } + } + ICVSFolder[] folders = cvsFolder.getFolders(); + for (int i= 0; i < folders.length; i++) { + IResource child = getFolder((IContainer)resource, folders[i].getName()); + if (child.exists()) { + IStructureComparator childNode = createChild(child); + if (childNode != null) { + fChildren.add(childNode); + } + } + } + } catch (TeamException e) { + CVSUIPlugin.log(e.getStatus()); + } + } + } + return fChildren.toArray(); + } + + private IResource getFile(IContainer container, String name) { + if (container instanceof IProject) { + return ((IProject)container).getFile(name); + } + if (container instanceof IFolder) { + return ((IFolder)container).getFile(name); + } + return null; + } + + private IResource getFolder(IContainer container, String name) { + if (container instanceof IProject) { + return ((IProject)container).getFolder(name); + } + if (container instanceof IFolder) { + return ((IFolder)container).getFolder(name); + } + return null; + } + + protected IStructureComparator createChild(IResource child) { + return new CVSResourceNode(child); + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java index c5fcac58f..9fa3f2fcb 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ResourceEditionNode.java @@ -1,159 +1,159 @@ -package org.eclipse.team.internal.ccvs.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.io.InputStream; - -import org.eclipse.compare.BufferedContent; -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.ITypedElement; -import org.eclipse.compare.structuremergeviewer.IStructureComparator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.team.ccvs.core.ICVSRemoteResource; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; - -/** - * A class for comparing ICVSRemoteResource objects - */ -public class ResourceEditionNode extends BufferedContent implements IStructureComparator, ITypedElement { - private ICVSRemoteResource resource; - private ResourceEditionNode[] children; - - /** - * Creates a new ResourceEditionNode on the given resource edition. - */ - public ResourceEditionNode(ICVSRemoteResource resourceEdition) { - this.resource = resourceEdition; - } - - /** - * @see BufferedContent#createStream - */ - public InputStream createStream() throws CoreException { - if (resource == null) { - return null; - } - try { - return resource.getContents(new NullProgressMonitor()); - } catch (TeamException e) { - throw new CoreException(e.getStatus()); - } - } - - /** - * Returns true if both resources names are identical. - * The content is not considered. - * @see IComparator#equals - */ - public boolean equals(Object other) { - if (other instanceof ITypedElement) { - String otherName = ((ITypedElement)other).getName(); - return getName().equals(otherName); - } - return super.equals(other); - } - - /** - * Enumerate children of this node (if any). - */ - public Object[] getChildren() { - if (children == null) { - if (resource == null) { - children = new ResourceEditionNode[0]; - } else { - try { - IRemoteResource[] members = resource.members(new NullProgressMonitor()); - children = new ResourceEditionNode[members.length]; - for (int i = 0; i < members.length; i++) { - children[i] = new ResourceEditionNode((ICVSRemoteResource)members[i]); - } - } catch (TeamException e) { - CVSUIPlugin.log(e.getStatus()); - } - } - } - return children; - } - - /** - * @see IStreamContentAccessor#getContents() - */ - public InputStream getContents() throws CoreException { - if (resource == null) { - return null; - } - //show busy cursor if this is happening in the UI thread - Display display = Display.getCurrent(); - if (display != null) { - final InputStream[] stream = new InputStream[1]; - final TeamException[] exception = new TeamException[1]; - BusyIndicator.showWhile(display, new Runnable() { - public void run() { - try { - stream[0] = resource.getContents(new NullProgressMonitor()); - } catch (TeamException e) { - exception[0] = e; - } - } - }); - if (exception[0] != null) { - throw new CoreException(exception[0].getStatus()); - } - return stream[0]; - } else { - //we're not in the UI thread, just get the contents. - try { - return resource.getContents(new NullProgressMonitor()); - } catch (TeamException e) { - throw new CoreException(e.getStatus()); - } - } - } - - public Image getImage() { - return CompareUI.getImage(resource); - } - - /** - * Returns the name of this node. - */ - public String getName() { - return resource == null ? "" : resource.getName(); - } - - public ICVSRemoteResource getRemoteResource() { - return resource; - } - - /** - * Returns the comparison type for this node. - */ - public String getType() { - if (resource == null) { - return UNKNOWN_TYPE; - } - if (resource.isContainer()) { - return FOLDER_TYPE; - } - String name = resource.getName(); - name = name.substring(name.lastIndexOf('.') + 1); - return name.length() == 0 ? UNKNOWN_TYPE : name; - } - - /** - * @see IComparator#equals - */ - public int hashCode() { - return getName().hashCode(); - } -} +package org.eclipse.team.internal.ccvs.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.io.InputStream; + +import org.eclipse.compare.BufferedContent; +import org.eclipse.compare.CompareUI; +import org.eclipse.compare.ITypedElement; +import org.eclipse.compare.structuremergeviewer.IStructureComparator; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.team.ccvs.core.ICVSRemoteResource; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.sync.IRemoteResource; + +/** + * A class for comparing ICVSRemoteResource objects + */ +public class ResourceEditionNode extends BufferedContent implements IStructureComparator, ITypedElement { + private ICVSRemoteResource resource; + private ResourceEditionNode[] children; + + /** + * Creates a new ResourceEditionNode on the given resource edition. + */ + public ResourceEditionNode(ICVSRemoteResource resourceEdition) { + this.resource = resourceEdition; + } + + /** + * @see BufferedContent#createStream + */ + public InputStream createStream() throws CoreException { + if (resource == null) { + return null; + } + try { + return resource.getContents(new NullProgressMonitor()); + } catch (TeamException e) { + throw new CoreException(e.getStatus()); + } + } + + /** + * Returns true if both resources names are identical. + * The content is not considered. + * @see IComparator#equals + */ + public boolean equals(Object other) { + if (other instanceof ITypedElement) { + String otherName = ((ITypedElement)other).getName(); + return getName().equals(otherName); + } + return super.equals(other); + } + + /** + * Enumerate children of this node (if any). + */ + public Object[] getChildren() { + if (children == null) { + if (resource == null) { + children = new ResourceEditionNode[0]; + } else { + try { + IRemoteResource[] members = resource.members(new NullProgressMonitor()); + children = new ResourceEditionNode[members.length]; + for (int i = 0; i < members.length; i++) { + children[i] = new ResourceEditionNode((ICVSRemoteResource)members[i]); + } + } catch (TeamException e) { + CVSUIPlugin.log(e.getStatus()); + } + } + } + return children; + } + + /** + * @see IStreamContentAccessor#getContents() + */ + public InputStream getContents() throws CoreException { + if (resource == null) { + return null; + } + //show busy cursor if this is happening in the UI thread + Display display = Display.getCurrent(); + if (display != null) { + final InputStream[] stream = new InputStream[1]; + final TeamException[] exception = new TeamException[1]; + BusyIndicator.showWhile(display, new Runnable() { + public void run() { + try { + stream[0] = resource.getContents(new NullProgressMonitor()); + } catch (TeamException e) { + exception[0] = e; + } + } + }); + if (exception[0] != null) { + throw new CoreException(exception[0].getStatus()); + } + return stream[0]; + } else { + //we're not in the UI thread, just get the contents. + try { + return resource.getContents(new NullProgressMonitor()); + } catch (TeamException e) { + throw new CoreException(e.getStatus()); + } + } + } + + public Image getImage() { + return CompareUI.getImage(resource); + } + + /** + * Returns the name of this node. + */ + public String getName() { + return resource == null ? "" : resource.getName(); + } + + public ICVSRemoteResource getRemoteResource() { + return resource; + } + + /** + * Returns the comparison type for this node. + */ + public String getType() { + if (resource == null) { + return UNKNOWN_TYPE; + } + if (resource.isContainer()) { + return FOLDER_TYPE; + } + String name = resource.getName(); + name = name.substring(name.lastIndexOf('.') + 1); + return name.length() == 0 ? UNKNOWN_TYPE : name; + } + + /** + * @see IComparator#equals + */ + public int hashCode() { + return getName().hashCode(); + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java index 19d501be7..adaebcd0e 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchCategory.java @@ -10,7 +10,7 @@ import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.widgets.Display; import org.eclipse.team.ccvs.core.ICVSRepositoryLocation; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; -import org.eclipse.ui.model.IWorkbenchAdapter; +import org.eclipse.ui.model.IWorkbenchAdapter; /** * BranchCategory is the model element for the branches category * for a particular repsitory in the repositories view. Its children diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java index 84f98ec5b..852de443c 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java @@ -1,271 +1,271 @@ -package org.eclipse.team.internal.ccvs.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2002. - * All Rights Reserved. - */ - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.resource.CompositeImageDescriptor; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.team.ccvs.core.ICVSFile; -import org.eclipse.team.ccvs.core.ICVSRemoteFile; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.sync.IRemoteResource; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; -import org.eclipse.team.internal.ccvs.ui.CVSDecorator; -import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; -import org.eclipse.team.internal.ccvs.ui.HistoryView; -import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; -import org.eclipse.team.internal.ccvs.ui.Policy; -import org.eclipse.team.internal.ccvs.ui.merge.UpdateMergeAction; -import org.eclipse.team.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.ui.sync.ITeamNode; -import org.eclipse.team.ui.sync.MergeResource; -import org.eclipse.team.ui.sync.SyncView; -import org.eclipse.team.ui.sync.TeamFile; - -public class CVSCatchupReleaseViewer extends CatchupReleaseViewer { - // Actions - private UpdateSyncAction updateAction; - private CommitSyncAction commitAction; - private UpdateMergeAction updateMergeAction; - private IgnoreAction ignoreAction; - private HistoryAction showInHistory; - - class DiffImage extends CompositeImageDescriptor { - private static final int HEIGHT= 16; - private static final int WIDTH= 22; - - Image baseImage; - ImageDescriptor overlay; - - public DiffImage(Image baseImage, ImageDescriptor overlay) { - this.baseImage = baseImage; - this.overlay = overlay; - } - - /* - * @see CompositeImageDescriptor#drawCompositeImage(int, int) - */ - protected void drawCompositeImage(int width, int height) { - drawImage(baseImage.getImageData(), 0, 0); - ImageData overlayData = overlay.getImageData(); - drawImage(overlayData, WIDTH - overlayData.width, (HEIGHT - overlayData.height) / 2); - } - - /* - * @see CompositeImageDescriptor#getSize() - */ - protected Point getSize() { - return new Point(WIDTH, HEIGHT); - } - } - class HistoryAction extends Action implements ISelectionChangedListener { - IStructuredSelection selection; - public HistoryAction(String label) { - super(label); - } - public void run() { - if (selection.isEmpty()) return; - HistoryView view = HistoryView.openInActivePerspective(); - if (view == null) return; - ITeamNode node = (ITeamNode)selection.getFirstElement(); - IRemoteSyncElement remoteSyncElement = ((TeamFile)node).getMergeResource().getSyncElement(); - IResource resource = remoteSyncElement.getLocal(); - if (resource.exists()) { - view.showHistory(resource); - } else { - ICVSRemoteFile remoteFile = (ICVSRemoteFile)remoteSyncElement.getRemote(); - view.showHistory(remoteFile); - } - } - public void selectionChanged(SelectionChangedEvent event) { - ISelection selection = event.getSelection(); - if (!(selection instanceof IStructuredSelection)) { - setEnabled(false); - return; - } - IStructuredSelection ss = (IStructuredSelection)selection; - if (ss.size() != 1) { - setEnabled(false); - return; - } - ITeamNode first = (ITeamNode)ss.getFirstElement(); - if (first instanceof TeamFile) { - this.selection = ss; - setEnabled(true); - } else { - this.selection = null; - setEnabled(false); - } - } - } - - public CVSCatchupReleaseViewer(Composite parent, CVSSyncCompareInput model) { - super(parent, model); - initializeActions(model); - initializeLabelProvider(); - } - - private void initializeLabelProvider() { - final ImageDescriptor conflictDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT); - final ImageDescriptor questionableDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE); - final LabelProvider oldProvider = (LabelProvider)getLabelProvider(); - setLabelProvider(new LabelProvider() { - public Image getImage(Object element) { - Image image = oldProvider.getImage(element); - if (element instanceof ITeamNode) { - ITeamNode node = (ITeamNode)element; - int kind = node.getKind(); - if ((kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) { - DiffImage diffImage = new DiffImage(image, conflictDescriptor); - return diffImage.createImage(); - } - if (kind == (IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION)) { - IResource resource = node.getResource(); - if (resource.getType() == IResource.FILE) { - try { - ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource); - if (cvsFile.getSyncInfo() == null) { - DiffImage diffImage = new DiffImage(image, questionableDescriptor); - return diffImage.createImage(); - } - } catch (TeamException e) { - ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); - // Fall through and return the default image - } - } - } - } - return image; - } - public String getText(Object element) { - StringBuffer postfix = new StringBuffer(); - if (element instanceof ITeamNode) { - ITeamNode node = (ITeamNode)element; - IResource resource = node.getResource(); - if (resource.exists() && resource.getType() == IResource.FILE) { - try { - ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource); - ResourceSyncInfo info = cvsFile.getSyncInfo(); - String kw; - if (info!=null) { - kw = CVSDecorator.getFileTypeString(resource.getName(), info.getKeywordMode()); - } else { - kw = CVSDecorator.getFileTypeString(resource.getName(), null); - } - postfix.append("(" + kw + ")"); - } catch(CVSException e) { - ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); - } - } - } - return oldProvider.getText(element) + " " + postfix.toString() ; - } - }); - } - - protected void fillContextMenu(IMenuManager manager) { - super.fillContextMenu(manager); - if (showInHistory != null) { - manager.add(showInHistory); - } - manager.add(new Separator()); - switch (getSyncMode()) { - case SyncView.SYNC_INCOMING: - updateAction.update(SyncView.SYNC_INCOMING); - manager.add(updateAction); - break; - case SyncView.SYNC_OUTGOING: - commitAction.update(SyncView.SYNC_OUTGOING); - manager.add(commitAction); - ignoreAction.update(); - manager.add(ignoreAction); - manager.add(new Separator()); - updateAction.update(SyncView.SYNC_OUTGOING); - manager.add(updateAction); - break; - case SyncView.SYNC_BOTH: - commitAction.update(SyncView.SYNC_BOTH); - manager.add(commitAction); - manager.add(new Separator()); - updateAction.update(SyncView.SYNC_BOTH); - manager.add(updateAction); - break; - case SyncView.SYNC_MERGE: - updateMergeAction.update(SyncView.SYNC_INCOMING); - manager.add(updateMergeAction); - break; - } - } - - /** - * Creates the actions for this viewer. - */ - private void initializeActions(final CVSSyncCompareInput diffModel) { - Shell shell = getControl().getShell(); - commitAction = new CommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.commit"), shell); - updateAction = new UpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); - updateMergeAction = new UpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); - ignoreAction = new IgnoreAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.ignore"), shell); - // Show in history view - showInHistory = new HistoryAction(Policy.bind("CVSCatchupReleaseViewer.showInHistory")); - addSelectionChangedListener(showInHistory); - } - - /** - * Provide CVS-specific labels for the editors. - */ - protected void updateLabels(MergeResource resource) { - CompareConfiguration config = getCompareConfiguration(); - String name = resource.getName(); - config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.workspaceFile", name)); - - IRemoteSyncElement syncTree = resource.getSyncElement(); - IRemoteResource remote = syncTree.getRemote(); - if (remote != null) { - try { - String revision = ((ICVSRemoteFile)remote).getRevision(); - config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFileRevision", new Object[] {name, revision})); - } catch (TeamException e) { - ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); - config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFile", name)); - } - } else { - config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.noRepositoryFile")); - } - - IRemoteResource base = syncTree.getBase(); - if (base != null) { - try { - String revision = ((ICVSRemoteFile)base).getRevision(); - config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.commonFileRevision", new Object[] {name, revision} )); - } catch (TeamException e) { - ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); - config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.commonFile", name)); - } - } else { - config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.noCommonFile")); - } - } -} +package org.eclipse.team.internal.ccvs.ui.sync; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import org.eclipse.compare.CompareConfiguration; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.team.ccvs.core.ICVSFile; +import org.eclipse.team.ccvs.core.ICVSRemoteFile; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.sync.IRemoteResource; +import org.eclipse.team.core.sync.IRemoteSyncElement; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; +import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; +import org.eclipse.team.internal.ccvs.ui.CVSDecorator; +import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.HistoryView; +import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants; +import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.team.internal.ccvs.ui.merge.UpdateMergeAction; +import org.eclipse.team.ui.sync.CatchupReleaseViewer; +import org.eclipse.team.ui.sync.ITeamNode; +import org.eclipse.team.ui.sync.MergeResource; +import org.eclipse.team.ui.sync.SyncView; +import org.eclipse.team.ui.sync.TeamFile; + +public class CVSCatchupReleaseViewer extends CatchupReleaseViewer { + // Actions + private UpdateSyncAction updateAction; + private CommitSyncAction commitAction; + private UpdateMergeAction updateMergeAction; + private IgnoreAction ignoreAction; + private HistoryAction showInHistory; + + class DiffImage extends CompositeImageDescriptor { + private static final int HEIGHT= 16; + private static final int WIDTH= 22; + + Image baseImage; + ImageDescriptor overlay; + + public DiffImage(Image baseImage, ImageDescriptor overlay) { + this.baseImage = baseImage; + this.overlay = overlay; + } + + /* + * @see CompositeImageDescriptor#drawCompositeImage(int, int) + */ + protected void drawCompositeImage(int width, int height) { + drawImage(baseImage.getImageData(), 0, 0); + ImageData overlayData = overlay.getImageData(); + drawImage(overlayData, WIDTH - overlayData.width, (HEIGHT - overlayData.height) / 2); + } + + /* + * @see CompositeImageDescriptor#getSize() + */ + protected Point getSize() { + return new Point(WIDTH, HEIGHT); + } + } + class HistoryAction extends Action implements ISelectionChangedListener { + IStructuredSelection selection; + public HistoryAction(String label) { + super(label); + } + public void run() { + if (selection.isEmpty()) return; + HistoryView view = HistoryView.openInActivePerspective(); + if (view == null) return; + ITeamNode node = (ITeamNode)selection.getFirstElement(); + IRemoteSyncElement remoteSyncElement = ((TeamFile)node).getMergeResource().getSyncElement(); + IResource resource = remoteSyncElement.getLocal(); + if (resource.exists()) { + view.showHistory(resource); + } else { + ICVSRemoteFile remoteFile = (ICVSRemoteFile)remoteSyncElement.getRemote(); + view.showHistory(remoteFile); + } + } + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (!(selection instanceof IStructuredSelection)) { + setEnabled(false); + return; + } + IStructuredSelection ss = (IStructuredSelection)selection; + if (ss.size() != 1) { + setEnabled(false); + return; + } + ITeamNode first = (ITeamNode)ss.getFirstElement(); + if (first instanceof TeamFile) { + this.selection = ss; + setEnabled(true); + } else { + this.selection = null; + setEnabled(false); + } + } + } + + public CVSCatchupReleaseViewer(Composite parent, CVSSyncCompareInput model) { + super(parent, model); + initializeActions(model); + initializeLabelProvider(); + } + + private void initializeLabelProvider() { + final ImageDescriptor conflictDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_MERGEABLE_CONFLICT); + final ImageDescriptor questionableDescriptor = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_QUESTIONABLE); + final LabelProvider oldProvider = (LabelProvider)getLabelProvider(); + setLabelProvider(new LabelProvider() { + public Image getImage(Object element) { + Image image = oldProvider.getImage(element); + if (element instanceof ITeamNode) { + ITeamNode node = (ITeamNode)element; + int kind = node.getKind(); + if ((kind & IRemoteSyncElement.AUTOMERGE_CONFLICT) != 0) { + DiffImage diffImage = new DiffImage(image, conflictDescriptor); + return diffImage.createImage(); + } + if (kind == (IRemoteSyncElement.OUTGOING | IRemoteSyncElement.ADDITION)) { + IResource resource = node.getResource(); + if (resource.getType() == IResource.FILE) { + try { + ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource); + if (cvsFile.getSyncInfo() == null) { + DiffImage diffImage = new DiffImage(image, questionableDescriptor); + return diffImage.createImage(); + } + } catch (TeamException e) { + ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); + // Fall through and return the default image + } + } + } + } + return image; + } + public String getText(Object element) { + StringBuffer postfix = new StringBuffer(); + if (element instanceof ITeamNode) { + ITeamNode node = (ITeamNode)element; + IResource resource = node.getResource(); + if (resource.exists() && resource.getType() == IResource.FILE) { + try { + ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile) resource); + ResourceSyncInfo info = cvsFile.getSyncInfo(); + String kw; + if (info!=null) { + kw = CVSDecorator.getFileTypeString(resource.getName(), info.getKeywordMode()); + } else { + kw = CVSDecorator.getFileTypeString(resource.getName(), null); + } + postfix.append("(" + kw + ")"); + } catch(CVSException e) { + ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); + } + } + } + return oldProvider.getText(element) + " " + postfix.toString() ; + } + }); + } + + protected void fillContextMenu(IMenuManager manager) { + super.fillContextMenu(manager); + if (showInHistory != null) { + manager.add(showInHistory); + } + manager.add(new Separator()); + switch (getSyncMode()) { + case SyncView.SYNC_INCOMING: + updateAction.update(SyncView.SYNC_INCOMING); + manager.add(updateAction); + break; + case SyncView.SYNC_OUTGOING: + commitAction.update(SyncView.SYNC_OUTGOING); + manager.add(commitAction); + ignoreAction.update(); + manager.add(ignoreAction); + manager.add(new Separator()); + updateAction.update(SyncView.SYNC_OUTGOING); + manager.add(updateAction); + break; + case SyncView.SYNC_BOTH: + commitAction.update(SyncView.SYNC_BOTH); + manager.add(commitAction); + manager.add(new Separator()); + updateAction.update(SyncView.SYNC_BOTH); + manager.add(updateAction); + break; + case SyncView.SYNC_MERGE: + updateMergeAction.update(SyncView.SYNC_INCOMING); + manager.add(updateMergeAction); + break; + } + } + + /** + * Creates the actions for this viewer. + */ + private void initializeActions(final CVSSyncCompareInput diffModel) { + Shell shell = getControl().getShell(); + commitAction = new CommitSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.commit"), shell); + updateAction = new UpdateSyncAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); + updateMergeAction = new UpdateMergeAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.update"), shell); + ignoreAction = new IgnoreAction(diffModel, this, Policy.bind("CVSCatchupReleaseViewer.ignore"), shell); + // Show in history view + showInHistory = new HistoryAction(Policy.bind("CVSCatchupReleaseViewer.showInHistory")); + addSelectionChangedListener(showInHistory); + } + + /** + * Provide CVS-specific labels for the editors. + */ + protected void updateLabels(MergeResource resource) { + CompareConfiguration config = getCompareConfiguration(); + String name = resource.getName(); + config.setLeftLabel(Policy.bind("CVSCatchupReleaseViewer.workspaceFile", name)); + + IRemoteSyncElement syncTree = resource.getSyncElement(); + IRemoteResource remote = syncTree.getRemote(); + if (remote != null) { + try { + String revision = ((ICVSRemoteFile)remote).getRevision(); + config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFileRevision", new Object[] {name, revision})); + } catch (TeamException e) { + ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); + config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFile", name)); + } + } else { + config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.noRepositoryFile")); + } + + IRemoteResource base = syncTree.getBase(); + if (base != null) { + try { + String revision = ((ICVSRemoteFile)base).getRevision(); + config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.commonFileRevision", new Object[] {name, revision} )); + } catch (TeamException e) { + ErrorDialog.openError(getControl().getShell(), null, null, e.getStatus()); + config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.commonFile", name)); + } + } else { + config.setAncestorLabel(Policy.bind("CVSCatchupReleaseViewer.noCommonFile")); + } + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java index 57623a908..540916f38 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java @@ -1,110 +1,110 @@ -package org.eclipse.team.internal.ccvs.ui.sync; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.compare.structuremergeviewer.ICompareInput; -import org.eclipse.compare.structuremergeviewer.IDiffContainer; -import org.eclipse.compare.structuremergeviewer.IDiffElement; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.team.ccvs.core.CVSTeamProvider; -import org.eclipse.team.core.ITeamProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.core.TeamPlugin; -import org.eclipse.team.core.sync.IRemoteSyncElement; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; -import org.eclipse.team.internal.ccvs.ui.Policy; -import org.eclipse.team.ui.sync.CatchupReleaseViewer; -import org.eclipse.team.ui.sync.ChangedTeamContainer; -import org.eclipse.team.ui.sync.ITeamNode; -import org.eclipse.team.ui.sync.SyncCompareInput; -import org.eclipse.team.ui.sync.SyncSet; -import org.eclipse.team.ui.sync.TeamFile; -import org.eclipse.team.ui.sync.UnchangedTeamContainer; -import org.eclipse.ui.actions.WorkspaceModifyOperation; - -public class CVSSyncCompareInput extends SyncCompareInput { - IResource[] resources; - /** - * Creates a new catchup or release operation. - */ - public CVSSyncCompareInput(IResource[] resources) { - super(); - this.resources = resources; - } - /** - * Overridden to create a custom DiffTreeViewer in the top left pane of the CompareProvider. - * - * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer - * using setViewer(). - */ - public Viewer createDiffViewer(Composite parent) { - CatchupReleaseViewer catchupReleaseViewer = new CVSCatchupReleaseViewer(parent, this); - setViewer(catchupReleaseViewer); - return catchupReleaseViewer; - } - - protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException { - IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length]; - int work = 1000 * resources.length; - monitor.beginTask(null, work); - try { - for (int i = 0; i < trees.length; i++) { - trees[i] = CVSWorkspaceRoot.getRemoteSyncTree(resources[i], null, Policy.subMonitorFor(monitor, 1000)); - } - } finally { - monitor.done(); - } - return trees; - } - - protected void updateView() { - // Update the view - if (getDiffRoot().hasChildren()) { - getViewer().refresh(); - } else { - getViewer().setInput(null); - } - - // Update the status line - updateStatusLine(); - } - - /** - * Overridden to mark the source as merged. - */ - protected void compareInputChanged(ICompareInput source) { - super.compareInputChanged(source); - contentsChanged(source); - } - protected void contentsChanged(ICompareInput source) { - // Mark the source as merged. - if (source instanceof TeamFile) { - IRemoteSyncElement element = ((TeamFile)source).getMergeResource().getSyncElement(); - try { - CVSUIPlugin.getPlugin().getRepositoryManager().merged(new IRemoteSyncElement[] {element}); - } catch (TeamException e) { - ErrorDialog.openError(getShell(), null, null, e.getStatus()); - } - } - } - /* - * @see SyncCompareInput#getSyncGranularity() - */ - protected int getSyncGranularity() { - // assuming that sync is always performed relative to the current branch. In - // these cases the server will perform the content comparison for us. - return IRemoteSyncElement.GRANULARITY_TIMESTAMP; - } -} +package org.eclipse.team.internal.ccvs.ui.sync; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.compare.structuremergeviewer.ICompareInput; +import org.eclipse.compare.structuremergeviewer.IDiffContainer; +import org.eclipse.compare.structuremergeviewer.IDiffElement; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.team.ccvs.core.CVSTeamProvider; +import org.eclipse.team.core.ITeamProvider; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.TeamPlugin; +import org.eclipse.team.core.sync.IRemoteSyncElement; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; +import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.team.ui.sync.CatchupReleaseViewer; +import org.eclipse.team.ui.sync.ChangedTeamContainer; +import org.eclipse.team.ui.sync.ITeamNode; +import org.eclipse.team.ui.sync.SyncCompareInput; +import org.eclipse.team.ui.sync.SyncSet; +import org.eclipse.team.ui.sync.TeamFile; +import org.eclipse.team.ui.sync.UnchangedTeamContainer; +import org.eclipse.ui.actions.WorkspaceModifyOperation; + +public class CVSSyncCompareInput extends SyncCompareInput { + IResource[] resources; + /** + * Creates a new catchup or release operation. + */ + public CVSSyncCompareInput(IResource[] resources) { + super(); + this.resources = resources; + } + /** + * Overridden to create a custom DiffTreeViewer in the top left pane of the CompareProvider. + * + * Subclasses must create and return a new CatchupReleaseViewer, and set the viewer + * using setViewer(). + */ + public Viewer createDiffViewer(Composite parent) { + CatchupReleaseViewer catchupReleaseViewer = new CVSCatchupReleaseViewer(parent, this); + setViewer(catchupReleaseViewer); + return catchupReleaseViewer; + } + + protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException { + IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length]; + int work = 1000 * resources.length; + monitor.beginTask(null, work); + try { + for (int i = 0; i < trees.length; i++) { + trees[i] = CVSWorkspaceRoot.getRemoteSyncTree(resources[i], null, Policy.subMonitorFor(monitor, 1000)); + } + } finally { + monitor.done(); + } + return trees; + } + + protected void updateView() { + // Update the view + if (getDiffRoot().hasChildren()) { + getViewer().refresh(); + } else { + getViewer().setInput(null); + } + + // Update the status line + updateStatusLine(); + } + + /** + * Overridden to mark the source as merged. + */ + protected void compareInputChanged(ICompareInput source) { + super.compareInputChanged(source); + contentsChanged(source); + } + protected void contentsChanged(ICompareInput source) { + // Mark the source as merged. + if (source instanceof TeamFile) { + IRemoteSyncElement element = ((TeamFile)source).getMergeResource().getSyncElement(); + try { + CVSUIPlugin.getPlugin().getRepositoryManager().merged(new IRemoteSyncElement[] {element}); + } catch (TeamException e) { + ErrorDialog.openError(getShell(), null, null, e.getStatus()); + } + } + } + /* + * @see SyncCompareInput#getSyncGranularity() + */ + protected int getSyncGranularity() { + // assuming that sync is always performed relative to the current branch. In + // these cases the server will perform the content comparison for us. + return IRemoteSyncElement.GRANULARITY_TIMESTAMP; + } +} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java index aa8df4e4a..3dd338bcc 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ToolTipMessageDialog.java @@ -1,25 +1,25 @@ -package org.eclipse.team.internal.ccvs.ui.sync; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; -/** - * A class that adds tool-tips to the buttons of a standard message dialog. +package org.eclipse.team.internal.ccvs.ui.sync; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; +/** + * A class that adds tool-tips to the buttons of a standard message dialog. */ public class ToolTipMessageDialog extends MessageDialog { - private String[] buttonToolTips; - /** - * Same as the MessageDialog constructor, with the addition of a button tooltip - * argument. The number of button tool tips must match the number of button labels. - */ - public ToolTipMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, String[] buttonToolTips, int defaultIndex) { - super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); - this.buttonToolTips = buttonToolTips; - } - /** - * Method declared on MessageDialog. - */ - protected void createButtonsForButtonBar(Composite parent) { - super.createButtonsForButtonBar(parent); - if (buttonToolTips != null) { - for (int i = 0; i < buttonToolTips.length; i++) { - getButton(i).setToolTipText(buttonToolTips[i]); - } - } + private String[] buttonToolTips; + /** + * Same as the MessageDialog constructor, with the addition of a button tooltip + * argument. The number of button tool tips must match the number of button labels. + */ + public ToolTipMessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, String[] buttonToolTips, int defaultIndex) { + super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); + this.buttonToolTips = buttonToolTips; + } + /** + * Method declared on MessageDialog. + */ + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + if (buttonToolTips != null) { + for (int i = 0; i < buttonToolTips.length; i++) { + getButton(i).setToolTipText(buttonToolTips[i]); + } + } } } diff --git a/bundles/org.eclipse.team.ui/README b/bundles/org.eclipse.team.ui/README index e5bced73f..6a358f07a 100644 --- a/bundles/org.eclipse.team.ui/README +++ b/bundles/org.eclipse.team.ui/README @@ -1,13 +1,13 @@ -Note to users of this plug-in - -The classes and interfaces in this plug-in are part of an API that is -still under development and expected to change significantly before -reaching stability. It is being made available at this early stage to -solicit feedback from pioneering adopters on the understanding -that any code that uses this API will almost certainly be broken -(repeatedly) as the API evolves. - -For up-to-date information on these APIs and other related news see -our component page: - +Note to users of this plug-in + +The classes and interfaces in this plug-in are part of an API that is +still under development and expected to change significantly before +reaching stability. It is being made available at this early stage to +solicit feedback from pioneering adopters on the understanding +that any code that uses this API will almost certainly be broken +(repeatedly) as the API evolves. + +For up-to-date information on these APIs and other related news see +our component page: + http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-vcm-home/main.html \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/about.html b/bundles/org.eclipse.team.ui/about.html index 768324e89..441774f92 100644 --- a/bundles/org.eclipse.team.ui/about.html +++ b/bundles/org.eclipse.team.ui/about.html @@ -1,42 +1,42 @@ - - -About - - - - - - - - -
About This Content
-

11th December, 2001

-

License

-

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

- -

Contributions

- -

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

- -

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or -other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.

-
- + + +About + + + + + + + + +
About This Content
+

11th December, 2001

+

License

+

Eclipse.org makes available all content in this plug-in "Content". Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Common Public License Version 0.5 "CPL". For purposes of the CPL, "Program" will mean the Content.

+ +

Contributions

+ +

If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise +made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such +Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.

+ +

If this Content is licensed to you under license terms and conditions other than the CPL "Other License", any modifications, enhancements and/or +other code and/or documentation "Modifications" uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the +host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available +to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also +providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of +the CPL.

+
+ \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/doc/hglegal.htm b/bundles/org.eclipse.team.ui/doc/hglegal.htm index b071dbdf4..c59811321 100644 --- a/bundles/org.eclipse.team.ui/doc/hglegal.htm +++ b/bundles/org.eclipse.team.ui/doc/hglegal.htm @@ -1,14 +1,14 @@ - - - - - - Legal Notices - - - -

-Notices

-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. - - + + + + + + Legal Notices + + + +

+Notices

+(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved. + + diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html index 18113134f..21fdecd7d 100644 --- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html +++ b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html @@ -1,30 +1,30 @@ - - - - - Team Core Extension Points - - - -
-

Team UI Plug-in

-This document lists all of the extension points that the Team UI plug-in makes available to provider developers. -

-


-

-General Extension Points

-The following extension point can be used to register a configuration mechanism for associating a project -with a team provider: - -The following extension point can be used to register a decorator to add team-related adornments to elements -in the UI: - -Copyright IBM Corp. 2000, 2001.  All Rights Reserved. - - + + + + + Team Core Extension Points + + + +
+

Team UI Plug-in

+This document lists all of the extension points that the Team UI plug-in makes available to provider developers. +

+


+

+General Extension Points

+The following extension point can be used to register a configuration mechanism for associating a project +with a team provider: + +The following extension point can be used to register a decorator to add team-related adornments to elements +in the UI: + +Copyright IBM Corp. 2000, 2001.  All Rights Reserved. + + diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html index c6e58e2bb..69eed425a 100644 --- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html +++ b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_configurationWizards.html @@ -1,61 +1,61 @@ - - - - - Eclipse Team UI Extension Point: Configuration Wizards - - - -
-

-Configuration Wizards

-Identifier: org.eclipse.team.ui.configurationWizards -

Description: This extension point is used to register -a method for configuration of a project. Configuration involves the association -of a project with a team provider, including all information necessary to -initialize that team provider, including such things as username, password, and -any relevant information necessary to locate the provider. -

Providers may provide an extension for this extension point, and an -implementation of org.eclipse.team.ui.IConfigurationWizard which -gathers the necessary information and configures the project. -

Configuration Markup: -

   <!ELEMENT wizard EMPTY> -
   <!ATTLIST wizard -
      name           -CDATA #REQUIRED -
      icon           -CDATA #REQUIRED -
      class          -CDATA #REQUIRED -
      id             -CDATA #REQUIRED -
   > - -

- -Examples: -

Following is an example of a configuration wizard extension: -

   <extension point="org.eclipse.team.ui.configurationWizard"> -
      <wizard -
        name="WebDAV" -
        icon="webdav.gif" -
        class="com.xyz.DAVDecorator" -
        id="com.xyz.dav"> -
      </wizard> -
   </extension> - -

API Information: The value of the class attribute -must represent a class that implements org.eclipse.team.ui.IConfigurationWizard. -This interface supports configuration of a wizard given a workbench and a project. - -

Supplied Implementation: The plug-in org.eclipse.team.provider.examples.ui contains -sample implementations of IConfigurationWizard for the WebDAV and filesystem provider types. - -

Copyright IBM Corp. 2000, 2001.  All Rights Reserved. - - + + + + + Eclipse Team UI Extension Point: Configuration Wizards + + + +

+

+Configuration Wizards

+Identifier: org.eclipse.team.ui.configurationWizards +

Description: This extension point is used to register +a method for configuration of a project. Configuration involves the association +of a project with a team provider, including all information necessary to +initialize that team provider, including such things as username, password, and +any relevant information necessary to locate the provider. +

Providers may provide an extension for this extension point, and an +implementation of org.eclipse.team.ui.IConfigurationWizard which +gathers the necessary information and configures the project. +

Configuration Markup: +

   <!ELEMENT wizard EMPTY> +
   <!ATTLIST wizard +
      name           +CDATA #REQUIRED +
      icon           +CDATA #REQUIRED +
      class          +CDATA #REQUIRED +
      id             +CDATA #REQUIRED +
   > + +

+ +Examples: +

Following is an example of a configuration wizard extension: +

   <extension point="org.eclipse.team.ui.configurationWizard"> +
      <wizard +
        name="WebDAV" +
        icon="webdav.gif" +
        class="com.xyz.DAVDecorator" +
        id="com.xyz.dav"> +
      </wizard> +
   </extension> + +

API Information: The value of the class attribute +must represent a class that implements org.eclipse.team.ui.IConfigurationWizard. +This interface supports configuration of a wizard given a workbench and a project. + +

Supplied Implementation: The plug-in org.eclipse.team.provider.examples.ui contains +sample implementations of IConfigurationWizard for the WebDAV and filesystem provider types. + +

Copyright IBM Corp. 2000, 2001.  All Rights Reserved. + + diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_decorators.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_decorators.html index 9e2ff129b..ee5e9f5a9 100644 --- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_decorators.html +++ b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui_decorators.html @@ -1,55 +1,55 @@ - - - - - Eclipse Team UI Extension Point: Decorators - - - -

-

-Decorators

-Identifier: org.eclipse.team.ui.decorators -

Description: This extension point is used to register -object decorator extensions. These decorators may adorn objects with -labels and icons depending on certain aspects of their team status. For -example, elements which are locally modified may their label or icon -modified to indicate this status. -

Providers may provide an extension for this extension point, and an -implementation of org.eclipse.team.ui.ITeamDecorator which -decorates objects in a provider-specific fashion. -

Configuration Markup: -

   <!ELEMENT decorator EMPTY> -
   <!ATTLIST decorator -
      class             -CDATA #REQUIRED -
      natureId          -CDATA #REQUIRED -
   > - -

- -Examples: -

Following is an example of decorator configuration: -

   <extension point="org.eclipse.team.ui.decorators"> -
      <decorator -
        class="com.xyz.XYZDecorator" -
        natureId="com.xyz.XYZNature"> -
      </decorator> -
   </extension> - -

API Information: The value of the class attribute -must represent a class that implements org.eclipse.team.ui.ITeamDecorator. -This decorator may be called upon at any time to provide textual labels and -icon adornments for a given resource. - -

Supplied Implementation: The plug-in org.eclipse.team.provider.examples.ui contains -sample implementations of ITeamDecorator which decorate for the filesystem provider implementation -and the WebDAV provider implementation. - -

Copyright IBM Corp. 2000, 2001.  All Rights Reserved. - - + + + + + Eclipse Team UI Extension Point: Decorators + + + +

+

+Decorators

+Identifier: org.eclipse.team.ui.decorators +

Description: This extension point is used to register +object decorator extensions. These decorators may adorn objects with +labels and icons depending on certain aspects of their team status. For +example, elements which are locally modified may their label or icon +modified to indicate this status. +

Providers may provide an extension for this extension point, and an +implementation of org.eclipse.team.ui.ITeamDecorator which +decorates objects in a provider-specific fashion. +

Configuration Markup: +

   <!ELEMENT decorator EMPTY> +
   <!ATTLIST decorator +
      class             +CDATA #REQUIRED +
      natureId          +CDATA #REQUIRED +
   > + +

+ +Examples: +

Following is an example of decorator configuration: +

   <extension point="org.eclipse.team.ui.decorators"> +
      <decorator +
        class="com.xyz.XYZDecorator" +
        natureId="com.xyz.XYZNature"> +
      </decorator> +
   </extension> + +

API Information: The value of the class attribute +must represent a class that implements org.eclipse.team.ui.ITeamDecorator. +This decorator may be called upon at any time to provide textual labels and +icon adornments for a given resource. + +

Supplied Implementation: The plug-in org.eclipse.team.provider.examples.ui contains +sample implementations of ITeamDecorator which decorate for the filesystem provider implementation +and the WebDAV provider implementation. + +

Copyright IBM Corp. 2000, 2001.  All Rights Reserved. + + diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml index d5c5cc867..4652d9f76 100644 --- a/bundles/org.eclipse.team.ui/plugin.xml +++ b/bundles/org.eclipse.team.ui/plugin.xml @@ -1,101 +1,101 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java index bb7c9e813..b40b54eb2 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardElement.java @@ -1,137 +1,137 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.internal.model.WorkbenchAdapter; -import org.eclipse.ui.model.IWorkbenchAdapter; -import org.eclipse.team.ui.*; - -/** - * ConfigurationWizardElement represents an item in the configuration wizard table, - * declared by an extension to the configurationWizards extension point. - */ -public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable { - private String id; - private String name; - private ImageDescriptor imageDescriptor; - private String description; - private IConfigurationElement configurationElement; - - /** - * Creates a new instance of this class - * - * @param name the name of the element - */ - public ConfigurationWizardElement(String name) { - this.name = name; - } - /** - * Create an the instance of the object described by the configuration - * element. That is, create the instance of the class the isv supplied in - * the extension point. - * - * @throws CoreException if an error occurs creating the extension - */ - public Object createExecutableExtension() throws CoreException { - return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS); - } - /* - * Method declared on IAdaptable. - */ - public Object getAdapter(Class adapter) { - if (adapter == IWorkbenchAdapter.class) { - return this; - } - return Platform.getAdapterManager().getAdapter(this, adapter); - } - /** - * Returns the configuration element - * - * @return the configuration element - */ - public IConfigurationElement getConfigurationElement() { - return configurationElement; - } - /** - * Returns the description parameter of this element - * - * @return the description of this elemnet - */ - public String getDescription() { - return description; - } - /** - * Returns the image for the given element - * - * @param element the element to get the image for - * @return the image for the given element - */ - public ImageDescriptor getImageDescriptor(Object element) { - return imageDescriptor; - } - /** - * Returns the label for the given element - * - * @param element the element to get the label for - * @return the label for the given element - */ - public String getLabel(Object element) { - return name; - } - /** - * Returns the id as specified in the extension. - * - * @return java.lang.String - */ - public String getID() { - return id; - } - /** - * Returns the image for this element. - * - * @return the image for this element - */ - public ImageDescriptor getImageDescriptor() { - return imageDescriptor; - } - /** - * Set the configuration element - * - * @param newConfigurationElement the new configuration element - */ - public void setConfigurationElement(IConfigurationElement newConfigurationElement) { - configurationElement = newConfigurationElement; - } - /** - * Set the description parameter of this element - * - * @param value the new desrciption - */ - public void setDescription(String value) { - description = value; - } - /** - * Sets the id parameter of this element - * - * @param value the new ID - */ - public void setID(String value) { - id = value; - } - /** - * Sets the image for this element. - * - * @param value the new image - */ - public void setImageDescriptor(ImageDescriptor value) { - imageDescriptor = value; - } -} +package org.eclipse.team.internal.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.internal.model.WorkbenchAdapter; +import org.eclipse.ui.model.IWorkbenchAdapter; +import org.eclipse.team.ui.*; + +/** + * ConfigurationWizardElement represents an item in the configuration wizard table, + * declared by an extension to the configurationWizards extension point. + */ +public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable { + private String id; + private String name; + private ImageDescriptor imageDescriptor; + private String description; + private IConfigurationElement configurationElement; + + /** + * Creates a new instance of this class + * + * @param name the name of the element + */ + public ConfigurationWizardElement(String name) { + this.name = name; + } + /** + * Create an the instance of the object described by the configuration + * element. That is, create the instance of the class the isv supplied in + * the extension point. + * + * @throws CoreException if an error occurs creating the extension + */ + public Object createExecutableExtension() throws CoreException { + return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS); + } + /* + * Method declared on IAdaptable. + */ + public Object getAdapter(Class adapter) { + if (adapter == IWorkbenchAdapter.class) { + return this; + } + return Platform.getAdapterManager().getAdapter(this, adapter); + } + /** + * Returns the configuration element + * + * @return the configuration element + */ + public IConfigurationElement getConfigurationElement() { + return configurationElement; + } + /** + * Returns the description parameter of this element + * + * @return the description of this elemnet + */ + public String getDescription() { + return description; + } + /** + * Returns the image for the given element + * + * @param element the element to get the image for + * @return the image for the given element + */ + public ImageDescriptor getImageDescriptor(Object element) { + return imageDescriptor; + } + /** + * Returns the label for the given element + * + * @param element the element to get the label for + * @return the label for the given element + */ + public String getLabel(Object element) { + return name; + } + /** + * Returns the id as specified in the extension. + * + * @return java.lang.String + */ + public String getID() { + return id; + } + /** + * Returns the image for this element. + * + * @return the image for this element + */ + public ImageDescriptor getImageDescriptor() { + return imageDescriptor; + } + /** + * Set the configuration element + * + * @param newConfigurationElement the new configuration element + */ + public void setConfigurationElement(IConfigurationElement newConfigurationElement) { + configurationElement = newConfigurationElement; + } + /** + * Set the description parameter of this element + * + * @param value the new desrciption + */ + public void setDescription(String value) { + description = value; + } + /** + * Sets the id parameter of this element + * + * @param value the new ID + */ + public void setID(String value) { + id = value; + } + /** + * Sets the image for this element. + * + * @param value the new image + */ + public void setImageDescriptor(ImageDescriptor value) { + imageDescriptor = value; + } +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java index 1079aa80c..f7f59d8c3 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ConfigurationWizardNode.java @@ -1,65 +1,65 @@ -package org.eclipse.team.internal.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.IWizardNode; -import org.eclipse.swt.graphics.Point; - -/** - * ConfigurationWizardNode represents the objects in the - * table in the Configuration wizard. - */ -public class ConfigurationWizardNode implements IWizardNode { - // The element this node represents - ConfigurationWizardElement element; - // The wizard this node is in - IWizard wizard; - - /** - * Create a new ConfigurationWizardNode - * - * @param element the configuration wizard element for this node - */ - public ConfigurationWizardNode(ConfigurationWizardElement element) { - this.element = element; - } - /* - * Method declared on IWizardNode. - */ - public void dispose() { - if (wizard != null) { - wizard.dispose(); - wizard = null; - } - } - /* - * Method declared on IWizardNode. - */ - public Point getExtent() { - return new Point(-1, -1); - } - /* - * Method declared on IWizardNode. - */ - public IWizard getWizard() { - if (wizard == null) { - try { - wizard = (IWizard)element.createExecutableExtension(); - } catch (CoreException e) { - System.out.println(Policy.bind("exceptionCreatingWizard")); - } - } - return wizard; - } - /* - * Method declared on IWizardNode. - */ - public boolean isContentCreated() { - return wizard != null; - } -} +package org.eclipse.team.internal.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardNode; +import org.eclipse.swt.graphics.Point; + +/** + * ConfigurationWizardNode represents the objects in the + * table in the Configuration wizard. + */ +public class ConfigurationWizardNode implements IWizardNode { + // The element this node represents + ConfigurationWizardElement element; + // The wizard this node is in + IWizard wizard; + + /** + * Create a new ConfigurationWizardNode + * + * @param element the configuration wizard element for this node + */ + public ConfigurationWizardNode(ConfigurationWizardElement element) { + this.element = element; + } + /* + * Method declared on IWizardNode. + */ + public void dispose() { + if (wizard != null) { + wizard.dispose(); + wizard = null; + } + } + /* + * Method declared on IWizardNode. + */ + public Point getExtent() { + return new Point(-1, -1); + } + /* + * Method declared on IWizardNode. + */ + public IWizard getWizard() { + if (wizard == null) { + try { + wizard = (IWizard)element.createExecutableExtension(); + } catch (CoreException e) { + System.out.println(Policy.bind("exceptionCreatingWizard")); + } + } + return wizard; + } + /* + * Method declared on IWizardNode. + */ + public boolean isContentCreated() { + return wizard != null; + } +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java index bd7349b19..2d885d328 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TextPreferencePage.java @@ -1 +1 @@ -package org.eclipse.team.internal.ui; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.TableEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.team.core.IFileTypeRegistry; import org.eclipse.team.core.TeamPlugin; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; /** * This preference page displays all patterns which determine whether a resource * is to be treated as a text file or not. The page allows the user to add or * remove entries from this table, and change their values from Text to Binary. */ public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Some string constants for display purposes private static final String TEXT = Policy.bind("TextPreferencePage.text"); private static final String BINARY = Policy.bind("TextPreferencePage.binary"); private static final String TRUE = "true"; private static final String FALSE = "false"; // The name of the parameter in the file registry private static final String IS_TEXT = "isText"; // The input for the table viewer private List input; // Widgets private TableViewer viewer; private Button removeButton; private Button changeButton; // File type registry private IFileTypeRegistry registry; /** * TableEntry is a pair of strings representing an entry in the table */ class TableEntry { String ext; String value; public TableEntry(String ext, String value) { this.ext = ext; this.value = value; } public String getExtension() { return ext; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } /** * TableLabelProvider provides labels for TableEntrys. */ class TableLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object element, int columnIndex) { TableEntry entry = (TableEntry)element; switch (columnIndex) { case 0: return entry.getExtension(); case 1: return entry.getValue(); default: return null; } } public Image getColumnImage(Object element, int columnIndex) { return null; } }; /* * Method declared on IWorkbenchPreferencePage */ public void init(IWorkbench workbench) { } /* * @see PreferencePage#createControl */ protected Control createContents(Composite ancestor) { noDefaultAndApplyButton(); Composite parent = new Composite(ancestor, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); // set F1 help //WorkbenchHelp.setHelp(parent, new DialogPageContextComputer (this, ITeamHelpContextIds.TEXT_PREFERENCE_PAGE)); Label l1 = new Label(parent, SWT.NULL); l1.setText(Policy.bind("TextPreferencePage.description")); GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; l1.setLayoutData(data); viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Table table = viewer.getTable(); new TableEditor(table); table.setHeaderVisible(true); table.setLinesVisible(true); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(30); table.setLayoutData(gd); table.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { handleSelection(); } }); // Create the table columns new TableColumn(table, SWT.NULL); new TableColumn(table, SWT.NULL); TableColumn[] columns = table.getColumns(); columns[0].setText(Policy.bind("TextPreferencePage.extension")); columns[1].setText(Policy.bind("TextPreferencePage.contents")); CellEditor editor = new ComboBoxCellEditor(table, new String[] {TEXT, BINARY}); viewer.setCellEditors(new CellEditor[] {null, editor}); viewer.setColumnProperties(new String[] {"extension", "contents"}); viewer.setCellModifier(new ICellModifier() { public Object getValue(Object element, String property) { String value = ((TableEntry)element).getValue(); if (value.equals(TEXT)) { return new Integer(0); } else { return new Integer(1); } } public boolean canModify(Object element, String property) { return true; } public void modify(Object element, String property, Object value) { IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); TableEntry entry = (TableEntry)selection.getFirstElement(); if (((Integer)value).intValue() == 0) { entry.setValue(TEXT); } else { entry.setValue(BINARY); } viewer.refresh(entry); } }); viewer.setLabelProvider(new TableLabelProvider()); viewer.setContentProvider(new IStructuredContentProvider() { public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object[] getElements(Object inputElement) { if (inputElement == null) return null; return ((List)inputElement).toArray(); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { ISelection selection = event.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } viewer.editElement(((IStructuredSelection)selection).getFirstElement(), 1); } }); TableLayout tl = new TableLayout(); tl.addColumnData(new ColumnWeightData(50)); tl.addColumnData(new ColumnWeightData(50)); table.setLayout(tl); Composite buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); buttons.setLayout(new GridLayout()); Button addButton = new Button(buttons, SWT.PUSH); addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addButton.setText(Policy.bind("TextPreferencePage.add")); addButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { addPattern(); } }); removeButton= new Button(buttons, SWT.PUSH); removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeButton.setText(Policy.bind("TextPreferencePage.remove")); removeButton.setEnabled(false); removeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { removePattern(); } }); changeButton = new Button(buttons, SWT.PUSH); changeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); changeButton.setText(Policy.bind("TextPreferencePage.change")); changeButton.setEnabled(false); changeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { changePattern(); } }); fillTable(); return parent; } /** * Do anything necessary because the OK button has been pressed. * * @return whether it is okay to close the preference page */ public boolean performOk() { Iterator it = input.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); String value = entry.getValue(); if (value.equals(TEXT)) { value = TRUE; } else { value = FALSE; } registry.setValue(entry.getExtension(), IS_TEXT, value); } return true; } /** * Fill the table with the values from the file type registry */ private void fillTable() { this.input = new ArrayList(); this.registry = TeamPlugin.getFileTypeRegistry(); String[] extensions = registry.getExtensions(IS_TEXT); for (int i = 0; i < extensions.length; i++) { String value = registry.getValue(extensions[i], IS_TEXT); if (value.equals(TRUE)) { value = TEXT; } else { value = BINARY; } input.add(new TableEntry(extensions[i], value)); } viewer.setInput(input); } /** * Add a new item to the table with the default type of Text. */ private void addPattern() { InputDialog dialog = new InputDialog(getShell(), Policy.bind("TextPreferencePage.enterExtensionShort"), Policy.bind("TextPreferencePage.enterExtensionLong"), null, null); dialog.open(); if (dialog.getReturnCode() != InputDialog.OK) return; String pattern = dialog.getValue(); if (pattern.equals("")) return; // Check if the item already exists Iterator it = input.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); if (entry.getExtension().equals(pattern)) { MessageDialog.openWarning(getShell(), Policy.bind("TextPreferencePage.extensionExistsShort"), Policy.bind("TextPreferencePage.extensionExistsLong")); return; } } input.add(new TableEntry(pattern, TEXT)); viewer.refresh(); } /** * Remove the selected items from the table */ private void removePattern() { ISelection selection = viewer.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } IStructuredSelection ss = (IStructuredSelection)selection; Iterator it = ss.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); input.remove(entry); } viewer.refresh(); } /** * Toggle the selected items' content types */ private void changePattern() { ISelection selection = viewer.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } IStructuredSelection ss = (IStructuredSelection)selection; Iterator it = ss.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); String string = entry.getValue(); if (string.equals(TEXT)) { entry.setValue(BINARY); } else { entry.setValue(TEXT); } viewer.refresh(entry); } } /** * The table viewer selection has changed. Update the remove and change button enablement. */ private void handleSelection() { boolean empty = viewer.getSelection().isEmpty(); removeButton.setEnabled(!empty); changeButton.setEnabled(!empty); } } \ No newline at end of file +package org.eclipse.team.internal.ui; /* * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ColumnWeightData; import org.eclipse.jface.viewers.ComboBoxCellEditor; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.ICellModifier; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.TableEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.team.core.IFileTypeRegistry; import org.eclipse.team.core.TeamPlugin; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; /** * This preference page displays all patterns which determine whether a resource * is to be treated as a text file or not. The page allows the user to add or * remove entries from this table, and change their values from Text to Binary. */ public class TextPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { // Some string constants for display purposes private static final String TEXT = Policy.bind("TextPreferencePage.text"); private static final String BINARY = Policy.bind("TextPreferencePage.binary"); private static final String TRUE = "true"; private static final String FALSE = "false"; // The name of the parameter in the file registry private static final String IS_TEXT = "isText"; // The input for the table viewer private List input; // Widgets private TableViewer viewer; private Button removeButton; private Button changeButton; // File type registry private IFileTypeRegistry registry; /** * TableEntry is a pair of strings representing an entry in the table */ class TableEntry { String ext; String value; public TableEntry(String ext, String value) { this.ext = ext; this.value = value; } public String getExtension() { return ext; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } /** * TableLabelProvider provides labels for TableEntrys. */ class TableLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object element, int columnIndex) { TableEntry entry = (TableEntry)element; switch (columnIndex) { case 0: return entry.getExtension(); case 1: return entry.getValue(); default: return null; } } public Image getColumnImage(Object element, int columnIndex) { return null; } }; /* * Method declared on IWorkbenchPreferencePage */ public void init(IWorkbench workbench) { } /* * @see PreferencePage#createControl */ protected Control createContents(Composite ancestor) { noDefaultAndApplyButton(); Composite parent = new Composite(ancestor, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); // set F1 help //WorkbenchHelp.setHelp(parent, new DialogPageContextComputer (this, ITeamHelpContextIds.TEXT_PREFERENCE_PAGE)); Label l1 = new Label(parent, SWT.NULL); l1.setText(Policy.bind("TextPreferencePage.description")); GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); data.horizontalSpan = 2; l1.setLayoutData(data); viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Table table = viewer.getTable(); new TableEditor(table); table.setHeaderVisible(true); table.setLinesVisible(true); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertWidthInCharsToPixels(30); table.setLayoutData(gd); table.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { handleSelection(); } }); // Create the table columns new TableColumn(table, SWT.NULL); new TableColumn(table, SWT.NULL); TableColumn[] columns = table.getColumns(); columns[0].setText(Policy.bind("TextPreferencePage.extension")); columns[1].setText(Policy.bind("TextPreferencePage.contents")); CellEditor editor = new ComboBoxCellEditor(table, new String[] {TEXT, BINARY}); viewer.setCellEditors(new CellEditor[] {null, editor}); viewer.setColumnProperties(new String[] {"extension", "contents"}); viewer.setCellModifier(new ICellModifier() { public Object getValue(Object element, String property) { String value = ((TableEntry)element).getValue(); if (value.equals(TEXT)) { return new Integer(0); } else { return new Integer(1); } } public boolean canModify(Object element, String property) { return true; } public void modify(Object element, String property, Object value) { IStructuredSelection selection = (IStructuredSelection)viewer.getSelection(); TableEntry entry = (TableEntry)selection.getFirstElement(); if (((Integer)value).intValue() == 0) { entry.setValue(TEXT); } else { entry.setValue(BINARY); } viewer.refresh(entry); } }); viewer.setLabelProvider(new TableLabelProvider()); viewer.setContentProvider(new IStructuredContentProvider() { public void dispose() { } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } public Object[] getElements(Object inputElement) { if (inputElement == null) return null; return ((List)inputElement).toArray(); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { ISelection selection = event.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } viewer.editElement(((IStructuredSelection)selection).getFirstElement(), 1); } }); TableLayout tl = new TableLayout(); tl.addColumnData(new ColumnWeightData(50)); tl.addColumnData(new ColumnWeightData(50)); table.setLayout(tl); Composite buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); buttons.setLayout(new GridLayout()); Button addButton = new Button(buttons, SWT.PUSH); addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); addButton.setText(Policy.bind("TextPreferencePage.add")); addButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { addPattern(); } }); removeButton= new Button(buttons, SWT.PUSH); removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); removeButton.setText(Policy.bind("TextPreferencePage.remove")); removeButton.setEnabled(false); removeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { removePattern(); } }); changeButton = new Button(buttons, SWT.PUSH); changeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); changeButton.setText(Policy.bind("TextPreferencePage.change")); changeButton.setEnabled(false); changeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { changePattern(); } }); fillTable(); return parent; } /** * Do anything necessary because the OK button has been pressed. * * @return whether it is okay to close the preference page */ public boolean performOk() { Iterator it = input.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); String value = entry.getValue(); if (value.equals(TEXT)) { value = TRUE; } else { value = FALSE; } registry.setValue(entry.getExtension(), IS_TEXT, value); } return true; } /** * Fill the table with the values from the file type registry */ private void fillTable() { this.input = new ArrayList(); this.registry = TeamPlugin.getFileTypeRegistry(); String[] extensions = registry.getExtensions(IS_TEXT); for (int i = 0; i < extensions.length; i++) { String value = registry.getValue(extensions[i], IS_TEXT); if (value.equals(TRUE)) { value = TEXT; } else { value = BINARY; } input.add(new TableEntry(extensions[i], value)); } viewer.setInput(input); } /** * Add a new item to the table with the default type of Text. */ private void addPattern() { InputDialog dialog = new InputDialog(getShell(), Policy.bind("TextPreferencePage.enterExtensionShort"), Policy.bind("TextPreferencePage.enterExtensionLong"), null, null); dialog.open(); if (dialog.getReturnCode() != InputDialog.OK) return; String pattern = dialog.getValue(); if (pattern.equals("")) return; // Check if the item already exists Iterator it = input.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); if (entry.getExtension().equals(pattern)) { MessageDialog.openWarning(getShell(), Policy.bind("TextPreferencePage.extensionExistsShort"), Policy.bind("TextPreferencePage.extensionExistsLong")); return; } } input.add(new TableEntry(pattern, TEXT)); viewer.refresh(); } /** * Remove the selected items from the table */ private void removePattern() { ISelection selection = viewer.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } IStructuredSelection ss = (IStructuredSelection)selection; Iterator it = ss.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); input.remove(entry); } viewer.refresh(); } /** * Toggle the selected items' content types */ private void changePattern() { ISelection selection = viewer.getSelection(); if (selection == null || !(selection instanceof IStructuredSelection)) { return; } IStructuredSelection ss = (IStructuredSelection)selection; Iterator it = ss.iterator(); while (it.hasNext()) { TableEntry entry = (TableEntry)it.next(); String string = entry.getValue(); if (string.equals(TEXT)) { entry.setValue(BINARY); } else { entry.setValue(TEXT); } viewer.refresh(entry); } } /** * The table viewer selection has changed. Update the remove and change button enablement. */ private void handleSelection() { boolean empty = viewer.getSelection().isEmpty(); removeButton.setEnabled(!empty); changeButton.setEnabled(!empty); } } \ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java index 168015f72..fcd51bfbc 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/IConfigurationWizard.java @@ -1,30 +1,30 @@ -package org.eclipse.team.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.ui.IWorkbench; - -/** - * IConfigurationWizard defines the interface that users of the extension - * point org.eclipse.team.ui.configurationWizards must implement. - */ -public interface IConfigurationWizard extends IWizard { - /** - * Initializes this creation wizard using the passed workbench and - * object selection. - *

- * This method is called after the no argument constructor and - * before other methods are called. - *

- * - * @param workbench the current workbench - * @param project the selected project - */ - void init(IWorkbench workbench, IProject project); -} - +package org.eclipse.team.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.ui.IWorkbench; + +/** + * IConfigurationWizard defines the interface that users of the extension + * point org.eclipse.team.ui.configurationWizards must implement. + */ +public interface IConfigurationWizard extends IWizard { + /** + * Initializes this creation wizard using the passed workbench and + * object selection. + *

+ * This method is called after the no argument constructor and + * before other methods are called. + *

+ * + * @param workbench the current workbench + * @param project the selected project + */ + void init(IWorkbench workbench, IProject project); +} + diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java index 1b324faa4..5ea2a4bf1 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/ISharedImages.java @@ -1,21 +1,21 @@ -package org.eclipse.team.ui; - -/* - * (c) Copyright IBM Corp. 2000, 2001. - * All Rights Reserved. - */ - -import org.eclipse.jface.resource.ImageDescriptor; - -/** - * Images that are available for providers to re-use. They include - * common overlays and wizard images. A provider can use their own - * custom images, these shared images are only available for - * convenience. - */ -public interface ISharedImages { - public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; - public final String IMG_CHECKEDIN_OVR = "ovr/checkedin_ov.gif"; - public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; -} - +package org.eclipse.team.ui; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.jface.resource.ImageDescriptor; + +/** + * Images that are available for providers to re-use. They include + * common overlays and wizard images. A provider can use their own + * custom images, these shared images are only available for + * convenience. + */ +public interface ISharedImages { + public final String IMG_DIRTY_OVR = "ovr/dirty_ov.gif"; + public final String IMG_CHECKEDIN_OVR = "ovr/checkedin_ov.gif"; + public final String IMG_CHECKEDOUT_OVR = "ovr/checkedout_ov.gif"; +} + diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java index 4f2585811..1ea10c5ed 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncView.java @@ -156,8 +156,8 @@ public class SyncView extends ViewPart { private boolean isEmpty(DiffNode node) { if (node.getKind() != 0) return false; IDiffElement[] children = node.getChildren(); - for (int i = 0; i < children.length; i++) { - if (!isEmpty(children[i])) return false; + for (int i = 0; i < children.length; i++) { + if (!isEmpty(children[i])) return false; } return true; } diff --git a/tests/org.eclipse.team.tests.cvs.core/.vcm_meta b/tests/org.eclipse.team.tests.cvs.core/.vcm_meta index 691cc5016..2bfe4af84 100644 --- a/tests/org.eclipse.team.tests.cvs.core/.vcm_meta +++ b/tests/org.eclipse.team.tests.cvs.core/.vcm_meta @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip index ec9b17bdd..21415fd0c 100644 Binary files a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip and b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkBig.zip differ diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip index c56846755..2777111ce 100644 Binary files a/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip and b/tests/org.eclipse.team.tests.cvs.core/resources/BenchmarkTest/benchmarkSmall.zip differ diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules index 1daac9387..3ab59a67f 100644 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules +++ b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules @@ -1,65 +1,65 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. - -# Block access to CVS hogs -#world -a denied___checkout_of_world_takes_too_long -#. -a denied___checkout_of_world_takes_too_long - -# self referencing modules -project1 project1 - -# checkout docs in flattened structure -docs -d docs common/docs -macros common/macros - -# include docs with project -project2 project2 &docs -# only project2 -project2-only project2 - -# a use of alias -project3-src project3/src -project3-src_file -a project3-src/file.c project3-src/file.h -project3-sub project3/sub &project3-src_file - -# embeddings -project4 project4 ¯os -project5-project4 -d extensions/project4 project4 -project5 project5 &project5-project4 ¯os - -# using -d to build a project from other projects -project6-dirA -d dirA project6/A -project6-dirB -d dirB project6/B -project6 &project6-dirA &project6-dirB - -# using aliases to provide packaging -project7-common -a project7/common -project7-pc -a project7-common project7/pc -project7-linux -a project7-common project7/linux - -# simple use of module alias +# Three different line formats are valid: +# key -a aliases... +# key [options] directory +# key [options] directory files... +# +# Where "options" are composed of: +# -i prog Run "prog" on "cvs commit" from top-level of module. +# -o prog Run "prog" on "cvs checkout" of module. +# -e prog Run "prog" on "cvs export" of module. +# -t prog Run "prog" on "cvs rtag" of module. +# -u prog Run "prog" on "cvs update" of module. +# -d dir Place module in directory "dir" instead of module name. +# -l Top-level directory only -- do not recurse. +# +# NOTE: If you change any of the "Run" options above, you'll have to +# release and re-checkout any working directories of these modules. +# +# And "directory" is a path to a directory relative to $CVSROOT. +# +# The "-a" option specifies an alias. An alias is interpreted as if +# everything on the right of the "-a" had been typed on the command line. +# +# You can encode a module within a module by using the special '&' +# character to interpose another module into the current module. This +# can be useful for creating a module that consists of many directories +# spread out over the entire source repository. + +# Block access to CVS hogs +#world -a denied___checkout_of_world_takes_too_long +#. -a denied___checkout_of_world_takes_too_long + +# self referencing modules +project1 project1 + +# checkout docs in flattened structure +docs -d docs common/docs +macros common/macros + +# include docs with project +project2 project2 &docs +# only project2 +project2-only project2 + +# a use of alias +project3-src project3/src +project3-src_file -a project3-src/file.c project3-src/file.h +project3-sub project3/sub &project3-src_file + +# embeddings +project4 project4 ¯os +project5-project4 -d extensions/project4 project4 +project5 project5 &project5-project4 ¯os + +# using -d to build a project from other projects +project6-dirA -d dirA project6/A +project6-dirB -d dirB project6/B +project6 &project6-dirA &project6-dirB + +# using aliases to provide packaging +project7-common -a project7/common +project7-pc -a project7-common project7/pc +project7-linux -a project7-common project7/linux + +# simple use of module alias project8-alias -a project8 common \ No newline at end of file diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html index 5b1b16d1f..8c7fe2111 100644 --- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html +++ b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/common/docs/readme.html @@ -1,2 +1,2 @@ - + \ No newline at end of file -- cgit v1.2.3