Skip to main content


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 13:49 Go to next message
Mat Mathiew is currently offline Mat MathiewFriend
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 08:25 Go to previous message
Xiuang Lee is currently offline Xiuang LeeFriend
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 08: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 Apr 26 04:10:04 GMT 2024

Powered by FUDForum. Page generated in 0.03522 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top