PTP
Release 7.0

org.eclipse.ptp.rdt.sync.core
Class SyncManager

java.lang.Object
  extended by org.eclipse.ptp.rdt.sync.core.SyncManager

public class SyncManager
extends java.lang.Object

Main control class for managing synchronization

Since:
3.0

Nested Class Summary
static class SyncManager.SyncMode
           
 
Field Summary
static java.lang.String ATTR_CLASS
           
static java.lang.String ATTR_NATURE
           
static java.lang.String SYNCHRONIZE_POLICY_EXTENSION
           
 
Method Summary
static void addPostSyncListener(org.eclipse.core.resources.IProject project, ISyncListener listener)
          Add a listener for sync events on a certain project
static PreferenceSyncFileFilterStorage getDefaultFileFilter()
          Return a copy of the default file filter If there are any problems retrieving the filter, the built-in default filter is returned.
static IMissingConnectionHandler getDefaultMissingConnectionHandler()
          Get the current default missing connection handler
static ISyncExceptionHandler getDefaultSyncExceptionHandler()
          Get the current default sync exception handler
static AbstractSyncFileFilter getFileFilter(org.eclipse.core.resources.IProject project)
          Return a copy of the project's file filter.
static boolean getShowErrors(org.eclipse.core.resources.IProject project)
          Should error messages be displayed for the given project?
static boolean getSyncAuto()
          Should sync'ing be done automatically?
static SyncManager.SyncMode getSyncMode(org.eclipse.core.resources.IProject project)
          Get sync mode for a project
static void makeSyncProject(org.eclipse.core.resources.IProject project, java.lang.String remoteSyncConfigName, ISynchronizeService provider, AbstractSyncFileFilter fileFilter)
          Convert a project into a synchronized project.
static void removePostSyncListener(org.eclipse.core.resources.IProject project, ISyncListener listener)
          Remove a listener for sync events on a certain project
static void saveFileFilter(org.eclipse.core.resources.IProject project, AbstractSyncFileFilter filter)
          Save a new file filter for a project.
static void setDefaultMissingConnectionHandler(IMissingConnectionHandler handler)
          Set the default sync exception handler
static void setDefaultSyncExceptionHandler(ISyncExceptionHandler handler)
          Set the default sync exception handler
static void setShowErrors(org.eclipse.core.resources.IProject project, boolean shouldBeDisplayed)
          Set whether error messages should be displayed
static void setSyncAuto(boolean isSyncAutomatic)
          Turn automatic sync'ing on or off
static void setSyncMode(org.eclipse.core.resources.IProject project, SyncManager.SyncMode mode)
          Set sync mode for a project
static org.eclipse.core.runtime.jobs.Job sync(org.eclipse.core.resources.IResourceDelta delta, org.eclipse.core.resources.IProject project, java.util.EnumSet<SyncFlag> syncFlags, ISyncExceptionHandler seHandler)
          Invoke sync for active (default) configuration on a project
static org.eclipse.core.runtime.jobs.Job[] syncAll(org.eclipse.core.resources.IResourceDelta delta, org.eclipse.core.resources.IProject project, java.util.EnumSet<SyncFlag> syncFlags, ISyncExceptionHandler seHandler)
          Invoke sync for all configurations on a project.
static org.eclipse.core.runtime.jobs.Job[] syncAllBlocking(org.eclipse.core.resources.IResourceDelta delta, org.eclipse.core.resources.IProject project, java.util.EnumSet<SyncFlag> syncFlags, ISyncExceptionHandler seHandler)
          Invoke sync for all configurations on a project and block until the sync finishes.
static org.eclipse.core.runtime.jobs.Job syncBlocking(org.eclipse.core.resources.IResourceDelta delta, org.eclipse.core.resources.IProject project, java.util.EnumSet<SyncFlag> syncFlags, org.eclipse.core.runtime.IProgressMonitor monitor)
          Invoke sync and block until sync finishes.
static org.eclipse.core.runtime.jobs.Job syncBlocking(org.eclipse.core.resources.IResourceDelta delta, org.eclipse.core.resources.IProject project, java.util.EnumSet<SyncFlag> syncFlags, org.eclipse.core.runtime.IProgressMonitor monitor, ISyncExceptionHandler seHandler)
          Invoke sync and block until sync finishes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYNCHRONIZE_POLICY_EXTENSION

public static final java.lang.String SYNCHRONIZE_POLICY_EXTENSION
See Also:
Constant Field Values

ATTR_CLASS

public static final java.lang.String ATTR_CLASS
See Also:
Constant Field Values

ATTR_NATURE

public static final java.lang.String ATTR_NATURE
See Also:
Constant Field Values
Method Detail

addPostSyncListener

public static void addPostSyncListener(org.eclipse.core.resources.IProject project,
                                       ISyncListener listener)
Add a listener for sync events on a certain project

Parameters:
project -
listener -

makeSyncProject

public static void makeSyncProject(org.eclipse.core.resources.IProject project,
                                   java.lang.String remoteSyncConfigName,
                                   ISynchronizeService provider,
                                   AbstractSyncFileFilter fileFilter)
                            throws org.eclipse.core.runtime.CoreException
Convert a project into a synchronized project.

Parameters:
project - project to convert
provider - ISynchronizeService that has been correctly configured
fileFilter - synchronize filter, or null if no filter
Throws:
org.eclipse.core.runtime.CoreException - on problems adding sync nature

getDefaultFileFilter

public static PreferenceSyncFileFilterStorage getDefaultFileFilter()
Return a copy of the default file filter If there are any problems retrieving the filter, the built-in default filter is returned.

Returns:
the file filter. This is never null.

getDefaultMissingConnectionHandler

public static IMissingConnectionHandler getDefaultMissingConnectionHandler()
Get the current default missing connection handler

Returns:
default missing connection handler

getDefaultSyncExceptionHandler

public static ISyncExceptionHandler getDefaultSyncExceptionHandler()
Get the current default sync exception handler

Returns:
default sync exception handler

getFileFilter

public static AbstractSyncFileFilter getFileFilter(org.eclipse.core.resources.IProject project)
Return a copy of the project's file filter. If there are any problems retrieving the filter, the workspace default filter is returned. Since only a copy is returned, users must execute "saveFileFilter(IProject, SyncFileFilter)" after making changes to have those changes actually applied.

Parameters:
project - cannot be null
Returns:
the file filter. This is never null.

getShowErrors

public static boolean getShowErrors(org.eclipse.core.resources.IProject project)
Should error messages be displayed for the given project?

Parameters:
project -
Returns:
whether error messages should be displayed.

getSyncAuto

public static boolean getSyncAuto()
Should sync'ing be done automatically?

Returns:
if sync'ing should be done automatically

getSyncMode

public static SyncManager.SyncMode getSyncMode(org.eclipse.core.resources.IProject project)
Get sync mode for a project

Parameters:
project - cannot be null
Returns:
sync mode. This is never null.

removePostSyncListener

public static void removePostSyncListener(org.eclipse.core.resources.IProject project,
                                          ISyncListener listener)
Remove a listener for sync events on a certain project

Parameters:
project -
listener -

saveFileFilter

public static void saveFileFilter(org.eclipse.core.resources.IProject project,
                                  AbstractSyncFileFilter filter)
                           throws java.io.IOException
Save a new file filter for a project. Use this in conjunction with "getFileFilter(IProject)" to modify the current file filtering for a project.

Parameters:
project - cannot be null
filter - cannot be null
Throws:
java.io.IOException

setDefaultMissingConnectionHandler

public static void setDefaultMissingConnectionHandler(IMissingConnectionHandler handler)
Set the default sync exception handler

Parameters:
handler -

setDefaultSyncExceptionHandler

public static void setDefaultSyncExceptionHandler(ISyncExceptionHandler handler)
Set the default sync exception handler

Parameters:
handler -

setShowErrors

public static void setShowErrors(org.eclipse.core.resources.IProject project,
                                 boolean shouldBeDisplayed)
Set whether error messages should be displayed

Parameters:
project -
shouldBeDisplayed -

setSyncAuto

public static void setSyncAuto(boolean isSyncAutomatic)
Turn automatic sync'ing on or off

Parameters:
isSyncAutomatic -

setSyncMode

public static void setSyncMode(org.eclipse.core.resources.IProject project,
                               SyncManager.SyncMode mode)
Set sync mode for a project

Parameters:
project -
mode -

sync

public static org.eclipse.core.runtime.jobs.Job sync(org.eclipse.core.resources.IResourceDelta delta,
                                                     org.eclipse.core.resources.IProject project,
                                                     java.util.EnumSet<SyncFlag> syncFlags,
                                                     ISyncExceptionHandler seHandler)
                                              throws org.eclipse.core.runtime.CoreException
Invoke sync for active (default) configuration on a project

Parameters:
delta - project delta
project - project to sync
syncFlags - sync flags
seHandler - logic to handle exceptions
Returns:
the scheduled sync job
Throws:
org.eclipse.core.runtime.CoreException

syncAll

public static org.eclipse.core.runtime.jobs.Job[] syncAll(org.eclipse.core.resources.IResourceDelta delta,
                                                          org.eclipse.core.resources.IProject project,
                                                          java.util.EnumSet<SyncFlag> syncFlags,
                                                          ISyncExceptionHandler seHandler)
                                                   throws org.eclipse.core.runtime.CoreException
Invoke sync for all configurations on a project.

Parameters:
delta - project delta
project - project to sync
syncFlags - sync flags
seHandler - logic to handle exceptions
Returns:
array of sync jobs scheduled
Throws:
org.eclipse.core.runtime.CoreException - on problems sync'ing

syncAllBlocking

public static org.eclipse.core.runtime.jobs.Job[] syncAllBlocking(org.eclipse.core.resources.IResourceDelta delta,
                                                                  org.eclipse.core.resources.IProject project,
                                                                  java.util.EnumSet<SyncFlag> syncFlags,
                                                                  ISyncExceptionHandler seHandler)
                                                           throws org.eclipse.core.runtime.CoreException
Invoke sync for all configurations on a project and block until the sync finishes. This does not spawn another thread and no locking of resources is done. Throws sync exceptions for client to handle.

Parameters:
delta - project delta
project - project to sync
syncFlags - sync flags
seHandler - logic to handle exceptions
Returns:
array of sync jobs scheduled
Throws:
org.eclipse.core.runtime.CoreException - on problems sync'ing

syncBlocking

public static org.eclipse.core.runtime.jobs.Job syncBlocking(org.eclipse.core.resources.IResourceDelta delta,
                                                             org.eclipse.core.resources.IProject project,
                                                             java.util.EnumSet<SyncFlag> syncFlags,
                                                             org.eclipse.core.runtime.IProgressMonitor monitor)
                                                      throws org.eclipse.core.runtime.CoreException
Invoke sync and block until sync finishes. This does not spawn another thread and no locking of resources is done. Throws sync exceptions for client to handle.

Parameters:
delta - project delta
project - project to sync
syncFlags - sync flags
monitor - progress monitor
Returns:
the scheduled sync job
Throws:
org.eclipse.core.runtime.CoreException - on problems sync'ing

syncBlocking

public static org.eclipse.core.runtime.jobs.Job syncBlocking(org.eclipse.core.resources.IResourceDelta delta,
                                                             org.eclipse.core.resources.IProject project,
                                                             java.util.EnumSet<SyncFlag> syncFlags,
                                                             org.eclipse.core.runtime.IProgressMonitor monitor,
                                                             ISyncExceptionHandler seHandler)
                                                      throws org.eclipse.core.runtime.CoreException
Invoke sync and block until sync finishes. This does not spawn another thread and no locking of resources is done. Sync exceptions are handled by the passed exception handler or by the default handler if null.

Parameters:
delta - project delta
project - project to sync
syncFlags - sync flags
monitor - progress monitor
seHandler - sync exception handler
Returns:
the scheduled sync job
Throws:
org.eclipse.core.runtime.CoreException - on problems sync'ing

PTP
Release 7.0

Copyright (c) 2011 IBM Corporation and others. All Rights Reserved.