Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I fetch a path from a preference page and use it in a process started by a button?
    primarykey
    data
    text
    <p>I have made a preference page whose program code is --</p> <pre><code>public class SAML extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { public SAML() { super(GRID); setPreferenceStore(RmpPlugin.getDefault().getPreferenceStore()); setDescription("Browse Appropriate files"); } public FileFieldEditor f; public FileFieldEditor f1; public void createFieldEditors() { f = new FileFieldEditor(PreferenceConstants.P_PATH, "&amp;Prism.bat File:", getFieldEditorParent()); addField(f); f1 = new FileFieldEditor(PreferenceConstants.P_PATH1, "&amp;NuSMV Application File:", getFieldEditorParent()); addField(f1); } public void init(IWorkbench workbench) { } } </code></pre> <p>In this preference page, there are two <strong>FileFieldEditor</strong> which is use to select "prism.bat" and "NuSMV.exe" file.</p> <p>I have accessed path in my another button programming whose code is ---</p> <pre><code>try { IPreferenceStore store = plugin.getPreferenceStore(); ProcessBuilder pb=new ProcessBuilder(store.getString(PreferenceConstants.P_PATH)); pb.directory(new File(store.getString(PreferenceConstants.P_PATH))); Process p=pb.start(); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); String in; while((in = input.readLine()) != null) { out.println(in); } int exitVal=p.waitFor(); if(exitVal==0) { out.println("Printing on console"); } else out.println("Process failed"); } catch (Exception e) { out.println(e.toString()); e.printStackTrace(); } </code></pre> <p>Whenever I am clicking the button after selecting Prism.bat file from preference page, it says that file not found.</p> <p>What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload