Commit 7c84a6d8 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Hand cursor showing on hovering of editpart's figure.

refs 2646
parent 60b1c19e
......@@ -36,7 +36,9 @@ import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.SnapToHelper;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.editpart.figure.TransparentLabel;
......@@ -59,15 +61,19 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 5823EF473EB92F258B289FCBFB348A73
* @ConQAT.Rating YELLOW Hash: 9B37C81B6D5E2B0B8BF025432FAEEF7E
*/
public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INamedCommentedElement>
extends PositionedEditPartBase<T> {
/** The global hand cursor resource. */
private static Cursor HAND_CURSOR = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
/** The default font for titles. */
public static Font DEFAULT_TITLE_FONT = FontUtils.derive(JFaceResources.getDefaultFont(), 0,
SWT.BOLD);
/** The cursor set before entering this edit part's figure. */
private Cursor cursor;
/** Constructor. */
protected ElementEditPartBase(T modelObject) {
super(modelObject);
......@@ -169,4 +175,28 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam
}
return super.getAdapter(adapter);
}
/** {@inheritDoc} */
@Override
public void showTargetFeedback(Request request) {
super.showTargetFeedback(request);
if(getFigure() != null) {
cursor = getFigure().getCursor();
getFigure().setCursor(HAND_CURSOR);
}
}
/** {@inheritDoc} */
@Override
public void eraseTargetFeedback(Request request) {
if(getFigure() != null) {
getFigure().setCursor(cursor);
}
super.eraseTargetFeedback(request);
}
/** Determines whether the hand cursor should be displayed on hovering the edit part's figure. */
protected boolean showHandCursorOnHover() {
return true;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment