|
|
Re: File Locations in RCP [message #453341 is a reply to message #453096] |
Wed, 26 July 2006 21:50 |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.04124 seconds