Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-06-15 20:22:35 +0000
committerMichael Valenta2004-06-15 20:22:35 +0000
commit9df2564d62f032730f5c2f09e248be463ce22185 (patch)
tree0582db917da7adcb1dfadf49c8d3b1d981b68369 /examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java
parent69900eca5aac470ed37963d55c4d69c07d094e38 (diff)
downloadeclipse.platform.team-9df2564d62f032730f5c2f09e248be463ce22185.tar.gz
eclipse.platform.team-9df2564d62f032730f5c2f09e248be463ce22185.tar.xz
eclipse.platform.team-9df2564d62f032730f5c2f09e248be463ce22185.zip
Updating examplea
Diffstat (limited to 'examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java')
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java
new file mode 100644
index 000000000..6f9f52d69
--- /dev/null
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSyncInfo.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.examples.filesystem.subscriber;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.variants.IResourceVariant;
+import org.eclipse.team.core.variants.IResourceVariantComparator;
+
+/**
+ * Provide a custom sync info that will report files that exist both
+ * locally and remotely as in-sync and will return a null base if there
+ * is an incoming change.
+ */
+public class FileSystemSyncInfo extends SyncInfo {
+
+ public FileSystemSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote, IResourceVariantComparator comparator) {
+ super(local, base, remote, comparator);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.SyncInfo#calculateKind(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected int calculateKind() throws TeamException {
+ if (getLocal().getType() != IResource.FILE) {
+ if (getLocal().exists() && getRemote() != null) {
+ return IN_SYNC;
+ }
+ }
+ return super.calculateKind();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.synchronize.SyncInfo#getBase()
+ */
+ public IResourceVariant getBase() {
+ // If the kind has been set and there is an incoming change
+ // return null as the base since the server does not keep the
+ // base contents
+ if ((getKind() & INCOMING) > 0) {
+ return null;
+ }
+ return super.getBase();
+ }
+}

Back to the top