📄 helloaction.java
字号:
package hellorcp;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
public class HelloAction extends Action {
private IWorkbenchWindow window;
public HelloAction(IWorkbenchWindow window) {
this.window = window;
this.setText("Hello");
this.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
.getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
}
public void run() {
MessageBox mb = new MessageBox(window.getShell(), SWT.OK);
mb.setMessage("Hello world!");
mb.setText("Demo");
mb.open();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -