Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fetch path of a file from preference page and print the Output on console via Button on Workbench?
    text
    copied!<p>I have made one preference page whose programming 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); } </code></pre> <p>I want to get path of <code>FileFieldEditor f</code> and want this path to run on a button which is embedded on workbench (but programming of that button is in different project on the same workspace). The button programming which has hard coded path of "prism.bat" file is:</p> <pre><code>try { //to clear the console on every click of button IViewPart view = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IConsoleConstants.ID_CONSOLE_VIEW); if (view != null) { (myConsole).clearConsole(); } ProcessBuilder pb=new ProcessBuilder("C:\\Program Files\\prism-4.0\\bin\\prism.bat"); pb.directory(new File("C:\\Program Files\\prism-4.0\\bin")); 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("Process Successful"); out.println("Printing on console with Exitvalue =0"); } else {out.println("Process failed"); out.println("Exitvalue = 1"); } } catch (Exception e) { out.println(e.toString()); e.printStackTrace(); } </code></pre> <p>But I want to fetch file from my preference page <code>FileFieldEditor f</code> and want this path to embed in button programming so that when button is pressed, result is shown.</p>
 

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