diff options
Diffstat (limited to 'examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java')
-rw-r--r-- | examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java index 974256a01..4aacbeb34 100644 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java +++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/subscriber/FileSystemSubscriber.java @@ -16,12 +16,19 @@ package org.eclipse.team.examples.filesystem.subscriber; import java.util.ArrayList; import java.util.List; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.QualifiedName; import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.synchronize.SyncInfo; -import org.eclipse.team.core.variants.*; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.core.variants.ThreeWayRemoteTree; +import org.eclipse.team.core.variants.ThreeWaySubscriber; +import org.eclipse.team.core.variants.ThreeWaySynchronizer; import org.eclipse.team.examples.filesystem.FileSystemPlugin; import org.eclipse.team.examples.filesystem.FileSystemProvider; @@ -32,7 +39,7 @@ import org.eclipse.team.examples.filesystem.FileSystemProvider; * manage the roots and to create resource variants. It also makes * use of a file system specific remote tree (<code>FileSystemRemoteTree</code>) * for provided the remote tree access and refresh. - * + * * @see ThreeWaySubscriber * @see ThreeWaySynchronizer * @see FileSystemProvider @@ -41,7 +48,7 @@ import org.eclipse.team.examples.filesystem.FileSystemProvider; public class FileSystemSubscriber extends ThreeWaySubscriber { private static FileSystemSubscriber instance; - + /** * Return the file system subscriber singleton. * @return the file system subscriber singleton. @@ -52,7 +59,7 @@ public class FileSystemSubscriber extends ThreeWaySubscriber { } return instance; } - + /** * Create the file system subscriber. */ @@ -60,9 +67,7 @@ public class FileSystemSubscriber extends ThreeWaySubscriber { super(new ThreeWaySynchronizer(new QualifiedName(FileSystemPlugin.ID, "workpsace-sync"))); //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.team.core.variants.ThreeWaySubscriber#getResourceVariant(org.eclipse.core.resources.IResource, byte[]) - */ + @Override public IResourceVariant getResourceVariant(IResource resource, byte[] bytes) { RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), FileSystemPlugin.PROVIDER_ID); if (provider != null) { @@ -71,28 +76,21 @@ public class FileSystemSubscriber extends ThreeWaySubscriber { return null; } - /* (non-Javadoc) - * @see org.eclipse.team.core.variants.ThreeWaySubscriber#createRemoteTree() - */ + @Override protected ThreeWayRemoteTree createRemoteTree() { return new FileSystemRemoteTree(this); } - /* (non-Javadoc) - * @see org.eclipse.team.core.subscribers.Subscriber#getName() - */ + @Override public String getName() { return "File System Example"; //$NON-NLS-1$ } - /* (non-Javadoc) - * @see org.eclipse.team.core.subscribers.Subscriber#roots() - */ + @Override public IResource[] roots() { - List result = new ArrayList(); + List<IProject> result = new ArrayList<>(); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); - for (int i = 0; i < projects.length; i++) { - IProject project = projects[i]; + for (IProject project : projects) { if(project.isAccessible()) { RepositoryProvider provider = RepositoryProvider.getProvider(project, FileSystemPlugin.PROVIDER_ID); if(provider != null) { @@ -100,20 +98,16 @@ public class FileSystemSubscriber extends ThreeWaySubscriber { } } } - return (IProject[]) result.toArray(new IProject[result.size()]); + return result.toArray(new IProject[result.size()]); } - /* (non-Javadoc) - * @see org.eclipse.team.core.variants.ThreeWaySubscriber#handleRootChanged(org.eclipse.core.resources.IResource, boolean) - */ + @Override public void handleRootChanged(IResource resource, boolean added) { // Override to allow FileSystemProvider to signal the addition and removal of roots super.handleRootChanged(resource, added); } - - /* (non-Javadoc) - * @see org.eclipse.team.core.variants.ResourceVariantTreeSubscriber#getSyncInfo(org.eclipse.core.resources.IResource, org.eclipse.team.core.variants.IResourceVariant, org.eclipse.team.core.variants.IResourceVariant) - */ + + @Override protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException { // Override to use a custom sync info FileSystemSyncInfo info = new FileSystemSyncInfo(local, base, remote, this.getResourceComparator()); @@ -140,7 +134,7 @@ public class FileSystemSubscriber extends ThreeWaySubscriber { /** * Make the change an outgoing change * @param resource - * @throws TeamException + * @throws TeamException */ public void markAsMerged(IResource resource, IProgressMonitor monitor) throws TeamException { makeInSync(resource); |