⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playlistlabelprovider.java

📁 Eclipse高级编程3源码(书本源码)
💻 JAVA
字号:
/*******************************************************************************
 * Copyright (c) 2004 Berthold Daum. All rights reserved. This program and the
 * accompanying materials are made available under the terms of the Common
 * Public License v1.0 which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: Berthold Daum
 ******************************************************************************/
package com.bdaum.jukebox;

import java.io.File;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.w3c.dom.Node;

/**
 * @author Berthold Daum
 * 
 * Creation date: 02.10.2003
 * 
 * This class provides the table of the playlist viewer with
 * cell contents.
 */
public class PlaylistLabelProvider
                implements
                  ITableLabelProvider {

  // Playlist domain model
  private IPlaylist playlistmodel;
  // Here we store the warning icon
  private Image alertImage;

  /**
   * Constructor.
   */
  public PlaylistLabelProvider(IPlaylist playlistmodel) {
    super();
    this.playlistmodel = playlistmodel;
  }

  /**
   * Returns warning icons for missing files
   * 
   * @see org.eclipse.jface.viewers.ITableLabelProvider#
   *      getColumnImage(java.lang.Object, int)
   */
  public Image getColumnImage(Object element, int columnIndex) {
    Node nod = (Node) element;
    // For the features <soundfile> and <image> we test for
    // the existence of the specified files. If the file does
    // not
    // exist we return a warning icon
    switch (columnIndex) {
      case 1 :
        return getFileAlert(playlistmodel.getFeature(nod,
                        Player.SOUNDFILE));
      case 2 :
        return getFileAlert(playlistmodel.getFeature(nod,
                        Player.IMAGEFILE));
      default :
        return null;
    }
  }

  /**
   * Load a warning icon from file
   * 
   * @param string
   *        File name
   * @return Image 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -