【问题标题】:Error while launching multiple instance of an e4 application in linux system of an exe在 exe 的 linux 系统中启动 e4 应用程序的多个实例时出错
【发布时间】:2014-10-14 05:14:57
【问题描述】:

我正在使用 -data @ none 创建一个 e4 rcp 应用程序的多个实例。通过使用这个在 Windows 7 中成功创建了多个实例,但是当我在终端中通过 ./applicationname 在 linux 中运行应用程序时,它会抛出一个错误,因为关联的工作空间已经在使用中。那么我们如何在linux中创建多个实例呢?请帮助解决此问题。

【问题讨论】:

  • org.eclipse.e4.ui.workbench.swt.E4Application 应用程序确实需要一个工作区位置,所以我认为您的 Windows 代码可能没有按照您的想法运行。 Platform.getInstanceLocation() 在 Windows 上为您提供什么?
  • 它给出了 exe 的定位和执行路径。即使我需要像在 windows 中为 linux 系统创建多个实例
  • 如果指定了-data @none,则位置应为空。
  • Platform.getInstanceLocation() 在 Windows PC 中给出 null,当我在启动参数中指定 -data @none 时

标签: linux swt rcp multiple-instances e4


【解决方案1】:

E4Application 确实需要工作区位置。您可以在 LifeCycle @PostContextCreate 方法中设置一个:

@PostContextCreate
public void postContextCreate()
{
  Location instanceLoc = Platform.getInstanceLocation();

  // -data @none specified?

  if (instanceLoc == null)
    return;

  // OK if location is set

  if (instanceLoc.isSet())
    return;

  // TODO construct a workspace location

  instanceLoc.set(url of location, false);
}

【讨论】:

  • 但是在这种情况下我们如何动态更改位置的url来设置实例位置
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-05-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-27
相关资源
最近更新 更多