Math2mat
|
00001 00020 package m2m.frontend.actions; 00021 00022 import org.eclipse.jface.dialogs.MessageDialog; 00023 import org.eclipse.ui.IWorkbenchWindow; 00024 00025 import m2m.frontend.threads.OctaveThread; 00026 00027 public class LaunchOctaveAction extends M2MAction { 00028 00029 public LaunchOctaveAction(IWorkbenchWindow window, String label) { 00030 super(window,label); 00031 00032 setImageDescriptor(m2m.frontend.Activator.getImageDescriptor("/icons/octave.gif")); 00033 00034 // The id is used to refer to the action in a menu or toolbar 00035 setId(ICommandIds.CMD_OCTAVE); 00036 00037 // Associate the action with a pre-defined command, to allow key bindings. 00038 setActionDefinitionId(ICommandIds.CMD_OCTAVE); 00039 } 00040 00044 public void run() 00045 { 00046 if (!getEditor("Error","Select the tab with the m2m code")) 00047 return; 00048 00049 if (editor.getParseDone()) 00050 { 00051 activateConsole(); 00052 00053 00054 /* Launch the octaveThread */ 00055 OctaveThread octaveThread = new OctaveThread(editor, editor.getM2MProject().getStructTreatment().getMonitor()); 00056 octaveThread.start(); 00057 } 00058 else 00059 MessageDialog.openError(window.getShell(), "Parsing error", "Parse the file to get inputs and outputs before trying to launch Octave"); 00060 } 00061 }