Math2mat
|
00001 00019 package m2m.frontend.actions; 00020 00021 import m2m.frontend.view.M2MConsole; 00022 00023 import org.eclipse.ui.IWorkbenchPage; 00024 import org.eclipse.ui.IWorkbenchWindow; 00025 import org.eclipse.ui.PlatformUI; 00026 00031 public class ClearConsoleAction extends M2MAction { 00032 00033 00034 public ClearConsoleAction(IWorkbenchWindow window, String label) { 00035 super(window,label); 00036 00037 // The id is used to refer to the action in a menu or toolbar 00038 setId(ICommandIds.CMD_CLEARCONSOLE); 00039 00040 // Associate the action with a pre-defined command, to allow key bindings. 00041 setActionDefinitionId(ICommandIds.CMD_CLEARCONSOLE); 00042 // setImageDescriptor(com.reds.m2mgui.Activator.getImageDescriptor("/icons/octave.gif")); 00043 } 00044 00045 public void run() { 00046 /* Clear the console */ 00047 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); 00048 if((M2MConsole)page.findView(M2MConsole.ID) != null) 00049 { 00050 ((M2MConsole)page.findView(M2MConsole.ID)).clearConsole(); 00051 } 00052 } 00053 00054 }