Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to make simplistic RCP app standalone?
How to make simplistic RCP app standalone? [message #1222220] Thu, 19 December 2013 18:14 Go to next message
Suzan Cioc is currently offline Suzan Cioc
Messages: 2
Registered: December 2013
Junior Member
I want to create very simple RCP application, but which is standalone. Below the steps I accomplish. Final application should print "Hello world", but doesn't.


Creating Simplistic RCP Application

I create new plugin project. At this moment all wizard features were disabled and I press
Finish
button. As a result, Eclipse creates nearly empty project with
MANIFEST.MF
and
build.properties
files only.

Now I am creating an application. Application is an extension to
org.eclipse.core.runtime.applications
extension point, which is implemented inside
org.eclipse.core.runtime
plug-in. So I add this plug-in as a dependency:

This creates new node in
Package Explorer
, called
Plug-in Dependencies
:

Now I add new extension to this point in my plug-in:

I am giving an id
myappid
to my application and assign a class
myproject.Application
to it.

This creates a file
plugin.xml


[code]<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="myappid"
         point="org.eclipse.core.runtime.applications">
      <application
            cardinality="singleton-global"
            thread="main"
            visible="true">
         <run
               class="myproject.Application">
         </run>
      </application>
   </extension>

</plugin>[/code]


which contains all this information. Also this file is referred from
build.properties
:

[code]source.. = src/
output.. = bin/
bin.includes = META-INF/,\
               .,\
               plugin.xml[/code]


Simultaneously
MANIFEST.MF
becomes invalid, since it is now required to be singleton, which is set either automatically, or by check box from
Overview
tab:

Note, that although my application id is
myappid
, this name is not fully qualified. Fully qualified name appears from concatenation between plug-in id and this is. In my case it is
myproject.myappid
.

Now I am going (back) to
Extensions
tab of manifest editor, and create class file for application by clicking
class
hyperlink:

This invokes
New Java class
wizard and finally creates
java
file and opens it in the editor:

[code]package myproject;

import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;

public class Application implements IApplication {

    @Override
    public Object start(IApplicationContext context) throws Exception {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public void stop() {
        // TODO Auto-generated method stub

    }

}[/code]


I am adding only one line here, inside
start
method:

[code]System.out.println("Hello world from myproject");[/code]


Now after saving all I am able to run application from
Overview
tab of manifest editor. Program works and prints what is expected:

Quote:

Hello world from myproject



Printing occurs in Eclipse Console View.

Creating Product Configuration

Now I am creating a product configuration, which is required for export wizard can work.

Creating and setting product file simultaneously adds extension to
plugin.xml
file to
org.eclipse.core.runtime.products
extension point.

On the
Overview
tab of product file editor, I press
New
button, which invokes
New Product Definition
window:

I filled it with new product name, product id and also referred application, which fully qualified name I derived before.

Now my
plugin.xml
file lokks like follows:

[code]<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
   <extension
         id="myappid"
         point="org.eclipse.core.runtime.applications">
      <application
            cardinality="singleton-global"
            thread="main"
            visible="true">
         <run
               class="myproject.Application">
         </run>
      </application>
   </extension>
   <extension
         id="myproductid"
         point="org.eclipse.core.runtime.products">
      <product
            application="myproject.myappid"
            name="MyProduct">
      </product>
   </extension>

</plugin>[/code]


You see that our product is represented there.

Now I need to do a trick which I was not able to find for a long time.

Despite the fact that product file refers to application and plugin correctly, it is not included into product content automatically. I regard this as Eclipse bug.

So, I go to
Dependencies
tab of product file editor, and add my own plugin to it:

After that I need to press magic button
Add Required Plug-ins


Now I am able to run my application from within
Overview
panel of product file editor and it works as expected (printing text inside console view).

Exporting Product

Only now I am able to utilize export wizard

This will create directory
D:\myproject
and put everything into it. It can be ran by running
eclipse.exe
inside

Unfortunately, it does nothing, although, cause no exceptions.

Questions

1) Why my exported program does nothing? Is it expects eclipse console or something? Or it just doesn't work?

2) How to make the program to print? My be it is possible to provide GUI console like in Eclipse? May be it is possible to force it to print to real operating system console?
Re: How to make simplistic RCP app standalone? [message #1224846 is a reply to message #1222220] Fri, 27 December 2013 18:51 Go to previous message
Craig Foote is currently offline Craig Foote
Messages: 195
Registered: July 2009
Senior Member
If you have a MyProduct.ini file in the export folder, edit it in a plain text editor and add these new lines just before the "-vmargs" line:
-consoleLog
-console

Running now should open and write to a console window.

[Updated on: Sat, 28 December 2013 10:29]

Report message to a moderator

Previous Topic:How to file a RFC for RCP?
Next Topic:Command alternative for editorActions, RulerToggleBreakpointActionDelegate
Goto Forum:
  


Current Time: Tue Sep 02 05:25:29 EDT 2014

Powered by FUDForum. Page generated in 0.01693 seconds