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 (-41 / +636 lines)
Lines 32-39 Link Here
32
import org.eclipse.jface.layout.GridDataFactory;
32
import org.eclipse.jface.layout.GridDataFactory;
33
import org.eclipse.jface.resource.ImageDescriptor;
33
import org.eclipse.jface.resource.ImageDescriptor;
34
import org.eclipse.jface.wizard.WizardPage;
34
import org.eclipse.jface.wizard.WizardPage;
35
import org.eclipse.mylyn.internal.commons.ui.ColorSelectionWindow;
36
import org.eclipse.mylyn.internal.commons.ui.Messages;
35
import org.eclipse.mylyn.internal.commons.ui.Messages;
36
import org.eclipse.osgi.util.NLS;
37
import org.eclipse.swt.SWT;
37
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.custom.ScrolledComposite;
38
import org.eclipse.swt.custom.ScrolledComposite;
39
import org.eclipse.swt.custom.ViewForm;
39
import org.eclipse.swt.custom.ViewForm;
Lines 46-51 Link Here
46
import org.eclipse.swt.events.PaintListener;
46
import org.eclipse.swt.events.PaintListener;
47
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.Color;
48
import org.eclipse.swt.graphics.Cursor;
48
import org.eclipse.swt.graphics.Cursor;
49
import org.eclipse.swt.graphics.Font;
50
import org.eclipse.swt.graphics.FontData;
49
import org.eclipse.swt.graphics.GC;
51
import org.eclipse.swt.graphics.GC;
50
import org.eclipse.swt.graphics.Image;
52
import org.eclipse.swt.graphics.Image;
51
import org.eclipse.swt.graphics.Point;
53
import org.eclipse.swt.graphics.Point;
Lines 53-63 Link Here
53
import org.eclipse.swt.graphics.Rectangle;
55
import org.eclipse.swt.graphics.Rectangle;
54
import org.eclipse.swt.graphics.Region;
56
import org.eclipse.swt.graphics.Region;
55
import org.eclipse.swt.widgets.Canvas;
57
import org.eclipse.swt.widgets.Canvas;
58
import org.eclipse.swt.widgets.ColorDialog;
56
import org.eclipse.swt.widgets.Composite;
59
import org.eclipse.swt.widgets.Composite;
57
import org.eclipse.swt.widgets.Display;
60
import org.eclipse.swt.widgets.Display;
58
import org.eclipse.swt.widgets.Event;
61
import org.eclipse.swt.widgets.Event;
62
import org.eclipse.swt.widgets.FontDialog;
63
import org.eclipse.swt.widgets.Listener;
59
import org.eclipse.swt.widgets.Shell;
64
import org.eclipse.swt.widgets.Shell;
60
import org.eclipse.swt.widgets.ToolItem;
65
import org.eclipse.swt.widgets.Text;
61
import org.eclipse.ui.progress.UIJob;
66
import org.eclipse.ui.progress.UIJob;
62
67
63
/**
68
/**
Lines 71-84 Link Here
71
 */
76
 */
72
public class ScreenshotCreationPage extends WizardPage implements IImageCreator {
77
public class ScreenshotCreationPage extends WizardPage implements IImageCreator {
73
78
74
	private IAction captureAction;
79
	private SelectCaptureAction captureAction;
75
80
76
	private IAction fitAction;
81
	private SelectZoomToolAction fitAction;
77
82
78
	private IAction cropAction;
83
	private IAction cropAction;
79
84
80
	private IAction markAction;
85
	private IAction markAction;
81
86
87
	private SelectDrawToolAction toolAction;
88
89
	private SelectLineToolAction lineAction;
90
91
	private SelectBoldToolAction boldAction;
92
93
	private IAction fontAction;
94
95
	private Font markFont;
96
97
	private Color markFontColor;
98
82
	private IAction colorAction;
99
	private IAction colorAction;
83
100
84
	private Image colorIcon;
101
	private Image colorIcon;
Lines 87-92 Link Here
87
104
88
	private IAction clearAction;
105
	private IAction clearAction;
89
106
107
	private IAction undoAction;
108
109
	private IAction redoAction;
110
90
	private boolean imageDirty;
111
	private boolean imageDirty;
91
112
92
	/**
113
	/**
Lines 99-104 Link Here
99
	 */
120
	 */
100
	private Image workImage;
121
	private Image workImage;
101
122
123
	private Image previousImage;
124
102
	/**
125
	/**
103
	 * Used to draw into {@link #workImage}
126
	 * Used to draw into {@link #workImage}
104
	 */
127
	 */
Lines 155-160 Link Here
155
	 */
178
	 */
156
	private EditorAction currentAction = EditorAction.CROPPING;
179
	private EditorAction currentAction = EditorAction.CROPPING;
157
180
181
	private boolean isFirstCapture = true;
182
183
	/**
184
	 * Mouse event history. Entry is [0] MouseDown/MouseMove/MouseUp, [1] x, [2] y
185
	 */
186
	private Text textArea;
187
188
	/**
189
	 * Mouse event history. Entry is [0] MouseDown/MouseMove/MouseUp, [1] x, [2] y
190
	 */
191
	private List<int[]> historyMouseEvent = new ArrayList<int[]>();
192
193
	/**
194
	 * Draw tool history. Entry is [0] drawHistory index, [1] FREE/LINE/BOX/OVAL, [2] Line type, [3] Bold, [4] R/G/B
195
	 */
196
	private List<int[]> historyDrawTool = new ArrayList<int[]>();
197
198
	private List<StringBuffer> historyDrawText = new ArrayList<StringBuffer>();
199
200
	private List<String> historyDrawFont = new ArrayList<String>();
201
202
	private int historyCheckpoint = 0;
203
204
	//	MouseDown [1, x, y], MouseMove [2, x, y], MouseUp [0, x, y]
205
158
	public ScreenshotCreationPage() {
206
	public ScreenshotCreationPage() {
159
		super("ScreenShotAttachment"); //$NON-NLS-1$
207
		super("ScreenShotAttachment"); //$NON-NLS-1$
160
		setTitle(Messages.ScreenshotCreationPage_CAPTURE_SCRRENSHOT);
208
		setTitle(Messages.ScreenshotCreationPage_CAPTURE_SCRRENSHOT);
Lines 173-185 Link Here
173
221
174
		// TODO: need disabled versions of all toolbar icons
222
		// TODO: need disabled versions of all toolbar icons
175
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT);
223
		ToolBarManager tbm = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.RIGHT);
176
		captureAction = new Action(Messages.ScreenshotCreationPage_Capture_Desktop_C, IAction.AS_PUSH_BUTTON) {
177
224
178
			private boolean isFirstCapture = true;
225
		captureAction = new SelectCaptureAction(getShell(), Messages.ScreenshotCreationPage_Capture_Desktop_C) {
179
226
180
			@Override
227
			@Override
181
			public void run() {
228
			public void run() {
182
				captureScreenshotContent();
229
				if (captureAction.getKind() == SelectCaptureAction.CAPTURE) {
230
					captureScreenshotContent();
231
				} else {
232
					captureScreenshotContent(captureAction.getScreenshotImage());
233
				}
234
				captureAction.resetKind();
183
				setErrorMessage(null);
235
				setErrorMessage(null);
184
				if (isFirstCapture) {
236
				if (isFirstCapture) {
185
					isFirstCapture = false;
237
					isFirstCapture = false;
Lines 189-199 Link Here
189
					markAction.setEnabled(true);
241
					markAction.setEnabled(true);
190
					clearAction.setEnabled(false);
242
					clearAction.setEnabled(false);
191
				}
243
				}
244
245
				historyMouseEvent = new ArrayList<int[]>();
246
				historyDrawTool = new ArrayList<int[]>();
247
				historyDrawText = new ArrayList<StringBuffer>();
248
				historyDrawFont = new ArrayList<String>();
249
				historyCheckpoint = 0;
250
				undoAction.setEnabled(false);
251
				redoAction.setEnabled(false);
192
			}
252
			}
193
253
194
		};
254
		};
195
		captureAction.setToolTipText(Messages.ScreenshotCreationPage_Capture_Desktop);
255
		captureAction.setToolTipText(Messages.ScreenshotCreationPage_Capture_Desktop);
196
		captureAction.setImageDescriptor(ImageDescriptor.createFromImage(CommonImages.getImage(CommonImages.IMAGE_CAPTURE)));
256
		captureAction.setImageDescriptor(ImageDescriptor.createFromImage(CommonImages.getImage(CommonImages.IMAGE_CAPTURE)));
257
		captureAction.setShowMenuAlways(false);
197
258
198
//		captureDelayedButton = new Button(buttonsComposite, SWT.PUSH);
259
//		captureDelayedButton = new Button(buttonsComposite, SWT.PUSH);
199
//		final String captureIn = "Capture in ";
260
//		final String captureIn = "Capture in ";
Lines 228-234 Link Here
228
//			}
289
//			}
229
//		});
290
//		});
230
291
231
		fitAction = new Action("", IAction.AS_CHECK_BOX) { //$NON-NLS-1$
292
		fitAction = new SelectZoomToolAction() {
232
			@Override
293
			@Override
233
			public void run() {
294
			public void run() {
234
				refreshCanvasSize();
295
				refreshCanvasSize();
Lines 237-243 Link Here
237
		fitAction.setToolTipText(Messages.ScreenshotCreationPage_Fit_Image);
298
		fitAction.setToolTipText(Messages.ScreenshotCreationPage_Fit_Image);
238
		fitAction.setText(Messages.ScreenshotCreationPage_Fit_Image_F);
299
		fitAction.setText(Messages.ScreenshotCreationPage_Fit_Image_F);
239
		fitAction.setImageDescriptor(ImageDescriptor.createFromImage(CommonImages.getImage(CommonImages.IMAGE_FIT)));
300
		fitAction.setImageDescriptor(ImageDescriptor.createFromImage(CommonImages.getImage(CommonImages.IMAGE_FIT)));
240
		fitAction.setChecked(true);
301
		//fitAction.setChecked(true);
241
		fitAction.setEnabled(false);
302
		fitAction.setEnabled(false);
242
303
243
		cropAction = new Action(Messages.ScreenshotCreationPage_Crop_R, IAction.AS_RADIO_BUTTON) {
304
		cropAction = new Action(Messages.ScreenshotCreationPage_Crop_R, IAction.AS_RADIO_BUTTON) {
Lines 246-252 Link Here
246
				currentAction = EditorAction.CROPPING;
307
				currentAction = EditorAction.CROPPING;
247
				cropAction.setChecked(true);
308
				cropAction.setChecked(true);
248
				markAction.setChecked(false);
309
				markAction.setChecked(false);
310
				toolAction.setEnabled(false);
311
				lineAction.setEnabled(false);
312
				boldAction.setEnabled(false);
313
				fontAction.setEnabled(false);
249
				colorAction.setEnabled(false);
314
				colorAction.setEnabled(false);
315
				undoAction.setEnabled(false);
316
				redoAction.setEnabled(false);
250
				canvas.redraw();
317
				canvas.redraw();
251
			}
318
			}
252
		};
319
		};
Lines 260-266 Link Here
260
				currentAction = EditorAction.MARKING;
327
				currentAction = EditorAction.MARKING;
261
				cropAction.setChecked(false);
328
				cropAction.setChecked(false);
262
				markAction.setChecked(true);
329
				markAction.setChecked(true);
330
				toolAction.setEnabled(true);
331
				lineAction.setEnabled(true);
332
				boldAction.setEnabled(true);
333
				fontAction.setEnabled(toolAction.getKind() == SelectDrawToolAction.TEXT);
263
				colorAction.setEnabled(true);
334
				colorAction.setEnabled(true);
335
				undoAction.setEnabled(false);
336
				redoAction.setEnabled(false);
264
				canvas.redraw();
337
				canvas.redraw();
265
			}
338
			}
266
		};
339
		};
Lines 269-293 Link Here
269
//		markAction.setDisabledImageDescriptor(ImageDescriptor.createFromFile(getClass(), "mark_disabled.gif"));
342
//		markAction.setDisabledImageDescriptor(ImageDescriptor.createFromFile(getClass(), "mark_disabled.gif"));
270
		markAction.setEnabled(false);
343
		markAction.setEnabled(false);
271
344
272
		colorAction = new Action("", IAction.AS_DROP_DOWN_MENU) { //$NON-NLS-1$
345
		toolAction = new SelectDrawToolAction() {
273
			@Override
346
			@Override
274
			public void runWithEvent(final Event e) {
347
			public void run() {
275
				final ColorSelectionWindow colorWindow = new ColorSelectionWindow(getControl().getShell()) {
348
				fontAction.setEnabled(toolAction.getKind() == SelectDrawToolAction.TEXT);
349
			}
350
		};
351
		toolAction.setEnabled(false);
352
353
		lineAction = new SelectLineToolAction();
354
		lineAction.setEnabled(false);
355
356
		boldAction = new SelectBoldToolAction();
357
		boldAction.setEnabled(false);
276
358
277
					@Override
359
		colorAction = new Action("", IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
278
					protected Point getInitialLocation(Point initialSize) {
360
			@Override
279
						ToolItem toolItem = (ToolItem) e.widget;
361
			public void runWithEvent(final Event e) {
280
						Rectangle itemBounds = toolItem.getBounds();
362
//				final ColorSelectionWindow colorWindow = new ColorSelectionWindow(getControl().getShell()) {
281
						Point location = toolItem.getParent().toDisplay(itemBounds.x + itemBounds.width,
363
//
282
								itemBounds.y + itemBounds.height);
364
//					@Override
283
						location.x -= initialSize.x;
365
//					protected Point getInitialLocation(Point initialSize) {
284
						return location;
366
//						ToolItem toolItem = (ToolItem) e.widget;
285
					}
367
//						Rectangle itemBounds = toolItem.getBounds();
286
368
//						Point location = toolItem.getParent().toDisplay(itemBounds.x + itemBounds.width,
287
				};
369
//								itemBounds.y + itemBounds.height);
288
				colorWindow.setBlockOnOpen(true);
370
//						location.x -= initialSize.x;
289
				colorWindow.open();
371
//						return location;
290
				RGB color = colorWindow.getSelectedRGB();
372
//					}
373
//
374
//				};
375
//				colorWindow.setBlockOnOpen(true);
376
//				colorWindow.open();
377
//				RGB color = colorWindow.getSelectedRGB();
378
				final ColorDialog colorWindow = new ColorDialog(getControl().getShell());
379
				colorWindow.setRGB(markColor.getRGB());
380
				RGB color = colorWindow.open();
381
				;
291
				if (color != null) {
382
				if (color != null) {
292
					setMarkColor(color);
383
					setMarkColor(color);
293
				}
384
				}
Lines 298-324 Link Here
298
		setMarkColor(new RGB(255, 85, 85));
389
		setMarkColor(new RGB(255, 85, 85));
299
		colorAction.setEnabled(false);
390
		colorAction.setEnabled(false);
300
391
301
		clearAction = new Action(Messages.ScreenshotCreationPage_Clear_Annotations, IAction.AS_PUSH_BUTTON) {
392
		fontAction = new Action("", IAction.AS_PUSH_BUTTON) { //$NON-NLS-1$
393
			@Override
394
			public void runWithEvent(final Event e) {
395
				final FontDialog fontWindow = new FontDialog(getControl().getShell());
396
				fontWindow.setFontList(markFont.getFontData());
397
				fontWindow.setRGB(markFontColor.getRGB());
398
				FontData fontData = fontWindow.open();
399
				RGB fontColor = fontWindow.getRGB();
400
				if (fontData != null) {
401
					setMarkFont(new FontData[] { fontData }, fontColor);
402
					fontAction.setToolTipText(getMarkFontInfo());
403
				}
404
			}
405
		};
406
		setMarkFont(getShell().getFont().getFontData(), new RGB(255, 0, 0));
407
		fontAction.setToolTipText(getMarkFontInfo());
408
		fontAction.setImageDescriptor(CommonImages.FONT_PROP);
409
		fontAction.setEnabled(false);
410
411
		clearAction = new Action(Messages.ScreenshotCreationPage_Clear, IAction.AS_PUSH_BUTTON) {
302
			@Override
412
			@Override
303
			public void run() {
413
			public void run() {
304
				clearAction.setEnabled(false);
414
				clearAction.setEnabled(false);
305
				workImageGC.drawImage(originalImage, 0, 0);
415
				workImageGC.drawImage(originalImage, 0, 0);
306
				canvas.redraw();
416
				canvas.redraw();
307
				setImageDirty(true);
417
				setImageDirty(true);
418
419
				historyMouseEvent = new ArrayList<int[]>();
420
				historyDrawTool = new ArrayList<int[]>();
421
				historyDrawText = new ArrayList<StringBuffer>();
422
				historyDrawFont = new ArrayList<String>();
423
				historyCheckpoint = 0;
424
				undoAction.setEnabled(false);
425
				redoAction.setEnabled(false);
308
			}
426
			}
309
		};
427
		};
310
		clearAction.setToolTipText(Messages.ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image);
428
		clearAction.setToolTipText(Messages.ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image);
311
		clearAction.setImageDescriptor(CommonImages.CLEAR);
429
		clearAction.setImageDescriptor(CommonImages.CLEAR);
312
		clearAction.setEnabled(false);
430
		clearAction.setEnabled(false);
313
431
432
		undoAction = new Action(Messages.ScreenshotCreationPage_Undo) {
433
			@Override
434
			public void run() {
435
				if (historyCheckpoint > 0) {
436
					historyCheckpoint--;
437
					drawAnnotationHistory();
438
				}
439
				if (historyCheckpoint == 0) {
440
					undoAction.setEnabled(false);
441
				}
442
				if (historyCheckpoint < historyDrawTool.size()) {
443
					redoAction.setEnabled(true);
444
				}
445
			}
446
		};
447
		undoAction.setToolTipText(Messages.ScreenshotCreationPage_Undo_annotation);
448
		undoAction.setImageDescriptor(CommonImages.EDIT_UNDO);
449
		undoAction.setEnabled(false);
450
451
		redoAction = new Action(Messages.ScreenshotCreationPage_Redo) {
452
			@Override
453
			public void run() {
454
				if (historyCheckpoint < historyDrawTool.size()) {
455
					historyCheckpoint++;
456
					drawAnnotationHistory();
457
				}
458
				if (historyCheckpoint > 0) {
459
					undoAction.setEnabled(true);
460
				}
461
				if (historyCheckpoint >= historyDrawTool.size()) {
462
					redoAction.setEnabled(false);
463
				}
464
			}
465
		};
466
		redoAction.setToolTipText(Messages.ScreenshotCreationPage_Redo_annotation);
467
		redoAction.setImageDescriptor(CommonImages.EDIT_REDO);
468
		redoAction.setEnabled(false);
469
314
		tbm.add(createAndConfigureCI(captureAction));
470
		tbm.add(createAndConfigureCI(captureAction));
315
		tbm.add(createAndConfigureCI(fitAction));
316
		tbm.add(new Separator());
471
		tbm.add(new Separator());
472
		tbm.add(createAndConfigureCI(fitAction));
317
		tbm.add(createAndConfigureCI(cropAction));
473
		tbm.add(createAndConfigureCI(cropAction));
318
		tbm.add(createAndConfigureCI(markAction));
474
		tbm.add(createAndConfigureCI(markAction));
475
		tbm.add(new Separator());
476
		tbm.add(createAndConfigureCI(toolAction));
477
		tbm.add(createAndConfigureCI(lineAction));
478
		tbm.add(createAndConfigureCI(boldAction));
319
		tbm.add(createAndConfigureCI(colorAction));
479
		tbm.add(createAndConfigureCI(colorAction));
480
		tbm.add(createAndConfigureCI(fontAction));
320
		tbm.add(new Separator());
481
		tbm.add(new Separator());
321
		tbm.add(createAndConfigureCI(clearAction));
482
		tbm.add(createAndConfigureCI(clearAction));
483
		tbm.add(createAndConfigureCI(undoAction));
484
		tbm.add(createAndConfigureCI(redoAction));
322
485
323
		scrolledComposite = new ScrolledComposite(vf, SWT.V_SCROLL | SWT.H_SCROLL);
486
		scrolledComposite = new ScrolledComposite(vf, SWT.V_SCROLL | SWT.H_SCROLL);
324
		canvas = new Canvas(scrolledComposite, SWT.DOUBLE_BUFFERED);
487
		canvas = new Canvas(scrolledComposite, SWT.DOUBLE_BUFFERED);
Lines 330-340 Link Here
330
					Rectangle imageBounds = workImage.getBounds();
493
					Rectangle imageBounds = workImage.getBounds();
331
					Rectangle canvasBounds = canvas.getClientArea();
494
					Rectangle canvasBounds = canvas.getClientArea();
332
495
333
					if (fitAction.isChecked()) {
496
					switch (fitAction.getKind()) {
334
						e.gc.drawImage(workImage, 0, 0, imageBounds.width, imageBounds.height, 0, 0,
497
					case SelectZoomToolAction.FIT:
335
								canvasBounds.width, canvasBounds.height);
498
						e.gc.drawImage(workImage, 0, 0, imageBounds.width, imageBounds.height, //
336
					} else {
499
								0, 0, canvasBounds.width, canvasBounds.height);
500
						break;
501
					case SelectZoomToolAction.ZOOM8X:
502
						e.gc.drawImage(workImage, 0, 0, imageBounds.width, imageBounds.height, //
503
								0, 0, imageBounds.width * 8, imageBounds.height * 8);
504
						break;
505
					case SelectZoomToolAction.ZOOM4X:
506
						e.gc.drawImage(workImage, 0, 0, imageBounds.width, imageBounds.height, //
507
								0, 0, imageBounds.width * 4, imageBounds.height * 4);
508
						break;
509
					case SelectZoomToolAction.ZOOM2X:
510
						e.gc.drawImage(workImage, 0, 0, imageBounds.width, imageBounds.height, //
511
								0, 0, imageBounds.width * 2, imageBounds.height * 2);
512
						break;
513
					default:
337
						e.gc.drawImage(workImage, 0, 0);
514
						e.gc.drawImage(workImage, 0, 0);
515
						break;
338
					}
516
					}
339
					drawSelection(e.gc);
517
					drawSelection(e.gc);
340
				} else {
518
				} else {
Lines 347-353 Link Here
347
		scrolledComposite.addControlListener(new ControlAdapter() {
525
		scrolledComposite.addControlListener(new ControlAdapter() {
348
			@Override
526
			@Override
349
			public void controlResized(ControlEvent e) {
527
			public void controlResized(ControlEvent e) {
350
				if (fitAction.isChecked()) {
528
				if (fitAction.getKind() == SelectZoomToolAction.FIT) {
351
					refreshCanvasSize();
529
					refreshCanvasSize();
352
				}
530
				}
353
			}
531
			}
Lines 367-372 Link Here
367
		return ci;
545
		return ci;
368
	}
546
	}
369
547
548
	private void setMarkFont(FontData[] fontData, RGB fontColor) {
549
		if (markFont != null) {
550
			markFont.dispose();
551
		}
552
		markFont = new Font(getShell().getDisplay(), fontData[0]);
553
		markFontColor = new Color(getShell().getDisplay(), fontColor);
554
	}
555
556
	private String getMarkFontInfo() {
557
		if (markFont == null) {
558
			return Messages.ScreenshotCreationPage_Change_text_font;
559
		}
560
		FontData[] fd = markFont.getFontData();
561
		String info = NLS.bind(Messages.ScreenshotCreationPage_Font_Name_Size, //
562
				new Object[] { fd[0].getName(), fd[0].getHeight() + "" }); //$NON-NLS-1$
563
		int style = fd[0].getStyle();
564
		if ((style & SWT.BOLD) != 0) {
565
			info = info + Messages.ScreenshotCreationPage_Font_Bold;
566
		}
567
		if ((style & SWT.ITALIC) != 0) {
568
			info = info + Messages.ScreenshotCreationPage_Font_Italic;
569
		}
570
		return info;
571
	}
572
370
	private void setMarkColor(RGB color) {
573
	private void setMarkColor(RGB color) {
371
		if (markColor != null) {
574
		if (markColor != null) {
372
			markColor.dispose();
575
			markColor.dispose();
Lines 455-460 Link Here
455
		return isPageComplete();
658
		return isPageComplete();
456
	}
659
	}
457
660
661
	private void captureScreenshotContent(Image image) {
662
		final Display display = getShell().getDisplay();
663
		disposeImageResources();
664
		originalImage = image;
665
		Rectangle displayBounds = originalImage.getBounds();
666
		workImage = new Image(display, displayBounds.width, displayBounds.height);
667
		GC gc = new GC(workImage);
668
		gc.drawImage(originalImage, 0, 0);
669
		gc.dispose();
670
671
		workImageGC = new GC(workImage);
672
		workImageGC.setBackground(new Color(getShell().getDisplay(), 255, 255, 255));
673
		workImageGC.setForeground(markColor);
674
		workImageGC.setLineWidth(4);
675
		workImageGC.setLineCap(SWT.CAP_ROUND);
676
677
		scrolledComposite.setEnabled(true);
678
		clearSelection();
679
		refreshCanvasSize();
680
681
		setPageComplete(true);
682
	}
683
458
	private void captureScreenshotContent() {
684
	private void captureScreenshotContent() {
459
		final Display display = getShell().getDisplay();
685
		final Display display = getShell().getDisplay();
460
		final Shell wizardShell = getWizard().getContainer().getShell();
686
		final Shell wizardShell = getWizard().getContainer().getShell();
Lines 659-664 Link Here
659
						canvas.setCursor(crossCursor);
885
						canvas.setCursor(crossCursor);
660
					}
886
					}
661
				} else if (currentAction == EditorAction.MARKING) {
887
				} else if (currentAction == EditorAction.MARKING) {
888
					if (startPoint != null) {
889
						if (toolAction.getKind() == SelectDrawToolAction.FREE) {
890
							int[] history = new int[3];
891
							history[0] = SWT.MouseMove;
892
							history[1] = scaledX;
893
							history[2] = scaledY;
894
							historyMouseEvent.add(history);
895
						} else {
896
							int[] history = historyMouseEvent.get(historyMouseEvent.size() - 1);
897
							if (history[0] == SWT.MouseMove) {
898
								history[1] = scaledX;
899
								history[2] = scaledY;
900
							} else {
901
								history = new int[3];
902
								history[0] = SWT.MouseMove;
903
								history[1] = scaledX;
904
								history[2] = scaledY;
905
								historyMouseEvent.add(history);
906
							}
907
						}
908
					}
909
662
					drawMarkLine(scaledX, scaledY);
910
					drawMarkLine(scaledX, scaledY);
663
911
664
					Cursor markCursor = cursors.get(CURSOR_MARK_TOOL);
912
					Cursor markCursor = cursors.get(CURSOR_MARK_TOOL);
Lines 699-707 Link Here
699
					canvas.redraw();
947
					canvas.redraw();
700
					setImageDirty(true);
948
					setImageDirty(true);
701
				} else if (currentAction == EditorAction.MARKING) {
949
				} else if (currentAction == EditorAction.MARKING) {
950
					if (startPoint != null) {
951
						if (toolAction.getKind() != SelectDrawToolAction.FREE) {
952
							if (toolAction.getKind() == SelectDrawToolAction.TEXT) {
953
								drawAnnotationText();
954
							}
955
							previousImage.dispose();
956
							previousImage = null;
957
						}
958
959
						int[] history = new int[3];
960
						history[0] = SWT.MouseUp;
961
						history[1] = 0;
962
						history[2] = 0;
963
						historyMouseEvent.add(history);
964
					}
965
702
					startPoint = null;
966
					startPoint = null;
703
					setImageDirty(true);
967
					setImageDirty(true);
968
969
				}
970
			}
971
972
			/**
973
			 * Input annotation text and draw text
974
			 */
975
			private void drawAnnotationText() {
976
				workImageGC.drawImage(previousImage, 0, 0);
977
978
				int[] history = historyMouseEvent.get(historyMouseEvent.size() - 1);
979
				if (history[0] != SWT.MouseMove) {
980
					historyCheckpoint--;
981
					updateAnnotationHistory();
982
					return;
983
				}
984
985
				final Rectangle bounds = new Rectangle(startPoint.x, startPoint.y, history[1] - startPoint.x,
986
						history[2] - startPoint.y);
987
988
				textArea = new Text(canvas, SWT.MULTI | SWT.WRAP);
989
				textArea.addListener(SWT.Deactivate, new Listener() {
990
991
					public void handleEvent(Event event) {
992
						String text = textArea.getText();
993
						{
994
							String newtext = ""; //$NON-NLS-1$
995
							Rectangle rect = textArea.getBounds();
996
							textArea.setSize(rect.width, textArea.getLineHeight());
997
							int currpos = 0;
998
							int charpos = currpos;
999
							textArea.setSelection(currpos);
1000
							textArea.setTopIndex(0);
1001
							int linepos = textArea.getTopIndex();
1002
							boolean remove1st = false;
1003
							String line;
1004
							while (currpos < text.length()) {
1005
								int y = textArea.getTopIndex();
1006
								if (linepos != y) {
1007
									line = text.substring(charpos, currpos);
1008
									if (line.endsWith("\n")) { //$NON-NLS-1$
1009
										line = line.substring(0, line.length() - 1);
1010
									}
1011
									newtext = newtext + "\n" + line; //$NON-NLS-1$
1012
									remove1st = true;
1013
									charpos = currpos;
1014
									linepos = y;
1015
								}
1016
								currpos++;
1017
								textArea.setSelection(currpos);
1018
							}
1019
							line = text.substring(charpos, currpos);
1020
							if (line.endsWith("\n")) { //$NON-NLS-1$
1021
								line = line.substring(0, line.length() - 1);
1022
							}
1023
							if (line.length() > 0) {
1024
								newtext = newtext + "\n" + text.substring(charpos, currpos); //$NON-NLS-1$
1025
								remove1st = true;
1026
							}
1027
							currpos = newtext.indexOf("\r"); //$NON-NLS-1$
1028
							while (currpos > 0) {
1029
								newtext = newtext.substring(0, currpos) + newtext.substring(currpos + 1);
1030
								currpos = newtext.indexOf("\r"); //$NON-NLS-1$
1031
							}
1032
							newtext = newtext.replace("\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
1033
							if (remove1st) {
1034
								newtext = newtext.substring(1);
1035
							}
1036
							text = newtext;
1037
						}
1038
1039
						textArea.dispose();
1040
						textArea = null;
1041
1042
						if (text.length() > 0) {
1043
							historyDrawText.get(historyCheckpoint - 1).append(text);
1044
							workImageGC.setFont(markFont);
1045
							workImageGC.setForeground(markFontColor);
1046
							workImageGC.setClipping(bounds);
1047
							workImageGC.drawText(text, bounds.x, bounds.y, true);
1048
							workImageGC.setClipping((Rectangle) null);
1049
							workImageGC.setForeground(markColor);
1050
						} else {
1051
							historyCheckpoint--;
1052
							updateAnnotationHistory();
1053
						}
1054
						canvas.redraw();
1055
					}
1056
				});
1057
1058
				int gp = (int) Math.round(3 * scaleFactor);
1059
				int xs = (int) Math.round(startPoint.x * scaleFactor);
1060
				int ys = (int) Math.round(startPoint.y * scaleFactor);
1061
				int xe = (int) Math.round(history[1] * scaleFactor);
1062
				int ye = (int) Math.round(history[2] * scaleFactor);
1063
				textArea.setBounds(new Rectangle(xs - gp, ys, xe - xs + gp + gp, ye - ys));
1064
				textArea.setForeground(markFontColor);
1065
				textArea.setTabs(1);
1066
				if (scaleFactor != 1.0) {
1067
					FontData[] fd = markFont.getFontData();
1068
					fd[0].setHeight((int) Math.round(fd[0].getHeight() * scaleFactor));
1069
					textArea.setFont(new Font(getShell().getDisplay(), fd[0]));
1070
				} else {
1071
					textArea.setFont(markFont);
704
				}
1072
				}
1073
				textArea.setFocus();
705
			}
1074
			}
706
1075
707
			/**
1076
			/**
Lines 713-718 Link Here
713
				int scaledY = (int) (e.y / scaleFactor);
1082
				int scaledY = (int) (e.y / scaleFactor);
714
1083
715
				if (currentAction == EditorAction.MARKING) {
1084
				if (currentAction == EditorAction.MARKING) {
1085
					updateAnnotationHistory();
1086
1087
					int toolKind = toolAction.getKind();
1088
					int[] history = new int[5];
1089
					history[0] = historyMouseEvent.size();
1090
					history[1] = toolAction.getKind();
1091
					history[2] = lineAction.getKind();
1092
					history[3] = boldAction.getKind();
1093
					if (toolKind == SelectDrawToolAction.TEXT) {
1094
						history[4] = (markFontColor.getRed() << 16) //
1095
								+ (markFontColor.getGreen() << 8) //
1096
								+ markFontColor.getBlue();
1097
					} else {
1098
						history[4] = (markColor.getRed() << 16) //
1099
								+ (markColor.getGreen() << 8) //
1100
								+ markColor.getBlue();
1101
					}
1102
					historyDrawTool.add(history);
1103
					historyDrawText.add(new StringBuffer());
1104
					if (toolKind == SelectDrawToolAction.TEXT) {
1105
						FontData[] fd = markFont.getFontData();
1106
						historyDrawFont.add(fd[0].toString());
1107
					} else {
1108
						historyDrawFont.add(""); //$NON-NLS-1$
1109
					}
1110
					historyCheckpoint = historyDrawTool.size();
1111
1112
					history = new int[3];
1113
					history[0] = SWT.MouseDown;
1114
					history[1] = scaledX;
1115
					history[2] = scaledY;
1116
					historyMouseEvent.add(history);
1117
					undoAction.setEnabled(true);
1118
1119
					if (toolKind != SelectDrawToolAction.FREE) {
1120
						Display display = getShell().getDisplay();
1121
						previousImage = new Image(display, workImage.getBounds());
1122
						GC gc = new GC(previousImage);
1123
						gc.drawImage(workImage, 0, 0);
1124
						gc.dispose();
1125
					}
1126
1127
					if (toolKind != SelectDrawToolAction.TEXT) {
1128
						workImageGC.setLineStyle(lineAction.getKind());
1129
						workImageGC.setLineWidth(boldAction.getKind());
1130
						workImageGC.setForeground(markFontColor);
1131
					} else {
1132
						workImageGC.setLineStyle(SWT.LINE_DOT);
1133
						workImageGC.setLineWidth(1);
1134
						workImageGC.setForeground(new Color(getShell().getDisplay(), 0, 0, 0));
1135
					}
1136
716
					startPoint = new Point(scaledX, scaledY);
1137
					startPoint = new Point(scaledX, scaledY);
717
					drawMarkLine(scaledX, scaledY);
1138
					drawMarkLine(scaledX, scaledY);
718
					canvas.setCursor(cursors.get(CURSOR_MARK_TOOL));
1139
					canvas.setCursor(cursors.get(CURSOR_MARK_TOOL));
Lines 779-785 Link Here
779
	 * Calling this method under other circumstances may lead to strange behavior in the scrolled composite
1200
	 * Calling this method under other circumstances may lead to strange behavior in the scrolled composite
780
	 */
1201
	 */
781
	private void refreshCanvasSize() {
1202
	private void refreshCanvasSize() {
782
		if (fitAction.isChecked()) {
1203
		if (fitAction.getKind() == SelectZoomToolAction.FIT) {
783
			// This little hack is necessary to get the client area without scrollbars; 
1204
			// This little hack is necessary to get the client area without scrollbars; 
784
			// they'll be automatically restored if necessary after Canvas.setBounds()
1205
			// they'll be automatically restored if necessary after Canvas.setBounds()
785
			scrolledComposite.getHorizontalBar().setVisible(false);
1206
			scrolledComposite.getHorizontalBar().setVisible(false);
Lines 798-809 Link Here
798
			}
1219
			}
799
			canvas.setBounds(bounds);
1220
			canvas.setBounds(bounds);
800
		} else {
1221
		} else {
801
			scaleFactor = 1.0;
1222
			if (fitAction.getKind() == SelectZoomToolAction.ZOOM8X) {
1223
				scaleFactor = 8.0;
1224
			} else if (fitAction.getKind() == SelectZoomToolAction.ZOOM4X) {
1225
				scaleFactor = 4.0;
1226
			} else if (fitAction.getKind() == SelectZoomToolAction.ZOOM2X) {
1227
				scaleFactor = 2.0;
1228
			} else {
1229
				scaleFactor = 1.0;
1230
			}
802
			Rectangle bounds = scrolledComposite.getClientArea();
1231
			Rectangle bounds = scrolledComposite.getClientArea();
803
			if (workImage != null) {
1232
			if (workImage != null) {
804
				Rectangle imageBounds = workImage.getBounds();
1233
				Rectangle imageBounds = workImage.getBounds();
805
				bounds.width = imageBounds.width;
1234
				bounds.width = (int) Math.round(imageBounds.width * scaleFactor);
806
				bounds.height = imageBounds.height;
1235
				bounds.height = (int) Math.round(imageBounds.height * scaleFactor);
807
			}
1236
			}
808
			canvas.setBounds(bounds);
1237
			canvas.setBounds(bounds);
809
		}
1238
		}
Lines 811-816 Link Here
811
		canvas.redraw();
1240
		canvas.redraw();
812
	}
1241
	}
813
1242
1243
	private void updateAnnotationHistory() {
1244
		int[] history;
1245
		if (historyCheckpoint < historyDrawTool.size()) {
1246
			history = historyDrawTool.get(historyCheckpoint);
1247
			while (history[0] < historyMouseEvent.size()) {
1248
				historyMouseEvent.remove(historyMouseEvent.size() - 1);
1249
			}
1250
			while (historyCheckpoint < historyDrawTool.size()) {
1251
				historyDrawTool.remove(historyDrawTool.size() - 1);
1252
			}
1253
			while (historyCheckpoint < historyDrawText.size()) {
1254
				historyDrawText.remove(historyDrawText.size() - 1);
1255
			}
1256
			while (historyCheckpoint < historyDrawFont.size()) {
1257
				historyDrawFont.remove(historyDrawFont.size() - 1);
1258
			}
1259
			redoAction.setEnabled(false);
1260
		}
1261
1262
		undoAction.setEnabled(historyCheckpoint > 0);
1263
	}
1264
1265
	/**
1266
	 * Draw Annotation with history
1267
	 */
1268
	private void drawAnnotationHistory() {
1269
		workImageGC.drawImage(originalImage, 0, 0);
1270
		int[] history;
1271
		for (int c = 0; c < historyCheckpoint; c++) {
1272
			history = historyDrawTool.get(c);
1273
			int toolKind = history[1];
1274
			int boldlKind = history[3];
1275
			workImageGC.setLineStyle(history[2]);
1276
			workImageGC.setLineWidth(boldlKind);
1277
			workImageGC.setForeground(new Color(getShell().getDisplay(), //
1278
					history[4] >> 16, //
1279
					(history[4] >> 8) & 0x00ff, //
1280
					history[4] & 0x00ff));
1281
1282
			int h = history[0];
1283
			history = historyMouseEvent.get(h);
1284
			int start_x = history[1];
1285
			int start_y = history[2];
1286
			for (h++; h < historyMouseEvent.size(); h++) {
1287
				history = historyMouseEvent.get(h);
1288
				if (history[0] == SWT.MouseUp) {
1289
					break;
1290
				}
1291
				int x = history[1];
1292
				int y = history[2];
1293
				if (toolKind == SelectDrawToolAction.FREE) {
1294
					workImageGC.drawLine(start_x, start_y, x, y);
1295
					start_x = x;
1296
					start_y = y;
1297
				} else {
1298
					if (start_x == x && start_y == y) {
1299
						workImageGC.drawLine(start_x, start_y, x, y);
1300
					} else {
1301
						Color backColor;
1302
						int rounded;
1303
						int width = x - start_x;
1304
						int height = y - start_y;
1305
						switch (toolKind) {
1306
						case SelectDrawToolAction.LINE:
1307
							workImageGC.drawLine(start_x, start_y, x, y);
1308
							break;
1309
						case SelectDrawToolAction.BOX:
1310
							workImageGC.drawRectangle(start_x, start_y, width, height);
1311
							break;
1312
						case SelectDrawToolAction.RBOX:
1313
							rounded = boldlKind * 8;
1314
							workImageGC.drawRoundRectangle(start_x, start_y, width, height, rounded, rounded);
1315
							break;
1316
						case SelectDrawToolAction.OVAL:
1317
							workImageGC.drawOval(start_x, start_y, width, height);
1318
							break;
1319
						case SelectDrawToolAction.FILL_BOX:
1320
							backColor = workImageGC.getBackground();
1321
							workImageGC.setBackground(markColor);
1322
							workImageGC.fillRectangle(start_x, start_y, width, height);
1323
							workImageGC.setBackground(backColor);
1324
							break;
1325
						case SelectDrawToolAction.FILL_RBOX:
1326
							rounded = boldlKind * 8;
1327
							backColor = workImageGC.getBackground();
1328
							workImageGC.setBackground(markColor);
1329
							workImageGC.fillRoundRectangle(start_x, start_y, width, height, rounded, rounded);
1330
							workImageGC.setBackground(backColor);
1331
							break;
1332
						case SelectDrawToolAction.FILL_OVAL:
1333
							backColor = workImageGC.getBackground();
1334
							workImageGC.setBackground(markColor);
1335
							workImageGC.fillOval(start_x, start_y, width, height);
1336
							workImageGC.setBackground(backColor);
1337
							break;
1338
						case SelectDrawToolAction.TEXT:
1339
							StringBuffer text = historyDrawText.get(c);
1340
							FontData fontData = new FontData(historyDrawFont.get(c));
1341
							workImageGC.setFont(new Font(getShell().getDisplay(), fontData));
1342
							workImageGC.setClipping(start_x, start_y, width, height);
1343
							workImageGC.drawText(text.toString(), start_x, start_y, true);
1344
							workImageGC.setClipping((Rectangle) null);
1345
							break;
1346
						}
1347
					}
1348
				}
1349
			}
1350
		}
1351
1352
		workImageGC.setForeground(markColor);
1353
		workImageGC.setLineStyle(lineAction.getKind());
1354
		workImageGC.setLineWidth(boldAction.getKind());
1355
		workImageGC.setFont(markFont);
1356
		canvas.redraw();
1357
	}
1358
814
	/**
1359
	/**
815
	 * Decorates the screenshot canvas with the selection rectangle, resize grab points and other adornments
1360
	 * Decorates the screenshot canvas with the selection rectangle, resize grab points and other adornments
816
	 */
1361
	 */
Lines 850-863 Link Here
850
	}
1395
	}
851
1396
852
	/**
1397
	/**
853
	 * Connects the previous mark point to the new reference point, by drawing a new line
1398
	 * Connects the previous mark point to the new reference point, by drawing a new line, rectangle or oval
854
	 */
1399
	 */
855
	private void drawMarkLine(int x, int y) {
1400
	private void drawMarkLine(int x, int y) {
856
		if (startPoint != null) {
1401
		if (startPoint != null) {
857
			clearAction.setEnabled(true);
1402
			clearAction.setEnabled(true);
858
			workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
1403
			if (toolAction.getKind() == SelectDrawToolAction.FREE) {
859
			startPoint.x = x;
1404
				workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
860
			startPoint.y = y;
1405
				startPoint.x = x;
1406
				startPoint.y = y;
1407
			} else {
1408
				workImageGC.drawImage(previousImage, 0, 0);
1409
				if (startPoint.x == x && startPoint.y == y) {
1410
					workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
1411
				} else {
1412
					Color backColor;
1413
					int rounded;
1414
					int width = x - startPoint.x;
1415
					int height = y - startPoint.y;
1416
					switch (toolAction.getKind()) {
1417
					case SelectDrawToolAction.LINE:
1418
						workImageGC.drawLine(startPoint.x, startPoint.y, x, y);
1419
						break;
1420
					case SelectDrawToolAction.BOX:
1421
						workImageGC.drawRectangle(startPoint.x, startPoint.y, width, height);
1422
						break;
1423
					case SelectDrawToolAction.RBOX:
1424
						rounded = boldAction.getKind() * 8;
1425
						workImageGC.drawRoundRectangle(startPoint.x, startPoint.y, width, height, rounded, rounded);
1426
						break;
1427
					case SelectDrawToolAction.OVAL:
1428
						workImageGC.drawOval(startPoint.x, startPoint.y, width, height);
1429
						break;
1430
					case SelectDrawToolAction.FILL_BOX:
1431
						backColor = workImageGC.getBackground();
1432
						workImageGC.setBackground(markColor);
1433
						workImageGC.fillRectangle(startPoint.x, startPoint.y, width, height);
1434
						workImageGC.setBackground(backColor);
1435
						break;
1436
					case SelectDrawToolAction.FILL_RBOX:
1437
						rounded = boldAction.getKind() * 8;
1438
						backColor = workImageGC.getBackground();
1439
						workImageGC.setBackground(markColor);
1440
						workImageGC.fillRoundRectangle(startPoint.x, startPoint.y, width, height, rounded, rounded);
1441
						workImageGC.setBackground(backColor);
1442
						break;
1443
					case SelectDrawToolAction.FILL_OVAL:
1444
						backColor = workImageGC.getBackground();
1445
						workImageGC.setBackground(markColor);
1446
						workImageGC.fillOval(startPoint.x, startPoint.y, width, height);
1447
						workImageGC.setBackground(backColor);
1448
						break;
1449
					case SelectDrawToolAction.TEXT:
1450
						workImageGC.fillRectangle(startPoint.x, startPoint.y, width, height);
1451
						workImageGC.drawRectangle(startPoint.x, startPoint.y, width, height);
1452
						break;
1453
					}
1454
				}
1455
			}
861
			canvas.redraw();
1456
			canvas.redraw();
862
		}
1457
		}
863
	}
1458
	}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/CommonImages.java (+48 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_RBOX = create(T_TOOL, "edit_rbox.gif"); //$NON-NLS-1$
165
166
	public static final ImageDescriptor EDIT_OVAL = create(T_TOOL, "edit_oval.gif"); //$NON-NLS-1$
167
168
	public static final ImageDescriptor EDIT_FILL_BOX = create(T_TOOL, "edit_fill_box.gif"); //$NON-NLS-1$
169
170
	public static final ImageDescriptor EDIT_FILL_RBOX = create(T_TOOL, "edit_fill_rbox.gif"); //$NON-NLS-1$
171
172
	public static final ImageDescriptor EDIT_FILL_OVAL = create(T_TOOL, "edit_fill_oval.gif"); //$NON-NLS-1$
173
174
	public static final ImageDescriptor EDIT_TEXT = create(T_TOOL, "font.gif"); //$NON-NLS-1$
175
176
	public static final ImageDescriptor EDIT_UNDO = create(T_TOOL, "undo_edit.gif"); //$NON-NLS-1$
177
178
	public static final ImageDescriptor EDIT_REDO = create(T_TOOL, "redo_edit.gif"); //$NON-NLS-1$
179
158
	public static final ImageDescriptor CUT = create(T_TOOL, "cut.gif"); //$NON-NLS-1$
180
	public static final ImageDescriptor CUT = create(T_TOOL, "cut.gif"); //$NON-NLS-1$
159
181
160
	public static final ImageDescriptor STATUS_NORMAL = create(T_EVIEW, "status-normal.gif"); //$NON-NLS-1$
182
	public static final ImageDescriptor STATUS_NORMAL = create(T_EVIEW, "status-normal.gif"); //$NON-NLS-1$
Lines 201-206 Link Here
201
223
202
	public static final ImageDescriptor FIND = create(T_TOOL, "find.gif"); //$NON-NLS-1$
224
	public static final ImageDescriptor FIND = create(T_TOOL, "find.gif"); //$NON-NLS-1$
203
225
226
	public static final ImageDescriptor FILE_OBJ = create(T_TOOL, "file_obj.gif"); //$NON-NLS-1$
227
228
	public static final ImageDescriptor CLIPBOARD_OBJ = create(T_TOOL, "clipboard_obj.gif"); //$NON-NLS-1$
229
230
	public static final ImageDescriptor MINITOR_OBJ = create(T_TOOL, "monitor_obj.gif"); //$NON-NLS-1$
231
232
	public static final ImageDescriptor LINE_SOLD = create(T_TOOL, "line_sold.gif"); //$NON-NLS-1$
233
234
	public static final ImageDescriptor LINE_DOT = create(T_TOOL, "line_dot.gif"); //$NON-NLS-1$
235
236
	public static final ImageDescriptor LINE_DASH = create(T_TOOL, "line_dash.gif"); //$NON-NLS-1$
237
238
	public static final ImageDescriptor LINE_DASH1D = create(T_TOOL, "line_dash1d.gif"); //$NON-NLS-1$
239
240
	public static final ImageDescriptor LINE_DASH2D = create(T_TOOL, "line_dash2d.gif"); //$NON-NLS-1$
241
242
	public static final ImageDescriptor LINE_BOLD1 = create(T_TOOL, "line_bold1.gif"); //$NON-NLS-1$
243
244
	public static final ImageDescriptor LINE_BOLD2 = create(T_TOOL, "line_bold2.gif"); //$NON-NLS-1$
245
246
	public static final ImageDescriptor LINE_BOLD4 = create(T_TOOL, "line_bold4.gif"); //$NON-NLS-1$
247
248
	public static final ImageDescriptor LINE_BOLD8 = create(T_TOOL, "line_bold8.gif"); //$NON-NLS-1$
249
250
	public static final ImageDescriptor FONT_PROP = create(T_TOOL, "font_props.gif"); //$NON-NLS-1$
251
204
	private static ImageDescriptor create(String prefix, String name) {
252
	private static ImageDescriptor create(String prefix, String name) {
205
		try {
253
		try {
206
			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
254
			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
(-)src/org/eclipse/mylyn/internal/commons/ui/messages.properties (-3 / +43 lines)
Lines 15-29 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_Change_text_font=Change text font
22
ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image=Clear all annotations made on screenshot image
23
ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image=Clear all annotations made on screenshot image
23
ScreenshotCreationPage_Clear_Annotations=C&lear Annotations
24
ScreenshotCreationPage_Clear_Annotations=C&lear Annotations
25
ScreenshotCreationPage_Clear=C&lear
26
ScreenshotCreationPage_Undo=&Undo
27
ScreenshotCreationPage_Undo_annotation=Undo annotation
28
ScreenshotCreationPage_Redo=Re&do
29
ScreenshotCreationPage_Redo_annotation=Redo annotation
24
ScreenshotCreationPage_Crop=Crop
30
ScreenshotCreationPage_Crop=Crop
25
ScreenshotCreationPage_Crop_R=C&rop
31
ScreenshotCreationPage_Crop_R=C&rop
26
ScreenshotCreationPage_DRAW_ANNOTATION_ON_SCREENSHOT_IMAGE=Draw annotations on screenshot image
32
ScreenshotCreationPage_DRAW_ANNOTATION_ON_SCREENSHOT_IMAGE=Draw annotations on screenshot image
27
ScreenshotCreationPage_Fit_Image=Fit Image
33
ScreenshotCreationPage_Fit_Image=Fit Image
28
ScreenshotCreationPage_Fit_Image_F=&Fit Image
34
#ScreenshotCreationPage_Fit_Image_F=&Fit Image
35
ScreenshotCreationPage_Fit_Image_F=&Fit
36
ScreenshotCreationPage_Font_Bold=, Bold
37
ScreenshotCreationPage_Font_Italic=, Italic
38
ScreenshotCreationPage_Font_Name_Size={0}, {1} pt
29
ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE=Note that you can continue to interact with the workbench in order to set up the screenshot.
39
ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE=Note that you can continue to interact with the workbench in order to set up the screenshot.
40
41
SelectBoldToolAction_1dot=1 dot
42
SelectBoldToolAction_2dots=2 dots
43
SelectBoldToolAction_4dots=4 dots
44
SelectBoldToolAction_8dots=8 dots
45
46
SelectCaptureAction_Clipboard=Clipboard
47
SelectCaptureAction_Desktop=Desktop
48
SelectCaptureAction_File=File...
49
50
SelectDrawToolAction_Box=Rectangle
51
SelectDrawToolAction_RBox=Round Rectangle
52
SelectDrawToolAction_Oval=Oval
53
SelectDrawToolAction_FillBox=Fill Rectangle
54
SelectDrawToolAction_FillRBox=Fill Round Rectangle
55
SelectDrawToolAction_FillOval=Fill Oval
56
SelectDrawToolAction_Free=Free
57
SelectDrawToolAction_Line=Line
58
SelectDrawToolAction_Text=Text
59
SelectLineToolAction_Dash=Dashed line
60
SelectLineToolAction_Dash_Dot=1 dots dashed line
61
SelectLineToolAction_Dash_Dot2=2 dots dashed line
62
SelectLineToolAction_Dot=Dotted line
63
SelectLineToolAction_Solid=Solid line
64
65
SelectZoomToolAction_Fit=Fit
66
SelectZoomToolAction_Zoom1X=100%
67
SelectZoomToolAction_Zoom2X=200%
68
SelectZoomToolAction_Zoom4X=400%
69
SelectZoomToolAction_Zoom8X=800%
(-)src/org/eclipse/mylyn/internal/commons/ui/Messages.java (+70 lines)
Lines 55-64 Link Here
55
55
56
	public static String ScreenshotCreationPage_Change_pen_color;
56
	public static String ScreenshotCreationPage_Change_pen_color;
57
57
58
	public static String ScreenshotCreationPage_Change_text_font;
59
58
	public static String ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image;
60
	public static String ScreenshotCreationPage_Clear_all_annotations_made_on_screenshot_image;
59
61
60
	public static String ScreenshotCreationPage_Clear_Annotations;
62
	public static String ScreenshotCreationPage_Clear_Annotations;
61
63
64
	public static String ScreenshotCreationPage_Clear;
65
66
	public static String ScreenshotCreationPage_Undo;
67
68
	public static String ScreenshotCreationPage_Undo_annotation;
69
70
	public static String ScreenshotCreationPage_Redo;
71
72
	public static String ScreenshotCreationPage_Redo_annotation;
73
62
	public static String ScreenshotCreationPage_Crop;
74
	public static String ScreenshotCreationPage_Crop;
63
75
64
	public static String ScreenshotCreationPage_Crop_R;
76
	public static String ScreenshotCreationPage_Crop_R;
Lines 69-73 Link Here
69
81
70
	public static String ScreenshotCreationPage_Fit_Image_F;
82
	public static String ScreenshotCreationPage_Fit_Image_F;
71
83
84
	public static String ScreenshotCreationPage_Font_Bold;
85
86
	public static String ScreenshotCreationPage_Font_Italic;
87
88
	public static String ScreenshotCreationPage_Font_Name_Size;
89
72
	public static String ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE;
90
	public static String ScreenshotCreationPage_NOTE_THAT_YOU_CONTINUTE;
91
92
	public static String SelectBoldToolAction_1dot;
93
94
	public static String SelectBoldToolAction_2dots;
95
96
	public static String SelectBoldToolAction_4dots;
97
98
	public static String SelectBoldToolAction_8dots;
99
100
	public static String SelectCaptureAction_Clipboard;
101
102
	public static String SelectCaptureAction_Desktop;
103
104
	public static String SelectCaptureAction_File;
105
106
	public static String SelectDrawToolAction_Box;
107
108
	public static String SelectDrawToolAction_RBox;
109
110
	public static String SelectDrawToolAction_Oval;
111
112
	public static String SelectDrawToolAction_FillBox;
113
114
	public static String SelectDrawToolAction_FillRBox;
115
116
	public static String SelectDrawToolAction_FillOval;
117
118
	public static String SelectDrawToolAction_Free;
119
120
	public static String SelectDrawToolAction_Line;
121
122
	public static String SelectDrawToolAction_Text;
123
124
	public static String SelectLineToolAction_Dash;
125
126
	public static String SelectLineToolAction_Dash_Dot;
127
128
	public static String SelectLineToolAction_Dash_Dot2;
129
130
	public static String SelectLineToolAction_Dot;
131
132
	public static String SelectLineToolAction_Solid;
133
134
	public static String SelectZoomToolAction_Fit;
135
136
	public static String SelectZoomToolAction_Zoom1X;
137
138
	public static String SelectZoomToolAction_Zoom2X;
139
140
	public static String SelectZoomToolAction_Zoom4X;
141
142
	public static String SelectZoomToolAction_Zoom8X;
73
}
143
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectCaptureAction.java (+115 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.resource.ImageDescriptor;
5
import org.eclipse.mylyn.internal.commons.ui.Messages;
6
import org.eclipse.swt.dnd.Clipboard;
7
import org.eclipse.swt.dnd.ImageTransfer;
8
import org.eclipse.swt.graphics.Image;
9
import org.eclipse.swt.graphics.ImageData;
10
import org.eclipse.swt.widgets.FileDialog;
11
import org.eclipse.swt.widgets.Shell;
12
13
public class SelectCaptureAction extends SelectToolAction {
14
15
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectcapture"; //$NON-NLS-1$
16
17
	public static final int CAPTURE = 0;
18
19
	public static final int CLIPBOARD = 1;
20
21
	public static final int FILE = 2;
22
23
	private final Shell shell;
24
25
	private String filename;
26
27
	public SelectCaptureAction(Shell shell, String label) {
28
		super(label, ID, new int[] { CAPTURE, CLIPBOARD, FILE }, // kinds
29
				new String[] { Messages.SelectCaptureAction_Desktop, Messages.SelectCaptureAction_Clipboard,
30
						Messages.SelectCaptureAction_File }, // labels
31
				new ImageDescriptor[] { CommonImages.MINITOR_OBJ, CommonImages.CLIPBOARD_OBJ, CommonImages.FILE_OBJ }); // images
32
33
		this.shell = shell;
34
	}
35
36
	public void resetKind() {
37
		reset(CAPTURE);
38
	}
39
40
	@Override
41
	protected void setKind(String label, ImageDescriptor image) {
42
		super.setKind(label, image);
43
44
		if (getKind() == FILE) {
45
			FileDialog dialog = new FileDialog(shell);
46
			dialog.setFileName(filename);
47
			dialog.setFilterExtensions(new String[] { "*.bmp;*.jpg;*.png", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$
48
			String result = dialog.open();
49
			if (result != null && result.length() > 0) {
50
				filename = result;
51
				run();
52
			}
53
		} else {
54
			run();
55
		}
56
	}
57
58
	@Override
59
	protected void updateLabel(String label, ImageDescriptor image) {
60
	}
61
62
	@Override
63
	protected void updateAction(Action action, int id) {
64
		if (id == CLIPBOARD) {
65
			action.setEnabled(existImageOnClipboard());
66
		}
67
	}
68
69
	public Image getScreenshotImage() {
70
		if (getKind() == CAPTURE) {
71
			return null;
72
		}
73
74
		if (getKind() == CLIPBOARD) {
75
			return getClipboardImage();
76
		}
77
78
		try {
79
			Image image = new Image(shell.getDisplay(), filename);
80
			return image;
81
		} catch (Exception e) {
82
			// None
83
		}
84
		return null;
85
	}
86
87
	private Image getClipboardImage() {
88
		try {
89
			Clipboard clipboard = new Clipboard(shell.getDisplay());
90
			ImageTransfer imageTransfer = ImageTransfer.getInstance();
91
			Object data = clipboard.getContents(imageTransfer);
92
			if (data instanceof ImageData) {
93
				Image image = new Image(shell.getDisplay(), (ImageData) data);
94
				return image;
95
			}
96
		} catch (Exception e) {
97
			// None
98
		}
99
		return null;
100
	}
101
102
	private boolean existImageOnClipboard() {
103
		try {
104
			Clipboard clipboard = new Clipboard(shell.getDisplay());
105
			ImageTransfer imageTransfer = ImageTransfer.getInstance();
106
			Object data = clipboard.getContents(imageTransfer);
107
			if (data instanceof ImageData) {
108
				return true;
109
			}
110
		} catch (Exception e) {
111
			// None
112
		}
113
		return false;
114
	}
115
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectToolAction.java (+162 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.swt.graphics.Point;
8
import org.eclipse.swt.graphics.Rectangle;
9
import org.eclipse.swt.widgets.Control;
10
import org.eclipse.swt.widgets.Event;
11
import org.eclipse.swt.widgets.Menu;
12
import org.eclipse.swt.widgets.ToolItem;
13
import org.eclipse.swt.widgets.Widget;
14
15
public class SelectToolAction extends Action implements IMenuCreator {
16
17
	private final int[] kinds;
18
19
	private final String[] labels;
20
21
	private final ImageDescriptor[] images;
22
23
	private int kind;
24
25
	private Menu dropDownMenu;
26
27
	private boolean showMenuAlways;
28
29
	public boolean isShowMenuAlways() {
30
		return showMenuAlways;
31
	}
32
33
	public void setShowMenuAlways(boolean showMenuAlways) {
34
		this.showMenuAlways = showMenuAlways;
35
	}
36
37
	public SelectToolAction(String label, String ID, int[] kinds, String[] labels, ImageDescriptor[] images) {
38
		super(label, AS_DROP_DOWN_MENU);
39
		this.kinds = kinds;
40
		this.labels = labels;
41
		this.images = images;
42
		setMenuCreator(this);
43
		setId(ID);
44
		if (images != null) {
45
			setImageDescriptor(images[0]);
46
		}
47
		setToolTipText(labels[0]);
48
		kind = kinds[0];
49
		showMenuAlways = true;
50
	}
51
52
	public SelectToolAction(String ID, int[] kinds, String[] labels, ImageDescriptor[] images) {
53
		super("", AS_DROP_DOWN_MENU); //$NON-NLS-1$
54
		this.kinds = kinds;
55
		this.labels = labels;
56
		this.images = images;
57
		setMenuCreator(this);
58
		setId(ID);
59
		if (images != null) {
60
			setImageDescriptor(images[0]);
61
		}
62
		setToolTipText(labels[0]);
63
		kind = kinds[0];
64
		showMenuAlways = true;
65
	}
66
67
	@Override
68
	public void runWithEvent(Event event) {
69
		if (showMenuAlways) {
70
			IMenuCreator mc = getMenuCreator();
71
			if (mc != null) {
72
				Widget item = event.widget;
73
				ToolItem ti = (ToolItem) item;
74
				Menu m = mc.getMenu(ti.getParent());
75
				if (m != null) {
76
					// position the menu below the drop down item
77
					Rectangle itemBounds = ti.getBounds();
78
					Point point = ti.getParent().toDisplay(itemBounds.x, itemBounds.y + itemBounds.height);
79
					m.setLocation(point.x, point.y); // waiting for SWT
80
					m.setVisible(true);
81
					return; // we don't fire the action
82
				}
83
			}
84
		}
85
		super.runWithEvent(event);
86
	}
87
88
	public void reset(int kind) {
89
		this.kind = kind;
90
	}
91
92
	public int getKind() {
93
		return kind;
94
	}
95
96
	protected void setKind(String label, ImageDescriptor image) {
97
		kind = kinds[0];
98
		for (int m = 0; m < labels.length; m++) {
99
			if (labels[m].equals(label)) {
100
				kind = kinds[m];
101
				updateLabel(label, image);
102
				break;
103
			}
104
		}
105
	}
106
107
	private void addActionsToMenu() {
108
		for (int m = 0; m < labels.length; m++) {
109
			SelectionAction action = new SelectionAction();
110
			ActionContributionItem item = new ActionContributionItem(action);
111
			action.setText(labels[m]);
112
			if (images != null) {
113
				action.setImageDescriptor(images[m]);
114
			}
115
			updateAction(action, kinds[m]);
116
			item.fill(dropDownMenu, -1);
117
		}
118
	}
119
120
	protected void updateAction(Action action, int id) {
121
		action.setChecked(id == kind);
122
	}
123
124
	protected void updateLabel(String label, ImageDescriptor image) {
125
		setToolTipText(label);
126
		if (image != null) {
127
			setImageDescriptor(image);
128
		}
129
	}
130
131
	public void dispose() {
132
		if (dropDownMenu != null) {
133
			dropDownMenu.dispose();
134
			dropDownMenu = null;
135
		}
136
	}
137
138
	public Menu getMenu(Control parent) {
139
		if (dropDownMenu != null) {
140
			dropDownMenu.dispose();
141
		}
142
		dropDownMenu = new Menu(parent);
143
		addActionsToMenu();
144
		return dropDownMenu;
145
	}
146
147
	public Menu getMenu(Menu parent) {
148
		if (dropDownMenu != null) {
149
			dropDownMenu.dispose();
150
		}
151
		dropDownMenu = new Menu(parent);
152
		addActionsToMenu();
153
		return dropDownMenu;
154
	}
155
156
	private class SelectionAction extends Action {
157
		@Override
158
		public void run() {
159
			setKind(getText(), getImageDescriptor());
160
		}
161
	}
162
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectDrawToolAction.java (+45 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.resource.ImageDescriptor;
4
import org.eclipse.mylyn.internal.commons.ui.Messages;
5
6
public class SelectDrawToolAction extends SelectToolAction {
7
8
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectdrawtool"; //$NON-NLS-1$
9
10
	public static final int FREE = 0;
11
12
	public static final int LINE = 1;
13
14
	public static final int BOX = 2;
15
16
	public static final int RBOX = 3;
17
18
	public static final int OVAL = 4;
19
20
	public static final int FILL_BOX = 5;
21
22
	public static final int FILL_RBOX = 6;
23
24
	public static final int FILL_OVAL = 7;
25
26
	public static final int TEXT = 8;
27
28
	public SelectDrawToolAction() {
29
		super(ID, new int[] { FREE, LINE, BOX, RBOX, OVAL, FILL_BOX, FILL_RBOX, FILL_OVAL, TEXT }, // kinds
30
				new String[] { Messages.SelectDrawToolAction_Free, Messages.SelectDrawToolAction_Line,
31
						Messages.SelectDrawToolAction_Box, Messages.SelectDrawToolAction_RBox,
32
						Messages.SelectDrawToolAction_Oval, Messages.SelectDrawToolAction_FillBox,
33
						Messages.SelectDrawToolAction_FillRBox, Messages.SelectDrawToolAction_FillOval,
34
						Messages.SelectDrawToolAction_Text }, // labels 
35
				new ImageDescriptor[] { CommonImages.EDIT_FREE, CommonImages.EDIT_LINE, CommonImages.EDIT_BOX,
36
						CommonImages.EDIT_RBOX, CommonImages.EDIT_OVAL, CommonImages.EDIT_FILL_BOX,
37
						CommonImages.EDIT_FILL_RBOX, CommonImages.EDIT_FILL_OVAL, CommonImages.EDIT_TEXT }); // images
38
	}
39
40
	@Override
41
	protected void setKind(String label, ImageDescriptor image) {
42
		super.setKind(label, image);
43
		run();
44
	}
45
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectLineToolAction.java (+19 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.resource.ImageDescriptor;
4
import org.eclipse.mylyn.internal.commons.ui.Messages;
5
import org.eclipse.swt.SWT;
6
7
public class SelectLineToolAction extends SelectToolAction {
8
9
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectlinetool"; //$NON-NLS-1$
10
11
	public SelectLineToolAction() {
12
		super(ID, new int[] { SWT.LINE_SOLID, SWT.LINE_DOT, SWT.LINE_DASH, SWT.LINE_DASHDOT, SWT.LINE_DASHDOTDOT }, // kinds
13
				new String[] { Messages.SelectLineToolAction_Solid, Messages.SelectLineToolAction_Dot,
14
						Messages.SelectLineToolAction_Dash, Messages.SelectLineToolAction_Dash_Dot,
15
						Messages.SelectLineToolAction_Dash_Dot2 }, // labels 
16
				new ImageDescriptor[] { CommonImages.LINE_SOLD, CommonImages.LINE_DOT, CommonImages.LINE_DASH,
17
						CommonImages.LINE_DASH1D, CommonImages.LINE_DASH2D }); // images
18
	}
19
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectZoomToolAction.java (+38 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.resource.ImageDescriptor;
4
import org.eclipse.mylyn.internal.commons.ui.Messages;
5
6
public class SelectZoomToolAction extends SelectToolAction {
7
8
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectzoomtool"; //$NON-NLS-1$
9
10
	public static final int FIT = 0;
11
12
	public static final int ZOOM1X = 1;
13
14
	public static final int ZOOM2X = 2;
15
16
	public static final int ZOOM4X = 3;
17
18
	public static final int ZOOM8X = 4;
19
20
	public SelectZoomToolAction() {
21
		super(ID, new int[] { FIT, ZOOM1X, ZOOM2X, ZOOM4X, ZOOM8X }, // kinds
22
				new String[] { Messages.SelectZoomToolAction_Fit, Messages.SelectZoomToolAction_Zoom1X,
23
						Messages.SelectZoomToolAction_Zoom2X, Messages.SelectZoomToolAction_Zoom4X,
24
						Messages.SelectZoomToolAction_Zoom8X }, // labels
25
				null); // images
26
	}
27
28
	@Override
29
	protected void setKind(String label, ImageDescriptor image) {
30
		super.setKind(label, image);
31
		run();
32
	}
33
34
	@Override
35
	protected void updateLabel(String label, ImageDescriptor image) {
36
		setText(label);
37
	}
38
}
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/SelectBoldToolAction.java (+18 lines)
Added Link Here
1
package org.eclipse.mylyn.internal.provisional.commons.ui;
2
3
import org.eclipse.jface.resource.ImageDescriptor;
4
import org.eclipse.mylyn.internal.commons.ui.Messages;
5
6
public class SelectBoldToolAction extends SelectToolAction {
7
8
	public static final String ID = "org.eclipse.mylyn.common.ui.actions.selectboldtool"; //$NON-NLS-1$
9
10
	public SelectBoldToolAction() {
11
		super(ID, new int[] { 1, 2, 4, 8 }, // kinds
12
				new String[] { Messages.SelectBoldToolAction_1dot, Messages.SelectBoldToolAction_2dots,
13
						Messages.SelectBoldToolAction_4dots, Messages.SelectBoldToolAction_8dots }, // labels
14
				new ImageDescriptor[] { CommonImages.LINE_BOLD1, CommonImages.LINE_BOLD2, CommonImages.LINE_BOLD4,
15
						CommonImages.LINE_BOLD8 }); // images
16
		setKind(Messages.SelectBoldToolAction_4dots, CommonImages.LINE_BOLD4);
17
	}
18
}

Return to bug 266123