How to make simplistic RCP app standalone? [message #1222220] |
Thu, 19 December 2013 23:14 |
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 button. As a result, Eclipse creates nearly empty project with and files only.
Now I am creating an application. Application is an extension to org.eclipse.core.runtime.applications extension point, which is implemented inside plug-in. So I add this plug-in as a dependency:
This creates new node in , called :
Now I add new extension to this point in my plug-in:
I am giving an id to my application and assign a class to it.
This creates a file
[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 :
[code]source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml[/code]
Simultaneously becomes invalid, since it is now required to be singleton, which is set either automatically, or by check box from tab:
Note, that although my application id is , this name is not fully qualified. Fully qualified name appears from concatenation between plug-in id and this is. In my case it is .
Now I am going (back) to tab of manifest editor, and create class file for application by clicking hyperlink:
This invokes wizard and finally creates 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 method:
[code]System.out.println("Hello world from myproject");[/code]
Now after saving all I am able to run application from 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 file to org.eclipse.core.runtime.products extension point.
On the tab of product file editor, I press button, which invokes window:
I filled it with new product name, product id and also referred application, which fully qualified name I derived before.
Now my 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 tab of product file editor, and add my own plugin to it:
After that I need to press magic button
Now I am able to run my application from within 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 and put everything into it. It can be ran by running 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?
|
|
|
|
Powered by
FUDForum. Page generated in 0.02761 seconds