blob: 6c7b2a95dafcc1a2394bfaa804526870eae016fb (
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
82
83
84
85
86
87
88
89
|
/**********************************************************************
* Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* 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:
* IBM - Initial API and implementation
* Bernd Hufmann - Updated for TMF
**********************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;
/**
* Default implementation of the IFont interface.
*
* @version 1.0
* @author sveyrier
*
*/
public class FontImpl implements IFont {
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
/**
* The font object
*/
private final Font fFont;
/**
* Flag to indicate that this object is managing the resource.
*/
protected boolean fManageFont = true;
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
/**
* Default constructor.
*
* @param display The display to use
* @param data A font data
*/
public FontImpl(Display display, FontData data) {
fFont = new Font(display, data);
}
/**
* Copy constructor
*
* @param value A font to copy.
*/
protected FontImpl(Font value) {
fFont = value;
fManageFont = false;
}
// ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
/**
* Returns a font implementation based system font.
*
* @return a font implementation based system font.
*/
public static FontImpl getSystemFont() {
return new FontImpl(Display.getDefault().getSystemFont());
}
@Override
public Object getFont() {
return fFont;
}
@Override
public void dispose() {
if (fFont != null) {
fFont.dispose();
}
}
}
|