Skip to content
Snippets Groups Projects
Commit 19fcbcb7 authored by David Trachtenherz's avatar David Trachtenherz
Browse files

refs 451
parent d257bc4e
No related branches found
No related tags found
No related merge requests found
/*--------------------------------------------------------------------------+
$Id: EasyStartMenuBase.java 1907 2011-11-11 14:04:26Z hoelzl $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.extension.base;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
/**
* Base class for menu actions.
*
* @author trachtenherz
* @author $Author: hoelzl $
* @version $Rev: 1907 $
* @ConQAT.Rating YELLOW Hash: CD9CF8D6200B156E8C0EE759A512A76E
*/
// TODO @review: this class looks very similar to EObjectActionBase; why do we
// need it?
// TODO @review: what is <T>; document generic parameters in class comment.
public abstract class MenuActionBase<T> extends Action {
/** Factory for the action instances used for this menu */
// TODO @review: why this interface? Why not
// org.eclipse.ui.actions.ActionFactory?
public static interface ActionFactory<T> {
/** Creates and returns an action instance for the given target. */
MenuActionBase<T> createAction(T target);
}
/** The target to be processed. */
protected final T target;
// TODO @review: why these methods? there are constructors.
/** Name of the action. */
protected abstract String getActionName();
/** Icon for the action. */
protected ImageDescriptor getActionIcon() {
return null;
}
/** Constructor. */
public MenuActionBase(T target) {
setText(getActionName());
setImageDescriptor(getActionIcon());
this.target = target;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment