2013-10-06 13 views
0

如何在沒有工作空間和其他Eclipse默認功能的情況下創建RCP項目?如何在沒有工作空間和其他Eclipse默認功能的情況下創建RCP項目?

每次創建Eclipse RCP項目時,它都會在單獨的工作區中運行,在左側顯示Package Explorer,允許創建項目等。

是否有可能創建獨立的應用程序,如XMind,它只是打開某些類型的文件幷包含某些類型的視圖?

UPDATE

例如,有一個激爽樣品只是在Eclipse的幫助。它旨在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庫。但是,如果我創建插件項目,我看不到插入主要方法的地方。

+0

在運行配置中,您可以更改此行爲,並只選擇運行插件所需的插件... – ppeterka

+0

您的意思是在運行配置的「插件」選項卡中?這是否意味着我可以在開發階段自由運行我的應用程序,並且能夠在生產階段之後禁用所有不需要的功能? –

+0

你是如何創建RCP項目的? –

回答

1

要獲得絕對最小的RCP代碼,請執行File/New Project並選擇Plug-in Project。在嚮導的第二步取消選擇This plug-in will make contributions to the UI並選擇Yes代替Would you like to create a 3.x rich client application。嚮導的最後一步將有一個Headless Hello RCP,它爲RCP創建絕對最小代碼。

如果您離開This plug-in will make contributions to the UI選中某些模板以創建包含視圖的RCP等等。

以上是適用於Eclipse 3.x樣式的RCP,適用於Eclipse 4純e4 RCP在新建項目嚮導中使用Eclipse 4/Eclipse 4 Application Project

+0

謝謝。但我無法取得最終結果。在3.x的情況下,我可以創建無頭應用程序,它在Eclipse調試器下運行無頭,但無法使其獨立。導出到可運行JAR不適用於Eclipse項目。關於Eclipse 4,我根本無法做出無頭應用。 –

+0

您必須使用導出產品導出Eclipse RCP,請參閱http://wiki.eclipse.org/FAQ_How_do_I_create_an_Eclipse_product%3F –

相關問題