【发布时间】:2015-09-27 20:31:43
【问题描述】:
我有一个基于 Eclipse 的 e3 应用程序,其中 Switch Workspace 无法正常工作。每当我这样做时,它都会切换到同一个工作区,而不是转到新的工作区。
在调用重新启动之前,他们将 eclipse.exitdata 的系统属性设置为 -data 工作区位置作为变量。但是重新启动后,系统变量会被清除。在他们正在调用的新工作区中
PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
它在内部从 InternalPlatform 类位置变量中获取位置。该 InternalPlatform 是一个 .class 文件,我无权编辑它。在 InternalPlatform 中,这是代码
public Location getInstanceLocation() {
assertInitialized();
return (Location) instanceLocation.getService();
}
/**
* @see Platform#getLocation()
*/
public IPath getLocation() throws IllegalStateException {
if (cachedInstanceLocation == null) {
Location location = getInstanceLocation();
if (location == null)
return null;
// This makes the assumption that the instance location is a file: URL
File file = new File(location.getURL().getFile());
cachedInstanceLocation = new Path(file.toString());
}
return cachedInstanceLocation;
}
在此Location location = getInstanceLocation(); 中获取工作区位置。我如何以及在哪里可以更改此变量?或者有没有其他方法可以为切换工作区传递变量?切换工作区在代码中是如何工作的?
【问题讨论】:
标签: java eclipse eclipse-rcp rcp restart