📄 playhandler.java
字号:
package com.siemens.ct.mp3m.ui.player.handlers;import java.io.FileNotFoundException;import org.eclipse.core.commands.AbstractHandler;import org.eclipse.core.commands.ExecutionEvent;import org.eclipse.core.commands.ExecutionException;import org.eclipse.jface.viewers.StructuredSelection;import org.eclipse.ui.handlers.HandlerUtil;import com.siemens.ct.mp3m.model.physical.Mp3File;import com.siemens.ct.mp3m.ui.player.Mp3Player;/** * A handler to play mp3 files. * * @see org.eclipse.core.commands.IHandler * @see org.eclipse.core.commands.AbstractHandler */public class PlayHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { StructuredSelection structuredSelection = (StructuredSelection) HandlerUtil .getCurrentSelection(event); if (structuredSelection.getFirstElement() instanceof Mp3File) { Mp3File file = (Mp3File) structuredSelection.getFirstElement(); try { Mp3Player.getInstance().play(file.getFullPath()); } catch (FileNotFoundException e) { e.printStackTrace(); } } return null; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -