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