package openqicq.actions; import java.io.IOException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; /** * Our sample action implements workbench action delegate. The action proxy will * be created by the workbench and shown in the UI. When the user tries to use * the action, this delegate will be created and execution will be delegated to * it. * * @see IWorkbenchWindowActionDelegate */ public class OpenQicqAction implements IWorkbenchWindowActionDelegate { private IWorkbenchWindow window; /** * The constructor. */ public OpenQicqAction() { } /** * The action has been activated. The argument of the method represents the * 'real' action sitting in the workbench UI. * * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { String path = "D:\\Program Files (x86)\\Tencent\\QQ\\QQProtect\\Bin\\QQProtect.exe"; try { Runtime.getRuntime().exec(path); } catch (IOException e) { e.printStackTrace(); MessageDialog.openInformation(window.getShell(), "QQ.exe lost", "打开QQ失败,估计是路径不对!"); } } /** * Selection in the workbench has been changed. We can change the state of * the 'real' action here if we want, but this can only happen after the * delegate has been created. * * @see IWorkbenchWindowActionDelegate#selectionChanged */ public void selectionChanged(IAction action, ISelection selection) { } /** * We can use this method to dispose of any system resources we previously * allocated. * * @see IWorkbenchWindowActionDelegate#dispose */ public void dispose() { } /** * We will cache window object in order to be able to provide parent shell * for the message dialog. * * @see IWorkbenchWindowActionDelegate#init */ public void init(IWorkbenchWindow window) { this.window = window; } }
最近下载更多
最近浏览更多
Ashbell
2月25日
暂无贡献等级
阿超在大学修仙 LV1
2023年9月15日
lmml2307831267 LV2
2023年6月24日
li951753 LV2
2023年6月19日
秋月常 LV1
2023年4月11日
臧家旺 LV3
2023年3月23日
感冒灵颗粒
2023年3月17日
暂无贡献等级
2011502295 LV6
2022年12月27日
2694809556 LV2
2022年12月22日
lkuailinc xjkmndckmx LV1
2022年12月21日