blob: e73a2ac723e516a41585467ec691232411d55fb4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/****************************************************************************
* Copyright (c) 2018 Remain Software
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wim Jongman <wim.jongman@remainsoftware.com> - initial API and implementation
*****************************************************************************/
package org.eclipse.tips.core;
/**
* Provides an action to be executed by a Tip.
*
*/
public class TipAction {
private final String fText;
private final TipImage fTipImage;
private final Runnable fRunner;
private final String fTooltip;
/**
* Creates a new TipAction. Tip actions can be executed in the tip UI when the
* associated Tip is displayed.
*
* @param text
* a very short description to be used on buttons and menus.
* @param tooltip
* a longer description to be shown as tool tip when possible.
* @param runner
* the actual code to run
* @param image
* the image to be shown when possible.
*
*/
public TipAction(String text, String tooltip, Runnable runner, TipImage image) {
fText = text;
fTooltip = tooltip;
fRunner = runner;
fTipImage = image;
}
/**
* The short description of the action to be shown as button text or menu entry
* when possible.
*
* @return the text
*/
public String getText() {
return fText;
}
/**
* A longer description to be shown as tool tip when possible.
*
* @return the tool tip.
*/
public String getTooltip() {
return fTooltip;
}
/**
* The icon of the image wrapped in a TipImage.
*
* @return the icon
*/
public TipImage getTipImage() {
return fTipImage;
}
/**
* The actual code to run when this action is executed.
*
* @return the runner.
*/
public Runnable getRunner() {
return fRunner;
}
}
|