我们可以从单个 Main 类启动 Eclipse RCP 应用程序吗?

发布于 2024-12-26 09:38:11 字数 148 浏览 3 评论 0原文

我的问题是:我们可以通过包含 public static void main(String x[]){} 方法的自定义 Main.java 来启动 Eclipse RCP 应用程序来运行 RCP 应用程序吗?毫无疑问,RCP 应用程序可以使用默认配置在 Eclipse 中照常启动。

My question is : Can we start an Eclipse RCP application by a customized Main.java containing public static void main(String x[]){} method to run the RCP application ? There's no doubt the RCP application can be started as usual in Eclipse with default configurations.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻安 2025-01-02 09:38:11

我不确定您想做什么,但如果您想运行一些对话框/编辑器而不运行整个 RCP,您可以这样做。

例如,如果您想打开表单/编辑器/首选项页面:

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    new YourFormPageFromEditor().createFormContent(shell); // or some kind of code that insert here some UI

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();

}

您只需输入即可打开对话框

public static void main(String[] args) {    
  new YourDialogThatExtendsTitleAreaDialog(null).open()
}

希望它有帮助。

I'm not sure what you would like to do but if you want to run some dialogs/editors without running whole RCP you can just do it.

In example, if you want to open form/editor/preference page:

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    new YourFormPageFromEditor().createFormContent(shell); // or some kind of code that insert here some UI

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();

}

Dialogs you can open just by type

public static void main(String[] args) {    
  new YourDialogThatExtendsTitleAreaDialog(null).open()
}

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文