2 Replies Latest reply: Nov 12, 2009 4:04 PM by DrClap RSS

    How to use a browser url to open a htm file relative to java project folder

      Hi all!
      I have written the following code to make a help for my editor
      package editor;
      import org.eclipse.jface.action.Action;
      import org.eclipse.ui.PlatformUI;
      import org.eclipse.swt.SWT;
      import org.eclipse.swt.browser.*;
      import org.eclipse.swt.layout.FillLayout;
      import org.eclipse.swt.layout.GridLayout;
      import org.eclipse.swt.widgets.Display;
      import org.eclipse.swt.widgets.Shell;
      public class HelpAction extends Action  {
            * Constructor for Action1.
           public HelpAction() {
          public static final String ID = "helpAction";
          public static final String LABEL = "Help";
          public void run() {
               Display dip = PlatformUI.createDisplay();
               Shell shell = new Shell(dip);
               shell.setLayout(new FillLayout());
               Browser browser = new  Browser(shell, SWT.NULL);
               browser.setSize(800, 600);
               while (!shell.isDisposed ()){
                    if (dip.readAndDispatch()) dip.sleep();
      in the
      java (on eclipse) does not open the desired file on the browser..
      I need it to be relative to my project folder(not my computer file system path) so that if I import the project onto a different computer it will open it relative to the project path(URL)

      Any ideas how can i fix it??
      Thanks in advance!