+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.browsing.ui.graph.impl;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.swt.graphics.ImageData;\r
+import org.eclipse.swt.graphics.PaletteData;\r
+import org.eclipse.swt.graphics.RGB;\r
+\r
+/**\r
+ * A simple 16x16 white image descriptor for a missing image.\r
+ * <p>\r
+ * Use <code>MissingImageDescriptor.getInstance</code> to\r
+ * access the singleton instance maintained in an\r
+ * internal state variable.\r
+ * </p>\r
+ */\r
+public class MissingImageDescriptor extends ImageDescriptor {\r
+ private static MissingImageDescriptor instance;\r
+\r
+ protected static final ImageData IMAGE_DATA = new ImageData(16, 16,\r
+ 1, new PaletteData(new RGB[] { new RGB(255, 255, 255) }));\r
+\r
+ /**\r
+ * Constructs a new default image descriptor.\r
+ */\r
+ private MissingImageDescriptor() {\r
+ super();\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * Method declared on ImageDesciptor.\r
+ */\r
+ @Override\r
+ public ImageData getImageData() {\r
+ return IMAGE_DATA;\r
+ }\r
+\r
+ /**\r
+ * Returns the shared default image descriptor instance.\r
+ *\r
+ * @return the image descriptor for a default image\r
+ */\r
+ public static MissingImageDescriptor getInstance() {\r
+ if (instance == null) {\r
+ instance = new MissingImageDescriptor();\r
+ }\r
+ return instance;\r
+ }\r
+}\r