Go to the documentation of this file.00001 package com.generalrobotix.ui.actions;
00002
00003 import org.eclipse.jface.action.IAction;
00004 import org.eclipse.jface.viewers.ISelection;
00005 import org.eclipse.ui.IWorkbench;
00006 import org.eclipse.ui.IWorkbenchPage;
00007 import org.eclipse.ui.IWorkbenchWindow;
00008 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
00009 import org.eclipse.ui.PartInitException;
00010 import org.eclipse.ui.PlatformUI;
00011
00012 import com.generalrobotix.ui.GrxPluginManager;
00013 import com.generalrobotix.ui.grxui.Activator;
00014 import com.generalrobotix.ui.view.GrxRobotHardwareClientView;
00015
00016 public class ServoOnOff implements IWorkbenchWindowActionDelegate {
00017 public ServoOnOff() {}
00018
00019 public void run(IAction action) {
00020 GrxPluginManager manager_ = Activator.getDefault().manager_;
00021 GrxRobotHardwareClientView rhView = (GrxRobotHardwareClientView)manager_.getView( GrxRobotHardwareClientView.class, true );
00022 if(rhView==null){
00023 IWorkbench workbench = PlatformUI.getWorkbench();
00024 IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
00025 IWorkbenchPage page = window.getActivePage();
00026 try {
00027 page.showView("com.generalrobotix.ui.view.GrxRobotHardwareClientViewPart", null, IWorkbenchPage.VIEW_CREATE);
00028 } catch (PartInitException e1) {
00029 e1.printStackTrace();
00030 }
00031 rhView = (GrxRobotHardwareClientView)manager_.getView( GrxRobotHardwareClientView.class, true );
00032 }
00033
00034
00035 }
00036
00037 public void selectionChanged(IAction action, ISelection selection) {}
00038 public void dispose() {}
00039 public void init(IWorkbenchWindow window) {}
00040 }