Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 266123 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/ScreenshotCreationPage.java (-8 / +74 lines)
Lines 71-77 Link Here
71
 */
71
 */
72
public class ScreenshotCreationPage extends WizardPage implements IImageCreator {
72
public class ScreenshotCreationPage extends WizardPage implements IImageCreator {
73
73
74
	private IAction captureAction;
74
	private SelectCaptureAction captureAction;
75
75
76
	private IAction fitAction;
76
	private IAction fitAction;
77
77
Lines 79-84 Link Here
79
79
80
	private IAction markAction;
80
	private IAction markAction;
81
81
82
	private SelectDrawToolAction toolAction;
83
82
	private IAction colorAction;
84
	private IAction colorAction;
83
85
84
	private Image colorIcon;
86
	private Image colorIcon;
Lines 99-104 Link Here
99
	 */
101
	 */
100
	private Image workImage;
102
	private Image workImage;
101
103
104
	private Image previousImage;
105
102
	/**
106
	/**
103
	 * Used to draw into {@link #workImage}
107
	 * Used to draw into {@link #workImage}
104
	 */
108
	 */
Lines 155-160 Link Here
155
	 */
159
	 */
156
	private EditorAction currentAction = EditorAction.CROPPING;
160
	private EditorAction currentAction = EditorAction.CROPPING;
157
161
162
	private boolean isFirstCapture = true;
163
158
	public ScreenshotCreationPage() {
164
	public ScreenshotCreationPage() {
159
		super("ScreenShotAttachment"); //$NON-NLS-1$
165
		super("ScreenShotAttachment"); //$NON-NLS-1$
160
		setTitle(Messages.ScreenshotCreationPage_CAPTURE_SCRRENSHOT);
166
		setTitle(Messages.ScreenshotCreationPage_CAPTURE_SCRRENSHOT);
Lines 173-185 Link Here
173
179
174
		// TODO: need disabled versions of all toolbar icons
180
		// TODO: need disabled versions of all toolbar icons
175
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT);
181
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT);
176
		captureAction = new Action(Messages.ScreenshotCreationPage_Capture_Desktop_C, IAction.AS_PUSH_BUTTON) {
177
182
178
			private boolean isFirstCapture = true;
183
		captureAction = new SelectCaptureAction(getShell(), Messages.ScreenshotCreationPage_Capture_Desktop_C) {
179
184
180
			@Override
185
			@Override
181
			public void run() {
186
			public void run() {
182
				captureScreenshotContent();
187
				if (captureAction.getKind() == SelectCaptureAction.Selection.CAPTURE) {
188
					captureScreenshotContent();
189
				} else {
190
					captureScreenshotContent(captureAction.getScreenshotImage());
191
				}
192
				captureAction.resetKind();
183
				setErrorMessage(null);
193
				setErrorMessage(null);
184
				if (isFirstCapture) {
194
				if (isFirstCapture) {
185
					isFirstCapture = false;
195
					isFirstCapture = false;
Lines 246-251 Link Here
246
				currentAction = EditorAction.CROPPING;
256
				currentAction = EditorAction.CROPPING;
247
				cropAction.setChecked(true);
257
				cropAction.setChecked(true);
248
				markAction.setChecked(false);
258
				markAction.setChecked(false);
259
				toolAction.setEnabled(false);
249
				colorAction.setEnabled(false);
260
				colorAction.setEnabled(false);
250
				canvas.redraw();
261
				canvas.redraw();
251
			}
262
			}
Lines 260-265 Link Here
260
				currentAction = EditorAction.MARKING;
271
				currentAction = EditorAction.MARKING;
261
				cropAction.setChecked(false);
272
				cropAction.setChecked(false);
262
				markAction.setChecked(true);
273
				markAction.setChecked(true);
274
				toolAction.setEnabled(true);
263
				colorAction.setEnabled(true);
275
				colorAction.setEnabled(true);
264
				canvas.redraw();
276
				canvas.redraw();
265
			}
277
			}
Lines 269-274 Link Here
269
//		markAction.setDisabledImageDescriptor(ImageDescriptor.createFromFile(getClass(), "mark_disabled.gif"));
281
//		markAction.setDisabledImageDescriptor(ImageDescriptor.createFromFile(getClass(), "mark_disabled.gif"));
270
		markAction.setEnabled(false);
282
		markAction.setEnabled(false);
271
283
284
		toolAction = new SelectDrawToolAction();
285
		toolAction.setEnabled(false);
286
272
		colorAction = new Action("", IAction.AS_DROP_DOWN_MENU) { //$NON-NLS-1$
287
		colorAction = new Action("", IAction.AS_DROP_DOWN_MENU) { //$NON-NLS-1$
273
			@Override
288
			@Override
274
			public void runWithEvent(final Event e) {
289
			public void runWithEvent(final Event e) {
Lines 316-321 Link Here
316
		tbm.add(new Separator());
331
		tbm.add(new Separator());
317
		tbm.add(createAndConfigureCI(cropAction));
332
		tbm.add(createAndConfigureCI(cropAction));
318
		tbm.add(createAndConfigureCI(markAction));
333
		tbm.add(createAndConfigureCI(markAction));
334
		tbm.add(createAndConfigureCI(toolAction));
319
		tbm.add(createAndConfigureCI(colorAction));
335
		tbm.add(createAndConfigureCI(colorAction));
320
		tbm.add(new Separator());
336
		tbm.add(new Separator());
321
		tbm.add(createAndConfigureCI(clearAction));
337
		tbm.add(createAndConfigureCI(clearAction));
Lines 455-460 Link Here
455
		return isPageComplete();
471
		return isPageComplete();
456
	}
472
	}
457
473
474
	private void captureScreenshotContent(Image image) {
475
		final Display display = getShell().getDisplay();
476
		disposeImageResources();
477
		originalImage = image;
478
		Rectangle displayBounds = originalImage.getBounds();
479
		workImage = new Image(display, displayBounds.width, displayBounds.height);
480
		GC gc = new GC(workImage);
481
		gc.drawImage(originalImage, 0, 0);
482
		gc.dispose();
483
484
		workImageGC = new GC(workImage);
485
		workImageGC.setForeground(markColor);
486
		workImageGC.setLineWidth(4);
487
		workImageGC.setLineCap(SWT.CAP_ROUND);
488
489
		scrolledComposite.setEnabled(true);
490
		clearSelection();
491
		refreshCanvasSize();
492
493
		setPageComplete(true);
494
	}
495
458
	private void captureScreenshotContent() {
496
	private void captureScreenshotContent() {
459
		final Display display = getShell().getDisplay();
497
		final Display display = getShell().getDisplay();
460
		final Shell wizardShell = getWizard().getContainer().getShell();
498
		final Shell wizardShell = getWizard().getContainer().getShell();
Lines 701-706 Link Here
701
				} else if (currentAction == EditorAction.MARKING) {
739
				} else if (currentAction == EditorAction.MARKING) {
702
					startPoint = null;
740
					startPoint = null;
703
					setImageDirty(true);
741
					setImageDirty(true);
742
743
					if (toolAction.getKind() != SelectDrawToolAction.DrawKind.FREE) {
744
						previousImage.dispose();
745
						previousImage = null;
746
					}
704
				}
747
				}
705
			}
748
			}
706
749
Lines 713-718 Link Here
713
				int scaledY = (int) (e.y / scaleFactor);
756
				int scaledY = (int) (e.y / scaleFactor);
714
757
715
				if (currentAction == EditorAction.MARKING) {
758
				if (currentAction == EditorAction.MARKING) {
759
					if (toolAction.getKind() != SelectDrawToolAction.DrawKind.FREE) {
760
						Display display = getShell().getDisplay();
761
						previousImage = new Image(display, workImage.getBounds());
762
						GC gc = new GC(previousImage);
763
						gc.drawImage(workImage, 0, 0);
764
						gc.dispose();
765
					}
766
716
					startPoint = new Point(scaledX, scaledY);
767
					startPoint = new Point(scaledX, scaledY);
717
					drawMarkLine(scaledX, scaledY);
768
					drawMarkLine(scaledX, scaledY);
718
					canvas.setCursor(cursors.get(CURSOR_MARK_TOOL));
769
					canvas.setCursor(cursors.get(CURSOR_MARK_TOOL));
Lines 850-863 Link Here
850
	}
901
	}
851
902
852
	/**
903
	/**
853
	 * Connects the previous mark point to the new reference point, by drawing a new line
904
	 * Connects the previous mark point to the new reference point, by drawing a new line, rectangle or oval
854
	 */
905
	 */
855
	private void drawMarkLine(int x, int y) {
906
	private void drawMarkLine(int x, int y) {
856
		if (startPoint != null) {
907
		if (startPoint != null) {
857
			clearAction.setEnabled(true);
908
			clearAction.setEnabled(true);
858
			workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
909
			if (toolAction.getKind() == SelectDrawToolAction.DrawKind.FREE) {
859
			startPoint.x = x;
910
				workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
860
			startPoint.y = y;
911
				startPoint.x = x;
912
				startPoint.y = y;
913
			} else {
914
				workImageGC.drawImage(previousImage, 0, 0);
915
				if (startPoint.x == x && startPoint.y == y) {
916
					workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
917
				} else {
918
					if (toolAction.getKind() == SelectDrawToolAction.DrawKind.LINE) {
919
						workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
920
					} else if (toolAction.getKind() == SelectDrawToolAction.DrawKind.BOX) {
921
						workImageGC.drawRectangle(startPoint.x, startPoint.y, x - startPoint.x, y - startPoint.y);
922
					} else if (toolAction.getKind() == SelectDrawToolAction.DrawKind.OVAL) {
923
						workImageGC.drawOval(startPoint.x, startPoint.y, x - startPoint.x, y - startPoint.y);
924
					}
925
				}
926
			}
861
			canvas.redraw();
927
			canvas.redraw();
862
		}
928
		}
863
	}
929
	}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java (+14 lines)
Lines 155-160 Link Here
155
155
156
	public static final ImageDescriptor EDIT = create(T_TOOL, "edit.gif"); //$NON-NLS-1$
156
	public static final ImageDescriptor EDIT = create(T_TOOL, "edit.gif"); //$NON-NLS-1$
157
157
158
	public static final ImageDescriptor EDIT_FREE = create(T_TOOL, "edit_free.gif"); //$NON-NLS-1$
159
160
	public static final ImageDescriptor EDIT_LINE = create(T_TOOL, "edit_line.gif"); //$NON-NLS-1$
161
162
	public static final ImageDescriptor EDIT_BOX = create(T_TOOL, "edit_box.gif"); //$NON-NLS-1$
163
164
	public static final ImageDescriptor EDIT_OVAL = create(T_TOOL, "edit_oval.gif"); //$NON-NLS-1$
165
158
	public static final ImageDescriptor CUT = create(T_TOOL, "cut.gif"); //$NON-NLS-1$
166
	public static final ImageDescriptor CUT = create(T_TOOL, "cut.gif"); //$NON-NLS-1$
159
167
160
	public static final ImageDescriptor STATUS_NORMAL = create(T_EVIEW, "status-normal.gif"); //$NON-NLS-1$
168
	public static final ImageDescriptor STATUS_NORMAL = create(T_EVIEW, "status-normal.gif"); //$NON-NLS-1$
Lines 201-206 Link Here
201
209
202
	public static final ImageDescriptor FIND = create(T_TOOL, "find.gif"); //$NON-NLS-1$
210
	public static final ImageDescriptor FIND = create(T_TOOL, "find.gif"); //$NON-NLS-1$
203
211
212
	public static final ImageDescriptor FILE_OBJ = create(T_TOOL, "file_obj.gif"); //$NON-NLS-1$
213
214
	public static final ImageDescriptor CLIPBOARD_OBJ = create(T_TOOL, "clipboard_obj.gif"); //$NON-NLS-1$
215
216
	public static final ImageDescriptor MINITOR_OBJ = create(T_TOOL, "monitor_obj.gif"); //$NON-NLS-1$
217
204
	private static ImageDescriptor create(String prefix, String name) {
218
	private static ImageDescriptor create(String prefix, String name) {
205
		try {
219
		try {
206
			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
220
			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
(-)src/org/eclipse/mylyn/internal/commons/ui/Messages.java (+14 lines)
Lines 70-73 Link Here
70
	public static String ScreenshotCreationPage_Fit_Image_F;
70
	public static String ScreenshotCreationPage_Fit_Image_F;
71
71
72
	public static String ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE;
72
	public static String ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE;
73
74
	public static String SelectCaptureAction_Clipboard;
75
76
	public static String SelectCaptureAction_Desktop;
77
78
	public static String SelectCaptureAction_File;
79
80
	public static String SelectDrawToolAction_Box;
81
82
	public static String SelectDrawToolAction_Oval;
83
84
	public static String SelectDrawToolAction_Free;
85
86
	public static String SelectDrawToolAction_Line;
73
}
87
}
(-)src/org/eclipse/mylyn/internal/commons/ui/messages.properties (-2 / +11 lines)
Lines 15-22 Link Here
15
15
16
ScreenshotCreationPage_After_capturing=After capturing, you can crop the image and make drawings on it. This window will not be captured. 
16
ScreenshotCreationPage_After_capturing=After capturing, you can crop the image and make drawings on it. This window will not be captured. 
17
ScreenshotCreationPage_Annotate=&Annotate
17
ScreenshotCreationPage_Annotate=&Annotate
18
ScreenshotCreationPage_Capture_Desktop=Capture Desktop
18
ScreenshotCreationPage_Capture_Desktop=Capture Desktop, Clipboard or File
19
ScreenshotCreationPage_Capture_Desktop_C=&Capture Desktop
19
ScreenshotCreationPage_Capture_Desktop_C=&Capture
20
ScreenshotCreationPage_CAPTURE_SCRRENSHOT=Capture Screenshot
20
ScreenshotCreationPage_CAPTURE_SCRRENSHOT=Capture Screenshot
21
ScreenshotCreationPage_Change_pen_color=Change pen color
21
ScreenshotCreationPage_Change_pen_color=Change pen color
22
ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image=Clear all annotations made on screenshot image
22
ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image=Clear all annotations made on screenshot image
Lines 27-29 Link Here
27
ScreenshotCreationPage_Fit_Image=Fit Image
27
ScreenshotCreationPage_Fit_Image=Fit Image
28
ScreenshotCreationPage_Fit_Image_F=&Fit Image
28
ScreenshotCreationPage_Fit_Image_F=&Fit Image
29
ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE=Note that you can continue to interact with the workbench in order to set up the screenshot.
29
ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE=Note that you can continue to interact with the workbench in order to set up the screenshot.
30
31
SelectCaptureAction_Clipboard=Clipboard
32
SelectCaptureAction_Desktop=Desktop
33
SelectCaptureAction_File=File...
34
35
SelectDrawToolAction_Box=Rectangle
36
SelectDrawToolAction_Oval=Oval
37
SelectDrawToolAction_Free=Free
38
SelectDrawToolAction_Line=Line
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectCaptureAction.java (+171 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.action.Action;
4
import org.eclipse.jface.action.ActionContributionItem;
5
import org.eclipse.jface.action.IMenuCreator;
6
import org.eclipse.jface.resource.ImageDescriptor;
7
import org.eclipse.mylyn.internal.commons.ui.Messages;
8
import org.eclipse.swt.dnd.Clipboard;
9
import org.eclipse.swt.dnd.ImageTransfer;
10
import org.eclipse.swt.graphics.Image;
11
import org.eclipse.swt.graphics.ImageData;
12
import org.eclipse.swt.widgets.Control;
13
import org.eclipse.swt.widgets.FileDialog;
14
import org.eclipse.swt.widgets.Menu;
15
import org.eclipse.swt.widgets.Shell;
16
17
public class SelectCaptureAction extends Action implements IMenuCreator {
18
19
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectcapture"; //$NON-NLS-1$
20
21
	public enum Selection {
22
		CAPTURE, CLIPBOARD, FILE
23
	};
24
25
	private static final Selection[] selections = { Selection.CAPTURE, Selection.CLIPBOARD, Selection.FILE };
26
27
	private static final String[] labels = { Messages.SelectCaptureAction_Desktop,
28
			Messages.SelectCaptureAction_Clipboard, Messages.SelectCaptureAction_File };
29
30
	private static final ImageDescriptor[] images = { CommonImages.MINITOR_OBJ, CommonImages.CLIPBOARD_OBJ,
31
			CommonImages.FILE_OBJ };
32
33
	private Selection kind;
34
35
	private Menu dropDownMenu;
36
37
	private final Shell shell;
38
39
	private String filename;
40
41
	public SelectCaptureAction(Shell shell, String label) {
42
		super(label);
43
		setMenuCreator(this);
44
		setId(ID);
45
		kind = selections[0];
46
		this.shell = shell;
47
	}
48
49
	public Selection getKind() {
50
		return kind;
51
	}
52
53
	public void resetKind() {
54
		kind = selections[0];
55
	}
56
57
	private void setKindAndRun(String label) {
58
		kind = selections[0];
59
		for (int m = 0; m < labels.length; m++) {
60
			if (labels[m].equals(label)) {
61
				kind = selections[m];
62
				if (selections[m] == Selection.FILE) {
63
					FileDialog dialog = new FileDialog(shell);
64
					dialog.setFileName(filename);
65
					dialog.setFilterExtensions(new String[] { "*.bmp;*.jpg;*.png", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$
66
					String result = dialog.open();
67
					if (result != null && result.length() > 0) {
68
						filename = result;
69
					} else {
70
						break;
71
					}
72
				}
73
				run();
74
				break;
75
			}
76
		}
77
	}
78
79
	private void addActionsToMenu() {
80
		kind = selections[0];
81
		for (int m = 0; m < labels.length; m++) {
82
			SelectionAction action = new SelectionAction();
83
			ActionContributionItem item = new ActionContributionItem(action);
84
			action.setText(labels[m]);
85
			action.setImageDescriptor(images[m]);
86
			if (selections[m] == Selection.CLIPBOARD) {
87
				action.setEnabled(existImageOnClipboard());
88
			}
89
			item.fill(dropDownMenu, -1);
90
		}
91
	}
92
93
	public void dispose() {
94
		if (dropDownMenu != null) {
95
			dropDownMenu.dispose();
96
			dropDownMenu = null;
97
		}
98
	}
99
100
	public Menu getMenu(Control parent) {
101
		if (dropDownMenu != null) {
102
			dropDownMenu.dispose();
103
		}
104
		dropDownMenu = new Menu(parent);
105
		addActionsToMenu();
106
		return dropDownMenu;
107
	}
108
109
	public Menu getMenu(Menu parent) {
110
		if (dropDownMenu != null) {
111
			dropDownMenu.dispose();
112
		}
113
		dropDownMenu = new Menu(parent);
114
		addActionsToMenu();
115
		return dropDownMenu;
116
	}
117
118
	private class SelectionAction extends Action {
119
		@Override
120
		public void run() {
121
			setKindAndRun(getText());
122
		}
123
	}
124
125
	public Image getScreenshotImage() {
126
		if (kind == Selection.CAPTURE) {
127
			return null;
128
		}
129
130
		if (kind == Selection.CLIPBOARD) {
131
			return getClipboardImage();
132
		}
133
134
		try {
135
			Image image = new Image(shell.getDisplay(), filename);
136
			return image;
137
		} catch (Exception e) {
138
			// None
139
		}
140
		return null;
141
	}
142
143
	private Image getClipboardImage() {
144
		try {
145
			Clipboard clipboard = new Clipboard(shell.getDisplay());
146
			ImageTransfer imageTransfer = ImageTransfer.getInstance();
147
			Object data = clipboard.getContents(imageTransfer);
148
			if (data instanceof ImageData) {
149
				Image image = new Image(shell.getDisplay(), (ImageData) data);
150
				return image;
151
			}
152
		} catch (Exception e) {
153
			// None
154
		}
155
		return null;
156
	}
157
158
	private boolean existImageOnClipboard() {
159
		try {
160
			Clipboard clipboard = new Clipboard(shell.getDisplay());
161
			ImageTransfer imageTransfer = ImageTransfer.getInstance();
162
			Object data = clipboard.getContents(imageTransfer);
163
			if (data instanceof ImageData) {
164
				return true;
165
			}
166
		} catch (Exception e) {
167
			// None
168
		}
169
		return false;
170
	}
171
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectDrawToolAction.java (+99 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.action.Action;
4
import org.eclipse.jface.action.ActionContributionItem;
5
import org.eclipse.jface.action.IMenuCreator;
6
import org.eclipse.jface.resource.ImageDescriptor;
7
import org.eclipse.mylyn.internal.commons.ui.Messages;
8
import org.eclipse.swt.widgets.Control;
9
import org.eclipse.swt.widgets.Menu;
10
11
public class SelectDrawToolAction extends Action implements IMenuCreator {
12
13
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectdrawtool"; //$NON-NLS-1$
14
15
	public enum DrawKind {
16
		FREE, LINE, BOX, OVAL
17
	};
18
19
	private final DrawKind[] kinds = { DrawKind.FREE, DrawKind.LINE, DrawKind.BOX, DrawKind.OVAL };
20
21
	private final String[] labels = { Messages.SelectDrawToolAction_Free, Messages.SelectDrawToolAction_Line,
22
			Messages.SelectDrawToolAction_Box, Messages.SelectDrawToolAction_Oval };
23
24
	private final ImageDescriptor[] images = { CommonImages.EDIT_FREE, CommonImages.EDIT_LINE, CommonImages.EDIT_BOX,
25
			CommonImages.EDIT_OVAL };
26
27
	private DrawKind kind;
28
29
	private Menu dropDownMenu;
30
31
	public SelectDrawToolAction() {
32
		super();
33
		setMenuCreator(this);
34
		setId(ID);
35
		setImageDescriptor(images[0]);
36
		setToolTipText(labels[0]);
37
		kind = kinds[0];
38
	}
39
40
	public DrawKind getKind() {
41
		return kind;
42
	}
43
44
	private void setKind(String label, ImageDescriptor image) {
45
		kind = kinds[0];
46
		for (int m = 0; m < labels.length; m++) {
47
			if (labels[m].equals(label)) {
48
				kind = kinds[m];
49
				setToolTipText(label);
50
				setImageDescriptor(image);
51
				break;
52
			}
53
		}
54
	}
55
56
	private void addActionsToMenu() {
57
		for (int m = 0; m < labels.length; m++) {
58
			SelectionAction action = new SelectionAction();
59
			ActionContributionItem item = new ActionContributionItem(action);
60
			action.setText(labels[m]);
61
			action.setImageDescriptor(images[m]);
62
			action.setChecked(kinds[m] == kind);
63
			item.fill(dropDownMenu, -1);
64
		}
65
	}
66
67
	public void dispose() {
68
		if (dropDownMenu != null) {
69
			dropDownMenu.dispose();
70
			dropDownMenu = null;
71
		}
72
	}
73
74
	public Menu getMenu(Control parent) {
75
		if (dropDownMenu != null) {
76
			dropDownMenu.dispose();
77
		}
78
		dropDownMenu = new Menu(parent);
79
		addActionsToMenu();
80
		return dropDownMenu;
81
	}
82
83
	public Menu getMenu(Menu parent) {
84
		if (dropDownMenu != null) {
85
			dropDownMenu.dispose();
86
		}
87
		dropDownMenu = new Menu(parent);
88
		addActionsToMenu();
89
		return dropDownMenu;
90
	}
91
92
	private class SelectionAction extends Action {
93
		@Override
94
		public void run() {
95
			setKind(getText(), getImageDescriptor());
96
		}
97
	}
98
99
}

Return to bug 266123