Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP application,product directory for files
RCP application,product directory for files [message #948899] Thu, 18 October 2012 09:49 Go to next message
Mat Mathiew is currently offline Mat Mathiew
Messages: 29
Registered: July 2012
Junior Member
Hi,

I want through my RCP application to create some folders and files which i will write
during the execution of the RCP application.
It seems that the best place is the product directory(where plugins,workspace etc are) to do that?
If yes is there a command to retrieve the directory?
Re: RCP application,product directory for files [message #954770 is a reply to message #948899] Tue, 23 October 2012 04:25 Go to previous message
Xiuang Lee is currently offline Xiuang Lee
Messages: 9
Registered: October 2012
Junior Member
I created directories inside my plugin project.

Than I used FileLocator to retrieve file in my part's contributor:
FileLocator.find(
    FrameworkUtil.getBundle(this.getClass()),
    new Path("icon/someimage.png"),
    null)


Don't forget to check folder with your files in build.properties "Binary build".

Here is full example of my code, displaying image in SWT canvas (maybe helps somehow):
Canvas canvas = new Canvas(composite, SWT.NO_REDRAW_RESIZE);
canvas.setBounds(0, 0, IMG_WIDTH, IMG_HEIGHT);
canvas.addPaintListener(new PaintListener() {
    public void paintControl(PaintEvent e) {
        e.gc.drawImage(
            ImageDescriptor
            .createFromURL(
                FileLocator.find(
                    FrameworkUtil.getBundle(this.getClass()),
                    new Path("icon/someimage.png"),
                    null)
             ).createImage(), 0, 0);
    }
});

[Updated on: Tue, 23 October 2012 04:33]

Report message to a moderator

Previous Topic:IPageLayout getViewLayout return null on e4
Next Topic:Hide Key Bindings from Preference Page
Goto Forum:
  


Current Time: Fri Aug 22 07:50:45 EDT 2014

Powered by FUDForum. Page generated in 0.15674 seconds