Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » File Locations in RCP
File Locations in RCP [message #453096] Fri, 21 July 2006 12:33 Go to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.Friend
Messages: 218
Registered: July 2009
Senior Member
I continue to struggle with how to locate a file within an RCP. I am easily
able to get a handle to the .metadata location, but I am sure this is the
wrong place to put a file.

The scenario is that I have a text file that contains rules for a decision
support system, and an RCP that uses this file. The end user will need to
be able to edit this file. I can successfully make this file show up in the
RCP when I export the product, using the feature facility and including the
file in root=. But I cannot figure out how to programatically locate this
file.

Any assistance is appreciated.

- Mike
Re: File Locations in RCP [message #453100 is a reply to message #453096] Fri, 21 July 2006 12:38 Go to previous messageGo to next message
Ilya Shinkarenko is currently offline Ilya ShinkarenkoFriend
Messages: 56
Registered: July 2009
Member
Hello,

IPath myPath = Platform.getLocation().append("myFolder/myFile.txt");




Ilya Shinkarenko
--
www.imedic.de
www.rcp-training.com



J Michael Dean wrote:
> I continue to struggle with how to locate a file within an RCP. I am easily
> able to get a handle to the .metadata location, but I am sure this is the
> wrong place to put a file.
>
> The scenario is that I have a text file that contains rules for a decision
> support system, and an RCP that uses this file. The end user will need to
> be able to edit this file. I can successfully make this file show up in the
> RCP when I export the product, using the feature facility and including the
> file in root=. But I cannot figure out how to programatically locate this
> file.
>
> Any assistance is appreciated.
>
> - Mike
>
Re: File Locations in RCP [message #453341 is a reply to message #453096] Wed, 26 July 2006 21:50 Go to previous message
Eclipse UserFriend
Originally posted by: baldin.gmail.com

try like this

import com.jvs.selene.rcp.Activator;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.swt.graphics.Image;
import java.net.URL;

public final class PluginResources {
public static Image getImage(String path) {
Image img;
try {
URL fileUrl =
FileLocator.toFileURL(Activator.getDefault().getBundle().get Entry(path));
img = new Image(null, fileUrl.getFile());
}catch (Exception e) {
img = null;
}
return img;
}
}


// Using PluginResources
final ImageRegistry images = new ImageRegistry();
images.put("server", PluginResources.getImage("icons/new_con.png"));



"J Michael Dean" <mdean77@comcast.net> escreveu na mensagem
news:C0E625BF.1544B%mdean77@comcast.net...
>I continue to struggle with how to locate a file within an RCP. I am
>easily
> able to get a handle to the .metadata location, but I am sure this is the
> wrong place to put a file.
>
> The scenario is that I have a text file that contains rules for a decision
> support system, and an RCP that uses this file. The end user will need to
> be able to edit this file. I can successfully make this file show up in
> the
> RCP when I export the product, using the feature facility and including
> the
> file in root=. But I cannot figure out how to programatically locate this
> file.
>
> Any assistance is appreciated.
>
> - Mike
>
Previous Topic:SchedulerTask
Next Topic:Using workspace in RCP Application
Goto Forum:
  


Current Time: Tue Oct 15 16:04:20 GMT 2024

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

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

Back to the top