Java 如何在没有工作区和其他Eclipse默认特性的情况下创建RCP项目?
如何在没有工作区和其他Eclipse默认特性的情况下创建RCP项目 每次我创建EclipseRCP项目时,它都在单独的工作区中运行,在左侧显示PackageExplorer,允许创建项目等等 是否可以创建像XMind这样的独立应用程序,它只打开某些类型的文件并包含某些类型的视图 更新 例如,Eclipse帮助中有一个Zest示例。它打算在Eclipse下运行,但包含以下主要内容:Java 如何在没有工作区和其他Eclipse默认特性的情况下创建RCP项目?,java,eclipse,eclipse-rcp,Java,Eclipse,Eclipse Rcp,如何在没有工作区和其他Eclipse默认特性的情况下创建RCP项目 每次我创建EclipseRCP项目时,它都在单独的工作区中运行,在左侧显示PackageExplorer,允许创建项目等等 是否可以创建像XMind这样的独立应用程序,它只打开某些类型的文件并包含某些类型的视图 更新 例如,Eclipse帮助中有一个Zest示例。它打算在Eclipse下运行,但包含以下主要内容: /*********************************************************
/*******************************************************************************
* 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代码,请执行
文件/New project
并选择插件项目。在向导的第二步中,取消选择此插件将对UI作出贡献
,并为选择是
,以确定是否要创建3.x富客户端应用程序
。向导的最后一步将有一个无头Hello RCP
,它为RCP创建绝对最小代码
如果您离开此插件将对用户界面做出贡献
检查了一些模板,以创建带有视图的RCP。如图所示
以上内容适用于Eclipse3.x风格的RCP,对于Eclipse4纯e4
RCP,请在新建项目向导中使用Eclipse4/Eclipse4应用程序项目 在运行配置中,您可以更改此行为,并仅选择运行插件所需的插件…您的意思是在运行配置的plugins
选项卡中?这是否意味着我可以在开发阶段使用所有eclipse功能自由运行我的应用程序,并且可以在以后的生产阶段禁用所有不需要的功能?你是如何创建RCP项目的?@SuzanCioc是的,如果zou出于调试目的需要,你可以从安装中获得所有eclipse插件。创建应用程序时,您将能够微调要包含的内容和不包含的内容。谢谢。但我不能达到最终的结果。在3.x的情况下,我可以创建headless应用程序,它在Eclipse调试器下运行headless,但不能使其独立。导出到runnable JAR不适用于Eclipse项目。关于Eclipse4,我根本无法制作headless应用程序