我想知道是否有任何独立于平台的Eclipse作为IResource
的一部分来打开资源管理器中的文件夹或目录。作为eclipse插件开发的一部分,我知道它可以特定于操作系统,如Windows、Mac或Linux。但是我有兴趣了解Eclipse平台的任何这样的功能。Eclipse还在系统资源管理器( System )中提供了作为IDE的一部分到系统资源管理器(System)中显示的功能。您可以看到以下图像。基本上,我有兴趣了解任何这样的IResource
API。在windows中,我们可以从命令提示符执行命令,使用explorer.exe .
打开资源管理器中的文件夹,请建议我。我也已经通过下面的链接。
发布于 2020-07-12 08:03:10
这是资源信息页面使用的代码:
ECommandService commandService = PlatformUI.getWorkbench().getService(ECommandService.class);
EHandlerService handlerService = PlatformUI.getWorkbench().getService(EHandlerService.class);
Command command = commandService.getCommand(ShowInSystemExplorerHandler.ID);
if (command.isDefined()) {
ParameterizedCommand parameterizedCommand = commandService
.createCommand(ShowInSystemExplorerHandler.ID, Collections.singletonMap(
ShowInSystemExplorerHandler.RESOURCE_PATH_PARAMETER, locationStr));
if (handlerService.canExecute(parameterizedCommand)) {
handlerService.executeHandler(parameterizedCommand);
}
}
其中locationStr
是资源的完整路径。
注意,ShowInSystemExplorerHandler
类是内部的,因此访问静态字段实际上违反了规则,但在这里应该是可以的,或者您可以将字符串复制到自己的常量中。
发布于 2020-07-12 07:42:56
您可以打电话系统资源管理器命令中的System 命令,该命令具有ID org.eclipse.ui.ide.showInSystemExplorer。
https://stackoverflow.com/questions/62858208
复制相似问题