Home | History | Annotate | Download | only in ui
      1 /*******************************************************************************
      2  * Copyright (c) 2011 Google, Inc.
      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  *    Google, Inc. - initial API and implementation
     10  *******************************************************************************/
     11 package org.eclipse.wb.internal.core.utils.ui;
     12 
     13 import org.eclipse.jface.resource.ImageDescriptor;
     14 import org.eclipse.swt.graphics.Image;
     15 import org.eclipse.swt.graphics.ImageData;
     16 
     17 /**
     18  * Implementation of {@link ImageDescriptor} for {@link Image} instance.
     19  *
     20  * @author scheglov_ke
     21  * @coverage core.ui
     22  */
     23 public final class ImageImageDescriptor extends ImageDescriptor {
     24   private final Image m_Image;
     25 
     26   ////////////////////////////////////////////////////////////////////////////
     27   //
     28   // Constructor
     29   //
     30   ////////////////////////////////////////////////////////////////////////////
     31   public ImageImageDescriptor(Image image) {
     32     m_Image = image;
     33   }
     34 
     35   ////////////////////////////////////////////////////////////////////////////
     36   //
     37   // ImageDescriptor
     38   //
     39   ////////////////////////////////////////////////////////////////////////////
     40   @Override
     41   public ImageData getImageData() {
     42     return m_Image == null ? null : m_Image.getImageData();
     43   }
     44 }
     45