Hexise's Blog

业精于勤荒于嬉 行成于思毁于随
posts - 13, comments - 12, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Eclipse插件如何刷新资源管理器?

Posted on 2006-12-29 12:19 Hexise 阅读(1580) 评论(0)  编辑  收藏 所属分类: Eclipse Plugin

最近项目中出现了一个bug,提示是Resource can not sync with file system.是文件系统不同步的问题,需要手动刷新一下资源管理器.

刷新资源管理器调用方法:

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);


只有注册用户登录后才能发表评论。


网站导航: