Posted on 2006-12-29 12:19
Hexise 閱讀(1593)
評論(0) 編輯 收藏 所屬分類:
Eclipse Plugin
最近項目中出現(xiàn)了一個bug,提示是Resource can not sync with file system.是文件系統(tǒng)不同步的問題,需要手動刷新一下資源管理器.
刷新資源管理器調用方法:
RefreshLocal
public void refreshLocal(int depth, IProgressMonitor monitor)
????????????????? throws CoreException
Refreshes the resource hierarchy from this resource and its children (to the specified depth) relative to the local file system. Creations, deletions, and changes detected in the local file system will be reflected in the workspace's resource tree. This resource need not exist or be local.
This method may discover changes to resources; any such changes will be reported in a subsequent resource change event.
If a new file or directory is discovered in the local file system at or below the location of this resource, any parent folders required to contain the new resource in the workspace will also be created automatically as required.
This method is long-running; progress and cancellation are provided by the given progress monitor.
Parameters:
depth - valid values are DEPTH_ZERO, DEPTH_ONE, or DEPTH_INFINITE
monitor - a progress monitor, or null if progress reporting is not desired
Throws:
CoreException - if this method fails. Reasons include:
Resource changes are disallowed during certain types of resource change event notification. See IResourceChangeEvent for more details.
OperationCanceledException - if the operation is canceled. Cancelation can occur even if no progress monitor is provided.
See Also:
DEPTH_ZERO, DEPTH_ONE, DEPTH_INFINITE, IResourceRuleFactory.refreshRule(IResource)
該方法位于org.eclipse.core.resources.IResource
我的調用方法是:
ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);