Java tutorial
/* * Copyright (c) 2017 Andreas Signer <asigner@gmail.com> * * This file is part of programmablefun. * * programmablefun is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * programmablefun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with programmablefun. If not, see <http://www.gnu.org/licenses/>. */ package com.programmablefun.ide; import org.eclipse.jface.action.Action; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; public class BaseAction extends Action { private final Runnable handler; public BaseAction(String text, Image image, Runnable handler) { super(text, ImageDescriptor.createFromImage((image))); this.handler = handler; } public BaseAction(String text, Runnable handler) { super(text); this.handler = handler; } @Override public void run() { handler.run(); } }