java - 如何在没有工作区和其他 Eclipse 默认功能的情况下创建 RCP 项目?

标签 java eclipse eclipse-rcp

如何在没有工作区和其他 Eclipse 默认功能的情况下创建 RCP 项目?

每次我创建 Eclipse RCP 项目时,它都会在单独的工作区中运行,在左侧显示 Package Explorer,允许创建项目等等。

是否可以创建像 XMind 这样的独立应用程序,它只打开某些类型的文件并包含某些类型的 View ?

更新

例如,Eclipse 帮助中有一个 Zest 示例。它旨在在 Eclipse 下运行,但包含 main:

/*******************************************************************************
  * Copyright 2005-2007, CHISEL Group, University of Victoria, Victoria, BC,
  * Canada. All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  * 
  * Contributors: The Chisel Group, University of Victoria
  ******************************************************************************/
 package org.eclipse.zest.examples.swt;

 import org.eclipse.zest.core.widgets.Graph;
 import org.eclipse.zest.core.widgets.GraphConnection;
 import org.eclipse.zest.core.widgets.GraphNode;
 import org.eclipse.zest.layouts.LayoutStyles;
 import org.eclipse.zest.layouts.algorithms.SpringLayoutAlgorithm;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;

 /**
  * This snippet creates a very simple graph where Rock is connected to Paper
  * which is connected to scissors which is connected to rock.
  * 
  * The nodes a layed out using a SpringLayout Algorithm, and they can be moved
  * around.
  * 
  * 
  * @author Ian Bull
  * 
  */
 public class GraphSnippet1 {
    /**
     * @param args
     */
    public static void main(String[] args) {
        // Create the shell
        Display d = new Display();
        Shell shell = new Shell(d);
        shell.setText("GraphSnippet1");
        shell.setLayout(new FillLayout());
        shell.setSize(400, 400);

        Graph g = new Graph(shell, SWT.NONE);
        GraphNode n = new GraphNode(g, SWT.NONE, "Paper");
        GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock");
        GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors");
        new GraphConnection(g, SWT.NONE, n, n2);
        new GraphConnection(g, SWT.NONE, n2, n3);
        new GraphConnection(g, SWT.NONE, n3, n);
        g.setLayoutAlgorithm(new SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);

        shell.open();
        while (!shell.isDisposed()) {
            while (!d.readAndDispatch()) {
                d.sleep();
            }
        }
    }
 }

如何编译这个?如果我只是将它放入java项目中,它没有大量的Eclipse库。但是如果我创建插件项目,我看不到插入 main 方法的地方。

最佳答案

要获得绝对最小的 RCP 代码,请执行文件/新建项目并选择插件项目。在向导的第二步中,取消选择此插件将对 UI 做出贡献,并为您想创建 3.x 富客户端选择应用程序。向导的最后一步将有一个 Headless Hello RCP,它为 RCP 创建绝对最少的代码。

如果您离开此插件将为 UI 做出贡献,请检查一些用于创建带有 View 等的 RCP 的模板。

以上内容适用于 Eclipse 3.x 风格的 RCP,对于 Eclipse 4 纯 e4 RCP,请在新建项目向导中使用 Eclipse 4/Eclipse 4 应用程序项目

关于java - 如何在没有工作区和其他 Eclipse 默认功能的情况下创建 RCP 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19212633/

相关文章:

java - 如何在 Spring 为 ScheduledTimerTask 设置服务器时间?

java - 如何停止 JBoss EAP 6.0.1

Java jasper 报 NullPointerException

java - 如何从 servlet 请求新的或更改的坐标?

JavaFX:如何显示表情符号?

java - 将自定义工具控件添加到工具栏 E4

Eclipse 文件模板插件不使用我的模板文件

eclipse - 如何在 Talend Open Studio 中添加 Maven 依赖项

eclipse-rcp - 带有对象参数的 RCP 命令

java - 将自定义 menuManager 移动到现有 RCP 应用程序菜单的末尾