lttng: Update copyright headers
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / drawings / impl / FontImpl.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
73005152
BH
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
73005152
BH
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
15
16import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont;
17import org.eclipse.swt.graphics.Font;
18import org.eclipse.swt.graphics.FontData;
19import org.eclipse.swt.widgets.Display;
20
21/**
df0b8ff4
BH
22 * Default implementation of the IFont interface.
23 *
24 * @version 1.0
73005152
BH
25 * @author sveyrier
26 *
27 */
28public class FontImpl implements IFont {
29
df0b8ff4
BH
30 // ------------------------------------------------------------------------
31 // Attributes
32 // ------------------------------------------------------------------------
33
34 /**
35 * The font object
36 */
eb63f5ff 37 protected Font fFont = null;
df0b8ff4
BH
38 /**
39 * Flag to indicate that this object is managing the resource.
40 */
eb63f5ff 41 protected boolean fManageFont = true;
73005152 42
df0b8ff4
BH
43 // ------------------------------------------------------------------------
44 // Constructors
45 // ------------------------------------------------------------------------
46 /**
47 * Default constructor.
48 *
49 * @param display The display to use
50 * @param data A font data
51 */
73005152 52 public FontImpl(Display display, FontData data) {
eb63f5ff 53 fFont = new Font(display, data);
73005152
BH
54 }
55
df0b8ff4
BH
56 /**
57 * Copy constructor
58 *
59 * @param value A font to copy.
60 */
73005152 61 protected FontImpl(Font value) {
eb63f5ff
BH
62 fFont = value;
63 fManageFont = false;
73005152
BH
64 }
65
df0b8ff4
BH
66 // ------------------------------------------------------------------------
67 // Methods
68 // ------------------------------------------------------------------------
69 /**
70 * Returns a font implementation based system font.
71 *
72 * @return a font implementation based system font.
73 */
73005152
BH
74 public static FontImpl getSystemFont() {
75 return new FontImpl(Display.getDefault().getSystemFont());
76 }
77
df0b8ff4
BH
78 /*
79 * (non-Javadoc)
80 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont#getFont()
81 */
82 @Override
83 public Object getFont() {
eb63f5ff 84 return fFont;
df0b8ff4
BH
85 }
86
87 /*
88 * (non-Javadoc)
89 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IFont#dispose()
90 */
73005152
BH
91 @Override
92 public void dispose() {
eb63f5ff
BH
93 if (fFont != null) {
94 fFont.dispose();
df0b8ff4 95 }
73005152 96 }
73005152 97}
This page took 0.036657 seconds and 5 git commands to generate.