KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > resource > MissingImageDescriptor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jface.resource;
12
13 import org.eclipse.swt.graphics.ImageData;
14
15 /**
16  * The image descriptor for a missing image.
17  * <p>
18  * Use <code>MissingImageDescriptor.getInstance</code> to
19  * access the singleton instance maintained in an
20  * internal state variable.
21  * </p>
22  */

23 class MissingImageDescriptor extends ImageDescriptor {
24     private static MissingImageDescriptor instance;
25
26     /**
27      * Constructs a new missing image descriptor.
28      */

29     private MissingImageDescriptor() {
30         super();
31     }
32
33     /* (non-Javadoc)
34      * Method declared on ImageDesciptor.
35      */

36     public ImageData getImageData() {
37         return DEFAULT_IMAGE_DATA;
38     }
39
40     /**
41      * Returns the shared missing image descriptor instance.
42      *
43      * @return the image descriptor for a missing image
44      */

45     static MissingImageDescriptor getInstance() {
46         if (instance == null) {
47             instance = new MissingImageDescriptor();
48         }
49         return instance;
50     }
51 }
52
Popular Tags